Keepers, bonds and misses
Bonds and covers
A keeper registers in the keepers contract with a USDG bond at or above the minimum set in the contract (now 1 USDG). Each rule names its keeper and a cover in USDG, by default 2 % of the value of one run, at most 5 USDG, editable up to the keeper's free bond. The cover stays locked in the keeper's bond while the rule lives, so a keeper cannot take more rules than its bond covers. Free bond leaves 24 hours after an unbond request.
Arming
arm(ruleId) can be sent by anyone when a live rule's trigger holds: the owner, a watcher, a friend. It costs about 40,000 gas and stamps the time and the L1 block on the rule. From then on:
- the rule's keeper can execute it at any time the trigger holds (it can also execute without arming);
- five minutes after arming, any bonded keeper can execute it;
- the owner can always execute it, without fee.
Attempts
If the action fails (your price limit is out of reach, your balance was withdrawn), the keeper calls attempt(ruleId). The vault runs the action inside a call to itself; if it reverts, the contract records the time and the reason instead of reverting. A keeper that keeps attempting at least every ten minutes is never in default, and the failure is proven by the contract itself. An attempt with too little gas to run the action is refused, so a keeper cannot fake a failure. If the trigger no longer holds, the attempt clears the arm.
Claiming a miss
The owner calls claimMiss(ruleId) when all of this is true: the rule was armed, its miss window passed (set per rule, 10 minutes to 24 hours, default 30 minutes), it was not executed, and its keeper recorded no attempt in the last ten minutes. The cover moves from the keeper's bond to the owner's wallet, the arm is cleared, and the keeper's miss count goes up. One claim per arming.
Why a fixed cover
The bond pays a cover fixed when the rule is created, not a gap computed after the fact: a gap read from a spot price at claim time could be pushed by the person claiming.
A keeper could try to make its own attempt fail by moving a thin pool. That costs it real money in the pool to save at most the cover, and the owner can always run the rule themself.