From 65f17a7ac9ddd49f5bff093765bc53737213dc68 Mon Sep 17 00:00:00 2001 From: Bearetta Bera Date: Thu, 3 Sep 2026 15:26:00 +0200 Subject: [PATCH 1/2] chore: add script to deploy new metamorpho factory with the new implementation --- .gitmodules | 2 +- lib/metamorpho-v1.1 | 2 +- package.json | 1 + ...oFactoryV1_1WithExistingFeePartitioner.sol | 38 +++++++++++++++++++ .../config/berachain.json | 3 +- 5 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 script/metamorpho-factory-v1.1/DeployMetaMorphoFactoryV1_1WithExistingFeePartitioner.sol diff --git a/.gitmodules b/.gitmodules index 29ed651..cab424f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,7 +26,7 @@ [submodule "lib/metamorpho-v1.1"] path = lib/metamorpho-v1.1 url = git@github.com:berachain/contracts-metamorpho-v1.1.git - branch = feat/split-fee + branch = main [submodule "lib/morpho-blue"] path = lib/morpho-blue url = git@github.com:berachain/morpho-blue.git diff --git a/lib/metamorpho-v1.1 b/lib/metamorpho-v1.1 index 1aa3c46..be8e4b7 160000 --- a/lib/metamorpho-v1.1 +++ b/lib/metamorpho-v1.1 @@ -1 +1 @@ -Subproject commit 1aa3c467ff874171376e38508690211ce5d78816 +Subproject commit be8e4b772af80b6db8964c557c2ec4410395b7f0 diff --git a/package.json b/package.json index 3c0e4c4..3329ebd 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "deploy:morpho": "yarn build:blue && yarn build:irm && yarn script script/morpho/DeployMorpho.sol --sig \"run(string memory)\"", "deploy:bundler3": "yarn build:bundler3 && yarn script script/bundler3/DeployBundler3.sol --sig \"run(string memory)\"", "deploy:metamorpho-factory-v1.1": "yarn build:metamorpho-v1.1 && yarn script script/metamorpho-factory-v1.1/DeployMetaMorphoFactoryV1_1.sol --sig \"run(string memory)\"", + "deploy:metamorpho-factory-v1.1-existing-fee-partitioner": "yarn build:metamorpho-v1.1 && yarn script script/metamorpho-factory-v1.1/DeployMetaMorphoFactoryV1_1WithExistingFeePartitioner.sol --sig \"run(string memory)\"", "deploy:oracle-factory": "yarn build:oracles && yarn script script/oracle-factory/DeployOracleFactory.sol --sig \"run(string memory)\"", "deploy:urd-factory": "yarn build:urd && yarn script script/urd-factory/DeployUrdFactory.sol --sig \"run(string memory)\"", "deploy:public-allocator": "yarn build:public-allocator && yarn script script/public-allocator/DeployPublicAllocator.sol --sig \"run(string memory)\"", diff --git a/script/metamorpho-factory-v1.1/DeployMetaMorphoFactoryV1_1WithExistingFeePartitioner.sol b/script/metamorpho-factory-v1.1/DeployMetaMorphoFactoryV1_1WithExistingFeePartitioner.sol new file mode 100644 index 0000000..8e37b11 --- /dev/null +++ b/script/metamorpho-factory-v1.1/DeployMetaMorphoFactoryV1_1WithExistingFeePartitioner.sol @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity ^0.8.0; + +import {IMetaMorphoV1_1Factory} from "../../lib/metamorpho-v1.1/src/interfaces/IMetaMorphoV1_1Factory.sol"; +import "../ConfiguredScript.sol"; + +/// @dev Warning: keys must be ordered alphabetically. +struct DeployMetaMorphoFactoryWithExistingFeePartitionerConfig { + address metaFeePartitioner; + bytes32 metaFeePartitionerSalt; + bytes32 salt; +} + +contract DeployMetaMorphoFactoryWithExistingFeePartitioner is ConfiguredScript { + IMetaMorphoV1_1Factory internal metaMorphoFactory; + + function _scriptDir() internal pure override returns (string memory) { + return "metamorpho-factory-v1.1"; + } + + function run(string memory network) + public + returns (DeployMetaMorphoFactoryWithExistingFeePartitionerConfig memory config) + { + config = abi.decode(_init(network, true), (DeployMetaMorphoFactoryWithExistingFeePartitionerConfig)); + + require(config.metaFeePartitioner != address(0), "metaFeePartitioner must be set in the config"); + require(config.metaFeePartitioner.code.length != 0, "metaFeePartitioner is not a contract on this network"); + + console2.log("Reusing MetaFeePartitioner at: ", config.metaFeePartitioner); + + bytes memory constructorArgs = abi.encode(address(morpho), config.metaFeePartitioner); + + metaMorphoFactory = IMetaMorphoV1_1Factory( + _deployCreate2Code("metamorpho-v1.1", "MetaMorphoV1_1Factory", constructorArgs, config.salt) + ); + } +} diff --git a/script/metamorpho-factory-v1.1/config/berachain.json b/script/metamorpho-factory-v1.1/config/berachain.json index 4ac50cf..b0767de 100644 --- a/script/metamorpho-factory-v1.1/config/berachain.json +++ b/script/metamorpho-factory-v1.1/config/berachain.json @@ -1,4 +1,5 @@ { "metaFeePartitionerSalt": "0x000000000000000000000000000000000000000000000000000000000000009", - "salt": "0x000000000000000000000000000000000000000000000000000000000000009" + "salt": "0x0000000000000000000000000000000000000000000000000000000000000010", + "metaFeePartitioner": "0x80108Ee81A92091Db6B8B2326B1875ce9388f461" } From 6163409069999be0bdc87ac1a055018e920e5a00 Mon Sep 17 00:00:00 2001 From: Bearetta Bera Date: Thu, 3 Sep 2026 15:46:43 +0200 Subject: [PATCH 2/2] chore: fix gh actions --- .github/workflows/formatting.yml | 4 ++-- .github/workflows/foundry.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 7a669e8..b04384a 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -14,10 +14,10 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3 - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1 - name: Run Linter run: forge fmt --check diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index 6ed4611..5e1a028 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -17,15 +17,15 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3 with: submodules: recursive - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1 - name: Install node - uses: actions/setup-node@v3 + uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3 with: node-version: 18 cache: yarn