Where the checks run
The engine checks a document when you stage it, before the owner signs anything. It runs the same document checks again when the commit lands on chain.
The document travels encrypted to the engine. The refusal and the warnings come back encrypted to your client, and the SDK opens them. The Anafi API in the middle cannot read them.
The error classes are on Errors. The stage call is on Documents.
The engine stops at the first refusal. Fix it and stage again to see the next one.
The order of the checks
1
Size
Length, nesting depth, anchors and aliases.
2
Parse
The YAML, the shape of every mapping and scalar, the units of every expression, the variables, the trigger fields, the transfer filters, the cents of
off_ramp literals, and the allowlists.3
Address checks
A watched
account that is the account itself, a payment to the account itself, a payment to the zero address.4
Network checks
The bank payout rail, the tokens of the network, the price of
price_crossed tokens, the fee floor of literal amounts, the fee token, the swap venue, the size of each send_batch.5
Inbox
global.notification_email against the verified inbox of the account.6
Account kind
What the adapter of the account can serve.
7
Parent
The document that the stage names as its parent is still the document on chain.
Size refusals
These come before the YAML parse. The text has no prefix.
An unquoted
time_of_day: *:15 is an alias. Quote it.
Parse refusals
Each parse refusal at staging starts withDSL parse: . A refusal inside a rule then names the rule: DSL parse: rule '<rule>': <reason>. A YAML syntax error names the line and the column: DSL parse: <line>:<col>: YAML parse: <reason>.
Shape
The
<context> of an unknown field is one of: document, global constraints, fees_method, rule, agent_envelope, periodic trigger, calendar trigger, at_fixed_time trigger, incoming_tx trigger, outgoing_tx trigger, price_crossed trigger, send_one action, send_batch action, send_batch recipient, exchange action, notify action, off_ramp action, off_ramp recipient.
The <form> of a bad scalar is one of these texts:
The
<field> of an unknown value is one of: trigger type, action type, notify channel, day-of-week, token, direction, off_ramp provider, fees_method type.
The structure texts:
day_of_month must not contain duplicatesday_of_week must not contain duplicatestimestamps must not contain duplicatescalendar requires at least one of day_of_month or day_of_weekoff_ramp recipient needs the account holder: `first_name` and `last_name` for a person, or `company_name` for a businessoff_ramp recipient names both a person and a `company_name`; write exactly one holderoff_ramp recipient names a person by half; write both `first_name` and `last_name`off_ramp recipient's `first_name` must not be blank, and the same forlast_nameandcompany_name
value range lower bound must be <= upper boundperiodic interval_seconds must be > 0periodic interval_seconds must be at least 10 secondsperiodic interval_seconds must be at most 3153600000 (100 years)off_ramp memo must be 5 to 140 characters, at least 5 of them past any leading or trailing spacesprice_crossed price_usd must be > 0
day_of_month, day_of_week, timestamps, send_batch recipients, rule actions, global.token_allowlist, global.recipient_allowlist, global.iban_allowlist, agent_envelope.token_allowlist.
Expressions
A
<unit> reads amount of <TOKEN>, percentage, bare number or polymorphic. polymorphic is the unit of trigger.value under a transfer trigger without a range.
References, filters and allowlists
Address refusals
These texts have noDSL parse: prefix.
The comparison ignores letter case and replaces each
$name first. The checks apply to send_one and send_batch under every trigger.
Network refusals
The<network name> is Polygon PoS, X Layer or Polygon Amoy testnet. The <network> is polygon, xlayer or polygon-amoy.
The token check covers
global.token_allowlist, transfer trigger ranges, price_crossed.token, the literal amounts of send_one, send_batch and off_ramp, and both sides of exchange on a network with a swap venue. The fee floor check covers only an action value that is one literal amount, such as "0.1 USDC".
Inbox refusal
The text is the same if the account has a different verified inbox or none. A document without
global.notification_email passes this check. See notification_email.
Account kind refusals
Asafe_module account gets no account kind refusal. It accepts every action that the network accepts, off_ramp included.
An erc20_allow account can pull only ERC-20 tokens, and it pays the fees in an ERC-20 token. The engine refuses these documents for it:
The SDK checks the same causes on the client before it sends the stage. It also refuses an
exchange when the adapter of the network runs no swaps. See ERC20Allow in the SDK.
Warnings
A warning does not stop the stage. The staged result lists the warnings in this order: for each rule, warnings 2, 3 and 4; then warning 1 in token order; then warning 6; then warning 5 in author order.
Warning 6 looks at enabled
incoming_tx rules without account. It finds the rules that one transfer into the account can fire together. It warns when their known spends exceed every transfer in that case:
- A rule fires on a transfer when its
fromis absent or equal to the sender, and itsvaluerange is absent or holds the token and the amount. - Known spends are
trigger.value,trigger.value * <N>%,trigger.value * <N>, and a literal amount in the token of the transfer. Other expressions are left out, so the warning never states more than the rules take. - It warns for shares that add up to more than 100%, for a 100% share next to a fixed amount, and for fixed amounts above what the upper bound of the range leaves after the shares.
- Under an open upper bound, shares of 100% or less plus a fixed amount do not warn. A large transfer covers them.
- It names the token, or
transferwhen the overspend occurs for a token that no rule names.
outgoing_tx rules and rules with account do not take part, because their transfer does not fund the account.
Valid, but it does not run
A document can pass every check and still do nothing in some cases. Know these before you commit:
The status of each fire is on Activity.