Overview
The Master Pool Rebalancer is an autonomous protocol module that manages AREAL DAO’s own liquidity in the master concentrated pools (RWT/USDY, RWT/USDC) on the native DEX. This module is separate from the DEX contract — it operates as an independent program that interacts with the DEX via CPI. It ensures that protocol-owned liquidity is always concentrated around the current NAV Book Value, providing deep liquidity exactly where trading occurs.Only protocol-owned liquidity is managed by this module. User LP positions on the native DEX are never touched, modified, or rebalanced. Users manage their own positions independently.
On-Chain Accounts
ProtocolLiquidity
Main PDA for each master pool’s protocol-owned position. Stores the LP position reference, deposited amounts, last rebalance price, rebalance threshold (default 1%), and the target bin count (default 50). Seeds:
["protocol_liquidity", pool].RebalancerConfig
Global configuration for the rebalancer module: rebalance threshold (basis points), target bin count, commit interval, and reference to the RWT Vault for NAV Book Value reads. Modifiable by Engine Authority. Seeds:
["rebalancer_config"].Core Instructions
deposit_protocol_liquidity
deposit_protocol_liquidity
Deposits AREAL DAO capital into a master pool as protocol-owned liquidity via the
ProtocolLiquidity PDA. The concentrated range is centered on the current NAV Book Value within the configured bin count (default 50 bins).Authority: Engine Authority (DAO governance)rebalance_protocol_liquidity
rebalance_protocol_liquidity
Auto-rebalances the protocol-owned liquidity when NAV Book Value deviates from the last rebalance price by more than the threshold. Withdraws the
ProtocolLiquidity position from the DEX via CPI, re-centers the concentrated range on the new NAV, and redeposits.User LP positions are never touched — only the DAO’s own capital is rebalanced.Authority: Permissionless (crank), guarded by deviation checkwithdraw_protocol_liquidity
withdraw_protocol_liquidity
Withdraws protocol-owned liquidity from a master pool back to the DAO wallet. Used when the DAO decides to reallocate capital or reduce protocol liquidity in a specific pool.Authority: Engine Authority (DAO governance)
update_rebalancer_config
update_rebalancer_config
Updates the rebalancer module configuration — rebalance threshold, target bin count, or other parameters. Requires Engine Authority.Authority: Engine Authority (DAO governance)
Rebalancing Flow
NAV deviation detected
The crank checks if the current NAV Book Value (from the RWT Vault) differs from
protocol_liquidity.last_rebalance_price by more than the configured threshold (default 1%).Protocol liquidity withdrawn
The module calls
remove_liquidity on the native DEX via CPI, withdrawing the DAO’s ProtocolLiquidity position. User positions remain untouched.Range re-centered
The concentrated bin range is recalculated: center = new NAV Book Value, spread = configured bin count (default 50 bins).
Protocol vs User Liquidity
The Master Pool Rebalancer only managesProtocolLiquidity — it has no access to user LP positions.
| Protocol Liquidity | User Liquidity | |
|---|---|---|
| Managed by | ProtocolLiquidity PDA (this module) | Individual LpPosition PDA (DEX contract) |
| Auto-rebalanced | Yes — via rebalance_protocol_liquidity | No — users manage their own range |
| Deposit/withdraw | Engine Authority (DAO) | LP owner (permissionless) |
| Purpose | Ensure deep liquidity around NAV Book Value | Users earn fees and yield on their capital |
| Bin range | Always centered on NAV, auto-adjusted | Set by user at deposit time, never changed |
Interaction with Native DEX
This module interacts with the Native DEX exclusively via CPI calls — it does not modify DEX state directly. The module calls the DEX’s standardadd_liquidity and remove_liquidity instructions, using the ProtocolLiquidity PDA as the LP owner.
Because the rebalancer uses standard DEX instructions via CPI, it benefits from all DEX security guarantees — slippage protection, pool immutability, and account ownership checks.
Security Considerations
User isolation
The module has zero access to user LP positions. It can only manage
ProtocolLiquidity PDAs — which are owned by this program, not the DEX.Deviation guard
rebalance_protocol_liquidity is permissionless but guarded by the threshold check. Cannot be triggered arbitrarily — only when NAV actually deviates beyond the configured limit.CPI-only interaction
All DEX interactions go through standard CPI calls. The module cannot bypass DEX security checks or access DEX accounts directly.
Configurable parameters
Threshold, bin count, and other parameters are stored in
RebalancerConfig and modifiable only by Engine Authority (DAO governance).