A rebalance crank is a strategy transaction submitted by the vault admin or operator. The vault program exposes two normal rebalance actions:Documentation Index
Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
Use this file to discover all available pages before exploring further.
deposit_strategy(amount)withdraw_strategy(amount)
Required Constraints
Before a rebalance can complete:- the vault must be a rebalance vault
- the signer must be the vault admin or operator
- the strategy must already be listed on the vault
- the token vault, LP mint, and fee vault must match the vault
- the reserve and collateral vault must match the strategy
- the strategy handler must support the strategy type
JupLend.
Accounting Flow
Record before state
The program records token vault liquidity, strategy current liquidity, vault total amount, unlocked amount, and LP supply.
Run strategy action
For deposits, tokens move from the token vault into the strategy. For withdrawals, strategy collateral is converted back into underlying tokens.
Convert collateral to liquidity
The strategy handler calculates current underlying liquidity from the strategy’s collateral amount and exchange rate.
Update total amount
The program updates
total_amount from before and after token-vault and strategy-liquidity values.Apply gain or loss
Gain is added to locked profit. Loss is reported and reduces locked profit first.
Total Amount Update
Gain or loss is then measured fromoldTotalAmount and newTotalAmount.

