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

contract IWrappedNative wNativeToken

vWNativeToken

Address of wrapped native token market

contract IVToken vWNativeToken

constructor

Constructor for NativeTokenGateway

constructor(contract IVToken vWrappedNativeToken) public

Parameters

NameTypeDescription

vWrappedNativeToken

contract IVToken

Address of wrapped native token market


receive

To receive Native when msg.data is empty

receive() external payable

fallback

To receive Native when msg.data is not empty

fallback() external payable

wrapAndSupply

Wrap Native, get wNativeToken, mint vWNativeToken, and supply to the market.

function wrapAndSupply(address minter) external payable

Parameters

NameTypeDescription

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

function redeemUnderlyingAndUnwrap(uint256 redeemAmount) external

Parameters

NameTypeDescription

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

function redeemAndUnwrap(uint256 redeemTokens) external

Parameters

NameTypeDescription

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

function wrapAndRepay() external payable

📅 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

function sweepNative() external

📅 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

function sweepToken(contract IERC20 token) external

Parameters

NameTypeDescription

token

contract IERC20

Address of the token

📅 Events

  • SweepToken emits on success

⛔️ Access Requirements

  • Controlled by Governance


Last updated