Vojtech Simetka 657b850a4e
feat: add group verification and message posting through smart contract (#80)
Co-authored-by: Philippe Schommers <philippe@schommers.be>
2023-01-24 07:51:42 +01:00

28 lines
1.1 KiB
TypeScript

import { task, types } from "hardhat/config"
task("deploy", "Deploy a GlobalAnonymousFeed contract")
.addOptionalParam("semaphore", "Semaphore contract address", undefined, types.string)
.addOptionalParam("group", "Group id", 42, types.int)
.addOptionalParam("logs", "Print the logs", true, types.boolean)
.setAction(async ({ logs, semaphore: semaphoreAddress, group: groupId }, { ethers, run }) => {
if (!semaphoreAddress) {
const { semaphore } = await run("deploy:semaphore", {
logs
})
semaphoreAddress = semaphore.address
}
const globalAnonymousFeedFactory = await ethers.getContractFactory("GlobalAnonymousFeed")
const globalAnonymousFeedContract = await globalAnonymousFeedFactory.deploy(semaphoreAddress, groupId)
await globalAnonymousFeedContract.deployed()
if (logs) {
console.info(`GlobalAnonymousFeedContract contract has been deployed to: ${globalAnonymousFeedContract.address}`)
}
return globalAnonymousFeedContract
})