Formulas and algorithms behind value tracking, APR, and rebalancing.
This page contains the mathematical foundations and mechanics that underpin the system.
Most users do not need to read this section — it is intended for advanced users, integrators, and researchers.
A leveraged position grows faster than its collateral. The relationship is:V∗δV∗=L⋅VcδVcWhere:
V∗ = value of the leveraged position
Vc = collateral value
L = compounding leverage factor
Integrating:V∗∝(Vc)LExample: If L=2 and the liquidity pool price is pLP=p, then:V∗∝(p)2=pThis means the position tracks the underlying asset’s price exactly — while still earning fees.
To maintain constant leverage L, the debt must stay aligned with collateral and oracle price po:d~=LL−1poy~where y~ is the collateral amount at oracle parity.The system uses a modified AMM invariant:(x0(po)−d)y=I(po)Solving for x0(po) leads to a quadratic expression:x0(po)=2(2L−1L)2poy+po2y2−4poyd(2L−1L)2At parity (p=po), the value of the pool is:V=2L−1x0This formula is also used when calculating shares for deposits and withdrawals.