@semaphore-protocol/hardhat 4.0.0-alpha.4 → 4.0.0-alpha.5
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/hardhat
|
|
3
|
-
* @version 4.0.0-alpha.
|
|
3
|
+
* @version 4.0.0-alpha.5
|
|
4
4
|
* @file A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.
|
|
5
5
|
* @copyright Ethereum Foundation 2024
|
|
6
6
|
* @license MIT
|
|
@@ -26,6 +26,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
26
26
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
27
27
|
PERFORMANCE OF THIS SOFTWARE.
|
|
28
28
|
***************************************************************************** */
|
|
29
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
30
|
+
|
|
29
31
|
|
|
30
32
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
31
33
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -73,114 +75,119 @@ function __spreadArray(to, from, pack) {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
76
|
-
}
|
|
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;
|
|
83
|
+
};
|
|
77
84
|
|
|
78
|
-
config.task("deploy:semaphore", "Deploy a Semaphore contract")
|
|
79
|
-
.addOptionalParam("semaphoreVerifier", "SemaphoreVerifier contract address", undefined, config.types.string)
|
|
80
|
-
.addOptionalParam("poseidon", "Poseidon library address", undefined, config.types.string)
|
|
81
|
-
.addOptionalParam("logs", "Print the logs", true, config.types.boolean)
|
|
82
|
-
.setAction(function (_a, _b) {
|
|
83
|
-
var logs = _a.logs, semaphoreVerifierAddress = _a.semaphoreVerifier, poseidonAddress = _a.poseidon;
|
|
84
|
-
var ethers = _b.ethers;
|
|
85
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
-
var SemaphoreVerifierFactory, semaphoreVerifier, PoseidonT3Factory, poseidonT3, SemaphoreFactory, semaphore, _c, _d, _e;
|
|
87
|
-
return __generator(this, function (_f) {
|
|
88
|
-
switch (_f.label) {
|
|
89
|
-
case 0:
|
|
90
|
-
if (!!semaphoreVerifierAddress) return [3 /*break*/, 4];
|
|
91
|
-
return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
92
|
-
case 1:
|
|
93
|
-
SemaphoreVerifierFactory = _f.sent();
|
|
94
|
-
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
95
|
-
case 2:
|
|
96
|
-
semaphoreVerifier = _f.sent();
|
|
97
|
-
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
98
|
-
case 3:
|
|
99
|
-
semaphoreVerifierAddress = _f.sent();
|
|
100
|
-
if (logs) {
|
|
101
|
-
console.info("SemaphoreVerifier contract has been deployed to: ".concat(semaphoreVerifierAddress));
|
|
102
|
-
}
|
|
103
|
-
_f.label = 4;
|
|
104
|
-
case 4:
|
|
105
|
-
if (!!poseidonAddress) return [3 /*break*/, 8];
|
|
106
|
-
return [4 /*yield*/, ethers.getContractFactory("PoseidonT3")];
|
|
107
|
-
case 5:
|
|
108
|
-
PoseidonT3Factory = _f.sent();
|
|
109
|
-
return [4 /*yield*/, PoseidonT3Factory.deploy()];
|
|
110
|
-
case 6:
|
|
111
|
-
poseidonT3 = _f.sent();
|
|
112
|
-
return [4 /*yield*/, poseidonT3.getAddress()];
|
|
113
|
-
case 7:
|
|
114
|
-
poseidonAddress = _f.sent();
|
|
115
|
-
if (logs) {
|
|
116
|
-
console.info("Poseidon library has been deployed to: ".concat(poseidonAddress));
|
|
117
|
-
}
|
|
118
|
-
_f.label = 8;
|
|
119
|
-
case 8: return [4 /*yield*/, ethers.getContractFactory("Semaphore", {
|
|
120
|
-
libraries: {
|
|
121
|
-
PoseidonT3: poseidonAddress
|
|
122
|
-
}
|
|
123
|
-
})];
|
|
124
|
-
case 9:
|
|
125
|
-
SemaphoreFactory = _f.sent();
|
|
126
|
-
return [4 /*yield*/, SemaphoreFactory.deploy(semaphoreVerifierAddress)];
|
|
127
|
-
case 10:
|
|
128
|
-
semaphore = _f.sent();
|
|
129
|
-
if (!logs) return [3 /*break*/, 12];
|
|
130
|
-
_d = (_c = console).info;
|
|
131
|
-
_e = "Semaphore contract has been deployed to: ".concat;
|
|
132
|
-
return [4 /*yield*/, semaphore.getAddress()];
|
|
133
|
-
case 11:
|
|
134
|
-
_d.apply(_c, [_e.apply("Semaphore contract has been deployed to: ", [_f.sent()])]);
|
|
135
|
-
_f.label = 12;
|
|
136
|
-
case 12: return [2 /*return*/, {
|
|
137
|
-
semaphore: semaphore,
|
|
138
|
-
semaphoreVerifierAddress: semaphoreVerifierAddress,
|
|
139
|
-
poseidonAddress: poseidonAddress
|
|
140
|
-
}];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
});
|
|
85
|
+
config.task("deploy:semaphore", "Deploy a Semaphore contract")
|
|
86
|
+
.addOptionalParam("semaphoreVerifier", "SemaphoreVerifier contract address", undefined, config.types.string)
|
|
87
|
+
.addOptionalParam("poseidon", "Poseidon library address", undefined, config.types.string)
|
|
88
|
+
.addOptionalParam("logs", "Print the logs", true, config.types.boolean)
|
|
89
|
+
.setAction(function (_a, _b) {
|
|
90
|
+
var logs = _a.logs, semaphoreVerifierAddress = _a.semaphoreVerifier, poseidonAddress = _a.poseidon;
|
|
91
|
+
var ethers = _b.ethers;
|
|
92
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
+
var SemaphoreVerifierFactory, semaphoreVerifier, PoseidonT3Factory, poseidonT3, SemaphoreFactory, semaphore, _c, _d, _e;
|
|
94
|
+
return __generator(this, function (_f) {
|
|
95
|
+
switch (_f.label) {
|
|
96
|
+
case 0:
|
|
97
|
+
if (!!semaphoreVerifierAddress) return [3 /*break*/, 4];
|
|
98
|
+
return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
99
|
+
case 1:
|
|
100
|
+
SemaphoreVerifierFactory = _f.sent();
|
|
101
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
102
|
+
case 2:
|
|
103
|
+
semaphoreVerifier = _f.sent();
|
|
104
|
+
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
105
|
+
case 3:
|
|
106
|
+
semaphoreVerifierAddress = _f.sent();
|
|
107
|
+
if (logs) {
|
|
108
|
+
console.info("SemaphoreVerifier contract has been deployed to: ".concat(semaphoreVerifierAddress));
|
|
109
|
+
}
|
|
110
|
+
_f.label = 4;
|
|
111
|
+
case 4:
|
|
112
|
+
if (!!poseidonAddress) return [3 /*break*/, 8];
|
|
113
|
+
return [4 /*yield*/, ethers.getContractFactory("PoseidonT3")];
|
|
114
|
+
case 5:
|
|
115
|
+
PoseidonT3Factory = _f.sent();
|
|
116
|
+
return [4 /*yield*/, PoseidonT3Factory.deploy()];
|
|
117
|
+
case 6:
|
|
118
|
+
poseidonT3 = _f.sent();
|
|
119
|
+
return [4 /*yield*/, poseidonT3.getAddress()];
|
|
120
|
+
case 7:
|
|
121
|
+
poseidonAddress = _f.sent();
|
|
122
|
+
if (logs) {
|
|
123
|
+
console.info("Poseidon library has been deployed to: ".concat(poseidonAddress));
|
|
124
|
+
}
|
|
125
|
+
_f.label = 8;
|
|
126
|
+
case 8: return [4 /*yield*/, ethers.getContractFactory("Semaphore", {
|
|
127
|
+
libraries: {
|
|
128
|
+
PoseidonT3: poseidonAddress
|
|
129
|
+
}
|
|
130
|
+
})];
|
|
131
|
+
case 9:
|
|
132
|
+
SemaphoreFactory = _f.sent();
|
|
133
|
+
return [4 /*yield*/, SemaphoreFactory.deploy(semaphoreVerifierAddress)];
|
|
134
|
+
case 10:
|
|
135
|
+
semaphore = _f.sent();
|
|
136
|
+
if (!logs) return [3 /*break*/, 12];
|
|
137
|
+
_d = (_c = console).info;
|
|
138
|
+
_e = "Semaphore contract has been deployed to: ".concat;
|
|
139
|
+
return [4 /*yield*/, semaphore.getAddress()];
|
|
140
|
+
case 11:
|
|
141
|
+
_d.apply(_c, [_e.apply("Semaphore contract has been deployed to: ", [_f.sent()])]);
|
|
142
|
+
_f.label = 12;
|
|
143
|
+
case 12: return [2 /*return*/, {
|
|
144
|
+
semaphore: semaphore,
|
|
145
|
+
semaphoreVerifierAddress: semaphoreVerifierAddress,
|
|
146
|
+
poseidonAddress: poseidonAddress
|
|
147
|
+
}];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
144
151
|
});
|
|
145
152
|
|
|
146
|
-
config.task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
147
|
-
.addOptionalParam("logs", "Print the logs", true, config.types.boolean)
|
|
148
|
-
.setAction(function (_a, _b) {
|
|
149
|
-
var logs = _a.logs;
|
|
150
|
-
var ethers = _b.ethers;
|
|
151
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
152
|
-
var SemaphoreVerifierFactory, semaphoreVerifier, _c, _d, _e;
|
|
153
|
-
return __generator(this, function (_f) {
|
|
154
|
-
switch (_f.label) {
|
|
155
|
-
case 0: return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
156
|
-
case 1:
|
|
157
|
-
SemaphoreVerifierFactory = _f.sent();
|
|
158
|
-
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
159
|
-
case 2:
|
|
160
|
-
semaphoreVerifier = _f.sent();
|
|
161
|
-
if (!logs) return [3 /*break*/, 4];
|
|
162
|
-
_d = (_c = console).info;
|
|
163
|
-
_e = "SemaphoreVerifier contract has been deployed to: ".concat;
|
|
164
|
-
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
165
|
-
case 3:
|
|
166
|
-
_d.apply(_c, [_e.apply("SemaphoreVerifier contract has been deployed to: ", [_f.sent()])]);
|
|
167
|
-
_f.label = 4;
|
|
168
|
-
case 4: return [2 /*return*/, {
|
|
169
|
-
semaphoreVerifier: semaphoreVerifier
|
|
170
|
-
}];
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
153
|
+
config.task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
154
|
+
.addOptionalParam("logs", "Print the logs", true, config.types.boolean)
|
|
155
|
+
.setAction(function (_a, _b) {
|
|
156
|
+
var logs = _a.logs;
|
|
157
|
+
var ethers = _b.ethers;
|
|
158
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
+
var SemaphoreVerifierFactory, semaphoreVerifier, _c, _d, _e;
|
|
160
|
+
return __generator(this, function (_f) {
|
|
161
|
+
switch (_f.label) {
|
|
162
|
+
case 0: return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
163
|
+
case 1:
|
|
164
|
+
SemaphoreVerifierFactory = _f.sent();
|
|
165
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
166
|
+
case 2:
|
|
167
|
+
semaphoreVerifier = _f.sent();
|
|
168
|
+
if (!logs) return [3 /*break*/, 4];
|
|
169
|
+
_d = (_c = console).info;
|
|
170
|
+
_e = "SemaphoreVerifier contract has been deployed to: ".concat;
|
|
171
|
+
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
172
|
+
case 3:
|
|
173
|
+
_d.apply(_c, [_e.apply("SemaphoreVerifier contract has been deployed to: ", [_f.sent()])]);
|
|
174
|
+
_f.label = 4;
|
|
175
|
+
case 4: return [2 /*return*/, {
|
|
176
|
+
semaphoreVerifier: semaphoreVerifier
|
|
177
|
+
}];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
174
181
|
});
|
|
175
182
|
|
|
176
|
-
config.extendConfig(function (config, userConfig) {
|
|
177
|
-
var _a;
|
|
178
|
-
config.dependencyCompiler.paths = [
|
|
179
|
-
"@semaphore-protocol/contracts/base/SemaphoreVerifier.sol",
|
|
180
|
-
"@semaphore-protocol/contracts/Semaphore.sol",
|
|
181
|
-
"poseidon-solidity/PoseidonT3.sol"
|
|
182
|
-
];
|
|
183
|
-
if ((_a = userConfig.dependencyCompiler) === null || _a === void 0 ? void 0 : _a.paths) {
|
|
184
|
-
config.dependencyCompiler.paths = __spreadArray(__spreadArray([], config.dependencyCompiler.paths, true), userConfig.dependencyCompiler.paths, true);
|
|
185
|
-
}
|
|
183
|
+
config.extendConfig(function (config, userConfig) {
|
|
184
|
+
var _a;
|
|
185
|
+
config.dependencyCompiler.paths = [
|
|
186
|
+
"@semaphore-protocol/contracts/base/SemaphoreVerifier.sol",
|
|
187
|
+
"@semaphore-protocol/contracts/Semaphore.sol",
|
|
188
|
+
"poseidon-solidity/PoseidonT3.sol"
|
|
189
|
+
];
|
|
190
|
+
if ((_a = userConfig.dependencyCompiler) === null || _a === void 0 ? void 0 : _a.paths) {
|
|
191
|
+
config.dependencyCompiler.paths = __spreadArray(__spreadArray([], config.dependencyCompiler.paths, true), userConfig.dependencyCompiler.paths, true);
|
|
192
|
+
}
|
|
186
193
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @semaphore-protocol/hardhat
|
|
3
|
-
* @version 4.0.0-alpha.
|
|
3
|
+
* @version 4.0.0-alpha.5
|
|
4
4
|
* @file A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.
|
|
5
5
|
* @copyright Ethereum Foundation 2024
|
|
6
6
|
* @license MIT
|
|
@@ -24,6 +24,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
24
24
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
25
|
PERFORMANCE OF THIS SOFTWARE.
|
|
26
26
|
***************************************************************************** */
|
|
27
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
28
|
+
|
|
27
29
|
|
|
28
30
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
29
31
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -71,114 +73,119 @@ function __spreadArray(to, from, pack) {
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
74
|
-
}
|
|
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;
|
|
81
|
+
};
|
|
75
82
|
|
|
76
|
-
task("deploy:semaphore", "Deploy a Semaphore contract")
|
|
77
|
-
.addOptionalParam("semaphoreVerifier", "SemaphoreVerifier contract address", undefined, types.string)
|
|
78
|
-
.addOptionalParam("poseidon", "Poseidon library address", undefined, types.string)
|
|
79
|
-
.addOptionalParam("logs", "Print the logs", true, types.boolean)
|
|
80
|
-
.setAction(function (_a, _b) {
|
|
81
|
-
var logs = _a.logs, semaphoreVerifierAddress = _a.semaphoreVerifier, poseidonAddress = _a.poseidon;
|
|
82
|
-
var ethers = _b.ethers;
|
|
83
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
-
var SemaphoreVerifierFactory, semaphoreVerifier, PoseidonT3Factory, poseidonT3, SemaphoreFactory, semaphore, _c, _d, _e;
|
|
85
|
-
return __generator(this, function (_f) {
|
|
86
|
-
switch (_f.label) {
|
|
87
|
-
case 0:
|
|
88
|
-
if (!!semaphoreVerifierAddress) return [3 /*break*/, 4];
|
|
89
|
-
return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
90
|
-
case 1:
|
|
91
|
-
SemaphoreVerifierFactory = _f.sent();
|
|
92
|
-
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
93
|
-
case 2:
|
|
94
|
-
semaphoreVerifier = _f.sent();
|
|
95
|
-
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
96
|
-
case 3:
|
|
97
|
-
semaphoreVerifierAddress = _f.sent();
|
|
98
|
-
if (logs) {
|
|
99
|
-
console.info("SemaphoreVerifier contract has been deployed to: ".concat(semaphoreVerifierAddress));
|
|
100
|
-
}
|
|
101
|
-
_f.label = 4;
|
|
102
|
-
case 4:
|
|
103
|
-
if (!!poseidonAddress) return [3 /*break*/, 8];
|
|
104
|
-
return [4 /*yield*/, ethers.getContractFactory("PoseidonT3")];
|
|
105
|
-
case 5:
|
|
106
|
-
PoseidonT3Factory = _f.sent();
|
|
107
|
-
return [4 /*yield*/, PoseidonT3Factory.deploy()];
|
|
108
|
-
case 6:
|
|
109
|
-
poseidonT3 = _f.sent();
|
|
110
|
-
return [4 /*yield*/, poseidonT3.getAddress()];
|
|
111
|
-
case 7:
|
|
112
|
-
poseidonAddress = _f.sent();
|
|
113
|
-
if (logs) {
|
|
114
|
-
console.info("Poseidon library has been deployed to: ".concat(poseidonAddress));
|
|
115
|
-
}
|
|
116
|
-
_f.label = 8;
|
|
117
|
-
case 8: return [4 /*yield*/, ethers.getContractFactory("Semaphore", {
|
|
118
|
-
libraries: {
|
|
119
|
-
PoseidonT3: poseidonAddress
|
|
120
|
-
}
|
|
121
|
-
})];
|
|
122
|
-
case 9:
|
|
123
|
-
SemaphoreFactory = _f.sent();
|
|
124
|
-
return [4 /*yield*/, SemaphoreFactory.deploy(semaphoreVerifierAddress)];
|
|
125
|
-
case 10:
|
|
126
|
-
semaphore = _f.sent();
|
|
127
|
-
if (!logs) return [3 /*break*/, 12];
|
|
128
|
-
_d = (_c = console).info;
|
|
129
|
-
_e = "Semaphore contract has been deployed to: ".concat;
|
|
130
|
-
return [4 /*yield*/, semaphore.getAddress()];
|
|
131
|
-
case 11:
|
|
132
|
-
_d.apply(_c, [_e.apply("Semaphore contract has been deployed to: ", [_f.sent()])]);
|
|
133
|
-
_f.label = 12;
|
|
134
|
-
case 12: return [2 /*return*/, {
|
|
135
|
-
semaphore: semaphore,
|
|
136
|
-
semaphoreVerifierAddress: semaphoreVerifierAddress,
|
|
137
|
-
poseidonAddress: poseidonAddress
|
|
138
|
-
}];
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
83
|
+
task("deploy:semaphore", "Deploy a Semaphore contract")
|
|
84
|
+
.addOptionalParam("semaphoreVerifier", "SemaphoreVerifier contract address", undefined, types.string)
|
|
85
|
+
.addOptionalParam("poseidon", "Poseidon library address", undefined, types.string)
|
|
86
|
+
.addOptionalParam("logs", "Print the logs", true, types.boolean)
|
|
87
|
+
.setAction(function (_a, _b) {
|
|
88
|
+
var logs = _a.logs, semaphoreVerifierAddress = _a.semaphoreVerifier, poseidonAddress = _a.poseidon;
|
|
89
|
+
var ethers = _b.ethers;
|
|
90
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
91
|
+
var SemaphoreVerifierFactory, semaphoreVerifier, PoseidonT3Factory, poseidonT3, SemaphoreFactory, semaphore, _c, _d, _e;
|
|
92
|
+
return __generator(this, function (_f) {
|
|
93
|
+
switch (_f.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
if (!!semaphoreVerifierAddress) return [3 /*break*/, 4];
|
|
96
|
+
return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
97
|
+
case 1:
|
|
98
|
+
SemaphoreVerifierFactory = _f.sent();
|
|
99
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
100
|
+
case 2:
|
|
101
|
+
semaphoreVerifier = _f.sent();
|
|
102
|
+
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
103
|
+
case 3:
|
|
104
|
+
semaphoreVerifierAddress = _f.sent();
|
|
105
|
+
if (logs) {
|
|
106
|
+
console.info("SemaphoreVerifier contract has been deployed to: ".concat(semaphoreVerifierAddress));
|
|
107
|
+
}
|
|
108
|
+
_f.label = 4;
|
|
109
|
+
case 4:
|
|
110
|
+
if (!!poseidonAddress) return [3 /*break*/, 8];
|
|
111
|
+
return [4 /*yield*/, ethers.getContractFactory("PoseidonT3")];
|
|
112
|
+
case 5:
|
|
113
|
+
PoseidonT3Factory = _f.sent();
|
|
114
|
+
return [4 /*yield*/, PoseidonT3Factory.deploy()];
|
|
115
|
+
case 6:
|
|
116
|
+
poseidonT3 = _f.sent();
|
|
117
|
+
return [4 /*yield*/, poseidonT3.getAddress()];
|
|
118
|
+
case 7:
|
|
119
|
+
poseidonAddress = _f.sent();
|
|
120
|
+
if (logs) {
|
|
121
|
+
console.info("Poseidon library has been deployed to: ".concat(poseidonAddress));
|
|
122
|
+
}
|
|
123
|
+
_f.label = 8;
|
|
124
|
+
case 8: return [4 /*yield*/, ethers.getContractFactory("Semaphore", {
|
|
125
|
+
libraries: {
|
|
126
|
+
PoseidonT3: poseidonAddress
|
|
127
|
+
}
|
|
128
|
+
})];
|
|
129
|
+
case 9:
|
|
130
|
+
SemaphoreFactory = _f.sent();
|
|
131
|
+
return [4 /*yield*/, SemaphoreFactory.deploy(semaphoreVerifierAddress)];
|
|
132
|
+
case 10:
|
|
133
|
+
semaphore = _f.sent();
|
|
134
|
+
if (!logs) return [3 /*break*/, 12];
|
|
135
|
+
_d = (_c = console).info;
|
|
136
|
+
_e = "Semaphore contract has been deployed to: ".concat;
|
|
137
|
+
return [4 /*yield*/, semaphore.getAddress()];
|
|
138
|
+
case 11:
|
|
139
|
+
_d.apply(_c, [_e.apply("Semaphore contract has been deployed to: ", [_f.sent()])]);
|
|
140
|
+
_f.label = 12;
|
|
141
|
+
case 12: return [2 /*return*/, {
|
|
142
|
+
semaphore: semaphore,
|
|
143
|
+
semaphoreVerifierAddress: semaphoreVerifierAddress,
|
|
144
|
+
poseidonAddress: poseidonAddress
|
|
145
|
+
}];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
142
149
|
});
|
|
143
150
|
|
|
144
|
-
task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
145
|
-
.addOptionalParam("logs", "Print the logs", true, types.boolean)
|
|
146
|
-
.setAction(function (_a, _b) {
|
|
147
|
-
var logs = _a.logs;
|
|
148
|
-
var ethers = _b.ethers;
|
|
149
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
150
|
-
var SemaphoreVerifierFactory, semaphoreVerifier, _c, _d, _e;
|
|
151
|
-
return __generator(this, function (_f) {
|
|
152
|
-
switch (_f.label) {
|
|
153
|
-
case 0: return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
154
|
-
case 1:
|
|
155
|
-
SemaphoreVerifierFactory = _f.sent();
|
|
156
|
-
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
157
|
-
case 2:
|
|
158
|
-
semaphoreVerifier = _f.sent();
|
|
159
|
-
if (!logs) return [3 /*break*/, 4];
|
|
160
|
-
_d = (_c = console).info;
|
|
161
|
-
_e = "SemaphoreVerifier contract has been deployed to: ".concat;
|
|
162
|
-
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
163
|
-
case 3:
|
|
164
|
-
_d.apply(_c, [_e.apply("SemaphoreVerifier contract has been deployed to: ", [_f.sent()])]);
|
|
165
|
-
_f.label = 4;
|
|
166
|
-
case 4: return [2 /*return*/, {
|
|
167
|
-
semaphoreVerifier: semaphoreVerifier
|
|
168
|
-
}];
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
});
|
|
151
|
+
task("deploy:semaphore-verifier", "Deploy a SemaphoreVerifier contract")
|
|
152
|
+
.addOptionalParam("logs", "Print the logs", true, types.boolean)
|
|
153
|
+
.setAction(function (_a, _b) {
|
|
154
|
+
var logs = _a.logs;
|
|
155
|
+
var ethers = _b.ethers;
|
|
156
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
+
var SemaphoreVerifierFactory, semaphoreVerifier, _c, _d, _e;
|
|
158
|
+
return __generator(this, function (_f) {
|
|
159
|
+
switch (_f.label) {
|
|
160
|
+
case 0: return [4 /*yield*/, ethers.getContractFactory("SemaphoreVerifier")];
|
|
161
|
+
case 1:
|
|
162
|
+
SemaphoreVerifierFactory = _f.sent();
|
|
163
|
+
return [4 /*yield*/, SemaphoreVerifierFactory.deploy()];
|
|
164
|
+
case 2:
|
|
165
|
+
semaphoreVerifier = _f.sent();
|
|
166
|
+
if (!logs) return [3 /*break*/, 4];
|
|
167
|
+
_d = (_c = console).info;
|
|
168
|
+
_e = "SemaphoreVerifier contract has been deployed to: ".concat;
|
|
169
|
+
return [4 /*yield*/, semaphoreVerifier.getAddress()];
|
|
170
|
+
case 3:
|
|
171
|
+
_d.apply(_c, [_e.apply("SemaphoreVerifier contract has been deployed to: ", [_f.sent()])]);
|
|
172
|
+
_f.label = 4;
|
|
173
|
+
case 4: return [2 /*return*/, {
|
|
174
|
+
semaphoreVerifier: semaphoreVerifier
|
|
175
|
+
}];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
172
179
|
});
|
|
173
180
|
|
|
174
|
-
extendConfig(function (config, userConfig) {
|
|
175
|
-
var _a;
|
|
176
|
-
config.dependencyCompiler.paths = [
|
|
177
|
-
"@semaphore-protocol/contracts/base/SemaphoreVerifier.sol",
|
|
178
|
-
"@semaphore-protocol/contracts/Semaphore.sol",
|
|
179
|
-
"poseidon-solidity/PoseidonT3.sol"
|
|
180
|
-
];
|
|
181
|
-
if ((_a = userConfig.dependencyCompiler) === null || _a === void 0 ? void 0 : _a.paths) {
|
|
182
|
-
config.dependencyCompiler.paths = __spreadArray(__spreadArray([], config.dependencyCompiler.paths, true), userConfig.dependencyCompiler.paths, true);
|
|
183
|
-
}
|
|
181
|
+
extendConfig(function (config, userConfig) {
|
|
182
|
+
var _a;
|
|
183
|
+
config.dependencyCompiler.paths = [
|
|
184
|
+
"@semaphore-protocol/contracts/base/SemaphoreVerifier.sol",
|
|
185
|
+
"@semaphore-protocol/contracts/Semaphore.sol",
|
|
186
|
+
"poseidon-solidity/PoseidonT3.sol"
|
|
187
|
+
];
|
|
188
|
+
if ((_a = userConfig.dependencyCompiler) === null || _a === void 0 ? void 0 : _a.paths) {
|
|
189
|
+
config.dependencyCompiler.paths = __spreadArray(__spreadArray([], config.dependencyCompiler.paths, true), userConfig.dependencyCompiler.paths, true);
|
|
190
|
+
}
|
|
184
191
|
});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "hardhat-dependency-compiler";
|
|
2
|
-
import "@nomicfoundation/hardhat-ethers";
|
|
3
|
-
import "./tasks/deploy-semaphore";
|
|
4
|
-
import "./tasks/deploy-semaphore-verifier";
|
|
1
|
+
import "hardhat-dependency-compiler";
|
|
2
|
+
import "@nomicfoundation/hardhat-ethers";
|
|
3
|
+
import "./tasks/deploy-semaphore";
|
|
4
|
+
import "./tasks/deploy-semaphore-verifier";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semaphore-protocol/hardhat",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"description": "A Semaphore Hardhat plugin to deploy verifiers and Semaphore contract.",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"license": "MIT",
|
|
6
|
-
"main": "dist/index.
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/types/index.d.ts",
|
|
7
9
|
"exports": {
|
|
8
|
-
"
|
|
9
|
-
"require": "./dist/index.
|
|
10
|
-
"
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"default": "./dist/index.js"
|
|
11
13
|
},
|
|
12
|
-
"types": "dist/types/index.d.ts",
|
|
13
14
|
"files": [
|
|
14
15
|
"dist/",
|
|
15
16
|
"src/",
|
|
@@ -31,14 +32,14 @@
|
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"hardhat": "^2.19.4",
|
|
33
34
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
34
|
-
"rollup-plugin-typescript2": "^0.
|
|
35
|
+
"rollup-plugin-typescript2": "^0.36.0"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
38
|
"hardhat": "^2.19.4"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
41
|
"@nomicfoundation/hardhat-ethers": "^3.0.0",
|
|
41
|
-
"@semaphore-protocol/contracts": "4.0.0-alpha.
|
|
42
|
+
"@semaphore-protocol/contracts": "4.0.0-alpha.5",
|
|
42
43
|
"ethers": "^6.4.0",
|
|
43
44
|
"hardhat-dependency-compiler": "^1.1.3"
|
|
44
45
|
}
|