Skip to main content
You can find the open-source contracts repository by clicking the button below:
Spend Permissionshttps://github.com/coinbase/spend-permissions

Structs

SpendPermission

Defines the complete parameters of a spend permission.
The fields of the SpendPermission structure must be strictly ordered as defined below.

PeriodSpend

Describes the cumulative spend for the current active period.

Contract functions

approve

Approve a spend permission via a direct call from the account. Only callable by the account specified in the spend permission.

approveWithSignature

Approve a spend permission via a signature from the account owner. Compatible with ERC-6492 signatures for automatic account creation if needed.

spend

Spend tokens using a spend permission, transferring them from the account to the spender. Only callable by the spender specified in the permission.

revoke

Revoke a spend permission, permanently disabling its use. Only callable by the account specified in the spend permission.

revokeAsSpender

Revoke a spend permission, permanently disabling its use. Only callable by the spender specified in the spend permission.

getHash

Generate a hash of a SpendPermission struct for signing, in accordance with EIP-712.

isApproved

Check if a spend permission is approved, regardless of whether the current time is within the valid time range of the permission.

isRevoked

Check if a spend permission is revoked, regardless of whether the current time is within the valid time range of the permission.

isValid

Check if a spend permission is approved and not revoked, regardless of whether the current time is within the valid time range of the permission.

getLastUpdatedPeriod

Retrieve the start, end, and accumulated spend for the last updated period of a spend permission.

getCurrentPeriod

Retrieve the 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.