Rebalance Process Flow
This document describes how rebalancing works in Harbor Protocol and how stability pools participate in the rebalancing process.
Overview
When the system-wide collateral ratio falls below the rebalance threshold, the protocol automatically rebalances by burning pegged tokens from stability pools. Stability pool depositors provide liquidity for rebalancing and receive rebalance tokens (collateral or leveraged tokens) as rewards.
Rebalance Trigger
Conditions for Rebalancing
The system becomes eligible for rebalancing when:
- Global collateral ratio falls below the rebalance threshold (e.g., 130%)
- Price movements cause the system to become undercollateralized
- Oracle price updates reflect the new market conditions
Rebalance Check
collateralRatio = totalCollateralValue / totalPeggedValue
if (collateralRatio < rebalanceThreshold) {
// System can be rebalanced
}
Rebalance Process
Step 1: Rebalance Initiation
-
Keeper or User Calls Rebalance
- Rebalancer calls
rebalance()on the StabilityPoolManager - Specifies minimum amount of pegged tokens expected to be burned
- Receives rebalance bounty as incentive
- Rebalancer calls
-
System Validation
- Contract checks if collateral ratio is below threshold
- Verifies sufficient stability pool balances
- Validates rebalance amount
Step 2: Pegged Token Burning
-
Token Collection
- Pegged tokens are swept from stability pools
- Tokens are burned via Minter (fee-free redemption)
- Total pegged token supply decreases
-
Debt Reduction
- System debt is reduced by the burned amount
- Global collateral ratio improves
Step 3: Rebalance Token Distribution
-
Token Calculation
- Collateral pool receives wrapped collateral (e.g., wstETH, fxSAVE)
- Leveraged pool receives leveraged tokens (hsTokens)
- Distribution proportional to each pool's contribution
-
Distribution to Depositors
- Rebalance tokens are distributed to pools via
notifyLiquidation() - Distribution is proportional to depositor's stake in the pool
- Depositors receive rebalance tokens in exchange for their pegged tokens
- Rebalance tokens are distributed to pools via
Step 4: Pool State Update
-
Balance Updates
- Rebalance token balance increases
- Individual depositor balances updated via checkpointing
- Total asset supply recalculated
-
Reward Distribution
- Rebalance tokens accumulate as rewards
- Depositors can claim rewards via
claim() - Rewards compound into balances automatically
Stability Pool Types
Collateral Stability Pool
Rebalance Token: Wrapped Collateral (wstETH, fxSAVE)
Process:
- Depositors provide pegged tokens (haETH, haBTC)
- Pool participates in system rebalancing
- Depositors receive wrapped collateral as rebalance tokens
- Depositors can withdraw collateral or continue earning rewards
Use Case: Users want to earn yield while providing rebalancing liquidity, receiving collateral in return.
Sail Stability Pool (Leveraged Pool)
Rebalance Token: Leveraged Tokens (hsFXUSD-ETH, hsSTETH-BTC)
Process:
- Depositors provide pegged tokens (haETH, haBTC)
- Pool participates in system rebalancing
- Depositors receive leveraged tokens as rebalance tokens
- Depositors can hold leveraged tokens for exposure or sell them
Use Case: Users want leveraged exposure while earning yield, receiving leveraged tokens as rebalance rewards.
Rebalance Example
Scenario
- System has: 1000 haETH pegged tokens
- Collateral: 1300 wstETH
- Current collateral ratio: 130%
- Rebalance threshold: 130%
- Price drops: Collateral value decreases
- New ratio: 120% (below threshold)
Rebalance
-
StabilityPoolManager Rebalances
- Burns 100 haETH from stability pools
- System debt reduced to 900 haETH
-
Token Distribution
- 100 haETH redeemed for ~100 wstETH (at current price)
- Collateral pool receives wstETH
- Leveraged pool receives hsTokens (if applicable)
-
Depositor Rewards
- Depositors receive rebalance tokens proportional to their stake
- Example: Depositor with 10% stake receives 10 wstETH (collateral pool) or equivalent hsTokens (leveraged pool)
Rebalance Incentives
For Rebalancers (Keepers)
- Rebalance bounty (typically 0.5-1% of rebalance amount)
- Gas cost reimbursement
- Priority in rebalance queue
- MEV opportunities
For Depositors
- Receive rebalance tokens at favorable rates
- Diversified exposure through rebalancing
- Yield from protocol operations
- Automatic compounding
Safety Mechanisms
- Minimum Rebalance Amount: Prevents dust rebalances
- Maximum Rebalance: Limits single rebalance size
- Slippage Protection:
minPeggedLiquidatedparameter - Circuit Breakers: Pauses rebalancing in extreme conditions
Gas Optimization
- Batch rebalances when possible
- Efficient token transfers
- Minimal state updates
Understanding Rebalancing
- Know Your Pool: Understand which rebalance tokens you'll receive
- Monitor Ratio: Track system collateral ratio
- Timing: Rebalances happen when ratio drops below threshold
- Understand: Know what rebalance tokens you'll receive