PermissionedWETHGateway
Last updated
Last updated
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.
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.
OnBehalfOf
must be whitelisted for DEPOSITOR role.
permissionAdmin
that whitelisted 👆🏻 must be still valid.
Call params
Params | Type | Description |
---|---|---|
Withdraws amount
of the WETH, unwraps it to ETH, and transfers the ETH to theto
address.
Ensure you set the relevant aToken
allowance, before calling this function, so the PermissionedWETHGateway
contract can burn the associated aWETH.
Call params
Repays onBehalfOf
's debt amount
of ETH which has a rateMode
.
OnBehalfOf
must be whitelisted for BORROWER role.
permissionAdmin
that whitelisted 👆🏻 must be still valid.
Call params
Allows whitelisted borrowers to borrow amount
of ETH with interestRateMode
.
The amount
of ETH is sent to msg.sender
.
msg.sender
must be whitelisted for BORROWER role.
permissionAdmin
that whitelisted 👆🏻 must be still valid.
Call params
Params | Type | Description |
---|---|---|
Params | Type | Description |
---|---|---|
Params | Type | Description |
---|---|---|
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.
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
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.
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.