File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,12 +79,11 @@ fun testRebalanceUndercollateralised() {
7979 let effectiveCollateralAfterDrop = 1_000.0 * 0.8 * (1.0 - priceDropPct ) // 640
8080 let debtBefore = 615.38461538
8181 let healthAfterPriceChangeVal = healthAfterPriceChange
82- let target = 1.3
8382
8483 // Calculate required pay-down to restore health to target (1.3)
8584 // Formula derived from: health = effectiveCollateral / effectiveDebt
8685 // Solving for the debt reduction needed to achieve target health
87- let requiredPaydown : UFix64 = debtBefore - effectiveCollateralAfterDrop / target
86+ let requiredPaydown : UFix64 = debtBefore - effectiveCollateralAfterDrop / targetHealth
8887 let expectedDebt : UFix64 = debtBefore - requiredPaydown
8988
9089 var actualDebt : UFix64 = 0.0
@@ -110,5 +109,5 @@ fun testRebalanceUndercollateralised() {
110109
111110 // Ensure health is at least the minimum threshold (1.1)
112111 Test .assert (healthAfterRebalance > = intMinHealth ,
113- message : " Health after rebalance should be at least the minimum (1.1 ) but was " .concat (healthAfterRebalance .toString ()))
112+ message : " Health after rebalance should be at least the minimum \( intMinHealth ) but was " .concat (healthAfterRebalance .toString ()))
114113}
You can’t perform that action at this time.
0 commit comments