@semaphore-protocol/hardhat 3.1.0 → 3.2.0
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/README.md +9 -4
- package/dist/index.mjs +52 -1
- package/dist/index.node.js +52 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/tasks/deploy-semaphore-verifier.d.ts +1 -0
- package/package.json +45 -45
- package/src/index.ts +1 -0
- package/src/tasks/deploy-semaphore-verifier.ts +38 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<h1 align="center">
|
|
3
3
|
Semaphore Hardhat plugin
|
|
4
4
|
</h1>
|
|
5
|
-
<p align="center">A Semaphore Hardhat plugin to deploy
|
|
5
|
+
<p align="center">A Semaphore Hardhat plugin to deploy Semaphore contracts.</p>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
🔎 Issues
|
|
41
41
|
</a>
|
|
42
42
|
<span> | </span>
|
|
43
|
-
<a href="https://
|
|
43
|
+
<a href="https://semaphore.appliedzkp.org/discord">
|
|
44
44
|
🗣️ Chat & Support
|
|
45
45
|
</a>
|
|
46
46
|
</h4>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
49
|
-
| This Hardhat plugin provides two simple tasks that can be used to deploy
|
|
50
|
-
|
|
|
49
|
+
| This Hardhat plugin provides two simple tasks that can be used to deploy Semaphore contracts without any additional configuration. |
|
|
50
|
+
| ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
51
|
|
|
52
52
|
## 🛠 Install
|
|
53
53
|
|
|
@@ -92,6 +92,11 @@ task("deploy", "Deploy a Greeter contract")
|
|
|
92
92
|
logs
|
|
93
93
|
})
|
|
94
94
|
|
|
95
|
+
// Or:
|
|
96
|
+
// const { semaphoreVerifier } = await run("deploy:semaphore-verifier", {
|
|
97
|
+
// logs
|
|
98
|
+
// })
|
|
99
|
+
|
|
95
100
|
const Greeter = await ethers.getContractFactory("Greeter")
|
|
96
101
|
|
|
97
102
|
const greeter = await Greeter.deploy(semaphore.address)
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/hardhat
|
|
3
|
-
* @version 3.
|
|
3
|
+
* @version 3.2.0
|
|
4
4
|
* @file A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.
|
|
5
5
|
* @copyright Ethereum Foundation 2022
|
|
6
6
|
* @license MIT
|
|
@@ -188,6 +188,57 @@ task("deploy:semaphore", "Deploy a Semaphore contract")
|
|
|
188
188
|
});
|
|
189
189
|
});
|
|
190
190
|
|
|
191
|
+
task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
192
|
+
.addOptionalParam("pairing", "Pairing library address", undefined, types.string)
|
|
193
|
+
.addOptionalParam("logs", "Print the logs", true, types.boolean)
|
|
194
|
+
.setAction(function (_a, _b) {
|
|
195
|
+
var logs = _a.logs, pairingAddress = _a.pairing;
|
|
196
|
+
var ethers = _b.ethers;
|
|
197
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
198
|
+
var PairingFactory, pairing, SemaphoreVerifierFactory, semaphoreVerifier;
|
|
199
|
+
return __generator(this, function (_c) {
|
|
200
|
+
switch (_c.label) {
|
|
201
|
+
case 0:
|
|
202
|
+
if (!!pairingAddress) return [3 /*break*/, 4];
|
|
203
|
+
return [4 /*yield*/, ethers.getContractFactory("Pairing")];
|
|
204
|
+
case 1:
|
|
205
|
+
PairingFactory = _c.sent();
|
|
206
|
+
return [4 /*yield*/, PairingFactory.deploy()];
|
|
207
|
+
case 2:
|
|
208
|
+
pairing = _c.sent();
|
|
209
|
+
return [4 /*yield*/, pairing.deployed()];
|
|
210
|
+
case 3:
|
|
211
|
+
_c.sent();
|
|
212
|
+
if (logs) {
|
|
213
|
+
console.info("Pairing library has been deployed to: ".concat(pairing.address));
|
|
214
|
+
}
|
|
215
|
+
pairingAddress = pairing.address;
|
|
216
|
+
_c.label = 4;
|
|
217
|
+
case 4: return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier", {
|
|
218
|
+
libraries: {
|
|
219
|
+
Pairing: pairingAddress
|
|
220
|
+
}
|
|
221
|
+
})];
|
|
222
|
+
case 5:
|
|
223
|
+
SemaphoreVerifierFactory = _c.sent();
|
|
224
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
225
|
+
case 6:
|
|
226
|
+
semaphoreVerifier = _c.sent();
|
|
227
|
+
return [4 /*yield*/, semaphoreVerifier.deployed()];
|
|
228
|
+
case 7:
|
|
229
|
+
_c.sent();
|
|
230
|
+
if (logs) {
|
|
231
|
+
console.info("SemaphoreVerifier contract has been deployed to: ".concat(semaphoreVerifier.address));
|
|
232
|
+
}
|
|
233
|
+
return [2 /*return*/, {
|
|
234
|
+
semaphoreVerifier: semaphoreVerifier,
|
|
235
|
+
pairingAddress: pairingAddress
|
|
236
|
+
}];
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
191
242
|
extendConfig(function (config, userConfig) {
|
|
192
243
|
var _a;
|
|
193
244
|
config.dependencyCompiler.paths = [
|
package/dist/index.node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/hardhat
|
|
3
|
-
* @version 3.
|
|
3
|
+
* @version 3.2.0
|
|
4
4
|
* @file A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.
|
|
5
5
|
* @copyright Ethereum Foundation 2022
|
|
6
6
|
* @license MIT
|
|
@@ -190,6 +190,57 @@ config.task("deploy:semaphore", "Deploy a Semaphore contract")
|
|
|
190
190
|
});
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
+
config.task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
194
|
+
.addOptionalParam("pairing", "Pairing library address", undefined, config.types.string)
|
|
195
|
+
.addOptionalParam("logs", "Print the logs", true, config.types.boolean)
|
|
196
|
+
.setAction(function (_a, _b) {
|
|
197
|
+
var logs = _a.logs, pairingAddress = _a.pairing;
|
|
198
|
+
var ethers = _b.ethers;
|
|
199
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
200
|
+
var PairingFactory, pairing, SemaphoreVerifierFactory, semaphoreVerifier;
|
|
201
|
+
return __generator(this, function (_c) {
|
|
202
|
+
switch (_c.label) {
|
|
203
|
+
case 0:
|
|
204
|
+
if (!!pairingAddress) return [3 /*break*/, 4];
|
|
205
|
+
return [4 /*yield*/, ethers.getContractFactory("Pairing")];
|
|
206
|
+
case 1:
|
|
207
|
+
PairingFactory = _c.sent();
|
|
208
|
+
return [4 /*yield*/, PairingFactory.deploy()];
|
|
209
|
+
case 2:
|
|
210
|
+
pairing = _c.sent();
|
|
211
|
+
return [4 /*yield*/, pairing.deployed()];
|
|
212
|
+
case 3:
|
|
213
|
+
_c.sent();
|
|
214
|
+
if (logs) {
|
|
215
|
+
console.info("Pairing library has been deployed to: ".concat(pairing.address));
|
|
216
|
+
}
|
|
217
|
+
pairingAddress = pairing.address;
|
|
218
|
+
_c.label = 4;
|
|
219
|
+
case 4: return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier", {
|
|
220
|
+
libraries: {
|
|
221
|
+
Pairing: pairingAddress
|
|
222
|
+
}
|
|
223
|
+
})];
|
|
224
|
+
case 5:
|
|
225
|
+
SemaphoreVerifierFactory = _c.sent();
|
|
226
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
227
|
+
case 6:
|
|
228
|
+
semaphoreVerifier = _c.sent();
|
|
229
|
+
return [4 /*yield*/, semaphoreVerifier.deployed()];
|
|
230
|
+
case 7:
|
|
231
|
+
_c.sent();
|
|
232
|
+
if (logs) {
|
|
233
|
+
console.info("SemaphoreVerifier contract has been deployed to: ".concat(semaphoreVerifier.address));
|
|
234
|
+
}
|
|
235
|
+
return [2 /*return*/, {
|
|
236
|
+
semaphoreVerifier: semaphoreVerifier,
|
|
237
|
+
pairingAddress: pairingAddress
|
|
238
|
+
}];
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
|
|
193
244
|
config.extendConfig(function (config, userConfig) {
|
|
194
245
|
var _a;
|
|
195
246
|
config.dependencyCompiler.paths = [
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
2
|
+
"name": "@semaphore-protocol/hardhat",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.node.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
"import": "./dist/index.mjs",
|
|
9
|
+
"require": "./dist/index.node.js"
|
|
10
|
+
},
|
|
11
|
+
"types": "dist/types/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/",
|
|
14
|
+
"src/",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"repository": "https://github.com/semaphore-protocol/semaphore",
|
|
19
|
+
"homepage": "https://github.com/semaphore-protocol/semaphore/tree/main/packages/hardhat",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/semaphore-protocol/semaphore.git/issues"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
|
25
|
+
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
|
26
|
+
"prepublishOnly": "yarn build"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"hardhat": "^2.0.0",
|
|
33
|
+
"rollup-plugin-cleanup": "^3.2.1",
|
|
34
|
+
"rollup-plugin-typescript2": "^0.31.2"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"hardhat": "^2.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@nomiclabs/hardhat-ethers": "^2.1.1",
|
|
41
|
+
"@semaphore-protocol/contracts": "3.2.0",
|
|
42
|
+
"circomlibjs": "^0.0.8",
|
|
43
|
+
"ethers": "^5.7.1",
|
|
44
|
+
"hardhat-dependency-compiler": "^1.1.3"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { HardhatConfig, HardhatUserConfig } from "hardhat/types"
|
|
|
4
4
|
import "hardhat-dependency-compiler"
|
|
5
5
|
import "@nomiclabs/hardhat-ethers"
|
|
6
6
|
import "./tasks/deploy-semaphore"
|
|
7
|
+
import "./tasks/deploy-semaphore-verifier"
|
|
7
8
|
|
|
8
9
|
extendConfig((config: HardhatConfig, userConfig: Readonly<HardhatUserConfig>) => {
|
|
9
10
|
config.dependencyCompiler.paths = [
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { task, types } from "hardhat/config"
|
|
2
|
+
|
|
3
|
+
task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
4
|
+
.addOptionalParam<boolean>("pairing", "Pairing library address", undefined, types.string)
|
|
5
|
+
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)
|
|
6
|
+
.setAction(async ({ logs, pairing: pairingAddress }, { ethers }): Promise<any> => {
|
|
7
|
+
if (!pairingAddress) {
|
|
8
|
+
const PairingFactory = await ethers.getContractFactory("Pairing")
|
|
9
|
+
const pairing = await PairingFactory.deploy()
|
|
10
|
+
|
|
11
|
+
await pairing.deployed()
|
|
12
|
+
|
|
13
|
+
if (logs) {
|
|
14
|
+
console.info(`Pairing library has been deployed to: ${pairing.address}`)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
pairingAddress = pairing.address
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const SemaphoreVerifierFactory = await ethers.getContractFactory("SemaphoreVerifier", {
|
|
21
|
+
libraries: {
|
|
22
|
+
Pairing: pairingAddress
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const semaphoreVerifier = await SemaphoreVerifierFactory.deploy()
|
|
27
|
+
|
|
28
|
+
await semaphoreVerifier.deployed()
|
|
29
|
+
|
|
30
|
+
if (logs) {
|
|
31
|
+
console.info(`SemaphoreVerifier contract has been deployed to: ${semaphoreVerifier.address}`)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
semaphoreVerifier,
|
|
36
|
+
pairingAddress
|
|
37
|
+
}
|
|
38
|
+
})
|