policy::check_and_consume, which asserts the policy is live and the spend is in scope before any coin leaves the vault. A failed assertion aborts the whole transaction. No coin moves, and on a dry-run no gas is spent.
The gate
Abort codes
Each abort code maps to a stable reason.decodePolicyAbort reads the abort out of a thrown error or a dry-run failure status and returns the reason.
| Move error | Code | Reason code | Meaning |
|---|---|---|---|
EPolicyRevoked | 1 | policy_revoked | The owner revoked the agent. Terminal. |
EPolicyExpired | 2 | policy_expired | expires_at_ms has passed. |
EPolicyPaused | 3 | agent_paused | The owner paused the agent. Reversible. |
ECapExceededPerTx | 4 | over_per_tx_cap | Amount exceeds per_tx_cap. |
ECapExceededPerDay | 5 | over_per_day_cap | Would push the rolling 24h total over per_day_cap. |
EPackageNotAllowed | 6 | package_not_allowed | Target package or pool is not in allowed_packages. |
EWrongPolicy | 7 | wrong_policy | The cap’s policy_id does not match this policy. |
ENotAllowedAction | 8 | action_not_allowed | Action is not in allowed_actions. |
EActionConfigMissing | 9 | action_config_missing | A required per-action config (e.g. swap floor) is absent. |
EAssetNotAllowed | 10 | asset_not_allowed | Transfer-out of an asset with no cap entry. |
Denied without spending gas
A denied action aborts on-chain and emits no event, so a chain indexer never sees it. The agent records the denial itself: dry-run the transaction withclient.devInspectTransactionBlock, decode the policy abort, log it, and skip submitting. guardedSubmit does exactly this — dry-run, and on a policy abort record the denial and return without submitting; otherwise submit for real.
A non-policy dry-run failure (DeepBook liquidity, gas) is not a policy decision. decodePolicyAbort returns null for it and guardedSubmit surfaces it rather than recording a denial.
Pause and revoke
Both are owner operations signed with theOwnerCap. Both take effect on the next agent action.
- Pause sets
paused. The next action abortsagent_paused. Unpause clears it and the agent resumes. - Revoke sets
revokedand emitsPolicyRevoked. The next action abortspolicy_revoked. There is no path back.killAndDrainrevokes and sweeps every vault asset to the owner in one transaction.
Next: audit trail
The on-chain events every decision emits, and how denials reach the Chronicle.