Wrapped Token Gateway
Last updated
Was this helpful?
Last updated
Was this helpful?
The Nexus Protocol operates exclusively with ERC-20 tokens. To accommodate network gas tokens, the WrappedTokenGateway is a helper contract that enables gas tokens to be wrapped or unwrapped to perform Nexus Pool methods:
Supply
Borrow
Repay
Withdraw
The smart contract source code is available on .
Wraps and supplies gas tokens to the Nexus Protocol. A corresponding amount of the wrapped zTokens are minted to the onBehalfOf
address.
Input Parameters:
onBehalfOf
address
The address of the user who will receive the zTokens representing the supplied tokens
referralCode
uint16
Inactive, can pass 0
as placeholder
Withdraws amount
of the supplied wrapped gas token, unwraps it and transfers to the to
address. If the amount is uint(-1)
, the entire balance is withdrawn.
Input Parameters:
amount
uint256
amount of zWETH to withdraw and receive native ETH
to
address
The address of the user who will receive native ETH
Repays a borrow position of onBehalfOf
's address for the specified amount (or for the whole amount, if amount
of uint256(-1)
is passed).
Input Parameters:
amount
uint256
The amount to repay, or uint256(-1)
if the user wants to repay everything
rateMode
uint256
Should always be passed a value of 2
(variable rate mode)
onBehalfOf
address
The address for which msg.sende
r is repaying
Borrows amount
of unwrapped network gas tokens to msg.sender
.
Input Parameters:
amount
uint256
The amount of ETH to borrow
interestRateMode
uint256
Should always be passed a value of 2
(variable rate mode)
referralCode
uint16
Integrators are assigned a referral code and can potentially receive rewards
Withdraws amount
of the supplied wrapped gas token, unwraps it and transfers to the to
address. If the amount is uint(-1)
, the entire balance is withdrawn.
Input Parameters:
amount
uint256
The amount of zWETH to withdraw and receive native ETH
to
address
The address of the user who will receive native ETH
deadline
uint256
Timestamp of signature expiration
permitV
uint8
V parameter of ERC712 permit sig
permitR
bytes32
R parameter of ERC712 permit sig
permitS
bytes32
S parameter of ERC712 permit sig
Get WETH address used by WrappedTokenGatewayV3.
Return Values:
address
The WETH address used by WrappedTokenGatewayV3
The WrappedTokenGateway contract must have an approved to borrow WETH (or corresponding wrapped gas token of the network) on behalf of the the caller, example: IVariableDebtToken(wethAddress).approveDelegation(wrappedTokenGatewayAddress, amount)