Skip to content

Commit

Permalink
Rename thresholdPrice to debtToCollateral in assertAuction in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prateek105 committed Dec 14, 2023
1 parent a66fb54 commit 7990083
Show file tree
Hide file tree
Showing 19 changed files with 138 additions and 138 deletions.
2 changes: 1 addition & 1 deletion tests/forge/invariants/base/BasicInvariants.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ abstract contract BasicInvariants is BaseInvariants {
for (uint256 loanId = 1; loanId < totalLoans; loanId++) {
(borrower, t0Tp) = _pool.loanInfo(loanId);

// borrower address and threshold price should not 0
// borrower address and t0 threshold price should not 0
require(borrower != address(0), "Loan Invariant L1");
require(t0Tp != 0, "Loan Invariant L1");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ contract ERC20PoolBorrowerTPLessThanMinPrice is ERC20HelperContract {

_borrow({
from: _borrower,
amount: 990 * 1e9,
amount: 900 * 1e9,
indexLimit: 2550,
newLup: 3_010.892022197881557845 * 1e18
});

(uint256 debt, uint256 collateral, ) = _poolUtils.borrowerInfo(address(_pool), _borrower);
uint256 thresholdPrice = Maths.wdiv(debt, collateral);
uint256 debtToCollateral = Maths.wdiv(debt, collateral);

// Ensure borrower tp is less than min price
assertLt(thresholdPrice, MIN_PRICE);
assertLt(Maths.wmul(debtToCollateral, COLLATERALIZATION_FACTOR), MIN_PRICE);

// Lender can kick borrower with tp less than min price
changePrank(_lender);
Expand Down
4 changes: 2 additions & 2 deletions tests/forge/unit/ERC20Pool/ERC20PoolDebtExceedsDeposit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ contract ERC20PoolDebtExceedsDepositTest is ERC20HelperContract {
totalBondEscrowed: 1.104560604152777078 * 1e18,
auctionPrice: 54.920254943840808688 * 1e18,
debtInAuction: 98.794903846153846199 * 1e18,
thresholdPrice: 94.995099852071005961 * 1e18,
debtToCollateral: 94.995099852071005961 * 1e18,
neutralPrice: 109.840509887681617373 * 1e18
})
);
Expand Down Expand Up @@ -364,7 +364,7 @@ contract ERC20PoolDebtExceedsDepositTest is ERC20HelperContract {
totalBondEscrowed: 11_179.675302295250711919 * 1e18,
auctionPrice: 52.467014501698027340 * 1e18,
debtInAuction: 999_940.55769230769276876 * 1e18,
thresholdPrice: 96.148130547337278151 * 1e18,
debtToCollateral: 96.148130547337278151 * 1e18,
neutralPrice: 111.173731071526020388 * 1e18
})
);
Expand Down
20 changes: 10 additions & 10 deletions tests/forge/unit/ERC20Pool/ERC20PoolLiquidationsArbTake.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0,
auctionPrice: 0,
debtInAuction: 0,
thresholdPrice: 0,
debtToCollateral: 0,
neutralPrice: 0
})
);
Expand Down Expand Up @@ -183,7 +183,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.210458053887159482 * 1e18,
auctionPrice: 2_786.004733495419094016 * 1e18,
debtInAuction: 18.823940596160099025 * 1e18,
thresholdPrice: 9.411970298080049512 * 1e18,
debtToCollateral: 9.411970298080049512 * 1e18,
neutralPrice: 10.882830990216480836 * 1e18
})
);
Expand Down Expand Up @@ -261,7 +261,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.210458053887159482 * 1e18,
auctionPrice: 9.151333567485071268 * 1e18,
debtInAuction: 18.823940596160099025 * 1e18,
thresholdPrice: 9.411970298080049512 * 1e18,
debtToCollateral: 9.411970298080049512 * 1e18,
neutralPrice: 10.882830990216480836 * 1e18
})
);
Expand Down Expand Up @@ -333,7 +333,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.210458053887159482 * 1e18,
auctionPrice: 9.151333567485071268 * 1e18,
debtInAuction: 0.744103746989137588 * 1e18,
thresholdPrice: 9.411970298080049512 * 1e18,
debtToCollateral: 9.411970298080049512 * 1e18,
neutralPrice: 10.882830990216480836 * 1e18
})
);
Expand Down Expand Up @@ -369,7 +369,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.210458053887159482 * 1e18,
auctionPrice: 15.390647183378366864 * 1e18,
debtInAuction: 18.823940596160099025 * 1e18,
thresholdPrice: 9.411970298080049512 * 1e18,
debtToCollateral: 9.411970298080049512 * 1e18,
neutralPrice: 10.882830990216480836 * 1e18
})
);
Expand Down Expand Up @@ -454,7 +454,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.210458053887159482 * 1e18,
auctionPrice: 15.390647183378366864 * 1e18,
debtInAuction: 18.823940596160099025 * 1e18,
thresholdPrice: 9.411970298080049512 * 1e18,
debtToCollateral: 9.411970298080049512 * 1e18,
neutralPrice: 10.882830990216480836 * 1e18
})
);
Expand Down Expand Up @@ -493,7 +493,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.042759438341664008 * 1e18,
auctionPrice: 15.390647183378366864 * 1e18,
debtInAuction: 4.076551853619286517 * 1e18,
thresholdPrice: 9.411970298080049512 * 1e18,
debtToCollateral: 9.411970298080049512 * 1e18,
neutralPrice: 10.882830990216480836 * 1e18
})
);
Expand Down Expand Up @@ -567,7 +567,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.210458053887159482 * 1e18,
auctionPrice: 30.781294366756733728 * 1e18,
debtInAuction: 18.823940596160099025 * 1e18,
thresholdPrice: 9.411970298080049512 * 1e18,
debtToCollateral: 9.411970298080049512 * 1e18,
neutralPrice: 10.882830990216480836 * 1e18
})
);
Expand Down Expand Up @@ -628,7 +628,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0,
auctionPrice: 0,
debtInAuction: 0,
thresholdPrice: 0,
debtToCollateral: 0,
neutralPrice: 0
})
);
Expand Down Expand Up @@ -670,7 +670,7 @@ contract ERC20PoolLiquidationsArbTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.210458053887159482 * 1e18,
auctionPrice: 36.605334269940285200 * 1e18,
debtInAuction: 18.823940596160099025 * 1e18,
thresholdPrice: 9.411970298080049512 * 1e18,
debtToCollateral: 9.411970298080049512 * 1e18,
neutralPrice: 10.882830990216480836 * 1e18
})
);
Expand Down
24 changes: 12 additions & 12 deletions tests/forge/unit/ERC20Pool/ERC20PoolLiquidationsDepositTake.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0,
auctionPrice: 0,
debtInAuction: 0,
thresholdPrice: 0,
debtToCollateral: 0,
neutralPrice: 0
})
);
Expand Down Expand Up @@ -184,7 +184,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.214827269923259784 * 1e18,
auctionPrice: 2_843.843606056533345792 * 1e18,
debtInAuction: 19.214735158764197054 * 1e18,
thresholdPrice: 9.607367579382098527 * 1e18,
debtToCollateral: 9.607367579382098527 * 1e18,
neutralPrice: 11.108764086158333382 * 1e18
})
);
Expand Down Expand Up @@ -261,7 +261,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.214827269923259784 * 1e18,
auctionPrice: 9.341319897949748632 * 1e18,
debtInAuction: 19.214735158764197054 * 1e18,
thresholdPrice: 9.607367579382098527 * 1e18,
debtToCollateral: 9.607367579382098527 * 1e18,
neutralPrice: 11.108764086158333382 * 1e18
})
);
Expand Down Expand Up @@ -326,7 +326,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.214827269923259784 * 1e18,
auctionPrice: 9.341319897949748632 * 1e18,
debtInAuction: 0.181604610561948914 * 1e18,
thresholdPrice: 9.607367579382098527 * 1e18,
debtToCollateral: 9.607367579382098527 * 1e18,
neutralPrice: 11.108764086158333382 * 1e18
})
);
Expand Down Expand Up @@ -369,7 +369,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.214827269923259784 * 1e18,
auctionPrice: 15.710164831848276420 * 1e18,
debtInAuction: 19.214735158764197054 * 1e18,
thresholdPrice: 9.607367579382098527 * 1e18,
debtToCollateral: 9.607367579382098527 * 1e18,
neutralPrice: 11.108764086158333382 * 1e18
})
);
Expand Down Expand Up @@ -461,7 +461,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.214827269923259784 * 1e18,
auctionPrice: 15.710164831848276420 * 1e18,
debtInAuction: 19.214735158764197054 * 1e18,
thresholdPrice: 9.607367579382098527 * 1e18,
debtToCollateral: 9.607367579382098527 * 1e18,
neutralPrice: 11.108764086158333382 * 1e18
})
);
Expand Down Expand Up @@ -500,7 +500,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.047128646698885500 * 1e18,
auctionPrice: 15.710164831848276420 * 1e18,
debtInAuction: 4.467355778582383914 * 1e18,
thresholdPrice: 9.607367579382098527 * 1e18,
debtToCollateral: 9.607367579382098527 * 1e18,
neutralPrice: 11.108764086158333382 * 1e18
})
);
Expand Down Expand Up @@ -574,7 +574,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.214827269923259784 * 1e18,
auctionPrice: 31.420329663696552836 * 1e18,
debtInAuction: 19.214735158764197054 * 1e18,
thresholdPrice: 9.607367579382098527 * 1e18,
debtToCollateral: 9.607367579382098527 * 1e18,
neutralPrice: 11.108764086158333382 * 1e18
})
);
Expand Down Expand Up @@ -636,7 +636,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0,
auctionPrice: 0,
debtInAuction: 0,
thresholdPrice: 0,
debtToCollateral: 0,
neutralPrice: 0
})
);
Expand Down Expand Up @@ -671,7 +671,7 @@ contract ERC20PoolLiquidationsDepositTakeTest is ERC20HelperContract {
totalBondEscrowed: 0.214827269923259784 * 1e18,
auctionPrice: 37.365279591798994668 * 1e18,
debtInAuction: 19.214735158764197054 * 1e18,
thresholdPrice: 9.607367579382098527 * 1e18,
debtToCollateral: 9.607367579382098527 * 1e18,
neutralPrice: 11.108764086158333382 * 1e18
})
);
Expand Down Expand Up @@ -767,7 +767,7 @@ contract ERC20PoolLiquidationsDepositTakeRegressionTest is ERC20HelperContract {
totalBondEscrowed: 13_799_909_500.935435603423349661 * 1e18,
auctionPrice: 0,
debtInAuction: 920_341_611_662.285708998644615657 * 1e18,
thresholdPrice: 2_758.083788017359002804 * 1e18,
debtToCollateral: 2_758.083788017359002804 * 1e18,
neutralPrice: 3_137.845063437099084063 * 1e18 // was 2_860.503207254858101199
})
);
Expand Down Expand Up @@ -795,7 +795,7 @@ contract ERC20PoolLiquidationsDepositTakeRegressionTest is ERC20HelperContract {
totalBondEscrowed: 13_799_909_500.935435603423349661 * 1e18,
auctionPrice: 0,
debtInAuction: 33_716_280_531.11637887639485531 * 1e18,
thresholdPrice: 0,
debtToCollateral: 0,
neutralPrice: 3_137.845063437099084063 * 1e18 // was 2_860.503207254858101199
})
);
Expand Down
10 changes: 5 additions & 5 deletions tests/forge/unit/ERC20Pool/ERC20PoolLiquidationsKick.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ contract ERC20PoolLiquidationsKickTest is ERC20HelperContract {
totalBondEscrowed: 0,
auctionPrice: 0,
debtInAuction: 0,
thresholdPrice: 0,
debtToCollateral: 0,
neutralPrice: 0
})
);
Expand Down Expand Up @@ -226,7 +226,7 @@ contract ERC20PoolLiquidationsKickTest is ERC20HelperContract {
totalBondEscrowed: 0.211592598652049829 * 1e18,
auctionPrice: 2_801.023626937442916608 * 1e18,
debtInAuction: 18.925417364872552389 * 1e18,
thresholdPrice: 9.462708682436276194 * 1e18,
debtToCollateral: 9.462708682436276194 * 1e18,
neutralPrice: 10.941498542724386393 * 1e18
})
);
Expand Down Expand Up @@ -286,7 +286,7 @@ contract ERC20PoolLiquidationsKickTest is ERC20HelperContract {
totalBondEscrowed: 0,
auctionPrice: 0,
debtInAuction: 0,
thresholdPrice: 0,
debtToCollateral: 0,
neutralPrice: 0
})
);
Expand Down Expand Up @@ -319,7 +319,7 @@ contract ERC20PoolLiquidationsKickTest is ERC20HelperContract {
totalBondEscrowed: 0.211592598652049829 * 1e18,
auctionPrice: 2_801.023626937442916608 * 1e18,
debtInAuction: 18.925417364872552389 * 1e18,
thresholdPrice: 9.462708682436276194 * 1e18,
debtToCollateral: 9.462708682436276194 * 1e18,
neutralPrice: 10.941498542724386393 * 1e18
})
);
Expand Down Expand Up @@ -353,7 +353,7 @@ contract ERC20PoolLiquidationsKickTest is ERC20HelperContract {
totalBondEscrowed: 0,
auctionPrice: 0,
debtInAuction: 0,
thresholdPrice: 0,
debtToCollateral: 0,
neutralPrice: 0
})
);
Expand Down
Loading

0 comments on commit 7990083

Please sign in to comment.