Rebalance Mechanism
Rebalance is the core mechanism of Mooncake. After each rebalance, both Funding Positions and Leveraged Positions are reset into new positions. This ensures that:
The coverage ratio of Underlying Tokens → Funding Positions, and
The Effective Leverage of Leveraged Positions return to the Target Leverage.
Rebalance Process
Conversion to Underlying Value
All Leveraged Positions and Funding Positions in the Leveraged Vault, Funding Vault, and LP Vault are converted into the equivalent value of the underlying token.
Conversion uses either:
Oracle Price (for Scheduled Rebalances), or
Price Cap/Floor (for Price-Driven Rebalances).
Re-splitting
The total underlying tokens are then re-split into new Funding Positions and Leveraged Positions, according to the target leverage.
Vault Adjustment
Funding Vault and Leveraged Vault are swapped against the LP Vault as needed, so that each vault ends up holding only its designated type of position. If mismatched positions remain, the system will keep retrying swaps until cleared.

Rebalance Triggers
Scheduled Rebalance
To ensure the effective leverage does not drift too far from the initial target, Mooncake performs periodic rebalances for each market.
Price-Driven Rebalance
When leverage deviation is caused by price movements, Mooncake applies a cap/floor mechanism. If the TWAP oracle price moves outside the cap or floor range, a rebalance is triggered at the cap/floor price.
Last updated