WrappedTokenGatewayV3
The WHYPE Gateway contract is a helper to easily wrap and unwrap HYPE as necessary when interacting with the protocol.
Write Methods
depositHYPE
function depositHYPE(address pool, address onBehalfOf, uint16 referralCode)
Supplies the msg.value
amount of HYPE (or native chain token) into the HypurrFi pool, minting the same amount of corresponding hyWHYPE and transferring them to the onBehalfOf
address.
Ensure that the depositHYPE()
transaction also includes the amount of HYPE you are supplying in the msg.value
.
Call Params
Name | Type | Description |
---|---|---|
pool | address | address of the targeted pool |
onBehalfOf | address | address who will receive the hyWHYPE. Use msg.sender when the hyTokens should be sent to the caller. |
referralCode | uint16 | unique code for 3rd party referral program integration. |
withdrawHYPE
function withdrawHYPE(address pool, uint256 amount, address to)
Withdraws amount
of the WHYPE (or wrapped native chain token), unwraps it and transfers HYPE (or native chain token) to the to
address.
π‘ Ensure you set the relevant `hyToken` allowance, before calling this function, so the `WrappedTokenGatewayV3` contract can transfer the associated hyWHYPE.
Call Params
Name | Type | Description |
---|---|---|
pool | address | address of the targeted pool |
amount | uint256 | amount to be withdrawn, expressed in wei units. Use type(uint).max to withdraw the entire balance. |
to | address | address that will receive the unwrapped HYPE |
repayHYPE
function repayHYPE(address pool, uint256 amount, uint256 rateMode, address onBehalfOf)
Repays onBehalfOf
βs debt amount
of HYPE () which has a rateMode
.
Ensure that the repayHYPE()
transaction also includes the amount of HYPE you are repaying in the msg.value
.
Parameter Name | Type | Description |
---|---|---|
lendingPool | address | address of the targeted underlying lending pool |
amount | uint256 | amount to be borrowed, expressed in wei units. |
rateMode | uint256 | the type of borrow debt. |
onBehalfOf | address | address of user who will incur the debt. |
borrowHYPE
function borrowHYPE(address pool, uint256 amount, uint256 interestRateMode, uint16 referralCode)
Borrows amount
of WHYPE with interestRateMode
, sending the amount
of unwrapped WHYPE to msg.sender
.
Call Params
Name | Type | Description |
---|---|---|
pool | address | address of the targeted pool |
amount | uint256 | amount to be borrowed, expressed in wei units |
interestRateMode | uint256 | the type of borrow debt. |
referralCode | uint16 | unique code for 3rd party referral program integration. |
withdrawHYPEWithPermit
function withdrawHYPEWithPermit(address pool, uint256 amount, address to, uint256 deadline, uint8 permitV, bytes32 permitR, bytes32 permitS)
Withdraws amount
of the WHYPE (or wrapped native chain token) without a separate approval tx. The HYPE (or native chain token) is sent to the to
address.
Call Params
Name | Type | Description |
---|---|---|
pool | address | address of the targeted pool |
amount | uint256 | amount of hyWHYPE (or hyToken corresponding to native token of chain) that will be burnt to withdraw HYPE (or native chain token) |
to | address | address that will receive the HYPE (or native chain token) |
deadline | uint256 | unix timestamp till which the signature is valid |
permitV | uint8 | Signature parameter v |
permitR | bytes32 | Signature parameter r |
permitS | bytes32 | Signature parameter s |
emergencyTokenTransfer
function emergencyTokenTransfer(address Token, address to, uint256 amount)
Method for ERC20 recovery in case of stuck tokens due direct transfers to the contract address.
Can be called only by the owner of the contract i.e. HypurrFi Governance.
emergencyHypeTransfer
function emergencyHypeTransfer(address to, uint256 amount)
Method for HYPE (or native chain token) recovery in case of stuck HYPE due selfdestruct or transfer ether to pre-computated contract address before deployment.
Can be called only by the owner of the contract i.e. HypurrFi Governance.
View
getWHYPEAddress
function getWHYPEAddress()
Returns the WHYPE address used by the WrappedTokenGatewayV3.