PermissionedWETHGateway
PermissionedWETHGateway
The WETH Gateway contract is a helper contract, which wraps and unwraps ETH ( or any native cryptoasset of a network, e.g. MATIC for Polygon, AVAX for Avalanche) as necessary when interacting with the protocol.
The source code can be found on Github here.
Write Methods
depositETH()
Allows whitelisted depositors to deposit msg.value amount of ETH (or native crypto asset) into the protocol, minting the same amount of corresponding aWETH, and transferring them to the onBehalfOf address.
Call params
lendingPool
address of the targeted underlying lending pool
onBehalfOf
address whom will receive the aTokens. Use msg.sender when the aTokens should be sent to the caller.
referralCode
referral code for 3rd party referral program integration. Use 0 for no referral.
withdrawETH()
Withdraws amount of the WETH, unwraps it to ETH, and transfers the ETH to theto address.
Call params
lendingPool
address of the targeted underlying lending pool
amount
amount to be withdrawn, expressed in wei units. Use type(uint).max to withdraw the entire balance.
to
address that will receive the unwrapped ETH
repayETH()
Repays onBehalfOf's debt amount of ETH which has a rateMode.
Call params
lendingPool
address of the targeted underlying lending pool
amount
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.
rateMode
the type of borrow debt. Stable: 1, Variable: 2
onBehalfOf
address of user who will incur the debt. Use msg.sender when not calling on behalf of a different user.
borrowETH()
Allows whitelisted borrowers to borrow amount of ETH with interestRateMode.
The amount of ETH is sent to msg.sender.
Call params
lendingPool
address of the targeted underlying lending pool
amount
amount to be borrowed, expressed in wei units
interestRateMode
the type of borrow debt. Stable: 1, Variable: 2
referralCode
referral code for 3rd party referral program integration. Use 0 for no referral.
Last updated