Transfer
State Variables
_PERMIT2_PARAMS_LEN
uint256 internal constant _PERMIT2_PARAMS_LEN = 256;
Functions
approve
function approve(ERC20 token_, address spender_, uint256 amount_) internal;
transfer
Performs an ERC20 transfer of token_
from the caller
This function handles the following:
- Checks that the user has granted approval to transfer the token
- Transfers the token from the user
- Checks that the transferred amount was received
This function reverts if:
- Approval has not been granted to this contract to transfer the token
- The token transfer fails
- The transferred amount is less than the requested amount
function transfer(
ERC20 token_,
address recipient_,
uint256 amount_,
bool validateBalance_
) internal;
Parameters
Name | Type | Description |
---|---|---|
token_ | ERC20 | Token to transfer |
recipient_ | address | Address of the recipient |
amount_ | uint256 | Amount of tokens to transfer (in native decimals) |
validateBalance_ | bool | Whether to validate the balance of the recipient |
transferFrom
Performs an ERC20 transferFrom of token_
from the sender
This function handles the following:
- Checks that the user has granted approval to transfer the token
- Transfers the token from the user
- Checks that the transferred amount was received
This function reverts if:
- Approval has not been granted to this contract to transfer the token
- The token transfer fails
- The transferred amount is less than the requested amount
function transferFrom(
ERC20 token_,
address sender_,
address recipient_,
uint256 amount_,
bool validateBalance_
) internal;
Parameters
Name | Type | Description |
---|---|---|
token_ | ERC20 | Token to transfer |
sender_ | address | Address of the sender |
recipient_ | address | Address of the recipient |
amount_ | uint256 | Amount of tokens to transfer (in native decimals) |
validateBalance_ | bool | Whether to validate the balance of the recipient |
permit2TransferFrom
function permit2TransferFrom(
ERC20 token_,
address permit2_,
address sender_,
address recipient_,
uint256 amount_,
Permit2Approval memory approval_,
bool validateBalance_
) internal;
permit2OrTransferFrom
function permit2OrTransferFrom(
ERC20 token_,
address permit2_,
address sender_,
address recipient_,
uint256 amount_,
Permit2Approval memory approval_,
bool validateBalance_
) internal;
decodePermit2Approval
function decodePermit2Approval(bytes memory data_) internal pure returns (Permit2Approval memory);
Errors
UnsupportedToken
error UnsupportedToken(address token_);
InvalidParams
error InvalidParams();
Structs
Permit2Approval
Parameters used for Permit2 approvals
struct Permit2Approval {
uint48 deadline;
uint256 nonce;
bytes signature;
}