mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-09 14:48:12 -05:00
@@ -1,61 +0,0 @@
|
||||
import fs from "fs"
|
||||
import { run, hardhatArguments } from "hardhat"
|
||||
|
||||
async function main() {
|
||||
const deployedContracts: { name: string; address: string }[] = []
|
||||
|
||||
// Deploy verifiers.
|
||||
for (let treeDepth = 16; treeDepth <= 32; treeDepth++) {
|
||||
const { address } = await run("deploy:verifier", { depth: treeDepth })
|
||||
|
||||
deployedContracts.push({
|
||||
name: `Verifier${treeDepth}`,
|
||||
address
|
||||
})
|
||||
|
||||
if (
|
||||
hardhatArguments.network &&
|
||||
hardhatArguments.network !== "hardhat" &&
|
||||
hardhatArguments.network !== "localhost"
|
||||
) {
|
||||
// Verify verifier.
|
||||
await run("verify:verify", { address })
|
||||
}
|
||||
}
|
||||
|
||||
// Deploy Semaphore.
|
||||
const { address } = await run("deploy:semaphore", {
|
||||
verifiers: deployedContracts.map((c) => ({ merkleTreeDepth: c.name.substring(8), contractAddress: c.address }))
|
||||
})
|
||||
|
||||
if (
|
||||
hardhatArguments.network &&
|
||||
hardhatArguments.network !== "hardhat" &&
|
||||
hardhatArguments.network !== "localhost"
|
||||
) {
|
||||
// Verify Semaphore.
|
||||
await run("verify:verify", {
|
||||
address,
|
||||
constructorArguments: [
|
||||
deployedContracts.map((c) => ({ merkleTreeDepth: c.name.substring(8), contractAddress: c.address }))
|
||||
]
|
||||
})
|
||||
|
||||
deployedContracts.push({
|
||||
name: `Semaphore`,
|
||||
address
|
||||
})
|
||||
|
||||
fs.writeFileSync(
|
||||
`./deployed-contracts/${hardhatArguments.network}.json`,
|
||||
JSON.stringify(deployedContracts, null, 4)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
@@ -1,24 +0,0 @@
|
||||
import download from "download"
|
||||
import fs from "fs"
|
||||
import { config } from "../package.json"
|
||||
|
||||
async function main() {
|
||||
const snarkArtifactsPath = config.paths.build["snark-artifacts"]
|
||||
const url = `https://www.trusted-setup-pse.org/semaphore/${process.env.TREE_DEPTH}`
|
||||
|
||||
if (!fs.existsSync(snarkArtifactsPath)) {
|
||||
fs.mkdirSync(snarkArtifactsPath, { recursive: true })
|
||||
}
|
||||
|
||||
if (!fs.existsSync(`${snarkArtifactsPath}/semaphore.zkey`)) {
|
||||
await download(`${url}/semaphore.wasm`, snarkArtifactsPath)
|
||||
await download(`${url}/semaphore.zkey`, snarkArtifactsPath)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
Reference in New Issue
Block a user