@semaphore-protocol/hardhat 4.0.0-beta.2 → 4.0.0-beta.3
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/dist/index.cjs +132 -156
- package/dist/index.js +132 -156
- package/package.json +6 -4
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/hardhat
|
|
3
|
-
* @version 4.0.0-beta.
|
|
3
|
+
* @version 4.0.0-beta.3
|
|
4
4
|
* @file A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.
|
|
5
5
|
* @copyright Ethereum Foundation 2024
|
|
6
6
|
* @license MIT
|
|
@@ -12,173 +12,149 @@ var config = require('hardhat/config');
|
|
|
12
12
|
require('hardhat-dependency-compiler');
|
|
13
13
|
require('@nomicfoundation/hardhat-ethers');
|
|
14
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
op = body.call(thisArg, _);
|
|
65
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
66
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function __spreadArray(to, from, pack) {
|
|
71
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
72
|
-
if (ar || !(i in from)) {
|
|
73
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
74
|
-
ar[i] = from[i];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
81
|
-
var e = new Error(message);
|
|
82
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
15
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function __generator(thisArg, body) {
|
|
25
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
26
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
27
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
28
|
+
function step(op) {
|
|
29
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
30
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
31
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
32
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
33
|
+
switch (op[0]) {
|
|
34
|
+
case 0: case 1: t = op; break;
|
|
35
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
36
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
37
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
38
|
+
default:
|
|
39
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
40
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
41
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
42
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
43
|
+
if (t[2]) _.ops.pop();
|
|
44
|
+
_.trys.pop(); continue;
|
|
45
|
+
}
|
|
46
|
+
op = body.call(thisArg, _);
|
|
47
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function __spreadArray(to, from, pack) {
|
|
52
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
53
|
+
if (ar || !(i in from)) {
|
|
54
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
55
|
+
ar[i] = from[i];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
59
|
+
}
|
|
60
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
61
|
+
var e = new Error(message);
|
|
62
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
83
63
|
};
|
|
84
64
|
|
|
85
65
|
config.task("deploy:semaphore", "Deploy a Semaphore contract")
|
|
86
66
|
.addOptionalParam("semaphoreVerifier", "SemaphoreVerifier contract address", undefined, config.types.string)
|
|
87
67
|
.addOptionalParam("poseidon", "Poseidon library address", undefined, config.types.string)
|
|
88
68
|
.addOptionalParam("logs", "Print the logs", true, config.types.boolean)
|
|
89
|
-
.setAction(function (_a, _b) {
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
69
|
+
.setAction(function (_a, _b) { return __awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
|
|
70
|
+
var SemaphoreVerifierFactory, semaphoreVerifier, PoseidonT3Factory, poseidonT3, SemaphoreFactory, semaphore, _e, _f, _g;
|
|
71
|
+
var logs = _c.logs, semaphoreVerifierAddress = _c.semaphoreVerifier, poseidonAddress = _c.poseidon;
|
|
72
|
+
var ethers = _d.ethers;
|
|
73
|
+
return __generator(this, function (_h) {
|
|
74
|
+
switch (_h.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
if (!!semaphoreVerifierAddress) return [3 /*break*/, 4];
|
|
77
|
+
return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
78
|
+
case 1:
|
|
79
|
+
SemaphoreVerifierFactory = _h.sent();
|
|
80
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
81
|
+
case 2:
|
|
82
|
+
semaphoreVerifier = _h.sent();
|
|
83
|
+
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
84
|
+
case 3:
|
|
85
|
+
semaphoreVerifierAddress = _h.sent();
|
|
86
|
+
if (logs) {
|
|
87
|
+
console.info("SemaphoreVerifier contract has been deployed to: ".concat(semaphoreVerifierAddress));
|
|
88
|
+
}
|
|
89
|
+
_h.label = 4;
|
|
90
|
+
case 4:
|
|
91
|
+
if (!!poseidonAddress) return [3 /*break*/, 8];
|
|
92
|
+
return [4 /*yield*/, ethers.getContractFactory("PoseidonT3")];
|
|
93
|
+
case 5:
|
|
94
|
+
PoseidonT3Factory = _h.sent();
|
|
95
|
+
return [4 /*yield*/, PoseidonT3Factory.deploy()];
|
|
96
|
+
case 6:
|
|
97
|
+
poseidonT3 = _h.sent();
|
|
98
|
+
return [4 /*yield*/, poseidonT3.getAddress()];
|
|
99
|
+
case 7:
|
|
100
|
+
poseidonAddress = _h.sent();
|
|
101
|
+
if (logs) {
|
|
102
|
+
console.info("Poseidon library has been deployed to: ".concat(poseidonAddress));
|
|
103
|
+
}
|
|
104
|
+
_h.label = 8;
|
|
105
|
+
case 8: return [4 /*yield*/, ethers.getContractFactory("Semaphore", {
|
|
106
|
+
libraries: {
|
|
107
|
+
PoseidonT3: poseidonAddress
|
|
124
108
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
semaphore: semaphore,
|
|
145
|
-
semaphoreVerifierAddress: semaphoreVerifierAddress,
|
|
146
|
-
poseidonAddress: poseidonAddress
|
|
147
|
-
}];
|
|
148
|
-
}
|
|
149
|
-
});
|
|
109
|
+
})];
|
|
110
|
+
case 9:
|
|
111
|
+
SemaphoreFactory = _h.sent();
|
|
112
|
+
return [4 /*yield*/, SemaphoreFactory.deploy(semaphoreVerifierAddress)];
|
|
113
|
+
case 10:
|
|
114
|
+
semaphore = _h.sent();
|
|
115
|
+
if (!logs) return [3 /*break*/, 12];
|
|
116
|
+
_f = (_e = console).info;
|
|
117
|
+
_g = "Semaphore contract has been deployed to: ".concat;
|
|
118
|
+
return [4 /*yield*/, semaphore.getAddress()];
|
|
119
|
+
case 11:
|
|
120
|
+
_f.apply(_e, [_g.apply("Semaphore contract has been deployed to: ", [_h.sent()])]);
|
|
121
|
+
_h.label = 12;
|
|
122
|
+
case 12: return [2 /*return*/, {
|
|
123
|
+
semaphore: semaphore,
|
|
124
|
+
semaphoreVerifierAddress: semaphoreVerifierAddress,
|
|
125
|
+
poseidonAddress: poseidonAddress
|
|
126
|
+
}];
|
|
127
|
+
}
|
|
150
128
|
});
|
|
151
|
-
});
|
|
129
|
+
}); });
|
|
152
130
|
|
|
153
131
|
config.task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
154
132
|
.addOptionalParam("logs", "Print the logs", true, config.types.boolean)
|
|
155
|
-
.setAction(function (_a, _b) {
|
|
156
|
-
var
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
});
|
|
133
|
+
.setAction(function (_a, _b) { return __awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
|
|
134
|
+
var SemaphoreVerifierFactory, semaphoreVerifier, _e, _f, _g;
|
|
135
|
+
var logs = _c.logs;
|
|
136
|
+
var ethers = _d.ethers;
|
|
137
|
+
return __generator(this, function (_h) {
|
|
138
|
+
switch (_h.label) {
|
|
139
|
+
case 0: return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
140
|
+
case 1:
|
|
141
|
+
SemaphoreVerifierFactory = _h.sent();
|
|
142
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
143
|
+
case 2:
|
|
144
|
+
semaphoreVerifier = _h.sent();
|
|
145
|
+
if (!logs) return [3 /*break*/, 4];
|
|
146
|
+
_f = (_e = console).info;
|
|
147
|
+
_g = "SemaphoreVerifier contract has been deployed to: ".concat;
|
|
148
|
+
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
149
|
+
case 3:
|
|
150
|
+
_f.apply(_e, [_g.apply("SemaphoreVerifier contract has been deployed to: ", [_h.sent()])]);
|
|
151
|
+
_h.label = 4;
|
|
152
|
+
case 4: return [2 /*return*/, {
|
|
153
|
+
semaphoreVerifier: semaphoreVerifier
|
|
154
|
+
}];
|
|
155
|
+
}
|
|
180
156
|
});
|
|
181
|
-
});
|
|
157
|
+
}); });
|
|
182
158
|
|
|
183
159
|
config.extendConfig(function (config, userConfig) {
|
|
184
160
|
var _a;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/hardhat
|
|
3
|
-
* @version 4.0.0-beta.
|
|
3
|
+
* @version 4.0.0-beta.3
|
|
4
4
|
* @file A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.
|
|
5
5
|
* @copyright Ethereum Foundation 2024
|
|
6
6
|
* @license MIT
|
|
@@ -10,173 +10,149 @@ import { task, types, extendConfig } from 'hardhat/config';
|
|
|
10
10
|
import 'hardhat-dependency-compiler';
|
|
11
11
|
import '@nomicfoundation/hardhat-ethers';
|
|
12
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
op = body.call(thisArg, _);
|
|
63
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
64
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function __spreadArray(to, from, pack) {
|
|
69
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
70
|
-
if (ar || !(i in from)) {
|
|
71
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
72
|
-
ar[i] = from[i];
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
79
|
-
var e = new Error(message);
|
|
80
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
13
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function __generator(thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function __spreadArray(to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
}
|
|
58
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
59
|
+
var e = new Error(message);
|
|
60
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
81
61
|
};
|
|
82
62
|
|
|
83
63
|
task("deploy:semaphore", "Deploy a Semaphore contract")
|
|
84
64
|
.addOptionalParam("semaphoreVerifier", "SemaphoreVerifier contract address", undefined, types.string)
|
|
85
65
|
.addOptionalParam("poseidon", "Poseidon library address", undefined, types.string)
|
|
86
66
|
.addOptionalParam("logs", "Print the logs", true, types.boolean)
|
|
87
|
-
.setAction(function (_a, _b) {
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
67
|
+
.setAction(function (_a, _b) { return __awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
|
|
68
|
+
var SemaphoreVerifierFactory, semaphoreVerifier, PoseidonT3Factory, poseidonT3, SemaphoreFactory, semaphore, _e, _f, _g;
|
|
69
|
+
var logs = _c.logs, semaphoreVerifierAddress = _c.semaphoreVerifier, poseidonAddress = _c.poseidon;
|
|
70
|
+
var ethers = _d.ethers;
|
|
71
|
+
return __generator(this, function (_h) {
|
|
72
|
+
switch (_h.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
if (!!semaphoreVerifierAddress) return [3 /*break*/, 4];
|
|
75
|
+
return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
76
|
+
case 1:
|
|
77
|
+
SemaphoreVerifierFactory = _h.sent();
|
|
78
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
79
|
+
case 2:
|
|
80
|
+
semaphoreVerifier = _h.sent();
|
|
81
|
+
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
82
|
+
case 3:
|
|
83
|
+
semaphoreVerifierAddress = _h.sent();
|
|
84
|
+
if (logs) {
|
|
85
|
+
console.info("SemaphoreVerifier contract has been deployed to: ".concat(semaphoreVerifierAddress));
|
|
86
|
+
}
|
|
87
|
+
_h.label = 4;
|
|
88
|
+
case 4:
|
|
89
|
+
if (!!poseidonAddress) return [3 /*break*/, 8];
|
|
90
|
+
return [4 /*yield*/, ethers.getContractFactory("PoseidonT3")];
|
|
91
|
+
case 5:
|
|
92
|
+
PoseidonT3Factory = _h.sent();
|
|
93
|
+
return [4 /*yield*/, PoseidonT3Factory.deploy()];
|
|
94
|
+
case 6:
|
|
95
|
+
poseidonT3 = _h.sent();
|
|
96
|
+
return [4 /*yield*/, poseidonT3.getAddress()];
|
|
97
|
+
case 7:
|
|
98
|
+
poseidonAddress = _h.sent();
|
|
99
|
+
if (logs) {
|
|
100
|
+
console.info("Poseidon library has been deployed to: ".concat(poseidonAddress));
|
|
101
|
+
}
|
|
102
|
+
_h.label = 8;
|
|
103
|
+
case 8: return [4 /*yield*/, ethers.getContractFactory("Semaphore", {
|
|
104
|
+
libraries: {
|
|
105
|
+
PoseidonT3: poseidonAddress
|
|
122
106
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
semaphore: semaphore,
|
|
143
|
-
semaphoreVerifierAddress: semaphoreVerifierAddress,
|
|
144
|
-
poseidonAddress: poseidonAddress
|
|
145
|
-
}];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
107
|
+
})];
|
|
108
|
+
case 9:
|
|
109
|
+
SemaphoreFactory = _h.sent();
|
|
110
|
+
return [4 /*yield*/, SemaphoreFactory.deploy(semaphoreVerifierAddress)];
|
|
111
|
+
case 10:
|
|
112
|
+
semaphore = _h.sent();
|
|
113
|
+
if (!logs) return [3 /*break*/, 12];
|
|
114
|
+
_f = (_e = console).info;
|
|
115
|
+
_g = "Semaphore contract has been deployed to: ".concat;
|
|
116
|
+
return [4 /*yield*/, semaphore.getAddress()];
|
|
117
|
+
case 11:
|
|
118
|
+
_f.apply(_e, [_g.apply("Semaphore contract has been deployed to: ", [_h.sent()])]);
|
|
119
|
+
_h.label = 12;
|
|
120
|
+
case 12: return [2 /*return*/, {
|
|
121
|
+
semaphore: semaphore,
|
|
122
|
+
semaphoreVerifierAddress: semaphoreVerifierAddress,
|
|
123
|
+
poseidonAddress: poseidonAddress
|
|
124
|
+
}];
|
|
125
|
+
}
|
|
148
126
|
});
|
|
149
|
-
});
|
|
127
|
+
}); });
|
|
150
128
|
|
|
151
129
|
task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
152
130
|
.addOptionalParam("logs", "Print the logs", true, types.boolean)
|
|
153
|
-
.setAction(function (_a, _b) {
|
|
154
|
-
var
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
});
|
|
131
|
+
.setAction(function (_a, _b) { return __awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
|
|
132
|
+
var SemaphoreVerifierFactory, semaphoreVerifier, _e, _f, _g;
|
|
133
|
+
var logs = _c.logs;
|
|
134
|
+
var ethers = _d.ethers;
|
|
135
|
+
return __generator(this, function (_h) {
|
|
136
|
+
switch (_h.label) {
|
|
137
|
+
case 0: return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
138
|
+
case 1:
|
|
139
|
+
SemaphoreVerifierFactory = _h.sent();
|
|
140
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
141
|
+
case 2:
|
|
142
|
+
semaphoreVerifier = _h.sent();
|
|
143
|
+
if (!logs) return [3 /*break*/, 4];
|
|
144
|
+
_f = (_e = console).info;
|
|
145
|
+
_g = "SemaphoreVerifier contract has been deployed to: ".concat;
|
|
146
|
+
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
147
|
+
case 3:
|
|
148
|
+
_f.apply(_e, [_g.apply("SemaphoreVerifier contract has been deployed to: ", [_h.sent()])]);
|
|
149
|
+
_h.label = 4;
|
|
150
|
+
case 4: return [2 /*return*/, {
|
|
151
|
+
semaphoreVerifier: semaphoreVerifier
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
178
154
|
});
|
|
179
|
-
});
|
|
155
|
+
}); });
|
|
180
156
|
|
|
181
157
|
extendConfig(function (config, userConfig) {
|
|
182
158
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semaphore-protocol/hardhat",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.3",
|
|
4
4
|
"description": "A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,16 +30,18 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
33
34
|
"hardhat": "^2.19.4",
|
|
34
|
-
"
|
|
35
|
-
"rollup
|
|
35
|
+
"rimraf": "^5.0.5",
|
|
36
|
+
"rollup": "^4.12.0",
|
|
37
|
+
"rollup-plugin-cleanup": "^3.2.1"
|
|
36
38
|
},
|
|
37
39
|
"peerDependencies": {
|
|
38
40
|
"hardhat": "^2.19.4"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
43
|
"@nomicfoundation/hardhat-ethers": "^3.0.0",
|
|
42
|
-
"@semaphore-protocol/contracts": "4.0.0-beta.
|
|
44
|
+
"@semaphore-protocol/contracts": "4.0.0-beta.3",
|
|
43
45
|
"ethers": "^6.4.0",
|
|
44
46
|
"hardhat-dependency-compiler": "^1.1.3"
|
|
45
47
|
}
|