Commit 173047c
committed
Implement a vault that holds underlying (AMPL) and perp (SPOT) tokens and auto-rebalances to maintain the system's target deviation ratio via IRolloverVault swaps.
Key features:
- Deposit underlying tokens and mint vault notes (LP tokens)
- Redeem notes for proportional underlying + perp tokens
- Auto-rebalance when system DR is outside equilibrium zone:
DR < 1 (perpTVL too high): redeem perps to decrease perpTVL
DR > 1 (perpTVL too low): mint perps to increase perpTVL
- Rebalance formula: requiredChange = perpTVL × |dr - targetDR|
(rolloverVaultTVL unchanged during flash mint/redeem)
- Liquidity limits based on swap direction:
underlying->perp: limited by underlying balance
perp->underlying: limited by perp value held
- Separate lag factors and percentage limits for each direction
- Slippage protection with configurable max swap fee percentage
- Keeper-controlled pause functionality.1 parent b91b91d commit 173047c
File tree
13 files changed
+3631
-1340
lines changed- spot-contracts
- spot-vaults
- contracts
- _interfaces
- errors
- _test
- tasks
- test
13 files changed
+3631
-1340
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
0 commit comments