Reactive

Reactive in Tsuneni

The Watcher is a reactive contract: it decides on every swap, on-chain, with no server watching anything.

Reactive Network runs contracts that react to events on other chains and call back contracts there. Tsuneni's whole decision layer is one such contract, the Watcher, on Reactive Lasna. Nothing off-chain decides when a rule fires.

What Reactive does hereHow Tsuneni uses it
Subscriptions to other chains' eventsThe Watcher subscribes to each Executor's rule, ack, budget and charge events on Base Sepolia and Unichain Sepolia, and to the Swap of every pool a rule depends on, filtered by pool id, subscribing and unsubscribing as rules come and go.
react() on each eventRule events update its mirror of every rule; swap events move each pool's tick and check the nearest triggers; acks clear in-flight requests.
Callbacks with a gas limitWhen a trigger holds, it requests a callback to the right chain's Executor with a gas limit per action (1.3M for a re-range, 0.9M for an exit).
CronOnly while something waits on it: ack timeouts, wait times and schedules.
The callback proxy and pay()Delivers the callback and charges the Executor, which charges the rule's owner (payment).

Built with reactive-lib-omni (the system contract at 0x8888…8888, requestCallbackV_1_0, onlySystem) and tested with Reactive's reactive-test-lib (omni) under its metered fee mode: 48 of the 100 tests run the whole loop through Reactive's real fee path, covering every rule type except Compound and Rebalance.

One Watcher serves both chains. A rule on Base can watch a pool on Unichain (a price trigger), and a Move can send a position from one chain to the other: the Watcher sees both chains' swaps and calls back whichever Executor holds the position.

The Watcher's reaction, as Reactive records itThe Lasna transaction in the middle is the Watcher reacting to that exact swap
800 ms
  1. 1
    Swap crossed the trigger Base Sepolia0xf380…ce5a
  2. 2
    Watcher reacted Reactive Lasna0x7f16…9dff
  3. 3
    Executor acted Base Sepolia0xe31f…6dac+800 ms after the swap