IWNat
#
Wrapped native token interface.
This contract converts native tokens into WNAT
(wrapped native) tokens and vice versa.
WNAT
tokens are a one-to-one ERC20
representation of native tokens, which are minted and burned as needed by this contract.
The wrapped versions of the native FLR
and SGB
tokens are called WFLR
and WSGB
respectively.
Code attribution: WETH9.
Functions#
deposit
#
function deposit(
) external payable;
Deposits native tokens and mints the same amount of WNAT
tokens,
which are added to the msg.sender
's balance.
This operation is commonly known as "wrapping".
depositTo
#
function depositTo(
address _recipient
) external payable;
Deposits native tokens and mints the same amount of WNAT
tokens,
which are added to _recipient
's balance.
This operation is commonly known as "wrapping".
This is equivalent to using deposit
followed by transfer
.
Parameters | Type | Description |
---|---|---|
_recipient |
address |
The address to receive the minted WNAT . |
withdraw
#
function withdraw(
uint256 _amount
) external;
Burns _amount
of WNAT
tokens from msg.sender
's WNAT
balance and
transfers the same amount of native tokens to msg.sender
.
This operation is commonly known as "unwrapping".
Reverts if _amount
is higher than msg.sender
's WNAT
balance.
Parameters | Type | Description |
---|---|---|
_amount |
uint256 |
The amount to withdraw. |
withdrawFrom
#
function withdrawFrom(
address _owner,
uint256 _amount
) external;
Burns _amount
of WNAT
tokens from _owner
's WNAT
balance and
transfers the same amount of native tokens to msg.sender
.
This operation is commonly known as "unwrapping".
msg.sender
must have been authorized to withdraw
from _owner
's account
through ERC-20's approve mechanism.
Reverts if _amount
is higher than _owners
's WNAT
balance or than
msg.sender
's allowance over _owner
's tokens.
Parameters | Type | Description |
---|---|---|
_owner |
address |
The address containing the tokens to withdraw. |
_amount |
uint256 |
The amount to withdraw. |