Concepts
Rewards
Why keepers compete on precision, and the exact formula.
The keeper is paid from your escrow, in the same transaction as the call. The amount depends only on the block where the egg lands:
span = notAfter - notBefore + 1
reward = maxReward * (notAfter + 1 - block) / span (zero outside the window)
| Block | Share of maxReward (window of 4 blocks) |
|---|---|
| notBefore | 100 % |
| notBefore + 1 | 75 % |
| notBefore + 2 | 50 % |
| notBefore + 3 (notAfter) | 25 % |
| after notAfter | refused |
Why it works
A keeper that lands one block earlier earns a quarter more. So every keeper tries to be first on the first block, and the whole network of keepers works for you. The reward is a price you set: a wider window or a smaller maxReward costs less and lands less precisely.
Tested
A property test checks that the reward never exceeds maxReward, never rises with lateness, and is zero outside the window. A second one checks that escrow, the reward paid and the call's value always add up to what was deposited.