From c34a8016c090859dcd7c4aba62ac95475d77f35d Mon Sep 17 00:00:00 2001 From: Rubilmax Date: Tue, 19 Dec 2023 09:59:13 +0100 Subject: [PATCH] test(irm): dont fuzz irm --- .../CreateMarketIntegrationTest.sol | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/test/forge/integration/CreateMarketIntegrationTest.sol b/test/forge/integration/CreateMarketIntegrationTest.sol index cbf23393a..db675543f 100644 --- a/test/forge/integration/CreateMarketIntegrationTest.sol +++ b/test/forge/integration/CreateMarketIntegrationTest.sol @@ -19,12 +19,6 @@ contract CreateMarketIntegrationTest is BaseTest { function testCreateMarketWithNotEnabledIrmAndEnabledLltv(MarketParams memory marketParamsFuzz) public { vm.assume(!morpho.isIrmEnabled(marketParamsFuzz.irm)); - marketParamsFuzz.lltv = _boundValidLltv(marketParamsFuzz.lltv); - - vm.startPrank(OWNER); - if (!morpho.isLltvEnabled(marketParamsFuzz.lltv)) morpho.enableLltv(marketParamsFuzz.lltv); - vm.stopPrank(); - vm.expectRevert(bytes(ErrorsLib.IRM_NOT_ENABLED)); vm.prank(OWNER); morpho.createMarket(marketParamsFuzz); @@ -43,18 +37,14 @@ contract CreateMarketIntegrationTest is BaseTest { } function testCreateMarketWithEnabledIrmAndLltv(MarketParams memory marketParamsFuzz) public { + marketParamsFuzz.irm = address(irm); marketParamsFuzz.lltv = _boundValidLltv(marketParamsFuzz.lltv); Id marketParamsFuzzId = marketParamsFuzz.id(); vm.startPrank(OWNER); - if (!morpho.isIrmEnabled(marketParamsFuzz.irm)) morpho.enableIrm(marketParamsFuzz.irm); if (!morpho.isLltvEnabled(marketParamsFuzz.lltv)) morpho.enableLltv(marketParamsFuzz.lltv); vm.stopPrank(); - if (marketParamsFuzz.irm != address(0)) { - vm.mockCall(marketParamsFuzz.irm, abi.encodeWithSelector(IIrm.borrowRate.selector), abi.encode(0)); - } - vm.expectEmit(true, true, true, true, address(morpho)); emit EventsLib.CreateMarket(marketParamsFuzz.id(), marketParamsFuzz); vm.prank(OWNER); @@ -69,17 +59,13 @@ contract CreateMarketIntegrationTest is BaseTest { } function testCreateMarketAlreadyCreated(MarketParams memory marketParamsFuzz) public { + marketParamsFuzz.irm = address(irm); marketParamsFuzz.lltv = _boundValidLltv(marketParamsFuzz.lltv); vm.startPrank(OWNER); - if (!morpho.isIrmEnabled(marketParamsFuzz.irm)) morpho.enableIrm(marketParamsFuzz.irm); if (!morpho.isLltvEnabled(marketParamsFuzz.lltv)) morpho.enableLltv(marketParamsFuzz.lltv); vm.stopPrank(); - if (marketParamsFuzz.irm != address(0)) { - vm.mockCall(marketParamsFuzz.irm, abi.encodeWithSelector(IIrm.borrowRate.selector), abi.encode(0)); - } - vm.prank(OWNER); morpho.createMarket(marketParamsFuzz); @@ -89,18 +75,14 @@ contract CreateMarketIntegrationTest is BaseTest { } function testIdToMarketParams(MarketParams memory marketParamsFuzz) public { + marketParamsFuzz.irm = address(irm); marketParamsFuzz.lltv = _boundValidLltv(marketParamsFuzz.lltv); Id marketParamsFuzzId = marketParamsFuzz.id(); vm.startPrank(OWNER); - if (!morpho.isIrmEnabled(marketParamsFuzz.irm)) morpho.enableIrm(marketParamsFuzz.irm); if (!morpho.isLltvEnabled(marketParamsFuzz.lltv)) morpho.enableLltv(marketParamsFuzz.lltv); vm.stopPrank(); - if (marketParamsFuzz.irm != address(0)) { - vm.mockCall(marketParamsFuzz.irm, abi.encodeWithSelector(IIrm.borrowRate.selector), abi.encode(0)); - } - vm.prank(OWNER); morpho.createMarket(marketParamsFuzz);