Merge pull request #719 from semaphore-protocol/feat/deployed-contracts

Add deployed contracts to utils package
This commit is contained in:
Cedoor
2024-03-25 18:55:09 +00:00
committed by GitHub
47 changed files with 405 additions and 705 deletions

View File

@@ -2,9 +2,5 @@ DEFAULT_NETWORK=hardhat
TREE_DEPTH=10
REPORT_GAS=false
BACKEND_PRIVATE_KEY=
INFURA_API_KEY=
COINMARKETCAP_API_KEY=
ETHERSCAN_API_KEY=
DEFENDER_KEY=
DEFENDER_SECRET=
CREATE2_SALT=1234

View File

@@ -24,12 +24,12 @@ jobs:
- name: Install dependencies
run: yarn
- name: Compile contracts
run: yarn compile:contracts
- name: Build libraries
run: yarn build:libraries
- name: Compile contracts
run: yarn compile:contracts
- name: Build subgraph
run: yarn build:subgraph

View File

@@ -22,12 +22,12 @@ jobs:
- name: Install dependencies
run: yarn
- name: Compile contracts
run: yarn compile:contracts
- name: Build libraries
run: yarn build:libraries
- name: Compile contracts
run: yarn compile:contracts
- name: Build subgraph
run: yarn build:subgraph

View File

@@ -4,7 +4,8 @@
"scripts": {
"start": "docusaurus start",
"start:es": "docusaurus start --locale es",
"build": "docusaurus build",
"pre-build": "yarn workspace @semaphore-protocol/utils build",
"build": "yarn pre-build && docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
@@ -16,6 +17,7 @@
"@docusaurus/core": "3.1.1",
"@docusaurus/preset-classic": "3.1.1",
"@mdx-js/react": "^3.0.0",
"@semaphore-protocol/utils": "4.0.0-beta.4",
"@svgr/webpack": "^5.5.0",
"clsx": "^1.2.1",
"docusaurus-plugin-sass": "^0.2.5",

View File

@@ -1,5 +1,5 @@
import { deployedContracts } from "@semaphore-protocol/utils"
import Heading from "@theme/Heading"
import { useEffect, useState } from "react"
function capitalizeFirstLetter(s: string): string {
return s.charAt(0).toUpperCase() + s.slice(1)
@@ -23,17 +23,6 @@ function getEtherscanLink(network: string): string {
}
export default function DeployedContracts() {
const [deployedContracts, setDeployedContracts] = useState<any[]>([])
useEffect(() => {
fetch(
"https://raw.githubusercontent.com/semaphore-protocol/semaphore/main/packages/contracts/deployed-contracts.json"
)
.then((response) => response.json())
.catch(() => [])
.then(setDeployedContracts)
}, [])
return (
<div>
{deployedContracts.map(({ network, contracts }) => (

View File

@@ -1,38 +0,0 @@
{
"sepolia": {
"Semaphore": {
"address": "0x5B8e7cC7bAC61A4b952d472b67056B2f260ba6dc",
"startBlock": 5150903
}
},
"mumbai": {
"Semaphore": {
"address": "",
"startBlock": 0
}
},
"optimism-sepolia": {
"Semaphore": {
"address": "",
"startBlock": 0
}
},
"arbitrum-sepolia": {
"Semaphore": {
"address": "",
"startBlock": 0
}
},
"arbitrum-one": {
"Semaphore": {
"address": "",
"startBlock": 0
}
},
"localhost": {
"Semaphore": {
"address": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
"startBlock": 0
}
}
}

View File

@@ -17,7 +17,8 @@
},
"dependencies": {
"@graphprotocol/graph-cli": "0.67.0",
"@graphprotocol/graph-ts": "0.32.0"
"@graphprotocol/graph-ts": "0.32.0",
"@semaphore-protocol/utils": "workspace:packages/utils"
},
"devDependencies": {
"@types/mustache": "^4.2.2",

View File

@@ -1,10 +1,11 @@
import Mustache from "mustache"
import { getDeployedContract } from "@semaphore-protocol/utils"
import { readFileSync, writeFileSync } from "fs"
import Mustache from "mustache"
const network = process.argv.at(2)
const template = readFileSync("./subgraph.template.yaml", "utf-8")
const networks = JSON.parse(readFileSync("./networks.json", "utf-8"))
const subgraph = Mustache.render(template, { network, ...networks[network].Semaphore })
const subgraph = Mustache.render(template, { network, ...getDeployedContract(network) })
writeFileSync("./subgraph.yaml", subgraph)

View File

@@ -13,8 +13,8 @@ const projects: any = fs
displayName: name,
setupFiles: ["dotenv/config"],
moduleNameMapper: {
"@semaphore-protocol/(.*)/(.*)": "<rootDir>/../$1/src/$2.ts",
"@semaphore-protocol/(.*)": "<rootDir>/../$1/src/index.ts"
"@semaphore-protocol/(.*)/(.*)": "<rootDir>/../$1/src/$2",
"@semaphore-protocol/(.*)": "<rootDir>/../$1/src"
}
}))

View File

@@ -1,4 +1,3 @@
INFURA_API_KEY=
ETHEREUM_PRIVATE_KEY=
REPORT_GAS=false
ETHERSCAN_API_KEY=

View File

@@ -1,54 +1,17 @@
import { HardhatUserConfig } from "hardhat/config"
import { NetworksUserConfig } from "hardhat/types"
import "@nomicfoundation/hardhat-toolbox"
import "dotenv/config"
import "@semaphore-protocol/hardhat"
import { getHardhatNetworks } from "@semaphore-protocol/utils"
import "dotenv/config"
import { HardhatUserConfig } from "hardhat/config"
import "./tasks/deploy"
function getNetworks(): NetworksUserConfig {
if (!process.env.INFURA_API_KEY || !process.env.ETHEREUM_PRIVATE_KEY) {
return {}
}
const accounts = [`0x${process.env.ETHEREUM_PRIVATE_KEY}`]
const infuraApiKey = process.env.INFURA_API_KEY
return {
sepolia: {
url: `https://sepolia.infura.io/v3/${infuraApiKey}`,
chainId: 11155111,
accounts
},
mumbai: {
url: `https://polygon-mumbai.infura.io/v3/${infuraApiKey}`,
chainId: 80001,
accounts
},
"optimism-sepolia": {
url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`,
chainId: 11155420,
accounts
},
"arbitrum-sepolia": {
url: "https://sepolia-rollup.arbitrum.io/rpc",
chainId: 421614,
accounts
},
arbitrum: {
url: "https://arb1.arbitrum.io/rpc",
chainId: 42161,
accounts
}
}
}
const config: HardhatUserConfig = {
solidity: "0.8.23",
networks: {
hardhat: {
chainId: 1337
},
...getNetworks()
...getHardhatNetworks(process.env.ETHEREUM_PRIVATE_KEY)
},
gasReporter: {
currency: "USD",

View File

@@ -43,6 +43,7 @@
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@semaphore-protocol/core": "4.0.0-beta.4",
"@semaphore-protocol/hardhat": "4.0.0-beta.4",
"@semaphore-protocol/utils": "4.0.0-beta.4",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"@types/chai": "^4.2.0",

View File

@@ -1,5 +1,4 @@
DEFAULT_NETWORK=localhost
INFURA_API_KEY=
ETHEREUM_PRIVATE_KEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
REPORT_GAS=false
COINMARKETCAP_API_KEY=

View File

@@ -1,50 +1,13 @@
import { HardhatUserConfig } from "hardhat/config"
import { NetworksUserConfig } from "hardhat/types"
import "@nomicfoundation/hardhat-toolbox"
import { config as dotenvConfig } from "dotenv"
import { resolve } from "path"
import "@semaphore-protocol/hardhat"
import { getHardhatNetworks } from "@semaphore-protocol/utils"
import { config as dotenvConfig } from "dotenv"
import { HardhatUserConfig } from "hardhat/config"
import { resolve } from "path"
import "./tasks/deploy"
dotenvConfig({ path: resolve(__dirname, "../../.env") })
function getNetworks(): NetworksUserConfig {
if (!process.env.INFURA_API_KEY || !process.env.ETHEREUM_PRIVATE_KEY) {
return {}
}
const accounts = [`0x${process.env.ETHEREUM_PRIVATE_KEY}`]
const infuraApiKey = process.env.INFURA_API_KEY
return {
sepolia: {
url: `https://sepolia.infura.io/v3/${infuraApiKey}`,
chainId: 11155111,
accounts
},
mumbai: {
url: `https://polygon-mumbai.infura.io/v3/${infuraApiKey}`,
chainId: 80001,
accounts
},
"optimism-sepolia": {
url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`,
chainId: 11155420,
accounts
},
"arbitrum-sepolia": {
url: "https://sepolia-rollup.arbitrum.io/rpc",
chainId: 421614,
accounts
},
arbitrum: {
url: "https://arb1.arbitrum.io/rpc",
chainId: 42161,
accounts
}
}
}
const config: HardhatUserConfig = {
solidity: "0.8.23",
defaultNetwork: process.env.DEFAULT_NETWORK || "localhost",
@@ -52,7 +15,7 @@ const config: HardhatUserConfig = {
hardhat: {
chainId: 1337
},
...getNetworks()
...getHardhatNetworks(process.env.ETHEREUM_PRIVATE_KEY)
},
gasReporter: {
currency: "USD",

View File

@@ -22,6 +22,7 @@
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@semaphore-protocol/core": "4.0.0-beta.4",
"@semaphore-protocol/hardhat": "4.0.0-beta.4",
"@semaphore-protocol/utils": "4.0.0-beta.4",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"@types/chai": "^4.2.0",

View File

@@ -1,5 +1,4 @@
DEFAULT_NETWORK=localhost
INFURA_API_KEY=
ETHEREUM_PRIVATE_KEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
REPORT_GAS=false
COINMARKETCAP_API_KEY=

View File

@@ -1,50 +1,13 @@
import { HardhatUserConfig } from "hardhat/config"
import { NetworksUserConfig } from "hardhat/types"
import "@nomicfoundation/hardhat-toolbox"
import { config as dotenvConfig } from "dotenv"
import { resolve } from "path"
import "@semaphore-protocol/hardhat"
import { getHardhatNetworks } from "@semaphore-protocol/utils"
import { config as dotenvConfig } from "dotenv"
import { HardhatUserConfig } from "hardhat/config"
import { resolve } from "path"
import "./tasks/deploy"
dotenvConfig({ path: resolve(__dirname, "../../.env") })
function getNetworks(): NetworksUserConfig {
if (!process.env.INFURA_API_KEY || !process.env.ETHEREUM_PRIVATE_KEY) {
return {}
}
const accounts = [`0x${process.env.ETHEREUM_PRIVATE_KEY}`]
const infuraApiKey = process.env.INFURA_API_KEY
return {
sepolia: {
url: `https://sepolia.infura.io/v3/${infuraApiKey}`,
chainId: 11155111,
accounts
},
mumbai: {
url: `https://polygon-mumbai.infura.io/v3/${infuraApiKey}`,
chainId: 80001,
accounts
},
"optimism-sepolia": {
url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`,
chainId: 11155420,
accounts
},
"arbitrum-sepolia": {
url: "https://sepolia-rollup.arbitrum.io/rpc",
chainId: 421614,
accounts
},
arbitrum: {
url: "https://arb1.arbitrum.io/rpc",
chainId: 42161,
accounts
}
}
}
const config: HardhatUserConfig = {
solidity: "0.8.23",
defaultNetwork: process.env.DEFAULT_NETWORK || "localhost",
@@ -52,7 +15,7 @@ const config: HardhatUserConfig = {
hardhat: {
chainId: 1337
},
...getNetworks()
...getHardhatNetworks(process.env.ETHEREUM_PRIVATE_KEY)
},
gasReporter: {
currency: "USD",

View File

@@ -22,6 +22,7 @@
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@semaphore-protocol/core": "4.0.0-beta.4",
"@semaphore-protocol/hardhat": "4.0.0-beta.4",
"@semaphore-protocol/utils": "4.0.0-beta.4",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"@types/chai": "^4.2.0",

View File

@@ -24,7 +24,7 @@ export default {
"fs",
"path",
"child_process",
"@semaphore-protocol/utils/supported-networks"
"@semaphore-protocol/utils/networks"
],
plugins: [
typescript({

View File

@@ -1,5 +1,5 @@
import { GroupResponse, SemaphoreEthers, SemaphoreSubgraph } from "@semaphore-protocol/data"
import supportedNetworks from "@semaphore-protocol/utils/supported-networks"
import { isSupportedNetwork, supportedNetworks } from "@semaphore-protocol/utils/networks"
import chalk from "chalk"
import { program } from "commander"
import decompress from "decompress"
@@ -121,10 +121,10 @@ program
.allowExcessArguments(false)
.action(async ({ network }) => {
if (!network) {
network = await getSupportedNetwork(supportedNetworks)
network = await getSupportedNetwork(Object.keys(supportedNetworks))
}
if (!supportedNetworks.includes(network)) {
if (!isSupportedNetwork(network)) {
console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`)
return
}
@@ -151,10 +151,10 @@ program
.allowExcessArguments(false)
.action(async (groupId, { network }) => {
if (!network) {
network = await getSupportedNetwork(supportedNetworks)
network = await getSupportedNetwork(Object.keys(supportedNetworks))
}
if (!supportedNetworks.includes(network)) {
if (!isSupportedNetwork(network)) {
console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`)
return
}
@@ -219,10 +219,10 @@ program
.allowExcessArguments(false)
.action(async (groupId, { network }) => {
if (!network) {
network = await getSupportedNetwork(supportedNetworks)
network = await getSupportedNetwork(Object.keys(supportedNetworks))
}
if (!supportedNetworks.includes(network)) {
if (!isSupportedNetwork(network)) {
console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`)
return
}
@@ -285,10 +285,10 @@ program
.allowExcessArguments(false)
.action(async (groupId, { network }) => {
if (!network) {
network = await getSupportedNetwork(supportedNetworks)
network = await getSupportedNetwork(Object.keys(supportedNetworks))
}
if (!supportedNetworks.includes(network)) {
if (!isSupportedNetwork(network)) {
console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`)
return
}

View File

@@ -1,19 +0,0 @@
[
{
"network": "sepolia",
"contracts": [
{
"name": "SemaphoreVerifier",
"address": "0x1E979ECf8C23d45577904974642592f80C464522"
},
{
"name": "PoseidonT3",
"address": "0x43AE9518d9FE43898cD705a06C22A73B015bCf12"
},
{
"name": "Semaphore",
"address": "0x5B8e7cC7bAC61A4b952d472b67056B2f260ba6dc"
}
]
}
]

View File

@@ -1,12 +1,11 @@
import "@nomicfoundation/hardhat-chai-matchers"
import "@nomicfoundation/hardhat-ethers"
import "@nomicfoundation/hardhat-verify"
import "@openzeppelin/hardhat-upgrades"
import { getHardhatNetworks } from "@semaphore-protocol/utils"
import "@typechain/hardhat"
import { config as dotenvConfig } from "dotenv"
import "hardhat-gas-reporter"
import { HardhatUserConfig } from "hardhat/config"
import { NetworksUserConfig } from "hardhat/types"
import { resolve } from "path"
import "solidity-coverage"
import "./tasks/accounts"
@@ -14,43 +13,6 @@ import "./tasks/deploy"
dotenvConfig({ path: resolve(__dirname, "../../.env") })
function getNetworks(): NetworksUserConfig {
if (!process.env.INFURA_API_KEY || !process.env.BACKEND_PRIVATE_KEY) {
return {}
}
const infuraApiKey = process.env.INFURA_API_KEY
const accounts = [`0x${process.env.BACKEND_PRIVATE_KEY}`]
return {
sepolia: {
url: `https://sepolia.infura.io/v3/${infuraApiKey}`,
chainId: 11155111,
accounts
},
mumbai: {
url: `https://polygon-mumbai.infura.io/v3/${infuraApiKey}`,
chainId: 80001,
accounts
},
"optimism-sepolia": {
url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`,
chainId: 11155420,
accounts
},
"arbitrum-sepolia": {
url: "https://sepolia-rollup.arbitrum.io/rpc",
chainId: 421614,
accounts
},
arbitrum: {
url: "https://arb1.arbitrum.io/rpc",
chainId: 42161,
accounts
}
}
}
const hardhatConfig: HardhatUserConfig = {
solidity: "0.8.23",
networks: {
@@ -58,17 +20,13 @@ const hardhatConfig: HardhatUserConfig = {
chainId: 1337,
allowUnlimitedContractSize: true
},
...getNetworks()
...getHardhatNetworks(process.env.BACKEND_PRIVATE_KEY)
},
gasReporter: {
currency: "USD",
enabled: process.env.REPORT_GAS === "true",
coinmarketcap: process.env.COINMARKETCAP_API_KEY
},
defender: {
apiKey: process.env.DEFENDER_KEY as string,
apiSecret: process.env.DEFENDER_SECRET as string
},
typechain: {
target: "ethers-v6"
},

View File

@@ -18,9 +18,9 @@
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@openzeppelin/hardhat-upgrades": "^3.0.4",
"@nomicfoundation/hardhat-verify": "^2.0.5",
"@semaphore-protocol/core": "workspace:packages/core",
"@semaphore-protocol/utils": "workspace:packages/utils",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"@types/chai": "^4.2.0",

View File

@@ -1,8 +1,10 @@
import { SupportedNetwork, isSupportedNetwork } from "@semaphore-protocol/utils"
import { readFileSync, writeFileSync } from "fs"
export type NetworkDeployedContracts = {
name: "Semaphore" | "SemaphoreVerifier" | "PoseidonT3"
address: string
startBlock: number
}[]
export type DeployedContracts = {
@@ -10,10 +12,10 @@ export type DeployedContracts = {
contracts: NetworkDeployedContracts
}[]
const supportedNetworks = ["sepolia", "arbitrum", "mumbai", "optimism-sepolia", "arbitrum-sepolia"]
const deployedContractsPath = "../utils/src/networks/deployed-contracts.json"
export function getDeployedContracts(): DeployedContracts {
return JSON.parse(readFileSync(`./deployed-contracts.json`, "utf8"))
return JSON.parse(readFileSync(deployedContractsPath, "utf8"))
}
export function getDeployedContractsByNetwork(network: string): NetworkDeployedContracts {
@@ -38,15 +40,15 @@ export function getDeployedContractAddress(network: string, contractName: string
return semaphoreAddress.address
}
export function saveDeployedContracts(contracts: NetworkDeployedContracts, network?: string) {
if (network && supportedNetworks.includes(network)) {
export function saveDeployedContracts(contracts: NetworkDeployedContracts, network?: SupportedNetwork) {
if (network && isSupportedNetwork(network)) {
const deployedContracts = getDeployedContracts() as DeployedContracts
for (let i = 0; i < deployedContracts.length; i += 1) {
if (deployedContracts[i].network === network) {
deployedContracts[i].contracts = contracts
writeFileSync(`./deployed-contracts.json`, JSON.stringify(deployedContracts, null, 4))
writeFileSync(deployedContractsPath, JSON.stringify(deployedContracts, null, 4))
return
}
@@ -57,6 +59,6 @@ export function saveDeployedContracts(contracts: NetworkDeployedContracts, netwo
contracts
})
writeFileSync(`./deployed-contracts.json`, JSON.stringify(deployedContracts, null, 4))
writeFileSync(deployedContractsPath, JSON.stringify(deployedContracts, null, 4))
}
}

View File

@@ -1,3 +1,4 @@
import { isSupportedNetwork } from "@semaphore-protocol/utils"
import { hardhatArguments, run } from "hardhat"
import { getDeployedContractAddress } from "./utils"
@@ -13,13 +14,15 @@ async function verify(address: string, constructorArguments?: any[]): Promise<vo
}
async function main() {
if (!hardhatArguments.network) {
throw Error("Please, define a supported network")
const { network } = hardhatArguments
if (!network || !isSupportedNetwork(network)) {
throw Error(`Network '${network}' is not supported`)
}
const semaphoreVerifierAddress = getDeployedContractAddress(hardhatArguments.network, "SemaphoreVerifier")
const poseidonT3Address = getDeployedContractAddress(hardhatArguments.network, "PoseidonT3")
const semaphoreAddress = getDeployedContractAddress(hardhatArguments.network, "Semaphore")
const semaphoreVerifierAddress = getDeployedContractAddress(network, "SemaphoreVerifier")
const poseidonT3Address = getDeployedContractAddress(network, "PoseidonT3")
const semaphoreAddress = getDeployedContractAddress(network, "Semaphore")
await verify(semaphoreVerifierAddress)
await verify(poseidonT3Address)

View File

@@ -1,6 +1,6 @@
import { SupportedNetwork } from "@semaphore-protocol/utils"
import { task, types } from "hardhat/config"
import { saveDeployedContracts } from "../scripts/utils"
import { deployContract } from "./utils"
task("deploy", "Deploy a Semaphore contract")
.addOptionalParam<boolean>("verifier", "Verifier contract address", undefined, types.string)
@@ -9,12 +9,16 @@ task("deploy", "Deploy a Semaphore contract")
.setAction(
async (
{ logs, verifier: semaphoreVerifierAddress, poseidon: poseidonT3Address },
{ ethers, hardhatArguments, defender }
{ ethers, hardhatArguments }
): Promise<any> => {
const startBlock = await ethers.provider.getBlockNumber()
if (!semaphoreVerifierAddress) {
const VerifierFactory = await ethers.getContractFactory(`SemaphoreVerifier`)
const verifier = await deployContract(defender, VerifierFactory, hardhatArguments.network)
const verifier = await VerifierFactory.deploy()
await verifier.waitForDeployment()
semaphoreVerifierAddress = await verifier.getAddress()
@@ -26,7 +30,9 @@ task("deploy", "Deploy a Semaphore contract")
if (!poseidonT3Address) {
const PoseidonT3Factory = await ethers.getContractFactory("PoseidonT3")
const poseidonT3 = await deployContract(defender, PoseidonT3Factory, hardhatArguments.network)
const poseidonT3 = await PoseidonT3Factory.deploy()
await poseidonT3.waitForDeployment()
poseidonT3Address = await poseidonT3.getAddress()
@@ -41,9 +47,9 @@ task("deploy", "Deploy a Semaphore contract")
}
})
const semaphore = await deployContract(defender, SemaphoreFactory, hardhatArguments.network, [
semaphoreVerifierAddress
])
const semaphore = await SemaphoreFactory.deploy(semaphoreVerifierAddress)
await semaphore.waitForDeployment()
const semaphoreAddress = await semaphore.getAddress()
@@ -55,18 +61,21 @@ task("deploy", "Deploy a Semaphore contract")
[
{
name: "SemaphoreVerifier",
address: semaphoreVerifierAddress
address: semaphoreVerifierAddress,
startBlock
},
{
name: "PoseidonT3",
address: poseidonT3Address
address: poseidonT3Address,
startBlock
},
{
name: "Semaphore",
address: semaphoreAddress
address: semaphoreAddress,
startBlock
}
],
hardhatArguments.network
hardhatArguments.network as SupportedNetwork
)
return {

View File

@@ -1,21 +0,0 @@
import { DefenderHardhatUpgrades } from "@openzeppelin/hardhat-upgrades"
import { ContractFactory } from "ethers"
export async function deployContract(
defender: DefenderHardhatUpgrades,
contractFactory: ContractFactory,
network?: string,
args: any[] = []
) {
let contract
if (network !== undefined && network !== "hardhat" && network !== "localhost") {
contract = await defender.deployContract(contractFactory, args, { salt: process.env.CREATE2_SALT })
await contract.waitForDeployment()
} else {
contract = await contractFactory.deploy(...args)
}
return contract
}

View File

@@ -37,6 +37,7 @@
"rollup-plugin-cleanup": "^3.2.1"
},
"dependencies": {
"@semaphore-protocol/utils": "4.0.0-beta.4",
"axios": "1.6.6",
"ethers": "6.11.0"
}

View File

@@ -19,6 +19,12 @@ export default {
{ file: pkg.exports.require, format: "cjs", banner, exports: "auto" },
{ file: pkg.exports.default, format: "es", banner }
],
external: [...Object.keys(pkg.dependencies), "ethers/contract", "ethers/constants", "ethers/providers"],
external: [
...Object.keys(pkg.dependencies),
"ethers/contract",
"ethers/constants",
"ethers/providers",
"@semaphore-protocol/utils/networks"
],
plugins: [json(), typescript({ tsconfig: "./build.tsconfig.json" }), cleanup({ comments: "jsdoc" })]
}

View File

@@ -1,3 +1,9 @@
import {
SupportedNetwork,
defaultNetwork,
getDeployedContract,
isSupportedNetwork
} from "@semaphore-protocol/utils/networks"
import { ZeroAddress } from "ethers/constants"
import { Contract } from "ethers/contract"
import {
@@ -25,7 +31,7 @@ export default class SemaphoreEthers {
* @param networkOrEthereumURL Ethereum network or custom URL.
* @param options Ethers options.
*/
constructor(networkOrEthereumURL: EthersNetwork | string = "sepolia", options: EthersOptions = {}) {
constructor(networkOrEthereumURL: EthersNetwork | string = defaultNetwork, options: EthersOptions = {}) {
checkParameter(networkOrEthereumURL, "networkOrSubgraphURL", "string")
if (options.provider) {
@@ -38,37 +44,17 @@ export default class SemaphoreEthers {
checkParameter(options.apiKey, "apiKey", "string")
}
if (networkOrEthereumURL === "mumbai") {
networkOrEthereumURL = "maticmum"
}
if (isSupportedNetwork(networkOrEthereumURL)) {
const { address, startBlock } = getDeployedContract(networkOrEthereumURL as SupportedNetwork)
switch (networkOrEthereumURL) {
case "arbitrum":
options.address ??= "0xc60E0Ee1a2770d5F619858C641f14FC4a6401520"
options.startBlock ??= 77278430
break
case "arbitrum-sepolia":
options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
options.startBlock ??= 15174410
break
case "maticmum":
options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
options.startBlock ??= 33995010
break
case "sepolia":
options.address ??= "0x5B8e7cC7bAC61A4b952d472b67056B2f260ba6dc"
options.startBlock ??= 5150903
break
case "optimism-sepolia":
options.address ??= "0x3889927F0B5Eb1a02C6E2C20b39a1Bd4EAd76131"
options.startBlock ??= 7632846
break
default:
if (options.address === undefined) {
throw new Error(`You should provide a Semaphore contract address for this network`)
}
options.address ??= address
options.startBlock ??= startBlock
} else {
if (options.address === undefined) {
throw new Error(`Network '${networkOrEthereumURL}' needs a Semaphore contract address`)
}
options.startBlock ??= 0
options.startBlock ??= 0
}
let provider: Provider

View File

@@ -1,19 +1,15 @@
import { SupportedNetwork } from "./types"
import type { SupportedNetwork } from "@semaphore-protocol/utils"
import { isSupportedNetwork } from "@semaphore-protocol/utils/networks"
/**
* Returns the subgraph URL related to the network passed as a parameter.
* @param supportedNetwork Semaphore supported network.
* @returns Subgraph URL.
*/
export default function getURL(supportedNetwork: SupportedNetwork | string): string {
switch (supportedNetwork) {
case "sepolia":
case "mumbai":
case "optimism-sepolia":
case "arbitrum-sepolia":
case "arbitrum":
return `https://api.studio.thegraph.com/query/14377/semaphore-${supportedNetwork}/v4.0.0-alpha.4`
default:
throw new TypeError(`Network '${supportedNetwork}' is not supported`)
export default function getURL(supportedNetwork: SupportedNetwork): string {
if (!isSupportedNetwork(supportedNetwork)) {
throw new TypeError(`Network '${supportedNetwork}' is not supported`)
}
return `https://api.studio.thegraph.com/query/14377/semaphore-${supportedNetwork}/v4.0.0-alpha.4`
}

View File

@@ -1,8 +1,9 @@
import { defaultNetwork, SupportedNetwork } from "@semaphore-protocol/utils/networks"
import { AxiosRequestConfig } from "axios"
import checkParameter from "./checkParameter"
import getURL from "./getURL"
import request from "./request"
import { GroupOptions, GroupResponse, SupportedNetwork } from "./types"
import { GroupOptions, GroupResponse } from "./types"
import { jsDateToGraphqlDate } from "./utils"
export default class SemaphoreSubgraph {
@@ -12,7 +13,7 @@ export default class SemaphoreSubgraph {
* Initializes the subgraph object with one of the supported networks or a custom URL.
* @param networkOrSubgraphURL Supported Semaphore network or custom Subgraph URL.
*/
constructor(networkOrSubgraphURL: SupportedNetwork | string = SupportedNetwork.SEPOLIA) {
constructor(networkOrSubgraphURL: SupportedNetwork | string = defaultNetwork) {
checkParameter(networkOrSubgraphURL, "networkOrSubgraphURL", "string")
if (typeof networkOrSubgraphURL === "string" && networkOrSubgraphURL.startsWith("http")) {
@@ -20,7 +21,7 @@ export default class SemaphoreSubgraph {
return
}
this._url = getURL(networkOrSubgraphURL)
this._url = getURL(networkOrSubgraphURL as SupportedNetwork)
}
/**

View File

@@ -1,21 +1,12 @@
export enum SupportedNetwork {
SEPOLIA = "sepolia",
MUMBAI = "mumbai",
OPTIMISM_SEPOLIA = "optimism-sepolia",
ARBITRUM_SEPOLIA = "arbitrum-sepolia",
ARBITRUM = "arbitrum"
}
export type EthersNetwork =
| "homestead"
| "mainnet"
| "sepolia"
| "matic"
| "matic-mumbai"
| "arbitrum"
| "maticmum"
| "mumbai"
| "arbitrum-sepolia"
| "optimism"
| "optimism-sepolia"
| "sepolia"
export type GroupOptions = {
members?: boolean

View File

@@ -30,54 +30,48 @@ describe("SemaphoreEthers", () => {
describe("# SemaphoreEthers", () => {
it("Should instantiate a SemaphoreEthers object with different networks", () => {
const semaphore = new SemaphoreEthers()
const semaphore1 = new SemaphoreEthers("arbitrum")
const semaphore2 = new SemaphoreEthers("mumbai")
const semaphore3 = new SemaphoreEthers("optimism-sepolia")
const semaphore4 = new SemaphoreEthers("arbitrum-sepolia")
const semaphore5 = new SemaphoreEthers("arbitrum-sepolia", {
const semaphore2 = new SemaphoreEthers("arbitrum-sepolia")
const semaphore3 = new SemaphoreEthers("arbitrum-sepolia", {
address: "0x0000000000000000000000000000000000000000",
startBlock: 0
})
const semaphore6 = new SemaphoreEthers("homestead", {
const semaphore4 = new SemaphoreEthers("mainnet", {
address: "0x0000000000000000000000000000000000000000",
startBlock: 0
})
expect(semaphore.network).toBe("sepolia")
expect(semaphore.contract).toBeInstanceOf(Object)
expect(semaphore1.network).toBe("arbitrum")
expect(semaphore2.network).toBe("maticmum")
expect(semaphore3.network).toBe("optimism-sepolia")
expect(semaphore4.network).toBe("arbitrum-sepolia")
expect(semaphore5.options.address).toContain("0x000000")
expect(semaphore6.network).toBe("homestead")
expect(semaphore6.options.startBlock).toBe(0)
expect(semaphore6.options.address).toContain("0x000000")
expect(semaphore2.network).toBe("arbitrum-sepolia")
expect(semaphore3.options.address).toContain("0x000000")
expect(semaphore4.network).toBe("mainnet")
expect(semaphore4.options.startBlock).toBe(0)
expect(semaphore4.options.address).toContain("0x000000")
})
it("Should instantiate a SemaphoreEthers object with different providers", () => {
const semaphore1 = new SemaphoreEthers("homestead", {
const semaphore1 = new SemaphoreEthers("mainnet", {
provider: "infura",
address: "0x0000000000000000000000000000000000000000",
apiKey: "1234567890"
})
const semaphore2 = new SemaphoreEthers("homestead", {
const semaphore2 = new SemaphoreEthers("mainnet", {
provider: "etherscan",
address: "0x0000000000000000000000000000000000000000"
})
const semaphore3 = new SemaphoreEthers("homestead", {
const semaphore3 = new SemaphoreEthers("mainnet", {
provider: "alchemy",
address: "0x0000000000000000000000000000000000000000"
})
const semaphore4 = new SemaphoreEthers("homestead", {
const semaphore4 = new SemaphoreEthers("mainnet", {
provider: "cloudflare",
address: "0x0000000000000000000000000000000000000000"
})
const semaphore5 = new SemaphoreEthers("homestead", {
const semaphore5 = new SemaphoreEthers("mainnet", {
provider: "pocket",
address: "0x0000000000000000000000000000000000000000"
})
const semaphore6 = new SemaphoreEthers("homestead", {
const semaphore6 = new SemaphoreEthers("mainnet", {
provider: "ankr",
address: "0x0000000000000000000000000000000000000000"
})
@@ -100,9 +94,9 @@ describe("SemaphoreEthers", () => {
})
it("Should throw an error if the network is not supported by Semaphore yet and there's no address", () => {
const fun = () => new SemaphoreEthers("homestead")
const fun = () => new SemaphoreEthers("mainnet")
expect(fun).toThrow("You should provide a Semaphore contract address for this network")
expect(fun).toThrow("Network 'mainnet' needs a Semaphore contract address")
})
it("Should throw an error if the provider is not supported", () => {

View File

@@ -14,10 +14,8 @@ describe("SemaphoreSubgraph", () => {
describe("# SemaphoreSubgraph", () => {
it("Should instantiate a SemaphoreSubgraph object", () => {
semaphore = new SemaphoreSubgraph()
const semaphore1 = new SemaphoreSubgraph("arbitrum")
expect(semaphore.url).toContain("sepolia")
expect(semaphore1.url).toContain("arbitrum")
})
it("Should instantiate a SemaphoreSubgraph object using URL", () => {

View File

@@ -35,7 +35,8 @@ export default {
"ethers/utils",
"ethers/abi",
"@zk-kit/utils/error-handlers",
"@zk-kit/utils/proof-packing"
"@zk-kit/utils/proof-packing",
"@semaphore-protocol/utils/constants"
],
plugins: [
alias({

View File

@@ -40,7 +40,8 @@ export default {
"ethers/utils",
"ethers/abi",
"@zk-kit/utils/error-handlers",
"@zk-kit/utils/proof-packing"
"@zk-kit/utils/proof-packing",
"@semaphore-protocol/utils/constants"
],
plugins: [
typescript({

View File

@@ -12,10 +12,10 @@
"require": "./dist/index.cjs",
"default": "./dist/index.js"
},
"./supported-networks": {
"types": "./dist/types/supported-networks.d.ts",
"require": "./dist/lib.commonjs/supported-networks.cjs",
"default": "./dist/lib.esm/supported-networks.js"
"./networks": {
"types": "./dist/types/networks/index.d.ts",
"require": "./dist/lib.commonjs/networks/index.cjs",
"default": "./dist/lib.esm/networks/index.js"
},
"./constants": {
"types": "./dist/types/constants.d.ts",
@@ -47,6 +47,7 @@
"access": "public"
},
"devDependencies": {
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-typescript": "^11.1.6",
"rimraf": "^5.0.5",
"rollup": "^4.12.0",

View File

@@ -1,4 +1,5 @@
import typescript from "@rollup/plugin-typescript"
import json from "@rollup/plugin-json"
import * as fs from "fs"
import cleanup from "rollup-plugin-cleanup"
@@ -19,11 +20,13 @@ export default [
{ file: pkg.exports["."].require, format: "cjs", banner, exports: "auto" },
{ file: pkg.exports["."].default, format: "es", banner }
],
external: [...Object.keys(pkg.dependencies), "ethers/abi", "ethers/utils"],
plugins: [
typescript({
tsconfig: "./build.tsconfig.json"
}),
cleanup({ comments: "jsdoc" })
cleanup({ comments: "jsdoc" }),
json()
]
},
{
@@ -38,13 +41,15 @@ export default [
},
{ dir: "./dist/lib.esm", format: "es", banner, preserveModules: true }
],
external: [...Object.keys(pkg.dependencies), "ethers/abi", "ethers/utils"],
plugins: [
typescript({
tsconfig: "./build.tsconfig.json",
declaration: false,
declarationDir: undefined
}),
cleanup({ comments: "jsdoc" })
cleanup({ comments: "jsdoc" }),
json()
]
}
]

View File

@@ -1,6 +1,5 @@
import * as constants from "./constants"
import decodeMessage from "./decode-message"
import supportedNetworks from "./supported-networks"
export * from "./types"
export { constants, decodeMessage, supportedNetworks }
export * from "./networks"
export { constants, decodeMessage }

View File

@@ -0,0 +1,82 @@
[
{
"network": "sepolia",
"contracts": [
{
"name": "SemaphoreVerifier",
"address": "0x58AD7a4389E0F5d814815E5D5A3Ab903dAE9284a",
"startBlock": 5539276
},
{
"name": "PoseidonT3",
"address": "0x4EFfF6a6a7BB31cdAd9Ee742b0faAA6Bb9BF096B",
"startBlock": 5539276
},
{
"name": "Semaphore",
"address": "0x0A09FB3f63c13F1C54F2fA41AFB1e7a98cffc774",
"startBlock": 5539276
}
]
},
{
"network": "arbitrum-sepolia",
"contracts": [
{
"name": "SemaphoreVerifier",
"address": "0x5f4edC58142f4395D1D536e793137A0252dA5a49",
"startBlock": 25837653
},
{
"name": "PoseidonT3",
"address": "0x181B7f34538cE3BceC68597d4A212aB3f7881648",
"startBlock": 25837653
},
{
"name": "Semaphore",
"address": "0x220fBdB6F996827b1Cf12f0C181E8d5e6de3a36F",
"startBlock": 25837653
}
]
},
{
"network": "optimism-sepolia",
"contracts": [
{
"name": "SemaphoreVerifier",
"address": "0x3d3df6CFc6BFf68d9693e097F32bF4a9903E77a5",
"startBlock": 9663266
},
{
"name": "PoseidonT3",
"address": "0x5f4edC58142f4395D1D536e793137A0252dA5a49",
"startBlock": 9663266
},
{
"name": "Semaphore",
"address": "0x181B7f34538cE3BceC68597d4A212aB3f7881648",
"startBlock": 9663266
}
]
},
{
"network": "matic-mumbai",
"contracts": [
{
"name": "SemaphoreVerifier",
"address": "0xE5269ae1E996C6FEEf6E832c7032401E73087568",
"startBlock": 47356015
},
{
"name": "PoseidonT3",
"address": "0xC0ae1a8D3505B2bE9DCe0e826abd722Afd13F1c9",
"startBlock": 47356015
},
{
"name": "Semaphore",
"address": "0x346a936b19071b2f619200848B8ADbb938D72250",
"startBlock": 47356015
}
]
}
]

View File

@@ -0,0 +1,66 @@
/**
* @module Networks
* This module provides a collection of utility functions to provide the other internal
* packages and developers with information on deployed contracts and networks supported
* by Semaphore.
*/
import deployedContracts from "./deployed-contracts.json"
import supportedNetworks from "./supported-networks"
export type SupportedNetwork = keyof typeof supportedNetworks
// Default Semaphore network.
export const defaultNetwork: SupportedNetwork = "sepolia"
/**
* Returns true if a network is supported by Semaphore, false otherwise.
* @param supportedNetwork The network to be checked.
*/
export function isSupportedNetwork(supportedNetwork: string): boolean {
return Object.keys(supportedNetworks).includes(supportedNetwork)
}
/**
* Utility function to get an object compatible with the Hardhat 'networks' option.
* If the private key is not defined it returns an empty object.
* @param privateKey Private key to be used with networks.
* @returns An object compatible with the Hardhat 'networks' option.
*/
export function getHardhatNetworks(privateKey?: string) {
if (!privateKey) {
return {}
}
const supportedNetworksCopy = JSON.parse(JSON.stringify(supportedNetworks))
for (const key in supportedNetworksCopy) {
if (Object.prototype.hasOwnProperty.call(supportedNetworksCopy, key)) {
supportedNetworksCopy[key].accounts = [`0x${privateKey}`]
}
}
return supportedNetworksCopy
}
/**
* Returns name, address and start block of a Semaphore contract deployed
* on a specific supported network.
* @param The network supported by Semaphore.
* @returns An object with name, address and start block of the deployed contract.
*/
export function getDeployedContract(supportedNetwork: SupportedNetwork) {
if (!isSupportedNetwork(supportedNetwork)) {
throw new Error(`Semaphore has not been deployed on '${supportedNetwork}' yet`)
}
const deployedContract = deployedContracts.find(({ network }) => network === supportedNetwork)
return deployedContract!.contracts.find(({ name }) => name === "Semaphore") as {
name: string
address: string
startBlock: number
}
}
export { deployedContracts, supportedNetworks }

View File

@@ -0,0 +1,26 @@
export default {
sepolia: {
name: "Sepolia",
url: "https://rpc2.sepolia.org",
chainId: 11155111,
explorer: "https://sepolia.etherscan.io"
},
"arbitrum-sepolia": {
name: "Arbitrum Sepolia",
url: "https://sepolia-rollup.arbitrum.io/rpc",
chainId: 421614,
explorer: "https://sepolia.arbiscan.io"
},
"optimism-sepolia": {
name: "Optimism Sepolia",
url: "https://sepolia.optimism.io",
chainId: 11155420,
explorer: "https://sepolia-optimism.etherscan.io"
},
"matic-mumbai": {
name: "Matic Mumbai",
url: "https://rpc-mumbai.polygon.technology",
chainId: 80001,
explorer: "https://mumbai.polygonscan.com"
}
}

View File

@@ -1,6 +0,0 @@
import { SupportedNetwork } from "./types"
// List of Semaphore supported networks.
const supportedNetwork: SupportedNetwork[] = ["sepolia", "mumbai", "optimism-sepolia", "arbitrum-sepolia", "arbitrum"]
export default supportedNetwork

View File

@@ -1 +0,0 @@
export type SupportedNetwork = "sepolia" | "mumbai" | "optimism-sepolia" | "arbitrum-sepolia" | "arbitrum"

View File

@@ -1,13 +1,49 @@
import { encodeBytes32String } from "ethers/abi"
import { toBigInt } from "ethers/utils"
import { supportedNetworks } from "../src"
import decodeMessage from "../src/decode-message"
import { getDeployedContract, getHardhatNetworks, isSupportedNetwork, supportedNetworks } from "../src/networks"
describe("Utils", () => {
describe("# supportedNetworks", () => {
it("Should be a list of networks supported by Semaphore", () => {
expect(supportedNetworks).toBeInstanceOf(Array)
expect(typeof supportedNetworks[0]).toBe("string")
describe("# networks", () => {
describe("# isSupportedNetwork", () => {
it("Should return true if the network is supported", () => {
expect(isSupportedNetwork("sepolia")).toBeTruthy()
})
it("Should return false if the network is not supported", () => {
expect(isSupportedNetwork("hello")).toBeFalsy()
})
})
describe("# getDeployedContract", () => {
it("Should return Semaphore deployment data for Sepolia", () => {
const { address, startBlock } = getDeployedContract("sepolia")
expect(address).toHaveLength(42)
expect(typeof startBlock).toBe("number")
})
it("Should throw an error if the network is not supported", () => {
const fun = () => getDeployedContract("hello" as any)
expect(fun).toThrow("Semaphore has not been deployed on 'hello' yet")
})
})
describe("# getHardhatNetworks", () => {
it("Should return an empty object if the private key is not defined", () => {
const networks = getHardhatNetworks()
expect(networks).toEqual({})
})
it("Should return a list of networks compatible with the Hardhat 'networks' object", () => {
const networks = getHardhatNetworks("ec12f72ab17a2f14cf538a1a2455d6cd94ec99a90e8d8be591f987744b7b440f")
expect(Object.keys(networks)).toEqual(Object.keys(supportedNetworks))
expect(Object.keys(networks)).toHaveLength(Object.keys(supportedNetworks).length)
expect(networks.sepolia.accounts).toHaveLength(1)
})
})
})

321
yarn.lock
View File

@@ -238,47 +238,6 @@ __metadata:
languageName: node
linkType: hard
"@aws-crypto/sha256-js@npm:1.2.2":
version: 1.2.2
resolution: "@aws-crypto/sha256-js@npm:1.2.2"
dependencies:
"@aws-crypto/util": "npm:^1.2.2"
"@aws-sdk/types": "npm:^3.1.0"
tslib: "npm:^1.11.1"
checksum: 10/1d49239e1ef93d3c5fda0f5c12eda098b14eb334cb5f604404bc6e4eaf418df9831e45f91985acfb9545eebde7a30815815ce70ab107ed147e515bbab644e791
languageName: node
linkType: hard
"@aws-crypto/util@npm:^1.2.2":
version: 1.2.2
resolution: "@aws-crypto/util@npm:1.2.2"
dependencies:
"@aws-sdk/types": "npm:^3.1.0"
"@aws-sdk/util-utf8-browser": "npm:^3.0.0"
tslib: "npm:^1.11.1"
checksum: 10/55cc2bb7923d2242cd58138926a19323b6cb6381b9fcc73c6ed5d7071be29e735e6d964f868b22991772377e6e5e3dc1a8aa640e4150222b509b4f5067c4c659
languageName: node
linkType: hard
"@aws-sdk/types@npm:^3.1.0":
version: 3.535.0
resolution: "@aws-sdk/types@npm:3.535.0"
dependencies:
"@smithy/types": "npm:^2.12.0"
tslib: "npm:^2.6.2"
checksum: 10/29c2def0ef0a10c0cc44d45b18e149ed6884a6417ddef7a23a58d50ad83f71cf0b00dd774fcc57fcdf85e1e21a8849d9e25999943435a1487ee8ac127a668c6d
languageName: node
linkType: hard
"@aws-sdk/util-utf8-browser@npm:^3.0.0":
version: 3.259.0
resolution: "@aws-sdk/util-utf8-browser@npm:3.259.0"
dependencies:
tslib: "npm:^2.3.1"
checksum: 10/bdcf29a92a9a1010b44bf8bade3f1224cb6577a6550b39df97cc053d353f2868d355c25589d61e1da54691d65350d8578a496840ad770ed916a6c3af0971f657
languageName: node
linkType: hard
"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.8.3":
version: 7.23.5
resolution: "@babel/code-frame@npm:7.23.5"
@@ -5526,7 +5485,7 @@ __metadata:
languageName: node
linkType: hard
"@nomicfoundation/hardhat-verify@npm:^2.0.0":
"@nomicfoundation/hardhat-verify@npm:^2.0.0, @nomicfoundation/hardhat-verify@npm:^2.0.5":
version: 2.0.5
resolution: "@nomicfoundation/hardhat-verify@npm:2.0.5"
dependencies:
@@ -5843,111 +5802,6 @@ __metadata:
languageName: node
linkType: hard
"@openzeppelin/defender-admin-client@npm:^1.52.0":
version: 1.54.1
resolution: "@openzeppelin/defender-admin-client@npm:1.54.1"
dependencies:
"@openzeppelin/defender-base-client": "npm:1.54.1"
axios: "npm:^1.4.0"
ethers: "npm:^5.7.2"
lodash: "npm:^4.17.19"
node-fetch: "npm:^2.6.0"
checksum: 10/46609debf264b5984c144de531c05c786234f5be0bf520c1a430eca560d760896a514f6869a288698a0e3f64674a6ca17313b8b13d6668ea76d24c585ceeb9de
languageName: node
linkType: hard
"@openzeppelin/defender-base-client@npm:1.54.1, @openzeppelin/defender-base-client@npm:^1.52.0":
version: 1.54.1
resolution: "@openzeppelin/defender-base-client@npm:1.54.1"
dependencies:
amazon-cognito-identity-js: "npm:^6.0.1"
async-retry: "npm:^1.3.3"
axios: "npm:^1.4.0"
lodash: "npm:^4.17.19"
node-fetch: "npm:^2.6.0"
checksum: 10/56a3cbba49820a8c68c22ae168a99a94790bda95cee52b4b880dd8adcf5656526c0a7903cc5a168164199d59e987484846fe468349872af0f65cc48b89087c90
languageName: node
linkType: hard
"@openzeppelin/defender-sdk-base-client@npm:^1.10.0, @openzeppelin/defender-sdk-base-client@npm:^1.11.0":
version: 1.11.0
resolution: "@openzeppelin/defender-sdk-base-client@npm:1.11.0"
dependencies:
amazon-cognito-identity-js: "npm:^6.3.6"
async-retry: "npm:^1.3.3"
checksum: 10/c4624d5575bec7860c0a9280fcb2929c4fd1f852cbf969afbd223ed6736d413862e430e250554b0f6794520c7dfa14d7f45716a3f5e9857ec9341c99f81a0ea3
languageName: node
linkType: hard
"@openzeppelin/defender-sdk-deploy-client@npm:^1.10.0":
version: 1.11.0
resolution: "@openzeppelin/defender-sdk-deploy-client@npm:1.11.0"
dependencies:
"@openzeppelin/defender-sdk-base-client": "npm:^1.11.0"
axios: "npm:^1.6.7"
lodash: "npm:^4.17.21"
checksum: 10/f3f32dfe69b3b72b36b1fa6d3bd9544b1b9670a1b4f1e5a03e9994f7db83da6907f390f2c82fb628d83865c41601f403e4175ee9306fcee5df8948a31f3341c3
languageName: node
linkType: hard
"@openzeppelin/defender-sdk-network-client@npm:^1.10.0":
version: 1.11.0
resolution: "@openzeppelin/defender-sdk-network-client@npm:1.11.0"
dependencies:
"@openzeppelin/defender-sdk-base-client": "npm:^1.11.0"
axios: "npm:^1.6.7"
lodash: "npm:^4.17.21"
checksum: 10/be89c738797016cb9561d371563af506bcfb3ea283454e796116754e044d583b787feaf62e2b82403c1ee4f0e575f0091a03891b883964a76647a383af2470b2
languageName: node
linkType: hard
"@openzeppelin/hardhat-upgrades@npm:^3.0.4":
version: 3.0.5
resolution: "@openzeppelin/hardhat-upgrades@npm:3.0.5"
dependencies:
"@openzeppelin/defender-admin-client": "npm:^1.52.0"
"@openzeppelin/defender-base-client": "npm:^1.52.0"
"@openzeppelin/defender-sdk-base-client": "npm:^1.10.0"
"@openzeppelin/defender-sdk-deploy-client": "npm:^1.10.0"
"@openzeppelin/defender-sdk-network-client": "npm:^1.10.0"
"@openzeppelin/upgrades-core": "npm:^1.32.0"
chalk: "npm:^4.1.0"
debug: "npm:^4.1.1"
ethereumjs-util: "npm:^7.1.5"
proper-lockfile: "npm:^4.1.1"
undici: "npm:^6.0.0"
peerDependencies:
"@nomicfoundation/hardhat-ethers": ^3.0.0
"@nomicfoundation/hardhat-verify": ^2.0.0
ethers: ^6.6.0
hardhat: ^2.0.2
peerDependenciesMeta:
"@nomicfoundation/hardhat-verify":
optional: true
bin:
migrate-oz-cli-project: dist/scripts/migrate-oz-cli-project.js
checksum: 10/3e767beac91d35c8e691c40e8d574a22fb5dac2e96b4f922b52cdcf6351d05a2aa3ba31660c24d6555e4481a0ee1ba5c2794fbcfeda83e64ef549fccf3d9d73a
languageName: node
linkType: hard
"@openzeppelin/upgrades-core@npm:^1.32.0":
version: 1.32.5
resolution: "@openzeppelin/upgrades-core@npm:1.32.5"
dependencies:
cbor: "npm:^9.0.0"
chalk: "npm:^4.1.0"
compare-versions: "npm:^6.0.0"
debug: "npm:^4.1.1"
ethereumjs-util: "npm:^7.0.3"
minimist: "npm:^1.2.7"
proper-lockfile: "npm:^4.1.1"
solidity-ast: "npm:^0.4.51"
bin:
openzeppelin-upgrades-core: dist/cli/cli.js
checksum: 10/71d768046968dac866e5310bb2c1df0618cb2d84914f2889b94d54a32e1c2b6c3a288f00b07e0f233dc3cbc34e6e9a29b4c06dc3409c6f017832b5b050406190
languageName: node
linkType: hard
"@peculiar/asn1-android@npm:^2.3.3":
version: 2.3.10
resolution: "@peculiar/asn1-android@npm:2.3.10"
@@ -6499,6 +6353,7 @@ __metadata:
"@semaphore-protocol/contracts": "npm:4.0.0-beta.4"
"@semaphore-protocol/core": "npm:4.0.0-beta.4"
"@semaphore-protocol/hardhat": "npm:4.0.0-beta.4"
"@semaphore-protocol/utils": "npm:4.0.0-beta.4"
"@typechain/ethers-v6": "npm:^0.5.0"
"@typechain/hardhat": "npm:^9.0.0"
"@types/chai": "npm:^4.2.0"
@@ -6597,6 +6452,7 @@ __metadata:
dependencies:
"@rollup/plugin-json": "npm:^6.1.0"
"@rollup/plugin-typescript": "npm:^11.1.6"
"@semaphore-protocol/utils": "npm:4.0.0-beta.4"
axios: "npm:1.6.6"
ethers: "npm:6.11.0"
rimraf: "npm:^5.0.5"
@@ -6696,6 +6552,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@semaphore-protocol/utils@workspace:packages/utils"
dependencies:
"@rollup/plugin-json": "npm:^6.1.0"
"@rollup/plugin-typescript": "npm:^11.1.6"
ethers: "npm:^6.11.1"
rimraf: "npm:^5.0.5"
@@ -6980,15 +6837,6 @@ __metadata:
languageName: node
linkType: hard
"@smithy/types@npm:^2.12.0":
version: 2.12.0
resolution: "@smithy/types@npm:2.12.0"
dependencies:
tslib: "npm:^2.6.2"
checksum: 10/2fb459b10d0c51d10da92e9d4b1551c1312dfb2a4739c4aeaeab703e8b35260a87ebc0c1cbb8a1deba669369ae7addab4eb81d99c70d0021b13cd26050a8c9b8
languageName: node
linkType: hard
"@solidity-parser/parser@npm:^0.14.0":
version: 0.14.5
resolution: "@solidity-parser/parser@npm:0.14.5"
@@ -9137,19 +8985,6 @@ __metadata:
languageName: node
linkType: hard
"amazon-cognito-identity-js@npm:^6.0.1, amazon-cognito-identity-js@npm:^6.3.6":
version: 6.3.12
resolution: "amazon-cognito-identity-js@npm:6.3.12"
dependencies:
"@aws-crypto/sha256-js": "npm:1.2.2"
buffer: "npm:4.9.2"
fast-base64-decode: "npm:^1.0.0"
isomorphic-unfetch: "npm:^3.0.0"
js-cookie: "npm:^2.2.1"
checksum: 10/524953a6d4c49187f14d39919a8b0c73d3ff47cbab9884dea83a339edb9aff3e9f9b62c1d52706101f8277ec23a562f857795e1246ca8b6b37f4a8afeb64df0e
languageName: node
linkType: hard
"amdefine@npm:>=0.0.4":
version: 1.0.1
resolution: "amdefine@npm:1.0.1"
@@ -9462,7 +9297,7 @@ __metadata:
languageName: node
linkType: hard
"array.prototype.findlast@npm:^1.2.2, array.prototype.findlast@npm:^1.2.4":
"array.prototype.findlast@npm:^1.2.4":
version: 1.2.4
resolution: "array.prototype.findlast@npm:1.2.4"
dependencies:
@@ -9671,15 +9506,6 @@ __metadata:
languageName: node
linkType: hard
"async-retry@npm:^1.3.3":
version: 1.3.3
resolution: "async-retry@npm:1.3.3"
dependencies:
retry: "npm:0.13.1"
checksum: 10/38a7152ff7265a9321ea214b9c69e8224ab1febbdec98efbbde6e562f17ff68405569b796b1c5271f354aef8783665d29953f051f68c1fc45306e61aec82fdc4
languageName: node
linkType: hard
"async@npm:1.x":
version: 1.5.2
resolution: "async@npm:1.5.2"
@@ -9776,7 +9602,7 @@ __metadata:
languageName: node
linkType: hard
"axios@npm:^1.4.0, axios@npm:^1.5.1, axios@npm:^1.6.7":
"axios@npm:^1.5.1, axios@npm:^1.6.7":
version: 1.6.8
resolution: "axios@npm:1.6.8"
dependencies:
@@ -9986,7 +9812,7 @@ __metadata:
languageName: node
linkType: hard
"base64-js@npm:^1.0.2, base64-js@npm:^1.3.1":
"base64-js@npm:^1.3.1":
version: 1.5.1
resolution: "base64-js@npm:1.5.1"
checksum: 10/669632eb3745404c2f822a18fc3a0122d2f9a7a13f7fb8b5823ee19d1d2ff9ee5b52c53367176ea4ad093c332fd5ab4bd0ebae5a8e27917a4105a4cfc86b1005
@@ -10392,17 +10218,6 @@ __metadata:
languageName: node
linkType: hard
"buffer@npm:4.9.2":
version: 4.9.2
resolution: "buffer@npm:4.9.2"
dependencies:
base64-js: "npm:^1.0.2"
ieee754: "npm:^1.1.4"
isarray: "npm:^1.0.0"
checksum: 10/4852a455e167bc8ca580c3c585176bbe0931c9929aeb68f3e0b49adadcb4e513fd0922a43efdf67ddb2e8785bbe8254ae17f4b69038dd06329ee9e3283c8508f
languageName: node
linkType: hard
"buffer@npm:6.0.3, buffer@npm:^6.0.1, buffer@npm:^6.0.3":
version: 6.0.3
resolution: "buffer@npm:6.0.3"
@@ -10713,15 +10528,6 @@ __metadata:
languageName: node
linkType: hard
"cbor@npm:^9.0.0":
version: 9.0.2
resolution: "cbor@npm:9.0.2"
dependencies:
nofilter: "npm:^3.1.0"
checksum: 10/a64f7d4dafed933adeafe7745e2ce9f39a2e669eba73db96de6bd1b39c2dbde4bdd51d0240beed179cc429a7dc8653c8d7c991c5addb9f4e0cee8cd167d87116
languageName: node
linkType: hard
"cborg@npm:^1.5.4, cborg@npm:^1.6.0":
version: 1.10.2
resolution: "cborg@npm:1.10.2"
@@ -11613,13 +11419,6 @@ __metadata:
languageName: node
linkType: hard
"compare-versions@npm:^6.0.0":
version: 6.1.0
resolution: "compare-versions@npm:6.1.0"
checksum: 10/20f349e7f8ad784704c68265f4e660e2abbe2c3d5c75793184fccb85f0c5c0263260e01fdd4488376f6b74b0f069e16c9684463f7316b075716fb1581eb36b77
languageName: node
linkType: hard
"compressible@npm:~2.0.16":
version: 2.0.18
resolution: "compressible@npm:2.0.18"
@@ -14242,7 +14041,7 @@ __metadata:
languageName: node
linkType: hard
"ethereumjs-util@npm:^7.0.3, ethereumjs-util@npm:^7.1.0, ethereumjs-util@npm:^7.1.4, ethereumjs-util@npm:^7.1.5":
"ethereumjs-util@npm:^7.1.0, ethereumjs-util@npm:^7.1.4":
version: 7.1.5
resolution: "ethereumjs-util@npm:7.1.5"
dependencies:
@@ -14581,13 +14380,6 @@ __metadata:
languageName: node
linkType: hard
"fast-base64-decode@npm:^1.0.0":
version: 1.0.0
resolution: "fast-base64-decode@npm:1.0.0"
checksum: 10/4c59eb1775a7f132333f296c5082476fdcc8f58d023c42ed6d378d2e2da4c328c7a71562f271181a725dd17cdaa8f2805346cc330cdbad3b8e4b9751508bd0a3
languageName: node
linkType: hard
"fast-decode-uri-component@npm:^1.0.1":
version: 1.0.1
resolution: "fast-decode-uri-component@npm:1.0.1"
@@ -16806,7 +16598,7 @@ __metadata:
languageName: node
linkType: hard
"ieee754@npm:^1.1.13, ieee754@npm:^1.1.4, ieee754@npm:^1.2.1":
"ieee754@npm:^1.1.13, ieee754@npm:^1.2.1":
version: 1.2.1
resolution: "ieee754@npm:1.2.1"
checksum: 10/d9f2557a59036f16c282aaeb107832dc957a93d73397d89bbad4eb1130560560eb695060145e8e6b3b498b15ab95510226649a0b8f52ae06583575419fe10fc4
@@ -17876,13 +17668,6 @@ __metadata:
languageName: node
linkType: hard
"isarray@npm:^1.0.0, isarray@npm:~1.0.0":
version: 1.0.0
resolution: "isarray@npm:1.0.0"
checksum: 10/f032df8e02dce8ec565cf2eb605ea939bdccea528dbcf565cdf92bfa2da9110461159d86a537388ef1acef8815a330642d7885b29010e8f7eac967c9993b65ab
languageName: node
linkType: hard
"isarray@npm:^2.0.5":
version: 2.0.5
resolution: "isarray@npm:2.0.5"
@@ -17890,6 +17675,13 @@ __metadata:
languageName: node
linkType: hard
"isarray@npm:~1.0.0":
version: 1.0.0
resolution: "isarray@npm:1.0.0"
checksum: 10/f032df8e02dce8ec565cf2eb605ea939bdccea528dbcf565cdf92bfa2da9110461159d86a537388ef1acef8815a330642d7885b29010e8f7eac967c9993b65ab
languageName: node
linkType: hard
"isexe@npm:^2.0.0":
version: 2.0.0
resolution: "isexe@npm:2.0.0"
@@ -17918,16 +17710,6 @@ __metadata:
languageName: node
linkType: hard
"isomorphic-unfetch@npm:^3.0.0":
version: 3.1.0
resolution: "isomorphic-unfetch@npm:3.1.0"
dependencies:
node-fetch: "npm:^2.6.1"
unfetch: "npm:^4.2.0"
checksum: 10/4e760d9a3f94b42c59fe5c6b53202469cecd864875dcac927668b1f43eb57698422a0086fadde47f7815752c4f4e30ecf1ce9a0eb09c44a871a2484dbc580b39
languageName: node
linkType: hard
"isomorphic-ws@npm:^4.0.1":
version: 4.0.1
resolution: "isomorphic-ws@npm:4.0.1"
@@ -18624,13 +18406,6 @@ __metadata:
languageName: node
linkType: hard
"js-cookie@npm:^2.2.1":
version: 2.2.1
resolution: "js-cookie@npm:2.2.1"
checksum: 10/4387f5f5691cb96ca9ff8852c589d3012b53f484fda68630a39e20cabc6c5b740f09225e23233ba56cd9de6ebe300a23d20b2c7315f10c309ad5a89fd8c4990b
languageName: node
linkType: hard
"js-sha3@npm:0.8.0, js-sha3@npm:^0.8.0":
version: 0.8.0
resolution: "js-sha3@npm:0.8.0"
@@ -19315,7 +19090,7 @@ __metadata:
languageName: node
linkType: hard
"lodash@npm:4.17.21, lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21":
"lodash@npm:4.17.21, lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.20, lodash@npm:^4.17.21":
version: 4.17.21
resolution: "lodash@npm:4.17.21"
checksum: 10/c08619c038846ea6ac754abd6dd29d2568aa705feb69339e836dfa8d8b09abbb2f859371e86863eda41848221f9af43714491467b5b0299122431e202bb0c532
@@ -20677,7 +20452,7 @@ __metadata:
languageName: node
linkType: hard
"minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6, minimist@npm:^1.2.7":
"minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6":
version: 1.2.8
resolution: "minimist@npm:1.2.8"
checksum: 10/908491b6cc15a6c440ba5b22780a0ba89b9810e1aea684e253e43c4e3b8d56ec1dcdd7ea96dde119c29df59c936cde16062159eae4225c691e19c70b432b6e6f
@@ -20900,6 +20675,7 @@ __metadata:
"@semaphore-protocol/contracts": "npm:4.0.0-beta.4"
"@semaphore-protocol/core": "npm:4.0.0-beta.4"
"@semaphore-protocol/hardhat": "npm:4.0.0-beta.4"
"@semaphore-protocol/utils": "npm:4.0.0-beta.4"
"@typechain/ethers-v6": "npm:^0.5.0"
"@typechain/hardhat": "npm:^9.0.0"
"@types/chai": "npm:^4.2.0"
@@ -20961,6 +20737,7 @@ __metadata:
"@semaphore-protocol/contracts": "npm:4.0.0-beta.4"
"@semaphore-protocol/core": "npm:4.0.0-beta.4"
"@semaphore-protocol/hardhat": "npm:4.0.0-beta.4"
"@semaphore-protocol/utils": "npm:4.0.0-beta.4"
"@typechain/ethers-v6": "npm:^0.5.0"
"@typechain/hardhat": "npm:^9.0.0"
"@types/chai": "npm:^4.2.0"
@@ -21370,7 +21147,7 @@ __metadata:
languageName: node
linkType: hard
"node-fetch@npm:^2.6.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.12, node-fetch@npm:^2.6.8":
"node-fetch@npm:^2.6.12, node-fetch@npm:^2.6.8":
version: 2.7.0
resolution: "node-fetch@npm:2.7.0"
dependencies:
@@ -23258,17 +23035,6 @@ __metadata:
languageName: node
linkType: hard
"proper-lockfile@npm:^4.1.1":
version: 4.1.2
resolution: "proper-lockfile@npm:4.1.2"
dependencies:
graceful-fs: "npm:^4.2.4"
retry: "npm:^0.12.0"
signal-exit: "npm:^3.0.2"
checksum: 10/000a4875f543f591872b36ca94531af8a6463ddb0174f41c0b004d19e231d7445268b422ff1ea595e43d238655c702250cd3d27f408e7b9d97b56f1533ba26bf
languageName: node
linkType: hard
"property-information@npm:^5.0.0":
version: 5.6.0
resolution: "property-information@npm:5.6.0"
@@ -24518,13 +24284,6 @@ __metadata:
languageName: node
linkType: hard
"retry@npm:0.13.1, retry@npm:^0.13.1":
version: 0.13.1
resolution: "retry@npm:0.13.1"
checksum: 10/6125ec2e06d6e47e9201539c887defba4e47f63471db304c59e4b82fc63c8e89ca06a77e9d34939a9a42a76f00774b2f46c0d4a4cbb3e287268bd018ed69426d
languageName: node
linkType: hard
"retry@npm:^0.12.0":
version: 0.12.0
resolution: "retry@npm:0.12.0"
@@ -24532,6 +24291,13 @@ __metadata:
languageName: node
linkType: hard
"retry@npm:^0.13.1":
version: 0.13.1
resolution: "retry@npm:0.13.1"
checksum: 10/6125ec2e06d6e47e9201539c887defba4e47f63471db304c59e4b82fc63c8e89ca06a77e9d34939a9a42a76f00774b2f46c0d4a4cbb3e287268bd018ed69426d
languageName: node
linkType: hard
"reusify@npm:^1.0.4":
version: 1.0.4
resolution: "reusify@npm:1.0.4"
@@ -25003,9 +24769,9 @@ __metadata:
"@nomicfoundation/hardhat-ethers": "npm:^3.0.0"
"@nomicfoundation/hardhat-network-helpers": "npm:^1.0.0"
"@nomicfoundation/hardhat-toolbox": "npm:^4.0.0"
"@nomicfoundation/hardhat-verify": "npm:^2.0.0"
"@openzeppelin/hardhat-upgrades": "npm:^3.0.4"
"@nomicfoundation/hardhat-verify": "npm:^2.0.5"
"@semaphore-protocol/core": "workspace:packages/core"
"@semaphore-protocol/utils": "workspace:packages/utils"
"@typechain/ethers-v6": "npm:^0.5.0"
"@typechain/hardhat": "npm:^9.0.0"
"@types/chai": "npm:^4.2.0"
@@ -25035,6 +24801,7 @@ __metadata:
"@docusaurus/preset-classic": "npm:3.1.1"
"@docusaurus/tsconfig": "npm:3.1.1"
"@mdx-js/react": "npm:^3.0.0"
"@semaphore-protocol/utils": "npm:4.0.0-beta.4"
"@svgr/webpack": "npm:^5.5.0"
"@types/react": "npm:^18.2.29"
clsx: "npm:^1.2.1"
@@ -25094,6 +24861,7 @@ __metadata:
dependencies:
"@graphprotocol/graph-cli": "npm:0.67.0"
"@graphprotocol/graph-ts": "npm:0.32.0"
"@semaphore-protocol/utils": "workspace:packages/utils"
"@types/mustache": "npm:^4.2.2"
matchstick-as: "npm:0.5.0"
mustache: "npm:^4.2.0"
@@ -25713,15 +25481,6 @@ __metadata:
languageName: node
linkType: hard
"solidity-ast@npm:^0.4.51":
version: 0.4.56
resolution: "solidity-ast@npm:0.4.56"
dependencies:
array.prototype.findlast: "npm:^1.2.2"
checksum: 10/65d699f6582fa6e08da7ecd66ec5903cf12ca0b9b62643e85a66f373a1958491288ae5d83694d0e2978d036f1431df861422dc7d1d8adf9721fffae7b8bb2e3e
languageName: node
linkType: hard
"solidity-comments-extractor@npm:^0.0.8":
version: 0.0.8
resolution: "solidity-comments-extractor@npm:0.0.8"
@@ -27058,7 +26817,7 @@ __metadata:
languageName: node
linkType: hard
"tslib@npm:^1.11.1, tslib@npm:^1.8.1, tslib@npm:^1.9.3":
"tslib@npm:^1.8.1, tslib@npm:^1.9.3":
version: 1.14.1
resolution: "tslib@npm:1.14.1"
checksum: 10/7dbf34e6f55c6492637adb81b555af5e3b4f9cc6b998fb440dac82d3b42bdc91560a35a5fb75e20e24a076c651438234da6743d139e4feabf0783f3cdfe1dddb
@@ -27473,20 +27232,6 @@ __metadata:
languageName: node
linkType: hard
"undici@npm:^6.0.0":
version: 6.9.0
resolution: "undici@npm:6.9.0"
checksum: 10/ee227517586f96b73db3b7a24387f101d191df6a6395ec0199688d6e56195dbe8c9d3456be2fa4a70af30fb1a9a905142826f9bf89c328dec842f00b55e9e5c2
languageName: node
linkType: hard
"unfetch@npm:^4.2.0":
version: 4.2.0
resolution: "unfetch@npm:4.2.0"
checksum: 10/d4924178060b6828d858acef3ce2baea69acd3f3f9e2429fd503a0ed0d2b1ed0ee107786aceadfd167ce884fad12d22b5288eb865a3ea036979b8358b8555c9a
languageName: node
linkType: hard
"unicode-canonical-property-names-ecmascript@npm:^2.0.0":
version: 2.0.0
resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0"