Subscription Payment
A subscription payment automatically transfers a fixed amount of tokens to a recipient at regular intervals. Once signed, the intent remains active, enabling automated recurring payments with native gas abstraction. Incentivization may be required for execution.
Key Features:
- Each intent has its own dedicated storage space. This ensures that state changes in one intent cannot interfere with or overwrite the storage of another intent, providing strong isolation and security.
- Execution is permissionless and can be automated.
# Subscription script: Executes a recurring token payment at a fixed interval (e.g., monthly)
contracts:
usdc:
abi: std/erc20
address: 0x...
constants:
recipient: !Address 0x... # Address to receive payments
amount: !Uint 100 * 10**6 # Amount to pay each interval (100 USDC)
execution_interval: !Uint 30 days # Interval in seconds
storage:
last_execution: !Uint # Timestamp of the last payment
workflow:
# Ensure payments are not executed before the interval has passed
- require(block.timestamp > last_execution + execution_interval)
# Transfer tokens to the recipient
- usdc.transfer(recipient, amount)
# Update the last execution timestamp
- last_execution: block.timestampUnlike the previous examples that demonstrate multi-party coordination, subscription payments operate as a self-contained workflow. The intent executes independently without requiring coordination with additional scripts, making it ideal for autonomous recurring operations where simplicity and reliability are paramount.
Last updated on