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

NameTypeDescription
pooladdressaddress of the targeted pool
onBehalfOfaddressaddress who will receive the hyWHYPE. Use msg.sender when the hyTokens should be sent to the caller.
referralCodeuint16

unique code for 3rd party referral program integration.
0 for no referral.

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

NameTypeDescription
pooladdressaddress of the targeted pool
amountuint256amount to be withdrawn, expressed in wei units. Use type(uint).max to withdraw the entire balance.
toaddressaddress 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 NameTypeDescription
lendingPooladdressaddress of the targeted underlying lending pool
amountuint256

amount to be borrowed, expressed in wei units.
Use uint(-1) to repay the entire debt, ONLY when the repayment is not executed on behalf of a 3rd party.
In case of repayments on behalf of another user, it’s recommended to send an _amount slightly higher than the current borrowed amount.

rateModeuint256

the type of borrow debt.
Stable: 1, Variable: 2

onBehalfOfaddress

address of user who will incur the debt.
Use msg.sender when not calling on behalf of a different user.

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

NameTypeDescription
pooladdressaddress of the targeted pool
amountuint256amount to be borrowed, expressed in wei units
interestRateModeuint256

the type of borrow debt.
Stable: 1, Variable: 2

referralCodeuint16

unique code for 3rd party referral program integration.
0 for no referral code.

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

NameTypeDescription
pooladdressaddress of the targeted pool
amountuint256amount of hyWHYPE (or hyToken corresponding to native token of chain) that will be burnt to withdraw HYPE (or native chain token)
toaddressaddress that will receive the HYPE (or native chain token)
deadlineuint256unix timestamp till which the signature is valid
permitVuint8Signature parameter v
permitRbytes32Signature parameter r
permitSbytes32Signature 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.

ABI