Skip to content

Commit 99b55fe

Browse files
authored
chore: add script to deploy new metamorpho factory with the new implementation (#7)
* chore: add script to deploy new metamorpho factory with the new implementation * chore: fix gh actions
1 parent 43dfa22 commit 99b55fe

7 files changed

Lines changed: 48 additions & 8 deletions

File tree

‎.github/workflows/formatting.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
lint:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3
1818

1919
- name: Install Foundry
20-
uses: foundry-rs/foundry-toolchain@v1
20+
uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1
2121

2222
- name: Run Linter
2323
run: forge fmt --check

‎.github/workflows/foundry.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3
2121
with:
2222
submodules: recursive
2323

2424
- name: Install Foundry
25-
uses: foundry-rs/foundry-toolchain@v1
25+
uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1
2626

2727
- name: Install node
28-
uses: actions/setup-node@v3
28+
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
2929
with:
3030
node-version: 18
3131
cache: yarn

‎.gitmodules‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
[submodule "lib/metamorpho-v1.1"]
2727
path = lib/metamorpho-v1.1
2828
url = git@github.com:berachain/contracts-metamorpho-v1.1.git
29-
branch = feat/split-fee
29+
branch = main
3030
[submodule "lib/morpho-blue"]
3131
path = lib/morpho-blue
3232
url = git@github.com:berachain/morpho-blue.git

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"deploy:morpho": "yarn build:blue && yarn build:irm && yarn script script/morpho/DeployMorpho.sol --sig \"run(string memory)\"",
1010
"deploy:bundler3": "yarn build:bundler3 && yarn script script/bundler3/DeployBundler3.sol --sig \"run(string memory)\"",
1111
"deploy:metamorpho-factory-v1.1": "yarn build:metamorpho-v1.1 && yarn script script/metamorpho-factory-v1.1/DeployMetaMorphoFactoryV1_1.sol --sig \"run(string memory)\"",
12+
"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)\"",
1213
"deploy:oracle-factory": "yarn build:oracles && yarn script script/oracle-factory/DeployOracleFactory.sol --sig \"run(string memory)\"",
1314
"deploy:urd-factory": "yarn build:urd && yarn script script/urd-factory/DeployUrdFactory.sol --sig \"run(string memory)\"",
1415
"deploy:public-allocator": "yarn build:public-allocator && yarn script script/public-allocator/DeployPublicAllocator.sol --sig \"run(string memory)\"",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
pragma solidity ^0.8.0;
3+
4+
import {IMetaMorphoV1_1Factory} from "../../lib/metamorpho-v1.1/src/interfaces/IMetaMorphoV1_1Factory.sol";
5+
import "../ConfiguredScript.sol";
6+
7+
/// @dev Warning: keys must be ordered alphabetically.
8+
struct DeployMetaMorphoFactoryWithExistingFeePartitionerConfig {
9+
address metaFeePartitioner;
10+
bytes32 metaFeePartitionerSalt;
11+
bytes32 salt;
12+
}
13+
14+
contract DeployMetaMorphoFactoryWithExistingFeePartitioner is ConfiguredScript {
15+
IMetaMorphoV1_1Factory internal metaMorphoFactory;
16+
17+
function _scriptDir() internal pure override returns (string memory) {
18+
return "metamorpho-factory-v1.1";
19+
}
20+
21+
function run(string memory network)
22+
public
23+
returns (DeployMetaMorphoFactoryWithExistingFeePartitionerConfig memory config)
24+
{
25+
config = abi.decode(_init(network, true), (DeployMetaMorphoFactoryWithExistingFeePartitionerConfig));
26+
27+
require(config.metaFeePartitioner != address(0), "metaFeePartitioner must be set in the config");
28+
require(config.metaFeePartitioner.code.length != 0, "metaFeePartitioner is not a contract on this network");
29+
30+
console2.log("Reusing MetaFeePartitioner at: ", config.metaFeePartitioner);
31+
32+
bytes memory constructorArgs = abi.encode(address(morpho), config.metaFeePartitioner);
33+
34+
metaMorphoFactory = IMetaMorphoV1_1Factory(
35+
_deployCreate2Code("metamorpho-v1.1", "MetaMorphoV1_1Factory", constructorArgs, config.salt)
36+
);
37+
}
38+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"metaFeePartitionerSalt": "0x000000000000000000000000000000000000000000000000000000000000009",
3-
"salt": "0x000000000000000000000000000000000000000000000000000000000000009"
3+
"salt": "0x0000000000000000000000000000000000000000000000000000000000000010",
4+
"metaFeePartitioner": "0x80108Ee81A92091Db6B8B2326B1875ce9388f461"
45
}

0 commit comments

Comments
 (0)