Skip to content

Commit eb274a2

Browse files
committed
fix: create2 bug fixed
1 parent a3e62e4 commit eb274a2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

script/Migrate.sol

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ interface IAddressProviderV3Legacy {
6161
}
6262

6363
address constant emergencyLiquidator = 0x7BD9c8161836b1F402233E80F55E3CaE0Fde4d87;
64+
address constant PUBLIC_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
6465

6566
contract Migrate is Script {
6667
using LibString for bytes32;
@@ -156,7 +157,9 @@ contract Migrate is Script {
156157
bytes memory parameters = abi.encode(oldAddressProvider, address(_addressProvider), "ChaosLabs", vetoAdmin);
157158

158159
bytes memory bytecodeWithParams = abi.encodePacked(bytecode, parameters);
159-
address mcl = Create2.computeAddress(0, keccak256(bytecodeWithParams));
160+
address mcl = Create2.computeAddress(0, keccak256(bytecodeWithParams), PUBLIC_FACTORY);
161+
162+
console.log("MarketConfiguratorLegacy:", mcl);
160163

161164
/// set this contract to add mcl as marketConfigurator
162165
_addressProvider.setAddress(AP_MARKET_CONFIGURATOR_FACTORY.fromSmallString(), deployer, false);
@@ -165,7 +168,8 @@ contract Migrate is Script {
165168
_addressProvider.addMarketConfigurator(address(mcl));
166169

167170
/// Deploy MarketConfiguratorLegacy
168-
Create2.deploy(0, 0, bytecodeWithParams);
171+
address pp = Create2.deploy(0, 0, bytecodeWithParams);
172+
console.log("MarketConfiguratorLegacy deployed at:", pp);
169173

170174
factory = address(new MarketConfiguratorFactoryV3(address(_addressProvider)));
171175
_addressProvider.setAddress(factory, false);

0 commit comments

Comments
 (0)