ERC3009
Inherits: IERC3009, StatefulERC712
Author: M^0 Labs
Inherits from ERC712 and StatefulERC712.
State Variables
TRANSFER_WITH_AUTHORIZATION_TYPEHASH
Returns transferWithAuthorization
typehash.
keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
RECEIVE_WITH_AUTHORIZATION_TYPEHASH
Returns receiveWithAuthorization
typehash.
keccak256("ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
CANCEL_AUTHORIZATION_TYPEHASH
Returns cancelAuthorization
typehash.
keccak256("CancelAuthorization(address authorizer,bytes32 nonce)")
authorizationState
Returns the state of an authorization.
Nonces are randomly generated 32-byte data unique to the authorizer's address
Functions
constructor
Construct the ERC3009 contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The name of the contract. |
transferWithAuthorization
Execute a transfer with a signed authorization.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
transferWithAuthorization
Execute a transfer with a signed authorization.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
transferWithAuthorization
Execute a transfer with a signed authorization.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
receiveWithAuthorization
Receive a transfer with a signed authorization from the payer.
This has an additional check to ensure that the payee's address matches the caller of this function to prevent front-running attacks. (See security considerations)
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
receiveWithAuthorization
Receive a transfer with a signed authorization from the payer.
This has an additional check to ensure that the payee's address matches the caller of this function to prevent front-running attacks. (See security considerations)
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
receiveWithAuthorization
Receive a transfer with a signed authorization from the payer.
This has an additional check to ensure that the payee's address matches the caller of this function to prevent front-running attacks. (See security considerations)
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
cancelAuthorization
Attempt to cancel an authorization.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
|
cancelAuthorization
Attempt to cancel an authorization.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
|
cancelAuthorization
Attempt to cancel an authorization.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
|
_transferWithAuthorization
Common transfer function used by transferWithAuthorization
and _receiveWithAuthorization
.
Parameters
Name | Type | Description |
---|---|---|
|
| Payer's address (Authorizer). |
|
| Payee's address. |
|
| Amount to be transferred. |
|
| The time after which this is valid (unix time). |
|
| The time before which this is valid (unix time). |
|
| Unique nonce. |
_receiveWithAuthorization
Common receive function used by receiveWithAuthorization
.
Parameters
Name | Type | Description |
---|---|---|
|
| Payer's address (Authorizer). |
|
| Payee's address. |
|
| Amount to be transferred. |
|
| The time after which this is valid (unix time). |
|
| The time before which this is valid (unix time). |
|
| Unique nonce. |
_cancelAuthorization
Common cancel function used by cancelAuthorization
.
Parameters
Name | Type | Description |
---|---|---|
|
| Authorizer's address. |
|
| Nonce of the authorization. |
_transfer
Internal ERC20 transfer function that needs to be implemented by the inheriting contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The sender's address. |
|
| The recipient's address. |
|
| The amount to be transferred. |
_getTransferWithAuthorizationDigest
Returns the internal EIP-712 digest of a transferWithAuthorization call.
Parameters
Name | Type | Description |
---|---|---|
|
| Payer's address (Authorizer). |
|
| Payee's address. |
|
| Amount to be transferred. |
|
| The time after which this is valid (unix time). |
|
| The time before which this is valid (unix time). |
|
| Unique nonce. |
Returns
Name | Type | Description |
---|---|---|
|
| The internal EIP-712 digest. |
_getReceiveWithAuthorizationDigest
Returns the internal EIP-712 digest of a receiveWithAuthorization call.
Parameters
Name | Type | Description |
---|---|---|
|
| Payer's address (Authorizer). |
|
| Payee's address. |
|
| Amount to be transferred. |
|
| The time after which this is valid (unix time). |
|
| The time before which this is valid (unix time). |
|
| Unique nonce. |
Returns
Name | Type | Description |
---|---|---|
|
| The internal EIP-712 digest. |
_getCancelAuthorizationDigest
Returns the internal EIP-712 digest of a cancelAuthorization call.
Parameters
Name | Type | Description |
---|---|---|
|
| Authorizer's address. |
|
| Nonce of the authorization. |
Returns
Name | Type | Description |
---|---|---|
|
| The internal EIP-712 digest. |
_revertIfAuthorizationAlreadyUsed
Reverts if the authorization is already used.
Parameters
Name | Type | Description |
---|---|---|
|
| The authorizer's address. |
|
| The nonce of the authorization. |