NativeTokenGateway
NativeTokenGateway
NativeTokenGateway contract facilitates interactions with a vToken market for native tokens (Native or wNativeToken)
Solidity API
wNativeToken
Address of wrapped native token contract
vWNativeToken
Address of wrapped native token market
constructor
Constructor for NativeTokenGateway
Parameters
Name | Type | Description |
---|---|---|
vWrappedNativeToken | contract IVToken | Address of wrapped native token market |
receive
To receive Native when msg.data is empty
fallback
To receive Native when msg.data is not empty
wrapAndSupply
Wrap Native, get wNativeToken, mint vWNativeToken, and supply to the market.
Parameters
Name | Type | Description |
---|---|---|
minter | address | The address on behalf of whom the supply is performed. |
📅 Events
TokensWrappedAndSupplied is emitted when assets are supplied to the market
❌ Errors
ZeroAddressNotAllowed is thrown if address of minter is zero address
ZeroValueNotAllowed is thrown if mintAmount is zero
redeemUnderlyingAndUnwrap
Redeem vWNativeToken, unwrap to Native Token, and send to the user
Parameters
Name | Type | Description |
---|---|---|
redeemAmount | uint256 | The amount of underlying tokens to redeem |
📅 Events
TokensRedeemedAndUnwrapped is emitted when assets are redeemed from a market and unwrapped
❌ Errors
ZeroValueNotAllowed is thrown if redeemAmount is zero
redeemAndUnwrap
Redeem vWNativeToken, unwrap to Native Token, and send to the user
Parameters
Name | Type | Description |
---|---|---|
redeemTokens | uint256 | The amount of vWNative tokens to redeem |
📅 Events
TokensRedeemedAndUnwrapped is emitted when assets are redeemed from a market and unwrapped
❌ Errors
ZeroValueNotAllowed is thrown if redeemTokens is zero
wrapAndRepay
Wrap Native, repay borrow in the market, and send remaining Native to the user
📅 Events
TokensWrappedAndRepaid is emitted when assets are repaid to a market and unwrapped
❌ Errors
ZeroValueNotAllowed is thrown if repayAmount is zero
sweepNative
Sweeps native assets (Native) from the contract and sends them to the owner
📅 Events
SweepNative is emitted when assets are swept from the contract
⛔️ Access Requirements
Controlled by Governance
sweepToken
Sweeps the input token address tokens from the contract and sends them to the owner
Parameters
Name | Type | Description |
---|---|---|
token | contract IERC20 | Address of the token |
📅 Events
SweepToken emits on success
⛔️ Access Requirements
Controlled by Governance
Last updated