The WETH Gateway contract is a helper to easily wrap and unwrap ETH (or native currency of chain eg. MATIC, AVAX etc) as necessary when interacting with the protocol.
function depositETH(address pool, address onBehalfOf, uint16 referralCode)
msg.valueamount of ETH (or native chain token) into the Themis pool, minting the same amount of corresponding tWETH and transferring them to the
function withdrawETH(address pool, uint256 amount, address to)
amountof the WETH (or wrapped native chain token), unwraps it and transfers ETH (or native chain token) to the to address.
💡 Ensure you set the relevant
aTokenallowance, before calling this function, so the
WETHGatewaycontract can transfer the associated aWETH.
function repayETH(address pool, uint256 amount, uint256 rateMode, address onBehalfOf)
onBehalfOf's debt amount of ETH () which has a
function borrowETH(address pool, uint256 amount, uint256 interestRateMode, uint16 referralCode)
amountof WETH with interestRateMode , sending the amount of unwrapped WETH to msg.sender .
function withdrawETHWithPermit(address pool, uint256 amount, address to, uint256 deadline, uint8 permitV, bytes32 permitR, bytes32 permitS)
amountof the WETH (or wrapped native chain token) without a separate approval tx. The ETH (or native chain token) is sent to the to address.
function emergencyTokenTransfer(address Token, address to, uint256 amount)
Method for ERC20 recovery in case of stuck tokens due direct transfers to the contract address.
function emergencyEtherTransfer(address to, uint256 amount)
Method for ETH (or native chain token) recovery in case of stuck ETH due selfdestruct or transfer ether to pre-computated contract address before deployment.
Returns the WETH address used by the WETHGateway.