Loading…
package spend_limit # ─── Spend-limit policy ───────────────────────────────────────────────────────# Deny-by-default. A transaction Intent is allowed only when every condition in# one of the `allow` blocks holds. Each `allow if { ... }` block is OR-ed; the# lines inside a block are AND-ed.## Data namespaces available to a Newton policy:# input -> the Intent. NOTE: the operator normalizes Intent fields to# strings — `input.value` is a DECIMAL STRING (e.g.# "1000000000000000"), `input.from`/`input.to` are hex# strings, `input.data` is hex. Parse numerics with# `to_number(...)` before comparing.# data.params -> owner-configured params (see params_schema.json), set# on-chain via `policy-client set-policy-params`# data.data -> runtime oracle output from policy.wasm (see oracle/app.js)## Chain scoping is NOT done here: the NewtonPolicyClient mixin already rejects a# wrong chain id on-chain ("Chain ID does not match"), and input.chain_id is not# populated during policy evaluation. default allow := false # Allow transfers at or under the configured limit, as long as the oracle does# not flag the recipient.allow if { to_number(input.value) <= data.params.max_value not recipient_flagged} # The admin address bypasses the value limit (still must clear the oracle flag).allow if { input.from == data.params.admin not recipient_flagged} # Oracle-driven risk check. `data.data.is_flagged` comes from the WASM oracle.recipient_flagged if { data.data.is_flagged == true} # A human-readable explanation, surfaced alongside the decision.reason := "transfer under configured limit" if { allow input.from != data.params.admin} reason := "admin override" if { allow input.from == data.params.admin} reason := "recipient flagged by risk oracle" if { recipient_flagged} reason := "transfer exceeds max_value" if { not allow not recipient_flagged}| Client | Policy set | Revision | Slot |
|---|---|---|---|
| 0x2a26…bb77 | 0x06c95f45…c599 | 1 | 0 |
| Key | Type | Required |
|---|---|---|
| max_valueMaximum transfer value in wei | number | yes |
| chain_idChain ID the policy is scoped to (e.g. 84532 for Base Sepolia) | number | yes |
| adminAdmin address that bypasses the value limit | string | yes |
| Task | Sender | Policy | Function | Result | Age |
|---|---|---|---|---|---|
| 0xe6d2c5e1… | 0xf39f…2266 | Spend Limit Policy + 0x06f725 | buy | AUTHORIZED | 7d 22h |
| 0x29bbfff4… | 0xf39f…2266 | Spend Limit Policy + 0x06f725 | buy | AUTHORIZED | 23d 22h |