WETHGateway
WETH
weth
pool
constructor
Sets the WETH address and the PoolAddressesProvider address. Infinite approves pool.
Parameters
Name | Type | Description |
---|---|---|
_weth | address | Address of the Wrapped Ether contract |
_pool | address | Address of the proxy pool of this contract |
initialize
depositETH
deposits WETH into the reserve, using native ETH. A corresponding amount of the overlying asset (xTokens) is minted.
Parameters
Name | Type | Description |
---|---|---|
onBehalfOf | address | address of the user who will receive the xTokens representing the deposit |
referralCode | uint16 | integrators are assigned a referral code and can potentially receive rewards. |
withdrawETH
_withdraws the WETH reserves of msg.sender.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | amount of pWETH to withdraw and receive native ETH |
to | address | address of the user who will receive native ETH |
repayETH
repays a borrow on the WETH reserve, for the specified amount (or for the whole amount, if uint256(-1) is specified).
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | the amount to repay, or uint256(-1) if the user wants to repay everything |
onBehalfOf | address | the address for which msg.sender is repaying |
borrowETH
borrow WETH, unwraps to ETH and send both the ETH and DebtTokens to msg.sender, via approveDelegation
and onBehalf argument in Pool.borrow
.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | the amount of ETH to borrow |
referralCode | uint16 | integrators are assigned a referral code and can potentially receive rewards |
withdrawETHWithPermit
_withdraws the WETH reserves of msg.sender.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | amount of pWETH to withdraw and receive native ETH |
to | address | address of the user who will receive native ETH |
deadline | uint256 | validity deadline of permit and so depositWithPermit signature |
permitV | uint8 | V parameter of ERC712 permit sig |
permitR | bytes32 | R parameter of ERC712 permit sig |
permitS | bytes32 | S parameter of ERC712 permit sig |
_safeTransferETH
transfer ETH to an address, revert if it fails.
Parameters
Name | Type | Description |
---|---|---|
to | address | recipient of the transfer |
value | uint256 | the amount to send |
emergencyTokenTransfer
transfer ERC20 from the utility contract, for ERC20 recovery in case of stuck tokens due direct transfers to the contract address.
Parameters
Name | Type | Description |
---|---|---|
token | address | token to transfer |
to | address | recipient of the transfer |
amount | uint256 | amount to send |
emergencyEtherTransfer
transfer native Ether from the utility contract, for native Ether recovery in case of stuck Ether due selfdestructs or transfer ether to pre-computated contract address before deployment.
Parameters
Name | Type | Description |
---|---|---|
to | address | recipient of the transfer |
amount | uint256 | amount to send |
getWETHAddress
Get WETH address used by WETHGateway
receive
Only WETH contract is allowed to transfer ETH here. Prevent other addresses to send Ether to this contract.
fallback
Revert fallback calls
Last updated