|
| 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 | +} |
0 commit comments