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
1
Record before state
The program records token vault liquidity, strategy current liquidity, vault total amount, unlocked amount, and LP supply.
2
Run strategy action
For deposits, tokens move from the token vault into the strategy. For withdrawals, strategy collateral is converted back into underlying tokens.
3
Convert collateral to liquidity
The strategy handler calculates current underlying liquidity from the strategy’s collateral amount and exchange rate.
4
Update total amount
The program updates
total_amount from before and after token-vault and strategy-liquidity values.5
Apply gain or loss
Gain is added to locked profit. Loss is reported and reduces locked profit first.
6
Mint performance-fee LP tokens
If gain is positive, the program calculates the 5% performance fee and mints LP tokens to the configured fee vault when the result is nonzero.
Total Amount Update
Gain or loss is then measured fromoldTotalAmount and newTotalAmount.

