-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
The formula in the docs seems to have misplaced parentheses.
Current (incorrect):
ETH for rebalance = stETH Liability - (1 - Reserve Ratio * Total Value) / Reserve Ratio
Should be:
ETH for rebalance = (stETH Liability - (1 - Reserve Ratio) * Total Value) / Reserve Ratio
Derivation:
X - ETH for rebalance
L - stETH Liability
RR - Reserve Ratio
TV - Total Value
HF = (TV * (1 - RR)) / L
We want to deduct X from TV and L to return health factor to 100% (1)
L - X = (TV - X) * (1 - RR)
L - X = TV - X - TV * RR + RR * X
X = (L - TV * (1 - RR)) / RR
Which gives:
ETH for rebalance = (stETH Liability - Total Value * (1 - Reserve Ratio)) / Reserve Ratio
Example:
For stETH Liability = 90, Total Value = 99, Reserve Ratio = 0.1:
- Current formula →
ETH for rebalance = 90 - (1 - 0.1 * 99) / 0.1 = 179 - Correct formula →
ETH for rebalance = (90 - (1 - 0.1) * 99) / 0.1 = 9
The result 179 is incorrect, it would mean rebalancing more ETH than exists in the stVault (99), which makes no sense.
With the corrected formula, the rebalance amount is 9, and checking the health factor after rebalancing confirms it returns to exactly 1, as intended.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels