ISignatureTransfer
Inherits: IEIP712
Title: SignatureTransfer
Handles ERC20 token transfers through signature based actions
Requires user's token approval on the Permit2 contract
Functions
nonceBitmap
A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection
Uses unordered nonces so that permit messages do not need to be spent in a certain order
The mapping is indexed first by the token owner, then by an index specified in the nonce
It returns a uint256 bitmap
The index, or wordPosition is capped at type(uint248).max
function nonceBitmap(address, uint256) external view returns (uint256);permitTransferFrom
Transfers a token using a signed permit message
Reverts if the requested amount is greater than the permitted signed amount
Parameters
permit
PermitTransferFrom
The permit data signed over by the owner
transferDetails
SignatureTransferDetails
The spender's requested transfer details for the permitted token
owner
address
The owner of the tokens to transfer
signature
bytes
The signature to verify
permitWitnessTransferFrom
Transfers a token using a signed permit message
Includes extra data provided by the caller to verify signature over
The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition
Reverts if the requested amount is greater than the permitted signed amount
Parameters
permit
PermitTransferFrom
The permit data signed over by the owner
transferDetails
SignatureTransferDetails
The spender's requested transfer details for the permitted token
owner
address
The owner of the tokens to transfer
witness
bytes32
Extra data to include when checking the user signature
witnessTypeString
string
The EIP-712 type definition for remaining string stub of the typehash
signature
bytes
The signature to verify
permitTransferFrom
Transfers multiple tokens using a signed permit message
Parameters
permit
PermitBatchTransferFrom
The permit data signed over by the owner
transferDetails
SignatureTransferDetails[]
Specifies the recipient and requested amount for the token transfer
owner
address
The owner of the tokens to transfer
signature
bytes
The signature to verify
permitWitnessTransferFrom
Transfers multiple tokens using a signed permit message
Includes extra data provided by the caller to verify signature over
The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition
Parameters
permit
PermitBatchTransferFrom
The permit data signed over by the owner
transferDetails
SignatureTransferDetails[]
Specifies the recipient and requested amount for the token transfer
owner
address
The owner of the tokens to transfer
witness
bytes32
Extra data to include when checking the user signature
witnessTypeString
string
The EIP-712 type definition for remaining string stub of the typehash
signature
bytes
The signature to verify
invalidateUnorderedNonces
Invalidates the bits specified in mask for the bitmap at the word position
The wordPos is maxed at type(uint248).max
Parameters
wordPos
uint256
A number to index the nonceBitmap at
mask
uint256
A bitmap masked against msg.sender's current bitmap at the word position
Events
UnorderedNonceInvalidation
Emits an event when the owner successfully invalidates an unordered nonce.
Errors
InvalidAmount
Thrown when the requested amount for a transfer is larger than the permissioned amount
Parameters
maxAmount
uint256
The maximum amount a spender can request to transfer
LengthMismatch
Thrown when the number of tokens permissioned to a spender does not match the number of tokens being transferred
If the spender does not need to transfer the number of tokens permitted, the spender can request amount 0 to be transferred
Structs
TokenPermissions
The token and amount details for a transfer signed in the permit transfer signature
PermitTransferFrom
The signed permit message for a single token transfer
SignatureTransferDetails
Specifies the recipient address and amount for batched transfers.
Recipients and amounts correspond to the index of the signed token permissions array.
Reverts if the requested amount is greater than the permitted signed amount.
PermitBatchTransferFrom
Used to reconstruct the signed permit message for multiple token transfers
Do not need to pass in spender address as it is required that it is msg.sender
Note that a user still signs over a spender address
Last updated
Was this helpful?