Commit e8a0d57
committed
Revert incorrect simulation loop formula
TEST RESULTS PROVED:
- OLD: remainingUSDC = tokens * F * price → 16,283 tokens, 6.51x (CORRECT)
- NEW: remainingUSDC = tokens * F → 6.6M tokens, 2659x (EXPONENTIAL, WRONG)
Root cause: Simulation uses simplified leverage model, not exact protocol mechanics.
- Simplified: borrow F * (token value) in USDC → geometric series (1-F^n)/(1-F)
- Protocol: borrow F * (collateral sets) in USDC → different mechanics
Keeping:
- Runway validation (prevents debt > collateral)
- Improved loop formula (old returned Infinity)
- Protocol documentation (helps integrators understand real mechanics)
Clarified comments to distinguish simulation model from protocol mechanics.1 parent ba97f37 commit e8a0d57
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
190 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
0 commit comments