From 9bd8d2e29f5d9893d88e3a972e210b6ed06827bc Mon Sep 17 00:00:00 2001 From: itofarina Date: Tue, 26 Mar 2024 14:00:19 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20market:=20set=20custom=20name=20and?= =?UTF-8?q?=20symbol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/purple-icons-rescue.md | 5 + .gas-snapshot | 516 +++++++++++++++--------------- contracts/Market.sol | 12 +- deploy/Markets.ts | 1 + test/InstallmentsRouter.t.sol | 2 + test/InterestRateModel.t.sol | 2 +- test/Market.t.sol | 29 +- test/Previewer.t.sol | 14 +- test/Protocol.t.sol | 2 +- test/RewardsController.t.sol | 15 +- test/hardhat/defaultEnv.ts | 1 + 11 files changed, 334 insertions(+), 265 deletions(-) create mode 100644 .changeset/purple-icons-rescue.md diff --git a/.changeset/purple-icons-rescue.md b/.changeset/purple-icons-rescue.md new file mode 100644 index 000000000..5c220b8a1 --- /dev/null +++ b/.changeset/purple-icons-rescue.md @@ -0,0 +1,5 @@ +--- +"@exactly/protocol": patch +--- + +✨ market: set custom name and symbol diff --git a/.gas-snapshot b/.gas-snapshot index 0aa525fe1..276bea544 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -127,221 +127,223 @@ EscrowedEXATest:testWithdrawMaxFromMultipleStreams() (gas: 1020335) EscrowedEXATest:testWithdrawMaxShouldGiveReserveBackWhenDepleted() (gas: 333113) EscrowedEXATest:testWithdrawMaxWithInvalidSender() (gas: 352320) InstallmentsRouterTest:testAmountsLength() (gas: 13886) -InstallmentsRouterTest:testBorrowETHWithPermit() (gas: 913019) -InstallmentsRouterTest:testBorrowRouter() (gas: 608255) -InstallmentsRouterTest:testBorrowUnwrappedETH() (gas: 716870) -InstallmentsRouterTest:testBorrowWithPermit() (gas: 1000875) +InstallmentsRouterTest:testBorrowETHWithPermit() (gas: 913040) +InstallmentsRouterTest:testBorrowRouter() (gas: 608321) +InstallmentsRouterTest:testBorrowUnwrappedETH() (gas: 716936) +InstallmentsRouterTest:testBorrowWithPermit() (gas: 1000896) InstallmentsRouterTest:testFakeMarket() (gas: 25124) -InstallmentsRouterTest:testInsufficientMaxRepay() (gas: 607919) -InstallmentsRouterTest:testMaxRepay() (gas: 604807) +InstallmentsRouterTest:testInsufficientMaxRepay() (gas: 607985) +InstallmentsRouterTest:testMaxRepay() (gas: 604873) InstallmentsRouterTest:testMissingMarketWETH() (gas: 656725) -InstallmentsRouterTest:testMoreBorrowsThanMaxPools() (gas: 611620) +InstallmentsRouterTest:testMoreBorrowsThanMaxPools() (gas: 611708) InterestRateModelTest:testFixedBorrowRate() (gas: 1843854) InterestRateModelTest:testFixedRateRevertAlreadyMatured() (gas: 1857753) InterestRateModelTest:testFixedRateRevertUtilizationExceeded() (gas: 1865115) InterestRateModelTest:testFloatingBorrowRate() (gas: 1837111) InterestRateModelTest:testMinTimeToMaturity() (gas: 1875281) InterestRateModelTest:testRevertMaxUtilizationLowerThanWad() (gas: 40324) -MarketTest:testAccountLiquidityAdjustedDebt() (gas: 383813) -MarketTest:testAnotherUserRedeemWhenOwnerHasShortfall() (gas: 489202) -MarketTest:testAnotherUserWithdrawWhenOwnerHasShortfall() (gas: 476908) -MarketTest:testBorrowAfterFreezing() (gas: 331700) -MarketTest:testBorrowAtMaturity() (gas: 406273) -MarketTest:testBorrowAtMaturityAfterFreezing() (gas: 408957) +MarketTest:testAccountLiquidityAdjustedDebt() (gas: 383857) +MarketTest:testAnotherUserRedeemWhenOwnerHasShortfall() (gas: 489312) +MarketTest:testAnotherUserWithdrawWhenOwnerHasShortfall() (gas: 477018) +MarketTest:testBorrowAfterFreezing() (gas: 331678) +MarketTest:testBorrowAtMaturity() (gas: 406339) +MarketTest:testBorrowAtMaturityAfterFreezing() (gas: 409067) MarketTest:testBorrowAtMaturityUpdatesFloatingDebtAndFloatingAssets() (gas: 601871) -MarketTest:testBorrowAtMaturityWhenFrozen() (gas: 43319) -MarketTest:testBorrowAtMaturityWithZeroAssets() (gas: 18165) -MarketTest:testBorrowDisagreement() (gas: 222390) -MarketTest:testBorrowFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 767006) -MarketTest:testBorrowWhenFrozen() (gas: 43309) -MarketTest:testCappedLiquidation() (gas: 700918) -MarketTest:testChargeTreasuryToEarlyWithdraws() (gas: 638500) -MarketTest:testChargeTreasuryToFixedBorrows() (gas: 850705) -MarketTest:testClearBadDebtAvoidingFixedBorrowsIfAccumulatorLower() (gas: 1166134) -MarketTest:testClearBadDebtCalledByAccount() (gas: 13493) -MarketTest:testClearBadDebtExactlyRepaysFixedBorrowWithAccumulatorAmount() (gas: 996839) -MarketTest:testClearBadDebtPartiallyRepaysEachFixedBorrow() (gas: 1027662) -MarketTest:testClearBadDebtPartiallyRepaysFloatingDebt() (gas: 1135271) -MarketTest:testClearBadDebtShouldAccrueAccumulatedEarningsBeforeSpreadingLosses() (gas: 1127471) -MarketTest:testClearBadDebtWithEmptyAccumulatorShouldNotRevert() (gas: 584324) -MarketTest:testClearMaturity() (gas: 757102) -MarketTest:testCollectTreasuryFreeLunchToEarlyWithdraws() (gas: 770703) -MarketTest:testCollectTreasuryFreeLunchToEarlyWithdrawsWithZeroFees() (gas: 275108) -MarketTest:testCollectTreasuryFreeLunchToFixedBorrows() (gas: 880796) -MarketTest:testCollectTreasuryFreeLunchToFixedBorrowsWithZeroFees() (gas: 479789) -MarketTest:testCrossMaturityLiquidation() (gas: 1246655) -MarketTest:testDepositAfterFreezing() (gas: 163465) -MarketTest:testDepositAtMaturity() (gas: 158647) -MarketTest:testDepositAtMaturityAfterFreezing() (gas: 161529) -MarketTest:testDepositAtMaturityWhenFrozen() (gas: 43178) -MarketTest:testDepositAtMaturityWithZeroAssets() (gas: 18107) -MarketTest:testDepositDisagreement() (gas: 35084) -MarketTest:testDepositShouldUpdateFlexibleBorrowVariables() (gas: 448070) -MarketTest:testDepositToSmartPool() (gas: 160154) -MarketTest:testDepositWhenFrozen() (gas: 126858) -MarketTest:testDistributeMultipleAccumulatedEarnings() (gas: 757153) -MarketTest:testDistributionOfLossesShouldReduceFromFloatingBackupBorrowedAccordingly() (gas: 2195016) -MarketTest:testEarlyRepaymentWithExcessiveAmountOfFees() (gas: 2617602) -MarketTest:testEarlyWithdrawFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 617457) -MarketTest:testEmergencyAdminRole() (gas: 129531) -MarketTest:testEmitFrozen() (gas: 32730) -MarketTest:testFixedBorrowFailingWhenFlexibleBorrowAccruesDebt() (gas: 791261) -MarketTest:testFixedBorrowRateToMaturity() (gas: 410343) -MarketTest:testFlexibleBorrow() (gas: 331595) -MarketTest:testFlexibleBorrowAccountingDebt() (gas: 327390) -MarketTest:testFlexibleBorrowChargingDebtToTreasury() (gas: 483310) -MarketTest:testFlexibleBorrowExceedingReserve() (gas: 528032) -MarketTest:testFlexibleBorrowExceedingReserveIncludingFixedBorrow() (gas: 713085) -MarketTest:testFlexibleBorrowExceedingReserveWithNewDebt() (gas: 665095) -MarketTest:testFlexibleBorrowFromAnotherUserSubtractsAllowance() (gas: 354472) -MarketTest:testFlexibleBorrowFromAnotherUserWithAllowance() (gas: 346825) -MarketTest:testFlexibleBorrowFromAnotherUserWithoutAllowance() (gas: 182174) -MarketTest:testFrontRunSmartPoolEarningsDistributionWithBigPenaltyRepayment() (gas: 755878) -MarketTest:testFullPause() (gas: 1926731) -MarketTest:testInitiallyUnfrozen() (gas: 12654) -MarketTest:testInsufficientProtocolLiquidity() (gas: 877246) -MarketTest:testLiquidateAndChargeIncentiveForLenders() (gas: 993649) -MarketTest:testLiquidateAndDistributeLosses() (gas: 1336682) -MarketTest:testLiquidateAndSeizeExactAmountWithDustAsCollateral() (gas: 1318553) -MarketTest:testLiquidateAndSeizeFromEmptyCollateral() (gas: 619073) -MarketTest:testLiquidateAndSubtractLossesFromAccumulator() (gas: 1659741) -MarketTest:testLiquidateFlexibleAndFixedBorrowPositionsInSingleCall() (gas: 1164583) -MarketTest:testLiquidateFlexibleBorrow() (gas: 1101863) -MarketTest:testLiquidateFlexibleBorrowChargeLendersAssetsToLiquidator() (gas: 734743) -MarketTest:testLiquidateFlexibleBorrowConsideringDebtOverTime() (gas: 837386) -MarketTest:testLiquidateLeavingDustAsCollateral() (gas: 1520017) -MarketTest:testLiquidateWhenFrozen() (gas: 749012) -MarketTest:testLiquidateWithTwoUnitsAsMaxAssets() (gas: 880157) -MarketTest:testLiquidateWithZeroAsMaxAssets() (gas: 618998) -MarketTest:testLiquidationClearingDebtOfAllAccountMarkets() (gas: 1516370) -MarketTest:testLiquidationResultingInZeroCollateralAndZeroDebt() (gas: 1068191) -MarketTest:testMaturityInsufficientProtocolLiquidity() (gas: 879255) -MarketTest:testMultipleBorrowsForMultipleAssets() (gas: 604574929) -MarketTest:testMultipleDepositsToSmartPool() (gas: 336917) -MarketTest:testMultipleFixedBorrowsRepays() (gas: 606311) -MarketTest:testMultipleLiquidationSameUser() (gas: 1450100) -MarketTest:testNotEnteredMarketShouldNotBeSeized() (gas: 7066986) -MarketTest:testOnlyAdminCanFreezeUnfreeze() (gas: 100587) -MarketTest:testOperationsShouldUpdateFloatingAssetsAverage() (gas: 650161) -MarketTest:testOperationsWithBtcWbtcRate() (gas: 6943425) -MarketTest:testOperationsWithStEthAsset() (gas: 6898014) -MarketTest:testPausable() (gas: 56158) -MarketTest:testPauserRole() (gas: 46942) -MarketTest:testPreviewOperationsWithSmartPoolCorrectlyAccountingEarnings() (gas: 880158) +MarketTest:testBorrowAtMaturityWhenFrozen() (gas: 43385) +MarketTest:testBorrowAtMaturityWithZeroAssets() (gas: 18209) +MarketTest:testBorrowDisagreement() (gas: 222456) +MarketTest:testBorrowFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 767028) +MarketTest:testBorrowWhenFrozen() (gas: 43243) +MarketTest:testCappedLiquidation() (gas: 700940) +MarketTest:testChargeTreasuryToEarlyWithdraws() (gas: 638808) +MarketTest:testChargeTreasuryToFixedBorrows() (gas: 851079) +MarketTest:testClearBadDebtAvoidingFixedBorrowsIfAccumulatorLower() (gas: 1166398) +MarketTest:testClearBadDebtCalledByAccount() (gas: 13515) +MarketTest:testClearBadDebtExactlyRepaysFixedBorrowWithAccumulatorAmount() (gas: 997014) +MarketTest:testClearBadDebtPartiallyRepaysEachFixedBorrow() (gas: 1028014) +MarketTest:testClearBadDebtPartiallyRepaysFloatingDebt() (gas: 1135535) +MarketTest:testClearBadDebtShouldAccrueAccumulatedEarningsBeforeSpreadingLosses() (gas: 1127933) +MarketTest:testClearBadDebtWithEmptyAccumulatorShouldNotRevert() (gas: 584456) +MarketTest:testClearMaturity() (gas: 757348) +MarketTest:testCollectTreasuryFreeLunchToEarlyWithdraws() (gas: 771056) +MarketTest:testCollectTreasuryFreeLunchToEarlyWithdrawsWithZeroFees() (gas: 275306) +MarketTest:testCollectTreasuryFreeLunchToFixedBorrows() (gas: 881151) +MarketTest:testCollectTreasuryFreeLunchToFixedBorrowsWithZeroFees() (gas: 479987) +MarketTest:testCrossMaturityLiquidation() (gas: 1246898) +MarketTest:testDepositAfterFreezing() (gas: 163553) +MarketTest:testDepositAtMaturity() (gas: 158691) +MarketTest:testDepositAtMaturityAfterFreezing() (gas: 161617) +MarketTest:testDepositAtMaturityWhenFrozen() (gas: 43244) +MarketTest:testDepositAtMaturityWithZeroAssets() (gas: 18129) +MarketTest:testDepositDisagreement() (gas: 35128) +MarketTest:testDepositShouldUpdateFlexibleBorrowVariables() (gas: 448180) +MarketTest:testDepositToSmartPool() (gas: 160198) +MarketTest:testDepositWhenFrozen() (gas: 126902) +MarketTest:testDistributeMultipleAccumulatedEarnings() (gas: 757261) +MarketTest:testDistributionOfLossesShouldReduceFromFloatingBackupBorrowedAccordingly() (gas: 2195564) +MarketTest:testEarlyRepaymentWithExcessiveAmountOfFees() (gas: 2617689) +MarketTest:testEarlyWithdrawFromFreeLunchShouldNotRevertWithFloatingFullUtilization() (gas: 617479) +MarketTest:testEmergencyAdminRole() (gas: 128852) +MarketTest:testEmitFrozen() (gas: 32783) +MarketTest:testFixedBorrowFailingWhenFlexibleBorrowAccruesDebt() (gas: 791327) +MarketTest:testFixedBorrowRateToMaturity() (gas: 410409) +MarketTest:testFlexibleBorrow() (gas: 331486) +MarketTest:testFlexibleBorrowAccountingDebt() (gas: 327477) +MarketTest:testFlexibleBorrowChargingDebtToTreasury() (gas: 483222) +MarketTest:testFlexibleBorrowExceedingReserve() (gas: 527922) +MarketTest:testFlexibleBorrowExceedingReserveIncludingFixedBorrow() (gas: 712997) +MarketTest:testFlexibleBorrowExceedingReserveWithNewDebt() (gas: 664963) +MarketTest:testFlexibleBorrowFromAnotherUserSubtractsAllowance() (gas: 354428) +MarketTest:testFlexibleBorrowFromAnotherUserWithAllowance() (gas: 346737) +MarketTest:testFlexibleBorrowFromAnotherUserWithoutAllowance() (gas: 182108) +MarketTest:testFrontRunSmartPoolEarningsDistributionWithBigPenaltyRepayment() (gas: 756208) +MarketTest:testFullPause() (gas: 1927371) +MarketTest:testInitiallyUnfrozen() (gas: 12698) +MarketTest:testInsufficientProtocolLiquidity() (gas: 877290) +MarketTest:testLiquidateAndChargeIncentiveForLenders() (gas: 993892) +MarketTest:testLiquidateAndDistributeLosses() (gas: 1337167) +MarketTest:testLiquidateAndSeizeExactAmountWithDustAsCollateral() (gas: 1318818) +MarketTest:testLiquidateAndSeizeFromEmptyCollateral() (gas: 619097) +MarketTest:testLiquidateAndSubtractLossesFromAccumulator() (gas: 1659934) +MarketTest:testLiquidateFlexibleAndFixedBorrowPositionsInSingleCall() (gas: 1164652) +MarketTest:testLiquidateFlexibleBorrow() (gas: 1101975) +MarketTest:testLiquidateFlexibleBorrowChargeLendersAssetsToLiquidator() (gas: 734722) +MarketTest:testLiquidateFlexibleBorrowConsideringDebtOverTime() (gas: 837431) +MarketTest:testLiquidateLeavingDustAsCollateral() (gas: 1520194) +MarketTest:testLiquidateWhenFrozen() (gas: 748969) +MarketTest:testLiquidateWithTwoUnitsAsMaxAssets() (gas: 880268) +MarketTest:testLiquidateWithZeroAsMaxAssets() (gas: 619130) +MarketTest:testLiquidationClearingDebtOfAllAccountMarkets() (gas: 1516437) +MarketTest:testLiquidationResultingInZeroCollateralAndZeroDebt() (gas: 1068368) +MarketTest:testMaturityInsufficientProtocolLiquidity() (gas: 879277) +MarketTest:testMultipleBorrowsForMultipleAssets() (gas: 604522273) +MarketTest:testMultipleDepositsToSmartPool() (gas: 337093) +MarketTest:testMultipleFixedBorrowsRepays() (gas: 606469) +MarketTest:testMultipleLiquidationSameUser() (gas: 1450345) +MarketTest:testNotEnteredMarketShouldNotBeSeized() (gas: 7048812) +MarketTest:testOnlyAdminCanFreezeUnfreeze() (gas: 100741) +MarketTest:testOperationsShouldUpdateFloatingAssetsAverage() (gas: 650498) +MarketTest:testOperationsWithBtcWbtcRate() (gas: 6925292) +MarketTest:testOperationsWithStEthAsset() (gas: 6879848) +MarketTest:testPausable() (gas: 56211) +MarketTest:testPauserRole() (gas: 46480) +MarketTest:testPreviewOperationsWithSmartPoolCorrectlyAccountingEarnings() (gas: 880466) MarketTest:testRepayAtMaturity() (gas: 354568) -MarketTest:testRepayDisagreement() (gas: 432287) -MarketTest:testRepayFlexibleBorrow() (gas: 561384) -MarketTest:testRepayWhenFrozen() (gas: 310587) -MarketTest:testRoundingDownAssetsToValidateShortfallWhenTransferring() (gas: 6427862) -MarketTest:testRoundingDownAssetsToValidateShortfallWhenTransferringFrom() (gas: 6456640) -MarketTest:testRoundingDownAssetsWhenTransferingFromAnAccountWithoutShortfall() (gas: 595010) -MarketTest:testRoundingDownAssetsWhenTransferingWithAnAccountWithoutShortfall() (gas: 568156) -MarketTest:testRoundingUpAllowanceWhenBorrowingAtMaturity() (gas: 503547) -MarketTest:testRoundingUpAllowanceWhenWithdrawingAtMaturity() (gas: 527104) -MarketTest:testSetDampSpeedFactorShouldUpdateFloatingAssetsAverage() (gas: 244057) -MarketTest:testSetEarningsAccumulatorSmoothFactorShouldDistributeEarnings() (gas: 498691) -MarketTest:testSetInterestRateModelShouldUpdateFloatingDebt() (gas: 2345613) -MarketTest:testSetInterestRateModelWithAddressZeroShouldNotUpdateFloatingDebt() (gas: 2177920) -MarketTest:testShareValueNotDecreasingAfterDeposit() (gas: 474315) -MarketTest:testShareValueNotDecreasingWhenMintingToTreasury() (gas: 480156) -MarketTest:testSingleFloatingBorrow() (gas: 328734) -MarketTest:testSingleFloatingRepay() (gas: 287894) -MarketTest:testSmartPoolEarningsDistribution() (gas: 706033) -MarketTest:testSmartPoolSharesDoNotAccountUnassignedEarningsFromMoreThanOneIntervalPastMaturities() (gas: 434525) -MarketTest:testSumDebtPlusEffectsShouldntRoundUpWhenWithdrawing() (gas: 575596) -MarketTest:testTotalAssetsProjectingBackupEarningsCorrectly() (gas: 414719) -MarketTest:testTotalAssetsProjectingFloatingDebtCorrectly() (gas: 480174) -MarketTest:testUpdateAccumulatedEarningsFactorToZero() (gas: 813560) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingAndBorrowingContinuously() (gas: 240205) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeBorrow() (gas: 439520) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeEarlyWithdraw() (gas: 325825) -MarketTest:testUpdateFloatingAssetsAverageWhenDepositingSomeSecondsBeforeBorrow() (gas: 500411) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeBorrow() (gas: 445340) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeEarlyWithdraw() (gas: 342577) -MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingSomeSecondsBeforeBorrow() (gas: 269561) -MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedDown() (gas: 255679) -MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedUp() (gas: 176086) -MarketTest:testUpdateFloatingDebtBeforeSettingTreasury() (gas: 84494) -MarketTest:testWithdrawAtMaturity() (gas: 168982) -MarketTest:testWithdrawFromSmartPool() (gas: 168816) -MarketTest:testWithdrawShouldUpdateFlexibleBorrowVariables() (gas: 497366) -MarketTest:testWithdrawWhenFrozen() (gas: 183909) +MarketTest:testRepayDisagreement() (gas: 432375) +MarketTest:testRepayFlexibleBorrow() (gas: 561427) +MarketTest:testRepayWhenFrozen() (gas: 310565) +MarketTest:testRoundingDownAssetsToValidateShortfallWhenTransferring() (gas: 6411307) +MarketTest:testRoundingDownAssetsToValidateShortfallWhenTransferringFrom() (gas: 6439997) +MarketTest:testRoundingDownAssetsWhenTransferingFromAnAccountWithoutShortfall() (gas: 595164) +MarketTest:testRoundingDownAssetsWhenTransferingWithAnAccountWithoutShortfall() (gas: 568310) +MarketTest:testRoundingUpAllowanceWhenBorrowingAtMaturity() (gas: 503657) +MarketTest:testRoundingUpAllowanceWhenWithdrawingAtMaturity() (gas: 527214) +MarketTest:testSetAssetSymbol() (gas: 31005) +MarketTest:testSetAssetSymbolNotAdmin() (gas: 45163) +MarketTest:testSetDampSpeedFactorShouldUpdateFloatingAssetsAverage() (gas: 244102) +MarketTest:testSetEarningsAccumulatorSmoothFactorShouldDistributeEarnings() (gas: 498801) +MarketTest:testSetInterestRateModelShouldUpdateFloatingDebt() (gas: 2345624) +MarketTest:testSetInterestRateModelWithAddressZeroShouldNotUpdateFloatingDebt() (gas: 2177875) +MarketTest:testShareValueNotDecreasingAfterDeposit() (gas: 474337) +MarketTest:testShareValueNotDecreasingWhenMintingToTreasury() (gas: 480046) +MarketTest:testSingleFloatingBorrow() (gas: 328668) +MarketTest:testSingleFloatingRepay() (gas: 287850) +MarketTest:testSmartPoolEarningsDistribution() (gas: 706165) +MarketTest:testSmartPoolSharesDoNotAccountUnassignedEarningsFromMoreThanOneIntervalPastMaturities() (gas: 434483) +MarketTest:testSumDebtPlusEffectsShouldntRoundUpWhenWithdrawing() (gas: 575750) +MarketTest:testTotalAssetsProjectingBackupEarningsCorrectly() (gas: 414696) +MarketTest:testTotalAssetsProjectingFloatingDebtCorrectly() (gas: 480152) +MarketTest:testUpdateAccumulatedEarningsFactorToZero() (gas: 813781) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingAndBorrowingContinuously() (gas: 240183) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeBorrow() (gas: 439587) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingRightBeforeEarlyWithdraw() (gas: 325913) +MarketTest:testUpdateFloatingAssetsAverageWhenDepositingSomeSecondsBeforeBorrow() (gas: 500610) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeBorrow() (gas: 445361) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingRightBeforeEarlyWithdraw() (gas: 342709) +MarketTest:testUpdateFloatingAssetsAverageWhenWithdrawingSomeSecondsBeforeBorrow() (gas: 269471) +MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedDown() (gas: 255834) +MarketTest:testUpdateFloatingAssetsAverageWithDampSpeedUp() (gas: 176130) +MarketTest:testUpdateFloatingDebtBeforeSettingTreasury() (gas: 84560) +MarketTest:testWithdrawAtMaturity() (gas: 169035) +MarketTest:testWithdrawFromSmartPool() (gas: 168887) +MarketTest:testWithdrawShouldUpdateFlexibleBorrowVariables() (gas: 497476) +MarketTest:testWithdrawWhenFrozen() (gas: 183980) PoolLibTest:testAtomicDepositBorrowRepayWithdraw() (gas: 38632) PoolLibTest:testBackupBorrow() (gas: 29484) PoolLibTest:testEarningsAccrual() (gas: 37652) PoolLibTest:testEarningsDistribution() (gas: 29456) PoolLibTest:testMaturityRangeLimit() (gas: 3729) PoolLibTest:testMaturityRangeTooWide() (gas: 6831) -PreviewerTest:testAccountsReturningAccurateAmounts() (gas: 1304555) -PreviewerTest:testAccountsReturningUtilizationForDifferentMaturities() (gas: 3678408) -PreviewerTest:testAccountsWithAccountOnlyDeposit() (gas: 834589) -PreviewerTest:testAccountsWithAccountThatHasBalances() (gas: 1798866) -PreviewerTest:testAccountsWithEmptyAccount() (gas: 683589) -PreviewerTest:testAccountsWithIntermediateOperationsReturningAccurateAmounts() (gas: 15867028) -PreviewerTest:testActualTimeBeforeStartDistributionRewards() (gas: 7063605) -PreviewerTest:testEmptyExactly() (gas: 5103312) -PreviewerTest:testExactlyReturningInterestRateModelData() (gas: 682538) -PreviewerTest:testFixedAvailableLiquidityProjectingNewFloatingDebt() (gas: 11540561) -PreviewerTest:testFixedPoolsA() (gas: 16890103) -PreviewerTest:testFixedPoolsChangingMaturityInTime() (gas: 1628004) -PreviewerTest:testFixedPoolsRatesAndUtilizations() (gas: 13351251) -PreviewerTest:testFixedPoolsWithFloatingAssetsAverage() (gas: 13826135) -PreviewerTest:testFlexibleAvailableLiquidity() (gas: 15219891) -PreviewerTest:testFlexibleBorrowSharesAndAssets() (gas: 3944917) -PreviewerTest:testFloatingAvailableLiquidityProjectingNewFloatingDebt() (gas: 11062556) -PreviewerTest:testFloatingRateAndUtilization() (gas: 1006440) -PreviewerTest:testJustUpdatedRewardRatesShouldStillReturnRate() (gas: 6300093) -PreviewerTest:testMaxBorrowAssetsCapacity() (gas: 2150224) -PreviewerTest:testMaxBorrowAssetsCapacityForAccountWithShortfall() (gas: 9676777) -PreviewerTest:testMaxBorrowAssetsCapacityPerMarket() (gas: 11177267) -PreviewerTest:testOraclePriceReturningAccurateValues() (gas: 9202415) -PreviewerTest:testPreviewBorrowAtAllMaturitiesReturningAccurateAmount() (gas: 3091203) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmount() (gas: 523968) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1188146) -PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateUtilization() (gas: 379521) -PreviewerTest:testPreviewBorrowAtMaturityWithFiveUnits() (gas: 319568) -PreviewerTest:testPreviewBorrowAtMaturityWithInvalidMaturity() (gas: 213031) -PreviewerTest:testPreviewBorrowAtMaturityWithMaturedMaturity() (gas: 50079) -PreviewerTest:testPreviewBorrowAtMaturityWithOneUnit() (gas: 319547) -PreviewerTest:testPreviewBorrowAtMaturityWithSameTimestamp() (gas: 49997) -PreviewerTest:testPreviewBorrowAtMaturityWithZeroAmount() (gas: 201899) -PreviewerTest:testPreviewDepositAtAllMaturitiesReturningAccurateAmounts() (gas: 1554178) -PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmount() (gas: 585227) -PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 858930) -PreviewerTest:testPreviewDepositAtMaturityWithEmptyMaturity() (gas: 45890) -PreviewerTest:testPreviewDepositAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 45889) -PreviewerTest:testPreviewDepositAtMaturityWithInvalidMaturity() (gas: 45892) +PreviewerTest:testAccountsReturningAccurateAmounts() (gas: 1305648) +PreviewerTest:testAccountsReturningUtilizationForDifferentMaturities() (gas: 3683448) +PreviewerTest:testAccountsWithAccountOnlyDeposit() (gas: 835263) +PreviewerTest:testAccountsWithAccountThatHasBalances() (gas: 1800912) +PreviewerTest:testAccountsWithEmptyAccount() (gas: 684219) +PreviewerTest:testAccountsWithIntermediateOperationsReturningAccurateAmounts() (gas: 15858213) +PreviewerTest:testActualTimeBeforeStartDistributionRewards() (gas: 7066674) +PreviewerTest:testEmptyExactly() (gas: 5104045) +PreviewerTest:testExactlyReturningInterestRateModelData() (gas: 683102) +PreviewerTest:testFixedAvailableLiquidityProjectingNewFloatingDebt() (gas: 11526333) +PreviewerTest:testFixedPoolsA() (gas: 16885621) +PreviewerTest:testFixedPoolsChangingMaturityInTime() (gas: 1629696) +PreviewerTest:testFixedPoolsRatesAndUtilizations() (gas: 13339563) +PreviewerTest:testFixedPoolsWithFloatingAssetsAverage() (gas: 13817488) +PreviewerTest:testFlexibleAvailableLiquidity() (gas: 15212545) +PreviewerTest:testFlexibleBorrowSharesAndAssets() (gas: 3948617) +PreviewerTest:testFloatingAvailableLiquidityProjectingNewFloatingDebt() (gas: 11047292) +PreviewerTest:testFloatingRateAndUtilization() (gas: 1006960) +PreviewerTest:testJustUpdatedRewardRatesShouldStillReturnRate() (gas: 6302134) +PreviewerTest:testMaxBorrowAssetsCapacity() (gas: 2151850) +PreviewerTest:testMaxBorrowAssetsCapacityForAccountWithShortfall() (gas: 9659838) +PreviewerTest:testMaxBorrowAssetsCapacityPerMarket() (gas: 11161387) +PreviewerTest:testOraclePriceReturningAccurateValues() (gas: 9185454) +PreviewerTest:testPreviewBorrowAtAllMaturitiesReturningAccurateAmount() (gas: 3097911) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmount() (gas: 524213) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 1188903) +PreviewerTest:testPreviewBorrowAtMaturityReturningAccurateUtilization() (gas: 380057) +PreviewerTest:testPreviewBorrowAtMaturityWithFiveUnits() (gas: 319791) +PreviewerTest:testPreviewBorrowAtMaturityWithInvalidMaturity() (gas: 213232) +PreviewerTest:testPreviewBorrowAtMaturityWithMaturedMaturity() (gas: 50124) +PreviewerTest:testPreviewBorrowAtMaturityWithOneUnit() (gas: 319770) +PreviewerTest:testPreviewBorrowAtMaturityWithSameTimestamp() (gas: 50042) +PreviewerTest:testPreviewBorrowAtMaturityWithZeroAmount() (gas: 202100) +PreviewerTest:testPreviewDepositAtAllMaturitiesReturningAccurateAmounts() (gas: 1557084) +PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmount() (gas: 585426) +PreviewerTest:testPreviewDepositAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 859461) +PreviewerTest:testPreviewDepositAtMaturityWithEmptyMaturity() (gas: 46001) +PreviewerTest:testPreviewDepositAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 46000) +PreviewerTest:testPreviewDepositAtMaturityWithInvalidMaturity() (gas: 46003) PreviewerTest:testPreviewDepositAtMaturityWithMaturedMaturity() (gas: 12551) -PreviewerTest:testPreviewDepositAtMaturityWithOneUnit() (gas: 497906) -PreviewerTest:testPreviewDepositAtMaturityWithSameTimestamp() (gas: 48445) -PreviewerTest:testPreviewDepositAtMaturityWithZeroAmount() (gas: 497950) -PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmount() (gas: 767382) -PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 797116) -PreviewerTest:testPreviewRepayAtMaturityWithEmptyMaturity() (gas: 35296) -PreviewerTest:testPreviewRepayAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 35316) -PreviewerTest:testPreviewRepayAtMaturityWithInvalidMaturity() (gas: 35316) -PreviewerTest:testPreviewRepayAtMaturityWithMaturedMaturity() (gas: 497102) -PreviewerTest:testPreviewRepayAtMaturityWithOneUnit() (gas: 500261) -PreviewerTest:testPreviewRepayAtMaturityWithSameTimestamp() (gas: 495502) -PreviewerTest:testPreviewRepayAtMaturityWithZeroAmount() (gas: 500327) -PreviewerTest:testPreviewValueInFixedOperations() (gas: 2001360) -PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmount() (gas: 214760) -PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 771572) -PreviewerTest:testPreviewWithdrawAtMaturityWithEmptyMaturity() (gas: 35207) -PreviewerTest:testPreviewWithdrawAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 35250) -PreviewerTest:testPreviewWithdrawAtMaturityWithFiveUnits() (gas: 222145) -PreviewerTest:testPreviewWithdrawAtMaturityWithInvalidMaturity() (gas: 35271) -PreviewerTest:testPreviewWithdrawAtMaturityWithMaturedMaturity() (gas: 199592) -PreviewerTest:testPreviewWithdrawAtMaturityWithOneUnit() (gas: 222144) -PreviewerTest:testPreviewWithdrawAtMaturityWithSameTimestamp() (gas: 199608) -PreviewerTest:testPreviewWithdrawAtMaturityWithZeroAmount() (gas: 222190) -PreviewerTest:testReserveFactor() (gas: 683779) -PreviewerTest:testReturnRewardAssetUsdPrice() (gas: 6128383) -PreviewerTest:testRewardsRateAfterDistributionEnd() (gas: 6461611) -PreviewerTest:testRewardsRateOnlyWithFixedBorrows() (gas: 6160171) -PreviewerTest:testRewardsRateWithDifferentRewardLengths() (gas: 17215829) -PreviewerTest:testRewardsRateWithMarketWithDifferentDecimals() (gas: 16418829) -PreviewerTest:testRewardsRateX() (gas: 7220114) +PreviewerTest:testPreviewDepositAtMaturityWithOneUnit() (gas: 498061) +PreviewerTest:testPreviewDepositAtMaturityWithSameTimestamp() (gas: 48556) +PreviewerTest:testPreviewDepositAtMaturityWithZeroAmount() (gas: 498105) +PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmount() (gas: 767625) +PreviewerTest:testPreviewRepayAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 797713) +PreviewerTest:testPreviewRepayAtMaturityWithEmptyMaturity() (gas: 35340) +PreviewerTest:testPreviewRepayAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 35360) +PreviewerTest:testPreviewRepayAtMaturityWithInvalidMaturity() (gas: 35360) +PreviewerTest:testPreviewRepayAtMaturityWithMaturedMaturity() (gas: 497279) +PreviewerTest:testPreviewRepayAtMaturityWithOneUnit() (gas: 500438) +PreviewerTest:testPreviewRepayAtMaturityWithSameTimestamp() (gas: 495657) +PreviewerTest:testPreviewRepayAtMaturityWithZeroAmount() (gas: 500504) +PreviewerTest:testPreviewValueInFixedOperations() (gas: 2004883) +PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmount() (gas: 214956) +PreviewerTest:testPreviewWithdrawAtMaturityReturningAccurateAmountWithIntermediateOperations() (gas: 772373) +PreviewerTest:testPreviewWithdrawAtMaturityWithEmptyMaturity() (gas: 35251) +PreviewerTest:testPreviewWithdrawAtMaturityWithEmptyMaturityAndZeroAmount() (gas: 35294) +PreviewerTest:testPreviewWithdrawAtMaturityWithFiveUnits() (gas: 222368) +PreviewerTest:testPreviewWithdrawAtMaturityWithInvalidMaturity() (gas: 35315) +PreviewerTest:testPreviewWithdrawAtMaturityWithMaturedMaturity() (gas: 199703) +PreviewerTest:testPreviewWithdrawAtMaturityWithOneUnit() (gas: 222367) +PreviewerTest:testPreviewWithdrawAtMaturityWithSameTimestamp() (gas: 199719) +PreviewerTest:testPreviewWithdrawAtMaturityWithZeroAmount() (gas: 222413) +PreviewerTest:testReserveFactor() (gas: 684255) +PreviewerTest:testReturnRewardAssetUsdPrice() (gas: 6130306) +PreviewerTest:testRewardsRateAfterDistributionEnd() (gas: 6463828) +PreviewerTest:testRewardsRateOnlyWithFixedBorrows() (gas: 6162257) +PreviewerTest:testRewardsRateWithDifferentRewardLengths() (gas: 17202636) +PreviewerTest:testRewardsRateWithMarketWithDifferentDecimals() (gas: 16405765) +PreviewerTest:testRewardsRateX() (gas: 7224210) PriceFeedDoubleTest:testPriceFeedDoubleReturningAccurateDecimals() (gas: 428034) PriceFeedDoubleTest:testPriceFeedDoubleReturningPrice() (gas: 26138) PriceFeedDoubleTest:testPriceFeedDoubleWithActualOnChainValues() (gas: 30888) @@ -358,67 +360,67 @@ PriceFeedWrapperTest:testPriceFeedWrapperReturningPriceAfterRebase() (gas: 22860 PriceFeedWrapperTest:testPriceFeedWrapperWithActualOnChainValues() (gas: 30260) PriceFeedWrapperTest:testPriceFeedWrapperWithNegativePriceShouldRevert() (gas: 43058) PriceFeedWrapperTest:testPriceFeedWrapperWithUsdPriceFeed() (gas: 1038001) -RewardsControllerTest:testAccrueRewardsForWholeDistributionPeriod() (gas: 964991) -RewardsControllerTest:testAccrueRewardsWithBadDebtClearingOfFixedBorrow() (gas: 1980836) -RewardsControllerTest:testAccrueRewardsWithRepayOfBorrowBalance() (gas: 1126866) -RewardsControllerTest:testAccrueRewardsWithRepayOfFixedBorrowBalance() (gas: 1222266) -RewardsControllerTest:testAccrueRewardsWithSeizeOfAllDepositShares() (gas: 1314935) -RewardsControllerTest:testAfterDistributionPeriodEnd() (gas: 1427341) -RewardsControllerTest:testAllClaimableUSDCWithAnotherAccountInPool() (gas: 1889477) -RewardsControllerTest:testAllClaimableUSDCWithDeposit() (gas: 1505884) -RewardsControllerTest:testAllClaimableUSDCWithFloatingBorrow() (gas: 1368362) -RewardsControllerTest:testAllClaimableUSDCWithFloatingRefund() (gas: 1289942) -RewardsControllerTest:testAllClaimableUSDCWithFloatingRepay() (gas: 1296422) -RewardsControllerTest:testAllClaimableUSDCWithMint() (gas: 1165148) -RewardsControllerTest:testAllClaimableUSDCWithRedeem() (gas: 1237217) -RewardsControllerTest:testAllClaimableUSDCWithTransfer() (gas: 1836263) -RewardsControllerTest:testAllClaimableUSDCWithTransferFrom() (gas: 1723947) -RewardsControllerTest:testAllClaimableUSDCWithWithdraw() (gas: 1238240) -RewardsControllerTest:testAllClaimableWETH() (gas: 1134877) -RewardsControllerTest:testAllClaimableWithMaturedFixedPool() (gas: 1008325) -RewardsControllerTest:testAllClaimableWithTimeElapsedZero() (gas: 1144395) -RewardsControllerTest:testClaim() (gas: 974395) -RewardsControllerTest:testClaimAll() (gas: 1681624) -RewardsControllerTest:testClaimMarketWithoutRewards() (gas: 940964) -RewardsControllerTest:testClaimWithNotEnabledRewardAsset() (gas: 1004144) -RewardsControllerTest:testConfigSettingNewStartWithOnGoingDistributionShouldNotUpdate() (gas: 345034) -RewardsControllerTest:testConfigWithDistributionNotYetStartedShouldNotFail() (gas: 498176) +RewardsControllerTest:testAccrueRewardsForWholeDistributionPeriod() (gas: 966421) +RewardsControllerTest:testAccrueRewardsWithBadDebtClearingOfFixedBorrow() (gas: 1982487) +RewardsControllerTest:testAccrueRewardsWithRepayOfBorrowBalance() (gas: 1128165) +RewardsControllerTest:testAccrueRewardsWithRepayOfFixedBorrowBalance() (gas: 1223587) +RewardsControllerTest:testAccrueRewardsWithSeizeOfAllDepositShares() (gas: 1315640) +RewardsControllerTest:testAfterDistributionPeriodEnd() (gas: 1430817) +RewardsControllerTest:testAllClaimableUSDCWithAnotherAccountInPool() (gas: 1894233) +RewardsControllerTest:testAllClaimableUSDCWithDeposit() (gas: 1510114) +RewardsControllerTest:testAllClaimableUSDCWithFloatingBorrow() (gas: 1371248) +RewardsControllerTest:testAllClaimableUSDCWithFloatingRefund() (gas: 1292474) +RewardsControllerTest:testAllClaimableUSDCWithFloatingRepay() (gas: 1298976) +RewardsControllerTest:testAllClaimableUSDCWithMint() (gas: 1168012) +RewardsControllerTest:testAllClaimableUSDCWithRedeem() (gas: 1239617) +RewardsControllerTest:testAllClaimableUSDCWithTransfer() (gas: 1840843) +RewardsControllerTest:testAllClaimableUSDCWithTransferFrom() (gas: 1727735) +RewardsControllerTest:testAllClaimableUSDCWithWithdraw() (gas: 1240640) +RewardsControllerTest:testAllClaimableWETH() (gas: 1137960) +RewardsControllerTest:testAllClaimableWithMaturedFixedPool() (gas: 1010833) +RewardsControllerTest:testAllClaimableWithTimeElapsedZero() (gas: 1146045) +RewardsControllerTest:testClaim() (gas: 975781) +RewardsControllerTest:testClaimAll() (gas: 1684374) +RewardsControllerTest:testClaimMarketWithoutRewards() (gas: 941250) +RewardsControllerTest:testClaimWithNotEnabledRewardAsset() (gas: 1005882) +RewardsControllerTest:testConfigSettingNewStartWithOnGoingDistributionShouldNotUpdate() (gas: 345254) +RewardsControllerTest:testConfigWithDistributionNotYetStartedShouldNotFail() (gas: 498199) RewardsControllerTest:testConfigWithTransitionFactorHigherOrEqThanCap() (gas: 49694) RewardsControllerTest:testConfigWithZeroDepositAllocationWeightFactorShouldRevert() (gas: 42855) -RewardsControllerTest:testDifferentDistributionTimeForDifferentRewards() (gas: 1529393) -RewardsControllerTest:testEmitAccrue() (gas: 965281) -RewardsControllerTest:testEmitClaimRewards() (gas: 868938) -RewardsControllerTest:testEmitConfigUpdate() (gas: 382887) -RewardsControllerTest:testEmitIndexUpdate() (gas: 1012706) -RewardsControllerTest:testLastUndistributed() (gas: 1432333) -RewardsControllerTest:testOperationAfterDistributionEnded() (gas: 614123) -RewardsControllerTest:testOperationsBeforeDistributionStart() (gas: 1201837) -RewardsControllerTest:testPermitClaim() (gas: 1058929) -RewardsControllerTest:testSetDistributionConfigWithDifferentDecimals() (gas: 9596406) -RewardsControllerTest:testSetDistributionOperationShouldUpdateIndex() (gas: 111775) -RewardsControllerTest:testSetDistributionWithOnGoingMarketOperations() (gas: 954483) -RewardsControllerTest:testSetHigherTotalDistribution() (gas: 1237010) -RewardsControllerTest:testSetLowerAndEqualDistributionPeriodThanCurrentTimestampShouldRevert() (gas: 878849) -RewardsControllerTest:testSetLowerAndEqualTotalDistributionThanReleasedShouldRevert() (gas: 876662) -RewardsControllerTest:testSetLowerDistributionPeriod() (gas: 1425870) -RewardsControllerTest:testSetLowerDistributionPeriodAndLowerTotalDistribution() (gas: 1428595) -RewardsControllerTest:testSetLowerTotalDistribution() (gas: 1236923) -RewardsControllerTest:testSetNewDistributionPeriod() (gas: 1862138) -RewardsControllerTest:testSetNewDistributionPeriodAfterDistributionEnds() (gas: 1082718) -RewardsControllerTest:testSetNewTargetDebt() (gas: 1156593) -RewardsControllerTest:testSetNewTargetDebtAfterDistributionEnds() (gas: 1188680) -RewardsControllerTest:testSetNewTargetDebtWithClaimOnlyAtEnd() (gas: 1060006) -RewardsControllerTest:testSetNewTreasuryFeeShouldImpactAllocation() (gas: 506852) -RewardsControllerTest:testSetTargetDebtMultipleTimes() (gas: 1676632) -RewardsControllerTest:testSetTargetDebtMultipleTimesAfterEnd() (gas: 1681626) -RewardsControllerTest:testSetTotalDistributionMultipleTimes() (gas: 1220880) -RewardsControllerTest:testTriggerHandleBorrowHookBeforeUpdatingFloatingDebt() (gas: 1276605) -RewardsControllerTest:testUpdateConfig() (gas: 1017129) -RewardsControllerTest:testUpdateIndexesWithUtilizationEqualToOne() (gas: 961433) -RewardsControllerTest:testUpdateIndexesWithUtilizationHigherThanOne() (gas: 1013520) -RewardsControllerTest:testUpdateWithTotalDebtZeroShouldUpdateLastUndistributed() (gas: 407858) -RewardsControllerTest:testUtilizationEqualZero() (gas: 623339) -RewardsControllerTest:testWithTwelveFixedPools() (gas: 3676673) +RewardsControllerTest:testDifferentDistributionTimeForDifferentRewards() (gas: 1531308) +RewardsControllerTest:testEmitAccrue() (gas: 966425) +RewardsControllerTest:testEmitClaimRewards() (gas: 870038) +RewardsControllerTest:testEmitConfigUpdate() (gas: 382669) +RewardsControllerTest:testEmitIndexUpdate() (gas: 1014334) +RewardsControllerTest:testLastUndistributed() (gas: 1435039) +RewardsControllerTest:testOperationAfterDistributionEnded() (gas: 614827) +RewardsControllerTest:testOperationsBeforeDistributionStart() (gas: 1203158) +RewardsControllerTest:testPermitClaim() (gas: 1060249) +RewardsControllerTest:testSetDistributionConfigWithDifferentDecimals() (gas: 9581869) +RewardsControllerTest:testSetDistributionOperationShouldUpdateIndex() (gas: 111666) +RewardsControllerTest:testSetDistributionWithOnGoingMarketOperations() (gas: 955034) +RewardsControllerTest:testSetHigherTotalDistribution() (gas: 1239100) +RewardsControllerTest:testSetLowerAndEqualDistributionPeriodThanCurrentTimestampShouldRevert() (gas: 879751) +RewardsControllerTest:testSetLowerAndEqualTotalDistributionThanReleasedShouldRevert() (gas: 877564) +RewardsControllerTest:testSetLowerDistributionPeriod() (gas: 1428818) +RewardsControllerTest:testSetLowerDistributionPeriodAndLowerTotalDistribution() (gas: 1431543) +RewardsControllerTest:testSetLowerTotalDistribution() (gas: 1239013) +RewardsControllerTest:testSetNewDistributionPeriod() (gas: 1866956) +RewardsControllerTest:testSetNewDistributionPeriodAfterDistributionEnds() (gas: 1083994) +RewardsControllerTest:testSetNewTargetDebt() (gas: 1158353) +RewardsControllerTest:testSetNewTargetDebtAfterDistributionEnds() (gas: 1190682) +RewardsControllerTest:testSetNewTargetDebtWithClaimOnlyAtEnd() (gas: 1061238) +RewardsControllerTest:testSetNewTreasuryFeeShouldImpactAllocation() (gas: 507182) +RewardsControllerTest:testSetTargetDebtMultipleTimes() (gas: 1679888) +RewardsControllerTest:testSetTargetDebtMultipleTimesAfterEnd() (gas: 1685058) +RewardsControllerTest:testSetTotalDistributionMultipleTimes() (gas: 1222684) +RewardsControllerTest:testTriggerHandleBorrowHookBeforeUpdatingFloatingDebt() (gas: 1277881) +RewardsControllerTest:testUpdateConfig() (gas: 1018405) +RewardsControllerTest:testUpdateIndexesWithUtilizationEqualToOne() (gas: 962225) +RewardsControllerTest:testUpdateIndexesWithUtilizationHigherThanOne() (gas: 1014334) +RewardsControllerTest:testUpdateWithTotalDebtZeroShouldUpdateLastUndistributed() (gas: 408166) +RewardsControllerTest:testUtilizationEqualZero() (gas: 623538) +RewardsControllerTest:testWithTwelveFixedPools() (gas: 3688905) RewardsControllerTest:testWithdrawAllRewardBalance() (gas: 47126) RewardsControllerTest:testWithdrawOnlyAdminRole() (gas: 84360) SwapperTest:testSwapBasic() (gas: 194295) diff --git a/contracts/Market.sol b/contracts/Market.sol index 6f7771ec6..43d99fae3 100644 --- a/contracts/Market.sol +++ b/contracts/Market.sol @@ -103,6 +103,7 @@ contract Market is Initializable, AccessControlUpgradeable, PausableUpgradeable, /// @notice Initializes the contract. /// @dev can only be called once. function initialize( + string calldata assetSymbol, uint8 maxFuturePools_, uint128 earningsAccumulatorSmoothFactor_, InterestRateModel interestRateModel_, @@ -115,15 +116,13 @@ contract Market is Initializable, AccessControlUpgradeable, PausableUpgradeable, __AccessControl_init(); __Pausable_init(); - string memory assetSymbol = asset.symbol(); - name = string.concat("exactly ", assetSymbol); - symbol = string.concat("exa", assetSymbol); lastAccumulatorAccrual = uint32(block.timestamp); lastFloatingDebtUpdate = uint32(block.timestamp); lastAverageUpdate = uint32(block.timestamp); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); + setAssetSymbol(assetSymbol); setMaxFuturePools(maxFuturePools_); setEarningsAccumulatorSmoothFactor(earningsAccumulatorSmoothFactor_); setInterestRateModel(interestRateModel_); @@ -1038,6 +1037,13 @@ contract Market is Initializable, AccessControlUpgradeable, PausableUpgradeable, emit FixedEarningsUpdate(block.timestamp, maturity, fixedPools[maturity].unassignedEarnings); } + /// @notice Sets name and symbol for the Market. + /// @param assetSymbol the symbol for the underlying asset. + function setAssetSymbol(string calldata assetSymbol) public onlyRole(DEFAULT_ADMIN_ROLE) { + name = string.concat("exactly ", assetSymbol); + symbol = string.concat("exa", assetSymbol); + } + /// @notice Sets the rate charged to the fixed depositors that the floating pool suppliers will retain for initially /// providing liquidity. /// @param backupFeeRate_ percentage amount represented with 18 decimals. diff --git a/deploy/Markets.ts b/deploy/Markets.ts index 15c066425..f671937a1 100644 --- a/deploy/Markets.ts +++ b/deploy/Markets.ts @@ -56,6 +56,7 @@ const func: DeployFunction = async ({ init: { methodName: "initialize", args: [ + symbol, finance.futurePools, earningsAccumulatorSmoothFactor, ZeroAddress, // irm diff --git a/test/InstallmentsRouter.t.sol b/test/InstallmentsRouter.t.sol index b87d45e93..b7f938c45 100644 --- a/test/InstallmentsRouter.t.sol +++ b/test/InstallmentsRouter.t.sol @@ -40,6 +40,7 @@ contract InstallmentsRouterTest is Test { market = Market(address(new ERC1967Proxy(address(new Market(usdc, auditor)), ""))); market.initialize( + "USDC.e", 3, 1e18, InterestRateModel(address(new MockInterestRateModel(0.1e18))), @@ -53,6 +54,7 @@ contract InstallmentsRouterTest is Test { marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 3, 1e18, InterestRateModel(address(new MockInterestRateModel(0.1e18))), diff --git a/test/InterestRateModel.t.sol b/test/InterestRateModel.t.sol index e3acfa9cc..de8098bdb 100644 --- a/test/InterestRateModel.t.sol +++ b/test/InterestRateModel.t.sol @@ -206,7 +206,7 @@ contract InterestRateModelTest is Test { }), market ); - market.initialize(2, 2e18, irm, 2e16 / uint256(1 days), 1e17, 0, type(uint128).max, type(uint128).max); + market.initialize("", 2, 2e18, irm, 2e16 / uint256(1 days), 1e17, 0, type(uint128).max, type(uint128).max); asset.mint(address(this), type(uint128).max); asset.approve(address(market), type(uint128).max); if (floatingAssets != 0) market.deposit(floatingAssets, address(this)); diff --git a/test/Market.t.sol b/test/Market.t.sol index a0df709e9..c0a8edce9 100644 --- a/test/Market.t.sol +++ b/test/Market.t.sol @@ -56,12 +56,23 @@ contract MarketTest is Test { irm = new MockInterestRateModel(0.1e18); market = Market(address(new ERC1967Proxy(address(new Market(asset, auditor)), ""))); - market.initialize(3, 1e18, InterestRateModel(address(irm)), 0.02e18 / uint256(1 days), 1e17, 0, 0.0046e18, 0.42e18); + market.initialize( + "DAI", + 3, + 1e18, + InterestRateModel(address(irm)), + 0.02e18 / uint256(1 days), + 1e17, + 0, + 0.0046e18, + 0.42e18 + ); vm.label(address(market), "MarketDAI"); daiPriceFeed = new MockPriceFeed(18, 1e18); marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, InterestRateModel(address(irm)), @@ -728,6 +739,7 @@ contract MarketTest is Test { MockERC20 usdc = new MockERC20("USD Coin", "USDC", 6); Market marketUSDC = Market(address(new ERC1967Proxy(address(new Market(usdc, auditor)), ""))); marketUSDC.initialize( + "USDC.e", 3, 1e18, InterestRateModel(address(irm)), @@ -2446,6 +2458,7 @@ contract MarketTest is Test { MockStETH stETH = new MockStETH(1090725952265553962); Market marketStETH = Market(address(new ERC1967Proxy(address(new Market(stETH, auditor)), ""))); marketStETH.initialize( + "", 3, 1e18, InterestRateModel(address(irm)), @@ -2479,6 +2492,7 @@ contract MarketTest is Test { MockERC20 wbtc = new MockERC20("WBTC", "WBTC", 8); Market marketWBTC = Market(address(new ERC1967Proxy(address(new Market(wbtc, auditor)), ""))); marketWBTC.initialize( + "WBTC", 3, 1e18, InterestRateModel(address(irm)), @@ -2515,6 +2529,7 @@ contract MarketTest is Test { MockERC20 asset = new MockERC20(symbols[i], symbols[i], 18); markets[i] = Market(address(new ERC1967Proxy(address(new Market(asset, auditor)), ""))); markets[i].initialize( + "", 3, 1e18, InterestRateModel(address(irm)), @@ -2827,6 +2842,18 @@ contract MarketTest is Test { assertFalse(market.paused()); } + function testSetAssetSymbol() external { + market.setAssetSymbol("TEST"); + assertEq(market.symbol(), "exaTEST"); + assertEq(market.name(), "exactly TEST"); + } + + function testSetAssetSymbolNotAdmin() external { + vm.prank(BOB); + vm.expectRevert(bytes("")); + market.setAssetSymbol("TEST"); + } + event MarketUpdate( uint256 timestamp, uint256 floatingDepositShares, diff --git a/test/Previewer.t.sol b/test/Previewer.t.sol index 4b259bc50..a31cd4167 100644 --- a/test/Previewer.t.sol +++ b/test/Previewer.t.sol @@ -59,7 +59,7 @@ contract PreviewerTest is Test { }), market ); - market.initialize(12, 1e18, irm, 0.02e18 / uint256(1 days), 0.1e18, 0, 0.0046e18, 0.42e18); + market.initialize("", 12, 1e18, irm, 0.02e18 / uint256(1 days), 0.1e18, 0, 0.0046e18, 0.42e18); vm.label(address(market), "MarketDAI"); auditor.enableMarket(market, daiPriceFeed, 0.8e18); @@ -444,6 +444,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "", 12, 1e18, new InterestRateModel( @@ -557,6 +558,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -707,6 +709,7 @@ contract PreviewerTest is Test { weth.mint(address(this), 1_000 ether); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -880,6 +883,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -1214,6 +1218,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -1294,6 +1299,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -1346,6 +1352,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -1410,6 +1417,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -1529,6 +1537,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -1578,6 +1587,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -1899,6 +1909,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( @@ -1937,6 +1948,7 @@ contract PreviewerTest is Test { MockERC20 weth = new MockERC20("WETH", "WETH", 18); Market marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 12, 1e18, new InterestRateModel( diff --git a/test/Protocol.t.sol b/test/Protocol.t.sol index 86f96f75c..73c0f9c19 100644 --- a/test/Protocol.t.sol +++ b/test/Protocol.t.sol @@ -80,7 +80,7 @@ contract ProtocolTest is Test { }), market ); - market.initialize(MAX_FUTURE_POOLS, 2e18, irm, PENALTY_RATE, 1e17, RESERVE_FACTOR, 0.0046e18, 0.42e18); + market.initialize("", MAX_FUTURE_POOLS, 2e18, irm, PENALTY_RATE, 1e17, RESERVE_FACTOR, 0.0046e18, 0.42e18); vm.label(address(market), string.concat("Market", i.toString())); MockPriceFeed priceFeed = new MockPriceFeed(18, 1e18); // market.setTreasury(address(this), 0.1e18); diff --git a/test/RewardsController.t.sol b/test/RewardsController.t.sol index b048e5adb..b68fa3f78 100644 --- a/test/RewardsController.t.sol +++ b/test/RewardsController.t.sol @@ -44,6 +44,7 @@ contract RewardsControllerTest is Test { marketUSDC = Market(address(new ERC1967Proxy(address(new Market(usdc, auditor)), ""))); marketUSDC.initialize( + "USDC.e", 3, 1e18, InterestRateModel(address(irm)), @@ -58,6 +59,7 @@ contract RewardsControllerTest is Test { marketWETH = Market(address(new ERC1967Proxy(address(new Market(weth, auditor)), ""))); marketWETH.initialize( + "WETH", 3, 1e18, InterestRateModel(address(irm)), @@ -72,6 +74,7 @@ contract RewardsControllerTest is Test { marketWBTC = Market(address(new ERC1967Proxy(address(new Market(wbtc, auditor)), ""))); marketWBTC.initialize( + "WBTC", 3, 1e18, InterestRateModel(address(irm)), @@ -1528,7 +1531,17 @@ contract RewardsControllerTest is Test { MockERC20 rewardAsset = new MockERC20("Reward", "RWD", 10); MockERC20 asset = new MockERC20("Asset", "AST", 6); Market market = Market(address(new ERC1967Proxy(address(new Market(asset, auditor)), ""))); - market.initialize(3, 1e18, InterestRateModel(address(irm)), 0.02e18 / uint256(1 days), 1e17, 0, 0.0046e18, 0.42e18); + market.initialize( + "AST", + 3, + 1e18, + InterestRateModel(address(irm)), + 0.02e18 / uint256(1 days), + 1e17, + 0, + 0.0046e18, + 0.42e18 + ); auditor.enableMarket(market, new MockPriceFeed(18, 1e18), 0.8e18); RewardsController.Config[] memory configs = new RewardsController.Config[](1); diff --git a/test/hardhat/defaultEnv.ts b/test/hardhat/defaultEnv.ts index d3299528a..f79f84368 100644 --- a/test/hardhat/defaultEnv.ts +++ b/test/hardhat/defaultEnv.ts @@ -150,6 +150,7 @@ export class DefaultEnv { await marketProxy.waitForDeployment(); const market = new Contract(marketProxy.target as string, Market.interface, owner) as unknown as Market; await market.initialize( + symbol, 12, parseUnits("1"), interestRateModel.target,