Liquid Staking
What is Olla?
Olla is a liquid staking protocol for Aztec. It lets you stake your Aztec tokens to earn sequencer rewards without locking up your capital. When you deposit Aztec tokens, you receive stAztec, a liquid receipt token representing your share of the staking pool. You can hold, transfer, or use stAztec in DeFi while your underlying tokens earn rewards on the rollup.
How stAztec works
stAztec is a rebasing-by-price token. Your stAztec balance stays the same, but each token becomes worth more Aztec over time as staking rewards accumulate. This is tracked through the exchange rate.
Exchange rate
The exchange rate determines how many Aztec tokens one stAztec is worth. It starts at 1:1 and goes up as rewards come in.
exchange rate = total assets / total stAztec supply
Total assets is the sum of:
- Buffered assets: Aztec tokens sitting in the vault, available for instant withdrawals and new stakes.
- Staked principal: Aztec tokens actively staked on the rollup earning rewards.
- Unclaimed rewards: Rewards earned but not yet harvested from the rollup.
- Pending unstakes: Aztec tokens in the process of being withdrawn from the rollup.
A virtual offset of 1,000 is added to both numerator and denominator to prevent rounding manipulation on an empty pool (the standard "inflation attack" mitigation from ERC-4626).
Deposits
When you deposit Aztec tokens, the protocol calculates your stAztec shares based on the current exchange rate:
shares received = deposit amount * total stAztec supply / total assets
Deposits are synchronous: you receive stAztec in the same transaction. Your tokens go into the buffer pool until the next rebalance stakes them on the rollup.
Withdrawals
Olla has two withdrawal paths:
Queued withdrawal (no fee): You burn your stAztec and join a FIFO queue. During the next rebalance cycle, the protocol unstakes enough Aztec to cover queued withdrawals. Once finalized, you can claim your tokens. If slashing happens between your request and finalization, the payout is adjusted down to protect other stakers:
payout = shares * min(current rate, locked rate at request time)
Instant redemption (fee applies): You burn your stAztec and get Aztec tokens back immediately from the buffer pool. A fee is charged (up to 20%, set by governance) and stays in the buffer, so it's effectively distributed to remaining stAztec holders. Instant redemptions depend on buffer liquidity.
The buffer pool
The vault keeps a pool of unbonded Aztec tokens called the buffer. It has three jobs:
- Absorb deposits: New deposits land in the buffer before being staked during rebalance.
- Fund instant redemptions: Users who want immediate liquidity redeem from the buffer.
- Cover queued withdrawals: Finalized withdrawal claims are paid from the buffer.
Governance sets a target buffer size (targetBufferedAssets). During rebalance, surplus above the target gets staked on the rollup. If the buffer is below target (due to pending withdrawals), the protocol unstakes to replenish it.
Rebalancing
Rebalancing moves assets between the buffer and the rollup. It's a permissionless state machine: anyone can call rebalance(), so the protocol doesn't depend on a specific operator being online. New cycles are rate-limited by a configurable cooldown (10 minutes to 24 hours).
Each rebalance cycle runs five steps in order:
- Harvest rewards: Claim sequencer rewards from the rollup.
- Pull unstaked funds: Sweep completed exits back to the buffer.
- Finalize withdrawals: Process queued withdrawal requests.
- Initiate unstakes: If the buffer needs replenishing, start withdrawing from the rollup.
- Stake surplus: If the buffer has excess, stake it on the rollup.
After rebalance completes, updateAccounting() recalculates the exchange rate, mints fee shares, and runs safety checks.
Cross-chain bridging
stAztec can be bridged to other chains via LayerZero V2. On the home chain, an OFT Adapter locks your stAztec and sends a message to the destination chain, where an OFT contract mints a synthetic version. Bridging back burns the synthetic and unlocks the original.