Stability Pools Process Flow
This document describes how stability pools work, including deposits, withdrawals, rewards, and rebalancing.
Overview
Stability pools provide a mechanism for users to earn yield while providing liquidity for protocol rebalancing. Depositors receive rewards and rebalance tokens (collateral or leveraged tokens) in exchange for their deposits.
Deposit Process
Step-by-Step Flow
-
User Initiates Deposit
- User calls
deposit(amount)on Stability Pool contract - Provides asset tokens (pegged tokens, e.g., haETH)
- User calls
-
Token Transfer
- Asset tokens are transferred from user to stability pool
- Pool balance increases
-
Stake Token Minting
- LP tokens (stake tokens) are minted to user
- Amount minted = (deposit amount × total stake tokens) / total assets
- Represents user's share of the pool
-
Gauge Staking
- Stake tokens are automatically staked in the liquidity gauge
- User becomes eligible for rewards
-
Event Emission
Depositedevent emitted with user address and amount
Example
Pool State:
- Total Assets: 1000 haETH
- Total Stake Tokens: 1000
User deposits 100 haETH:
- New Total Assets: 1100 haETH
- Stake Tokens Minted: (100 × 1000) / 1000 = 100
- User receives 100 stake tokens
Withdrawal Process
Step-by-Step Flow
-
User Initiates Withdrawal
- User calls
withdraw(amount)on Stability Pool - Specifies amount of stake tokens to burn
- User calls
-
Stake Token Validation
- Contract verifies user has sufficient stake tokens
- Checks if withdrawal is allowed (no active liquidations, etc.)
-
Asset Calculation
- Assets to return = (stake tokens × total assets) / total stake tokens
- Accounts for any accrued value from liquidations
-
Token Transfer
- Asset tokens transferred from pool to user
- Stake tokens burned
-
Gauge Unstaking
- Stake tokens unstaked from gauge
- Rewards remain claimable
-
Event Emission
Withdrawnevent emitted
Example
Pool State:
- Total Assets: 1100 haETH (includes liquidation gains)
- Total Stake Tokens: 1100
User withdraws 100 stake tokens:
- Assets Returned: (100 × 1100) / 1100 = 100 haETH
- But pool may have gained value from liquidations
- User receives proportional share of gains
Reward Mechanism
Compounding Accumulator System
Stability pools use a compounding accumulator system for reward distribution:
- Reward Tokens: Multiple tokens supported (e.g., TIDE, wstETH from harvests)
- Distribution: Based on user's share of total pool balance
- Compounding: Rewards compound automatically into user balances
Reward Calculation
Rewards are calculated using an integral-based system:
- Global reward integrals track accumulated rewards per token
- User checkpoints track their position in the reward accumulation
- Rewards = (userShare × (currentIntegral - userCheckpointIntegral)) / precision
Claiming Rewards
-
User Calls
claim()- Checkpoints user to update reward calculations
- Calculates accrued rewards for all active reward tokens
- Transfers reward tokens to user (or custom receiver)
-
Reward Updates
- User's reward snapshot updated
- Pending rewards reset to zero
- Claimed amount incremented
- Event emitted
For detailed information about the reward system, see Reward System Contracts.
Rebalance Participation
How Depositors Benefit
When rebalancing occurs:
-
Rebalance Tokens Received
- Depositors receive rebalance tokens (collateral or leveraged tokens)
- Proportional to their stake in the pool
-
Value Accrual
- Pool's total asset value may increase
- Stake token holders benefit from rebalance gains
- Value per stake token increases
-
Diversification
- Depositors gain exposure to rebalance tokens
- Can hold or sell rebalance tokens
Rebalance Flow Integration
Rebalancing occurs:
↓
Pegged tokens burned from pools
↓
Rebalance tokens distributed to pools
↓
Pool's rebalance token balance increases
↓
Value per stake token increases
↓
Depositors benefit when withdrawing
Pool Types Comparison
Collateral Stability Pool
Characteristics:
- Liquidation Token: wstETH (collateral)
- Risk Profile: Lower risk, stable collateral
- Use Case: Conservative yield earning
Rewards:
- TIDE token rewards
- wstETH from rebalancing
- Staking yield from underlying collateral
Sail Stability Pool
Characteristics:
- Liquidation Token: Leveraged tokens (hsETHxFxSAVE)
- Risk Profile: Higher risk, leveraged exposure
- Use Case: Aggressive yield + exposure
Rewards:
- TIDE token rewards
- Leveraged tokens from rebalancing
- Potential for leveraged gains
Pool State Management
Key Metrics
- Total Assets: Total asset tokens in pool
- Total Stake Tokens: Total LP tokens minted
- Rebalance Token Balance: Accumulated rebalance tokens
- Reward Accumulation: Accrued rewards from multiple tokens
State Updates
- Deposits increase both assets and stake tokens
- Withdrawals decrease both proportionally
- Rebalancing increases rebalance token balance
- Rewards accrue continuously via gauge
Risk Considerations
For Depositors
- Impermanent Loss: Value changes from rebalancing
- Rebalance Token Risk: Value of received tokens may fluctuate
- Smart Contract Risk: Protocol and contract risks
- Reward Volatility: Reward token price fluctuations
Mitigations
- Diversification across pool types
- Monitoring pool health metrics
- Understanding rebalancing mechanics
Best Practices
- Diversify: Consider both pool types
- Monitor: Track pool metrics and health
- Timing: Consider market conditions for deposits/withdrawals
- Understand: Know what rebalance tokens you'll receive