Taker
Search
K

WETHGateway

If you need to use native ETH in the protocol, it must first be wrapped into WETH. The WETH Gateway contract is a helper contract to easily wrap and unwrap ETH as necessary when interacting with the protocol, since only ERC20 is used within protocol interactions.

Methods

deposit

function deposit(address pool, address to)
Deposits WETH into the reserve, using native ETH. A corresponding amount of the overlying asset (tTokens) is minted.

call params

Name
Type
Description
pool
address
The address of pool contract.
to
address
The address of the user who will receive the tTokens representing the deposit

withdraw

function withdraw(address pool, uint256 amount, address to)
Withdraws the WETH _reserves of msg.sender.

call params

Name
Type
Description
pool
address
The address of pool contract.
amount
uint256
amount of WETH to withdraw and receive native ETH
to
address
address of the user who will receive native ETH

borrow

function borrow(address pool, uint256 amount)
Borrow WETH, unwraps to ETH and send both the ETH and DebtTokens to msg.sender, via from argument in LendingPool.borrow.

call params

Name
Type
Description
pool
address
The address of pool contract.
amount
uint256
the amount of ETH to borrow

repay

function repay(address pool, uint256 amount, address to)
Repays a borrow on the WETH reserve, for the specified amount (or for the whole amount, if type(uint256).max is specified).

call params

Name
Type
Description
pool
address
The address of pool contract.
amount
uint256
the amount to repay, or type(uint256).max if the user wants to repay everything
to
address
address of the user who will burn debtToken.

liquidate

function liquidate(
address pool,
address nft,
uint256 tokenId,
address user,
bool receiveTNFT
) external payable override returns (uint256)
Liquidates a borrow on the WETH reserve.

call params

Name
Type
Description
pool
address
The address of pool contract.
nft
address
The address of the underlying NFT used as collateral。
tokenId
uint256
The token ID of the underlying NFT used as collateral。
user
address
the address of borrower.
receiveTNFT
bool
receive the TNFT or the underlying NFT.