@semaphore-protocol/cli-template-contracts-hardhat 4.0.0-beta.4 → 4.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env.example CHANGED
@@ -1,4 +1,3 @@
1
- INFURA_API_KEY=
2
1
  ETHEREUM_PRIVATE_KEY=
3
2
  REPORT_GAS=false
4
3
  ETHERSCAN_API_KEY=
@@ -8,11 +8,10 @@ contract Feedback {
8
8
 
9
9
  uint256 public groupId;
10
10
 
11
- constructor(address semaphoreAddress, uint256 _groupId) {
11
+ constructor(address semaphoreAddress) {
12
12
  semaphore = ISemaphore(semaphoreAddress);
13
- groupId = _groupId;
14
13
 
15
- semaphore.createGroup(groupId, address(this));
14
+ groupId = semaphore.createGroup();
16
15
  }
17
16
 
18
17
  function joinGroup(uint256 identityCommitment) external {
package/files.tgz CHANGED
Binary file
package/hardhat.config.ts CHANGED
@@ -1,54 +1,17 @@
1
- import { HardhatUserConfig } from "hardhat/config"
2
- import { NetworksUserConfig } from "hardhat/types"
3
1
  import "@nomicfoundation/hardhat-toolbox"
4
- import "dotenv/config"
5
2
  import "@semaphore-protocol/hardhat"
3
+ import { getHardhatNetworks } from "@semaphore-protocol/utils"
4
+ import "dotenv/config"
5
+ import { HardhatUserConfig } from "hardhat/config"
6
6
  import "./tasks/deploy"
7
7
 
8
- function getNetworks(): NetworksUserConfig {
9
- if (!process.env.INFURA_API_KEY || !process.env.ETHEREUM_PRIVATE_KEY) {
10
- return {}
11
- }
12
-
13
- const accounts = [`0x${process.env.ETHEREUM_PRIVATE_KEY}`]
14
- const infuraApiKey = process.env.INFURA_API_KEY
15
-
16
- return {
17
- sepolia: {
18
- url: `https://sepolia.infura.io/v3/${infuraApiKey}`,
19
- chainId: 11155111,
20
- accounts
21
- },
22
- mumbai: {
23
- url: `https://polygon-mumbai.infura.io/v3/${infuraApiKey}`,
24
- chainId: 80001,
25
- accounts
26
- },
27
- "optimism-sepolia": {
28
- url: `https://optimism-sepolia.infura.io/v3/${infuraApiKey}`,
29
- chainId: 11155420,
30
- accounts
31
- },
32
- "arbitrum-sepolia": {
33
- url: "https://sepolia-rollup.arbitrum.io/rpc",
34
- chainId: 421614,
35
- accounts
36
- },
37
- arbitrum: {
38
- url: "https://arb1.arbitrum.io/rpc",
39
- chainId: 42161,
40
- accounts
41
- }
42
- }
43
- }
44
-
45
8
  const config: HardhatUserConfig = {
46
9
  solidity: "0.8.23",
47
10
  networks: {
48
11
  hardhat: {
49
12
  chainId: 1337
50
13
  },
51
- ...getNetworks()
14
+ ...getHardhatNetworks(process.env.ETHEREUM_PRIVATE_KEY)
52
15
  },
53
16
  gasReporter: {
54
17
  currency: "USD",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semaphore-protocol/cli-template-contracts-hardhat",
3
- "version": "4.0.0-beta.4",
3
+ "version": "4.0.0-beta.6",
4
4
  "description": "Semaphore Hardhat template.",
5
5
  "license": "Unlicense",
6
6
  "files": [
@@ -41,8 +41,9 @@
41
41
  "@nomicfoundation/hardhat-network-helpers": "^1.0.0",
42
42
  "@nomicfoundation/hardhat-toolbox": "^4.0.0",
43
43
  "@nomicfoundation/hardhat-verify": "^2.0.0",
44
- "@semaphore-protocol/core": "4.0.0-beta.4",
45
- "@semaphore-protocol/hardhat": "4.0.0-beta.4",
44
+ "@semaphore-protocol/core": "4.0.0-beta.6",
45
+ "@semaphore-protocol/hardhat": "4.0.0-beta.6",
46
+ "@semaphore-protocol/utils": "4.0.0-beta.6",
46
47
  "@typechain/ethers-v6": "^0.5.0",
47
48
  "@typechain/hardhat": "^9.0.0",
48
49
  "@types/chai": "^4.2.0",
@@ -70,7 +71,7 @@
70
71
  "typescript": "^5.3.3"
71
72
  },
72
73
  "dependencies": {
73
- "@semaphore-protocol/contracts": "4.0.0-beta.4"
74
+ "@semaphore-protocol/contracts": "4.0.0-beta.6"
74
75
  },
75
76
  "packageManager": "yarn@4.1.0"
76
77
  }
package/tasks/deploy.ts CHANGED
@@ -2,9 +2,8 @@ import { task, types } from "hardhat/config"
2
2
 
3
3
  task("deploy", "Deploy a Feedback contract")
4
4
  .addOptionalParam("semaphore", "Semaphore contract address", undefined, types.string)
5
- .addOptionalParam("group", "Group id", "42", types.string)
6
5
  .addOptionalParam("logs", "Print the logs", true, types.boolean)
7
- .setAction(async ({ logs, semaphore: semaphoreAddress, group: groupId }, { ethers, run }) => {
6
+ .setAction(async ({ logs, semaphore: semaphoreAddress }, { ethers, run }) => {
8
7
  if (!semaphoreAddress) {
9
8
  const { semaphore } = await run("deploy:semaphore", {
10
9
  logs
@@ -13,13 +12,9 @@ task("deploy", "Deploy a Feedback contract")
13
12
  semaphoreAddress = await semaphore.getAddress()
14
13
  }
15
14
 
16
- if (!groupId) {
17
- groupId = process.env.GROUP_ID
18
- }
19
-
20
15
  const FeedbackFactory = await ethers.getContractFactory("Feedback")
21
16
 
22
- const feedbackContract = await FeedbackFactory.deploy(semaphoreAddress, groupId)
17
+ const feedbackContract = await FeedbackFactory.deploy(semaphoreAddress)
23
18
 
24
19
  if (logs) {
25
20
  console.info(`Feedback contract has been deployed to: ${await feedbackContract.getAddress()}`)
package/test/Feedback.ts CHANGED
@@ -9,8 +9,6 @@ import { Feedback, ISemaphore } from "../typechain-types"
9
9
 
10
10
  describe("Feedback", () => {
11
11
  async function deployFeedbackFixture() {
12
- const groupId = "42"
13
-
14
12
  const { semaphore } = await run("deploy:semaphore", {
15
13
  logs: false
16
14
  })
@@ -19,10 +17,11 @@ describe("Feedback", () => {
19
17
 
20
18
  const feedbackContract: Feedback = await run("deploy", {
21
19
  logs: false,
22
- group: groupId,
23
20
  semaphore: await semaphoreContract.getAddress()
24
21
  })
25
22
 
23
+ const groupId = await feedbackContract.groupId()
24
+
26
25
  return { semaphoreContract, feedbackContract, groupId }
27
26
  }
28
27