From f2073c0022a3ecb88b8b16acc10e1e797972898c Mon Sep 17 00:00:00 2001 From: Santiago Sanchez Avalos Date: Tue, 27 Aug 2024 15:27:32 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=94=20market:=20increase=20accumulator?= =?UTF-8?q?=20local=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/fast-hotels-grin.md | 5 + .gas-snapshot | 558 ++++++++++++++++----------------- contracts/Market.sol | 1 + test/Market.t.sol | 8 +- 4 files changed, 289 insertions(+), 283 deletions(-) create mode 100644 .changeset/fast-hotels-grin.md diff --git a/.changeset/fast-hotels-grin.md b/.changeset/fast-hotels-grin.md new file mode 100644 index 00000000..0e38c3f9 --- /dev/null +++ b/.changeset/fast-hotels-grin.md @@ -0,0 +1,5 @@ +--- +"@exactly/protocol": minor +--- + +👔 market: increase accumulator local var diff --git a/.gas-snapshot b/.gas-snapshot index cbb14f86..64ba038b 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -17,20 +17,20 @@ AuditorTest:testEnableMarketAuditorMismatch() (gas: 67682) AuditorTest:testEnableMarketShouldRevertWithInvalidPriceFeed() (gas: 224321) AuditorTest:testEnterExitMarket() (gas: 313882) AuditorTest:testExitMarketOwning() (gas: 280975) -DebtManagerTest:testAllowanceSurplus() (gas: 965332) +DebtManagerTest:testAllowanceSurplus() (gas: 965368) DebtManagerTest:testApproveMaliciousMarket() (gas: 50529) DebtManagerTest:testApproveMarket() (gas: 83345) DebtManagerTest:testBalancerFlashloanCallFromDifferentOrigin() (gas: 98619) DebtManagerTest:testCallReceiveFlashLoanFromAnyAddress() (gas: 63771) -DebtManagerTest:testDeleverage() (gas: 963660) -DebtManagerTest:testDeleverageHalfPosition() (gas: 980627) -DebtManagerTest:testDeleverageIncremental() (gas: 1661563) -DebtManagerTest:testDeleverageWithMoreThanBalancerAvailableLiquidity() (gas: 1138329) -DebtManagerTest:testDeleverageWithPartialWithdraw() (gas: 1016169) -DebtManagerTest:testDeleverageWithWithdraw() (gas: 1006646) -DebtManagerTest:testFakeMarketDeleverage() (gas: 1240409) -DebtManagerTest:testFakeMarketLeverage() (gas: 1278752) -DebtManagerTest:testFakeMarketRollFixed() (gas: 1968924) +DebtManagerTest:testDeleverage() (gas: 963696) +DebtManagerTest:testDeleverageHalfPosition() (gas: 980663) +DebtManagerTest:testDeleverageIncremental() (gas: 1661599) +DebtManagerTest:testDeleverageWithMoreThanBalancerAvailableLiquidity() (gas: 1138365) +DebtManagerTest:testDeleverageWithPartialWithdraw() (gas: 1016205) +DebtManagerTest:testDeleverageWithWithdraw() (gas: 1006682) +DebtManagerTest:testFakeMarketDeleverage() (gas: 1246223) +DebtManagerTest:testFakeMarketLeverage() (gas: 1284602) +DebtManagerTest:testFakeMarketRollFixed() (gas: 1974738) DebtManagerTest:testFixedRoll() (gas: 1180518) DebtManagerTest:testFixedRollSameMaturityWithThreeLoops() (gas: 994775) DebtManagerTest:testFixedRollWithAccurateBorrowSlippage() (gas: 1743390) @@ -42,57 +42,57 @@ DebtManagerTest:testFixedToFloatingRollHigherThanAvailableLiquidity() (gas: 1245 DebtManagerTest:testFixedToFloatingRollHigherThanAvailableLiquidityWithSlippage() (gas: 1939154) DebtManagerTest:testFixedToFloatingRollHigherThanAvailableLiquidityWithSlippageWithThreeLoops() (gas: 2626574) DebtManagerTest:testFixedToFloatingRollWithAccurateSlippage() (gas: 1660099) -DebtManagerTest:testFlashloanFeeGreaterThanZero() (gas: 782399) +DebtManagerTest:testFlashloanFeeGreaterThanZero() (gas: 782435) DebtManagerTest:testFloatingToFixedRoll() (gas: 1122257) DebtManagerTest:testFloatingToFixedRollHigherThanAvailableLiquidity() (gas: 1290029) DebtManagerTest:testFloatingToFixedRollHigherThanAvailableLiquidityWithSlippage() (gas: 2037850) DebtManagerTest:testFloatingToFixedRollHigherThanAvailableLiquidityWithSlippageWithThreePools() (gas: 2794984) DebtManagerTest:testFloatingToFixedRollWithAccurateSlippage() (gas: 1699218) DebtManagerTest:testFloatingToFixedRollWithAccurateSlippageWithPreviousPosition() (gas: 1931341) -DebtManagerTest:testFuzzRolls(uint8[4],uint8[4],uint256[4],uint40[4],uint8[4]) (runs: 256, μ: 6567002, ~: 6703643) +DebtManagerTest:testFuzzRolls(uint8[4],uint8[4],uint256[4],uint40[4],uint8[4]) (runs: 256, μ: 6579524, ~: 6658123) DebtManagerTest:testLateFixedRoll() (gas: 1310831) DebtManagerTest:testLateFixedRollWithThreeLoops() (gas: 1897545) DebtManagerTest:testLateFixedToFloatingRoll() (gas: 1273784) DebtManagerTest:testLateFixedToFloatingRollWithThreeLoops() (gas: 1834425) -DebtManagerTest:testLeverage() (gas: 624861) -DebtManagerTest:testLeverageIncremental() (gas: 1334229) -DebtManagerTest:testLeverageShouldFailWhenHealthFactorNearOne() (gas: 1395319) +DebtManagerTest:testLeverage() (gas: 624897) +DebtManagerTest:testLeverageIncremental() (gas: 1334265) +DebtManagerTest:testLeverageShouldFailWhenHealthFactorNearOne() (gas: 1395391) DebtManagerTest:testLeverageWithAlreadyDepositedAmount() (gas: 812467) -DebtManagerTest:testLeverageWithInvalidBalancerVault() (gas: 3912150) -DebtManagerTest:testLeverageWithMoreThanBalancerAvailableLiquidity() (gas: 1000405) -DebtManagerTest:testLeverageWithNegativePrincipal() (gas: 1255085) -DebtManagerTest:testLeverageWithPartialNegativePrincipal() (gas: 1424159) -DebtManagerTest:testMockBalancerVault() (gas: 6125378) -DebtManagerTest:testPartialDeleverageWithWithdrawAndNewRatio() (gas: 1031475) -DebtManagerTest:testPartialDeleverageWithWithdrawKeepingRatio() (gas: 1031481) +DebtManagerTest:testLeverageWithInvalidBalancerVault() (gas: 3916062) +DebtManagerTest:testLeverageWithMoreThanBalancerAvailableLiquidity() (gas: 1000441) +DebtManagerTest:testLeverageWithNegativePrincipal() (gas: 1255121) +DebtManagerTest:testLeverageWithPartialNegativePrincipal() (gas: 1424195) +DebtManagerTest:testMockBalancerVault() (gas: 6131192) +DebtManagerTest:testPartialDeleverageWithWithdrawAndNewRatio() (gas: 1031511) +DebtManagerTest:testPartialDeleverageWithWithdrawKeepingRatio() (gas: 1031517) DebtManagerTest:testPartialFixedRoll() (gas: 1200784) DebtManagerTest:testPartialFixedToFloatingRoll() (gas: 1159479) DebtManagerTest:testPartialLateFixedRoll() (gas: 1332263) DebtManagerTest:testPartialLateFixedToFloatingRoll() (gas: 1301956) DebtManagerTest:testPermit2AndLeverage() (gas: 752603) DebtManagerTest:testPermitAndDeleverage() (gas: 1152286) -DebtManagerTest:testPermitAndLeverage() (gas: 692022) +DebtManagerTest:testPermitAndLeverage() (gas: 692051) DebtManagerTest:testPermitAndRollFloatingToFixed() (gas: 1198750) -DebtManagerTest:testPermitAndTransferLeverage() (gas: 803803) -DebtPreviewerTest:testDeleverageRatesSameAsset() (gas: 883762) +DebtManagerTest:testPermitAndTransferLeverage() (gas: 803839) +DebtPreviewerTest:testDeleverageRatesSameAsset() (gas: 883798) DebtPreviewerTest:testLeverageRatesCrossAsset() (gas: 780816) DebtPreviewerTest:testLeverageRatesSameAsset() (gas: 489623) DebtPreviewerTest:testLeverageRatesWithNativeBorrow() (gas: 416300) DebtPreviewerTest:testLeverageRatesWithNegativeNativeResult() (gas: 416382) DebtPreviewerTest:testLeverageRatesZeroPrincipalCrossAsset() (gas: 712846) DebtPreviewerTest:testLeverageRatesZeroPrincipalSameAsset() (gas: 419463) -DebtPreviewerTest:testPreviewDeleverageSameAsset() (gas: 2323003) +DebtPreviewerTest:testPreviewDeleverageSameAsset() (gas: 2323039) DebtPreviewerTest:testPreviewEmptyLeverage() (gas: 317803) -DebtPreviewerTest:testPreviewLeverage() (gas: 865236) +DebtPreviewerTest:testPreviewLeverage() (gas: 865272) DebtPreviewerTest:testPreviewLeverageBalancerAvailableLiquidity() (gas: 321707) -DebtPreviewerTest:testPreviewLeverageSameAsset() (gas: 1129754) -DebtPreviewerTest:testPreviewLeverageSameAssetNegativePrincipal() (gas: 1807241) -DebtPreviewerTest:testPreviewLeverageSameAssetPartialNegativePrincipal() (gas: 1640024) +DebtPreviewerTest:testPreviewLeverageSameAsset() (gas: 1129790) +DebtPreviewerTest:testPreviewLeverageSameAssetNegativePrincipal() (gas: 1807277) +DebtPreviewerTest:testPreviewLeverageSameAssetPartialNegativePrincipal() (gas: 1640060) DebtPreviewerTest:testPreviewLeverageSameUSDCAssetMaxRatioMultipleCollateralAndDebt() (gas: 2329705) -DebtPreviewerTest:testPreviewLeverageSameUSDCAssetWithDeposit() (gas: 2273055) +DebtPreviewerTest:testPreviewLeverageSameUSDCAssetWithDeposit() (gas: 2273091) DebtPreviewerTest:testPreviewLeverageSameWETHAssetMaxRatioMultipleCollateralAndDebt() (gas: 2400913) DebtPreviewerTest:testPreviewLeverageSameWETHAssetMultipleCollateralAndDebtWithMinHealthFactor() (gas: 2400935) -DebtPreviewerTest:testPreviewMaxRatioWithdrawWithSameAssetLeverage() (gas: 976876) +DebtPreviewerTest:testPreviewMaxRatioWithdrawWithSameAssetLeverage() (gas: 976912) DebtPreviewerTest:testPreviewSameAssetInvalidLeverageShouldCapRatio() (gas: 1052001) EscrowedEXATest:testCancelExternalStreams() (gas: 371324) EscrowedEXATest:testCancelExternalStreamsWithesEXACancel() (gas: 1110061) @@ -128,160 +128,160 @@ EscrowedEXATest:testWithdrawMaxFromMultipleStreams() (gas: 1556686) EscrowedEXATest:testWithdrawMaxShouldGiveReserveBackWhenDepleted() (gas: 548053) EscrowedEXATest:testWithdrawMaxWithInvalidSender() (gas: 500137) InstallmentsRouterTest:testAmountsLength() (gas: 36269) -InstallmentsRouterTest:testBorrowETHWithPermit() (gas: 1114945) -InstallmentsRouterTest:testBorrowRouter() (gas: 638710) -InstallmentsRouterTest:testBorrowUnwrappedETH() (gas: 722398) -InstallmentsRouterTest:testBorrowWithPermit() (gas: 1217880) +InstallmentsRouterTest:testBorrowETHWithPermit() (gas: 1115035) +InstallmentsRouterTest:testBorrowRouter() (gas: 638764) +InstallmentsRouterTest:testBorrowUnwrappedETH() (gas: 722452) +InstallmentsRouterTest:testBorrowWithPermit() (gas: 1217970) InstallmentsRouterTest:testFakeMarket() (gas: 47507) -InstallmentsRouterTest:testInsufficientMaxRepay() (gas: 630433) -InstallmentsRouterTest:testMaxRepay() (gas: 630420) +InstallmentsRouterTest:testInsufficientMaxRepay() (gas: 630487) +InstallmentsRouterTest:testMaxRepay() (gas: 630474) InstallmentsRouterTest:testMissingMarketWETH() (gas: 768066) -InstallmentsRouterTest:testMoreBorrowsThanMaxPools() (gas: 634272) +InstallmentsRouterTest:testMoreBorrowsThanMaxPools() (gas: 634326) InterestRateModelTest:testFixedBorrowRate() (gas: 2054838) InterestRateModelTest:testFixedRateRevertAlreadyMatured() (gas: 2049020) InterestRateModelTest:testFixedRateRevertUtilizationExceeded() (gas: 2056183) InterestRateModelTest:testFloatingBorrowRate() (gas: 2048324) InterestRateModelTest:testFuzzFixedRateGrowth(uint256,uint256,uint256,uint256) (runs: 256, μ: 2069159, ~: 2066427) InterestRateModelTest:testFuzzFixedRateTimeSensitivity(uint256,uint256,uint256) (runs: 256, μ: 2075956, ~: 2075994) -InterestRateModelTest:testFuzzReferenceLegacyRateFixed(uint32,uint256,uint256[2],uint256[2],uint256,uint256,uint256) (runs: 256, μ: 10068618, ~: 10189525) +InterestRateModelTest:testFuzzReferenceLegacyRateFixed(uint32,uint256,uint256[2],uint256[2],uint256,uint256,uint256) (runs: 256, μ: 10077377, ~: 10198301) InterestRateModelTest:testFuzzReferenceRateFixed(uint256,uint256,uint256,uint256,uint256,uint256,(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,int256,uint256,uint256)) (runs: 256, μ: 2340184, ~: 2342095) InterestRateModelTest:testFuzzReferenceRateFloating(uint256,uint256,(uint256,uint256,uint256,uint256,uint256,uint256,uint256)) (runs: 256, μ: 2278308, ~: 2279144) InterestRateModelTest:testMinTimeToMaturity() (gas: 2066338) InterestRateModelTest:testRevertMaxUtilizationLowerThanWad() (gas: 266877) -MarketTest:testAccountLiquidityAdjustedDebt() (gas: 499501) -MarketTest:testAccrueEarningsBeforeLiquidation() (gas: 1253185) -MarketTest:testAnotherUserRedeemWhenOwnerHasShortfall() (gas: 819136) -MarketTest:testAnotherUserWithdrawWhenOwnerHasShortfall() (gas: 806806) -MarketTest:testBorrowAfterFreezing() (gas: 491397) -MarketTest:testBorrowAtMaturity() (gas: 499605) -MarketTest:testBorrowAtMaturityAfterFreezing() (gas: 573221) -MarketTest:testBorrowAtMaturityUpdatesFloatingDebtAndFloatingAssets() (gas: 884716) +MarketTest:testAccountLiquidityAdjustedDebt() (gas: 499555) +MarketTest:testAccrueEarningsBeforeLiquidation() (gas: 1253412) +MarketTest:testAnotherUserRedeemWhenOwnerHasShortfall() (gas: 819226) +MarketTest:testAnotherUserWithdrawWhenOwnerHasShortfall() (gas: 806896) +MarketTest:testBorrowAfterFreezing() (gas: 491451) +MarketTest:testBorrowAtMaturity() (gas: 499659) +MarketTest:testBorrowAtMaturityAfterFreezing() (gas: 573275) +MarketTest:testBorrowAtMaturityUpdatesFloatingDebtAndFloatingAssets() (gas: 884806) MarketTest:testBorrowAtMaturityWhenFrozen() (gas: 93718) MarketTest:testBorrowAtMaturityWithZeroAssets() (gas: 40403) -MarketTest:testBorrowDisagreement() (gas: 295476) -MarketTest:testBorrowFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 1294375) +MarketTest:testBorrowDisagreement() (gas: 295512) +MarketTest:testBorrowFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 1294519) MarketTest:testBorrowWhenFrozen() (gas: 93157) MarketTest:testBorrowWithZeroAssets() (gas: 39771) -MarketTest:testCappedLiquidation() (gas: 1199751) -MarketTest:testChargeTreasuryToEarlyWithdraws() (gas: 1218557) -MarketTest:testChargeTreasuryToFixedBorrows() (gas: 1579309) -MarketTest:testClearBadDebtAvoidingFixedBorrowsIfAccumulatorLower() (gas: 2280336) -MarketTest:testClearBadDebtBeforeMaturity() (gas: 2345708) +MarketTest:testCappedLiquidation() (gas: 1199895) +MarketTest:testChargeTreasuryToEarlyWithdraws() (gas: 1218701) +MarketTest:testChargeTreasuryToFixedBorrows() (gas: 1579435) +MarketTest:testClearBadDebtAvoidingFixedBorrowsIfAccumulatorLower() (gas: 2280498) +MarketTest:testClearBadDebtBeforeMaturity() (gas: 2346043) MarketTest:testClearBadDebtCalledByAccount() (gas: 35043) -MarketTest:testClearBadDebtEmptiesUnassignedEarnings() (gas: 2497935) -MarketTest:testClearBadDebtExactlyRepaysFixedBorrowWithAccumulatorAmount() (gas: 2010734) -MarketTest:testClearBadDebtPartiallyRepaysEachFixedBorrow() (gas: 1959023) -MarketTest:testClearBadDebtPartiallyRepaysFloatingDebt() (gas: 2298811) -MarketTest:testClearBadDebtShouldAccrueAccumulatedEarningsBeforeSpreadingLosses() (gas: 2078219) -MarketTest:testClearBadDebtWithEmptyAccumulatorShouldNotRevert() (gas: 969910) -MarketTest:testClearMaturity() (gas: 1684770) -MarketTest:testCollectTreasuryFreeLunchToEarlyWithdraws() (gas: 1766256) -MarketTest:testCollectTreasuryFreeLunchToEarlyWithdrawsWithZeroFees() (gas: 559359) -MarketTest:testCollectTreasuryFreeLunchToFixedBorrows() (gas: 1811686) -MarketTest:testCollectTreasuryFreeLunchToFixedBorrowsWithZeroFees() (gas: 722757) -MarketTest:testCrossMaturityLiquidation() (gas: 2625052) -MarketTest:testDepositAfterFreezing() (gas: 256227) -MarketTest:testDepositAtMaturity() (gas: 193500) -MarketTest:testDepositAtMaturityAfterFreezing() (gas: 267471) +MarketTest:testClearBadDebtEmptiesUnassignedEarnings() (gas: 2498306) +MarketTest:testClearBadDebtExactlyRepaysFixedBorrowWithAccumulatorAmount() (gas: 2010914) +MarketTest:testClearBadDebtPartiallyRepaysEachFixedBorrow() (gas: 1959250) +MarketTest:testClearBadDebtPartiallyRepaysFloatingDebt() (gas: 2289455) +MarketTest:testClearBadDebtShouldAccrueAccumulatedEarningsBeforeSpreadingLosses() (gas: 2078399) +MarketTest:testClearBadDebtWithEmptyAccumulatorShouldNotRevert() (gas: 970000) +MarketTest:testClearMaturity() (gas: 1684954) +MarketTest:testCollectTreasuryFreeLunchToEarlyWithdraws() (gas: 1766472) +MarketTest:testCollectTreasuryFreeLunchToEarlyWithdrawsWithZeroFees() (gas: 559449) +MarketTest:testCollectTreasuryFreeLunchToFixedBorrows() (gas: 1811884) +MarketTest:testCollectTreasuryFreeLunchToFixedBorrowsWithZeroFees() (gas: 722847) +MarketTest:testCrossMaturityLiquidation() (gas: 2625250) +MarketTest:testDepositAfterFreezing() (gas: 256263) +MarketTest:testDepositAtMaturity() (gas: 193536) +MarketTest:testDepositAtMaturityAfterFreezing() (gas: 267507) MarketTest:testDepositAtMaturityWhenFrozen() (gas: 93231) MarketTest:testDepositAtMaturityWithZeroAssets() (gas: 39977) MarketTest:testDepositDisagreement() (gas: 73904) -MarketTest:testDepositShouldUpdateFlexibleBorrowVariables() (gas: 716971) -MarketTest:testDepositToSmartPool() (gas: 181849) -MarketTest:testDepositWhenFrozen() (gas: 176471) -MarketTest:testDistributeMultipleAccumulatedEarnings() (gas: 1373914) -MarketTest:testDistributionOfLossesShouldReduceFromFloatingBackupBorrowedAccordingly() (gas: 6410156) -MarketTest:testEarlyRepayLiquidationUnassignedEarnings() (gas: 2116898) -MarketTest:testEarlyRepaymentWithExcessiveAmountOfFees() (gas: 3426434) -MarketTest:testEarlyWithdrawFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 1050103) +MarketTest:testDepositShouldUpdateFlexibleBorrowVariables() (gas: 717097) +MarketTest:testDepositToSmartPool() (gas: 181885) +MarketTest:testDepositWhenFrozen() (gas: 176507) +MarketTest:testDistributeMultipleAccumulatedEarnings() (gas: 1374112) +MarketTest:testDistributionOfLossesShouldReduceFromFloatingBackupBorrowedAccordingly() (gas: 6410869) +MarketTest:testEarlyRepayLiquidationUnassignedEarnings() (gas: 2117114) +MarketTest:testEarlyRepaymentWithExcessiveAmountOfFees() (gas: 3426578) +MarketTest:testEarlyWithdrawFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 1050247) MarketTest:testEmergencyAdminRole() (gas: 322263) MarketTest:testEmitFrozen() (gas: 91047) -MarketTest:testFixedBorrowFailingWhenFlexibleBorrowAccruesDebt() (gas: 1530894) -MarketTest:testFixedBorrowRateToMaturity() (gas: 562527) -MarketTest:testFixedOperationsUpdateFloatingDebt() (gas: 865391) -MarketTest:testFlexibleBorrow() (gas: 423656) -MarketTest:testFlexibleBorrowAccountingDebt() (gas: 607131) -MarketTest:testFlexibleBorrowChargingDebtToTreasury() (gas: 751177) -MarketTest:testFlexibleBorrowExceedingReserve() (gas: 878430) -MarketTest:testFlexibleBorrowExceedingReserveIncludingFixedBorrow() (gas: 1267485) -MarketTest:testFlexibleBorrowExceedingReserveWithNewDebt() (gas: 1001209) -MarketTest:testFlexibleBorrowFromAnotherUserSubtractsAllowance() (gas: 469265) -MarketTest:testFlexibleBorrowFromAnotherUserWithAllowance() (gas: 458681) -MarketTest:testFlexibleBorrowFromAnotherUserWithoutAllowance() (gas: 252381) -MarketTest:testFrontRunSmartPoolEarningsDistributionWithBigPenaltyRepayment() (gas: 1373093) -MarketTest:testFullPause() (gas: 5959965) +MarketTest:testFixedBorrowFailingWhenFlexibleBorrowAccruesDebt() (gas: 1530984) +MarketTest:testFixedBorrowRateToMaturity() (gas: 562581) +MarketTest:testFixedOperationsUpdateFloatingDebt() (gas: 865535) +MarketTest:testFlexibleBorrow() (gas: 423710) +MarketTest:testFlexibleBorrowAccountingDebt() (gas: 607257) +MarketTest:testFlexibleBorrowChargingDebtToTreasury() (gas: 751249) +MarketTest:testFlexibleBorrowExceedingReserve() (gas: 878556) +MarketTest:testFlexibleBorrowExceedingReserveIncludingFixedBorrow() (gas: 1267629) +MarketTest:testFlexibleBorrowExceedingReserveWithNewDebt() (gas: 1001317) +MarketTest:testFlexibleBorrowFromAnotherUserSubtractsAllowance() (gas: 469319) +MarketTest:testFlexibleBorrowFromAnotherUserWithAllowance() (gas: 458735) +MarketTest:testFlexibleBorrowFromAnotherUserWithoutAllowance() (gas: 252417) +MarketTest:testFrontRunSmartPoolEarningsDistributionWithBigPenaltyRepayment() (gas: 1373291) +MarketTest:testFullPause() (gas: 5960469) MarketTest:testInitiallyUnfrozen() (gas: 15592) -MarketTest:testInsufficientProtocolLiquidity() (gas: 1940330) -MarketTest:testLiquidateAndChargeIncentiveForLenders() (gas: 2433480) -MarketTest:testLiquidateAndDistributeLosses() (gas: 3234382) -MarketTest:testLiquidateAndSeizeExactAmountWithDustAsCollateral() (gas: 2800638) -MarketTest:testLiquidateAndSeizeFromEmptyCollateral() (gas: 1043463) -MarketTest:testLiquidateAndSubtractLossesFromAccumulator() (gas: 3899599) -MarketTest:testLiquidateFlexibleAndFixedBorrowPositionsInSingleCall() (gas: 2638533) -MarketTest:testLiquidateFlexibleBorrow() (gas: 2160663) -MarketTest:testLiquidateFlexibleBorrowChargeLendersAssetsToLiquidator() (gas: 1152409) -MarketTest:testLiquidateFlexibleBorrowConsideringDebtOverTime() (gas: 1167683) -MarketTest:testLiquidateLeavingDustAsCollateral() (gas: 3646059) -MarketTest:testLiquidateTransferRepayAssetsBeforeSeize() (gas: 1045359) -MarketTest:testLiquidateUpdateFloatingDebt() (gas: 1903228) -MarketTest:testLiquidateWhenFrozen() (gas: 1232974) -MarketTest:testLiquidateWithTwoUnitsAsMaxAssets() (gas: 1579217) -MarketTest:testLiquidateWithZeroAsMaxAssets() (gas: 1043412) -MarketTest:testLiquidationClearingDebtOfAllAccountMarkets() (gas: 3098516) -MarketTest:testLiquidationResultingInZeroCollateralAndZeroDebt() (gas: 1975363) -MarketTest:testMaturityInsufficientProtocolLiquidity() (gas: 1464114) -MarketTest:testMultipleBorrowsForMultipleAssets() (gas: 2463576251) -MarketTest:testMultipleDepositsToSmartPool() (gas: 915573) -MarketTest:testMultipleFixedBorrowsRepays() (gas: 1348413) -MarketTest:testMultipleLiquidationSameUser() (gas: 2944378) -MarketTest:testNotEnteredMarketShouldNotBeSeized() (gas: 8590039) +MarketTest:testInsufficientProtocolLiquidity() (gas: 1940492) +MarketTest:testLiquidateAndChargeIncentiveForLenders() (gas: 2433678) +MarketTest:testLiquidateAndDistributeLosses() (gas: 3234717) +MarketTest:testLiquidateAndSeizeExactAmountWithDustAsCollateral() (gas: 2800955) +MarketTest:testLiquidateAndSeizeFromEmptyCollateral() (gas: 1043553) +MarketTest:testLiquidateAndSubtractLossesFromAccumulator() (gas: 3900237) +MarketTest:testLiquidateFlexibleAndFixedBorrowPositionsInSingleCall() (gas: 2638821) +MarketTest:testLiquidateFlexibleBorrow() (gas: 2160915) +MarketTest:testLiquidateFlexibleBorrowChargeLendersAssetsToLiquidator() (gas: 1152553) +MarketTest:testLiquidateFlexibleBorrowConsideringDebtOverTime() (gas: 1167827) +MarketTest:testLiquidateLeavingDustAsCollateral() (gas: 3646412) +MarketTest:testLiquidateTransferRepayAssetsBeforeSeize() (gas: 1045467) +MarketTest:testLiquidateUpdateFloatingDebt() (gas: 1903408) +MarketTest:testLiquidateWhenFrozen() (gas: 1233118) +MarketTest:testLiquidateWithTwoUnitsAsMaxAssets() (gas: 1579379) +MarketTest:testLiquidateWithZeroAsMaxAssets() (gas: 1043502) +MarketTest:testLiquidationClearingDebtOfAllAccountMarkets() (gas: 3098822) +MarketTest:testLiquidationResultingInZeroCollateralAndZeroDebt() (gas: 1975644) +MarketTest:testMaturityInsufficientProtocolLiquidity() (gas: 1464276) +MarketTest:testMultipleBorrowsForMultipleAssets() (gas: 2463626991) +MarketTest:testMultipleDepositsToSmartPool() (gas: 915825) +MarketTest:testMultipleFixedBorrowsRepays() (gas: 1348597) +MarketTest:testMultipleLiquidationSameUser() (gas: 2944767) +MarketTest:testNotEnteredMarketShouldNotBeSeized() (gas: 8598833) MarketTest:testOnlyAdminCanFreezeUnfreeze() (gas: 212203) -MarketTest:testOperationsShouldUpdateFloatingAssetsAverage() (gas: 1445531) -MarketTest:testOperationsWithBtcWbtcRate() (gas: 8267204) -MarketTest:testOperationsWithStEthAsset() (gas: 8152089) +MarketTest:testOperationsShouldUpdateFloatingAssetsAverage() (gas: 1445747) +MarketTest:testOperationsWithBtcWbtcRate() (gas: 8275926) +MarketTest:testOperationsWithStEthAsset() (gas: 8160811) MarketTest:testPausable() (gas: 158136) MarketTest:testPauserRole() (gas: 78228) -MarketTest:testPreviewOperationsWithSmartPoolCorrectlyAccountingEarnings() (gas: 1976306) -MarketTest:testRepayAtMaturity() (gas: 586727) -MarketTest:testRepayDisagreement() (gas: 594059) -MarketTest:testRepayFlexibleBorrow() (gas: 1076284) -MarketTest:testRepayWhenFrozen() (gas: 535326) -MarketTest:testRoundingDownAssetsToValidateShortfallWhenTransferring() (gas: 7561628) -MarketTest:testRoundingDownAssetsToValidateShortfallWhenTransferringFrom() (gas: 7616914) -MarketTest:testRoundingDownAssetsWhenTransferingFromAnAccountWithoutShortfall() (gas: 1030183) -MarketTest:testRoundingDownAssetsWhenTransferingWithAnAccountWithoutShortfall() (gas: 974749) -MarketTest:testRoundingUpAllowanceWhenBorrowingAtMaturity() (gas: 845713) -MarketTest:testRoundingUpAllowanceWhenWithdrawingAtMaturity() (gas: 791732) +MarketTest:testPreviewOperationsWithSmartPoolCorrectlyAccountingEarnings() (gas: 1976594) +MarketTest:testRepayAtMaturity() (gas: 586817) +MarketTest:testRepayDisagreement() (gas: 594113) +MarketTest:testRepayFlexibleBorrow() (gas: 1076500) +MarketTest:testRepayWhenFrozen() (gas: 535416) +MarketTest:testRoundingDownAssetsToValidateShortfallWhenTransferring() (gas: 7570428) +MarketTest:testRoundingDownAssetsToValidateShortfallWhenTransferringFrom() (gas: 7625714) +MarketTest:testRoundingDownAssetsWhenTransferingFromAnAccountWithoutShortfall() (gas: 1030309) +MarketTest:testRoundingDownAssetsWhenTransferingWithAnAccountWithoutShortfall() (gas: 974875) +MarketTest:testRoundingUpAllowanceWhenBorrowingAtMaturity() (gas: 845785) +MarketTest:testRoundingUpAllowanceWhenWithdrawingAtMaturity() (gas: 791822) MarketTest:testSetAssetSymbol() (gas: 55035) MarketTest:testSetAssetSymbolNotAdmin() (gas: 66288) -MarketTest:testSetDampSpeedFactorShouldUpdateFloatingAssetsAverage() (gas: 386872) -MarketTest:testSetEarningsAccumulatorSmoothFactorShouldDistributeEarnings() (gas: 722432) -MarketTest:testSetInterestRateModelShouldUpdateFloatingDebt() (gas: 2803542) -MarketTest:testSetInterestRateModelWithAddressZeroShouldNotUpdateFloatingDebt() (gas: 2573368) -MarketTest:testShareValueNotDecreasingAfterDeposit() (gas: 707864) -MarketTest:testShareValueNotDecreasingWhenMintingToTreasury() (gas: 763200) -MarketTest:testSingleFloatingBorrow() (gas: 417427) -MarketTest:testSingleFloatingRepay() (gas: 484649) -MarketTest:testSmartPoolEarningsDistribution() (gas: 1095688) -MarketTest:testSmartPoolSharesDoNotAccountUnassignedEarningsFromMoreThanOneIntervalPastMaturities() (gas: 528463) -MarketTest:testSumDebtPlusEffectsShouldntRoundUpWhenWithdrawing() (gas: 1005585) -MarketTest:testTotalAssetsProjectingBackupEarningsCorrectly() (gas: 508280) -MarketTest:testTotalAssetsProjectingFloatingDebtCorrectly() (gas: 713937) -MarketTest:testUpdateAccumulatedEarningsFactorToZero() (gas: 1473262) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingAndBorrowingContinuously() (gas: 344749) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeBorrow() (gas: 670454) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeEarlyWithdraw() (gas: 630543) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingSomeSecondsBeforeBorrow() (gas: 901042) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeBorrow() (gas: 683518) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeEarlyWithdraw() (gas: 643695) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingSomeSecondsBeforeBorrow() (gas: 373112) -MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedDown() (gas: 358048) -MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedUp() (gas: 199697) +MarketTest:testSetDampSpeedFactorShouldUpdateFloatingAssetsAverage() (gas: 386944) +MarketTest:testSetEarningsAccumulatorSmoothFactorShouldDistributeEarnings() (gas: 722522) +MarketTest:testSetInterestRateModelShouldUpdateFloatingDebt() (gas: 2803596) +MarketTest:testSetInterestRateModelWithAddressZeroShouldNotUpdateFloatingDebt() (gas: 2573422) +MarketTest:testShareValueNotDecreasingAfterDeposit() (gas: 707954) +MarketTest:testShareValueNotDecreasingWhenMintingToTreasury() (gas: 763272) +MarketTest:testSingleFloatingBorrow() (gas: 417481) +MarketTest:testSingleFloatingRepay() (gas: 484739) +MarketTest:testSmartPoolEarningsDistribution() (gas: 1095814) +MarketTest:testSmartPoolSharesDoNotAccountUnassignedEarningsFromMoreThanOneIntervalPastMaturities() (gas: 528517) +MarketTest:testSumDebtPlusEffectsShouldntRoundUpWhenWithdrawing() (gas: 1005711) +MarketTest:testTotalAssetsProjectingBackupEarningsCorrectly() (gas: 508334) +MarketTest:testTotalAssetsProjectingFloatingDebtCorrectly() (gas: 714027) +MarketTest:testUpdateAccumulatedEarningsFactorToZero() (gas: 1473460) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingAndBorrowingContinuously() (gas: 344821) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeBorrow() (gas: 670544) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeEarlyWithdraw() (gas: 630669) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingSomeSecondsBeforeBorrow() (gas: 901150) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeBorrow() (gas: 683590) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeEarlyWithdraw() (gas: 643803) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingSomeSecondsBeforeBorrow() (gas: 373166) +MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedDown() (gas: 358102) +MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedUp() (gas: 199733) MarketTest:testUpdateFloatingDebtBeforeSettingTreasury() (gas: 106417) -MarketTest:testWithdrawAtMaturity() (gas: 304325) -MarketTest:testWithdrawFromSmartPool() (gas: 279221) -MarketTest:testWithdrawShouldUpdateFlexibleBorrowVariables() (gas: 863981) -MarketTest:testWithdrawWhenFrozen() (gas: 325961) +MarketTest:testWithdrawAtMaturity() (gas: 304379) +MarketTest:testWithdrawFromSmartPool() (gas: 279275) +MarketTest:testWithdrawShouldUpdateFlexibleBorrowVariables() (gas: 864071) +MarketTest:testWithdrawWhenFrozen() (gas: 326015) PauserTest:testPauseProtocolFromRando() (gas: 32843) PauserTest:testPauseProtocolWhenMarketsArePaused() (gas: 187722) PauserTest:testPauseProtocolWhenMarketsAreUnpaused() (gas: 130060) @@ -296,77 +296,77 @@ PoolLibTest:testEarningsDistribution() (gas: 32640) PoolLibTest:testFuzzAddRemoveAll(uint8[12]) (runs: 256, μ: 54752, ~: 54026) PoolLibTest:testMaturityRangeLimit() (gas: 7873) PoolLibTest:testMaturityRangeTooWide() (gas: 6831) -PreviewerTest:testAccountsReturningAccurateAmounts() (gas: 1393737) -PreviewerTest:testAccountsReturningUtilizationForDifferentMaturities() (gas: 4187370) -PreviewerTest:testAccountsWithAccountOnlyDeposit() (gas: 862391) -PreviewerTest:testAccountsWithAccountThatHasBalances() (gas: 2265104) +PreviewerTest:testAccountsReturningAccurateAmounts() (gas: 1393791) +PreviewerTest:testAccountsReturningUtilizationForDifferentMaturities() (gas: 4187460) +PreviewerTest:testAccountsWithAccountOnlyDeposit() (gas: 862427) +PreviewerTest:testAccountsWithAccountThatHasBalances() (gas: 2265248) PreviewerTest:testAccountsWithEmptyAccount() (gas: 690558) -PreviewerTest:testAccountsWithIntermediateOperationsReturningAccurateAmounts() (gas: 17646707) -PreviewerTest:testActualTimeBeforeStartDistributionRewards() (gas: 7836506) -PreviewerTest:testEmptyExactly() (gas: 5725652) +PreviewerTest:testAccountsWithIntermediateOperationsReturningAccurateAmounts() (gas: 17655477) +PreviewerTest:testActualTimeBeforeStartDistributionRewards() (gas: 7838504) +PreviewerTest:testEmptyExactly() (gas: 5727596) PreviewerTest:testExactlyReturningInterestRateModelData() (gas: 688149) -PreviewerTest:testFixedAvailableLiquidityProjectingNewFloatingDebt() (gas: 13330761) -PreviewerTest:testFixedPoolsA() (gas: 19352495) +PreviewerTest:testFixedAvailableLiquidityProjectingNewFloatingDebt() (gas: 13339495) +PreviewerTest:testFixedPoolsA() (gas: 19361373) PreviewerTest:testFixedPoolsChangingMaturityInTime() (gas: 1627253) -PreviewerTest:testFixedPoolsRatesAndUtilizations() (gas: 14844249) -PreviewerTest:testFixedPoolsWithFloatingAssetsAverage() (gas: 15667423) -PreviewerTest:testFlexibleAvailableLiquidity() (gas: 17276552) -PreviewerTest:testFlexibleBorrowSharesAndAssets() (gas: 4401038) -PreviewerTest:testFloatingAvailableLiquidityProjectingNewFloatingDebt() (gas: 12583421) -PreviewerTest:testFloatingRateAndUtilization() (gas: 1128246) -PreviewerTest:testJustUpdatedRewardRatesShouldStillReturnRate() (gas: 7255302) -PreviewerTest:testMaxBorrowAssetsCapacity() (gas: 2482200) -PreviewerTest:testMaxBorrowAssetsCapacityForAccountWithShortfall() (gas: 11020952) -PreviewerTest:testMaxBorrowAssetsCapacityPerMarket() (gas: 13233565) -PreviewerTest:testOraclePriceReturningAccurateValues() (gas: 10162792) -PreviewerTest:testPreviewBorrowAtAllMaturitiesReturningAccurateAmount() (gas: 4242626) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmount() (gas: 623428) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1954610) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateUtilization() (gas: 486694) -PreviewerTest:testPreviewBorrowAtMaturityWithFiveUnits() (gas: 423539) -PreviewerTest:testPreviewBorrowAtMaturityWithInvalidMaturity() (gas: 235133) +PreviewerTest:testFixedPoolsRatesAndUtilizations() (gas: 14852965) +PreviewerTest:testFixedPoolsWithFloatingAssetsAverage() (gas: 15676175) +PreviewerTest:testFlexibleAvailableLiquidity() (gas: 17285412) +PreviewerTest:testFlexibleBorrowSharesAndAssets() (gas: 4401146) +PreviewerTest:testFloatingAvailableLiquidityProjectingNewFloatingDebt() (gas: 12592137) +PreviewerTest:testFloatingRateAndUtilization() (gas: 1128300) +PreviewerTest:testJustUpdatedRewardRatesShouldStillReturnRate() (gas: 7257318) +PreviewerTest:testMaxBorrowAssetsCapacity() (gas: 2482254) +PreviewerTest:testMaxBorrowAssetsCapacityForAccountWithShortfall() (gas: 11029656) +PreviewerTest:testMaxBorrowAssetsCapacityPerMarket() (gas: 13242335) +PreviewerTest:testOraclePriceReturningAccurateValues() (gas: 10171406) +PreviewerTest:testPreviewBorrowAtAllMaturitiesReturningAccurateAmount() (gas: 4242842) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmount() (gas: 623482) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1954808) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateUtilization() (gas: 486766) +PreviewerTest:testPreviewBorrowAtMaturityWithFiveUnits() (gas: 423611) +PreviewerTest:testPreviewBorrowAtMaturityWithInvalidMaturity() (gas: 235169) PreviewerTest:testPreviewBorrowAtMaturityWithMaturedMaturity() (gas: 50170) -PreviewerTest:testPreviewBorrowAtMaturityWithOneUnit() (gas: 423606) +PreviewerTest:testPreviewBorrowAtMaturityWithOneUnit() (gas: 423678) PreviewerTest:testPreviewBorrowAtMaturityWithSameTimestamp() (gas: 50088) -PreviewerTest:testPreviewBorrowAtMaturityWithZeroAmount() (gas: 224222) -PreviewerTest:testPreviewDepositAtAllMaturitiesReturningAccurateAmounts() (gas: 2416760) -PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmount() (gas: 798849) -PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1466639) +PreviewerTest:testPreviewBorrowAtMaturityWithZeroAmount() (gas: 224258) +PreviewerTest:testPreviewDepositAtAllMaturitiesReturningAccurateAmounts() (gas: 2416994) +PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmount() (gas: 798939) +PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1466819) PreviewerTest:testPreviewDepositAtMaturityWithEmptyMaturity() (gas: 48940) PreviewerTest:testPreviewDepositAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 48917) PreviewerTest:testPreviewDepositAtMaturityWithInvalidMaturity() (gas: 48920) PreviewerTest:testPreviewDepositAtMaturityWithMaturedMaturity() (gas: 12565) -PreviewerTest:testPreviewDepositAtMaturityWithOneUnit() (gas: 589435) +PreviewerTest:testPreviewDepositAtMaturityWithOneUnit() (gas: 589489) PreviewerTest:testPreviewDepositAtMaturityWithSameTimestamp() (gas: 48970) -PreviewerTest:testPreviewDepositAtMaturityWithZeroAmount() (gas: 589457) -PreviewerTest:testPreviewRepayAtMaturityLastAccrualIsMaturity() (gas: 1427957) -PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmount() (gas: 1249743) -PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1553603) +PreviewerTest:testPreviewDepositAtMaturityWithZeroAmount() (gas: 589511) +PreviewerTest:testPreviewRepayAtMaturityLastAccrualIsMaturity() (gas: 1428101) +PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmount() (gas: 1249887) +PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1553819) PreviewerTest:testPreviewRepayAtMaturityWithEmptyMaturity() (gas: 35313) PreviewerTest:testPreviewRepayAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 35355) PreviewerTest:testPreviewRepayAtMaturityWithInvalidMaturity() (gas: 35355) -PreviewerTest:testPreviewRepayAtMaturityWithMaturedMaturity() (gas: 588647) -PreviewerTest:testPreviewRepayAtMaturityWithOneUnit() (gas: 591870) -PreviewerTest:testPreviewRepayAtMaturityWithSameTimestamp() (gas: 586968) -PreviewerTest:testPreviewRepayAtMaturityWithZeroAmount() (gas: 591825) -PreviewerTest:testPreviewValueInFixedOperations() (gas: 2273008) -PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmount() (gas: 370901) -PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1404481) +PreviewerTest:testPreviewRepayAtMaturityWithMaturedMaturity() (gas: 588701) +PreviewerTest:testPreviewRepayAtMaturityWithOneUnit() (gas: 591924) +PreviewerTest:testPreviewRepayAtMaturityWithSameTimestamp() (gas: 587022) +PreviewerTest:testPreviewRepayAtMaturityWithZeroAmount() (gas: 591879) +PreviewerTest:testPreviewValueInFixedOperations() (gas: 2273134) +PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmount() (gas: 370955) +PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1404661) PreviewerTest:testPreviewWithdrawAtMaturityWithEmptyMaturity() (gas: 35224) PreviewerTest:testPreviewWithdrawAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 35267) -PreviewerTest:testPreviewWithdrawAtMaturityWithFiveUnits() (gas: 251719) +PreviewerTest:testPreviewWithdrawAtMaturityWithFiveUnits() (gas: 251755) PreviewerTest:testPreviewWithdrawAtMaturityWithInvalidMaturity() (gas: 35310) -PreviewerTest:testPreviewWithdrawAtMaturityWithMaturedMaturity() (gas: 233501) -PreviewerTest:testPreviewWithdrawAtMaturityWithOneUnit() (gas: 251718) -PreviewerTest:testPreviewWithdrawAtMaturityWithSameTimestamp() (gas: 233406) -PreviewerTest:testPreviewWithdrawAtMaturityWithZeroAmount() (gas: 251675) +PreviewerTest:testPreviewWithdrawAtMaturityWithMaturedMaturity() (gas: 233537) +PreviewerTest:testPreviewWithdrawAtMaturityWithOneUnit() (gas: 251754) +PreviewerTest:testPreviewWithdrawAtMaturityWithSameTimestamp() (gas: 233442) +PreviewerTest:testPreviewWithdrawAtMaturityWithZeroAmount() (gas: 251711) PreviewerTest:testReserveFactor() (gas: 707280) -PreviewerTest:testReturnRewardAssetUsdPrice() (gas: 6780317) -PreviewerTest:testRewardsRateAfterDistributionEnd() (gas: 7561623) -PreviewerTest:testRewardsRateOnlyWithFixedBorrows() (gas: 6868753) -PreviewerTest:testRewardsRateWithDifferentRewardLengths() (gas: 19353280) -PreviewerTest:testRewardsRateWithMarketWithDifferentDecimals() (gas: 18484755) -PreviewerTest:testRewardsRateX() (gas: 8208254) +PreviewerTest:testReturnRewardAssetUsdPrice() (gas: 6782261) +PreviewerTest:testRewardsRateAfterDistributionEnd() (gas: 7563675) +PreviewerTest:testRewardsRateOnlyWithFixedBorrows() (gas: 6870751) +PreviewerTest:testRewardsRateWithDifferentRewardLengths() (gas: 19363940) +PreviewerTest:testRewardsRateWithMarketWithDifferentDecimals() (gas: 18495379) +PreviewerTest:testRewardsRateX() (gas: 8210270) PriceFeedDoubleTest:testPriceFeedDoubleReturningAccurateDecimals() (gas: 605925) PriceFeedDoubleTest:testPriceFeedDoubleReturningPrice() (gas: 53190) PriceFeedDoubleTest:testPriceFeedDoubleWithActualOnChainValues() (gas: 76310) @@ -387,74 +387,74 @@ RatePreviewerTest:testPreviewRate() (gas: 956610) RatePreviewerTest:testPreviewRateAfterFloatingDepositAndBorrow() (gas: 1059931) RatePreviewerTest:testSnapshot() (gas: 1029231) RatePreviewerTest:testSnapshotWithSignificantElapsedTime() (gas: 1063339) -RewardsControllerTest:testAccountKeeperClaimOnBehalfOf() (gas: 1294500) -RewardsControllerTest:testAccrueRewardsForWholeDistributionPeriod() (gas: 1246256) -RewardsControllerTest:testAccrueRewardsWithBadDebtClearingOfFixedBorrow() (gas: 3340281) -RewardsControllerTest:testAccrueRewardsWithRepayOfBorrowBalance() (gas: 1603825) -RewardsControllerTest:testAccrueRewardsWithRepayOfFixedBorrowBalance() (gas: 1793165) -RewardsControllerTest:testAccrueRewardsWithSeizeOfAllDepositShares() (gas: 1992324) -RewardsControllerTest:testAfterDistributionPeriodEnd() (gas: 1819278) -RewardsControllerTest:testAllClaimableUSDCWithAnotherAccountInPool() (gas: 2274712) -RewardsControllerTest:testAllClaimableUSDCWithDeposit() (gas: 1628638) -RewardsControllerTest:testAllClaimableUSDCWithFloatingBorrow() (gas: 1560714) -RewardsControllerTest:testAllClaimableUSDCWithFloatingRefund() (gas: 1668007) -RewardsControllerTest:testAllClaimableUSDCWithFloatingRepay() (gas: 1674608) -RewardsControllerTest:testAllClaimableUSDCWithMint() (gas: 1284944) -RewardsControllerTest:testAllClaimableUSDCWithRedeem() (gas: 1641275) -RewardsControllerTest:testAllClaimableUSDCWithTransfer() (gas: 2221728) -RewardsControllerTest:testAllClaimableUSDCWithTransferFrom() (gas: 2136601) -RewardsControllerTest:testAllClaimableUSDCWithWithdraw() (gas: 1642288) -RewardsControllerTest:testAllClaimableWETH() (gas: 1248420) -RewardsControllerTest:testAllClaimableWithMaturedFixedPool() (gas: 1128558) -RewardsControllerTest:testAllClaimableWithTimeElapsedZero() (gas: 1625735) -RewardsControllerTest:testAllRewards() (gas: 216448) -RewardsControllerTest:testClaim() (gas: 1193011) -RewardsControllerTest:testClaimAll() (gas: 2189950) -RewardsControllerTest:testClaimMarketWithoutRewards() (gas: 1241426) -RewardsControllerTest:testClaimWithNotEnabledRewardAsset() (gas: 1223553) -RewardsControllerTest:testConfigSettingNewStartWithOnGoingDistributionShouldNotUpdate() (gas: 430420) -RewardsControllerTest:testConfigWithDistributionNotYetStartedShouldNotFail() (gas: 613268) +RewardsControllerTest:testAccountKeeperClaimOnBehalfOf() (gas: 1294572) +RewardsControllerTest:testAccrueRewardsForWholeDistributionPeriod() (gas: 1246328) +RewardsControllerTest:testAccrueRewardsWithBadDebtClearingOfFixedBorrow() (gas: 3340533) +RewardsControllerTest:testAccrueRewardsWithRepayOfBorrowBalance() (gas: 1603969) +RewardsControllerTest:testAccrueRewardsWithRepayOfFixedBorrowBalance() (gas: 1793309) +RewardsControllerTest:testAccrueRewardsWithSeizeOfAllDepositShares() (gas: 1992522) +RewardsControllerTest:testAfterDistributionPeriodEnd() (gas: 1819350) +RewardsControllerTest:testAllClaimableUSDCWithAnotherAccountInPool() (gas: 2274820) +RewardsControllerTest:testAllClaimableUSDCWithDeposit() (gas: 1628692) +RewardsControllerTest:testAllClaimableUSDCWithFloatingBorrow() (gas: 1560804) +RewardsControllerTest:testAllClaimableUSDCWithFloatingRefund() (gas: 1668133) +RewardsControllerTest:testAllClaimableUSDCWithFloatingRepay() (gas: 1674734) +RewardsControllerTest:testAllClaimableUSDCWithMint() (gas: 1284998) +RewardsControllerTest:testAllClaimableUSDCWithRedeem() (gas: 1641383) +RewardsControllerTest:testAllClaimableUSDCWithTransfer() (gas: 2221818) +RewardsControllerTest:testAllClaimableUSDCWithTransferFrom() (gas: 2136691) +RewardsControllerTest:testAllClaimableUSDCWithWithdraw() (gas: 1642396) +RewardsControllerTest:testAllClaimableWETH() (gas: 1248474) +RewardsControllerTest:testAllClaimableWithMaturedFixedPool() (gas: 1128612) +RewardsControllerTest:testAllClaimableWithTimeElapsedZero() (gas: 1625879) +RewardsControllerTest:testAllRewards() (gas: 216484) +RewardsControllerTest:testClaim() (gas: 1193101) +RewardsControllerTest:testClaimAll() (gas: 2190094) +RewardsControllerTest:testClaimMarketWithoutRewards() (gas: 1241534) +RewardsControllerTest:testClaimWithNotEnabledRewardAsset() (gas: 1223625) +RewardsControllerTest:testConfigSettingNewStartWithOnGoingDistributionShouldNotUpdate() (gas: 430456) +RewardsControllerTest:testConfigWithDistributionNotYetStartedShouldNotFail() (gas: 613304) RewardsControllerTest:testConfigWithTransitionFactorHigherOrEqThanCap() (gas: 107077) RewardsControllerTest:testConfigWithZeroDepositAllocationWeightFactorShouldRevert() (gas: 71430) -RewardsControllerTest:testDifferentDistributionTimeForDifferentRewards() (gas: 2026432) -RewardsControllerTest:testEmitAccrue() (gas: 1319086) -RewardsControllerTest:testEmitClaimRewards() (gas: 1113375) +RewardsControllerTest:testDifferentDistributionTimeForDifferentRewards() (gas: 2026540) +RewardsControllerTest:testEmitAccrue() (gas: 1319194) +RewardsControllerTest:testEmitClaimRewards() (gas: 1113447) RewardsControllerTest:testEmitConfigUpdate() (gas: 439433) -RewardsControllerTest:testEmitIndexUpdate() (gas: 1447380) -RewardsControllerTest:testLastUndistributed() (gas: 2192657) -RewardsControllerTest:testLastUpdateAfterDistributionPeriodEnd() (gas: 1848872) +RewardsControllerTest:testEmitIndexUpdate() (gas: 1447470) +RewardsControllerTest:testLastUndistributed() (gas: 2192819) +RewardsControllerTest:testLastUpdateAfterDistributionPeriodEnd() (gas: 1848962) RewardsControllerTest:testNotKeeperClaimOnBehalfOf() (gas: 185650) -RewardsControllerTest:testOperationAfterDistributionEnded() (gas: 723254) -RewardsControllerTest:testOperationsBeforeDistributionStart() (gas: 1675913) -RewardsControllerTest:testPermitClaim() (gas: 1276089) -RewardsControllerTest:testSetDistributionConfigWithDifferentDecimals() (gas: 11478229) +RewardsControllerTest:testOperationAfterDistributionEnded() (gas: 723308) +RewardsControllerTest:testOperationsBeforeDistributionStart() (gas: 1676021) +RewardsControllerTest:testPermitClaim() (gas: 1276179) +RewardsControllerTest:testSetDistributionConfigWithDifferentDecimals() (gas: 11487059) RewardsControllerTest:testSetDistributionOperationShouldUpdateIndex() (gas: 136066) -RewardsControllerTest:testSetDistributionWithOnGoingMarketOperations() (gas: 1202681) -RewardsControllerTest:testSetHigherTotalDistribution() (gas: 1833726) +RewardsControllerTest:testSetDistributionWithOnGoingMarketOperations() (gas: 1202753) +RewardsControllerTest:testSetHigherTotalDistribution() (gas: 1833816) RewardsControllerTest:testSetKeeperOnlyAdminRole() (gas: 118463) -RewardsControllerTest:testSetLowerAndEqualDistributionPeriodThanCurrentTimestampShouldRevert() (gas: 1275540) -RewardsControllerTest:testSetLowerAndEqualTotalDistributionThanReleasedShouldRevert() (gas: 1268587) -RewardsControllerTest:testSetLowerDistributionPeriod() (gas: 2287785) -RewardsControllerTest:testSetLowerDistributionPeriodAndLowerTotalDistribution() (gas: 2290510) -RewardsControllerTest:testSetLowerTotalDistribution() (gas: 1833661) -RewardsControllerTest:testSetNewDistributionPeriod() (gas: 3148899) -RewardsControllerTest:testSetNewDistributionPeriodAfterDistributionEnds() (gas: 1407763) -RewardsControllerTest:testSetNewTargetDebt() (gas: 1673516) -RewardsControllerTest:testSetNewTargetDebtAfterDistributionEnds() (gas: 1737248) -RewardsControllerTest:testSetNewTargetDebtWithClaimOnlyAtEnd() (gas: 1390985) -RewardsControllerTest:testSetNewTreasuryFeeShouldImpactAllocation() (gas: 659010) -RewardsControllerTest:testSetTargetDebtMultipleTimes() (gas: 2722301) -RewardsControllerTest:testSetTargetDebtMultipleTimesAfterEnd() (gas: 2759213) -RewardsControllerTest:testSetTotalDistributionMultipleTimes() (gas: 1839868) -RewardsControllerTest:testTriggerHandleBorrowHookBeforeUpdatingFloatingDebt() (gas: 1879936) -RewardsControllerTest:testUpdateConfig() (gas: 1330028) -RewardsControllerTest:testUpdateIndexesWithUtilizationEqualToOne() (gas: 1258855) -RewardsControllerTest:testUpdateIndexesWithUtilizationHigherThanOne() (gas: 1353685) -RewardsControllerTest:testUpdateWithTotalDebtZeroShouldUpdateLastUndistributed() (gas: 575907) -RewardsControllerTest:testUtilizationEqualZero() (gas: 922132) -RewardsControllerTest:testWithTwelveFixedPools() (gas: 8061113) -RewardsControllerTest:testWithdrawAllRewardBalance() (gas: 71913) -RewardsControllerTest:testWithdrawOnlyAdminRole() (gas: 122264) +RewardsControllerTest:testSetLowerAndEqualDistributionPeriodThanCurrentTimestampShouldRevert() (gas: 1275594) +RewardsControllerTest:testSetLowerAndEqualTotalDistributionThanReleasedShouldRevert() (gas: 1268641) +RewardsControllerTest:testSetLowerDistributionPeriod() (gas: 2287893) +RewardsControllerTest:testSetLowerDistributionPeriodAndLowerTotalDistribution() (gas: 2290618) +RewardsControllerTest:testSetLowerTotalDistribution() (gas: 1833751) +RewardsControllerTest:testSetNewDistributionPeriod() (gas: 3149025) +RewardsControllerTest:testSetNewDistributionPeriodAfterDistributionEnds() (gas: 1407835) +RewardsControllerTest:testSetNewTargetDebt() (gas: 1673606) +RewardsControllerTest:testSetNewTargetDebtAfterDistributionEnds() (gas: 1737338) +RewardsControllerTest:testSetNewTargetDebtWithClaimOnlyAtEnd() (gas: 1391057) +RewardsControllerTest:testSetNewTreasuryFeeShouldImpactAllocation() (gas: 659064) +RewardsControllerTest:testSetTargetDebtMultipleTimes() (gas: 2722409) +RewardsControllerTest:testSetTargetDebtMultipleTimesAfterEnd() (gas: 2759321) +RewardsControllerTest:testSetTotalDistributionMultipleTimes() (gas: 1839940) +RewardsControllerTest:testTriggerHandleBorrowHookBeforeUpdatingFloatingDebt() (gas: 1880116) +RewardsControllerTest:testUpdateConfig() (gas: 1330100) +RewardsControllerTest:testUpdateIndexesWithUtilizationEqualToOne() (gas: 1258963) +RewardsControllerTest:testUpdateIndexesWithUtilizationHigherThanOne() (gas: 1353793) +RewardsControllerTest:testUpdateWithTotalDebtZeroShouldUpdateLastUndistributed() (gas: 575979) +RewardsControllerTest:testUtilizationEqualZero() (gas: 922222) +RewardsControllerTest:testWithTwelveFixedPools() (gas: 8061419) +RewardsControllerTest:testWithdrawAllRewardBalance() (gas: 71931) +RewardsControllerTest:testWithdrawOnlyAdminRole() (gas: 122282) StakedEXATest:invariantAvgIndexUpOnly() (runs: 10, calls: 5000, reverts: 0) StakedEXATest:invariantAvgStartUpOnly() (runs: 10, calls: 5000, reverts: 0) StakedEXATest:invariantIndexUpOnly() (runs: 10, calls: 5000, reverts: 0) @@ -555,12 +555,12 @@ StakingPreviewerTest:testAllClaimed() (gas: 639614) StakingPreviewerTest:testAllEarned() (gas: 322414) StakingPreviewerTest:testAllRewards() (gas: 490331) StakingPreviewerTest:testStaking() (gas: 538504) -SwapperTest:testSwapBasic() (gas: 216831) -SwapperTest:testSwapWithAllowance() (gas: 481530) -SwapperTest:testSwapWithInaccurateSlippageSendsETHToAccount() (gas: 297968) -SwapperTest:testSwapWithKeepAmount() (gas: 223809) +SwapperTest:testSwapBasic() (gas: 216849) +SwapperTest:testSwapWithAllowance() (gas: 481584) +SwapperTest:testSwapWithInaccurateSlippageSendsETHToAccount() (gas: 297986) +SwapperTest:testSwapWithKeepAmount() (gas: 223827) SwapperTest:testSwapWithKeepEqualToValue() (gas: 67579) SwapperTest:testSwapWithKeepHigherThanValue() (gas: 67600) -SwapperTest:testSwapWithPermit() (gas: 478910) -SwapperTest:testSwapWithPermit2() (gas: 482813) +SwapperTest:testSwapWithPermit() (gas: 478953) +SwapperTest:testSwapWithPermit2() (gas: 482831) VotePreviewerTest:testExternalVotes() (gas: 246642) \ No newline at end of file diff --git a/contracts/Market.sol b/contracts/Market.sol index fe3cf9e6..e04c3030 100644 --- a/contracts/Market.sol +++ b/contracts/Market.sol @@ -653,6 +653,7 @@ contract Market is Initializable, AccessControlUpgradeable, PausableUpgradeable, ); fixedPools[maturity].unassignedEarnings -= yield; earningsAccumulator += yield; + accumulator += yield; } delete fixedBorrowPositions[maturity][borrower]; diff --git a/test/Market.t.sol b/test/Market.t.sol index a3f4fce8..a5303e8a 100644 --- a/test/Market.t.sol +++ b/test/Market.t.sol @@ -1279,9 +1279,9 @@ contract MarketTest is Test { assertEq(marketWETH.earningsAccumulator(), 20 ether); daiPriceFeed.setPrice(1); - // clear the first fixed borrow debt and 1/5 of the floating debt with accumulator's earnings + // clear the first fixed borrow debt and more than 1/5 of the floating debt with accumulator's earnings vm.expectEmit(true, true, true, true, address(marketWETH)); - emit Repay(address(auditor), address(this), 10 ether, 10 ether); + emit Repay(address(auditor), address(this), 15 ether, 15 ether); auditor.handleBadDebt(address(this)); // only first fixed borrow is covered @@ -1292,8 +1292,8 @@ contract MarketTest is Test { (, , uint256 unassignedEarningsAfter, ) = market.fixedPools(FixedLib.INTERVAL); assertEq(unassignedEarningsAfter, 0); assertEq(principal + fee, 400 ether); - assertEq(marketWETH.previewRefund(floatingBorrowShares), 40 ether); - assertEq(marketWETH.earningsAccumulator(), 5 ether); + assertEq(marketWETH.previewRefund(floatingBorrowShares), 35 ether); + assertEq(marketWETH.earningsAccumulator(), 0); } function testClearBadDebtAvoidingFixedBorrowsIfAccumulatorLower() external {