SpendPermission
SpendPermission
structure must be strictly ordered as
defined below.Field | Type | Description |
---|---|---|
account | address | Smart account this spend permission is valid for. |
spender | address | Entity that can spend account ’s tokens. |
token | address | Token address (ERC-7528 native token address or ERC-20 contract). |
allowance | uint160 | Maximum allowed value to spend within each period . |
period | uint48 | Time duration for resetting used allowance on a recurring basis (seconds). |
start | uint48 | Timestamp this spend permission is valid starting at (unix seconds). |
end | uint48 | Timestamp this spend permission is valid until (unix seconds). |
salt | uint256 | An arbitrary salt to differentiate unique spend permissions with otherwise identical data. |
extraData | bytes | Arbitrary data to include in the permission. |
PeriodSpend
Field | Type | Description |
---|---|---|
start | uint48 | Start time of the period (unix seconds). |
end | uint48 | End time of the period (unix seconds). |
spend | uint160 | Accumulated spend amount for period. |
approve
account
. Only callable by the account
specified in the spend permission.
approveWithSignature
account
owner. Compatible with ERC-6492 signatures for automatic account creation if needed.
spend
account
to the spender
. Only callable by the spender
specified in the permission.
revoke
account
specified in the spend permission.
revokeAsSpender
spender
specified in the spend permission.
getHash
SpendPermission
struct for signing, in accordance with EIP-712.
isApproved
isRevoked
isValid
getLastUpdatedPeriod
start
, end
, and accumulated spend
for the last updated period of a spend permission.
getCurrentPeriod
start
, end
, and accumulated spend
for the current period of a spend permission.
Reverts if the current time is outside the valid time range of the permission, but does not validate whether the
spend permission has been approved or revoked.