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