Skip to content

Commit

Permalink
fix deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbuild3r committed Aug 4, 2023
1 parent 75b1ee1 commit 566898c
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 24 deletions.
87 changes: 65 additions & 22 deletions src/script/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async function getBaseRpcUrl(config) {
config.baseRpcUrl = process.env.OP_RPC_URL;
}
if (!config.baseRpcUrl) {
config.baseRpcUrl = await ask(`Enter Optimism RPC URL: (${DEFAULT_RPC_URL}) `);
config.baseRpcUrl = await ask(`Enter Base RPC URL: (${DEFAULT_RPC_URL}) `);
}
if (!config.baseRpcUrl) {
config.baseRpcUrl = DEFAULT_RPC_URL;
Expand Down Expand Up @@ -241,37 +241,64 @@ async function getDeployerAddress(config) {
}
}

async function getOpGasLimitSendRootOptimism(config) {
if (!config.opGasLimitSendRootOptimism) {
config.opGasLimitSendRootOptimism = process.env.OP_GAS_LIMIT_SEND_ROOT_OPTIMISM;
async function getGasLimitSendRootOptimism(config) {
if (!config.gasLimitSendRootOptimism) {
config.gasLimitSendRootOptimism = process.env.GAS_LIMIT_SEND_ROOT_OPTIMISM;
}
if (!config.opGasLimitSendRootOptimism) {
config.opGasLimitSendRootOptimism = await ask("Enter the Optimism gas limit for sendRootOptimism: ");
if (!config.gasLimitSendRootOptimism) {
config.gasLimitSendRootOptimism = await ask("Enter the Optimism gas limit for sendRootOptimism: ");
}
}

async function getOpGasLimitSetRootHistoryExpiryOptimism(config) {
if (!config.opGasLimitSetRootHistoryExpiryOptimism) {
config.opGasLimitSetRootHistoryExpiryOptimism = process.env.OP_GAS_LIMIT_SET_ROOT_HISTORY_EXPIRY_OPTIMISM;
async function getGasLimitSetRootHistoryExpiryOptimism(config) {
if (!config.gasLimitSetRootHistoryExpiryOptimism) {
config.gasLimitSetRootHistoryExpiryOptimism = process.env.GAS_LIMIT_SET_ROOT_HISTORY_EXPIRY_OPTIMISM;
}
if (!config.opGasLimitSetRootHistoryExpiryOptimism) {
config.opGasLimitSetRootHistoryExpiryOptimism = await ask(
if (!config.gasLimitSetRootHistoryExpiryOptimism) {
config.gasLimitSetRootHistoryExpiryOptimism = await ask(
"Enter the Optimism gas limit for setRootHistoryExpiryOptimism: ",
);
}
}

async function getOpGasLimitTransferOwnershipOptimism(config) {
if (!config.opGasLimitTransferOwnershipOptimism) {
config.opGasLimitTransferOwnershipOptimism = process.env.OP_GAS_LIMIT_TRANSFER_OWNERSHIP_OPTIMISM;
async function getGasLimitTransferOwnershipOptimism(config) {
if (!config.gasLimitTransferOwnershipOptimism) {
config.gasLimitTransferOwnershipOptimism = process.env.GAS_LIMIT_TRANSFER_OWNERSHIP_OPTIMISM;
}
if (!config.opGasLimitTransferOwnershipOptimism) {
config.opGasLimitTransferOwnershipOptimism = await ask(
if (!config.gasLimitTransferOwnershipOptimism) {
config.gasLimitTransferOwnershipOptimism = await ask(
"Enter the Optimism gas limit for transferOwnershipOptimism: ",
);
}
}

async function getGasLimitSendRootBase(config) {
if (!config.gasLimitSendRootBase) {
config.gasLimitSendRootBase = process.env.GAS_LIMIT_SEND_ROOT_BASE;
}
if (!config.gasLimitSendRootBase) {
config.gasLimitSendRootBase = await ask("Enter the Base gas limit for sendRootBase: ");
}
}

async function getGasLimitSetRootHistoryExpiryBase(config) {
if (!config.gasLimitSetRootHistoryExpiryBase) {
config.gasLimitSetRootHistoryExpiryBase = process.env.GAS_LIMIT_SET_ROOT_HISTORY_EXPIRY_BASE;
}
if (!config.gasLimitSetRootHistoryExpiryBase) {
config.gasLimitSetRootHistoryExpiryBase = await ask("Enter the Base gas limit for setRootHistoryExpiryBase: ");
}
}

async function getGasLimitTransferOwnershipBase(config) {
if (!config.gasLimitTransferOwnershipBase) {
config.gasLimitTransferOwnershipBase = process.env.GAS_LIMIT_TRANSFER_OWNERSHIP_BASE;
}
if (!config.gasLimitTransferOwnershipBase) {
config.gasLimitTransferOwnershipBase = await ask("Enter the Base gas limit for transferOwnershipBase: ");
}
}

async function loadConfiguration(useConfig) {
if (!useConfig) {
return {};
Expand Down Expand Up @@ -546,23 +573,27 @@ async function deploymentMainnet(config) {
await getPrivateKey(config);
await getEthereumRpcUrl(config);
await getOptimismRpcUrl(config);
await getBaseRpcUrl(config);
await getPolygonRpcUrl(config);
await getEthereumEtherscanApiKey(config);
await getOptimismEtherscanApiKey(config);
await getBaseEtherscanApiKey(config);
await getPolygonscanApiKey(config);
await getTreeDepth(config);
await saveConfiguration(config);
await deployOptimismWorldID(config);
await deployBaseWorldID(config);
await deployPolygonWorldIDMainnet(config);
await getWorldIDIdentityManagerAddress(config);
await getOptimismWorldIDAddress(config);
await getBaseWorldIDAddress(config);
await getPolygonWorldIDAddress(config);
await saveConfiguration(config);
await deployStateBridgeMainnet(config);
await getStateBridgeAddress(config);
await saveConfiguration(config);
await initializePolygonWorldID(config);
await transferOwnershipOfOpWorldIDMainnet(config);
// await transferOwnershipOfOpWorldIDMainnet(config);
}

async function deploymentTestnet(config) {
Expand Down Expand Up @@ -591,7 +622,7 @@ async function deploymentTestnet(config) {
await getStateBridgeAddress(config);
await saveConfiguration(config);
await initializePolygonWorldID(config);
await transferOwnershipOfOpWorldIDGoerli(config);
// await transferOwnershipOfOpWorldIDGoerli(config);
}

async function mockDeployment(config) {
Expand All @@ -600,9 +631,11 @@ async function mockDeployment(config) {
await getPrivateKey(config);
await getEthereumRpcUrl(config);
await getOptimismRpcUrl(config);
await getBaseRpcUrl(config);
await getPolygonRpcUrl(config);
await getEthereumEtherscanApiKey(config);
await getOptimismEtherscanApiKey(config);
await getBaseEtherscanApiKey(config);
await getPolygonscanApiKey(config);
await getTreeDepth(config);
await saveConfiguration(config);
Expand All @@ -611,6 +644,7 @@ async function mockDeployment(config) {
await deployPolygonWorldIDMumbai(config);
await getWorldIDIdentityManagerAddress(config);
await getOptimismWorldIDAddress(config);
await getBaseWorldIDAddress(config);
await getPolygonWorldIDAddress(config);
await saveConfiguration(config);
await deployStateBridgeGoerli(config);
Expand All @@ -631,15 +665,18 @@ async function mockLocalDeployment(config) {
await getEthereumRpcUrl(config);
await getOptimismRpcUrl(config);
await getPolygonRpcUrl(config);
await getBaseRpcUrl(config);
await getEthereumEtherscanApiKey(config);
await getOptimismEtherscanApiKey(config);
await getBaseEtherscanApiKey(config);
await getPolygonscanApiKey(config);
await getTreeDepth(config);
await saveConfiguration(config);
await deployMockWorldID(config);
await deployMockOpPolygonWorldID(config);
await getWorldIDIdentityManagerAddress(config);
await getOptimismWorldIDAddress(config);
await getBaseWorldIDAddress(config);
await getPolygonWorldIDAddress(config);
await saveConfiguration(config);
await deployMockStateBridge(config);
Expand All @@ -656,12 +693,18 @@ async function setOpGasLimit(config) {

await getEthereumRpcUrl(config);
await getOptimismWorldIDAddress(config);
await getOptimismAlchemyApiKey(config);
await getOptimismRpcUrl(config);
await getBaseWorldIDAddress(config);
await getBaseRpcUrl(config);
await getDeployerAddress(config);
await saveConfiguration(config);
await getOpGasLimitSendRootOptimism(config);
await getOpGasLimitSetRootHistoryExpiryOptimism(config);
await getOpGasLimitTransferOwnershipOptimism(config);
await getGasLimitSendRootOptimism(config);
await getGasLimitSetRootHistoryExpiryOptimism(config);
await getGasLimitTransferOwnershipOptimism(config);
await getGasLimitSendRootBase(config);
await getGasLimitSetRootHistoryExpiryBase(config);
await getGasLimitTransferOwnershipBase(config);

// await getOpGasLimitEstimates(config);
await saveConfiguration(config);

Expand Down
2 changes: 0 additions & 2 deletions src/script/deploy/DeployMockStateBridge.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ contract DeployMockStateBridge is Script {
MockStateBridge public bridge;

address public opWorldIDAddress;
address public polygonWorldIDAddress;
address public worldIDIdentityManagerAddress;
address public stateBridgeAddress;

Expand All @@ -32,7 +31,6 @@ contract DeployMockStateBridge is Script {
worldIDIdentityManagerAddress =
abi.decode(vm.parseJson(json, ".worldIDIdentityManagerAddress"), (address));
opWorldIDAddress = abi.decode(vm.parseJson(json, ".optimismWorldIDAddress"), (address));
polygonWorldIDAddress = abi.decode(vm.parseJson(json, ".polygonWorldIDAddress"), (address));
}

function run() public {
Expand Down

0 comments on commit 566898c

Please sign in to comment.