Skip to content

Commit

Permalink
chore(contracts): add scroll to deploy config
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 committed Jun 14, 2024
1 parent 4ab13a2 commit 4b5b0ee
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 2 deletions.
6 changes: 6 additions & 0 deletions contracts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ MNEMONIC=
ETH_ETHERSCAN_API_KEY=
# api key for optimism mainnet etherscan
OPTIMISM_ETHERSCAN_API_KEY=
# api key for scroll etherscan
SCROLL_ETHERSCAN_API_KEY=
# RPC url to talk to optimism mainnet
SEPOLIA_RPC_URL=
# RPC url to talk to optimism sepolia
OP_SEPOLIA_RPC_URL=
# RPC url to talk to scroll mainnet
SCROLL_RPC_URL=
# RPC url to talk to scroll sepolia
SCROLL_SEPOLIA_RPC_URL=
# Forking url for testing
FORKING_URL=
# Gas price to use for transactions
Expand Down
51 changes: 51 additions & 0 deletions contracts/deploy-config-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,56 @@
"coordinatorPubkey": "macipk.9a59264310d95cfd8eb7083aebeba221b5c26e77427f12b7c0f50bc1cc35e621",
"useQuadraticVoting": true
}
},
"scroll_sepolia": {
"ConstantInitialVoiceCreditProxy": {
"deploy": true,
"amount": 99
},
"FreeForAllGatekeeper": {
"deploy": false
},
"EASGatekeeper": {
"deploy": false,
"easAddress": "0xaEF4103A04090071165F78D45D83A0C0782c2B2a",
"schema": "0xe2636f31239f7948afdd9a9c477048b7fc2a089c347af60e3aa1251e5bf63e5c",
"attester": "0xcbc8a82e3dfc6faa2506f3033271ebc7447f096b"
},
"ZupassGatekeeper": {
"deploy": true,
"signer1": "13908133709081944902758389525983124100292637002438232157513257158004852609027",
"signer2": "7654374482676219729919246464135900991450848628968334062174564799457623790084",
"eventId": "d2ce5bb2-99a3-5a61-b7e6-1cd46d2ee00d"
},
"MACI": {
"stateTreeDepth": 10,
"gatekeeper": "ZupassGatekeeper"
},
"VkRegistry": {
"stateTreeDepth": 10,
"intStateTreeDepth": 1,
"messageTreeDepth": 2,
"voteOptionTreeDepth": 2,
"messageBatchDepth": 1,
"zkeys": {
"qv": {
"processMessagesZkey": "../cli/zkeys/ProcessMessages_10-2-1-2_test/ProcessMessages_10-2-1-2_test.0.zkey",
"tallyVotesZkey": "../cli/zkeys/TallyVotes_10-1-2_test/TallyVotes_10-1-2_test.0.zkey",
"processWasm": "../cli/zkeys/ProcessMessages_10-2-1-2_test/ProcessMessages_10-2-1-2_test_js/ProcessMessages_10-2-1-2_test.wasm",
"tallyWasm": "../cli/zkeys/TallyVotes_10-1-2_test/TallyVotes_10-1-2_test_js/TallyVotes_10-1-2_test.wasm"
},
"nonQv": {
"processMessagesZkey": "../cli/zkeys/ProcessMessagesNonQv_10-2-1-2_test/ProcessMessagesNonQv_10-2-1-2_test.0.zkey",
"tallyVotesZkey": "../cli/zkeys/TallyVotesNonQv_10-1-2_test/TallyVotesNonQv_10-1-2_test.0.zkey",
"processWasm": "../cli/zkeys/ProcessMessagesNonQv_10-2-1-2_test/ProcessMessagesNonQv_10-2-1-2_test_js/ProcessMessagesNonQv_10-2-1-2_test.wasm",
"tallyWasm": "../cli/zkeys/TallyVotesNonQv_10-1-2_test/TallyVotesNonQv_10-1-2_test_js/TallyVotesNonQv_10-1-2_test.wasm"
}
}
},
"Poll": {
"pollDuration": 10800,
"coordinatorPubkey": "macipk.0a1ce79a43fa676ee3d2882c79d9164a24d4a22bb6190e3d8fa25d97bffc069a",
"useQuadraticVoting": false
}
}
}
20 changes: 20 additions & 0 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const config: HardhatUserConfig = {
networks: {
sepolia: getCommonNetworkConfig(ESupportedChains.Sepolia, EChainId.Sepolia),
optimism_sepolia: getCommonNetworkConfig(ESupportedChains.OptimismSepolia, EChainId.OptimismSepolia),
scroll: getCommonNetworkConfig(ESupportedChains.Scroll, EChainId.Scroll),
scroll_sepolia: getCommonNetworkConfig(ESupportedChains.ScrollSepolia, EChainId.ScrollSepolia),
coverage: getCommonNetworkConfig(ESupportedChains.Coverage, EChainId.Coverage, TEST_MNEMONIC),
localhost: {
url: "http://localhost:8545",
Expand Down Expand Up @@ -101,6 +103,8 @@ const config: HardhatUserConfig = {
apiKey: {
[ESupportedChains.Sepolia]: ETHERSCAN_API_KEYS[ESupportedChains.Sepolia]!,
[ESupportedChains.OptimismSepolia]: ETHERSCAN_API_KEYS[ESupportedChains.OptimismSepolia]!,
[ESupportedChains.Scroll]: ETHERSCAN_API_KEYS[ESupportedChains.Scroll]!,
[ESupportedChains.ScrollSepolia]: ETHERSCAN_API_KEYS[ESupportedChains.ScrollSepolia]!,
},
customChains: [
{
Expand All @@ -111,6 +115,22 @@ const config: HardhatUserConfig = {
browserURL: "https://sepolia-optimism.etherscan.io",
},
},
{
network: ESupportedChains.Scroll,
chainId: EChainId.Scroll,
urls: {
apiURL: "https://api.scrollscan.com/api",
browserURL: "https://scrollscan.com/",
},
},
{
network: ESupportedChains.ScrollSepolia,
chainId: EChainId.ScrollSepolia,
urls: {
apiURL: "https://api-sepolia.scrollscan.com/api",
browserURL: "https://sepolia.scrollscan.com/",
},
},
],
},
sourcify: {
Expand Down
12 changes: 11 additions & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,27 @@
"deploy:localhost": "pnpm run deploy",
"deploy:sepolia": "pnpm run deploy --network sepolia",
"deploy:optimism-sepolia": "pnpm run deploy --network optimism_sepolia",
"deploy:scroll": "pnpm run deploy --network scroll",
"deploy:scroll-sepolia": "pnpm run deploy --network scroll_sepolia",
"deploy-poll:localhost": "pnpm run deploy-poll",
"deploy-poll:sepolia": "pnpm run deploy-poll --network sepolia",
"deploy-poll:optimism-sepolia": "pnpm run deploy-poll --network optimism_sepolia",
"deploy-poll:scroll": "pnpm run deploy-poll --network scroll",
"deploy-poll:scroll-sepolia": "pnpm run deploy-poll --network scroll_sepolia",
"merge:localhost": "pnpm run merge",
"merge:sepolia": "pnpm run merge --network sepolia",
"merge:optimism-sepolia": "pnpm run merge --network optimism_sepolia",
"merge:scroll": "pnpm run merge --network scroll",
"merge:scroll-sepolia": "pnpm run merge --network scroll_sepolia",
"prove:localhost": "pnpm run prove",
"prove:sepolia": "pnpm run prove --network sepolia",
"prove:optimism-sepolia": "pnpm run prove --network optimism_sepolia",
"prove:scroll": "pnpm run prove --network scroll",
"prove:scroll-sepolia": "pnpm run prove --network scroll_sepolia",
"verify:sepolia": "pnpm run verify --network sepolia",
"verify:optimism-sepolia": "pnpm run verify --network optimism_sepolia"
"verify:optimism-sepolia": "pnpm run verify --network optimism_sepolia",
"verify:scroll": "pnpm run verify --network scroll",
"verify:scroll-sepolia": "pnpm run verify --network scroll_sepolia"
},
"dependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.5",
Expand Down
12 changes: 12 additions & 0 deletions contracts/tasks/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
export enum ESupportedChains {
Sepolia = "sepolia",
OptimismSepolia = "optimism_sepolia",
Scroll = "scroll",
ScrollSepolia = "scroll_sepolia",
Coverage = "coverage",
Hardhat = "hardhat",
}
Expand All @@ -15,6 +17,8 @@ export enum EChainId {
Hardhat = 31337,
OptimismSepolia = 11155420,
Sepolia = 11155111,
Scroll = 534352,
ScrollSepolia = 534351,
Coverage = 1337,
}

Expand All @@ -36,6 +40,8 @@ const gasPrice = (value: number) => value * GWEI;
export const NETWORKS_DEFAULT_GAS: Record<ESupportedChains, number | "auto"> = {
[ESupportedChains.Sepolia]: gasPrice(1),
[ESupportedChains.OptimismSepolia]: gasPrice(1),
[ESupportedChains.Scroll]: gasPrice(1),
[ESupportedChains.ScrollSepolia]: gasPrice(1),
[ESupportedChains.Coverage]: gasPrice(1),
[ESupportedChains.Hardhat]: gasPrice(1),
};
Expand All @@ -48,10 +54,14 @@ export const NETWORKS_DEFAULT_GAS: Record<ESupportedChains, number | "auto"> = {
export const getNetworkRpcUrls = (): Record<ESupportedChains, string> => {
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL ?? "";
const OP_SEPOLIA_RPC_URL = process.env.OP_SEPOLIA_RPC_URL ?? "";
const SCROLL_RPC_URL = process.env.SCROLL_RPC_URL ?? "";
const SCROLL_SEPOLIA_RPC_URL = process.env.SCROLL_SEPOLIA_RPC_URL ?? "";

return {
[ESupportedChains.Sepolia]: SEPOLIA_RPC_URL,
[ESupportedChains.OptimismSepolia]: OP_SEPOLIA_RPC_URL,
[ESupportedChains.Scroll]: SCROLL_RPC_URL,
[ESupportedChains.ScrollSepolia]: SCROLL_SEPOLIA_RPC_URL,
[ESupportedChains.Coverage]: "http://localhost:8555",
[ESupportedChains.Hardhat]: "http://localhost:8545",
};
Expand All @@ -60,6 +70,8 @@ export const getNetworkRpcUrls = (): Record<ESupportedChains, string> => {
export const getEtherscanApiKeys = (): Record<ESupportedChains, string | undefined> => ({
[ESupportedChains.Sepolia]: process.env.ETH_ETHERSCAN_API_KEY,
[ESupportedChains.OptimismSepolia]: process.env.OPTIMISM_ETHERSCAN_API_KEY,
[ESupportedChains.Scroll]: process.env.SCROLL_ETHERSCAN_API_KEY,
[ESupportedChains.ScrollSepolia]: process.env.SCROLL_ETHERSCAN_API_KEY,
[ESupportedChains.Coverage]: undefined,
[ESupportedChains.Hardhat]: undefined,
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maci",
"version": "1.2.4",
"version": "1.2.5",
"description": "Minimal Anti-Collusion Infrastructure",
"repository": "https://github.com/privacy-scaling-explorations/maci",
"license": "MIT",
Expand Down

0 comments on commit 4b5b0ee

Please sign in to comment.