Skip to content

Commit

Permalink
Merge pull request #343 from SocketDotTech/dev-deploy
Browse files Browse the repository at this point in the history
Dev deployments
  • Loading branch information
arthcp authored Dec 4, 2023
2 parents 8e23396 + a4adb8c commit 2b5d745
Show file tree
Hide file tree
Showing 9 changed files with 548 additions and 915 deletions.
847 changes: 148 additions & 699 deletions deployments/dev_addresses.json

Large diffs are not rendered by default.

514 changes: 343 additions & 171 deletions deployments/dev_verification.json

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ if (isProduction) {
liveNetworks = {
[HardhatChainName.ARBITRUM_GOERLI]: getChainConfig(ChainId.ARBITRUM_GOERLI),
[HardhatChainName.OPTIMISM_GOERLI]: getChainConfig(ChainId.OPTIMISM_GOERLI),
[HardhatChainName.ARBITRUM_SEPOLIA]: getChainConfig(
ChainId.ARBITRUM_SEPOLIA
),
[HardhatChainName.OPTIMISM_SEPOLIA]: getChainConfig(
ChainId.OPTIMISM_SEPOLIA
),
[HardhatChainName.POLYGON_MAINNET]: getChainConfig(ChainId.POLYGON_MAINNET),
[HardhatChainName.ARBITRUM]: getChainConfig(ChainId.ARBITRUM),
[HardhatChainName.BSC]: getChainConfig(ChainId.BSC),
Expand Down Expand Up @@ -100,18 +106,18 @@ const config: HardhatUserConfig = {
customChains: [
{
network: "optimisticTestnet",
chainId: ChainId.OPTIMISM_GOERLI,
chainId: ChainId.OPTIMISM_SEPOLIA,
urls: {
apiURL: "https://api-goerli-optimistic.etherscan.io/api",
browserURL: "https://goerli-optimism.etherscan.io/",
apiURL: "https://api-sepolia-optimistic.etherscan.io/api",
browserURL: "https://sepolia-optimism.etherscan.io/",
},
},
{
network: "arbitrumTestnet",
chainId: ChainId.ARBITRUM_GOERLI,
chainId: ChainId.ARBITRUM_SEPOLIA,
urls: {
apiURL: "https://api-goerli.arbiscan.io/api",
browserURL: "https://goerli.arbiscan.io/",
apiURL: "https://api-sepolia.arbiscan.io/api",
browserURL: "https://sepolia.arbiscan.io/",
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@socket.tech/dl-core",
"license": "UNLICENSED",
"version": "2.4.13",
"version": "2.4.13.test-0",
"description": "Smart contracts for socket data layer.",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
Expand Down
10 changes: 10 additions & 0 deletions scripts/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ export function getJsonRpcUrl(chain: HardhatChainName | ChainId): string {
jsonRpcUrl = "http://127.0.0.1:8545/";
break;

case HardhatChainName.OPTIMISM_SEPOLIA:
case ChainId.OPTIMISM_SEPOLIA:
jsonRpcUrl = process.env.OPTIMISM_SEPOLIA_RPC as string;
break;

case HardhatChainName.ARBITRUM_SEPOLIA:
case ChainId.ARBITRUM_SEPOLIA:
jsonRpcUrl = process.env.ARBITRUM_SEPOLIA_RPC as string;
break;

default:
if (process.env.NEW_RPC) {
jsonRpcUrl = process.env.NEW_RPC as string;
Expand Down
47 changes: 24 additions & 23 deletions scripts/deploy/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ console.log(
);

export const chains: Array<ChainSlug> = [
ChainSlug.GOERLI,
// ChainSlug.GOERLI,
ChainSlug.ARBITRUM_SEPOLIA,
ChainSlug.OPTIMISM_SEPOLIA,
ChainSlug.POLYGON_MUMBAI,
ChainSlug.SX_NETWORK_TESTNET,
ChainSlug.BSC_TESTNET,
ChainSlug.AEVO_TESTNET,
ChainSlug.LYRA_TESTNET,
// ChainSlug.SX_NETWORK_TESTNET,
// ChainSlug.BSC_TESTNET,
// ChainSlug.AEVO_TESTNET,
// ChainSlug.LYRA_TESTNET,
ChainSlug.SEPOLIA,
ChainSlug.XAI_TESTNET,
ChainSlug.CDK_TESTNET,
ChainSlug.AEVO,
ChainSlug.MAINNET,
ChainSlug.ARBITRUM,
ChainSlug.OPTIMISM,
ChainSlug.LYRA,
ChainSlug.BSC,
ChainSlug.POLYGON_MAINNET,
// ChainSlug.XAI_TESTNET,
// ChainSlug.CDK_TESTNET,
// ChainSlug.AEVO,
// ChainSlug.MAINNET,
// ChainSlug.ARBITRUM,
// ChainSlug.OPTIMISM,
// ChainSlug.LYRA,
// ChainSlug.BSC,
// ChainSlug.POLYGON_MAINNET,
];

export const executionManagerVersion = CORE_CONTRACTS.ExecutionManager;
Expand Down Expand Up @@ -84,7 +84,8 @@ export const watcherAddresses = {
};

export const executorAddresses = {
[DeploymentMode.DEV]: "0x8e90345042b2720F33138CC437f8f897AC84A095",
// [DeploymentMode.DEV]: "0x8e90345042b2720F33138CC437f8f897AC84A095", // private key
[DeploymentMode.DEV]: "0x5ea69806b1df5dbdc6c1a78c662682ca48f9524d", // kms
[DeploymentMode.SURGE]: "0x3051Aa7F267bF425A4e8bF766750D60391F014B4",
[DeploymentMode.PROD]: "0x42639d8fd154b72472e149a7d5ac13fa280303d9",
};
Expand All @@ -102,10 +103,10 @@ export const overrides = (
gasLimit: 20_000_000,
gasPrice,
};
} else if (chain == ChainSlug.ARBITRUM_GOERLI) {
} else if (chain == ChainSlug.ARBITRUM_SEPOLIA) {
return {
// type,
// gasLimit: 20_000_000,
// gasLimit,
// gasPrice,
};
} else if (chain == ChainSlug.OPTIMISM) {
Expand All @@ -114,10 +115,10 @@ export const overrides = (
gasLimit: 2_000_000,
gasPrice,
};
} else if (chain == ChainSlug.OPTIMISM_GOERLI) {
} else if (chain == ChainSlug.OPTIMISM_SEPOLIA) {
return {
// type,
// gasLimit: 20_000_000,
// gasLimit,
// gasPrice,
};
} else if (chain == ChainSlug.BSC) {
Expand Down Expand Up @@ -152,15 +153,15 @@ export const overrides = (
};
} else if (chain == ChainSlug.POLYGON_MUMBAI) {
return {
type: 0,
gasLimit: 2_000_000,
gasPrice,
type: 1,
gasLimit: 3000000,
gasPrice: 10_000_000_000,
};
} else if (chain == ChainSlug.SEPOLIA) {
return {
type,
gasLimit,
gasPrice,
gasPrice: 1_000_000_000,
};
} else if (chain == ChainSlug.AEVO_TESTNET) {
return {
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/scripts/configureSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const configureExecutionManager = async (
requests,
{ ...overrides(chain) }
);
console.log(chain, tx.hash);
console.log("configured EM for ", chain, tx.hash);
await tx.wait();
} catch (error) {
console.log("error while configuring execution manager: ", error);
Expand Down
16 changes: 4 additions & 12 deletions scripts/deploy/scripts/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
getAddresses,
} from "../../../src";
import { getRoleHash, getChainRoleHash, getInstance } from "../utils";
import { Contract, Wallet, ethers } from "ethers";
import { Wallet, ethers } from "ethers";
import { getProviderFromChainSlug } from "../../constants";
import { filterChains, mode } from "../config";
import { overrides } from "../config";
Expand Down Expand Up @@ -217,7 +217,6 @@ export const checkNativeSwitchboardRoles = async ({
newRoleStatus: boolean;
}) => {
let contractName = CORE_CONTRACTS.NativeSwitchboard;

await Promise.all(
siblingSlugs.map(async (siblingSlug) => {
if (filterChains.length > 0 && !filterChains.includes(siblingSlug))
Expand All @@ -237,9 +236,9 @@ export const checkNativeSwitchboardRoles = async ({
// );
return;
}
let instance = (await getInstance(contractName, contractAddress)).connect(
provider
);
let instance = (
await getInstance("OptimismSwitchboard", contractAddress)
).connect(provider);
let requiredRoles =
REQUIRED_ROLES[contractName as keyof typeof REQUIRED_ROLES];

Expand Down Expand Up @@ -303,13 +302,6 @@ export const checkAndUpdateRoles = async (

let siblingSlugs = getSiblingSlugs(chainSlug);

// console.log(chainSlug, " Sibling Slugs: ", siblingSlugs);

// console.log(
// "============= checking for network: ",
// ChainSlugToKey(chainSlug),
// "================="
// );
let addresses: ChainSocketAddresses | undefined;
try {
addresses = await getAddresses(chainSlug, mode);
Expand Down
7 changes: 5 additions & 2 deletions scripts/deploy/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,22 @@ export const verify = async (
contractName: string,
path: string,
args: any[]
) => {
): Promise<boolean> => {
try {
const chainSlug = await getChainSlug();
if (chainSlug === 31337) return;
if (chainSlug === 31337) return true;

await run("verify:verify", {
address,
contract: `${path}:${contractName}`,
constructorArguments: args,
});
return true;
} catch (error) {
console.log("Error during verification", error);
}

return false;
};

export const sleep = (delay: number) =>
Expand Down

0 comments on commit 2b5d745

Please sign in to comment.