Skip to content

Commit

Permalink
refactor deploy a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed Sep 30, 2024
1 parent 0d08c80 commit 9ee03f8
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions script/Deploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract Deploy is Script {
vm.startBroadcast(deployerPrivateKey);

address raindex = address(0);
address routeProcessor = address(0);
address routeProcessor = vm.envOr("DEPLOY_ROUTE_PROCESSOR_4_ADDRESS", address(0));

if (suite == DEPLOYMENT_SUITE_RAINDEX || suite == DEPLOYMENT_SUITE_ALL) {
raindex = address(deployRaindex());
Expand All @@ -76,23 +76,18 @@ contract Deploy is Script {
deploySubParser(metaboard);
}

if (suite == DEPLOYMENT_SUITE_ROUTE_PROCESSOR || suite == DEPLOYMENT_SUITE_ALL) {
if (suite == DEPLOYMENT_SUITE_ROUTE_PROCESSOR || (suite == DEPLOYMENT_SUITE_ALL && routeProcessor == address(0))) {
routeProcessor = deployRouter();
}
bytes32 routeProcessor4BytecodeHash;
assembly {
routeProcessor4BytecodeHash := extcodehash(routeProcessor)
}
if (routeProcessor4BytecodeHash != ROUTE_PROCESSOR_4_BYTECODE_HASH) {
revert BadRouteProcessor(ROUTE_PROCESSOR_4_BYTECODE_HASH, routeProcessor4BytecodeHash);
}

if (suite == DEPLOYMENT_SUITE_ARB || suite == DEPLOYMENT_SUITE_ALL) {
if (routeProcessor == address(0)) {
routeProcessor = vm.envAddress("DEPLOY_ROUTE_PROCESSOR_4_ADDRESS");
}

bytes32 routeProcessor4BytecodeHash;
assembly {
routeProcessor4BytecodeHash := extcodehash(routeProcessor)
}
if (routeProcessor4BytecodeHash != ROUTE_PROCESSOR_4_BYTECODE_HASH) {
revert BadRouteProcessor(ROUTE_PROCESSOR_4_BYTECODE_HASH, routeProcessor4BytecodeHash);
}

if (raindex == address(0)) {
raindex = vm.envAddress("DEPLOY_RAINDEX_ADDRESS");
}
Expand Down

0 comments on commit 9ee03f8

Please sign in to comment.