IFeeToken
Inherits: IERC20, IERC20Metadata, IERC20Errors, IMigratable, IRegistryParametersErrors
This interface exposes functionality for wrapping and unwrapping tokens for use as fees in the protocol.
Functions
initialize
Initializes the contract.
function initialize() external;
permit
Sets value_ as the allowance of spender_ over owner_'s tokens, given `owner_'s signed approval.
function permit(address owner_, address spender_, uint256 value_, uint256 deadline_, uint8 v_, bytes32 r_, bytes32 s_)
external;
Parameters
| Name | Type | Description |
|---|---|---|
owner_ | address | The owner of the tokens. |
spender_ | address | The spender of the tokens. |
value_ | uint256 | The value of the tokens. |
deadline_ | uint256 | The deadline of the permit (must be the current or future timestamp). |
v_ | uint8 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
r_ | bytes32 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
s_ | bytes32 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
deposit
Deposits amount_ of the underlying token.
function deposit(uint256 amount_) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount_ | uint256 | The amount of the underlying token to deposit. |
depositWithPermit
Deposits amount_ of the underlying token, given owner_'s signed approval.
The permit signature must be for the underlying token, not for this token.
function depositWithPermit(uint256 amount_, uint256 deadline_, uint8 v_, bytes32 r_, bytes32 s_) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount_ | uint256 | The amount of the underlying token to deposit. |
deadline_ | uint256 | The deadline of the permit (must be the current or future timestamp). |
v_ | uint8 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
r_ | bytes32 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
s_ | bytes32 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
depositFor
Deposits amount_ of the underlying token for recipient_.
This function conforms to ERC20Wrapper.depositFor.
function depositFor(address recipient_, uint256 amount_) external returns (bool success_);
Parameters
| Name | Type | Description |
|---|---|---|
recipient_ | address | The recipient of the underlying token. |
amount_ | uint256 | The amount of the underlying token to deposit. |
depositForWithPermit
Deposits amount_ of the underlying token for recipient_, given owner_'s signed approval.
The permit signature must be for the underlying token, not for this token.
This function conforms to ERC20Wrapper.depositFor.
function depositForWithPermit(address recipient_, uint256 amount_, uint256 deadline_, uint8 v_, bytes32 r_, bytes32 s_)
external
returns (bool success_);
Parameters
| Name | Type | Description |
|---|---|---|
recipient_ | address | The recipient of the underlying token. |
amount_ | uint256 | The amount of the underlying token to deposit. |
deadline_ | uint256 | The deadline of the permit (must be the current or future timestamp). |
v_ | uint8 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
r_ | bytes32 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
s_ | bytes32 | An ECDSA secp256k1 signature parameter (EIP-2612 via EIP-712). |
withdraw
Withdraws amount_ of the underlying token.
function withdraw(uint256 amount_) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount_ | uint256 | The amount of the underlying token to withdraw. |
withdrawTo
Withdraws amount_ of the underlying token for recipient_.
This function conforms to ERC20Wrapper.withdrawTo.
function withdrawTo(address recipient_, uint256 amount_) external returns (bool success_);
Parameters
| Name | Type | Description |
|---|---|---|
recipient_ | address | The recipient of the underlying token. |
amount_ | uint256 | The amount of the underlying token to withdraw. |
DOMAIN_SEPARATOR
Returns the EIP712 domain separator used in the encoding of a signed digest.
function DOMAIN_SEPARATOR() external view returns (bytes32 domainSeparator_);
PERMIT_TYPEHASH
Returns the EIP712 typehash used in the encoding of a signed digest for a permit.
function PERMIT_TYPEHASH() external pure returns (bytes32 permitTypehash_);
underlying
Returns the address of the underlying token.
function underlying() external view returns (address underlying_);
migratorParameterKey
The parameter registry key used to fetch the migrator.
function migratorParameterKey() external pure returns (string memory key_);
parameterRegistry
The address of the parameter registry.
function parameterRegistry() external view returns (address parameterRegistry_);
getPermitDigest
Returns the EIP-712 digest for a permit.
function getPermitDigest(address owner_, address spender_, uint256 value_, uint256 nonce_, uint256 deadline_)
external
view
returns (bytes32 digest_);
Parameters
| Name | Type | Description |
|---|---|---|
owner_ | address | The owner of the tokens. |
spender_ | address | The spender of the tokens. |
value_ | uint256 | The value of the tokens. |
nonce_ | uint256 | The nonce of the permit signature. |
deadline_ | uint256 | The deadline of the permit signature. |
Returns
| Name | Type | Description |
|---|---|---|
digest_ | bytes32 | The EIP-712 digest. |
nonces
Returns the current nonce for owner_ that must be included for the next valid permit signature.
function nonces(address owner_) external view returns (uint256 nonce_);
Parameters
| Name | Type | Description |
|---|---|---|
owner_ | address | The owner of the tokens. |
Returns
| Name | Type | Description |
|---|---|---|
nonce_ | uint256 | The nonce of the owner. |
Errors
ZeroParameterRegistry
Thrown when the parameter registry address is being set to zero (i.e. address(0)).
error ZeroParameterRegistry();
ZeroUnderlying
Thrown when the underlying token address is being set to zero (i.e. address(0)).
error ZeroUnderlying();
ZeroAmount
Thrown when the amount to deposit or withdraw is zero.
error ZeroAmount();
ZeroRecipient
Thrown when the recipient address is zero (i.e. address(0)).
error ZeroRecipient();
TransferFailed
Thrown when the ERC20.transfer call fails.
This is an identical redefinition of SafeTransferLib.TransferFailed.
error TransferFailed();
TransferFromFailed
Thrown when the ERC20.transferFrom call fails.
This is an identical redefinition of SafeTransferLib.TransferFromFailed.
error TransferFromFailed();