OllaVault
What is OllaVault?
OllaVault is the user-facing entry point to the Olla protocol. It holds Aztec tokens, mints and burns stAztec shares, and manages the withdrawal queue. It implements ERC-4626 (tokenized vault), ERC-7540 (async redemptions), and ERC-7575 (share/asset separation).
Users interact exclusively with OllaVault for deposits, withdrawals, and instant redemptions. The vault delegates pricing to OllaCore (exchange rate, totalAssets) and delegates share token operations to StAztec.
Key responsibilities:
- Accepting deposits and minting stAztec via StAztec.
- Managing the buffer pool of unbonded Aztec tokens.
- Processing withdrawal requests through the WithdrawalQueue.
- Handling instant redemptions with fee deduction.
- Executing OllaCore instructions during rebalance (transferring assets, receiving unstaked funds, minting fees).
OllaVault is upgradeable via UUPS proxy, owned by OllaGovernance.
Deposits
Users deposit Aztec tokens and receive stAztec based on the current exchange rate. Deposits go into the buffer pool and are staked on the rollup during the next rebalance.
Two variants:
deposit(assets, receiver, minSharesOut): standard deposit with slippage protection.depositWithPermit(...): gasless approval via ERC-2612 permit. Includes frontrun protection: if the permit fails but sufficient allowance exists, the deposit proceeds.
Deposits are blocked when the SafetyModule is paused or the deposit cap is exceeded.
Withdrawals
Queued withdrawal (no fee):
requestRedeem(shares, controller): burns stAztec, locks the exchange rate, and enqueues a withdrawal request.- Wait for rebalance to finalize the request.
claimRequestById(requestId): claim Aztec tokens. Payout may be adjusted down if slashing occurred.
Instant redemption (fee applies):
instantRedeem(shares, receiver, minAssetsOut): burns stAztec and receives Aztec immediately from the buffer. A fee is deducted (up to 20%) which stays in the buffer, benefiting remaining holders.
Both variants support permit-based approval (requestRedeemWithPermit, instantRedeemWithPermit).
See User Actions for detailed sequence diagrams.
Methods
User
deposit()
Deposit Aztec tokens and receive stAztec shares.
function deposit(uint256 assets, address recipient, uint256 minSharesOut) external returns (uint256 shares)
depositWithPermit()
Deposit with gasless approval via ERC-2612 permit.
function depositWithPermit(uint256 assets, address recipient, uint256 minSharesOut, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external returns (uint256 shares)
requestRedeem()
Queue a withdrawal request. Burns stAztec immediately and locks the exchange rate.
function requestRedeem(uint256 shares, address controller, address owner) external returns (uint256 requestId)
requestRedeemWithPermit()
Queue a withdrawal with gasless approval.
function requestRedeemWithPermit(uint256 shares, address controller, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external returns (uint256 requestId)
claimRequestById()
Claim a finalized withdrawal request.
function claimRequestById(uint256 requestId) external returns (uint256 assets)
instantRedeem()
Redeem stAztec instantly from the buffer pool. A fee is deducted.
function instantRedeem(uint256 shares, address recipient, uint256 minAssetsOut) external returns (uint256 assetsAfterFee)
instantRedeemWithPermit()
Instant redemption with gasless approval.
function instantRedeemWithPermit(uint256 shares, address recipient, uint256 minAssetsOut, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external returns (uint256 assetsAfterFee)
setOperator()
Approve or remove an operator to act on your behalf (ERC-7540).
function setOperator(address operator, bool approved) external returns (bool)
Guardian
Requires GUARDIAN_ROLE.
pause()
Pause deposits, withdrawals, and redemptions.
function pause() external
unpause()
Resume vault operations.
function unpause() external
Governance
Requires owner (OllaGovernance via timelock).
setInstantRedemptionFeeBP()
Set the fee charged on instant redemptions. Range: 0–2,000 bps (0–20%).
function setInstantRedemptionFeeBP(uint256 newFeeBP) external
setQueueGasThreshold()
Set the gas floor for withdrawal queue processing.
function setQueueGasThreshold(uint256 threshold) external
reconcileBufferedAssets()
Sync the buffer with the actual token balance. Absorbs donations.
function reconcileBufferedAssets() external returns (uint256 delta)
recoverStAztec()
Recover stAztec accidentally sent to the vault.
function recoverStAztec(address recipient, uint256 amount) external
View methods
bufferedAssets()
Aztec tokens currently in the buffer pool.
function bufferedAssets() external view returns (uint256)
availableForInstantRedemption()
Buffer available after accounting for pending withdrawals.
function availableForInstantRedemption() external view returns (uint256)
pendingWithdrawalAssets()
Total assets queued for withdrawal.
function pendingWithdrawalAssets() external view returns (uint256)
previewDeposit()
Preview shares received for a deposit amount.
function previewDeposit(uint256 assets) external view returns (uint256)
previewInstantRedeem()
Preview net assets received after fee.
function previewInstantRedeem(uint256 shares) external view returns (uint256)
convertToShares()
Convert Aztec to stAztec at the current rate.
function convertToShares(uint256 assets) external view returns (uint256)
convertToAssets()
Convert stAztec to Aztec at the current rate.
function convertToAssets(uint256 shares) external view returns (uint256)
maxDeposit()
Maximum deposit allowed under the deposit cap.
function maxDeposit(address) external view returns (uint256)
pendingRedeemRequest()
Shares pending for a specific withdrawal request.
function pendingRedeemRequest(uint256 requestId, address controller) external view returns (uint256)
claimableRedeemRequest()
Assets claimable for a finalized request.
function claimableRedeemRequest(uint256 requestId, address controller) external view returns (uint256)
activeRequestIds()
Active withdrawal request IDs for an address.
function activeRequestIds(address owner) external view returns (uint256[] memory)
isOperator()
Whether an operator is approved for a controller.
function isOperator(address controller, address operator) external view returns (bool)
Events
event Deposit(address indexed caller, address indexed recipient, uint256 assets, uint256 shares)
User deposited Aztec and received stAztec.
event RedeemRequest(address indexed controller, address indexed owner, uint256 indexed requestId, address sender, uint256 assets)
Withdrawal request queued.
event WithdrawalClaimed(uint256 requestId, address recipient, uint256 assets)
Finalized withdrawal claimed by user.
event InstantRedemption(address indexed owner, address indexed recipient, uint256 shares, uint256 grossAssets, uint256 fee, uint256 netAssets, uint256 exchangeRate)
User redeemed stAztec instantly.
event FeesMinted(uint256 treasuryShares, uint256 providerShares)
Protocol fee shares minted to treasury and provider.
event OperatorSet(address indexed controller, address indexed operator, bool approved)
Operator approval changed.
event InstantRedemptionFeeUpdated(uint256 oldFeeBP, uint256 newFeeBP)
event QueueGasThresholdUpdated(uint256 oldThreshold, uint256 newThreshold)
event BufferedAssetsReconciled(uint256 delta, uint256 newBufferedAssets, address indexed recipient)
event StAztecRecovered(uint256 amount, address indexed recipient)
event AssetsTransferredToStaking(uint256 amount)
event UnstakedAssetsReceived(uint256 amount)
event WithdrawalFinalized(uint256 available, uint256 used)
Parameter change and internal operation events.