Open app

Model

The model and the keeper

The heavy part runs off chain. The keeper reads every swap on the watched pools, prices it with the fee function, computes its markouts, and once an hour publishes what it learned to the hook.

swaps on chainmarkouts 1m, 5mtiers + refitsetTiers, proposeModel24 h timelock

Markouts

For each swap the keeper takes the fill price and the fair price one and five minutes later (the latest price across every venue for the same assets). A positive five-minute markout means the swapper was right and the LPs lost; the tape calls it toxic, confirmed.

Tiers

Per sender over the window: number of swaps, share that closed a gap, mean markout. Four or more swaps with a mean markout above 3 bps and at least half closing a gap make tier 3. Two or more above 1.5 bps make tier 2. Eight or more swaps make tier 1. The table is sent with setTiers.

Refit

A grid search over k, the base and the tier surcharges picks the parameter set that would have left the LPs the most, fees minus markout loss, on the same swaps. A better set is sent with proposeModel and waits 24 hours in the hook. Anyone can call activateModel after that.

Bounds

The hook refuses any set with a cap above 1%, a floor below 0.01%, a base outside [floor, cap] or a tier multiplier above 10x. The keeper cannot move a live model faster than the timelock.