diff --git a/contracts/.gas-snapshot b/contracts/.gas-snapshot index 088f4075..a683756d 100644 --- a/contracts/.gas-snapshot +++ b/contracts/.gas-snapshot @@ -1,48 +1,48 @@ -ExaAccountFactoryTest:testFuzz_createAccount_EOAOwners(uint256,address[63]) (runs: 256, μ: 3563445, ~: 3436081) -ExaPluginTest:test_collectCredit_collects() (gas: 920206) -ExaPluginTest:test_collectCredit_collects_whenHealthFactorHigherThanMinHealthFactor() (gas: 800832) -ExaPluginTest:test_collectCredit_collects_withEnoughSlippage() (gas: 799411) -ExaPluginTest:test_collectCredit_passes_whenProposalLeavesEnoughLiquidity() (gas: 1009267) -ExaPluginTest:test_collectCredit_reverts_asNotKeeper() (gas: 362543) -ExaPluginTest:test_collectCredit_reverts_whenDisagreement() (gas: 555202) -ExaPluginTest:test_collectCredit_reverts_whenExpired() (gas: 358241) -ExaPluginTest:test_collectCredit_reverts_whenHealthFactorLowerThanMinHealthFactor() (gas: 831051) -ExaPluginTest:test_collectCredit_reverts_whenPrposalCausesInsufficientLiquidity() (gas: 1009559) -ExaPluginTest:test_collectCredit_reverts_whenReplay() (gas: 842468) -ExaPluginTest:test_collectCredit_reverts_whenTimelocked() (gas: 354860) -ExaPluginTest:test_collectCredit_toleratesTimeDrift() (gas: 802776) -ExaPluginTest:test_collectDebit_collects() (gas: 651524) -ExaPluginTest:test_collectDebit_collects_whenProposalLeavesEnoughLiquidity() (gas: 855054) -ExaPluginTest:test_collectDebit_reverts_asNotKeeper() (gas: 362353) -ExaPluginTest:test_collectDebit_reverts_whenExpired() (gas: 358025) -ExaPluginTest:test_collectDebit_reverts_whenProposalCausesInsufficientLiquidity() (gas: 851993) -ExaPluginTest:test_collectDebit_reverts_whenReplay() (gas: 691013) -ExaPluginTest:test_collectDebit_reverts_whenTimelocked() (gas: 354623) -ExaPluginTest:test_collectDebit_toleratesTimeDrift() (gas: 651641) -ExaPluginTest:test_collectInstallments_collects() (gas: 1338486) -ExaPluginTest:test_collectInstallments_revertsWhenNoSlippage() (gas: 1202584) -ExaPluginTest:test_collectInstallments_reverts_asNotKeeper() (gas: 363415) -ExaPluginTest:test_collectInstallments_reverts_whenExpired() (gas: 360401) -ExaPluginTest:test_collectInstallments_reverts_whenReplay() (gas: 1070389) -ExaPluginTest:test_collectInstallments_reverts_whenTimelocked() (gas: 356984) -ExaPluginTest:test_collectInstallments_toleratesTimeDrift() (gas: 1195121) -ExaPluginTest:test_crossRepay_repays() (gas: 20017889) -ExaPluginTest:test_crossRepay_repays_whenKeeper() (gas: 20008018) -ExaPluginTest:test_crossRepay_reverts_whenNotKeeper() (gas: 18350629) -ExaPluginTest:test_debitCollateral_collects() (gas: 20159006) -ExaPluginTest:test_exitMarket_reverts() (gas: 389045) -ExaPluginTest:test_lifiSwap_reverts_withDisagreement() (gas: 17523653) -ExaPluginTest:test_lifiSwap_swaps() (gas: 17240058) +ExaAccountFactoryTest:testFuzz_createAccount_EOAOwners(uint256,address[63]) (runs: 256, μ: 3603713, ~: 3515846) +ExaPluginTest:test_collectCredit_collects() (gas: 920177) +ExaPluginTest:test_collectCredit_collects_whenHealthFactorHigherThanMinHealthFactor() (gas: 800803) +ExaPluginTest:test_collectCredit_collects_withEnoughSlippage() (gas: 799382) +ExaPluginTest:test_collectCredit_passes_whenProposalLeavesEnoughLiquidity() (gas: 1009209) +ExaPluginTest:test_collectCredit_reverts_asNotKeeper() (gas: 362514) +ExaPluginTest:test_collectCredit_reverts_whenDisagreement() (gas: 555173) +ExaPluginTest:test_collectCredit_reverts_whenExpired() (gas: 358212) +ExaPluginTest:test_collectCredit_reverts_whenHealthFactorLowerThanMinHealthFactor() (gas: 831022) +ExaPluginTest:test_collectCredit_reverts_whenPrposalCausesInsufficientLiquidity() (gas: 1009501) +ExaPluginTest:test_collectCredit_reverts_whenReplay() (gas: 842439) +ExaPluginTest:test_collectCredit_reverts_whenTimelocked() (gas: 354831) +ExaPluginTest:test_collectCredit_toleratesTimeDrift() (gas: 802747) +ExaPluginTest:test_collectDebit_collects() (gas: 651495) +ExaPluginTest:test_collectDebit_collects_whenProposalLeavesEnoughLiquidity() (gas: 854996) +ExaPluginTest:test_collectDebit_reverts_asNotKeeper() (gas: 362324) +ExaPluginTest:test_collectDebit_reverts_whenExpired() (gas: 357996) +ExaPluginTest:test_collectDebit_reverts_whenProposalCausesInsufficientLiquidity() (gas: 851935) +ExaPluginTest:test_collectDebit_reverts_whenReplay() (gas: 690984) +ExaPluginTest:test_collectDebit_reverts_whenTimelocked() (gas: 354594) +ExaPluginTest:test_collectDebit_toleratesTimeDrift() (gas: 651612) +ExaPluginTest:test_collectInstallments_collects() (gas: 1338457) +ExaPluginTest:test_collectInstallments_revertsWhenNoSlippage() (gas: 1202555) +ExaPluginTest:test_collectInstallments_reverts_asNotKeeper() (gas: 363386) +ExaPluginTest:test_collectInstallments_reverts_whenExpired() (gas: 360372) +ExaPluginTest:test_collectInstallments_reverts_whenReplay() (gas: 1070360) +ExaPluginTest:test_collectInstallments_reverts_whenTimelocked() (gas: 356955) +ExaPluginTest:test_collectInstallments_toleratesTimeDrift() (gas: 1195092) +ExaPluginTest:test_crossRepay_repays() (gas: 20028460) +ExaPluginTest:test_crossRepay_repays_whenKeeper() (gas: 20018589) +ExaPluginTest:test_crossRepay_reverts_whenNotKeeper() (gas: 18361229) +ExaPluginTest:test_debitCollateral_collects() (gas: 20169577) +ExaPluginTest:test_exitMarket_reverts() (gas: 389016) +ExaPluginTest:test_lifiSwap_reverts_withDisagreement() (gas: 17534253) +ExaPluginTest:test_lifiSwap_swaps() (gas: 17250658) ExaPluginTest:test_onUninstall_uninstalls() (gas: 284122) -ExaPluginTest:test_poke() (gas: 315694) +ExaPluginTest:test_poke() (gas: 315665) ExaPluginTest:test_pokeETH_deposits() (gas: 392792) -ExaPluginTest:test_propose_emitsProposed() (gas: 218704) +ExaPluginTest:test_propose_emitsProposed() (gas: 218675) ExaPluginTest:test_refund_refunds() (gas: 361535) -ExaPluginTest:test_repay_partiallyRepays() (gas: 1249846) -ExaPluginTest:test_repay_partiallyRepays_whenKeeper() (gas: 1192016) -ExaPluginTest:test_repay_repays() (gas: 1165942) -ExaPluginTest:test_repay_repays_whenKeeper() (gas: 1108251) -ExaPluginTest:test_rollDebt_rolls() (gas: 1232549) +ExaPluginTest:test_repay_partiallyRepays() (gas: 1249817) +ExaPluginTest:test_repay_partiallyRepays_whenKeeper() (gas: 1191987) +ExaPluginTest:test_repay_repays() (gas: 1165913) +ExaPluginTest:test_repay_repays_whenKeeper() (gas: 1108222) +ExaPluginTest:test_rollDebt_rolls() (gas: 1232520) ExaPluginTest:test_setCollector_emitsCollectorSet() (gas: 40531) ExaPluginTest:test_setCollector_reverts_whenAddressZero() (gas: 32206) ExaPluginTest:test_setCollector_reverts_whenNotAdmin() (gas: 33736) @@ -50,18 +50,18 @@ ExaPluginTest:test_setCollector_sets_whenAdmin() (gas: 39832) ExaPluginTest:test_setMinHealthFactor_reverts_whenLowerThanWad() (gas: 32200) ExaPluginTest:test_setMinHealthFactor_reverts_whenNotAdmin() (gas: 33724) ExaPluginTest:test_setMinHealthFactor_sets_whenAdmin() (gas: 39345) -ExaPluginTest:test_withdrawWETH_transfersETH() (gas: 865188) -ExaPluginTest:test_withdraw_reverts_whenNoProposal() (gas: 414905) -ExaPluginTest:test_withdraw_reverts_whenNoProposalKeeper() (gas: 357764) -ExaPluginTest:test_withdraw_reverts_whenNotKeeper() (gas: 354804) -ExaPluginTest:test_withdraw_reverts_whenReceiverIsContractAndMarketNotWETH() (gas: 620913) -ExaPluginTest:test_withdraw_reverts_whenTimelocked() (gas: 307471) -ExaPluginTest:test_withdraw_reverts_whenTimelockedKeeper() (gas: 309262) -ExaPluginTest:test_withdraw_reverts_whenWrongAmount() (gas: 308438) -ExaPluginTest:test_withdraw_reverts_whenWrongMarket() (gas: 309172) -ExaPluginTest:test_withdraw_reverts_whenWrongReceiver() (gas: 308107) -ExaPluginTest:test_withdraw_transfersAsset_asKeeper() (gas: 819800) -ExaPluginTest:test_withdraw_transfersAsset_asOwner() (gas: 818536) +ExaPluginTest:test_withdrawWETH_transfersETH() (gas: 865159) +ExaPluginTest:test_withdraw_reverts_whenNoProposal() (gas: 414876) +ExaPluginTest:test_withdraw_reverts_whenNoProposalKeeper() (gas: 357735) +ExaPluginTest:test_withdraw_reverts_whenNotKeeper() (gas: 354775) +ExaPluginTest:test_withdraw_reverts_whenReceiverIsContractAndMarketNotWETH() (gas: 620855) +ExaPluginTest:test_withdraw_reverts_whenTimelocked() (gas: 307442) +ExaPluginTest:test_withdraw_reverts_whenTimelockedKeeper() (gas: 309233) +ExaPluginTest:test_withdraw_reverts_whenWrongAmount() (gas: 308409) +ExaPluginTest:test_withdraw_reverts_whenWrongMarket() (gas: 309143) +ExaPluginTest:test_withdraw_reverts_whenWrongReceiver() (gas: 308078) +ExaPluginTest:test_withdraw_transfersAsset_asKeeper() (gas: 819742) +ExaPluginTest:test_withdraw_transfersAsset_asOwner() (gas: 818478) InstallmentsPreviewerTest:test_preview_returns() (gas: 135598) RefunderTest:test_refund_refunds() (gas: 242379) RefunderTest:test_refund_reverts_whenExpired() (gas: 69144) diff --git a/contracts/src/ExaPlugin.sol b/contracts/src/ExaPlugin.sol index 7c860b0f..8f023ea5 100644 --- a/contracts/src/ExaPlugin.sol +++ b/contracts/src/ExaPlugin.sol @@ -651,10 +651,6 @@ contract ExaPlugin is AccessControl, BasePlugin, IExaAccount { } } - function _checkMarket(IMarket market) internal view { - if (!_isMarket(market)) revert NotMarket(); - } - function _flashLoan(uint256 amount, bytes memory data) internal { IERC20[] memory tokens = new IERC20[](1); tokens[0] = IERC20(EXA_USDC.asset()); @@ -687,7 +683,7 @@ contract ExaPlugin is AccessControl, BasePlugin, IExaAccount { } modifier onlyMarket(IMarket market) { - _checkMarket(market); + if (!_isMarket(market)) revert NotMarket(); _; }