Settle and payout
Anyone can settle. The buyer receives USDG after a two-hour window.
settle(policyId) is permissionless. The buyer, a keeper, or a stranger can send it. The shipped keeper bot does not. It only records prices.
Settle succeeds when
All of these are true. The caller does not pass a price or a timestamp.
- The policy is active:
activeFromhas passed andexpiryhas not. - The 5-minute average now is at or below
(1 - drop)times the entry average. - The buyer still holds at least
coveredTokens. - The same drop still holds on the 5-minute average at each of the last K observations (default 3), each in its own block, each at or after
activeFrom.
The payout is the loss from the entry average, capped by the coverage purchased. See Coverage.
Then it waits
The status becomes pending. The USDG is reserved from the backing cells. For 2 hours a backing LP may challenge. release after the deadline pays the buyer and does not recheck the price. Silence means the payout stands.
If the term ends with no settle, anyone can close the policy. The premium stays with the LPs and the locked capital unlocks.
A settle test on the demo pool
- Buy cover from a second wallet and wait until
activeFrom. - Keep the keeper recording so the 5-minute average and the last three samples exist.
- Sell a large amount of the meme from the deployer, not from the buyer.
- Wait until the new price has been the average for about five minutes and the last samples are all down.
- Call settle. If the average is still the old price, it reverts. If the buyer sold the bag, it reverts with a holding error.
A 0.5 token sell does not move a pool of 1 billion tokens and 10,000 USDG. See Demo swap.