Skip to content
elyrail

Policy reference

A policy is one JSON document, version 1. Elyrail validates it strictly and compiles every amount into base units.

  • Unknown fields are errors.
  • Anything the policy does not allow is denied.
  • Amounts are decimal strings in whole token units, such as "1.5". Exponents, signs and more decimals than the token has are rejected.

Check a policy with elyrail policy lint and try actions against it with elyrail policy simulate.

Top level#

| Field | Type | Default | Meaning | | --- | --- | --- | --- | | version | 1 | required | Format version. | | id | string | required | Lowercase identifier, for example ops-2026-12. Recorded with the policy hash in the audit log. | | chainId | 99901 or 99801 | required | Elysium mainnet or testnet. Actions for any other chain are denied. | | agents | string[] | required | Agent IDs this policy applies to. Others get AGENT_NOT_ALLOWED. | | tokens | object[] | [] | ERC-20s the policy may refer to: address, symbol, decimals. HYPE is always "native" with 18 decimals. | | limits | object | required | Spend caps. See below. | | recipients | object[] | [] | Transfer allowlist: address, label. | | contracts | object[] | [] | Generic contract calls: address, label, selectors, maxNativeValue (default "0"). | | approvals | object[] | [] | Allowed approvals: token, spender, max (decimal or "unlimited"), via (erc20 or permit2), maxExpirySeconds (required for permit2). | | allowUnlimitedApprovals | boolean | false | Must be true for any approval rule with max: "unlimited". | | swaps | object[] | [] | Swap venues. See below. | | trading | object | none | Hyperliquid trading. See below. | | timeWindows | object[] | [] | UTC windows when actions are allowed: days (0 = Sunday), start, end (HH:MM). A window may cross midnight. Empty means any time. | | rateLimit | object | none | maxActions per windowSeconds, per agent. | | humanApproval | object | none | aboveUsd, aboveNative, and kinds (action kinds that always need approval). | | gas | object | maxGasLimit: 2000000, maxFeePerGasGwei: "10" | Gas caps per transaction. |

limits#

| Field | Meaning | | --- | --- | | perTransaction | [{ token, max }]. A token with no per-transaction limit cannot leave the wallet at all (TOKEN_NOT_ALLOWED). | | rolling | [{ token, max, windowSeconds }]. The window is half-open: spend exactly windowSeconds old has left it. Spend by every agent on the wallet counts. | | usd | { perTransaction, rolling }. Needs a price source configured by the operator. Without a price, USD rules deny (PRICE_UNAVAILABLE). |

Approval selectors are special#

approve, increaseAllowance, permit, Permit2 approve and permit, setApprovalForAll and transferFrom may appear only through approvals, never in contracts or swaps. Declared tokens cannot be generic contracts either. This keeps approval caps and the recipient allowlist from being bypassed through a generic call.

swaps#

| Field | Meaning | | --- | --- | | venue | uniswap-v4, uniswap-v3 or uniswap-v2. Only uniswap-v4 has a swap tool. | | router | Router address. For v4 this is the Universal Router. | | selectors | Allowed function selectors on the router, for example 0x3593564c (execute). | | tokensIn, tokensOut | Allowed tokens, "native" or declared addresses. | | maxSlippageBps | The minimum output must be within this many basis points of the simulated output. | | hooks | Uniswap v4 hook contracts allowed in pool keys. Pools without hooks are always allowed. |

trading.hyperliquid#

| Field | Meaning | | --- | --- | | network | mainnet or testnet. Must match the configured Hyperliquid network. | | markets | Perpetual market names, for example ["BTC", "ETH"]. | | maxLeverage | Integer. Both for orders, using the account's current leverage, and for hl_set_leverage. | | maxOrderNotionalUsd | Order size times Hyperliquid's mid price. Reduce-only orders are exempt, but they may not grow a position. | | maxPositionNotionalUsd | The position after a full fill, valued at mid. | | maxPriceDeviationBps | Distance of the limit price from mid. Default 300. |

Example#

json
{
  "version": 1,
  "id": "treasury-bot",
  "chainId": 99801,
  "agents": ["agent-1"],
  "tokens": [],
  "limits": {
    "perTransaction": [{ "token": "native", "max": "0.5" }],
    "rolling": [{ "token": "native", "max": "2", "windowSeconds": 86400 }]
  },
  "recipients": [{ "address": "0x000000000000000000000000000000000000a11c", "label": "treasury" }],
  "rateLimit": { "maxActions": 20, "windowSeconds": 3600 },
  "humanApproval": { "aboveNative": "0.25" },
  "gas": { "maxGasLimit": 300000, "maxFeePerGasGwei": "2" }
}