SelfPermit
Functionality to call permit on any EIP-2612-compliant token for use in the route
These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function that requires an approval in a single transaction.
Functions
selfPermit
Permits this contract to spend a given token from msg.sender
The owner
is always msg.sender and the spender
is always address(this).
Parameters:
Name | Type | Description |
---|---|---|
| address | The address of the token spent |
| uint256 | The amount that can be spent of token |
| uint256 | A timestamp, the current blocktime must be less than or equal to this timestamp |
| uint8 | Must produce valid secp256k1 signature from the holder along with |
| bytes32 | Must produce valid secp256k1 signature from the holder along with |
| bytes32 | Must produce valid secp256k1 signature from the holder along with |
selfPermitIfNecessary
Permits this contract to spend a given token from msg.sender
The owner
is always msg.sender and the spender
is always address(this). Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit
Parameters:
Name | Type | Description |
---|---|---|
| address | The address of the token spent |
| uint256 | The amount that can be spent of token |
| uint256 | A timestamp, the current blocktime must be less than or equal to this timestamp |
| uint8 | Must produce valid secp256k1 signature from the holder along with |
| bytes32 | Must produce valid secp256k1 signature from the holder along with |
| bytes32 | Must produce valid secp256k1 signature from the holder along with |
selfPermitAllowed
Permits this contract to spend the sender's tokens for permit signatures that have the allowed
parameter
The owner
is always msg.sender and the spender
is always address(this)
Parameters:
Name | Type | Description |
---|---|---|
| address | The address of the token spent |
| uint256 | The current nonce of the owner |
| uint256 | The timestamp at which the permit is no longer valid |
| uint8 | Must produce valid secp256k1 signature from the holder along with |
| bytes32 | Must produce valid secp256k1 signature from the holder along with |
| bytes32 | Must produce valid secp256k1 signature from the holder along with |
selfPermitAllowedIfNecessary
Permits this contract to spend the sender's tokens for permit signatures that have the allowed
parameter
The owner
is always msg.sender and the spender
is always address(this) Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed.
Parameters:
Name | Type | Description |
---|---|---|
| address | The address of the token spent |
| uint256 | The current nonce of the owner |
| uint256 | The timestamp at which the permit is no longer valid |
| uint8 | Must produce valid secp256k1 signature from the holder along with |
| bytes32 | Must produce valid secp256k1 signature from the holder along with |
| bytes32 | Must produce valid secp256k1 signature from the holder along with |
Last updated