Skip to content

Commit ea7bd01

Browse files
committed
liquidity protection - updated internal deficit calculation
1 parent ce51661 commit ea7bd01

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contracts/liquidity-protection/LiquidityProtection.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ contract LiquidityProtection is ILiquidityProtection, Utils, Owned, ReentrancyGu
685685
Fraction memory poolDeficit = _poolDeficit(poolToken);
686686

687687
// no deficit
688-
if (poolDeficit.d == 0) {
688+
if (poolDeficit.n == 0) {
689689
return (targetAmount, targetAmount);
690690
}
691691

@@ -709,7 +709,7 @@ contract LiquidityProtection is ILiquidityProtection, Utils, Owned, ReentrancyGu
709709
Fraction memory poolDeficit = _poolDeficit(poolToken);
710710

711711
// no deficit
712-
if (poolDeficit.d == 0) {
712+
if (poolDeficit.n == 0) {
713713
return 0;
714714
}
715715

@@ -719,7 +719,7 @@ contract LiquidityProtection is ILiquidityProtection, Utils, Owned, ReentrancyGu
719719
/**
720720
* @dev returns the pool deficit based on the total protected amount vs. total
721721
* positions value, as a fraction.
722-
* note that 0/0 is returned if the pool is not in deficit
722+
* note that 0/1 is returned if the pool is not in deficit
723723
*/
724724
function _poolDeficit(IDSToken poolToken)
725725
private
@@ -742,7 +742,7 @@ contract LiquidityProtection is ILiquidityProtection, Utils, Owned, ReentrancyGu
742742
// if the protected liquidity is equal or greater than the total value,
743743
// the pool is not in deficit
744744
if (protectedLiquidity >= totalValue) {
745-
return Fraction({ n: 0, d: 0 });
745+
return Fraction({ n: 0, d: 1 });
746746
}
747747

748748
// the pool is in deficit

0 commit comments

Comments
 (0)