diff --git a/foundry.toml b/foundry.toml index 0a61c909..fcd86988 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,7 +5,7 @@ libs = ["lib"] evm_version = "paris" fs_permissions = [ { access = "read", path = "./config/"}, - { access = "read", path = "./lib/morpho-blue/out/"} + { access = "read", path = "./out/"} ] [profile.default.rpc_endpoints] diff --git a/hardhat.config.ts b/hardhat.config.ts index b275bd1d..ae128eed 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -68,14 +68,25 @@ const config: HardhatUserConfig = { { version: "0.8.21", settings: { - optimizer: { + optimizer: { enabled: true, runs: 200, }, viaIR: true, evmVersion: "paris", - }, + } }, + { + version: "0.8.19", + settings: { + optimizer: { + enabled: true, + runs: 999999, + }, + viaIR: true, + evmVersion: "paris", + } + } ], }, mocha: { diff --git a/src/mocks/MorphoImport.sol b/src/mocks/MorphoImport.sol new file mode 100644 index 00000000..bf778e1d --- /dev/null +++ b/src/mocks/MorphoImport.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity 0.8.19; +// Force foundry to compile Morpho Blue even though it's not imported by Metamorpho or by the tests. +// Morpho Blue will be compiled with its own solidity version. +// The resulting bytecode is then loaded by BaseTest.sol. + +import "../../lib/morpho-blue/src/Morpho.sol"; diff --git a/test/forge/helpers/BaseTest.sol b/test/forge/helpers/BaseTest.sol index cef788ec..a55f6505 100644 --- a/test/forge/helpers/BaseTest.sol +++ b/test/forge/helpers/BaseTest.sol @@ -52,8 +52,7 @@ contract BaseTest is Test { address internal MORPHO_OWNER = makeAddr("MorphoOwner"); address internal MORPHO_FEE_RECIPIENT = makeAddr("MorphoFeeRecipient"); - IMorpho internal morpho = - IMorpho(deployCode("lib/morpho-blue/out/Morpho.sol/Morpho.json", abi.encode(MORPHO_OWNER))); + IMorpho internal morpho = IMorpho(deployCode("Morpho.sol", abi.encode(MORPHO_OWNER))); ERC20Mock internal loanToken = new ERC20Mock("loan", "B"); ERC20Mock internal collateralToken = new ERC20Mock("collateral", "C"); OracleMock internal oracle = new OracleMock();