From 66209d6c44a6180bb7fbdc0bc4f46f292d2315a4 Mon Sep 17 00:00:00 2001 From: Santiago Sanchez Avalos Date: Fri, 14 Oct 2022 15:22:05 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20market:=20memory=20read=20?= =?UTF-8?q?when=20updating=20`floatingAssets`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gas-snapshot | 246 +++++++++++++++++++++---------------------- contracts/Market.sol | 2 +- 2 files changed, 124 insertions(+), 124 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 11cc1210a..54456bf2a 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -20,148 +20,148 @@ InterestRateModelTest:testFixedBorrowRate() (gas: 3498) InterestRateModelTest:testFloatingBorrowRate() (gas: 2951) InterestRateModelTest:testFloatingBorrowRateUsingMinMaxUtilizations() (gas: 5413) InterestRateModelTest:testReferenceFloatingRate(uint256,uint64) (runs: 256, μ: 137086, ~: 137059) -MarketTest:testAccountLiquidityAdjustedDebt() (gas: 384675) -MarketTest:testAnotherUserRedeemWhenOwnerHasShortfall() (gas: 489290) -MarketTest:testAnotherUserWithdrawWhenOwnerHasShortfall() (gas: 477668) -MarketTest:testBorrowAtMaturity() (gas: 406309) -MarketTest:testBorrowAtMaturityUpdatesFloatingDebtAndFloatingAssets() (gas: 640709) -MarketTest:testBorrowDisagreement() (gas: 170576) -MarketTest:testBorrowFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 783608) -MarketTest:testCappedLiquidation() (gas: 722445) -MarketTest:testChargeTreasuryToEarlyWithdraws() (gas: 631013) -MarketTest:testChargeTreasuryToFixedBorrows() (gas: 682722) -MarketTest:testClearBadDebtAvoidingFixedBorrowsIfAccumulatorLower() (gas: 1026667) +MarketTest:testAccountLiquidityAdjustedDebt() (gas: 384443) +MarketTest:testAnotherUserRedeemWhenOwnerHasShortfall() (gas: 488942) +MarketTest:testAnotherUserWithdrawWhenOwnerHasShortfall() (gas: 477320) +MarketTest:testBorrowAtMaturity() (gas: 406077) +MarketTest:testBorrowAtMaturityUpdatesFloatingDebtAndFloatingAssets() (gas: 640245) +MarketTest:testBorrowDisagreement() (gas: 170460) +MarketTest:testBorrowFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 783260) +MarketTest:testCappedLiquidation() (gas: 721981) +MarketTest:testChargeTreasuryToEarlyWithdraws() (gas: 630897) +MarketTest:testChargeTreasuryToFixedBorrows() (gas: 682142) +MarketTest:testClearBadDebtAvoidingFixedBorrowsIfAccumulatorLower() (gas: 1025971) MarketTest:testClearBadDebtCalledByAccount() (gas: 13605) -MarketTest:testClearBadDebtExactlyRepaysFixedBorrowWithAccumulatorAmount() (gas: 839064) -MarketTest:testClearBadDebtPartiallyRepaysEachFixedBorrow() (gas: 869184) -MarketTest:testClearBadDebtPartiallyRepaysFloatingDebt() (gas: 995496) -MarketTest:testClearBadDebtShouldAccrueAccumulatedEarningsBeforeSpreadingLosses() (gas: 1015872) -MarketTest:testClearBadDebtWithEmptyAccumulatorShouldNotRevert() (gas: 616471) -MarketTest:testClearMaturity() (gas: 626628) -MarketTest:testCollectTreasuryFreeLunchToEarlyWithdraws() (gas: 760020) -MarketTest:testCollectTreasuryFreeLunchToEarlyWithdrawsWithZeroFees() (gas: 270505) -MarketTest:testCollectTreasuryFreeLunchToFixedBorrows() (gas: 708411) -MarketTest:testCollectTreasuryFreeLunchToFixedBorrowsWithZeroFees() (gas: 476220) -MarketTest:testCrossMaturityLiquidation() (gas: 1211617) +MarketTest:testClearBadDebtExactlyRepaysFixedBorrowWithAccumulatorAmount() (gas: 838600) +MarketTest:testClearBadDebtPartiallyRepaysEachFixedBorrow() (gas: 868720) +MarketTest:testClearBadDebtPartiallyRepaysFloatingDebt() (gas: 994800) +MarketTest:testClearBadDebtShouldAccrueAccumulatedEarningsBeforeSpreadingLosses() (gas: 1015408) +MarketTest:testClearBadDebtWithEmptyAccumulatorShouldNotRevert() (gas: 616123) +MarketTest:testClearMaturity() (gas: 626256) +MarketTest:testCollectTreasuryFreeLunchToEarlyWithdraws() (gas: 759788) +MarketTest:testCollectTreasuryFreeLunchToEarlyWithdrawsWithZeroFees() (gas: 270389) +MarketTest:testCollectTreasuryFreeLunchToFixedBorrows() (gas: 708179) +MarketTest:testCollectTreasuryFreeLunchToFixedBorrowsWithZeroFees() (gas: 476104) +MarketTest:testCrossMaturityLiquidation() (gas: 1210805) MarketTest:testDepositAtMaturity() (gas: 156968) MarketTest:testDepositDisagreement() (gas: 30877) -MarketTest:testDepositShouldUpdateFlexibleBorrowVariables() (gas: 471745) -MarketTest:testDepositToSmartPool() (gas: 157883) -MarketTest:testDistributeMultipleAccumulatedEarnings() (gas: 590769) -MarketTest:testDistributionOfLossesShouldReduceFromFloatingBackupBorrowedAccordingly() (gas: 2085360) -MarketTest:testEarlyRepaymentWithExcessiveAmountOfFees() (gas: 1410321) -MarketTest:testEarlyWithdrawFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 633523) -MarketTest:testFixedBorrowFailingWhenFlexibleBorrowAccruesDebt() (gas: 807912) -MarketTest:testFlexibleBorrow() (gas: 329288) -MarketTest:testFlexibleBorrowAccountingDebt() (gas: 342280) -MarketTest:testFlexibleBorrowChargingDebtToTreasury() (gas: 497745) -MarketTest:testFlexibleBorrowExceedingReserve() (gas: 563209) -MarketTest:testFlexibleBorrowExceedingReserveIncludingFixedBorrow() (gas: 748354) -MarketTest:testFlexibleBorrowExceedingReserveWithNewDebt() (gas: 701108) -MarketTest:testFlexibleBorrowFromAnotherUserSubtractsAllowance() (gas: 353047) -MarketTest:testFlexibleBorrowFromAnotherUserWithAllowance() (gas: 345842) -MarketTest:testFlexibleBorrowFromAnotherUserWithoutAllowance() (gas: 179372) -MarketTest:testFrontRunSmartPoolEarningsDistributionWithBigPenaltyRepayment() (gas: 549254) -MarketTest:testInsufficientProtocolLiquidity() (gas: 931603) -MarketTest:testLiquidateAndChargeIncentiveForLenders() (gas: 1015296) -MarketTest:testLiquidateAndDistributeLosses() (gas: 1211989) -MarketTest:testLiquidateAndSeizeExactAmountWithDustAsCollateral() (gas: 1138209) -MarketTest:testLiquidateAndSeizeFromEmptyCollateral() (gas: 636166) -MarketTest:testLiquidateAndSubtractLossesFromAccumulator() (gas: 1547732) -MarketTest:testLiquidateFlexibleAndFixedBorrowPositionsInSingleCall() (gas: 1204507) -MarketTest:testLiquidateFlexibleBorrow() (gas: 1137881) -MarketTest:testLiquidateFlexibleBorrowChargeLendersAssetsToLiquidator() (gas: 772294) -MarketTest:testLiquidateFlexibleBorrowConsideringDebtOverTime() (gas: 876395) -MarketTest:testLiquidateLeavingDustAsCollateral() (gas: 1370824) -MarketTest:testLiquidateWithTwoUnitsAsMaxAssets() (gas: 901159) -MarketTest:testLiquidateWithZeroAsMaxAssets() (gas: 636136) -MarketTest:testLiquidationClearingDebtOfAllAccountMarkets() (gas: 1397077) -MarketTest:testLiquidationResultingInZeroCollateralAndZeroDebt() (gas: 943612) -MarketTest:testMaturityInsufficientProtocolLiquidity() (gas: 901304) -MarketTest:testMultipleBorrowsForMultipleAssets() (gas: 632664293) -MarketTest:testMultipleDepositsToSmartPool() (gas: 329411) -MarketTest:testMultipleFixedBorrowsRepays() (gas: 763640) -MarketTest:testMultipleLiquidationSameUser() (gas: 1336038) -MarketTest:testOperationsShouldUpdateFloatingAssetsAverage() (gas: 666701) -MarketTest:testPreviewOperationsWithSmartPoolCorrectlyAccountingEarnings() (gas: 875262) -MarketTest:testRepayAtMaturity() (gas: 354868) -MarketTest:testRepayDisagreement() (gas: 432206) -MarketTest:testRepayFlexibleBorrow() (gas: 571599) -MarketTest:testRoundingUpAllowanceWhenBorrowingAtMaturity() (gas: 494475) -MarketTest:testRoundingUpAllowanceWhenWithdrawingAtMaturity() (gas: 505341) -MarketTest:testRoundingUpAssetsToValidateShortfallWhenTransferring() (gas: 6247624) -MarketTest:testRoundingUpAssetsToValidateShortfallWhenTransferringFrom() (gas: 6273280) -MarketTest:testSetDampSpeedFactorShouldUpdateFloatingAssetsAverage() (gas: 240891) -MarketTest:testSetEarningsAccumulatorSmoothFactorShouldDistributeEarnings() (gas: 498457) -MarketTest:testSetInterestRateModelShouldUpdateFloatingDebt() (gas: 968123) -MarketTest:testShareValueNotDecreasingAfterDeposit() (gas: 488151) -MarketTest:testShareValueNotDecreasingWhenMintingToTreasury() (gas: 494785) -MarketTest:testSingleFloatingBorrow() (gas: 328839) -MarketTest:testSingleFloatingRepay() (gas: 307239) -MarketTest:testSmartPoolEarningsDistribution() (gas: 537169) -MarketTest:testSmartPoolSharesDoNotAccountUnassignedEarningsFromMoreThanOneIntervalPastMaturities() (gas: 434041) -MarketTest:testTotalAssetsProjectingBackupEarningsCorrectly() (gas: 414333) -MarketTest:testTotalAssetsProjectingFloatingDebtCorrectly() (gas: 493442) -MarketTest:testUpdateAccumulatedEarningsFactorToZero() (gas: 646974) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingAndBorrowingContinuously() (gas: 237107) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeBorrow() (gas: 437976) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeEarlyWithdraw() (gas: 323944) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingSomeSecondsBeforeBorrow() (gas: 498580) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeBorrow() (gas: 443904) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeEarlyWithdraw() (gas: 340848) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingSomeSecondsBeforeBorrow() (gas: 268563) -MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedDown() (gas: 254713) -MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedUp() (gas: 173871) +MarketTest:testDepositShouldUpdateFlexibleBorrowVariables() (gas: 471281) +MarketTest:testDepositToSmartPool() (gas: 157767) +MarketTest:testDistributeMultipleAccumulatedEarnings() (gas: 590421) +MarketTest:testDistributionOfLossesShouldReduceFromFloatingBackupBorrowedAccordingly() (gas: 2084432) +MarketTest:testEarlyRepaymentWithExcessiveAmountOfFees() (gas: 1409741) +MarketTest:testEarlyWithdrawFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 633175) +MarketTest:testFixedBorrowFailingWhenFlexibleBorrowAccruesDebt() (gas: 807448) +MarketTest:testFlexibleBorrow() (gas: 329056) +MarketTest:testFlexibleBorrowAccountingDebt() (gas: 341816) +MarketTest:testFlexibleBorrowChargingDebtToTreasury() (gas: 497397) +MarketTest:testFlexibleBorrowExceedingReserve() (gas: 562629) +MarketTest:testFlexibleBorrowExceedingReserveIncludingFixedBorrow() (gas: 747658) +MarketTest:testFlexibleBorrowExceedingReserveWithNewDebt() (gas: 700644) +MarketTest:testFlexibleBorrowFromAnotherUserSubtractsAllowance() (gas: 352815) +MarketTest:testFlexibleBorrowFromAnotherUserWithAllowance() (gas: 345610) +MarketTest:testFlexibleBorrowFromAnotherUserWithoutAllowance() (gas: 179256) +MarketTest:testFrontRunSmartPoolEarningsDistributionWithBigPenaltyRepayment() (gas: 548790) +MarketTest:testInsufficientProtocolLiquidity() (gas: 930675) +MarketTest:testLiquidateAndChargeIncentiveForLenders() (gas: 1014484) +MarketTest:testLiquidateAndDistributeLosses() (gas: 1211061) +MarketTest:testLiquidateAndSeizeExactAmountWithDustAsCollateral() (gas: 1137397) +MarketTest:testLiquidateAndSeizeFromEmptyCollateral() (gas: 635818) +MarketTest:testLiquidateAndSubtractLossesFromAccumulator() (gas: 1546897) +MarketTest:testLiquidateFlexibleAndFixedBorrowPositionsInSingleCall() (gas: 1203347) +MarketTest:testLiquidateFlexibleBorrow() (gas: 1136837) +MarketTest:testLiquidateFlexibleBorrowChargeLendersAssetsToLiquidator() (gas: 771714) +MarketTest:testLiquidateFlexibleBorrowConsideringDebtOverTime() (gas: 875815) +MarketTest:testLiquidateLeavingDustAsCollateral() (gas: 1370012) +MarketTest:testLiquidateWithTwoUnitsAsMaxAssets() (gas: 900579) +MarketTest:testLiquidateWithZeroAsMaxAssets() (gas: 635788) +MarketTest:testLiquidationClearingDebtOfAllAccountMarkets() (gas: 1395801) +MarketTest:testLiquidationResultingInZeroCollateralAndZeroDebt() (gas: 943032) +MarketTest:testMaturityInsufficientProtocolLiquidity() (gas: 900608) +MarketTest:testMultipleBorrowsForMultipleAssets() (gas: 632553329) +MarketTest:testMultipleDepositsToSmartPool() (gas: 328599) +MarketTest:testMultipleFixedBorrowsRepays() (gas: 763176) +MarketTest:testMultipleLiquidationSameUser() (gas: 1335226) +MarketTest:testOperationsShouldUpdateFloatingAssetsAverage() (gas: 666005) +MarketTest:testPreviewOperationsWithSmartPoolCorrectlyAccountingEarnings() (gas: 874218) +MarketTest:testRepayAtMaturity() (gas: 354683) +MarketTest:testRepayDisagreement() (gas: 431974) +MarketTest:testRepayFlexibleBorrow() (gas: 570787) +MarketTest:testRoundingUpAllowanceWhenBorrowingAtMaturity() (gas: 494127) +MarketTest:testRoundingUpAllowanceWhenWithdrawingAtMaturity() (gas: 505225) +MarketTest:testRoundingUpAssetsToValidateShortfallWhenTransferring() (gas: 6245667) +MarketTest:testRoundingUpAssetsToValidateShortfallWhenTransferringFrom() (gas: 6271323) +MarketTest:testSetDampSpeedFactorShouldUpdateFloatingAssetsAverage() (gas: 240659) +MarketTest:testSetEarningsAccumulatorSmoothFactorShouldDistributeEarnings() (gas: 498341) +MarketTest:testSetInterestRateModelShouldUpdateFloatingDebt() (gas: 967775) +MarketTest:testShareValueNotDecreasingAfterDeposit() (gas: 487803) +MarketTest:testShareValueNotDecreasingWhenMintingToTreasury() (gas: 494437) +MarketTest:testSingleFloatingBorrow() (gas: 328607) +MarketTest:testSingleFloatingRepay() (gas: 306891) +MarketTest:testSmartPoolEarningsDistribution() (gas: 536705) +MarketTest:testSmartPoolSharesDoNotAccountUnassignedEarningsFromMoreThanOneIntervalPastMaturities() (gas: 433809) +MarketTest:testTotalAssetsProjectingBackupEarningsCorrectly() (gas: 414101) +MarketTest:testTotalAssetsProjectingFloatingDebtCorrectly() (gas: 493094) +MarketTest:testUpdateAccumulatedEarningsFactorToZero() (gas: 646394) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingAndBorrowingContinuously() (gas: 236875) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeBorrow() (gas: 437628) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeEarlyWithdraw() (gas: 323712) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingSomeSecondsBeforeBorrow() (gas: 498116) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeBorrow() (gas: 443556) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeEarlyWithdraw() (gas: 340616) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingSomeSecondsBeforeBorrow() (gas: 268331) +MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedDown() (gas: 254481) +MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedUp() (gas: 173755) MarketTest:testWithdrawAtMaturity() (gas: 167155) -MarketTest:testWithdrawFromSmartPool() (gas: 167973) -MarketTest:testWithdrawShouldUpdateFlexibleBorrowVariables() (gas: 522879) -PreviewerTest:testAccountsReturningAccurateAmounts() (gas: 926419) -PreviewerTest:testAccountsReturningUtilizationForDifferentMaturities() (gas: 2409973) -PreviewerTest:testAccountsWithAccountOnlyDeposit() (gas: 666876) -PreviewerTest:testAccountsWithAccountThatHasBalances() (gas: 1288993) +MarketTest:testWithdrawFromSmartPool() (gas: 167788) +MarketTest:testWithdrawShouldUpdateFlexibleBorrowVariables() (gas: 522415) +PreviewerTest:testAccountsReturningAccurateAmounts() (gas: 926187) +PreviewerTest:testAccountsReturningUtilizationForDifferentMaturities() (gas: 2409509) +PreviewerTest:testAccountsWithAccountOnlyDeposit() (gas: 666760) +PreviewerTest:testAccountsWithAccountThatHasBalances() (gas: 1288645) PreviewerTest:testAccountsWithEmptyAccount() (gas: 524409) -PreviewerTest:testAccountsWithIntermediateOperationsReturningAccurateAmounts() (gas: 11175093) -PreviewerTest:testFixedAvailableLiquidityProjectingNewFloatingDebt() (gas: 8648856) -PreviewerTest:testFixedPoolsA() (gas: 12180549) +PreviewerTest:testAccountsWithIntermediateOperationsReturningAccurateAmounts() (gas: 11172669) +PreviewerTest:testFixedAvailableLiquidityProjectingNewFloatingDebt() (gas: 8646542) +PreviewerTest:testFixedPoolsA() (gas: 12178125) PreviewerTest:testFixedPoolsChangingMaturityInTime() (gas: 1228603) -PreviewerTest:testFixedPoolsWithFloatingAssetsAverage() (gas: 10090520) -PreviewerTest:testFlexibleAvailableLiquidity() (gas: 11161569) -PreviewerTest:testFlexibleBorrowSharesAndAssets() (gas: 2671300) -PreviewerTest:testFloatingAvailableLiquidityProjectingNewFloatingDebt() (gas: 8401850) -PreviewerTest:testMaxBorrowAssetsCapacity() (gas: 1656039) -PreviewerTest:testMaxBorrowAssetsCapacityForAccountWithShortfall() (gas: 7540383) -PreviewerTest:testMaxBorrowAssetsCapacityPerMarket() (gas: 8703955) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmount() (gas: 482501) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1049169) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateUtilization() (gas: 317453) -PreviewerTest:testPreviewBorrowAtMaturityWithFiveUnits() (gas: 289943) -PreviewerTest:testPreviewBorrowAtMaturityWithInvalidMaturity() (gas: 182561) +PreviewerTest:testFixedPoolsWithFloatingAssetsAverage() (gas: 10088328) +PreviewerTest:testFlexibleAvailableLiquidity() (gas: 11159145) +PreviewerTest:testFlexibleBorrowSharesAndAssets() (gas: 2670836) +PreviewerTest:testFloatingAvailableLiquidityProjectingNewFloatingDebt() (gas: 8399652) +PreviewerTest:testMaxBorrowAssetsCapacity() (gas: 1655691) +PreviewerTest:testMaxBorrowAssetsCapacityForAccountWithShortfall() (gas: 7538301) +PreviewerTest:testMaxBorrowAssetsCapacityPerMarket() (gas: 8701409) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmount() (gas: 482269) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1048473) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateUtilization() (gas: 317337) +PreviewerTest:testPreviewBorrowAtMaturityWithFiveUnits() (gas: 289711) +PreviewerTest:testPreviewBorrowAtMaturityWithInvalidMaturity() (gas: 182445) PreviewerTest:testPreviewBorrowAtMaturityWithMaturedMaturity() (gas: 45551) -PreviewerTest:testPreviewBorrowAtMaturityWithOneUnit() (gas: 290010) +PreviewerTest:testPreviewBorrowAtMaturityWithOneUnit() (gas: 289778) PreviewerTest:testPreviewBorrowAtMaturityWithSameTimestamp() (gas: 45491) -PreviewerTest:testPreviewBorrowAtMaturityWithZeroAmount() (gas: 182432) -PreviewerTest:testPreviewDepositAtAllMaturitiesReturningAccurateAmounts() (gas: 1421325) -PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmount() (gas: 569710) -PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 819455) +PreviewerTest:testPreviewBorrowAtMaturityWithZeroAmount() (gas: 182316) +PreviewerTest:testPreviewDepositAtAllMaturitiesReturningAccurateAmounts() (gas: 1420861) +PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmount() (gas: 569478) +PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 819107) PreviewerTest:testPreviewDepositAtMaturityWithEmptyMaturity() (gas: 42288) PreviewerTest:testPreviewDepositAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 42244) PreviewerTest:testPreviewDepositAtMaturityWithInvalidMaturity() (gas: 42246) PreviewerTest:testPreviewDepositAtMaturityWithMaturedMaturity() (gas: 11617) -PreviewerTest:testPreviewDepositAtMaturityWithOneUnit() (gas: 482148) +PreviewerTest:testPreviewDepositAtMaturityWithOneUnit() (gas: 481916) PreviewerTest:testPreviewDepositAtMaturityWithSameTimestamp() (gas: 44786) -PreviewerTest:testPreviewDepositAtMaturityWithZeroAmount() (gas: 482083) -PreviewerTest:testPreviewFixedWithUsdAmount() (gas: 7168556) -PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmount() (gas: 730582) -PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 743123) +PreviewerTest:testPreviewDepositAtMaturityWithZeroAmount() (gas: 481851) +PreviewerTest:testPreviewFixedWithUsdAmount() (gas: 7166590) +PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmount() (gas: 730118) +PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 742659) PreviewerTest:testPreviewRepayAtMaturityWithEmptyMaturity() (gas: 24140) PreviewerTest:testPreviewRepayAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 24140) PreviewerTest:testPreviewRepayAtMaturityWithInvalidMaturity() (gas: 24116) PreviewerTest:testPreviewRepayAtMaturityWithMaturedMaturity() (gas: 23195) -PreviewerTest:testPreviewRepayAtMaturityWithOneUnit() (gas: 479133) +PreviewerTest:testPreviewRepayAtMaturityWithOneUnit() (gas: 478901) PreviewerTest:testPreviewRepayAtMaturityWithSameTimestamp() (gas: 21478) -PreviewerTest:testPreviewRepayAtMaturityWithZeroAmount() (gas: 479124) +PreviewerTest:testPreviewRepayAtMaturityWithZeroAmount() (gas: 478892) PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmount() (gas: 198595) -PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 692266) +PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 692034) PreviewerTest:testPreviewWithdrawAtMaturityWithEmptyMaturity() (gas: 45625) PreviewerTest:testPreviewWithdrawAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 45669) PreviewerTest:testPreviewWithdrawAtMaturityWithFiveUnits() (gas: 200678) diff --git a/contracts/Market.sol b/contracts/Market.sol index 94af2c4bf..1d35644b3 100644 --- a/contracts/Market.sol +++ b/contracts/Market.sol @@ -825,7 +825,7 @@ contract Market is Initializable, AccessControlUpgradeable, PausableUpgradeable, memFloatingDebt += newDebt; treasuryFee = newDebt.mulWadDown(treasuryFeeRate); - floatingAssets += newDebt - treasuryFee; + floatingAssets = memFloatingAssets + newDebt - treasuryFee; floatingDebt = memFloatingDebt; floatingUtilization = newFloatingUtilization; lastFloatingDebtUpdate = uint32(block.timestamp);