Skip to content

Conversation

@aalavandhan
Copy link
Member

@aalavandhan aalavandhan commented Jan 31, 2026

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.

@openzeppelin-code
Copy link

openzeppelin-code bot commented Jan 31, 2026

DRBalancerVault contract for system DR rebalancing

Generated at commit: 173047c13da39883fe1ee2e4ecd2a070f3f8b8bc

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
1
0
0
3
24
28
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@aalavandhan aalavandhan force-pushed the dr-balancer-vault branch 10 times, most recently from 404525b to ecdf37e Compare January 31, 2026 20:55
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants