Concepts
How an epoch settles
Each epoch, the difference between the crest and the fixed rate moves from one deposit to the other.
The payment#
On chain the payment is floor(notional × |rate − fixed| ÷ 1,000,000,000) lamports. A fraction of a lamport is dropped rather than carried, so payments are never larger than the formula.
Try it: move the crest above and below the line with the sliders.
- Long crest
- +0.0120 SOL
- Short crest
- −0.0120 SOL
1,000 SOL × |0.0072% − 0.0060%| = 0.0120 SOL, paid to the long side. Example market with a 0.0001% tick and a 0.0150% cap.
A worked example#
A 1,000 SOL swap at a fixed 0.0060% per epoch, in a market capped at 0.0150%:
| Epoch's crest | Crest used | Long crest | Short crest |
|---|---|---|---|
| 0.0072% | 0.0072% | +0.012 SOL | −0.012 SOL |
| 0.0051% | 0.0051% | −0.009 SOL | +0.009 SOL |
| 0.0210% | 0.0150%, the cap | +0.09 SOL | −0.09 SOL |
| 0.0060% | 0.0060% | 0 | 0 |
In order, once each#
A position settles its epochs one at a time, in order, and each exactly once. It can't skip one: if epoch 412's checkpoint isn't final yet, epoch 413 waits even when its own checkpoint is. A settlement for the wrong epoch fails, so the same epoch can never be paid twice.
Who settles#
Settlement is permissionless. Any wallet can send it once the epoch's checkpoint is final. Crest's keeper settles positions as checkpoints finalize, and the app shows Settle epoch N on any of your positions that is ready, so you never depend on anyone else to be paid.
What happens after#
- If the epoch was the market's last, the position closes as matured.
- Otherwise the program checks both balances. If one side can no longer cover a worst epoch plus the reserve, the position closes early. See Deposits and margin.
- Either way, a closed position's balances go back through payout.