Skip to content

Commit

Permalink
feat: geist deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
arthcp committed Oct 30, 2024
1 parent 177677c commit 52ef9c1
Show file tree
Hide file tree
Showing 26 changed files with 140 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ XLAYER_RPC=' '
MANTA_PACIFIC_RPC=' '

OPBNB_RPC=' '

GEIST_RPC=' '
43 changes: 43 additions & 0 deletions deployments/prod_addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,18 @@
"switchboard": "0xeF7C79DF9c9AA6BC5d1d4ae308907e9B6a6B4372"
}
},
"63157": {
"FAST": {
"capacitor": "0x4785721D150482ccC651A3dF5B02c237134dcbf7",
"decapacitor": "0xfE41B1A4dB563BcA56A959706505D007E27FE672",
"switchboard": "0x33918BBF9f5269d90b8c0AbF1Fd1134C827bA445"
},
"OPTIMISTIC": {
"capacitor": "0xa197F227283f2F7ffD3b8EF132FCEb582C6033Fa",
"decapacitor": "0x672936478a49567Dc1Ccb0d5d02eEBC9F52bCC72",
"switchboard": "0xeF7C79DF9c9AA6BC5d1d4ae308907e9B6a6B4372"
}
},
"81457": {
"FAST": {
"capacitor": "0x8a0f43439b49F39cA4bBF63B6eBB117aF1Ed7566",
Expand Down Expand Up @@ -4150,6 +4162,37 @@
}
}
},
"63157": {
"SignatureVerifier": "0x941f0ef5258604Fe10C76AE3858984CE0452b5f2",
"Hasher": "0xFe9DCb3dAba382f46F2Ce69ddEb3b5Df86d96f04",
"CapacitorFactory": "0x5C4186D343EeF952c9ED886E45F8243edf0A503F",
"Socket": "0x34464194a4aCD38F42060D144BF3729F625Ff047",
"ExecutionManagerDF": "0xD3B7bd2A9973b188E096dceCbB3D72FC5649FF56",
"TransmitManager": "0xe1e0d782E3b4985f1d657f77B683897AeA6b7dC9",
"FastSwitchboard": "0xEf3589Fb5CE7a5BfB01BF4F1e35a198BA7F6dF4E",
"OptimisticSwitchboard": "0x06638c0799638d64c9AfbB132f94c451A35C7c09",
"SocketBatcher": "0xc9a998F24DBa0C38293fe0418fcEaE28CD0A403E",
"Counter": "0x2CAd2eCe3A78eF1Ef6ec2E0E43E264dcBEd7E8B0",
"SocketSimulator": "0x22891c72dE565d884Dfd762B8df7C4632888a93A",
"SimulatorUtils": "0xB81598BdD2851F223625Ed2C677ccaBD8049b323",
"SwitchboardSimulator": "0x08c3e46CDbE16993d034e0BA87fD9C0dEF08F477",
"CapacitorSimulator": "0xD02F5a7a682d83504e163FCa62A66ee19B5C2AD9",
"startBlock": 70,
"integrations": {
"137": {
"FAST": {
"capacitor": "0x862ccDd5AC90d3A9CCcEE4672Cb49A343c6A5B73",
"decapacitor": "0x71e65941E04da2A88F4C0716F5cde8Af8317d94d",
"switchboard": "0xEf3589Fb5CE7a5BfB01BF4F1e35a198BA7F6dF4E"
},
"OPTIMISTIC": {
"capacitor": "0xB40C51F025D330219811A502B6ADEdaaC9d757F7",
"decapacitor": "0xCb97B4BD183413d34406fE29277D7AAfFFDd9040",
"switchboard": "0x06638c0799638d64c9AfbB132f94c451A35C7c09"
}
}
}
},
"80008": {
"SignatureVerifier": "0x2b42AFFD4b7C14d9B7C2579229495c052672Ccd3",
"Hasher": "0x8537307810fC40F4073A12a38554D4Ff78EfFf41",
Expand Down
20 changes: 20 additions & 0 deletions deployments/prod_verification.json
Original file line number Diff line number Diff line change
Expand Up @@ -4266,6 +4266,26 @@
["0x5fD7D0d6b91CC4787Bcb86ca47e0Bd4ea0346d34"]
]
],
"63157": [
[
"0x22891c72dE565d884Dfd762B8df7C4632888a93A",
"SocketSimulator",
"contracts/mocks/fee-updater/SocketSimulator.sol",
[
63157,
63157,
"0xFe9DCb3dAba382f46F2Ce69ddEb3b5Df86d96f04",
"0x941f0ef5258604Fe10C76AE3858984CE0452b5f2",
"IMLI"
]
],
[
"0x5C4186D343EeF952c9ED886E45F8243edf0A503F",
"CapacitorFactory",
"contracts/CapacitorFactory.sol",
["0x44A44837894B5eDC2Bde64567FC62599b3b88F4C", 10]
]
],
"80001": [
[
"0x1F0F1FC746fcd4d59b6dBDDFf67a88cde70dAeE5",
Expand Down
10 changes: 10 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ if (isProduction) {
[HardhatChainName.AVALANCHE]: getChainConfig(ChainSlug.AVALANCHE),
[HardhatChainName.MANTA_PACIFIC]: getChainConfig(ChainSlug.MANTA_PACIFIC),
[HardhatChainName.OPBNB]: getChainConfig(ChainSlug.OPBNB),
[HardhatChainName.GEIST]: getChainConfig(ChainSlug.GEIST),
};
}

Expand Down Expand Up @@ -169,6 +170,7 @@ const config: HardhatUserConfig = {
avalanche: process.env.SNOWTRACE_API_KEY || "",
manta_pacific: process.env.MANTA_PACIFIC_API_KEY || "none",
opbnb: process.env.OPBNB_API_KEY || "none",
geist: process.env.GEIST_API_KEY || "none",
},
customChains: [
{
Expand Down Expand Up @@ -323,6 +325,14 @@ const config: HardhatUserConfig = {
browserURL: "https://opbnb.bscscan.com/",
},
},
{
network: "geist",
chainId: ChainId.GEIST,
urls: {
apiURL: "https://geist-mainnet.explorer.alchemy.com/api",
browserURL: "https://geist-mainnet.explorer.alchemy.com/",
},
},
],
},
networks: {
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.31.0",
"version": "2.32.0",
"description": "Smart contracts for socket data layer.",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
Expand Down
25 changes: 20 additions & 5 deletions scripts/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,47 @@ const main = async () => {
value: chain,
}));

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

const chains = [...configResponse.chains];
const chains = chainsResponse.chains;
const siblings = chainsResponse.siblings;
const allChains = [...chains, ...siblings];
let addresses: DeploymentAddresses = await deployForChains(
chains,
allChains,
executionManagerVersion
);

if (chains.length === 0) {
console.log("No siblings selected!");
return;
}
await configureRoles(addresses, chains, true, executionManagerVersion);
await configureRoles(
addresses,
chains,
siblings,
true,
executionManagerVersion
);
addresses = await configureSwitchboards(
addresses,
chains,
siblings,
executionManagerVersion
);
await connectPlugs(addresses, chains);
await connectPlugs(addresses, chains, siblings);
} catch (error) {
console.log("Error:", error);
}
Expand Down
13 changes: 7 additions & 6 deletions scripts/deploy/scripts/configureRoles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const newRoleStatus = true;
export const configureRoles = async (
addresses: DeploymentAddresses,
chains: ChainSlug[],
siblings: ChainSlug[],
sendTransaction: boolean,
executionManagerVersion: CORE_CONTRACTS
) => {
Expand Down Expand Up @@ -60,7 +61,7 @@ export const configureRoles = async (
],
contractName: executionManagerVersion,
filterChains: chains,
filterSiblingChains: chains,
filterSiblingChains: siblings,
sendTransaction,
newRoleStatus,
},
Expand Down Expand Up @@ -90,7 +91,7 @@ export const configureRoles = async (
],
contractName: CORE_CONTRACTS.TransmitManager,
filterChains: chains,
filterSiblingChains: chains,
filterSiblingChains: siblings,
sendTransaction,
newRoleStatus,
},
Expand All @@ -111,7 +112,7 @@ export const configureRoles = async (
],
contractName: CORE_CONTRACTS.Socket,
filterChains: chains,
filterSiblingChains: chains,
filterSiblingChains: siblings,
sendTransaction,
newRoleStatus,
},
Expand Down Expand Up @@ -152,7 +153,7 @@ export const configureRoles = async (

contractName: CORE_CONTRACTS.FastSwitchboard,
filterChains: chains,
filterSiblingChains: chains,
filterSiblingChains: siblings,
sendTransaction,
newRoleStatus,
},
Expand Down Expand Up @@ -191,7 +192,7 @@ export const configureRoles = async (
],
contractName: CORE_CONTRACTS.OptimisticSwitchboard,
filterChains: chains,
filterSiblingChains: chains,
filterSiblingChains: siblings,
sendTransaction,
newRoleStatus,
},
Expand Down Expand Up @@ -227,7 +228,7 @@ export const configureRoles = async (
],
contractName: CORE_CONTRACTS.NativeSwitchboard,
filterChains: chains,
filterSiblingChains: chains,
filterSiblingChains: siblings,
sendTransaction,
newRoleStatus,
},
Expand Down
17 changes: 9 additions & 8 deletions scripts/deploy/scripts/configureSwitchboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
export const configureSwitchboards = async (
addresses: DeploymentAddresses,
chains: ChainSlug[],
siblings: ChainSlug[],
executionManagerVersion: CORE_CONTRACTS
) => {
try {
Expand All @@ -42,25 +43,25 @@ export const configureSwitchboards = async (

let addr: ChainSocketAddresses = addresses[chain]!;

const list = isTestnet(chain) ? TestnetIds : MainnetIds;
const siblingSlugs: ChainSlug[] = list.filter(
(chainSlug) => chainSlug !== chain && chains.includes(chainSlug)
);
// const list = isTestnet(chain) ? TestnetIds : MainnetIds;
// const siblingSlugs: ChainSlug[] = list.filter(
// (chainSlug) => chainSlug !== chain && chains.includes(chainSlug)
// );

await configureExecutionManager(
executionManagerVersion,
addr[executionManagerVersion]!,
addr[CORE_CONTRACTS.SocketBatcher],
chain,
siblingSlugs,
siblings,
socketSigner
);

await setManagers(addr, socketSigner, executionManagerVersion);

const integrations = addr["integrations"] ?? {};
const integrationList = Object.keys(integrations).filter((chain) =>
chains.includes(parseInt(chain) as ChainSlug)
siblings.includes(parseInt(chain) as ChainSlug)
);

console.log(`Configuring for ${chain}`);
Expand Down Expand Up @@ -91,7 +92,7 @@ export const configureSwitchboards = async (

addr = await registerSwitchboards(
chain,
siblingSlugs,
siblings,
CORE_CONTRACTS.FastSwitchboard,
IntegrationTypes.fast,
addr,
Expand All @@ -101,7 +102,7 @@ export const configureSwitchboards = async (

addr = await registerSwitchboards(
chain,
siblingSlugs,
siblings,
CORE_CONTRACTS.OptimisticSwitchboard,
IntegrationTypes.optimistic,
addr,
Expand Down
23 changes: 12 additions & 11 deletions scripts/deploy/scripts/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import { overrides } from "../config/config";

export const connectPlugs = async (
addresses: DeploymentAddresses,
chains: ChainSlug[]
chains: ChainSlug[],
siblings: ChainSlug[]
) => {
try {
await Promise.all(
Expand All @@ -34,15 +35,15 @@ export const connectPlugs = async (
const addr: ChainSocketAddresses = addresses[chain]!;
if (!addr["integrations"]) return;

const list = isTestnet(chain) ? TestnetIds : MainnetIds;
const siblingSlugs: ChainSlug[] = list.filter(
(chainSlug) =>
chainSlug !== chain &&
addresses?.[chainSlug]?.["Counter"] &&
chains.includes(chainSlug)
);
// const list = isTestnet(chain) ? TestnetIds : MainnetIds;
// const siblingSlugs: ChainSlug[] = list.filter(
// (chainSlug) =>
// chainSlug !== chain &&
// addresses?.[chainSlug]?.["Counter"] &&
// chains.includes(chainSlug)
// );

const siblingIntegrationtype: IntegrationTypes[] = siblingSlugs.map(
const siblingIntegrationtype: IntegrationTypes[] = siblings.map(
(chainSlug) => {
return getDefaultIntegrationType(chain, chainSlug);
}
Expand All @@ -58,8 +59,8 @@ export const connectPlugs = async (
await getInstance("Socket", addr["Socket"])
).connect(socketSigner);

for (let index = 0; index < siblingSlugs.length; index++) {
const sibling = siblingSlugs[index];
for (let index = 0; index < siblings.length; index++) {
const sibling = siblings[index];
const siblingCounter = addresses?.[sibling]?.["Counter"];
let switchboard;
try {
Expand Down
1 change: 1 addition & 0 deletions scripts/rpcConfig/constants/batcherSupportedChainSlug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ export const batcherSupportedChainSlugs = [
ChainSlug.XLAYER,
ChainSlug.MANTA_PACIFIC,
ChainSlug.OPBNB,
ChainSlug.GEIST,
];
1 change: 1 addition & 0 deletions scripts/rpcConfig/constants/explorers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ export const explorers = {
[ChainSlug.XLAYER]: "https://www.okx.com/web3/explorer/xlayer",
[ChainSlug.MANTA_PACIFIC]: "https://pacific-explorer.manta.network/",
[ChainSlug.OPBNB]: "https://opbnb.bscscan.com/",
[ChainSlug.GEIST]: "https://geist-mainnet.explorer.alchemy.com/",
};
1 change: 1 addition & 0 deletions scripts/rpcConfig/constants/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export const icons = {
[ChainSlug.XLAYER]: "",
[ChainSlug.MANTA_PACIFIC]: "",
[ChainSlug.OPBNB]: "",
[ChainSlug.GEIST]: "",
};
1 change: 1 addition & 0 deletions scripts/rpcConfig/constants/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ export const rpcs = {
[ChainSlug.XLAYER]: checkEnvValue("XLAYER_RPC"),
[ChainSlug.MANTA_PACIFIC]: checkEnvValue("MANTA_PACIFIC_RPC"),
[ChainSlug.OPBNB]: checkEnvValue("OPBNB_RPC"),
[ChainSlug.GEIST]: checkEnvValue("GEIST_RPC"),
};
2 changes: 1 addition & 1 deletion scripts/rpcConfig/constants/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { DeploymentMode } from "../../../src";

export const version = {
[DeploymentMode.DEV]: "1.0.5",
[DeploymentMode.PROD]: "1.0.61",
[DeploymentMode.PROD]: "1.0.65",
};
2 changes: 0 additions & 2 deletions scripts/rpcConfig/rpcConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ const getOldEMVersionChainSlugs = (): ChainSlug[] => {
if (!chainAddress.ExecutionManagerDF)
chains.push(parseInt(chain) as ChainSlug);
});

console.log(chains);
} catch (error) {
return [] as ChainSlug[];
}
Expand Down
1 change: 1 addition & 0 deletions src/enums/arbChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const arbChains = [
ChainSlug.PARALLEL,
ChainSlug.REYA_CRONOS,
ChainSlug.REYA,
ChainSlug.GEIST,
];
1 change: 1 addition & 0 deletions src/enums/chainId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ export enum ChainId {
XLAYER = 196,
MANTA_PACIFIC = 169,
OPBNB = 204,
GEIST = 63157,
}
Loading

0 comments on commit 52ef9c1

Please sign in to comment.