Agents
What the Gate checks
The Gate stands between every agent and the vault. It runs an action only when every check below passes, and runs a batch of actions as one: if one fails, none of them happen.
The checks, in order
| Check | Refused with |
|---|---|
| The Gate is installed on the vault and the vault is not paused. | NotInstalled, VaultPaused |
| The caller is an agent the owner added and its expiry has not passed, or a strategy module the owner enabled. | NotAgent, NotModule |
| The agent or module may use this adapter. | AdapterNotAllowed |
| The adapter's plan names a market the owner listed for that adapter, unless open markets are on. | MarketNotAllowed |
| Every call matches one of the adapter's declared rules and never targets the vault, the Gate, Safe7579, the EntryPoint or an installed module. | CallNotAllowed, ForbiddenTarget, MalformedCall |
| A call that sends ETH has ETH in the plan's tokens, and a swap's two tokens are in the list. A rule written for any token matches only tokens the plan lists. | UndeclaredEth, UndeclaredToken |
| What left the vault fits the cap for that token and period. | CapExceeded |
| A swap returned at least the owner's floor for the pair. | NoMinRate, BelowMinRate, SwapNotSettled |
| Every approval given in the batch is back at zero. | AllowanceLeft |
How caps count
A cap is set per agent or module, per token, with a limit and a period in seconds. The Gate reads the vault's balance of each declared token before and after the batch and charges every decrease. Because it measures the real change, fee-on-transfer tokens and stock tokens are charged exactly.
A window opens at the first spend and lasts one period. When it ends, the next spend opens a new window with the full limit again. Changing the period resets the window. A token with no cap has a limit of zero, so it cannot be spent at all.
Price floors
A floor is the least of the bought token a swap must return, in raw units per 1036 raw units of the sold token. The scale is fine enough for a token worth a trillionth of a cent traded against a six-decimal stablecoin.
Floors are set per direction: selling A for B and selling B for A are two floors. A swap with no floor for its direction is refused. With an open floor, the agent may swap a pair the owner never priced in either direction, ETH and WETH counted as one token; a pair priced only one way still needs its own floor.
Open trading
Open trading is off by default and set per agent. Open markets let the agent use any market an adapter accepts, such as any pool of the official Uniswap v3 factory or any Pons V2 curve, without listing each one. An open floor lets it swap pairs the owner never priced.
Open trading never lifts a cap or a floor the owner set. It is meant for a sub-vault funded for trading, where each cap is what the owner accepts to lose per period.
Pause and expiry
Each agent acts until the time the owner set, then stops without any transaction. The pause switch freezes every agent and module of the vault at once. The vault or the pauser it names can press it, and only the root can lift it. The root can still move funds directly while the vault is paused.