Skip to content

Commit

Permalink
add support for zkevm
Browse files Browse the repository at this point in the history
  • Loading branch information
jfschwarz committed Oct 9, 2024
1 parent a71a487 commit d76148b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 9 deletions.
6 changes: 6 additions & 0 deletions packages/deployments/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export const chains = {
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-polygon/v2.2.3",
},
[1101]: {
name: "zkevm",
prefix: "zkevm",
subgraph:
"https://api.studio.thegraph.com/query/23167/zodiac-roles-zkevm/v2.2.3",
},
[42161]: {
name: "arbitrumOne",
prefix: "arb1",
Expand Down
14 changes: 11 additions & 3 deletions packages/evm/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const {
POLYGONSCAN_API_KEY,
ARBISCAN_API_KEY,
SNOWTRACE_API_KEY,
ZKEVM_POLYGONSCAN_API_KEY
ZKEVM_POLYGONSCAN_API_KEY,
} = process.env;

const sharedNetworkConfig: HttpNetworkUserConfig = {};
Expand Down Expand Up @@ -102,7 +102,7 @@ const config: HardhatUserConfig = {
chainId: 43114,
url: "https://rpc.ankr.com/avalanche",
},
zkEVM: {
zkevm: {
...sharedNetworkConfig,
chainId: 1101,
url: "https://zkevm-rpc.com",
Expand All @@ -117,7 +117,7 @@ const config: HardhatUserConfig = {
matic: POLYGONSCAN_API_KEY,
arbitrum: ARBISCAN_API_KEY,
avalanche: SNOWTRACE_API_KEY,
zkEVM: ZKEVM_POLYGONSCAN_API_KEY
zkevm: ZKEVM_POLYGONSCAN_API_KEY,
} as Record<string, string>,
customChains: [
{
Expand Down Expand Up @@ -160,6 +160,14 @@ const config: HardhatUserConfig = {
browserURL: "https://www.snowtrace.io",
},
},
{
network: "zkevm",
chainId: 1101,
urls: {
apiURL: "https://api-zkevm.polygonscan.com/api",
browserURL: "https://zkevm.polygonscan.com",
},
},
],
},
gasReporter: {
Expand Down
13 changes: 9 additions & 4 deletions packages/evm/tasks/verify-mastercopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ task(
)
.addOptionalParam(
"contractVersion",
"Filters by a specific version or lateat",
"Specify a specific version",
"latest", // Default value
types.string
)
.setAction(async ({ contractVersion }, hre) => {
if (!ETHERSCAN_API_KEY) {
throw new Error("Missing ENV ETHERSCAN_API_KEY");
const apiKey = (hre.config.etherscan.apiKey as any)[hre.network.name] as
| string
| undefined;
if (!apiKey) {
throw new Error(
"Missing etherscan api key for network " + hre.network.name
);
}

const chainId = String((await hre.ethers.provider.getNetwork()).chainId);
Expand All @@ -24,7 +29,7 @@ task(
const { noop } = await verifyMastercopy({
artifact,
apiUrlOrChainId: chainId,
apiKey: ETHERSCAN_API_KEY,
apiKey: apiKey,
});

const { contractName, contractVersion, address } = artifact;
Expand Down
1 change: 1 addition & 0 deletions packages/subgraph/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ SUBGRAPH_AVALANCHE=zodiac-roles-avalanche
SUBGRAPH_BSC=zodiac-roles-bsc
SUBGRAPH_OPTIMISM=zodiac-roles-optimism
SUBGRAPH_POLYGON=zodiac-roles-polygon
SUBGRAPH_ZKEVM=zodiac-roles-zkevm
SUBGRAPH_BASE=zodiac-roles-base
4 changes: 4 additions & 0 deletions packages/subgraph/networks/polygon-zkevm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"network": "polygon-zkevm",
"startBlock": 16677236
}
6 changes: 4 additions & 2 deletions packages/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"deploy:optimism": "yarn prepare:optimism && bash -c 'source .env || true && graph deploy --studio $SUBGRAPH_OPTIMISM'",
"deploy:base": "yarn prepare:base && bash -c 'source .env || true && graph deploy --studio $SUBGRAPH_BASE'",
"deploy:polygon": "yarn prepare:polygon && bash -c 'source .env || true && graph deploy --studio $SUBGRAPH_POLYGON'",
"deploy:zkevm": "yarn prepare:zkevm && bash -c 'source .env || true && graph deploy --studio $SUBGRAPH_ZKEVM'",
"prepare:mainnet": "mustache networks/mainnet.json subgraph.template.yaml > subgraph.yaml",
"prepare:sepolia": "mustache networks/sepolia.json subgraph.template.yaml > subgraph.yaml",
"prepare:gnosis": "mustache networks/gnosis.json subgraph.template.yaml > subgraph.yaml",
Expand All @@ -25,7 +26,8 @@
"prepare:bsc": "mustache networks/bsc.json subgraph.template.yaml > subgraph.yaml",
"prepare:optimism": "mustache networks/optimism.json subgraph.template.yaml > subgraph.yaml",
"prepare:base": "mustache networks/base.json subgraph.template.yaml > subgraph.yaml",
"prepare:polygon": "mustache networks/polygon.json subgraph.template.yaml > subgraph.yaml"
"prepare:polygon": "mustache networks/polygon.json subgraph.template.yaml > subgraph.yaml",
"prepare:zkevm": "mustache networks/polygon-zkevm.json subgraph.template.yaml > subgraph.yaml"
},
"devDependencies": {
"mustache": "^4.2.0",
Expand All @@ -39,4 +41,4 @@
"installConfig": {
"hoistingLimits": "workspaces"
}
}
}

0 comments on commit d76148b

Please sign in to comment.