Skip to content

Commit

Permalink
Add sei
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Jul 30, 2024
1 parent 2a09478 commit e8d86e6
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 26 deletions.
22 changes: 22 additions & 0 deletions data/config/rpc-limitations.json
Original file line number Diff line number Diff line change
Expand Up @@ -1634,5 +1634,27 @@
"eth_getTransactionReceipt": 1
}
}
},
"sei": {
"https://evm-rpc.sei-apis.com": {
"restrictToMode": null,
"isArchiveNode": true,
"minDelayBetweenCalls": 1000,
"maxGetLogsBlockSpan": 5000,
"maxGetLogsAddressBatchSize": 30,
"internalTimeoutMs": null,
"stateChangeReadsOnSameBlock": true,
"canUseMulticallBlockTimestamp": true,
"disableBatching": false,
"disableRpc": false,
"weight": null,
"methods": {
"eth_getLogs": 50,
"eth_call": 50,
"eth_getBlockByNumber": 10,
"eth_blockNumber": 10,
"eth_getTransactionReceipt": 10
}
}
}
}
14 changes: 7 additions & 7 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,19 @@ services:
<<: *importer
environment:
<<: *importer-env
WORK_CMD: "./dist/src/script/run.js beefy:run -t historical-prices -c arbitrum -c avax -c base -c bsc -c canto -c cronos -c ethereum -c fantom -c fraxtal -c fuse -c gnosis -c kava -c linea -c manta -c mantle -c metis -c mode -c moonbeam -c moonriver -c optimism -c polygon -c real -c rollux -c scroll -c zkevm -c zksync -e false -S live -l 1hour"
WORK_CMD: "./dist/src/script/run.js beefy:run -t historical-prices -c arbitrum -c avax -c base -c bsc -c canto -c cronos -c ethereum -c fantom -c fraxtal -c fuse -c gnosis -c kava -c linea -c manta -c mantle -c metis -c mode -c moonbeam -c moonriver -c optimism -c polygon -c real -c rollux -c scroll -c sei -c zkevm -c zksync -e false -S live -l 1hour"

importer-prices-recent:
<<: *importer
environment:
<<: *importer-env
WORK_CMD: "./dist/src/script/run.js beefy:run -t recent-prices -c arbitrum -c avax -c base -c bsc -c canto -c cronos -c ethereum -c fantom -c fraxtal -c fuse -c gnosis -c kava -c linea -c manta -c mantle -c metis -c mode -c moonbeam -c moonriver -c optimism -c polygon -c real -c rollux -c scroll -c zkevm -c zksync -l 15min"
WORK_CMD: "./dist/src/script/run.js beefy:run -t recent-prices -c arbitrum -c avax -c base -c bsc -c canto -c cronos -c ethereum -c fantom -c fraxtal -c fuse -c gnosis -c kava -c linea -c manta -c mantle -c metis -c mode -c moonbeam -c moonriver -c optimism -c polygon -c real -c rollux -c scroll -c sei -c zkevm -c zksync -l 15min"

importer-historical-product-statistics:
<<: *importer
environment:
<<: *importer-env
WORK_CMD: "./dist/src/script/run.js beefy:run -t historical-product-statistics -e false -c arbitrum -c avax -c base -c bsc -c canto -c cronos -c ethereum -c fantom -c fraxtal -c fuse -c gnosis -c kava -c linea -c manta -c mantle -c metis -c mode -c moonbeam -c moonriver -c optimism -c polygon -c real -c rollux -c scroll -c zkevm -c zksync -l 1day"
WORK_CMD: "./dist/src/script/run.js beefy:run -t historical-product-statistics -e false -c arbitrum -c avax -c base -c bsc -c canto -c cronos -c ethereum -c fantom -c fraxtal -c fuse -c gnosis -c kava -c linea -c manta -c mantle -c metis -c mode -c moonbeam -c moonriver -c optimism -c polygon -c real -c rollux -c scroll -c sei -c zkevm -c zksync -l 1day"

# arbitrum avax base bsc canto cronos ethereum fantom fraxtal fuse kava linea mantle metis mode moonbeam moonriver optimism polygon rollux scroll zkevm zksync

Expand Down Expand Up @@ -290,7 +290,7 @@ services:
<<: *importer
environment:
<<: *importer-env
WORK_CMD: "./dist/src/script/run.js beefy:run -e false -t recent -c fantom -c fraxtal -c gnosis -c polygon -c real -c rollux -c scroll -c zkevm -l 1min"
WORK_CMD: "./dist/src/script/run.js beefy:run -e false -t recent -c fantom -c fraxtal -c gnosis -c polygon -c real -c rollux -c scroll -c sei -c zkevm -l 1min"

# arbitrum avax base bsc canto cronos ethereum fantom fraxtal fuse kava linea mantle metis mode moonbeam moonriver optimism polygon rollux scroll zkevm zksync

Expand Down Expand Up @@ -328,7 +328,7 @@ services:
<<: *importer
environment:
<<: *importer-env
WORK_CMD: "./dist/src/script/run.js beefy:run -e false -t historical -c fantom -c fraxtal -c gnosis -c polygon -c real -c rollux -c scroll -c zkevm -l 15min -S all"
WORK_CMD: "./dist/src/script/run.js beefy:run -e false -t historical -c fantom -c fraxtal -c gnosis -c polygon -c real -c rollux -c scroll -c sei -c zkevm -l 15min -S all"

# arbitrum avax base bsc canto cronos ethereum fantom fraxtal fuse kava linea mantle metis mode moonbeam moonriver optimism polygon rollux scroll zkevm zksync

Expand Down Expand Up @@ -366,7 +366,7 @@ services:
<<: *importer
environment:
<<: *importer-env
WORK_CMD: "./dist/src/script/run.js beefy:run -e false -t historical-share-rate -c fantom -c fraxtal -c gnosis -c polygon -c real -c rollux -c scroll -c zkevm -l 15min -S all"
WORK_CMD: "./dist/src/script/run.js beefy:run -e false -t historical-share-rate -c fantom -c fraxtal -c gnosis -c polygon -c real -c rollux -c scroll -c sei -c zkevm -l 15min -S all"

# arbitrum avax base bsc canto cronos ethereum fantom fraxtal fuse kava linea mantle metis mode moonbeam moonriver optimism polygon rollux scroll zkevm zksync

Expand Down Expand Up @@ -404,4 +404,4 @@ services:
<<: *importer
environment:
<<: *importer-env
WORK_CMD: "./dist/src/script/run.js beefy:run -e false -t recent-share-rate -c fantom -c fraxtal -c gnosis -c polygon -c real -c rollux -c scroll -c zkevm -L 0 -l 15min -S all"
WORK_CMD: "./dist/src/script/run.js beefy:run -e false -t recent-share-rate -c fantom -c fraxtal -c gnosis -c polygon -c real -c rollux -c scroll -c sei -c zkevm -L 0 -l 15min -S all"
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"abstract-cache-redis": "^2.0.0",
"async-lock": "^1.4.0",
"axios": "^1.3.4",
"blockchain-addressbook": "^0.46.205",
"blockchain-addressbook": "^0.46.208",
"decimal.js": "^10.4.3",
"dotenv": "^16.0.3",
"ethereum-multicall": "^2.16.1",
Expand All @@ -77,7 +77,7 @@
"rxjs": "^7.8.0",
"simple-git": "^3.17.0",
"uuid": "^9.0.0",
"viem": "^2.18.1",
"viem": "^2.18.4",
"yargs": "^17.7.1"
}
}
2 changes: 2 additions & 0 deletions src/api/service/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
real,
rollux,
scroll,
sei,
zkSync,
type Chain as ViemChain,
} from "viem/chains";
Expand Down Expand Up @@ -64,6 +65,7 @@ const VIEM_CHAINS: Record<BeefyChain, ViemChain | null> = {
real: real,
rollux: rollux,
scroll: scroll,
sei: sei,
zkevm: polygonZkEvm,
zksync: zkSync,
};
Expand Down
26 changes: 26 additions & 0 deletions src/protocol/common/connector/contract-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ async function getContractCreationInfos(ctx: ImportCtx, contractAddress: string,
return await getFromExplorerCreationInfos(contractAddress, EXPLORER_URLS[chain].url, ETHERSCAN_API_KEY[chain]);
} else if (explorerType === "zksync") {
return await getFromZksyncExplorerApi(contractAddress, EXPLORER_URLS[chain].url);
} else if (explorerType === "seitrace") {
return await getFromSeitraceExplorer(contractAddress, EXPLORER_URLS[chain].url);
} else {
throw new Error("Unsupported explorer type: " + explorerType);
}
Expand Down Expand Up @@ -397,3 +399,27 @@ async function getFromZksyncExplorerApi(contractAddress: string, explorerUrl: st
throw error;
}
}

async function getFromSeitraceExplorer(contractAddress: string, explorerUrl: string) {
var url = explorerUrl + `/pacific-1/gateway/api/v1/addresses/${contractAddress}`;

try {
logger.trace({ msg: "Fetching blockscout transaction link", data: { contractAddress, url } });
const resp = await axios.get(url);

const tx = resp.data.creation_tx_hash;
const trxUrl = `${explorerUrl}/pacific-1/gateway/api/v1/transactions/${tx}`;

const txResp = await axios.get(trxUrl);
const blockNumber = txResp.data.block;
const rawDateStr: string = txResp.data.timestamp;
const datetime = new Date(Date.parse(rawDateStr));

logger.trace({ msg: "Fetched contract creation block", data: { contractAddress, blockNumber, datetime } });
return { blockNumber, datetime };
} catch (error) {
logger.error({ msg: "Error while fetching contract creation block", data: { contractAddress, url, error: error } });
logger.error(error);
throw error;
}
}
1 change: 1 addition & 0 deletions src/script/find-out-rpc-limitations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ async function testRpcLimits(chain: Chain, behaviour: ImportBehaviour, tests: Rp
real: 31054,
rollux: 1, // wsys created on genesis block
scroll: 1, // weth created on genesis block
sei: 79351444, // looks like a precompile, but multicall only exists starting from 79351444
zkevm: 129,
zksync: 9648,
};
Expand Down
2 changes: 2 additions & 0 deletions src/types/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type Chain =
| "real"
| "rollux"
| "scroll"
| "sei"
| "zkevm"
| "zksync";

Expand Down Expand Up @@ -61,6 +62,7 @@ export const allChainIds: Chain[] = [
"real",
"rollux",
"scroll",
"sei",
"zkevm",
"zksync",
];
10 changes: 8 additions & 2 deletions src/utils/addressbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ function getAddressBookTokensConfig(chain: Chain) {
if (addrBookChain in addressbook.addressBook) {
// @ts-ignore
return addressbook.addressBook[addrBookChain].tokens;
} else if (chain === "sei") {
return {
WNATIVE: { address: "0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7", symbol: "SEI" },
};
} else if (chain === "scroll") {
return {
WNATIVE: { address: "0x5300000000000000000000000000000000000004" },
WNATIVE: { address: "0x5300000000000000000000000000000000000004", symbol: "WETH" },
};
} else if (chain === "rollux") {
return {
WNATIVE: { address: "0x4200000000000000000000000000000000000006" },
WNATIVE: { address: "0x4200000000000000000000000000000000000006", symbol: "WSYS" },
};
}

Expand All @@ -34,6 +38,8 @@ export function getChainNetworkId(chain: Chain): number {
if (addrBookChain in addressbook.ChainId) {
// @ts-ignore
return addressbook.ChainId[addrBookChain];
} else if (chain === "sei") {
return 1329;
} else if (chain === "scroll") {
return 534352;
} else if (chain === "rollux") {
Expand Down
9 changes: 8 additions & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ export const RPC_API_URL_KAVA_BEEFY = process.env.RPC_API_URL_KAVA_BEEFY || null
export const RPC_API_URL_FUSE_BEEFY = process.env.RPC_API_URL_FUSE_BEEFY || null;

export const EXPLORER_URLS: {
[chain in Chain]: { type: "etherscan" | "blockscout" | "blockscout-json" | "blockscout-api-v2" | "harmony" | "routescan" | "zksync"; url: string };
[chain in Chain]: {
type: "etherscan" | "blockscout" | "blockscout-json" | "blockscout-api-v2" | "harmony" | "routescan" | "zksync" | "seitrace";
url: string;
};
} = {
arbitrum: { type: "etherscan", url: "https://api.arbiscan.io/api" },
aurora: { type: "etherscan", url: "https://api.aurorascan.dev/api" },
Expand Down Expand Up @@ -97,6 +100,7 @@ export const EXPLORER_URLS: {
real: { type: "blockscout-api-v2", url: "https://explorer.re.al/api/v2" },
rollux: { type: "blockscout-json", url: "https://explorer.rollux.com" },
scroll: { type: "etherscan", url: "https://scrollscan.com" },
sei: { type: "seitrace", url: "https://seitrace.com/" },
zkevm: { type: "etherscan", url: "https://api-zkevm.polygonscan.com/api" },
zksync: { type: "zksync", url: "https://block-explorer-api.mainnet.zksync.io" },
};
Expand Down Expand Up @@ -131,6 +135,7 @@ export const MULTICALL3_ADDRESS_MAP: { [chain in Chain]: { multicallAddress: str
real: { multicallAddress: "0xcA11bde05977b3631167028862bE2a173976CA11", createdAtBlock: 695 },
rollux: { multicallAddress: "0xcA11bde05977b3631167028862bE2a173976CA11", createdAtBlock: 119222 },
scroll: { multicallAddress: "0xcA11bde05977b3631167028862bE2a173976CA11", createdAtBlock: 14 },
sei: { multicallAddress: "0xcA11bde05977b3631167028862bE2a173976CA11", createdAtBlock: 79351444 },
zkevm: { multicallAddress: "0xcA11bde05977b3631167028862bE2a173976CA11", createdAtBlock: 57746 },
zksync: { multicallAddress: "0xF9cda624FBC7e059355ce98a31693d299FACd963", createdAtBlock: 324 },
};
Expand Down Expand Up @@ -171,6 +176,7 @@ export const ETHERSCAN_API_KEY: {
real: _getExplorerApiKey("real"),
rollux: _getExplorerApiKey("rollux"),
scroll: _getExplorerApiKey("scroll"),
sei: _getExplorerApiKey("sei"),
zkevm: _getExplorerApiKey("zkevm"),
zksync: _getExplorerApiKey("zksync"),
};
Expand Down Expand Up @@ -209,6 +215,7 @@ export const MS_PER_BLOCK_ESTIMATE: { [chain in Chain]: number } = {
rollux: 2000,
real: 7706,
scroll: 4000,
sei: 400,
zkevm: 1208,
zksync: 1000,
};
Expand Down

0 comments on commit e8d86e6

Please sign in to comment.