@semaphore-protocol/hardhat
TypeScript icon, indicating that this package has built-in type declarations

4.12.0 • Public • Published

Semaphore Hardhat plugin

A Hardhat plugin to deploy Semaphore contracts.

NPM license NPM version Downloads Linter eslint Code style prettier

The Semaphore Hardhat plugin simplifies the deployment of Semaphore contracts, reducing setup time and complexity.

🛠 Install

npm or yarn

To install the Semaphore Hardhat plugin, use npm or yarn:

npm i @semaphore-protocol/hardhat

or yarn:

yarn add @semaphore-protocol/hardhat

📜 Usage

To use the plugin, import it in your Hardhat configuration file (hardhat.config.ts):

import "@semaphore-protocol/hardhat"
import "./tasks/deploy"

const hardhatConfig: HardhatUserConfig = {
    solidity: "0.8.4"
}

export default hardhatConfig

And use its tasks to create your own deploy task and deploy your contract with a Semaphore address.

import { task, types } from "hardhat/config"

task("deploy", "Deploy a Greeter contract")
    .addOptionalParam("logs", "Print the logs", true, types.boolean)
    .setAction(async ({ logs }, { ethers, run }) => {
        const { semaphore } = await run("deploy:semaphore", {
            logs
        })

        // Or:
        // const { semaphoreVerifier } = await run("deploy:semaphore-verifier", {
        //    logs
        // })

        const Greeter = await ethers.getContractFactory("Greeter")

        const greeter = await Greeter.deploy(semaphore.address)

        await greeter.deployed()

        if (logs) {
            console.log(`Greeter contract has been deployed to: ${greeter.address}`)
        }

        return greeter
    })

Deploying Contracts

Use the provided tasks to deploy your Semaphore contracts:

npx hardhat deploy

This command will deploy a Semaphore contract using the addresses provided or deploy necessary dependencies like Semaphore Verifier and Poseidon library.

Readme

Keywords

none

Package Sidebar

Install

npm i @semaphore-protocol/hardhat

Weekly Downloads

86

Version

4.12.0

License

MIT

Unpacked Size

17.9 kB

Total Files

10

Last publish

Collaborators

  • vplasencia