Skip to content

Commit

Permalink
fix: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ameeshaagrawal committed Jun 25, 2024
1 parent 9dad292 commit 0ede188
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 64 deletions.
24 changes: 3 additions & 21 deletions scripts/deploy/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,6 @@ export const overrides = (
gasLimit: 4_000_000,
gasPrice: 30_000_000_000,
};
} else if (chain == ChainSlug.GOERLI) {
return {
type,
gasLimit: 3_000_000,
gasPrice,
};
} else if (chain == ChainSlug.POLYGON_MAINNET) {
return {
type,
Expand All @@ -186,9 +180,9 @@ export const overrides = (
};
} else if (chain == ChainSlug.SEPOLIA) {
return {
// type,
// gasLimit: 2_000_000,
// gasPrice: 250_000_000_000,
// type: 1,
gasLimit: 2_000_000,
// gasPrice: 180_000_000_000,
};
} else if (chain == ChainSlug.AEVO_TESTNET) {
return {
Expand All @@ -214,12 +208,6 @@ export const overrides = (
// gasLimit,
// gasPrice: 100_000_000,
};
} else if (chain == ChainSlug.XAI_TESTNET) {
return {
// type: 1,
// gasLimit,
// gasPrice: 100_000_000,
};
} else if (chain == ChainSlug.SX_NETWORK_TESTNET) {
return {
// type: 1,
Expand All @@ -244,12 +232,6 @@ export const overrides = (
gasLimit: 500_000_000,
gasPrice: 1_000_000,
};
} else if (chain == ChainSlug.VICTION_TESTNET) {
return {
// type: 1,
// gasLimit,
// gasPrice: 100_000_000,
};
} else if (chain == ChainSlug.HOOK) {
return {
// type: 1,
Expand Down
86 changes: 43 additions & 43 deletions scripts/deploy/em-migration/migrate-em.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require("dotenv").config();
import {
CORE_CONTRACTS,
ChainSlug,
DeploymentAddresses,
DeploymentMode,
MainnetIds,
Expand All @@ -15,43 +16,8 @@ import prompts from "prompts";
const deploymentMode = process.env.DEPLOYMENT_MODE as DeploymentMode;
const emVersion = CORE_CONTRACTS.ExecutionManagerDF;

const deploy = async () => {
const deploy = async (chains: ChainSlug[]) => {
try {
const response = await prompts([
{
name: "chainType",
type: "select",
message: "Select chains network type",
choices: [
{
title: "Mainnet",
value: "mainnet",
},
{
title: "Testnet",
value: "testnet",
},
],
},
]);

const chainOptions =
response.chainType === "mainnet" ? MainnetIds : TestnetIds;
let choices = chainOptions.map((chain) => ({
title: chain.toString(),
value: chain,
}));

const configResponse = await prompts([
{
name: "chains",
type: "multiselect",
message: "Select sibling chains to connect",
choices,
},
]);

const chains = [...configResponse.chains];
const addresses: DeploymentAddresses = await deployForChains(
chains,
emVersion
Expand All @@ -62,12 +28,13 @@ const deploy = async () => {
}
};

const configure = async () => {
const configure = async (chains: ChainSlug[]) => {
try {
let addresses: DeploymentAddresses = getAllAddresses(deploymentMode);
const chains = [...MainnetIds, ...TestnetIds];

addresses = await configureSwitchboards(addresses, chains, emVersion);
const addresses: DeploymentAddresses = await deployForChains(
chains,
emVersion
);
await configureSwitchboards(addresses, chains, emVersion);
} catch (error) {
console.log("Error:", error);
}
Expand All @@ -90,14 +57,47 @@ const main = async () => {
},
],
},
{
name: "chainType",
type: "select",
message: "Select chains network type",
choices: [
{
title: "Mainnet",
value: "mainnet",
},
{
title: "Testnet",
value: "testnet",
},
],
},
]);

const chainOptions =
response.chainType === "mainnet" ? MainnetIds : TestnetIds;
let choices = chainOptions.map((chain) => ({
title: chain.toString(),
value: chain,
}));

const configResponse = await prompts([
{
name: "chains",
type: "multiselect",
message: "Select sibling chains to connect",
choices,
},
]);

const chains = [...configResponse.chains];

switch (response.action) {
case "configure":
await configure();
await configure(chains);
break;
case "deploy":
await deploy();
await deploy(chains);
break;
case "exit":
process.exit(0);
Expand Down

0 comments on commit 0ede188

Please sign in to comment.