Skip to content

Commit

Permalink
test: Fix yield accountancy check in invariant tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bingen committed Sep 12, 2024
1 parent ee2762b commit 4398f35
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/src/test/TestContracts/InvariantsTestHandler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1556,8 +1556,9 @@ contract InvariantsTestHandler is BaseHandler, BaseMultiCollateralTest {
v.ethClaimed = claim ? v.ethStash + v.ethGain : 0;
v.boldClaimed = claim ? v.boldYield : 0;
uint256 totalBoldDepositsBefore = v.c.stabilityPool.getTotalBoldDeposits();
if (totalBoldDepositsBefore < DECIMAL_PRECISION && amount + totalBoldDepositsBefore >= DECIMAL_PRECISION) {
v.depositorPendingYield = v.pendingYield + SP_YIELD_SPLIT * v.pendingInterest / 1e18;
uint256 totalBoldDepositsAfter = amount + totalBoldDepositsBefore;
if (totalBoldDepositsBefore < DECIMAL_PRECISION && totalBoldDepositsAfter >= DECIMAL_PRECISION) {
v.depositorPendingYield = (v.pendingYield + SP_YIELD_SPLIT * v.pendingInterest / 1e18) * amount / totalBoldDepositsAfter;
}

info("initial deposit: ", v.initialBoldDeposit.decimal());
Expand Down

0 comments on commit 4398f35

Please sign in to comment.