Skip to main content
After you read this page, you can bound what a rule document allows, and you know which bounds the document sets and which bounds the chain enforces. Limits come from three places: This page describes the document limits and the settings of an erc20_allow account. The checks of each contract are on Contracts overview and Redeem.

Allowlists

Each allowlist is optional. When it is absent, it sets no limit. When it is present, it must have at least one entry. [] is refused, because it looks like “nobody” and would mean “anybody”. The engine checks the allowlists when it stages the document, and again when the commit lands. A rule that breaks an allowlist is refused. It does not wait for a fire.

global.token_allowlist

Every token that the document names must be on the list: A transfer trigger without a range watches only the tokens on the list. So trigger.value in such a rule is always a token on the list. Refusal texts:
  • rule '<rule>': token '<TOKEN>' not in global.token_allowlist
  • global.token_allowlist does not contain fee token <TOKEN>
Each entry must also be a token of the network. The stage refuses another entry with global.token_allowlist: <TOKEN> is not a token on <network name>.
Add the fee token to token_allowlist. Without fees_method, the fee token is the native coin, such as POL or OKB. A list without it refuses the document.

global.recipient_allowlist

Every to of send_one and of each send_batch item must be on the list. The engine replaces each $name with its value first, so "$landlord" and the literal address match. The comparison uses the exact text after that replacement. Write an address in the same letter case on the list and in the actions, or refer to one variable in both places. The list does not apply to:
  • the account, from and to filters of transfer triggers, which watch and do not pay,
  • exchange, which pays the account itself,
  • off_ramp, which uses iban_allowlist.
Refusal text: rule '<rule>': address '<address>' not in global.recipient_allowlist. The address is shown as the document writes it.

global.iban_allowlist

Every off_ramp.to.iban must be on the list. The comparison works like recipient_allowlist. Refusal text: rule '<rule>': IBAN '<iban>' not in global.iban_allowlist. The engine checks this list at staging and again at the commit. The Safe can keep a second list of IBANs on chain, in the off-ramp policy of its fallback handler. Nothing keeps the two lists equal. See Off-ramp handler.

Amounts as limits

The language has no budget, no counter and no sum per day or per month. Each action value is its own limit: the action pays what the expression computes, and no more. A transfer trigger fires on each transfer that passes its filters, with no limit in time. A rule with account fires at most once per block. To bound the total over time, use the on-chain caps of an erc20_allow account, or keep only the funds that you want to automate in the account.

Time limits

See start and expiry and price_crossed.

What the language does not have

These do not exist. A document that names one is refused as an unknown field:
  • a budget per rule, per token or per period,
  • a maximum number of fires,
  • a slippage field on exchange,
  • an approval step before a fire,
  • a cap in agent_envelope that the engine enforces. The engine accepts agent_envelope and enforces none of its fields.

Structural limits

The refusal texts are on Validation.

A safe_module account

For a Safe, the adapter is a Safe module that the owner enables. The checks of the module are on Safe adapter. The owner stops all automation with one Safe transaction: disable the module. See Update, pause and revoke.

On-chain limits of an erc20_allow account

For a plain address, the adapter pulls ERC-20 tokens with transferFrom. Three on-chain settings bound it, all set by the owner and all readable by anyone:

Caps

A cap entry has three fields: token, limit (base units) and periodSeconds.
  • periodSeconds must be at least 3600 (MIN_CAP_PERIOD_SECONDS). A shorter period reverts the whole call with CapPeriodTooShort(periodSeconds).
  • The windows are fixed. A window is the time from k × periodSeconds to (k + 1) × periodSeconds in Unix seconds. They do not start when you call setCaps.
  • Each pull of the token counts against the cap: each transfer of a send, the input of a swap, and the gas charge when the token pays the fee. For the gas charge, the adapter counts the maximum charge first and releases the unused part after the payment.
  • A leg pull that does not fit in the rest of the window makes every leg of the payment fail with CapExceeded(owner, token). No leg of that payment happens, and the gas charge is still paid. A gas reservation that does not fit reverts the whole redeem with the same error, before any leg and any charge.
  • setCaps with the same periodSeconds in the same window keeps the amount already spent. Another call starts the count at zero.
  • clearCaps(tokens) removes the caps. A token without a cap has no window limit, only its allowance.
  • capOf returns (isSet, limit, periodSeconds, spentInPeriod). spentInPeriod is 0 after its window ends.
Each function acts on the caps of the caller only.

Choose the caps from the document

The adapter pulls these tokens for a document: the token of each send, the sold token of each exchange, and the fee token. The SDK function erc20AllowDocumentTokenSymbols returns this list, and readErc20AllowDocumentTokens returns it with the contracts. Give each of these tokens an allowance. Set a cap on each token where you want a limit in time. For example, a document that pays 1500 USDC on the 1st of each month, with fees_method in USDC, can run under a USDC cap of a little more than 1500 USDC per 31 days (periodSeconds: 2678400). Because the windows are fixed, a 31-day window does not follow calendar months. Leave room for two payments in one window, or accept that a payment can revert. See ERC20Allow adapter for every function and error, and ERC20Allow in the SDK for the calls that build these transactions.