How it works
The Watcher's discipline
How one reactive contract watches every rule on two chains and stays inside a reaction's gas.
| Kept | How |
|---|---|
| Most swaps cost almost nothing | Each pool keeps a quiet band between its nearest lower and upper trigger; a swap inside it returns early. |
| Exits go first | Two passes per reaction, exits first; an exit locks its position so nothing acts on it in the same reaction. |
| Bounded work | At most 4 callbacks per reaction and 24 rules per pool. A pool of 32 rules crossed at once measured 857k of the 900k gas a reaction gets; at 24 it stays under 760k. |
| One request at a time | One in flight per rule and per position, cleared by the Executor's Ack; a timeout on a cron if none comes. |
| Failures back off | Exponential backoff, and a rule stops after 3 failed attempts until it's edited or renewed. The app reads it as Stopped acting and offers Renew. |
| Gas per action | Re-range 1.3M, exit 0.9M, collect 0.7M, compound 0.9M, order 0.7M, move 1.3M, rebalance 0.7M. |
| Already past the trigger | A rule saved when the price is already past its trigger acts at once, without waiting for a swap. |
| Wait times | A rule with a wait (60 s for Follow the price added with Add rule) records when the price first crossed, then confirms on a cron or the next swap; if the price comes back, the wait clears. |
It subscribes to each Executor's RuleSaved, Ack, BudgetChanged and Charged, and to each watched pool's Swap filtered by pool id. Its cron subscriptions (ack timeouts, schedules, wait times) are live only while something is waiting on them.
The Copier
Copy trading has its own reactive contract beside the Watcher, with its own fuel, so a busy followed wallet can never slow a stop-loss down.
| Kept | How |
|---|---|
| Only who's followed | It subscribes to a wallet's token Transfers and position NFTs only while someone follows it, on the chains they asked for, and drops the subscription when the last follow ends. |
| A swap from its legs | A swap is the first two token legs of one transaction (different tokens, one out to the pool or router, one in to the wallet): the amounts and the price the leader got, with no router decoding. A position is a mint to the wallet, a close is its NFT leaving. |
| Bounded fan-out | At most 64 copiers per wallet, chain and kind; 4 copies per reaction, the rest queued for the next reactions and dropped after 20 minutes (a close never is). |
| Daily limits | 60 events a day per followed wallet (then its follows read Paused today until 00:00 UTC), 1,000 copies a day in all. |
| Listed when it can pay | A follow is on its leader's list only while its copy budget covers a copy; the CopyExecutor's BudgetChanged puts it back. |
| Fuel floor | Under its floor (0.25 lREACT on Testnet) it stops sending copies and says so on Status; rules keep running on the Watcher. |
| Gas per copy | Swap 1.1M (the pull, the swap, the send and any protection rule it arms), position 1.6M, each set per callback like a rule's. |