@thesingularitynetwork/singularity-sdk-lite 0.0.0-stage → 0.2.0-beta.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 +12 -2
- package/dist/config/contractConfig.d.ts +36 -0
- package/dist/config/stakingConfig.d.ts +8 -0
- package/dist/darkpool.d.ts +16 -0
- package/dist/entities/error.d.ts +3 -0
- package/dist/entities/index.d.ts +6 -0
- package/dist/entities/otcswap.d.ts +31 -0
- package/dist/entities/relayer.d.ts +5 -0
- package/dist/entities/relayerRequestTypes.d.ts +229 -0
- package/dist/entities/token.d.ts +8 -0
- package/dist/entities/types.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/lite.d.ts +11 -0
- package/dist/services/BaseService.d.ts +64 -0
- package/dist/services/base/deposit.d.ts +32 -0
- package/dist/services/base/withdraw.d.ts +38 -0
- package/dist/services/merkletree.d.ts +13 -0
- package/dist/services/noteService.d.ts +10 -0
- package/dist/singularity-sdk-lite.cjs.development.js +3869 -0
- package/dist/singularity-sdk-lite.cjs.development.js.map +1 -0
- package/dist/singularity-sdk-lite.cjs.production.min.js +2 -0
- package/dist/singularity-sdk-lite.cjs.production.min.js.map +1 -0
- package/dist/singularity-sdk-lite.esm.js +3836 -0
- package/dist/singularity-sdk-lite.esm.js.map +1 -0
- package/dist/utils/util.d.ts +9 -0
- package/package.json +22 -4
|
@@ -0,0 +1,3836 @@
|
|
|
1
|
+
import { createNote, generateDepositProof, generateWithdrawProof, calcNullifier, getNullifier, validateNote } from '@thesingularitynetwork/darkpool-v1-proof-lite';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
|
|
5
|
+
function _construct(t, e, r) {
|
|
6
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
7
|
+
var o = [null];
|
|
8
|
+
o.push.apply(o, e);
|
|
9
|
+
var p = new (t.bind.apply(t, o))();
|
|
10
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
11
|
+
}
|
|
12
|
+
function _isNativeReflectConstruct() {
|
|
13
|
+
try {
|
|
14
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
15
|
+
} catch (t) {}
|
|
16
|
+
return (_isNativeReflectConstruct = function () {
|
|
17
|
+
return !!t;
|
|
18
|
+
})();
|
|
19
|
+
}
|
|
20
|
+
function _regeneratorRuntime() {
|
|
21
|
+
_regeneratorRuntime = function () {
|
|
22
|
+
return e;
|
|
23
|
+
};
|
|
24
|
+
var t,
|
|
25
|
+
e = {},
|
|
26
|
+
r = Object.prototype,
|
|
27
|
+
n = r.hasOwnProperty,
|
|
28
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
29
|
+
t[e] = r.value;
|
|
30
|
+
},
|
|
31
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
32
|
+
a = i.iterator || "@@iterator",
|
|
33
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
34
|
+
u = i.toStringTag || "@@toStringTag";
|
|
35
|
+
function define(t, e, r) {
|
|
36
|
+
return Object.defineProperty(t, e, {
|
|
37
|
+
value: r,
|
|
38
|
+
enumerable: !0,
|
|
39
|
+
configurable: !0,
|
|
40
|
+
writable: !0
|
|
41
|
+
}), t[e];
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
define({}, "");
|
|
45
|
+
} catch (t) {
|
|
46
|
+
define = function (t, e, r) {
|
|
47
|
+
return t[e] = r;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function wrap(t, e, r, n) {
|
|
51
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
52
|
+
a = Object.create(i.prototype),
|
|
53
|
+
c = new Context(n || []);
|
|
54
|
+
return o(a, "_invoke", {
|
|
55
|
+
value: makeInvokeMethod(t, r, c)
|
|
56
|
+
}), a;
|
|
57
|
+
}
|
|
58
|
+
function tryCatch(t, e, r) {
|
|
59
|
+
try {
|
|
60
|
+
return {
|
|
61
|
+
type: "normal",
|
|
62
|
+
arg: t.call(e, r)
|
|
63
|
+
};
|
|
64
|
+
} catch (t) {
|
|
65
|
+
return {
|
|
66
|
+
type: "throw",
|
|
67
|
+
arg: t
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
e.wrap = wrap;
|
|
72
|
+
var h = "suspendedStart",
|
|
73
|
+
l = "suspendedYield",
|
|
74
|
+
f = "executing",
|
|
75
|
+
s = "completed",
|
|
76
|
+
y = {};
|
|
77
|
+
function Generator() {}
|
|
78
|
+
function GeneratorFunction() {}
|
|
79
|
+
function GeneratorFunctionPrototype() {}
|
|
80
|
+
var p = {};
|
|
81
|
+
define(p, a, function () {
|
|
82
|
+
return this;
|
|
83
|
+
});
|
|
84
|
+
var d = Object.getPrototypeOf,
|
|
85
|
+
v = d && d(d(values([])));
|
|
86
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
87
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
88
|
+
function defineIteratorMethods(t) {
|
|
89
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
90
|
+
define(t, e, function (t) {
|
|
91
|
+
return this._invoke(e, t);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function AsyncIterator(t, e) {
|
|
96
|
+
function invoke(r, o, i, a) {
|
|
97
|
+
var c = tryCatch(t[r], t, o);
|
|
98
|
+
if ("throw" !== c.type) {
|
|
99
|
+
var u = c.arg,
|
|
100
|
+
h = u.value;
|
|
101
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
102
|
+
invoke("next", t, i, a);
|
|
103
|
+
}, function (t) {
|
|
104
|
+
invoke("throw", t, i, a);
|
|
105
|
+
}) : e.resolve(h).then(function (t) {
|
|
106
|
+
u.value = t, i(u);
|
|
107
|
+
}, function (t) {
|
|
108
|
+
return invoke("throw", t, i, a);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
a(c.arg);
|
|
112
|
+
}
|
|
113
|
+
var r;
|
|
114
|
+
o(this, "_invoke", {
|
|
115
|
+
value: function (t, n) {
|
|
116
|
+
function callInvokeWithMethodAndArg() {
|
|
117
|
+
return new e(function (e, r) {
|
|
118
|
+
invoke(t, n, e, r);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function makeInvokeMethod(e, r, n) {
|
|
126
|
+
var o = h;
|
|
127
|
+
return function (i, a) {
|
|
128
|
+
if (o === f) throw Error("Generator is already running");
|
|
129
|
+
if (o === s) {
|
|
130
|
+
if ("throw" === i) throw a;
|
|
131
|
+
return {
|
|
132
|
+
value: t,
|
|
133
|
+
done: !0
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
for (n.method = i, n.arg = a;;) {
|
|
137
|
+
var c = n.delegate;
|
|
138
|
+
if (c) {
|
|
139
|
+
var u = maybeInvokeDelegate(c, n);
|
|
140
|
+
if (u) {
|
|
141
|
+
if (u === y) continue;
|
|
142
|
+
return u;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
146
|
+
if (o === h) throw o = s, n.arg;
|
|
147
|
+
n.dispatchException(n.arg);
|
|
148
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
149
|
+
o = f;
|
|
150
|
+
var p = tryCatch(e, r, n);
|
|
151
|
+
if ("normal" === p.type) {
|
|
152
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
153
|
+
return {
|
|
154
|
+
value: p.arg,
|
|
155
|
+
done: n.done
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function maybeInvokeDelegate(e, r) {
|
|
163
|
+
var n = r.method,
|
|
164
|
+
o = e.iterator[n];
|
|
165
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
166
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
167
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
168
|
+
var a = i.arg;
|
|
169
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
170
|
+
}
|
|
171
|
+
function pushTryEntry(t) {
|
|
172
|
+
var e = {
|
|
173
|
+
tryLoc: t[0]
|
|
174
|
+
};
|
|
175
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
176
|
+
}
|
|
177
|
+
function resetTryEntry(t) {
|
|
178
|
+
var e = t.completion || {};
|
|
179
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
180
|
+
}
|
|
181
|
+
function Context(t) {
|
|
182
|
+
this.tryEntries = [{
|
|
183
|
+
tryLoc: "root"
|
|
184
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
185
|
+
}
|
|
186
|
+
function values(e) {
|
|
187
|
+
if (e || "" === e) {
|
|
188
|
+
var r = e[a];
|
|
189
|
+
if (r) return r.call(e);
|
|
190
|
+
if ("function" == typeof e.next) return e;
|
|
191
|
+
if (!isNaN(e.length)) {
|
|
192
|
+
var o = -1,
|
|
193
|
+
i = function next() {
|
|
194
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
195
|
+
return next.value = t, next.done = !0, next;
|
|
196
|
+
};
|
|
197
|
+
return i.next = i;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
201
|
+
}
|
|
202
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
203
|
+
value: GeneratorFunctionPrototype,
|
|
204
|
+
configurable: !0
|
|
205
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
206
|
+
value: GeneratorFunction,
|
|
207
|
+
configurable: !0
|
|
208
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
209
|
+
var e = "function" == typeof t && t.constructor;
|
|
210
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
211
|
+
}, e.mark = function (t) {
|
|
212
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
213
|
+
}, e.awrap = function (t) {
|
|
214
|
+
return {
|
|
215
|
+
__await: t
|
|
216
|
+
};
|
|
217
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
218
|
+
return this;
|
|
219
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
220
|
+
void 0 === i && (i = Promise);
|
|
221
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
222
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
223
|
+
return t.done ? t.value : a.next();
|
|
224
|
+
});
|
|
225
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
226
|
+
return this;
|
|
227
|
+
}), define(g, "toString", function () {
|
|
228
|
+
return "[object Generator]";
|
|
229
|
+
}), e.keys = function (t) {
|
|
230
|
+
var e = Object(t),
|
|
231
|
+
r = [];
|
|
232
|
+
for (var n in e) r.push(n);
|
|
233
|
+
return r.reverse(), function next() {
|
|
234
|
+
for (; r.length;) {
|
|
235
|
+
var t = r.pop();
|
|
236
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
237
|
+
}
|
|
238
|
+
return next.done = !0, next;
|
|
239
|
+
};
|
|
240
|
+
}, e.values = values, Context.prototype = {
|
|
241
|
+
constructor: Context,
|
|
242
|
+
reset: function (e) {
|
|
243
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
244
|
+
},
|
|
245
|
+
stop: function () {
|
|
246
|
+
this.done = !0;
|
|
247
|
+
var t = this.tryEntries[0].completion;
|
|
248
|
+
if ("throw" === t.type) throw t.arg;
|
|
249
|
+
return this.rval;
|
|
250
|
+
},
|
|
251
|
+
dispatchException: function (e) {
|
|
252
|
+
if (this.done) throw e;
|
|
253
|
+
var r = this;
|
|
254
|
+
function handle(n, o) {
|
|
255
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
256
|
+
}
|
|
257
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
258
|
+
var i = this.tryEntries[o],
|
|
259
|
+
a = i.completion;
|
|
260
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
261
|
+
if (i.tryLoc <= this.prev) {
|
|
262
|
+
var c = n.call(i, "catchLoc"),
|
|
263
|
+
u = n.call(i, "finallyLoc");
|
|
264
|
+
if (c && u) {
|
|
265
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
266
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
267
|
+
} else if (c) {
|
|
268
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
269
|
+
} else {
|
|
270
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
271
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
abrupt: function (t, e) {
|
|
277
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
278
|
+
var o = this.tryEntries[r];
|
|
279
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
280
|
+
var i = o;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
285
|
+
var a = i ? i.completion : {};
|
|
286
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
287
|
+
},
|
|
288
|
+
complete: function (t, e) {
|
|
289
|
+
if ("throw" === t.type) throw t.arg;
|
|
290
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
291
|
+
},
|
|
292
|
+
finish: function (t) {
|
|
293
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
294
|
+
var r = this.tryEntries[e];
|
|
295
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
catch: function (t) {
|
|
299
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
300
|
+
var r = this.tryEntries[e];
|
|
301
|
+
if (r.tryLoc === t) {
|
|
302
|
+
var n = r.completion;
|
|
303
|
+
if ("throw" === n.type) {
|
|
304
|
+
var o = n.arg;
|
|
305
|
+
resetTryEntry(r);
|
|
306
|
+
}
|
|
307
|
+
return o;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
throw Error("illegal catch attempt");
|
|
311
|
+
},
|
|
312
|
+
delegateYield: function (e, r, n) {
|
|
313
|
+
return this.delegate = {
|
|
314
|
+
iterator: values(e),
|
|
315
|
+
resultName: r,
|
|
316
|
+
nextLoc: n
|
|
317
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
318
|
+
}
|
|
319
|
+
}, e;
|
|
320
|
+
}
|
|
321
|
+
function _toPrimitive(t, r) {
|
|
322
|
+
if ("object" != typeof t || !t) return t;
|
|
323
|
+
var e = t[Symbol.toPrimitive];
|
|
324
|
+
if (void 0 !== e) {
|
|
325
|
+
var i = e.call(t, r || "default");
|
|
326
|
+
if ("object" != typeof i) return i;
|
|
327
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
328
|
+
}
|
|
329
|
+
return ("string" === r ? String : Number)(t);
|
|
330
|
+
}
|
|
331
|
+
function _toPropertyKey(t) {
|
|
332
|
+
var i = _toPrimitive(t, "string");
|
|
333
|
+
return "symbol" == typeof i ? i : i + "";
|
|
334
|
+
}
|
|
335
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
336
|
+
try {
|
|
337
|
+
var info = gen[key](arg);
|
|
338
|
+
var value = info.value;
|
|
339
|
+
} catch (error) {
|
|
340
|
+
reject(error);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (info.done) {
|
|
344
|
+
resolve(value);
|
|
345
|
+
} else {
|
|
346
|
+
Promise.resolve(value).then(_next, _throw);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function _asyncToGenerator(fn) {
|
|
350
|
+
return function () {
|
|
351
|
+
var self = this,
|
|
352
|
+
args = arguments;
|
|
353
|
+
return new Promise(function (resolve, reject) {
|
|
354
|
+
var gen = fn.apply(self, args);
|
|
355
|
+
function _next(value) {
|
|
356
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
357
|
+
}
|
|
358
|
+
function _throw(err) {
|
|
359
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
360
|
+
}
|
|
361
|
+
_next(undefined);
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function _defineProperties(target, props) {
|
|
366
|
+
for (var i = 0; i < props.length; i++) {
|
|
367
|
+
var descriptor = props[i];
|
|
368
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
369
|
+
descriptor.configurable = true;
|
|
370
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
371
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
375
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
376
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
377
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
378
|
+
writable: false
|
|
379
|
+
});
|
|
380
|
+
return Constructor;
|
|
381
|
+
}
|
|
382
|
+
function _inheritsLoose(subClass, superClass) {
|
|
383
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
384
|
+
subClass.prototype.constructor = subClass;
|
|
385
|
+
_setPrototypeOf(subClass, superClass);
|
|
386
|
+
}
|
|
387
|
+
function _getPrototypeOf(o) {
|
|
388
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
389
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
390
|
+
};
|
|
391
|
+
return _getPrototypeOf(o);
|
|
392
|
+
}
|
|
393
|
+
function _setPrototypeOf(o, p) {
|
|
394
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
395
|
+
o.__proto__ = p;
|
|
396
|
+
return o;
|
|
397
|
+
};
|
|
398
|
+
return _setPrototypeOf(o, p);
|
|
399
|
+
}
|
|
400
|
+
function _isNativeFunction(fn) {
|
|
401
|
+
try {
|
|
402
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
403
|
+
} catch (e) {
|
|
404
|
+
return typeof fn === "function";
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function _wrapNativeSuper(Class) {
|
|
408
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
409
|
+
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
410
|
+
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
411
|
+
if (typeof Class !== "function") {
|
|
412
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
413
|
+
}
|
|
414
|
+
if (typeof _cache !== "undefined") {
|
|
415
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
416
|
+
_cache.set(Class, Wrapper);
|
|
417
|
+
}
|
|
418
|
+
function Wrapper() {
|
|
419
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
420
|
+
}
|
|
421
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
422
|
+
constructor: {
|
|
423
|
+
value: Wrapper,
|
|
424
|
+
enumerable: false,
|
|
425
|
+
writable: true,
|
|
426
|
+
configurable: true
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
430
|
+
};
|
|
431
|
+
return _wrapNativeSuper(Class);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
var _format = "hh-sol-artifact-1";
|
|
435
|
+
var contractName = "DarkpoolAssetManager";
|
|
436
|
+
var sourceName = "contracts/core/DarkpoolAssetManager.sol";
|
|
437
|
+
var abi = [
|
|
438
|
+
{
|
|
439
|
+
inputs: [
|
|
440
|
+
{
|
|
441
|
+
internalType: "address",
|
|
442
|
+
name: "assetPoolERC20",
|
|
443
|
+
type: "address"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
internalType: "address",
|
|
447
|
+
name: "assetPoolERC721",
|
|
448
|
+
type: "address"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
internalType: "address",
|
|
452
|
+
name: "assetPoolETH",
|
|
453
|
+
type: "address"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
internalType: "address",
|
|
457
|
+
name: "verifierHub",
|
|
458
|
+
type: "address"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
internalType: "address",
|
|
462
|
+
name: "relayerHub",
|
|
463
|
+
type: "address"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
internalType: "address",
|
|
467
|
+
name: "feeManager",
|
|
468
|
+
type: "address"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
internalType: "address",
|
|
472
|
+
name: "comlianceManager",
|
|
473
|
+
type: "address"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
internalType: "address",
|
|
477
|
+
name: "merkleTreeOperator",
|
|
478
|
+
type: "address"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
internalType: "address",
|
|
482
|
+
name: "mimc254",
|
|
483
|
+
type: "address"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
internalType: "address",
|
|
487
|
+
name: "initialOwner",
|
|
488
|
+
type: "address"
|
|
489
|
+
}
|
|
490
|
+
],
|
|
491
|
+
stateMutability: "nonpayable",
|
|
492
|
+
type: "constructor"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
inputs: [
|
|
496
|
+
{
|
|
497
|
+
internalType: "address",
|
|
498
|
+
name: "target",
|
|
499
|
+
type: "address"
|
|
500
|
+
}
|
|
501
|
+
],
|
|
502
|
+
name: "AddressEmptyCode",
|
|
503
|
+
type: "error"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
inputs: [
|
|
507
|
+
{
|
|
508
|
+
internalType: "address",
|
|
509
|
+
name: "account",
|
|
510
|
+
type: "address"
|
|
511
|
+
}
|
|
512
|
+
],
|
|
513
|
+
name: "AddressInsufficientBalance",
|
|
514
|
+
type: "error"
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
inputs: [
|
|
518
|
+
],
|
|
519
|
+
name: "FailedInnerCall",
|
|
520
|
+
type: "error"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
inputs: [
|
|
524
|
+
],
|
|
525
|
+
name: "MerkleRootNotAllowed",
|
|
526
|
+
type: "error"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
inputs: [
|
|
530
|
+
],
|
|
531
|
+
name: "NoteAlreadyCreated",
|
|
532
|
+
type: "error"
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
inputs: [
|
|
536
|
+
],
|
|
537
|
+
name: "NoteFooterUsed",
|
|
538
|
+
type: "error"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
inputs: [
|
|
542
|
+
],
|
|
543
|
+
name: "NullifierUsed",
|
|
544
|
+
type: "error"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
inputs: [
|
|
548
|
+
{
|
|
549
|
+
internalType: "address",
|
|
550
|
+
name: "owner",
|
|
551
|
+
type: "address"
|
|
552
|
+
}
|
|
553
|
+
],
|
|
554
|
+
name: "OwnableInvalidOwner",
|
|
555
|
+
type: "error"
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
inputs: [
|
|
559
|
+
{
|
|
560
|
+
internalType: "address",
|
|
561
|
+
name: "account",
|
|
562
|
+
type: "address"
|
|
563
|
+
}
|
|
564
|
+
],
|
|
565
|
+
name: "OwnableUnauthorizedAccount",
|
|
566
|
+
type: "error"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
inputs: [
|
|
570
|
+
],
|
|
571
|
+
name: "RelayerNotRegistered",
|
|
572
|
+
type: "error"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
inputs: [
|
|
576
|
+
{
|
|
577
|
+
internalType: "address",
|
|
578
|
+
name: "token",
|
|
579
|
+
type: "address"
|
|
580
|
+
}
|
|
581
|
+
],
|
|
582
|
+
name: "SafeERC20FailedOperation",
|
|
583
|
+
type: "error"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
anonymous: false,
|
|
587
|
+
inputs: [
|
|
588
|
+
{
|
|
589
|
+
indexed: false,
|
|
590
|
+
internalType: "address",
|
|
591
|
+
name: "depositor",
|
|
592
|
+
type: "address"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
indexed: false,
|
|
596
|
+
internalType: "bytes32",
|
|
597
|
+
name: "noteOut",
|
|
598
|
+
type: "bytes32"
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
indexed: false,
|
|
602
|
+
internalType: "uint256",
|
|
603
|
+
name: "amount",
|
|
604
|
+
type: "uint256"
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
indexed: false,
|
|
608
|
+
internalType: "address",
|
|
609
|
+
name: "asset",
|
|
610
|
+
type: "address"
|
|
611
|
+
}
|
|
612
|
+
],
|
|
613
|
+
name: "Deposit",
|
|
614
|
+
type: "event"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
anonymous: false,
|
|
618
|
+
inputs: [
|
|
619
|
+
{
|
|
620
|
+
indexed: false,
|
|
621
|
+
internalType: "bytes32",
|
|
622
|
+
name: "nullifierIn1",
|
|
623
|
+
type: "bytes32"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
indexed: false,
|
|
627
|
+
internalType: "bytes32",
|
|
628
|
+
name: "nullifierIn2",
|
|
629
|
+
type: "bytes32"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
indexed: false,
|
|
633
|
+
internalType: "bytes32",
|
|
634
|
+
name: "noteOut1",
|
|
635
|
+
type: "bytes32"
|
|
636
|
+
}
|
|
637
|
+
],
|
|
638
|
+
name: "Join",
|
|
639
|
+
type: "event"
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
anonymous: false,
|
|
643
|
+
inputs: [
|
|
644
|
+
{
|
|
645
|
+
indexed: false,
|
|
646
|
+
internalType: "bytes32",
|
|
647
|
+
name: "nullifierIn1",
|
|
648
|
+
type: "bytes32"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
indexed: false,
|
|
652
|
+
internalType: "bytes32",
|
|
653
|
+
name: "nullifierIn2",
|
|
654
|
+
type: "bytes32"
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
indexed: false,
|
|
658
|
+
internalType: "bytes32",
|
|
659
|
+
name: "noteOut1",
|
|
660
|
+
type: "bytes32"
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
indexed: false,
|
|
664
|
+
internalType: "bytes32",
|
|
665
|
+
name: "noteOut2",
|
|
666
|
+
type: "bytes32"
|
|
667
|
+
}
|
|
668
|
+
],
|
|
669
|
+
name: "JoinSplit",
|
|
670
|
+
type: "event"
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
anonymous: false,
|
|
674
|
+
inputs: [
|
|
675
|
+
{
|
|
676
|
+
indexed: true,
|
|
677
|
+
internalType: "address",
|
|
678
|
+
name: "previousOwner",
|
|
679
|
+
type: "address"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
indexed: true,
|
|
683
|
+
internalType: "address",
|
|
684
|
+
name: "newOwner",
|
|
685
|
+
type: "address"
|
|
686
|
+
}
|
|
687
|
+
],
|
|
688
|
+
name: "OwnershipTransferred",
|
|
689
|
+
type: "event"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
anonymous: false,
|
|
693
|
+
inputs: [
|
|
694
|
+
{
|
|
695
|
+
indexed: false,
|
|
696
|
+
internalType: "bytes32",
|
|
697
|
+
name: "nullifierIn",
|
|
698
|
+
type: "bytes32"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
indexed: false,
|
|
702
|
+
internalType: "bytes32",
|
|
703
|
+
name: "noteOut1",
|
|
704
|
+
type: "bytes32"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
indexed: false,
|
|
708
|
+
internalType: "bytes32",
|
|
709
|
+
name: "noteOut2",
|
|
710
|
+
type: "bytes32"
|
|
711
|
+
}
|
|
712
|
+
],
|
|
713
|
+
name: "Split",
|
|
714
|
+
type: "event"
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
anonymous: false,
|
|
718
|
+
inputs: [
|
|
719
|
+
{
|
|
720
|
+
indexed: false,
|
|
721
|
+
internalType: "bytes32",
|
|
722
|
+
name: "nullifierIn",
|
|
723
|
+
type: "bytes32"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
indexed: false,
|
|
727
|
+
internalType: "uint256",
|
|
728
|
+
name: "amount",
|
|
729
|
+
type: "uint256"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
indexed: false,
|
|
733
|
+
internalType: "address",
|
|
734
|
+
name: "asset",
|
|
735
|
+
type: "address"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
indexed: false,
|
|
739
|
+
internalType: "bytes32",
|
|
740
|
+
name: "noteOut",
|
|
741
|
+
type: "bytes32"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
indexed: false,
|
|
745
|
+
internalType: "bytes32",
|
|
746
|
+
name: "noteFooter",
|
|
747
|
+
type: "bytes32"
|
|
748
|
+
}
|
|
749
|
+
],
|
|
750
|
+
name: "Transfer",
|
|
751
|
+
type: "event"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
anonymous: false,
|
|
755
|
+
inputs: [
|
|
756
|
+
{
|
|
757
|
+
indexed: false,
|
|
758
|
+
internalType: "bytes32",
|
|
759
|
+
name: "nullifierIn",
|
|
760
|
+
type: "bytes32"
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
indexed: false,
|
|
764
|
+
internalType: "uint256",
|
|
765
|
+
name: "amount",
|
|
766
|
+
type: "uint256"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
indexed: false,
|
|
770
|
+
internalType: "address",
|
|
771
|
+
name: "asset",
|
|
772
|
+
type: "address"
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
indexed: false,
|
|
776
|
+
internalType: "address",
|
|
777
|
+
name: "recipient",
|
|
778
|
+
type: "address"
|
|
779
|
+
}
|
|
780
|
+
],
|
|
781
|
+
name: "Withdraw",
|
|
782
|
+
type: "event"
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
inputs: [
|
|
786
|
+
],
|
|
787
|
+
name: "ASSET_ETH",
|
|
788
|
+
outputs: [
|
|
789
|
+
{
|
|
790
|
+
internalType: "bytes32",
|
|
791
|
+
name: "",
|
|
792
|
+
type: "bytes32"
|
|
793
|
+
}
|
|
794
|
+
],
|
|
795
|
+
stateMutability: "view",
|
|
796
|
+
type: "function"
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
inputs: [
|
|
800
|
+
],
|
|
801
|
+
name: "ETH_ADDRESS",
|
|
802
|
+
outputs: [
|
|
803
|
+
{
|
|
804
|
+
internalType: "address",
|
|
805
|
+
name: "",
|
|
806
|
+
type: "address"
|
|
807
|
+
}
|
|
808
|
+
],
|
|
809
|
+
stateMutability: "view",
|
|
810
|
+
type: "function"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
inputs: [
|
|
814
|
+
],
|
|
815
|
+
name: "P",
|
|
816
|
+
outputs: [
|
|
817
|
+
{
|
|
818
|
+
internalType: "uint256",
|
|
819
|
+
name: "",
|
|
820
|
+
type: "uint256"
|
|
821
|
+
}
|
|
822
|
+
],
|
|
823
|
+
stateMutability: "view",
|
|
824
|
+
type: "function"
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
inputs: [
|
|
828
|
+
{
|
|
829
|
+
internalType: "address",
|
|
830
|
+
name: "_asset",
|
|
831
|
+
type: "address"
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
internalType: "uint256",
|
|
835
|
+
name: "_amount",
|
|
836
|
+
type: "uint256"
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
internalType: "bytes32",
|
|
840
|
+
name: "_noteCommitment",
|
|
841
|
+
type: "bytes32"
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
internalType: "bytes32",
|
|
845
|
+
name: "_noteFooter",
|
|
846
|
+
type: "bytes32"
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
internalType: "bytes",
|
|
850
|
+
name: "_proof",
|
|
851
|
+
type: "bytes"
|
|
852
|
+
}
|
|
853
|
+
],
|
|
854
|
+
name: "depositERC20",
|
|
855
|
+
outputs: [
|
|
856
|
+
],
|
|
857
|
+
stateMutability: "nonpayable",
|
|
858
|
+
type: "function"
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
inputs: [
|
|
862
|
+
{
|
|
863
|
+
internalType: "bytes32",
|
|
864
|
+
name: "_noteCommitment",
|
|
865
|
+
type: "bytes32"
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
internalType: "bytes32",
|
|
869
|
+
name: "_noteFooter",
|
|
870
|
+
type: "bytes32"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
internalType: "bytes",
|
|
874
|
+
name: "_proof",
|
|
875
|
+
type: "bytes"
|
|
876
|
+
}
|
|
877
|
+
],
|
|
878
|
+
name: "depositETH",
|
|
879
|
+
outputs: [
|
|
880
|
+
],
|
|
881
|
+
stateMutability: "payable",
|
|
882
|
+
type: "function"
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
inputs: [
|
|
886
|
+
],
|
|
887
|
+
name: "getAssetPoolERC20",
|
|
888
|
+
outputs: [
|
|
889
|
+
{
|
|
890
|
+
internalType: "address",
|
|
891
|
+
name: "",
|
|
892
|
+
type: "address"
|
|
893
|
+
}
|
|
894
|
+
],
|
|
895
|
+
stateMutability: "view",
|
|
896
|
+
type: "function"
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
inputs: [
|
|
900
|
+
],
|
|
901
|
+
name: "getAssetPoolERC721",
|
|
902
|
+
outputs: [
|
|
903
|
+
{
|
|
904
|
+
internalType: "address",
|
|
905
|
+
name: "",
|
|
906
|
+
type: "address"
|
|
907
|
+
}
|
|
908
|
+
],
|
|
909
|
+
stateMutability: "view",
|
|
910
|
+
type: "function"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
inputs: [
|
|
914
|
+
],
|
|
915
|
+
name: "getAssetPoolETH",
|
|
916
|
+
outputs: [
|
|
917
|
+
{
|
|
918
|
+
internalType: "address",
|
|
919
|
+
name: "",
|
|
920
|
+
type: "address"
|
|
921
|
+
}
|
|
922
|
+
],
|
|
923
|
+
stateMutability: "view",
|
|
924
|
+
type: "function"
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
inputs: [
|
|
928
|
+
],
|
|
929
|
+
name: "getComplianceManager",
|
|
930
|
+
outputs: [
|
|
931
|
+
{
|
|
932
|
+
internalType: "address",
|
|
933
|
+
name: "",
|
|
934
|
+
type: "address"
|
|
935
|
+
}
|
|
936
|
+
],
|
|
937
|
+
stateMutability: "view",
|
|
938
|
+
type: "function"
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
inputs: [
|
|
942
|
+
],
|
|
943
|
+
name: "getFeeManager",
|
|
944
|
+
outputs: [
|
|
945
|
+
{
|
|
946
|
+
internalType: "address",
|
|
947
|
+
name: "",
|
|
948
|
+
type: "address"
|
|
949
|
+
}
|
|
950
|
+
],
|
|
951
|
+
stateMutability: "view",
|
|
952
|
+
type: "function"
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
inputs: [
|
|
956
|
+
],
|
|
957
|
+
name: "getMerkleTreeOperator",
|
|
958
|
+
outputs: [
|
|
959
|
+
{
|
|
960
|
+
internalType: "address",
|
|
961
|
+
name: "",
|
|
962
|
+
type: "address"
|
|
963
|
+
}
|
|
964
|
+
],
|
|
965
|
+
stateMutability: "view",
|
|
966
|
+
type: "function"
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
inputs: [
|
|
970
|
+
],
|
|
971
|
+
name: "getMimc254",
|
|
972
|
+
outputs: [
|
|
973
|
+
{
|
|
974
|
+
internalType: "address",
|
|
975
|
+
name: "",
|
|
976
|
+
type: "address"
|
|
977
|
+
}
|
|
978
|
+
],
|
|
979
|
+
stateMutability: "view",
|
|
980
|
+
type: "function"
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
inputs: [
|
|
984
|
+
],
|
|
985
|
+
name: "getRelayerHub",
|
|
986
|
+
outputs: [
|
|
987
|
+
{
|
|
988
|
+
internalType: "address",
|
|
989
|
+
name: "",
|
|
990
|
+
type: "address"
|
|
991
|
+
}
|
|
992
|
+
],
|
|
993
|
+
stateMutability: "view",
|
|
994
|
+
type: "function"
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
inputs: [
|
|
998
|
+
],
|
|
999
|
+
name: "getVerifierHub",
|
|
1000
|
+
outputs: [
|
|
1001
|
+
{
|
|
1002
|
+
internalType: "address",
|
|
1003
|
+
name: "",
|
|
1004
|
+
type: "address"
|
|
1005
|
+
}
|
|
1006
|
+
],
|
|
1007
|
+
stateMutability: "view",
|
|
1008
|
+
type: "function"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
inputs: [
|
|
1012
|
+
{
|
|
1013
|
+
internalType: "bytes32",
|
|
1014
|
+
name: "_merkleRoot",
|
|
1015
|
+
type: "bytes32"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
internalType: "bytes32",
|
|
1019
|
+
name: "_nullifierIn1",
|
|
1020
|
+
type: "bytes32"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
internalType: "bytes32",
|
|
1024
|
+
name: "_nullifierIn2",
|
|
1025
|
+
type: "bytes32"
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
internalType: "bytes32",
|
|
1029
|
+
name: "_noteOut",
|
|
1030
|
+
type: "bytes32"
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
internalType: "bytes32",
|
|
1034
|
+
name: "_noteFooter",
|
|
1035
|
+
type: "bytes32"
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
internalType: "bytes",
|
|
1039
|
+
name: "_proof",
|
|
1040
|
+
type: "bytes"
|
|
1041
|
+
}
|
|
1042
|
+
],
|
|
1043
|
+
name: "join",
|
|
1044
|
+
outputs: [
|
|
1045
|
+
],
|
|
1046
|
+
stateMutability: "payable",
|
|
1047
|
+
type: "function"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
inputs: [
|
|
1051
|
+
{
|
|
1052
|
+
internalType: "bytes32",
|
|
1053
|
+
name: "_merkleRoot",
|
|
1054
|
+
type: "bytes32"
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
internalType: "bytes32",
|
|
1058
|
+
name: "_nullifierIn1",
|
|
1059
|
+
type: "bytes32"
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
internalType: "bytes32",
|
|
1063
|
+
name: "_nullifierIn2",
|
|
1064
|
+
type: "bytes32"
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
internalType: "bytes32",
|
|
1068
|
+
name: "_noteOut1",
|
|
1069
|
+
type: "bytes32"
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
internalType: "bytes32",
|
|
1073
|
+
name: "_noteOut2",
|
|
1074
|
+
type: "bytes32"
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
internalType: "bytes32",
|
|
1078
|
+
name: "_noteFooter1",
|
|
1079
|
+
type: "bytes32"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
internalType: "bytes32",
|
|
1083
|
+
name: "_noteFooter2",
|
|
1084
|
+
type: "bytes32"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
internalType: "bytes",
|
|
1088
|
+
name: "_proof",
|
|
1089
|
+
type: "bytes"
|
|
1090
|
+
}
|
|
1091
|
+
],
|
|
1092
|
+
name: "joinSplit",
|
|
1093
|
+
outputs: [
|
|
1094
|
+
],
|
|
1095
|
+
stateMutability: "payable",
|
|
1096
|
+
type: "function"
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
inputs: [
|
|
1100
|
+
],
|
|
1101
|
+
name: "owner",
|
|
1102
|
+
outputs: [
|
|
1103
|
+
{
|
|
1104
|
+
internalType: "address",
|
|
1105
|
+
name: "",
|
|
1106
|
+
type: "address"
|
|
1107
|
+
}
|
|
1108
|
+
],
|
|
1109
|
+
stateMutability: "view",
|
|
1110
|
+
type: "function"
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
inputs: [
|
|
1114
|
+
{
|
|
1115
|
+
internalType: "address",
|
|
1116
|
+
name: "asset",
|
|
1117
|
+
type: "address"
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
internalType: "uint256",
|
|
1121
|
+
name: "amount",
|
|
1122
|
+
type: "uint256"
|
|
1123
|
+
}
|
|
1124
|
+
],
|
|
1125
|
+
name: "releaseToAsssetPool",
|
|
1126
|
+
outputs: [
|
|
1127
|
+
],
|
|
1128
|
+
stateMutability: "nonpayable",
|
|
1129
|
+
type: "function"
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
inputs: [
|
|
1133
|
+
],
|
|
1134
|
+
name: "renounceOwnership",
|
|
1135
|
+
outputs: [
|
|
1136
|
+
],
|
|
1137
|
+
stateMutability: "nonpayable",
|
|
1138
|
+
type: "function"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
inputs: [
|
|
1142
|
+
{
|
|
1143
|
+
internalType: "address",
|
|
1144
|
+
name: "assetPoolERC20",
|
|
1145
|
+
type: "address"
|
|
1146
|
+
}
|
|
1147
|
+
],
|
|
1148
|
+
name: "setAssetPoolERC20",
|
|
1149
|
+
outputs: [
|
|
1150
|
+
],
|
|
1151
|
+
stateMutability: "nonpayable",
|
|
1152
|
+
type: "function"
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
inputs: [
|
|
1156
|
+
{
|
|
1157
|
+
internalType: "address",
|
|
1158
|
+
name: "assetPoolERC721",
|
|
1159
|
+
type: "address"
|
|
1160
|
+
}
|
|
1161
|
+
],
|
|
1162
|
+
name: "setAssetPoolERC721",
|
|
1163
|
+
outputs: [
|
|
1164
|
+
],
|
|
1165
|
+
stateMutability: "nonpayable",
|
|
1166
|
+
type: "function"
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
inputs: [
|
|
1170
|
+
{
|
|
1171
|
+
internalType: "address",
|
|
1172
|
+
name: "assetPoolETH",
|
|
1173
|
+
type: "address"
|
|
1174
|
+
}
|
|
1175
|
+
],
|
|
1176
|
+
name: "setAssetPoolETH",
|
|
1177
|
+
outputs: [
|
|
1178
|
+
],
|
|
1179
|
+
stateMutability: "nonpayable",
|
|
1180
|
+
type: "function"
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
inputs: [
|
|
1184
|
+
{
|
|
1185
|
+
internalType: "address",
|
|
1186
|
+
name: "complianceManager",
|
|
1187
|
+
type: "address"
|
|
1188
|
+
}
|
|
1189
|
+
],
|
|
1190
|
+
name: "setComplianceManager",
|
|
1191
|
+
outputs: [
|
|
1192
|
+
],
|
|
1193
|
+
stateMutability: "nonpayable",
|
|
1194
|
+
type: "function"
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
inputs: [
|
|
1198
|
+
{
|
|
1199
|
+
internalType: "address",
|
|
1200
|
+
name: "feeManager",
|
|
1201
|
+
type: "address"
|
|
1202
|
+
}
|
|
1203
|
+
],
|
|
1204
|
+
name: "setFeeManager",
|
|
1205
|
+
outputs: [
|
|
1206
|
+
],
|
|
1207
|
+
stateMutability: "nonpayable",
|
|
1208
|
+
type: "function"
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
inputs: [
|
|
1212
|
+
{
|
|
1213
|
+
internalType: "address",
|
|
1214
|
+
name: "relayerHub",
|
|
1215
|
+
type: "address"
|
|
1216
|
+
}
|
|
1217
|
+
],
|
|
1218
|
+
name: "setRelayerHub",
|
|
1219
|
+
outputs: [
|
|
1220
|
+
],
|
|
1221
|
+
stateMutability: "nonpayable",
|
|
1222
|
+
type: "function"
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
inputs: [
|
|
1226
|
+
{
|
|
1227
|
+
internalType: "address",
|
|
1228
|
+
name: "verifierHub",
|
|
1229
|
+
type: "address"
|
|
1230
|
+
}
|
|
1231
|
+
],
|
|
1232
|
+
name: "setVerifierHub",
|
|
1233
|
+
outputs: [
|
|
1234
|
+
],
|
|
1235
|
+
stateMutability: "nonpayable",
|
|
1236
|
+
type: "function"
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
inputs: [
|
|
1240
|
+
{
|
|
1241
|
+
internalType: "bytes32",
|
|
1242
|
+
name: "_merkleRoot",
|
|
1243
|
+
type: "bytes32"
|
|
1244
|
+
},
|
|
1245
|
+
{
|
|
1246
|
+
internalType: "bytes32",
|
|
1247
|
+
name: "_nullifierIn1",
|
|
1248
|
+
type: "bytes32"
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
internalType: "bytes32",
|
|
1252
|
+
name: "_noteOut1",
|
|
1253
|
+
type: "bytes32"
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
internalType: "bytes32",
|
|
1257
|
+
name: "_noteOut2",
|
|
1258
|
+
type: "bytes32"
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
internalType: "bytes32",
|
|
1262
|
+
name: "_noteFooter1",
|
|
1263
|
+
type: "bytes32"
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
internalType: "bytes32",
|
|
1267
|
+
name: "_noteFooter2",
|
|
1268
|
+
type: "bytes32"
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
internalType: "bytes",
|
|
1272
|
+
name: "_proof",
|
|
1273
|
+
type: "bytes"
|
|
1274
|
+
}
|
|
1275
|
+
],
|
|
1276
|
+
name: "split",
|
|
1277
|
+
outputs: [
|
|
1278
|
+
],
|
|
1279
|
+
stateMutability: "payable",
|
|
1280
|
+
type: "function"
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
inputs: [
|
|
1284
|
+
{
|
|
1285
|
+
internalType: "bytes32",
|
|
1286
|
+
name: "_merkleRoot",
|
|
1287
|
+
type: "bytes32"
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
internalType: "bytes32",
|
|
1291
|
+
name: "_nullifierIn",
|
|
1292
|
+
type: "bytes32"
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
internalType: "address",
|
|
1296
|
+
name: "_asset",
|
|
1297
|
+
type: "address"
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
internalType: "uint256",
|
|
1301
|
+
name: "_amount",
|
|
1302
|
+
type: "uint256"
|
|
1303
|
+
},
|
|
1304
|
+
{
|
|
1305
|
+
internalType: "bytes32",
|
|
1306
|
+
name: "_noteOut",
|
|
1307
|
+
type: "bytes32"
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
internalType: "bytes32",
|
|
1311
|
+
name: "_noteFooter",
|
|
1312
|
+
type: "bytes32"
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
internalType: "bytes",
|
|
1316
|
+
name: "_proof",
|
|
1317
|
+
type: "bytes"
|
|
1318
|
+
}
|
|
1319
|
+
],
|
|
1320
|
+
name: "transfer",
|
|
1321
|
+
outputs: [
|
|
1322
|
+
],
|
|
1323
|
+
stateMutability: "nonpayable",
|
|
1324
|
+
type: "function"
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
inputs: [
|
|
1328
|
+
{
|
|
1329
|
+
internalType: "address",
|
|
1330
|
+
name: "newOwner",
|
|
1331
|
+
type: "address"
|
|
1332
|
+
}
|
|
1333
|
+
],
|
|
1334
|
+
name: "transferOwnership",
|
|
1335
|
+
outputs: [
|
|
1336
|
+
],
|
|
1337
|
+
stateMutability: "nonpayable",
|
|
1338
|
+
type: "function"
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
inputs: [
|
|
1342
|
+
{
|
|
1343
|
+
internalType: "address",
|
|
1344
|
+
name: "_asset",
|
|
1345
|
+
type: "address"
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
internalType: "bytes",
|
|
1349
|
+
name: "_proof",
|
|
1350
|
+
type: "bytes"
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
internalType: "bytes32",
|
|
1354
|
+
name: "_merkleRoot",
|
|
1355
|
+
type: "bytes32"
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
internalType: "bytes32",
|
|
1359
|
+
name: "_nullifier",
|
|
1360
|
+
type: "bytes32"
|
|
1361
|
+
},
|
|
1362
|
+
{
|
|
1363
|
+
internalType: "address",
|
|
1364
|
+
name: "_recipient",
|
|
1365
|
+
type: "address"
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
internalType: "address",
|
|
1369
|
+
name: "_relayer",
|
|
1370
|
+
type: "address"
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
internalType: "uint256",
|
|
1374
|
+
name: "_amount",
|
|
1375
|
+
type: "uint256"
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
internalType: "uint256",
|
|
1379
|
+
name: "_relayerGasFee",
|
|
1380
|
+
type: "uint256"
|
|
1381
|
+
}
|
|
1382
|
+
],
|
|
1383
|
+
name: "withdrawERC20",
|
|
1384
|
+
outputs: [
|
|
1385
|
+
],
|
|
1386
|
+
stateMutability: "nonpayable",
|
|
1387
|
+
type: "function"
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
inputs: [
|
|
1391
|
+
{
|
|
1392
|
+
internalType: "bytes",
|
|
1393
|
+
name: "_proof",
|
|
1394
|
+
type: "bytes"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
internalType: "bytes32",
|
|
1398
|
+
name: "_merkleRoot",
|
|
1399
|
+
type: "bytes32"
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
internalType: "bytes32",
|
|
1403
|
+
name: "_nullifier",
|
|
1404
|
+
type: "bytes32"
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
internalType: "address payable",
|
|
1408
|
+
name: "_recipient",
|
|
1409
|
+
type: "address"
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
internalType: "address payable",
|
|
1413
|
+
name: "_relayer",
|
|
1414
|
+
type: "address"
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
internalType: "uint256",
|
|
1418
|
+
name: "_relayerGasFee",
|
|
1419
|
+
type: "uint256"
|
|
1420
|
+
},
|
|
1421
|
+
{
|
|
1422
|
+
internalType: "uint256",
|
|
1423
|
+
name: "_amount",
|
|
1424
|
+
type: "uint256"
|
|
1425
|
+
}
|
|
1426
|
+
],
|
|
1427
|
+
name: "withdrawETH",
|
|
1428
|
+
outputs: [
|
|
1429
|
+
],
|
|
1430
|
+
stateMutability: "nonpayable",
|
|
1431
|
+
type: "function"
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
stateMutability: "payable",
|
|
1435
|
+
type: "receive"
|
|
1436
|
+
}
|
|
1437
|
+
];
|
|
1438
|
+
var bytecode = "";
|
|
1439
|
+
var deployedBytecode = "";
|
|
1440
|
+
var linkReferences = {
|
|
1441
|
+
};
|
|
1442
|
+
var deployedLinkReferences = {
|
|
1443
|
+
};
|
|
1444
|
+
var DarkpoolAssetManagerAbi = {
|
|
1445
|
+
_format: _format,
|
|
1446
|
+
contractName: contractName,
|
|
1447
|
+
sourceName: sourceName,
|
|
1448
|
+
abi: abi,
|
|
1449
|
+
bytecode: bytecode,
|
|
1450
|
+
deployedBytecode: deployedBytecode,
|
|
1451
|
+
linkReferences: linkReferences,
|
|
1452
|
+
deployedLinkReferences: deployedLinkReferences
|
|
1453
|
+
};
|
|
1454
|
+
|
|
1455
|
+
var _format$1 = "hh-sol-artifact-1";
|
|
1456
|
+
var contractName$1 = "IERC20";
|
|
1457
|
+
var sourceName$1 = "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
1458
|
+
var abi$1 = [
|
|
1459
|
+
{
|
|
1460
|
+
anonymous: false,
|
|
1461
|
+
inputs: [
|
|
1462
|
+
{
|
|
1463
|
+
indexed: true,
|
|
1464
|
+
internalType: "address",
|
|
1465
|
+
name: "owner",
|
|
1466
|
+
type: "address"
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
indexed: true,
|
|
1470
|
+
internalType: "address",
|
|
1471
|
+
name: "spender",
|
|
1472
|
+
type: "address"
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
indexed: false,
|
|
1476
|
+
internalType: "uint256",
|
|
1477
|
+
name: "value",
|
|
1478
|
+
type: "uint256"
|
|
1479
|
+
}
|
|
1480
|
+
],
|
|
1481
|
+
name: "Approval",
|
|
1482
|
+
type: "event"
|
|
1483
|
+
},
|
|
1484
|
+
{
|
|
1485
|
+
anonymous: false,
|
|
1486
|
+
inputs: [
|
|
1487
|
+
{
|
|
1488
|
+
indexed: true,
|
|
1489
|
+
internalType: "address",
|
|
1490
|
+
name: "from",
|
|
1491
|
+
type: "address"
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
indexed: true,
|
|
1495
|
+
internalType: "address",
|
|
1496
|
+
name: "to",
|
|
1497
|
+
type: "address"
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
indexed: false,
|
|
1501
|
+
internalType: "uint256",
|
|
1502
|
+
name: "value",
|
|
1503
|
+
type: "uint256"
|
|
1504
|
+
}
|
|
1505
|
+
],
|
|
1506
|
+
name: "Transfer",
|
|
1507
|
+
type: "event"
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
inputs: [
|
|
1511
|
+
{
|
|
1512
|
+
internalType: "address",
|
|
1513
|
+
name: "owner",
|
|
1514
|
+
type: "address"
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
internalType: "address",
|
|
1518
|
+
name: "spender",
|
|
1519
|
+
type: "address"
|
|
1520
|
+
}
|
|
1521
|
+
],
|
|
1522
|
+
name: "allowance",
|
|
1523
|
+
outputs: [
|
|
1524
|
+
{
|
|
1525
|
+
internalType: "uint256",
|
|
1526
|
+
name: "",
|
|
1527
|
+
type: "uint256"
|
|
1528
|
+
}
|
|
1529
|
+
],
|
|
1530
|
+
stateMutability: "view",
|
|
1531
|
+
type: "function"
|
|
1532
|
+
},
|
|
1533
|
+
{
|
|
1534
|
+
inputs: [
|
|
1535
|
+
{
|
|
1536
|
+
internalType: "address",
|
|
1537
|
+
name: "spender",
|
|
1538
|
+
type: "address"
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
internalType: "uint256",
|
|
1542
|
+
name: "value",
|
|
1543
|
+
type: "uint256"
|
|
1544
|
+
}
|
|
1545
|
+
],
|
|
1546
|
+
name: "approve",
|
|
1547
|
+
outputs: [
|
|
1548
|
+
{
|
|
1549
|
+
internalType: "bool",
|
|
1550
|
+
name: "",
|
|
1551
|
+
type: "bool"
|
|
1552
|
+
}
|
|
1553
|
+
],
|
|
1554
|
+
stateMutability: "nonpayable",
|
|
1555
|
+
type: "function"
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
inputs: [
|
|
1559
|
+
{
|
|
1560
|
+
internalType: "address",
|
|
1561
|
+
name: "account",
|
|
1562
|
+
type: "address"
|
|
1563
|
+
}
|
|
1564
|
+
],
|
|
1565
|
+
name: "balanceOf",
|
|
1566
|
+
outputs: [
|
|
1567
|
+
{
|
|
1568
|
+
internalType: "uint256",
|
|
1569
|
+
name: "",
|
|
1570
|
+
type: "uint256"
|
|
1571
|
+
}
|
|
1572
|
+
],
|
|
1573
|
+
stateMutability: "view",
|
|
1574
|
+
type: "function"
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
inputs: [
|
|
1578
|
+
],
|
|
1579
|
+
name: "totalSupply",
|
|
1580
|
+
outputs: [
|
|
1581
|
+
{
|
|
1582
|
+
internalType: "uint256",
|
|
1583
|
+
name: "",
|
|
1584
|
+
type: "uint256"
|
|
1585
|
+
}
|
|
1586
|
+
],
|
|
1587
|
+
stateMutability: "view",
|
|
1588
|
+
type: "function"
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
inputs: [
|
|
1592
|
+
{
|
|
1593
|
+
internalType: "address",
|
|
1594
|
+
name: "to",
|
|
1595
|
+
type: "address"
|
|
1596
|
+
},
|
|
1597
|
+
{
|
|
1598
|
+
internalType: "uint256",
|
|
1599
|
+
name: "value",
|
|
1600
|
+
type: "uint256"
|
|
1601
|
+
}
|
|
1602
|
+
],
|
|
1603
|
+
name: "transfer",
|
|
1604
|
+
outputs: [
|
|
1605
|
+
{
|
|
1606
|
+
internalType: "bool",
|
|
1607
|
+
name: "",
|
|
1608
|
+
type: "bool"
|
|
1609
|
+
}
|
|
1610
|
+
],
|
|
1611
|
+
stateMutability: "nonpayable",
|
|
1612
|
+
type: "function"
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
inputs: [
|
|
1616
|
+
{
|
|
1617
|
+
internalType: "address",
|
|
1618
|
+
name: "from",
|
|
1619
|
+
type: "address"
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
internalType: "address",
|
|
1623
|
+
name: "to",
|
|
1624
|
+
type: "address"
|
|
1625
|
+
},
|
|
1626
|
+
{
|
|
1627
|
+
internalType: "uint256",
|
|
1628
|
+
name: "value",
|
|
1629
|
+
type: "uint256"
|
|
1630
|
+
}
|
|
1631
|
+
],
|
|
1632
|
+
name: "transferFrom",
|
|
1633
|
+
outputs: [
|
|
1634
|
+
{
|
|
1635
|
+
internalType: "bool",
|
|
1636
|
+
name: "",
|
|
1637
|
+
type: "bool"
|
|
1638
|
+
}
|
|
1639
|
+
],
|
|
1640
|
+
stateMutability: "nonpayable",
|
|
1641
|
+
type: "function"
|
|
1642
|
+
}
|
|
1643
|
+
];
|
|
1644
|
+
var bytecode$1 = "0x";
|
|
1645
|
+
var deployedBytecode$1 = "0x";
|
|
1646
|
+
var linkReferences$1 = {
|
|
1647
|
+
};
|
|
1648
|
+
var deployedLinkReferences$1 = {
|
|
1649
|
+
};
|
|
1650
|
+
var ERC20Abi = {
|
|
1651
|
+
_format: _format$1,
|
|
1652
|
+
contractName: contractName$1,
|
|
1653
|
+
sourceName: sourceName$1,
|
|
1654
|
+
abi: abi$1,
|
|
1655
|
+
bytecode: bytecode$1,
|
|
1656
|
+
deployedBytecode: deployedBytecode$1,
|
|
1657
|
+
linkReferences: linkReferences$1,
|
|
1658
|
+
deployedLinkReferences: deployedLinkReferences$1
|
|
1659
|
+
};
|
|
1660
|
+
|
|
1661
|
+
var _format$2 = "hh-sol-artifact-1";
|
|
1662
|
+
var contractName$2 = "IERC20";
|
|
1663
|
+
var sourceName$2 = "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
1664
|
+
var abi$2 = [
|
|
1665
|
+
{
|
|
1666
|
+
anonymous: false,
|
|
1667
|
+
inputs: [
|
|
1668
|
+
{
|
|
1669
|
+
indexed: true,
|
|
1670
|
+
internalType: "address",
|
|
1671
|
+
name: "owner",
|
|
1672
|
+
type: "address"
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
indexed: true,
|
|
1676
|
+
internalType: "address",
|
|
1677
|
+
name: "spender",
|
|
1678
|
+
type: "address"
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
indexed: false,
|
|
1682
|
+
internalType: "uint256",
|
|
1683
|
+
name: "value",
|
|
1684
|
+
type: "uint256"
|
|
1685
|
+
}
|
|
1686
|
+
],
|
|
1687
|
+
name: "Approval",
|
|
1688
|
+
type: "event"
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
anonymous: false,
|
|
1692
|
+
inputs: [
|
|
1693
|
+
{
|
|
1694
|
+
indexed: true,
|
|
1695
|
+
internalType: "address",
|
|
1696
|
+
name: "from",
|
|
1697
|
+
type: "address"
|
|
1698
|
+
},
|
|
1699
|
+
{
|
|
1700
|
+
indexed: true,
|
|
1701
|
+
internalType: "address",
|
|
1702
|
+
name: "to",
|
|
1703
|
+
type: "address"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
indexed: false,
|
|
1707
|
+
internalType: "uint256",
|
|
1708
|
+
name: "value",
|
|
1709
|
+
type: "uint256"
|
|
1710
|
+
}
|
|
1711
|
+
],
|
|
1712
|
+
name: "Transfer",
|
|
1713
|
+
type: "event"
|
|
1714
|
+
},
|
|
1715
|
+
{
|
|
1716
|
+
inputs: [
|
|
1717
|
+
{
|
|
1718
|
+
internalType: "address",
|
|
1719
|
+
name: "owner",
|
|
1720
|
+
type: "address"
|
|
1721
|
+
},
|
|
1722
|
+
{
|
|
1723
|
+
internalType: "address",
|
|
1724
|
+
name: "spender",
|
|
1725
|
+
type: "address"
|
|
1726
|
+
}
|
|
1727
|
+
],
|
|
1728
|
+
name: "allowance",
|
|
1729
|
+
outputs: [
|
|
1730
|
+
{
|
|
1731
|
+
internalType: "uint256",
|
|
1732
|
+
name: "",
|
|
1733
|
+
type: "uint256"
|
|
1734
|
+
}
|
|
1735
|
+
],
|
|
1736
|
+
stateMutability: "view",
|
|
1737
|
+
type: "function"
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
inputs: [
|
|
1741
|
+
{
|
|
1742
|
+
internalType: "address",
|
|
1743
|
+
name: "spender",
|
|
1744
|
+
type: "address"
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
internalType: "uint256",
|
|
1748
|
+
name: "value",
|
|
1749
|
+
type: "uint256"
|
|
1750
|
+
}
|
|
1751
|
+
],
|
|
1752
|
+
name: "approve",
|
|
1753
|
+
outputs: [
|
|
1754
|
+
],
|
|
1755
|
+
stateMutability: "nonpayable",
|
|
1756
|
+
type: "function"
|
|
1757
|
+
},
|
|
1758
|
+
{
|
|
1759
|
+
inputs: [
|
|
1760
|
+
{
|
|
1761
|
+
internalType: "address",
|
|
1762
|
+
name: "account",
|
|
1763
|
+
type: "address"
|
|
1764
|
+
}
|
|
1765
|
+
],
|
|
1766
|
+
name: "balanceOf",
|
|
1767
|
+
outputs: [
|
|
1768
|
+
{
|
|
1769
|
+
internalType: "uint256",
|
|
1770
|
+
name: "",
|
|
1771
|
+
type: "uint256"
|
|
1772
|
+
}
|
|
1773
|
+
],
|
|
1774
|
+
stateMutability: "view",
|
|
1775
|
+
type: "function"
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
inputs: [
|
|
1779
|
+
],
|
|
1780
|
+
name: "totalSupply",
|
|
1781
|
+
outputs: [
|
|
1782
|
+
{
|
|
1783
|
+
internalType: "uint256",
|
|
1784
|
+
name: "",
|
|
1785
|
+
type: "uint256"
|
|
1786
|
+
}
|
|
1787
|
+
],
|
|
1788
|
+
stateMutability: "view",
|
|
1789
|
+
type: "function"
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
inputs: [
|
|
1793
|
+
{
|
|
1794
|
+
internalType: "address",
|
|
1795
|
+
name: "to",
|
|
1796
|
+
type: "address"
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
internalType: "uint256",
|
|
1800
|
+
name: "value",
|
|
1801
|
+
type: "uint256"
|
|
1802
|
+
}
|
|
1803
|
+
],
|
|
1804
|
+
name: "transfer",
|
|
1805
|
+
outputs: [
|
|
1806
|
+
{
|
|
1807
|
+
internalType: "bool",
|
|
1808
|
+
name: "",
|
|
1809
|
+
type: "bool"
|
|
1810
|
+
}
|
|
1811
|
+
],
|
|
1812
|
+
stateMutability: "nonpayable",
|
|
1813
|
+
type: "function"
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
inputs: [
|
|
1817
|
+
{
|
|
1818
|
+
internalType: "address",
|
|
1819
|
+
name: "from",
|
|
1820
|
+
type: "address"
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
internalType: "address",
|
|
1824
|
+
name: "to",
|
|
1825
|
+
type: "address"
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
internalType: "uint256",
|
|
1829
|
+
name: "value",
|
|
1830
|
+
type: "uint256"
|
|
1831
|
+
}
|
|
1832
|
+
],
|
|
1833
|
+
name: "transferFrom",
|
|
1834
|
+
outputs: [
|
|
1835
|
+
{
|
|
1836
|
+
internalType: "bool",
|
|
1837
|
+
name: "",
|
|
1838
|
+
type: "bool"
|
|
1839
|
+
}
|
|
1840
|
+
],
|
|
1841
|
+
stateMutability: "nonpayable",
|
|
1842
|
+
type: "function"
|
|
1843
|
+
}
|
|
1844
|
+
];
|
|
1845
|
+
var bytecode$2 = "0x";
|
|
1846
|
+
var deployedBytecode$2 = "0x";
|
|
1847
|
+
var linkReferences$2 = {
|
|
1848
|
+
};
|
|
1849
|
+
var deployedLinkReferences$2 = {
|
|
1850
|
+
};
|
|
1851
|
+
var ERC20_USDT = {
|
|
1852
|
+
_format: _format$2,
|
|
1853
|
+
contractName: contractName$2,
|
|
1854
|
+
sourceName: sourceName$2,
|
|
1855
|
+
abi: abi$2,
|
|
1856
|
+
bytecode: bytecode$2,
|
|
1857
|
+
deployedBytecode: deployedBytecode$2,
|
|
1858
|
+
linkReferences: linkReferences$2,
|
|
1859
|
+
deployedLinkReferences: deployedLinkReferences$2
|
|
1860
|
+
};
|
|
1861
|
+
|
|
1862
|
+
var DarkpoolError = /*#__PURE__*/function (_Error) {
|
|
1863
|
+
function DarkpoolError(message) {
|
|
1864
|
+
var _this;
|
|
1865
|
+
_this = _Error.call(this, message) || this;
|
|
1866
|
+
_this.name = 'DarkpoolError';
|
|
1867
|
+
return _this;
|
|
1868
|
+
}
|
|
1869
|
+
_inheritsLoose(DarkpoolError, _Error);
|
|
1870
|
+
return DarkpoolError;
|
|
1871
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1872
|
+
|
|
1873
|
+
var NoteOnChainStatus;
|
|
1874
|
+
(function (NoteOnChainStatus) {
|
|
1875
|
+
NoteOnChainStatus["ACTIVE"] = "ACTIVE";
|
|
1876
|
+
NoteOnChainStatus["SPENT"] = "SPENT";
|
|
1877
|
+
NoteOnChainStatus["LOCKED"] = "LOCKED";
|
|
1878
|
+
NoteOnChainStatus["UNKNOWN"] = "UNKNOWN";
|
|
1879
|
+
})(NoteOnChainStatus || (NoteOnChainStatus = {}));
|
|
1880
|
+
|
|
1881
|
+
var NATIVE_ASSETS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
1882
|
+
function isNativeAsset(asset) {
|
|
1883
|
+
return asset.toLowerCase() === NATIVE_ASSETS.toLowerCase();
|
|
1884
|
+
}
|
|
1885
|
+
function isAddressEquals(address1, address2) {
|
|
1886
|
+
if (!address1 || !address2) return false;
|
|
1887
|
+
return address1.toLowerCase() === address2.toLowerCase();
|
|
1888
|
+
}
|
|
1889
|
+
function hexlify32(value) {
|
|
1890
|
+
return ethers.zeroPadValue(ethers.toBeHex(value), 32);
|
|
1891
|
+
}
|
|
1892
|
+
function hexlify16(value) {
|
|
1893
|
+
return ethers.zeroPadValue(ethers.toBeHex(value), 16);
|
|
1894
|
+
}
|
|
1895
|
+
function hexlify8(value) {
|
|
1896
|
+
return ethers.zeroPadValue(ethers.toBeHex(value), 8);
|
|
1897
|
+
}
|
|
1898
|
+
function hexlify5(value) {
|
|
1899
|
+
return ethers.zeroPadValue(ethers.toBeHex(value), 5);
|
|
1900
|
+
}
|
|
1901
|
+
function hexlify3(value) {
|
|
1902
|
+
return ethers.zeroPadValue(ethers.toBeHex(value), 3);
|
|
1903
|
+
}
|
|
1904
|
+
function hexlify1(value) {
|
|
1905
|
+
return ethers.toBeHex(value);
|
|
1906
|
+
}
|
|
1907
|
+
function isHexEquals(hex1, hex2) {
|
|
1908
|
+
if (!hex1 || !hex2) return false;
|
|
1909
|
+
return hex1.toLowerCase() === hex2.toLowerCase();
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
var BaseContext = /*#__PURE__*/function () {
|
|
1913
|
+
function BaseContext(signature) {
|
|
1914
|
+
this._signature = signature;
|
|
1915
|
+
}
|
|
1916
|
+
return _createClass(BaseContext, [{
|
|
1917
|
+
key: "signature",
|
|
1918
|
+
get: function get() {
|
|
1919
|
+
return this._signature;
|
|
1920
|
+
}
|
|
1921
|
+
}, {
|
|
1922
|
+
key: "merkleRoot",
|
|
1923
|
+
get: function get() {
|
|
1924
|
+
return this._merkleRoot;
|
|
1925
|
+
},
|
|
1926
|
+
set: function set(merkleRoot) {
|
|
1927
|
+
this._merkleRoot = merkleRoot;
|
|
1928
|
+
}
|
|
1929
|
+
}, {
|
|
1930
|
+
key: "tx",
|
|
1931
|
+
get: function get() {
|
|
1932
|
+
return this._tx;
|
|
1933
|
+
},
|
|
1934
|
+
set: function set(tx) {
|
|
1935
|
+
this._tx = tx;
|
|
1936
|
+
}
|
|
1937
|
+
}]);
|
|
1938
|
+
}();
|
|
1939
|
+
var BaseRelayerContext = /*#__PURE__*/function (_BaseContext) {
|
|
1940
|
+
function BaseRelayerContext(relayer, signature) {
|
|
1941
|
+
var _this;
|
|
1942
|
+
_this = _BaseContext.call(this, signature) || this;
|
|
1943
|
+
_this._relayer = relayer;
|
|
1944
|
+
return _this;
|
|
1945
|
+
}
|
|
1946
|
+
_inheritsLoose(BaseRelayerContext, _BaseContext);
|
|
1947
|
+
return _createClass(BaseRelayerContext, [{
|
|
1948
|
+
key: "relayer",
|
|
1949
|
+
get: function get() {
|
|
1950
|
+
return this._relayer;
|
|
1951
|
+
}
|
|
1952
|
+
}, {
|
|
1953
|
+
key: "jobId",
|
|
1954
|
+
get: function get() {
|
|
1955
|
+
return this._jobId;
|
|
1956
|
+
},
|
|
1957
|
+
set: function set(jobId) {
|
|
1958
|
+
this._jobId = jobId;
|
|
1959
|
+
}
|
|
1960
|
+
}]);
|
|
1961
|
+
}(BaseContext);
|
|
1962
|
+
var BaseContractService = function BaseContractService(_darkPool) {
|
|
1963
|
+
this._darkPool = _darkPool;
|
|
1964
|
+
};
|
|
1965
|
+
var BaseRelayerService = /*#__PURE__*/function () {
|
|
1966
|
+
function BaseRelayerService(_darkPool) {
|
|
1967
|
+
this._darkPool = _darkPool;
|
|
1968
|
+
}
|
|
1969
|
+
var _proto = BaseRelayerService.prototype;
|
|
1970
|
+
_proto.execute = /*#__PURE__*/function () {
|
|
1971
|
+
var _execute = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(context) {
|
|
1972
|
+
var relayerRequest, response;
|
|
1973
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1974
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1975
|
+
case 0:
|
|
1976
|
+
_context.next = 2;
|
|
1977
|
+
return this.getRelayerRequest(context);
|
|
1978
|
+
case 2:
|
|
1979
|
+
relayerRequest = _context.sent;
|
|
1980
|
+
_context.next = 5;
|
|
1981
|
+
return axios.post(context.relayer.hostUrl + this.getRelayerPath(), relayerRequest);
|
|
1982
|
+
case 5:
|
|
1983
|
+
response = _context.sent;
|
|
1984
|
+
if (!(response.status == 200)) {
|
|
1985
|
+
_context.next = 11;
|
|
1986
|
+
break;
|
|
1987
|
+
}
|
|
1988
|
+
context.jobId = response.data.id;
|
|
1989
|
+
return _context.abrupt("return", response.data.id);
|
|
1990
|
+
case 11:
|
|
1991
|
+
if (!(response.status == 400)) {
|
|
1992
|
+
_context.next = 15;
|
|
1993
|
+
break;
|
|
1994
|
+
}
|
|
1995
|
+
throw new Error('Request error' + response.data.error);
|
|
1996
|
+
case 15:
|
|
1997
|
+
throw new Error('Relayer not asscessable');
|
|
1998
|
+
case 16:
|
|
1999
|
+
case "end":
|
|
2000
|
+
return _context.stop();
|
|
2001
|
+
}
|
|
2002
|
+
}, _callee, this);
|
|
2003
|
+
}));
|
|
2004
|
+
function execute(_x) {
|
|
2005
|
+
return _execute.apply(this, arguments);
|
|
2006
|
+
}
|
|
2007
|
+
return execute;
|
|
2008
|
+
}();
|
|
2009
|
+
_proto.executeAndWaitForResult = /*#__PURE__*/function () {
|
|
2010
|
+
var _executeAndWaitForResult = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(context) {
|
|
2011
|
+
var _yield$this$pollJobSt, error, txHash;
|
|
2012
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2013
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2014
|
+
case 0:
|
|
2015
|
+
_context2.next = 2;
|
|
2016
|
+
return this.execute(context);
|
|
2017
|
+
case 2:
|
|
2018
|
+
_context2.next = 4;
|
|
2019
|
+
return this.pollJobStatus(context);
|
|
2020
|
+
case 4:
|
|
2021
|
+
_yield$this$pollJobSt = _context2.sent;
|
|
2022
|
+
error = _yield$this$pollJobSt.error;
|
|
2023
|
+
txHash = _yield$this$pollJobSt.txHash;
|
|
2024
|
+
console.log('relayer response, error and tx: ', error, txHash);
|
|
2025
|
+
if (!error) {
|
|
2026
|
+
_context2.next = 10;
|
|
2027
|
+
break;
|
|
2028
|
+
}
|
|
2029
|
+
throw new DarkpoolError(error);
|
|
2030
|
+
case 10:
|
|
2031
|
+
_context2.next = 12;
|
|
2032
|
+
return this.postExecute(context);
|
|
2033
|
+
case 12:
|
|
2034
|
+
return _context2.abrupt("return", _context2.sent);
|
|
2035
|
+
case 13:
|
|
2036
|
+
case "end":
|
|
2037
|
+
return _context2.stop();
|
|
2038
|
+
}
|
|
2039
|
+
}, _callee2, this);
|
|
2040
|
+
}));
|
|
2041
|
+
function executeAndWaitForResult(_x2) {
|
|
2042
|
+
return _executeAndWaitForResult.apply(this, arguments);
|
|
2043
|
+
}
|
|
2044
|
+
return executeAndWaitForResult;
|
|
2045
|
+
}();
|
|
2046
|
+
_proto.pollJobStatus = /*#__PURE__*/function () {
|
|
2047
|
+
var _pollJobStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(context) {
|
|
2048
|
+
var tries, txHash, response, error, _response$data, _txHash, status, failedReason;
|
|
2049
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2050
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
2051
|
+
case 0:
|
|
2052
|
+
tries = 1;
|
|
2053
|
+
txHash = undefined;
|
|
2054
|
+
case 2:
|
|
2055
|
+
if (!(tries <= 100)) {
|
|
2056
|
+
_context3.next = 30;
|
|
2057
|
+
break;
|
|
2058
|
+
}
|
|
2059
|
+
if (!(tries >= 100)) {
|
|
2060
|
+
_context3.next = 5;
|
|
2061
|
+
break;
|
|
2062
|
+
}
|
|
2063
|
+
return _context3.abrupt("break", 30);
|
|
2064
|
+
case 5:
|
|
2065
|
+
_context3.prev = 5;
|
|
2066
|
+
_context3.next = 8;
|
|
2067
|
+
return axios.get(context.relayer.hostUrl + "/v1/jobs/" + context.jobId);
|
|
2068
|
+
case 8:
|
|
2069
|
+
response = _context3.sent;
|
|
2070
|
+
if (!(response.status === 400)) {
|
|
2071
|
+
_context3.next = 13;
|
|
2072
|
+
break;
|
|
2073
|
+
}
|
|
2074
|
+
error = response.data.error;
|
|
2075
|
+
console.log(error);
|
|
2076
|
+
return _context3.abrupt("return", {
|
|
2077
|
+
error: 'Failed to submit transaction to relayer:' + error,
|
|
2078
|
+
txHash: undefined
|
|
2079
|
+
});
|
|
2080
|
+
case 13:
|
|
2081
|
+
if (!(response.status === 200)) {
|
|
2082
|
+
_context3.next = 20;
|
|
2083
|
+
break;
|
|
2084
|
+
}
|
|
2085
|
+
_response$data = response.data, _txHash = _response$data.txHash, status = _response$data.status, failedReason = _response$data.failedReason;
|
|
2086
|
+
context.tx = _txHash;
|
|
2087
|
+
if (!(status === 'FAILED')) {
|
|
2088
|
+
_context3.next = 18;
|
|
2089
|
+
break;
|
|
2090
|
+
}
|
|
2091
|
+
return _context3.abrupt("return", {
|
|
2092
|
+
error: failedReason != null ? failedReason : 'Transaction failed.',
|
|
2093
|
+
txHash: _txHash
|
|
2094
|
+
});
|
|
2095
|
+
case 18:
|
|
2096
|
+
if (!(status === 'CONFIRMED' || status === 'MINED')) {
|
|
2097
|
+
_context3.next = 20;
|
|
2098
|
+
break;
|
|
2099
|
+
}
|
|
2100
|
+
return _context3.abrupt("return", {
|
|
2101
|
+
error: undefined,
|
|
2102
|
+
txHash: _txHash
|
|
2103
|
+
});
|
|
2104
|
+
case 20:
|
|
2105
|
+
_context3.next = 22;
|
|
2106
|
+
return new Promise(function (resolve) {
|
|
2107
|
+
return setTimeout(resolve, 5000);
|
|
2108
|
+
});
|
|
2109
|
+
case 22:
|
|
2110
|
+
_context3.next = 27;
|
|
2111
|
+
break;
|
|
2112
|
+
case 24:
|
|
2113
|
+
_context3.prev = 24;
|
|
2114
|
+
_context3.t0 = _context3["catch"](5);
|
|
2115
|
+
console.log(_context3.t0);
|
|
2116
|
+
case 27:
|
|
2117
|
+
tries++;
|
|
2118
|
+
_context3.next = 2;
|
|
2119
|
+
break;
|
|
2120
|
+
case 30:
|
|
2121
|
+
return _context3.abrupt("return", {
|
|
2122
|
+
error: 'Waited too long for transaction to be mined.',
|
|
2123
|
+
txHash: txHash
|
|
2124
|
+
});
|
|
2125
|
+
case 31:
|
|
2126
|
+
case "end":
|
|
2127
|
+
return _context3.stop();
|
|
2128
|
+
}
|
|
2129
|
+
}, _callee3, null, [[5, 24]]);
|
|
2130
|
+
}));
|
|
2131
|
+
function pollJobStatus(_x3) {
|
|
2132
|
+
return _pollJobStatus.apply(this, arguments);
|
|
2133
|
+
}
|
|
2134
|
+
return pollJobStatus;
|
|
2135
|
+
}();
|
|
2136
|
+
return BaseRelayerService;
|
|
2137
|
+
}();
|
|
2138
|
+
function transferCodeToNoteFooter(transferCode, chainId) {
|
|
2139
|
+
var params = transferCode.trim().split('-');
|
|
2140
|
+
if (params.length < 3 || params[0] != 'ONEOFF' || params[1] != 'RECIPIENT' || params[2] != chainId.toString()) {
|
|
2141
|
+
throw new DarkpoolError('Invalid receiver code');
|
|
2142
|
+
}
|
|
2143
|
+
return BigInt(params[3]);
|
|
2144
|
+
}
|
|
2145
|
+
function validateRecipientCode(code) {
|
|
2146
|
+
var codePattern = /^(ONEOFF-RECIPIENT)-(\d+)-(\d+)/gm;
|
|
2147
|
+
return codePattern.test(code);
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
var ChainId;
|
|
2151
|
+
(function (ChainId) {
|
|
2152
|
+
ChainId[ChainId["HARDHAT"] = 31337] = "HARDHAT";
|
|
2153
|
+
ChainId[ChainId["HARDHAT_ARBITRUM"] = 31338] = "HARDHAT_ARBITRUM";
|
|
2154
|
+
ChainId[ChainId["HARDHAT_BASE"] = 31339] = "HARDHAT_BASE";
|
|
2155
|
+
ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
|
|
2156
|
+
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
|
|
2157
|
+
ChainId[ChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
|
|
2158
|
+
ChainId[ChainId["BASE"] = 8453] = "BASE";
|
|
2159
|
+
ChainId[ChainId["BounceBit"] = 6001] = "BounceBit";
|
|
2160
|
+
ChainId[ChainId["BounceBitTestnet"] = 6000] = "BounceBitTestnet";
|
|
2161
|
+
})(ChainId || (ChainId = {}));
|
|
2162
|
+
|
|
2163
|
+
var _relayerPathConfig, _legacyTokenConfig;
|
|
2164
|
+
var Action;
|
|
2165
|
+
(function (Action) {
|
|
2166
|
+
Action["CURVE_LP_DEPOSIT"] = "CURVE_LP_DEPOSIT";
|
|
2167
|
+
Action["CURVE_LP_WITHDRAW"] = "CURVE_LP_WITHDRAW";
|
|
2168
|
+
Action["CURVE_MULTI_SWAP"] = "CURVE_MULTI_SWAP";
|
|
2169
|
+
Action["DEFI_INFRA"] = "DEFI_INFRA";
|
|
2170
|
+
Action["STAKE"] = "STAKE";
|
|
2171
|
+
Action["REDEEM"] = "REDEEM";
|
|
2172
|
+
Action["UNISWAP_SINGLE_SWAP"] = "UNISWAP_SINGLE_SWAP";
|
|
2173
|
+
Action["UNISWAP_LP_DEPOSIT"] = "UNISWAP_LP_DEPOSIT";
|
|
2174
|
+
Action["UNISWAP_LP_WITHDRAW"] = "UNISWAP_LP_WITHDRAW";
|
|
2175
|
+
Action["UNISWAP_LP_COLLECT_FEE"] = "UNISWAP_LP_COLLECT_FEE";
|
|
2176
|
+
Action["WITHDRAW"] = "WITHDRAW";
|
|
2177
|
+
Action["AERODROME_SWAP"] = "AERODROME_SWAP";
|
|
2178
|
+
Action["AERODROME_LP_DEPOSIT"] = "AERODROME_LP_DEPOSIT";
|
|
2179
|
+
Action["AERODROME_LP_WITHDRAW"] = "AERODROME_LP_WITHDRAW";
|
|
2180
|
+
Action["ROCKET_POOL_STAKE"] = "ROCKET_POOL_STAKE";
|
|
2181
|
+
Action["ROCKET_POOL_UNSTAKE"] = "ROCKET_POOL_UNSTAKE";
|
|
2182
|
+
Action["SABLIER_CLAIM_STREAM"] = "SABLIER_CLAIM_STREAM";
|
|
2183
|
+
Action["THE_DEEP_NOTE_DEPOSIT"] = "THE_DEEP_NOTE_DEPOSIT";
|
|
2184
|
+
Action["THE_DEEP_WITHDRAW"] = "THE_DEEP_WITHDRAW";
|
|
2185
|
+
})(Action || (Action = {}));
|
|
2186
|
+
var relayerPathConfig = (_relayerPathConfig = {}, _relayerPathConfig[Action.WITHDRAW] = '/v1/pgDarkPoolWithdraw', _relayerPathConfig[Action.UNISWAP_SINGLE_SWAP] = '/v1/pgDarkPoolUniswapSingleSwap', _relayerPathConfig[Action.UNISWAP_LP_DEPOSIT] = '/v1/pgDarkPoolUniswapLP', _relayerPathConfig[Action.UNISWAP_LP_WITHDRAW] = '/v1/pgDarkPoolUniswapRemoveLiquidity', _relayerPathConfig[Action.UNISWAP_LP_COLLECT_FEE] = '/v1/pgDarkPoolUniswapCollectFees', _relayerPathConfig[Action.CURVE_LP_DEPOSIT] = '/v1/pgDarkPoolCurveAddLiquidity', _relayerPathConfig[Action.CURVE_LP_WITHDRAW] = '/v1/pgDarkPoolCurveRemoveLiquidity', _relayerPathConfig[Action.CURVE_MULTI_SWAP] = '/v1/pgDarkPoolCurveMultiExchange', _relayerPathConfig[Action.DEFI_INFRA] = '/v1/pgDarkPoolDefiInfra', _relayerPathConfig[Action.STAKE] = '/v1/pgDarkPoolZkStake', _relayerPathConfig[Action.REDEEM] = '/v1/pgDarkPoolZkRedeem', _relayerPathConfig[Action.AERODROME_SWAP] = '/v1/pgDarkPoolAerodromeSwap', _relayerPathConfig[Action.AERODROME_LP_DEPOSIT] = '/v1/pgDarkPoolAerodromeAddLiquidity', _relayerPathConfig[Action.AERODROME_LP_WITHDRAW] = '/v1/pgDarkPoolAerodromeRemoveLiquidity', _relayerPathConfig[Action.ROCKET_POOL_STAKE] = '/v1/pgDarkPoolRocketPoolStake', _relayerPathConfig[Action.ROCKET_POOL_UNSTAKE] = '/v1/pgDarkPoolRocketPoolUnStake', _relayerPathConfig[Action.SABLIER_CLAIM_STREAM] = '/v1/pgDarkPoolSablierClaim', _relayerPathConfig[Action.THE_DEEP_NOTE_DEPOSIT] = '/v1/pgDarkPoolTheDeepNoteDeposit', _relayerPathConfig[Action.THE_DEEP_WITHDRAW] = '/v1/pgDarkPoolTheDeepWithdraw', _relayerPathConfig);
|
|
2187
|
+
var legacyTokenConfig = (_legacyTokenConfig = {}, _legacyTokenConfig[ChainId.MAINNET] = ['0xdac17f958d2ee523a2206206994597c13d831ec7'], _legacyTokenConfig[ChainId.HARDHAT] = ['0xdac17f958d2ee523a2206206994597c13d831ec7'], _legacyTokenConfig);
|
|
2188
|
+
|
|
2189
|
+
var MAX_ALLOWANCE = /*#__PURE__*/BigInt('115792089237316195423570985008687907853269984665640564039457584007913129639935'); // 2**256 - 1
|
|
2190
|
+
var DepositContext = /*#__PURE__*/function (_BaseContext) {
|
|
2191
|
+
function DepositContext(signature) {
|
|
2192
|
+
return _BaseContext.call(this, signature) || this;
|
|
2193
|
+
}
|
|
2194
|
+
_inheritsLoose(DepositContext, _BaseContext);
|
|
2195
|
+
return _createClass(DepositContext, [{
|
|
2196
|
+
key: "note",
|
|
2197
|
+
get: function get() {
|
|
2198
|
+
return this._note;
|
|
2199
|
+
},
|
|
2200
|
+
set: function set(note) {
|
|
2201
|
+
this._note = note;
|
|
2202
|
+
}
|
|
2203
|
+
}, {
|
|
2204
|
+
key: "address",
|
|
2205
|
+
get: function get() {
|
|
2206
|
+
return this._address;
|
|
2207
|
+
},
|
|
2208
|
+
set: function set(address) {
|
|
2209
|
+
this._address = address;
|
|
2210
|
+
}
|
|
2211
|
+
}, {
|
|
2212
|
+
key: "proof",
|
|
2213
|
+
get: function get() {
|
|
2214
|
+
return this._proof;
|
|
2215
|
+
},
|
|
2216
|
+
set: function set(proof) {
|
|
2217
|
+
this._proof = proof;
|
|
2218
|
+
}
|
|
2219
|
+
}]);
|
|
2220
|
+
}(BaseContext);
|
|
2221
|
+
var DepositService = /*#__PURE__*/function (_BaseContractService) {
|
|
2222
|
+
function DepositService(_darkPool) {
|
|
2223
|
+
return _BaseContractService.call(this, _darkPool) || this;
|
|
2224
|
+
}
|
|
2225
|
+
_inheritsLoose(DepositService, _BaseContractService);
|
|
2226
|
+
var _proto = DepositService.prototype;
|
|
2227
|
+
_proto.prepare = /*#__PURE__*/function () {
|
|
2228
|
+
var _prepare = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(asset, amount, walletAddress, signature) {
|
|
2229
|
+
var note, context;
|
|
2230
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2231
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2232
|
+
case 0:
|
|
2233
|
+
_context.next = 2;
|
|
2234
|
+
return createNote(asset, amount, signature);
|
|
2235
|
+
case 2:
|
|
2236
|
+
note = _context.sent;
|
|
2237
|
+
context = new DepositContext(signature);
|
|
2238
|
+
context.note = note;
|
|
2239
|
+
context.address = walletAddress;
|
|
2240
|
+
return _context.abrupt("return", {
|
|
2241
|
+
context: context,
|
|
2242
|
+
outNotes: [note]
|
|
2243
|
+
});
|
|
2244
|
+
case 7:
|
|
2245
|
+
case "end":
|
|
2246
|
+
return _context.stop();
|
|
2247
|
+
}
|
|
2248
|
+
}, _callee);
|
|
2249
|
+
}));
|
|
2250
|
+
function prepare(_x, _x2, _x3, _x4) {
|
|
2251
|
+
return _prepare.apply(this, arguments);
|
|
2252
|
+
}
|
|
2253
|
+
return prepare;
|
|
2254
|
+
}();
|
|
2255
|
+
_proto.generateProof = /*#__PURE__*/function () {
|
|
2256
|
+
var _generateProof = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(context) {
|
|
2257
|
+
var proof;
|
|
2258
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2259
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2260
|
+
case 0:
|
|
2261
|
+
if (!(!context || !context.note || !context.address || !context.signature)) {
|
|
2262
|
+
_context2.next = 2;
|
|
2263
|
+
break;
|
|
2264
|
+
}
|
|
2265
|
+
throw new DarkpoolError('Invalid context');
|
|
2266
|
+
case 2:
|
|
2267
|
+
_context2.next = 4;
|
|
2268
|
+
return generateDepositProof({
|
|
2269
|
+
note: context.note,
|
|
2270
|
+
signedMessage: context.signature,
|
|
2271
|
+
address: context.address,
|
|
2272
|
+
options: this._darkPool.proofOptions
|
|
2273
|
+
});
|
|
2274
|
+
case 4:
|
|
2275
|
+
proof = _context2.sent;
|
|
2276
|
+
context.proof = proof;
|
|
2277
|
+
case 6:
|
|
2278
|
+
case "end":
|
|
2279
|
+
return _context2.stop();
|
|
2280
|
+
}
|
|
2281
|
+
}, _callee2, this);
|
|
2282
|
+
}));
|
|
2283
|
+
function generateProof(_x5) {
|
|
2284
|
+
return _generateProof.apply(this, arguments);
|
|
2285
|
+
}
|
|
2286
|
+
return generateProof;
|
|
2287
|
+
}();
|
|
2288
|
+
_proto.execute = /*#__PURE__*/function () {
|
|
2289
|
+
var _execute = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(context) {
|
|
2290
|
+
var signer, contract, tx, _tx;
|
|
2291
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2292
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
2293
|
+
case 0:
|
|
2294
|
+
if (!(!context || !context.note || !context.address || !context.signature || !context.proof)) {
|
|
2295
|
+
_context3.next = 2;
|
|
2296
|
+
break;
|
|
2297
|
+
}
|
|
2298
|
+
throw new DarkpoolError('Invalid context');
|
|
2299
|
+
case 2:
|
|
2300
|
+
signer = this._darkPool.signer;
|
|
2301
|
+
contract = new ethers.Contract(this._darkPool.contracts.darkpoolAssetManager, DarkpoolAssetManagerAbi.abi, signer);
|
|
2302
|
+
if (isNativeAsset(context.note.asset)) {
|
|
2303
|
+
_context3.next = 13;
|
|
2304
|
+
break;
|
|
2305
|
+
}
|
|
2306
|
+
_context3.next = 7;
|
|
2307
|
+
return this.allowance(context);
|
|
2308
|
+
case 7:
|
|
2309
|
+
_context3.next = 9;
|
|
2310
|
+
return contract.depositERC20(context.note.asset, hexlify32(context.note.amount), hexlify32(context.note.note), context.proof.noteFooter, context.proof.proof.proof);
|
|
2311
|
+
case 9:
|
|
2312
|
+
tx = _context3.sent;
|
|
2313
|
+
return _context3.abrupt("return", tx.hash);
|
|
2314
|
+
case 13:
|
|
2315
|
+
_context3.next = 15;
|
|
2316
|
+
return contract.depositETH(hexlify32(context.note.note), context.proof.noteFooter, context.proof.proof.proof, {
|
|
2317
|
+
value: context.note.amount
|
|
2318
|
+
});
|
|
2319
|
+
case 15:
|
|
2320
|
+
_tx = _context3.sent;
|
|
2321
|
+
return _context3.abrupt("return", _tx.hash);
|
|
2322
|
+
case 17:
|
|
2323
|
+
case "end":
|
|
2324
|
+
return _context3.stop();
|
|
2325
|
+
}
|
|
2326
|
+
}, _callee3, this);
|
|
2327
|
+
}));
|
|
2328
|
+
function execute(_x6) {
|
|
2329
|
+
return _execute.apply(this, arguments);
|
|
2330
|
+
}
|
|
2331
|
+
return execute;
|
|
2332
|
+
}();
|
|
2333
|
+
_proto.allowance = /*#__PURE__*/function () {
|
|
2334
|
+
var _allowance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(context) {
|
|
2335
|
+
var signer, allowanceContract, allowance, isLegacy, contract, tx;
|
|
2336
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2337
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
2338
|
+
case 0:
|
|
2339
|
+
if (!(!context || !context.note || !context.address || !context.signature || !context.proof)) {
|
|
2340
|
+
_context4.next = 2;
|
|
2341
|
+
break;
|
|
2342
|
+
}
|
|
2343
|
+
throw new DarkpoolError('Invalid context');
|
|
2344
|
+
case 2:
|
|
2345
|
+
signer = this._darkPool.signer;
|
|
2346
|
+
allowanceContract = new ethers.Contract(context.note.asset, ERC20Abi.abi, this._darkPool);
|
|
2347
|
+
_context4.next = 6;
|
|
2348
|
+
return allowanceContract.allowance(signer.getAddress(), this._darkPool.contracts.darkpoolAssetManager);
|
|
2349
|
+
case 6:
|
|
2350
|
+
allowance = _context4.sent;
|
|
2351
|
+
if (!(BigInt(allowance) < context.note.amount)) {
|
|
2352
|
+
_context4.next = 15;
|
|
2353
|
+
break;
|
|
2354
|
+
}
|
|
2355
|
+
isLegacy = legacyTokenConfig.hasOwnProperty(this._darkPool.chainId) && legacyTokenConfig[this._darkPool.chainId].includes(context.note.asset.toLowerCase());
|
|
2356
|
+
contract = new ethers.Contract(context.note.asset, isLegacy ? ERC20_USDT.abi : ERC20Abi.abi, signer);
|
|
2357
|
+
_context4.next = 12;
|
|
2358
|
+
return contract.approve(this._darkPool.contracts.darkpoolAssetManager, hexlify32(MAX_ALLOWANCE));
|
|
2359
|
+
case 12:
|
|
2360
|
+
tx = _context4.sent;
|
|
2361
|
+
_context4.next = 15;
|
|
2362
|
+
return tx.wait();
|
|
2363
|
+
case 15:
|
|
2364
|
+
case "end":
|
|
2365
|
+
return _context4.stop();
|
|
2366
|
+
}
|
|
2367
|
+
}, _callee4, this);
|
|
2368
|
+
}));
|
|
2369
|
+
function allowance(_x7) {
|
|
2370
|
+
return _allowance.apply(this, arguments);
|
|
2371
|
+
}
|
|
2372
|
+
return allowance;
|
|
2373
|
+
}();
|
|
2374
|
+
_proto.getContractCallParameters = function getContractCallParameters(context) {
|
|
2375
|
+
if (!context || !context.note || !context.address || !context.signature || !context.proof) {
|
|
2376
|
+
throw new DarkpoolError('Invalid context');
|
|
2377
|
+
}
|
|
2378
|
+
return {
|
|
2379
|
+
proof: context.proof.proof.proof,
|
|
2380
|
+
asset: context.note.asset,
|
|
2381
|
+
amount: hexlify32(context.note.amount),
|
|
2382
|
+
note: hexlify32(context.note.note),
|
|
2383
|
+
noteFooter: context.proof.noteFooter
|
|
2384
|
+
};
|
|
2385
|
+
};
|
|
2386
|
+
return DepositService;
|
|
2387
|
+
}(BaseContractService);
|
|
2388
|
+
|
|
2389
|
+
var _format$3 = "hh-sol-artifact-1";
|
|
2390
|
+
var contractName$3 = "MerkleTreeOperator";
|
|
2391
|
+
var sourceName$3 = "contracts/core/MerkleTreeOperator.sol";
|
|
2392
|
+
var abi$3 = [
|
|
2393
|
+
{
|
|
2394
|
+
inputs: [
|
|
2395
|
+
{
|
|
2396
|
+
internalType: "address",
|
|
2397
|
+
name: "initialOwner",
|
|
2398
|
+
type: "address"
|
|
2399
|
+
},
|
|
2400
|
+
{
|
|
2401
|
+
internalType: "address",
|
|
2402
|
+
name: "mimc254Address",
|
|
2403
|
+
type: "address"
|
|
2404
|
+
}
|
|
2405
|
+
],
|
|
2406
|
+
stateMutability: "nonpayable",
|
|
2407
|
+
type: "constructor"
|
|
2408
|
+
},
|
|
2409
|
+
{
|
|
2410
|
+
inputs: [
|
|
2411
|
+
],
|
|
2412
|
+
name: "InvalidLeaf",
|
|
2413
|
+
type: "error"
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
inputs: [
|
|
2417
|
+
],
|
|
2418
|
+
name: "MerkleRootNotAllowed",
|
|
2419
|
+
type: "error"
|
|
2420
|
+
},
|
|
2421
|
+
{
|
|
2422
|
+
inputs: [
|
|
2423
|
+
],
|
|
2424
|
+
name: "NoteAlreadyCreated",
|
|
2425
|
+
type: "error"
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
inputs: [
|
|
2429
|
+
],
|
|
2430
|
+
name: "NoteFooterUsed",
|
|
2431
|
+
type: "error"
|
|
2432
|
+
},
|
|
2433
|
+
{
|
|
2434
|
+
inputs: [
|
|
2435
|
+
],
|
|
2436
|
+
name: "NullifierUsed",
|
|
2437
|
+
type: "error"
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
inputs: [
|
|
2441
|
+
{
|
|
2442
|
+
internalType: "address",
|
|
2443
|
+
name: "owner",
|
|
2444
|
+
type: "address"
|
|
2445
|
+
}
|
|
2446
|
+
],
|
|
2447
|
+
name: "OwnableInvalidOwner",
|
|
2448
|
+
type: "error"
|
|
2449
|
+
},
|
|
2450
|
+
{
|
|
2451
|
+
inputs: [
|
|
2452
|
+
{
|
|
2453
|
+
internalType: "address",
|
|
2454
|
+
name: "account",
|
|
2455
|
+
type: "address"
|
|
2456
|
+
}
|
|
2457
|
+
],
|
|
2458
|
+
name: "OwnableUnauthorizedAccount",
|
|
2459
|
+
type: "error"
|
|
2460
|
+
},
|
|
2461
|
+
{
|
|
2462
|
+
anonymous: false,
|
|
2463
|
+
inputs: [
|
|
2464
|
+
{
|
|
2465
|
+
indexed: true,
|
|
2466
|
+
internalType: "address",
|
|
2467
|
+
name: "previousOwner",
|
|
2468
|
+
type: "address"
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
indexed: true,
|
|
2472
|
+
internalType: "address",
|
|
2473
|
+
name: "newOwner",
|
|
2474
|
+
type: "address"
|
|
2475
|
+
}
|
|
2476
|
+
],
|
|
2477
|
+
name: "OwnershipTransferred",
|
|
2478
|
+
type: "event"
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
inputs: [
|
|
2482
|
+
{
|
|
2483
|
+
internalType: "bytes32",
|
|
2484
|
+
name: "leaf",
|
|
2485
|
+
type: "bytes32"
|
|
2486
|
+
}
|
|
2487
|
+
],
|
|
2488
|
+
name: "appendMerkleLeaf",
|
|
2489
|
+
outputs: [
|
|
2490
|
+
],
|
|
2491
|
+
stateMutability: "nonpayable",
|
|
2492
|
+
type: "function"
|
|
2493
|
+
},
|
|
2494
|
+
{
|
|
2495
|
+
inputs: [
|
|
2496
|
+
{
|
|
2497
|
+
internalType: "address",
|
|
2498
|
+
name: "assetManager",
|
|
2499
|
+
type: "address"
|
|
2500
|
+
}
|
|
2501
|
+
],
|
|
2502
|
+
name: "assetManagersRegistered",
|
|
2503
|
+
outputs: [
|
|
2504
|
+
{
|
|
2505
|
+
internalType: "bool",
|
|
2506
|
+
name: "registered",
|
|
2507
|
+
type: "bool"
|
|
2508
|
+
}
|
|
2509
|
+
],
|
|
2510
|
+
stateMutability: "view",
|
|
2511
|
+
type: "function"
|
|
2512
|
+
},
|
|
2513
|
+
{
|
|
2514
|
+
inputs: [
|
|
2515
|
+
{
|
|
2516
|
+
internalType: "bytes32",
|
|
2517
|
+
name: "_noteCommitment",
|
|
2518
|
+
type: "bytes32"
|
|
2519
|
+
}
|
|
2520
|
+
],
|
|
2521
|
+
name: "getMerklePath",
|
|
2522
|
+
outputs: [
|
|
2523
|
+
{
|
|
2524
|
+
internalType: "bytes32[]",
|
|
2525
|
+
name: "",
|
|
2526
|
+
type: "bytes32[]"
|
|
2527
|
+
},
|
|
2528
|
+
{
|
|
2529
|
+
internalType: "bool[]",
|
|
2530
|
+
name: "",
|
|
2531
|
+
type: "bool[]"
|
|
2532
|
+
},
|
|
2533
|
+
{
|
|
2534
|
+
internalType: "bytes32",
|
|
2535
|
+
name: "",
|
|
2536
|
+
type: "bytes32"
|
|
2537
|
+
},
|
|
2538
|
+
{
|
|
2539
|
+
internalType: "uint256",
|
|
2540
|
+
name: "",
|
|
2541
|
+
type: "uint256"
|
|
2542
|
+
}
|
|
2543
|
+
],
|
|
2544
|
+
stateMutability: "view",
|
|
2545
|
+
type: "function"
|
|
2546
|
+
},
|
|
2547
|
+
{
|
|
2548
|
+
inputs: [
|
|
2549
|
+
],
|
|
2550
|
+
name: "getMerkleRoot",
|
|
2551
|
+
outputs: [
|
|
2552
|
+
{
|
|
2553
|
+
internalType: "bytes32",
|
|
2554
|
+
name: "",
|
|
2555
|
+
type: "bytes32"
|
|
2556
|
+
}
|
|
2557
|
+
],
|
|
2558
|
+
stateMutability: "view",
|
|
2559
|
+
type: "function"
|
|
2560
|
+
},
|
|
2561
|
+
{
|
|
2562
|
+
inputs: [
|
|
2563
|
+
],
|
|
2564
|
+
name: "getmerkleNodes",
|
|
2565
|
+
outputs: [
|
|
2566
|
+
{
|
|
2567
|
+
internalType: "bytes32[][]",
|
|
2568
|
+
name: "",
|
|
2569
|
+
type: "bytes32[][]"
|
|
2570
|
+
}
|
|
2571
|
+
],
|
|
2572
|
+
stateMutability: "view",
|
|
2573
|
+
type: "function"
|
|
2574
|
+
},
|
|
2575
|
+
{
|
|
2576
|
+
inputs: [
|
|
2577
|
+
{
|
|
2578
|
+
internalType: "uint256",
|
|
2579
|
+
name: "",
|
|
2580
|
+
type: "uint256"
|
|
2581
|
+
},
|
|
2582
|
+
{
|
|
2583
|
+
internalType: "uint256",
|
|
2584
|
+
name: "",
|
|
2585
|
+
type: "uint256"
|
|
2586
|
+
}
|
|
2587
|
+
],
|
|
2588
|
+
name: "merkleNodes",
|
|
2589
|
+
outputs: [
|
|
2590
|
+
{
|
|
2591
|
+
internalType: "bytes32",
|
|
2592
|
+
name: "",
|
|
2593
|
+
type: "bytes32"
|
|
2594
|
+
}
|
|
2595
|
+
],
|
|
2596
|
+
stateMutability: "view",
|
|
2597
|
+
type: "function"
|
|
2598
|
+
},
|
|
2599
|
+
{
|
|
2600
|
+
inputs: [
|
|
2601
|
+
],
|
|
2602
|
+
name: "merkleRoot",
|
|
2603
|
+
outputs: [
|
|
2604
|
+
{
|
|
2605
|
+
internalType: "bytes32",
|
|
2606
|
+
name: "",
|
|
2607
|
+
type: "bytes32"
|
|
2608
|
+
}
|
|
2609
|
+
],
|
|
2610
|
+
stateMutability: "view",
|
|
2611
|
+
type: "function"
|
|
2612
|
+
},
|
|
2613
|
+
{
|
|
2614
|
+
inputs: [
|
|
2615
|
+
{
|
|
2616
|
+
internalType: "bytes32",
|
|
2617
|
+
name: "_merkleRoot",
|
|
2618
|
+
type: "bytes32"
|
|
2619
|
+
}
|
|
2620
|
+
],
|
|
2621
|
+
name: "merkleRootIsAllowed",
|
|
2622
|
+
outputs: [
|
|
2623
|
+
{
|
|
2624
|
+
internalType: "bool",
|
|
2625
|
+
name: "",
|
|
2626
|
+
type: "bool"
|
|
2627
|
+
}
|
|
2628
|
+
],
|
|
2629
|
+
stateMutability: "view",
|
|
2630
|
+
type: "function"
|
|
2631
|
+
},
|
|
2632
|
+
{
|
|
2633
|
+
inputs: [
|
|
2634
|
+
{
|
|
2635
|
+
internalType: "bytes32",
|
|
2636
|
+
name: "root",
|
|
2637
|
+
type: "bytes32"
|
|
2638
|
+
}
|
|
2639
|
+
],
|
|
2640
|
+
name: "merkleRootsAllowed",
|
|
2641
|
+
outputs: [
|
|
2642
|
+
{
|
|
2643
|
+
internalType: "bool",
|
|
2644
|
+
name: "allowed",
|
|
2645
|
+
type: "bool"
|
|
2646
|
+
}
|
|
2647
|
+
],
|
|
2648
|
+
stateMutability: "view",
|
|
2649
|
+
type: "function"
|
|
2650
|
+
},
|
|
2651
|
+
{
|
|
2652
|
+
inputs: [
|
|
2653
|
+
],
|
|
2654
|
+
name: "mimcBn254Address",
|
|
2655
|
+
outputs: [
|
|
2656
|
+
{
|
|
2657
|
+
internalType: "address",
|
|
2658
|
+
name: "",
|
|
2659
|
+
type: "address"
|
|
2660
|
+
}
|
|
2661
|
+
],
|
|
2662
|
+
stateMutability: "view",
|
|
2663
|
+
type: "function"
|
|
2664
|
+
},
|
|
2665
|
+
{
|
|
2666
|
+
inputs: [
|
|
2667
|
+
{
|
|
2668
|
+
internalType: "bytes32",
|
|
2669
|
+
name: "commitment",
|
|
2670
|
+
type: "bytes32"
|
|
2671
|
+
}
|
|
2672
|
+
],
|
|
2673
|
+
name: "noteCommitmentsCreated",
|
|
2674
|
+
outputs: [
|
|
2675
|
+
{
|
|
2676
|
+
internalType: "bool",
|
|
2677
|
+
name: "created",
|
|
2678
|
+
type: "bool"
|
|
2679
|
+
}
|
|
2680
|
+
],
|
|
2681
|
+
stateMutability: "view",
|
|
2682
|
+
type: "function"
|
|
2683
|
+
},
|
|
2684
|
+
{
|
|
2685
|
+
inputs: [
|
|
2686
|
+
{
|
|
2687
|
+
internalType: "bytes32",
|
|
2688
|
+
name: "_noteFooter",
|
|
2689
|
+
type: "bytes32"
|
|
2690
|
+
}
|
|
2691
|
+
],
|
|
2692
|
+
name: "noteFooterIsNotUsed",
|
|
2693
|
+
outputs: [
|
|
2694
|
+
{
|
|
2695
|
+
internalType: "bool",
|
|
2696
|
+
name: "",
|
|
2697
|
+
type: "bool"
|
|
2698
|
+
}
|
|
2699
|
+
],
|
|
2700
|
+
stateMutability: "view",
|
|
2701
|
+
type: "function"
|
|
2702
|
+
},
|
|
2703
|
+
{
|
|
2704
|
+
inputs: [
|
|
2705
|
+
{
|
|
2706
|
+
internalType: "bytes32",
|
|
2707
|
+
name: "noteFooter",
|
|
2708
|
+
type: "bytes32"
|
|
2709
|
+
}
|
|
2710
|
+
],
|
|
2711
|
+
name: "noteFootersUsed",
|
|
2712
|
+
outputs: [
|
|
2713
|
+
{
|
|
2714
|
+
internalType: "bool",
|
|
2715
|
+
name: "used",
|
|
2716
|
+
type: "bool"
|
|
2717
|
+
}
|
|
2718
|
+
],
|
|
2719
|
+
stateMutability: "view",
|
|
2720
|
+
type: "function"
|
|
2721
|
+
},
|
|
2722
|
+
{
|
|
2723
|
+
inputs: [
|
|
2724
|
+
{
|
|
2725
|
+
internalType: "bytes32",
|
|
2726
|
+
name: "_noteCommitment",
|
|
2727
|
+
type: "bytes32"
|
|
2728
|
+
}
|
|
2729
|
+
],
|
|
2730
|
+
name: "noteIsNotCreated",
|
|
2731
|
+
outputs: [
|
|
2732
|
+
{
|
|
2733
|
+
internalType: "bool",
|
|
2734
|
+
name: "",
|
|
2735
|
+
type: "bool"
|
|
2736
|
+
}
|
|
2737
|
+
],
|
|
2738
|
+
stateMutability: "view",
|
|
2739
|
+
type: "function"
|
|
2740
|
+
},
|
|
2741
|
+
{
|
|
2742
|
+
inputs: [
|
|
2743
|
+
{
|
|
2744
|
+
internalType: "bytes32",
|
|
2745
|
+
name: "_nullifier",
|
|
2746
|
+
type: "bytes32"
|
|
2747
|
+
}
|
|
2748
|
+
],
|
|
2749
|
+
name: "nullifierIsNotLocked",
|
|
2750
|
+
outputs: [
|
|
2751
|
+
{
|
|
2752
|
+
internalType: "bool",
|
|
2753
|
+
name: "",
|
|
2754
|
+
type: "bool"
|
|
2755
|
+
}
|
|
2756
|
+
],
|
|
2757
|
+
stateMutability: "view",
|
|
2758
|
+
type: "function"
|
|
2759
|
+
},
|
|
2760
|
+
{
|
|
2761
|
+
inputs: [
|
|
2762
|
+
{
|
|
2763
|
+
internalType: "bytes32",
|
|
2764
|
+
name: "_nullifier",
|
|
2765
|
+
type: "bytes32"
|
|
2766
|
+
}
|
|
2767
|
+
],
|
|
2768
|
+
name: "nullifierIsNotUsed",
|
|
2769
|
+
outputs: [
|
|
2770
|
+
{
|
|
2771
|
+
internalType: "bool",
|
|
2772
|
+
name: "",
|
|
2773
|
+
type: "bool"
|
|
2774
|
+
}
|
|
2775
|
+
],
|
|
2776
|
+
stateMutability: "view",
|
|
2777
|
+
type: "function"
|
|
2778
|
+
},
|
|
2779
|
+
{
|
|
2780
|
+
inputs: [
|
|
2781
|
+
{
|
|
2782
|
+
internalType: "bytes32",
|
|
2783
|
+
name: "nullifier",
|
|
2784
|
+
type: "bytes32"
|
|
2785
|
+
}
|
|
2786
|
+
],
|
|
2787
|
+
name: "nullifiersLocked",
|
|
2788
|
+
outputs: [
|
|
2789
|
+
{
|
|
2790
|
+
internalType: "bool",
|
|
2791
|
+
name: "locked",
|
|
2792
|
+
type: "bool"
|
|
2793
|
+
}
|
|
2794
|
+
],
|
|
2795
|
+
stateMutability: "view",
|
|
2796
|
+
type: "function"
|
|
2797
|
+
},
|
|
2798
|
+
{
|
|
2799
|
+
inputs: [
|
|
2800
|
+
{
|
|
2801
|
+
internalType: "bytes32",
|
|
2802
|
+
name: "nullifier",
|
|
2803
|
+
type: "bytes32"
|
|
2804
|
+
}
|
|
2805
|
+
],
|
|
2806
|
+
name: "nullifiersUsed",
|
|
2807
|
+
outputs: [
|
|
2808
|
+
{
|
|
2809
|
+
internalType: "bool",
|
|
2810
|
+
name: "used",
|
|
2811
|
+
type: "bool"
|
|
2812
|
+
}
|
|
2813
|
+
],
|
|
2814
|
+
stateMutability: "view",
|
|
2815
|
+
type: "function"
|
|
2816
|
+
},
|
|
2817
|
+
{
|
|
2818
|
+
inputs: [
|
|
2819
|
+
],
|
|
2820
|
+
name: "owner",
|
|
2821
|
+
outputs: [
|
|
2822
|
+
{
|
|
2823
|
+
internalType: "address",
|
|
2824
|
+
name: "",
|
|
2825
|
+
type: "address"
|
|
2826
|
+
}
|
|
2827
|
+
],
|
|
2828
|
+
stateMutability: "view",
|
|
2829
|
+
type: "function"
|
|
2830
|
+
},
|
|
2831
|
+
{
|
|
2832
|
+
inputs: [
|
|
2833
|
+
],
|
|
2834
|
+
name: "renounceOwnership",
|
|
2835
|
+
outputs: [
|
|
2836
|
+
],
|
|
2837
|
+
stateMutability: "nonpayable",
|
|
2838
|
+
type: "function"
|
|
2839
|
+
},
|
|
2840
|
+
{
|
|
2841
|
+
inputs: [
|
|
2842
|
+
{
|
|
2843
|
+
internalType: "address",
|
|
2844
|
+
name: "assetManager",
|
|
2845
|
+
type: "address"
|
|
2846
|
+
},
|
|
2847
|
+
{
|
|
2848
|
+
internalType: "bool",
|
|
2849
|
+
name: "registered",
|
|
2850
|
+
type: "bool"
|
|
2851
|
+
}
|
|
2852
|
+
],
|
|
2853
|
+
name: "setAssetManager",
|
|
2854
|
+
outputs: [
|
|
2855
|
+
],
|
|
2856
|
+
stateMutability: "nonpayable",
|
|
2857
|
+
type: "function"
|
|
2858
|
+
},
|
|
2859
|
+
{
|
|
2860
|
+
inputs: [
|
|
2861
|
+
{
|
|
2862
|
+
internalType: "bytes32",
|
|
2863
|
+
name: "commitment",
|
|
2864
|
+
type: "bytes32"
|
|
2865
|
+
}
|
|
2866
|
+
],
|
|
2867
|
+
name: "setNoteCommitmentCreated",
|
|
2868
|
+
outputs: [
|
|
2869
|
+
],
|
|
2870
|
+
stateMutability: "nonpayable",
|
|
2871
|
+
type: "function"
|
|
2872
|
+
},
|
|
2873
|
+
{
|
|
2874
|
+
inputs: [
|
|
2875
|
+
{
|
|
2876
|
+
internalType: "bytes32",
|
|
2877
|
+
name: "noteFooter",
|
|
2878
|
+
type: "bytes32"
|
|
2879
|
+
}
|
|
2880
|
+
],
|
|
2881
|
+
name: "setNoteFooterUsed",
|
|
2882
|
+
outputs: [
|
|
2883
|
+
],
|
|
2884
|
+
stateMutability: "nonpayable",
|
|
2885
|
+
type: "function"
|
|
2886
|
+
},
|
|
2887
|
+
{
|
|
2888
|
+
inputs: [
|
|
2889
|
+
{
|
|
2890
|
+
internalType: "bytes32",
|
|
2891
|
+
name: "nullifier",
|
|
2892
|
+
type: "bytes32"
|
|
2893
|
+
},
|
|
2894
|
+
{
|
|
2895
|
+
internalType: "bool",
|
|
2896
|
+
name: "locked",
|
|
2897
|
+
type: "bool"
|
|
2898
|
+
}
|
|
2899
|
+
],
|
|
2900
|
+
name: "setNullifierLocked",
|
|
2901
|
+
outputs: [
|
|
2902
|
+
],
|
|
2903
|
+
stateMutability: "nonpayable",
|
|
2904
|
+
type: "function"
|
|
2905
|
+
},
|
|
2906
|
+
{
|
|
2907
|
+
inputs: [
|
|
2908
|
+
{
|
|
2909
|
+
internalType: "bytes32",
|
|
2910
|
+
name: "nullifier",
|
|
2911
|
+
type: "bytes32"
|
|
2912
|
+
}
|
|
2913
|
+
],
|
|
2914
|
+
name: "setNullifierUsed",
|
|
2915
|
+
outputs: [
|
|
2916
|
+
],
|
|
2917
|
+
stateMutability: "nonpayable",
|
|
2918
|
+
type: "function"
|
|
2919
|
+
},
|
|
2920
|
+
{
|
|
2921
|
+
inputs: [
|
|
2922
|
+
{
|
|
2923
|
+
internalType: "address",
|
|
2924
|
+
name: "newOwner",
|
|
2925
|
+
type: "address"
|
|
2926
|
+
}
|
|
2927
|
+
],
|
|
2928
|
+
name: "transferOwnership",
|
|
2929
|
+
outputs: [
|
|
2930
|
+
],
|
|
2931
|
+
stateMutability: "nonpayable",
|
|
2932
|
+
type: "function"
|
|
2933
|
+
}
|
|
2934
|
+
];
|
|
2935
|
+
var bytecode$3 = "";
|
|
2936
|
+
var deployedBytecode$3 = "";
|
|
2937
|
+
var linkReferences$3 = {
|
|
2938
|
+
};
|
|
2939
|
+
var deployedLinkReferences$3 = {
|
|
2940
|
+
};
|
|
2941
|
+
var MerkleAbi = {
|
|
2942
|
+
_format: _format$3,
|
|
2943
|
+
contractName: contractName$3,
|
|
2944
|
+
sourceName: sourceName$3,
|
|
2945
|
+
abi: abi$3,
|
|
2946
|
+
bytecode: bytecode$3,
|
|
2947
|
+
deployedBytecode: deployedBytecode$3,
|
|
2948
|
+
linkReferences: linkReferences$3,
|
|
2949
|
+
deployedLinkReferences: deployedLinkReferences$3
|
|
2950
|
+
};
|
|
2951
|
+
|
|
2952
|
+
function getContract(address, darkPool) {
|
|
2953
|
+
var provider = darkPool.provider;
|
|
2954
|
+
return new ethers.Contract(address, MerkleAbi.abi, provider);
|
|
2955
|
+
}
|
|
2956
|
+
function getMerklePathAndRoot(_x, _x2) {
|
|
2957
|
+
return _getMerklePathAndRoot.apply(this, arguments);
|
|
2958
|
+
}
|
|
2959
|
+
function _getMerklePathAndRoot() {
|
|
2960
|
+
_getMerklePathAndRoot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(note, darkPool) {
|
|
2961
|
+
var contract, _yield$contract$getMe, path, index, root;
|
|
2962
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2963
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2964
|
+
case 0:
|
|
2965
|
+
contract = getContract(darkPool.contracts.merkleTreeOperator, darkPool);
|
|
2966
|
+
_context.next = 3;
|
|
2967
|
+
return contract.getMerklePath(hexlify32(note));
|
|
2968
|
+
case 3:
|
|
2969
|
+
_yield$contract$getMe = _context.sent;
|
|
2970
|
+
path = _yield$contract$getMe[0];
|
|
2971
|
+
index = _yield$contract$getMe[1];
|
|
2972
|
+
root = _yield$contract$getMe[2];
|
|
2973
|
+
return _context.abrupt("return", {
|
|
2974
|
+
path: path,
|
|
2975
|
+
index: index.map(function (x) {
|
|
2976
|
+
return x ? 1 : 0;
|
|
2977
|
+
}),
|
|
2978
|
+
root: root
|
|
2979
|
+
});
|
|
2980
|
+
case 8:
|
|
2981
|
+
case "end":
|
|
2982
|
+
return _context.stop();
|
|
2983
|
+
}
|
|
2984
|
+
}, _callee);
|
|
2985
|
+
}));
|
|
2986
|
+
return _getMerklePathAndRoot.apply(this, arguments);
|
|
2987
|
+
}
|
|
2988
|
+
function multiGetMerklePathAndRoot(_x3, _x4) {
|
|
2989
|
+
return _multiGetMerklePathAndRoot.apply(this, arguments);
|
|
2990
|
+
}
|
|
2991
|
+
function _multiGetMerklePathAndRoot() {
|
|
2992
|
+
_multiGetMerklePathAndRoot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(notes, darkPool) {
|
|
2993
|
+
var contract, blockNumber, _yield$Promise$all, root, results;
|
|
2994
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2995
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2996
|
+
case 0:
|
|
2997
|
+
contract = getContract(darkPool.contracts.merkleTreeOperator, darkPool);
|
|
2998
|
+
_context2.next = 3;
|
|
2999
|
+
return darkPool.provider.getBlockNumber();
|
|
3000
|
+
case 3:
|
|
3001
|
+
blockNumber = _context2.sent;
|
|
3002
|
+
_context2.next = 6;
|
|
3003
|
+
return Promise.all([contract.getMerkleRoot({
|
|
3004
|
+
blockTag: blockNumber
|
|
3005
|
+
})].concat(notes.map(function (note) {
|
|
3006
|
+
return contract.getMerklePath(hexlify32(note), {
|
|
3007
|
+
blockTag: blockNumber
|
|
3008
|
+
});
|
|
3009
|
+
})));
|
|
3010
|
+
case 6:
|
|
3011
|
+
_yield$Promise$all = _context2.sent;
|
|
3012
|
+
root = _yield$Promise$all[0];
|
|
3013
|
+
results = _yield$Promise$all.slice(1);
|
|
3014
|
+
return _context2.abrupt("return", results.map(function (_ref, i) {
|
|
3015
|
+
var path = _ref[0],
|
|
3016
|
+
index = _ref[1];
|
|
3017
|
+
return {
|
|
3018
|
+
noteCommitment: notes[i],
|
|
3019
|
+
path: path,
|
|
3020
|
+
index: index.map(function (x) {
|
|
3021
|
+
return x ? 1 : 0;
|
|
3022
|
+
}),
|
|
3023
|
+
root: root
|
|
3024
|
+
};
|
|
3025
|
+
}));
|
|
3026
|
+
case 10:
|
|
3027
|
+
case "end":
|
|
3028
|
+
return _context2.stop();
|
|
3029
|
+
}
|
|
3030
|
+
}, _callee2);
|
|
3031
|
+
}));
|
|
3032
|
+
return _multiGetMerklePathAndRoot.apply(this, arguments);
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
var WithdrawContext = /*#__PURE__*/function (_BaseRelayerContext) {
|
|
3036
|
+
function WithdrawContext(relayer, signature) {
|
|
3037
|
+
return _BaseRelayerContext.call(this, relayer, signature) || this;
|
|
3038
|
+
}
|
|
3039
|
+
_inheritsLoose(WithdrawContext, _BaseRelayerContext);
|
|
3040
|
+
return _createClass(WithdrawContext, [{
|
|
3041
|
+
key: "note",
|
|
3042
|
+
get: function get() {
|
|
3043
|
+
return this._note;
|
|
3044
|
+
},
|
|
3045
|
+
set: function set(note) {
|
|
3046
|
+
this._note = note;
|
|
3047
|
+
}
|
|
3048
|
+
}, {
|
|
3049
|
+
key: "recipient",
|
|
3050
|
+
get: function get() {
|
|
3051
|
+
return this._recipient;
|
|
3052
|
+
},
|
|
3053
|
+
set: function set(recipient) {
|
|
3054
|
+
this._recipient = recipient;
|
|
3055
|
+
}
|
|
3056
|
+
}, {
|
|
3057
|
+
key: "proof",
|
|
3058
|
+
get: function get() {
|
|
3059
|
+
return this._proof;
|
|
3060
|
+
},
|
|
3061
|
+
set: function set(proof) {
|
|
3062
|
+
this._proof = proof;
|
|
3063
|
+
}
|
|
3064
|
+
}]);
|
|
3065
|
+
}(BaseRelayerContext);
|
|
3066
|
+
var WithdrawService = /*#__PURE__*/function (_BaseRelayerService) {
|
|
3067
|
+
function WithdrawService(_darkPool) {
|
|
3068
|
+
return _BaseRelayerService.call(this, _darkPool) || this;
|
|
3069
|
+
}
|
|
3070
|
+
_inheritsLoose(WithdrawService, _BaseRelayerService);
|
|
3071
|
+
var _proto = WithdrawService.prototype;
|
|
3072
|
+
_proto.prepare = /*#__PURE__*/function () {
|
|
3073
|
+
var _prepare = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(note, recipient, signature) {
|
|
3074
|
+
var context;
|
|
3075
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3076
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3077
|
+
case 0:
|
|
3078
|
+
context = new WithdrawContext(this._darkPool.getRelayer(), signature);
|
|
3079
|
+
context.note = note;
|
|
3080
|
+
context.recipient = recipient;
|
|
3081
|
+
return _context.abrupt("return", {
|
|
3082
|
+
context: context,
|
|
3083
|
+
outPartialNotes: []
|
|
3084
|
+
});
|
|
3085
|
+
case 4:
|
|
3086
|
+
case "end":
|
|
3087
|
+
return _context.stop();
|
|
3088
|
+
}
|
|
3089
|
+
}, _callee, this);
|
|
3090
|
+
}));
|
|
3091
|
+
function prepare(_x, _x2, _x3) {
|
|
3092
|
+
return _prepare.apply(this, arguments);
|
|
3093
|
+
}
|
|
3094
|
+
return prepare;
|
|
3095
|
+
}();
|
|
3096
|
+
_proto.generateProof = /*#__PURE__*/function () {
|
|
3097
|
+
var _generateProof = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(context) {
|
|
3098
|
+
var path, proof;
|
|
3099
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3100
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3101
|
+
case 0:
|
|
3102
|
+
if (!(!context || !context.note || !context.recipient || !context.signature)) {
|
|
3103
|
+
_context2.next = 2;
|
|
3104
|
+
break;
|
|
3105
|
+
}
|
|
3106
|
+
throw new DarkpoolError('Invalid context');
|
|
3107
|
+
case 2:
|
|
3108
|
+
_context2.next = 4;
|
|
3109
|
+
return getMerklePathAndRoot(context.note.note, this._darkPool);
|
|
3110
|
+
case 4:
|
|
3111
|
+
path = _context2.sent;
|
|
3112
|
+
context.merkleRoot = path.root;
|
|
3113
|
+
_context2.next = 8;
|
|
3114
|
+
return generateWithdrawProof({
|
|
3115
|
+
note: context.note,
|
|
3116
|
+
address: context.recipient,
|
|
3117
|
+
merkleRoot: path.root,
|
|
3118
|
+
merklePath: path.path,
|
|
3119
|
+
merkleIndex: path.index,
|
|
3120
|
+
relayer: context.relayer.relayerAddress,
|
|
3121
|
+
signedMessage: context.signature,
|
|
3122
|
+
options: this._darkPool.proofOptions
|
|
3123
|
+
});
|
|
3124
|
+
case 8:
|
|
3125
|
+
proof = _context2.sent;
|
|
3126
|
+
context.proof = proof;
|
|
3127
|
+
case 10:
|
|
3128
|
+
case "end":
|
|
3129
|
+
return _context2.stop();
|
|
3130
|
+
}
|
|
3131
|
+
}, _callee2, this);
|
|
3132
|
+
}));
|
|
3133
|
+
function generateProof(_x4) {
|
|
3134
|
+
return _generateProof.apply(this, arguments);
|
|
3135
|
+
}
|
|
3136
|
+
return generateProof;
|
|
3137
|
+
}();
|
|
3138
|
+
_proto.getRelayerRequest = /*#__PURE__*/function () {
|
|
3139
|
+
var _getRelayerRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(context) {
|
|
3140
|
+
var withdrawRelayerRequest;
|
|
3141
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3142
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3143
|
+
case 0:
|
|
3144
|
+
if (!(!context || !context.note || !context.signature || !context.merkleRoot || !context.recipient || !context.proof)) {
|
|
3145
|
+
_context3.next = 2;
|
|
3146
|
+
break;
|
|
3147
|
+
}
|
|
3148
|
+
throw new DarkpoolError('Invalid context');
|
|
3149
|
+
case 2:
|
|
3150
|
+
withdrawRelayerRequest = {
|
|
3151
|
+
proof: context.proof.proof.proof,
|
|
3152
|
+
asset: context.note.asset,
|
|
3153
|
+
merkleRoot: context.merkleRoot,
|
|
3154
|
+
nullifier: context.proof.nullifier,
|
|
3155
|
+
recipient: context.recipient,
|
|
3156
|
+
relayer: context.relayer.relayerAddress,
|
|
3157
|
+
amount: hexlify32(context.note.amount),
|
|
3158
|
+
refund: hexlify32(0n),
|
|
3159
|
+
verifierArgs: context.proof.proof.verifyInputs
|
|
3160
|
+
};
|
|
3161
|
+
return _context3.abrupt("return", withdrawRelayerRequest);
|
|
3162
|
+
case 4:
|
|
3163
|
+
case "end":
|
|
3164
|
+
return _context3.stop();
|
|
3165
|
+
}
|
|
3166
|
+
}, _callee3);
|
|
3167
|
+
}));
|
|
3168
|
+
function getRelayerRequest(_x5) {
|
|
3169
|
+
return _getRelayerRequest.apply(this, arguments);
|
|
3170
|
+
}
|
|
3171
|
+
return getRelayerRequest;
|
|
3172
|
+
}();
|
|
3173
|
+
_proto.getRelayerPath = function getRelayerPath() {
|
|
3174
|
+
return relayerPathConfig[Action.WITHDRAW];
|
|
3175
|
+
}
|
|
3176
|
+
//eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3177
|
+
;
|
|
3178
|
+
_proto.postExecute =
|
|
3179
|
+
/*#__PURE__*/
|
|
3180
|
+
function () {
|
|
3181
|
+
var _postExecute = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(context) {
|
|
3182
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3183
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3184
|
+
case 0:
|
|
3185
|
+
console.log(context.tx);
|
|
3186
|
+
return _context4.abrupt("return", {
|
|
3187
|
+
txHash: context.tx
|
|
3188
|
+
});
|
|
3189
|
+
case 2:
|
|
3190
|
+
case "end":
|
|
3191
|
+
return _context4.stop();
|
|
3192
|
+
}
|
|
3193
|
+
}, _callee4);
|
|
3194
|
+
}));
|
|
3195
|
+
function postExecute(_x6) {
|
|
3196
|
+
return _postExecute.apply(this, arguments);
|
|
3197
|
+
}
|
|
3198
|
+
return postExecute;
|
|
3199
|
+
}();
|
|
3200
|
+
_proto.getRelayerContractCallParameters = function getRelayerContractCallParameters(context) {
|
|
3201
|
+
if (!context || !context.note || !context.recipient || !context.signature || !context.proof) {
|
|
3202
|
+
throw new DarkpoolError('Invalid context');
|
|
3203
|
+
}
|
|
3204
|
+
return {
|
|
3205
|
+
proof: context.proof.proof.proof,
|
|
3206
|
+
asset: context.note.asset,
|
|
3207
|
+
merkleRoot: context.merkleRoot,
|
|
3208
|
+
nullifier: context.proof.nullifier,
|
|
3209
|
+
recipient: context.recipient,
|
|
3210
|
+
relayer: context.relayer.relayerAddress,
|
|
3211
|
+
amount: hexlify32(context.note.amount)
|
|
3212
|
+
};
|
|
3213
|
+
};
|
|
3214
|
+
return WithdrawService;
|
|
3215
|
+
}(BaseRelayerService);
|
|
3216
|
+
|
|
3217
|
+
function getContract$1(address, darkPool) {
|
|
3218
|
+
var provider = darkPool.provider;
|
|
3219
|
+
return new ethers.Contract(address, MerkleAbi.abi, provider);
|
|
3220
|
+
}
|
|
3221
|
+
function getNoteOnChainStatus(_x, _x2, _x3) {
|
|
3222
|
+
return _getNoteOnChainStatus.apply(this, arguments);
|
|
3223
|
+
}
|
|
3224
|
+
function _getNoteOnChainStatus() {
|
|
3225
|
+
_getNoteOnChainStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(darkPool, note, nullifier) {
|
|
3226
|
+
var contract, isCreated, isSpent, isLocked;
|
|
3227
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3228
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3229
|
+
case 0:
|
|
3230
|
+
contract = getContract$1(darkPool.contracts.merkleTreeOperator, darkPool);
|
|
3231
|
+
_context.next = 3;
|
|
3232
|
+
return contract.noteCommitmentsCreated(note);
|
|
3233
|
+
case 3:
|
|
3234
|
+
isCreated = _context.sent;
|
|
3235
|
+
if (isCreated) {
|
|
3236
|
+
_context.next = 6;
|
|
3237
|
+
break;
|
|
3238
|
+
}
|
|
3239
|
+
return _context.abrupt("return", NoteOnChainStatus.UNKNOWN);
|
|
3240
|
+
case 6:
|
|
3241
|
+
_context.next = 8;
|
|
3242
|
+
return contract.nullifiersUsed(nullifier);
|
|
3243
|
+
case 8:
|
|
3244
|
+
isSpent = _context.sent;
|
|
3245
|
+
if (!isSpent) {
|
|
3246
|
+
_context.next = 11;
|
|
3247
|
+
break;
|
|
3248
|
+
}
|
|
3249
|
+
return _context.abrupt("return", NoteOnChainStatus.SPENT);
|
|
3250
|
+
case 11:
|
|
3251
|
+
_context.next = 13;
|
|
3252
|
+
return contract.nullifiersLocked(nullifier);
|
|
3253
|
+
case 13:
|
|
3254
|
+
isLocked = _context.sent;
|
|
3255
|
+
if (!isLocked) {
|
|
3256
|
+
_context.next = 16;
|
|
3257
|
+
break;
|
|
3258
|
+
}
|
|
3259
|
+
return _context.abrupt("return", NoteOnChainStatus.LOCKED);
|
|
3260
|
+
case 16:
|
|
3261
|
+
return _context.abrupt("return", NoteOnChainStatus.ACTIVE);
|
|
3262
|
+
case 17:
|
|
3263
|
+
case "end":
|
|
3264
|
+
return _context.stop();
|
|
3265
|
+
}
|
|
3266
|
+
}, _callee);
|
|
3267
|
+
}));
|
|
3268
|
+
return _getNoteOnChainStatus.apply(this, arguments);
|
|
3269
|
+
}
|
|
3270
|
+
function getNoteOnChainStatusByPublicKey(_x4, _x5, _x6) {
|
|
3271
|
+
return _getNoteOnChainStatusByPublicKey.apply(this, arguments);
|
|
3272
|
+
}
|
|
3273
|
+
function _getNoteOnChainStatusByPublicKey() {
|
|
3274
|
+
_getNoteOnChainStatusByPublicKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(darkPool, note, publicKey) {
|
|
3275
|
+
var nullifier, onChainStatus;
|
|
3276
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3277
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3278
|
+
case 0:
|
|
3279
|
+
nullifier = calcNullifier(note.rho, publicKey);
|
|
3280
|
+
_context2.next = 3;
|
|
3281
|
+
return getNoteOnChainStatus(darkPool, hexlify32(note.note), hexlify32(nullifier));
|
|
3282
|
+
case 3:
|
|
3283
|
+
onChainStatus = _context2.sent;
|
|
3284
|
+
return _context2.abrupt("return", onChainStatus);
|
|
3285
|
+
case 5:
|
|
3286
|
+
case "end":
|
|
3287
|
+
return _context2.stop();
|
|
3288
|
+
}
|
|
3289
|
+
}, _callee2);
|
|
3290
|
+
}));
|
|
3291
|
+
return _getNoteOnChainStatusByPublicKey.apply(this, arguments);
|
|
3292
|
+
}
|
|
3293
|
+
function getNoteOnChainStatusBySignature(_x7, _x8, _x9) {
|
|
3294
|
+
return _getNoteOnChainStatusBySignature.apply(this, arguments);
|
|
3295
|
+
}
|
|
3296
|
+
function _getNoteOnChainStatusBySignature() {
|
|
3297
|
+
_getNoteOnChainStatusBySignature = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(darkPool, note, signature) {
|
|
3298
|
+
var nullifier, onChainStatus;
|
|
3299
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3300
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3301
|
+
case 0:
|
|
3302
|
+
_context3.next = 2;
|
|
3303
|
+
return getNullifier({
|
|
3304
|
+
rho: note.rho,
|
|
3305
|
+
signedMessage: signature
|
|
3306
|
+
});
|
|
3307
|
+
case 2:
|
|
3308
|
+
nullifier = _context3.sent;
|
|
3309
|
+
_context3.next = 5;
|
|
3310
|
+
return getNoteOnChainStatus(darkPool, hexlify32(note.note), nullifier);
|
|
3311
|
+
case 5:
|
|
3312
|
+
onChainStatus = _context3.sent;
|
|
3313
|
+
return _context3.abrupt("return", onChainStatus);
|
|
3314
|
+
case 7:
|
|
3315
|
+
case "end":
|
|
3316
|
+
return _context3.stop();
|
|
3317
|
+
}
|
|
3318
|
+
}, _callee3);
|
|
3319
|
+
}));
|
|
3320
|
+
return _getNoteOnChainStatusBySignature.apply(this, arguments);
|
|
3321
|
+
}
|
|
3322
|
+
function isNoteActive(_x10, _x11, _x12) {
|
|
3323
|
+
return _isNoteActive.apply(this, arguments);
|
|
3324
|
+
}
|
|
3325
|
+
function _isNoteActive() {
|
|
3326
|
+
_isNoteActive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(darkPool, note, signature) {
|
|
3327
|
+
var nullifier, onChainStatus;
|
|
3328
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3329
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3330
|
+
case 0:
|
|
3331
|
+
_context4.next = 2;
|
|
3332
|
+
return getNullifier({
|
|
3333
|
+
rho: note.rho,
|
|
3334
|
+
signedMessage: signature
|
|
3335
|
+
});
|
|
3336
|
+
case 2:
|
|
3337
|
+
nullifier = _context4.sent;
|
|
3338
|
+
_context4.next = 5;
|
|
3339
|
+
return getNoteOnChainStatus(darkPool, hexlify32(note.note), nullifier);
|
|
3340
|
+
case 5:
|
|
3341
|
+
onChainStatus = _context4.sent;
|
|
3342
|
+
return _context4.abrupt("return", onChainStatus === NoteOnChainStatus.ACTIVE);
|
|
3343
|
+
case 7:
|
|
3344
|
+
case "end":
|
|
3345
|
+
return _context4.stop();
|
|
3346
|
+
}
|
|
3347
|
+
}, _callee4);
|
|
3348
|
+
}));
|
|
3349
|
+
return _isNoteActive.apply(this, arguments);
|
|
3350
|
+
}
|
|
3351
|
+
function isNoteSpent(_x13, _x14, _x15) {
|
|
3352
|
+
return _isNoteSpent.apply(this, arguments);
|
|
3353
|
+
}
|
|
3354
|
+
function _isNoteSpent() {
|
|
3355
|
+
_isNoteSpent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(darkPool, note, signature) {
|
|
3356
|
+
var nullifier, onChainStatus;
|
|
3357
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3358
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3359
|
+
case 0:
|
|
3360
|
+
_context5.next = 2;
|
|
3361
|
+
return getNullifier({
|
|
3362
|
+
rho: note.rho,
|
|
3363
|
+
signedMessage: signature
|
|
3364
|
+
});
|
|
3365
|
+
case 2:
|
|
3366
|
+
nullifier = _context5.sent;
|
|
3367
|
+
_context5.next = 5;
|
|
3368
|
+
return getNoteOnChainStatus(darkPool, hexlify32(note.note), nullifier);
|
|
3369
|
+
case 5:
|
|
3370
|
+
onChainStatus = _context5.sent;
|
|
3371
|
+
return _context5.abrupt("return", onChainStatus === NoteOnChainStatus.SPENT);
|
|
3372
|
+
case 7:
|
|
3373
|
+
case "end":
|
|
3374
|
+
return _context5.stop();
|
|
3375
|
+
}
|
|
3376
|
+
}, _callee5);
|
|
3377
|
+
}));
|
|
3378
|
+
return _isNoteSpent.apply(this, arguments);
|
|
3379
|
+
}
|
|
3380
|
+
function isNoteLocked(_x16, _x17, _x18) {
|
|
3381
|
+
return _isNoteLocked.apply(this, arguments);
|
|
3382
|
+
}
|
|
3383
|
+
function _isNoteLocked() {
|
|
3384
|
+
_isNoteLocked = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(darkPool, note, signature) {
|
|
3385
|
+
var nullifier, onChainStatus;
|
|
3386
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3387
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3388
|
+
case 0:
|
|
3389
|
+
_context6.next = 2;
|
|
3390
|
+
return getNullifier({
|
|
3391
|
+
rho: note.rho,
|
|
3392
|
+
signedMessage: signature
|
|
3393
|
+
});
|
|
3394
|
+
case 2:
|
|
3395
|
+
nullifier = _context6.sent;
|
|
3396
|
+
_context6.next = 5;
|
|
3397
|
+
return getNoteOnChainStatus(darkPool, hexlify32(note.note), nullifier);
|
|
3398
|
+
case 5:
|
|
3399
|
+
onChainStatus = _context6.sent;
|
|
3400
|
+
return _context6.abrupt("return", onChainStatus === NoteOnChainStatus.LOCKED);
|
|
3401
|
+
case 7:
|
|
3402
|
+
case "end":
|
|
3403
|
+
return _context6.stop();
|
|
3404
|
+
}
|
|
3405
|
+
}, _callee6);
|
|
3406
|
+
}));
|
|
3407
|
+
return _isNoteLocked.apply(this, arguments);
|
|
3408
|
+
}
|
|
3409
|
+
function isNoteValid(_x19, _x20) {
|
|
3410
|
+
return _isNoteValid.apply(this, arguments);
|
|
3411
|
+
}
|
|
3412
|
+
function _isNoteValid() {
|
|
3413
|
+
_isNoteValid = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(note, signature) {
|
|
3414
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
3415
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
3416
|
+
case 0:
|
|
3417
|
+
_context7.next = 2;
|
|
3418
|
+
return validateNote(note, signature);
|
|
3419
|
+
case 2:
|
|
3420
|
+
return _context7.abrupt("return", _context7.sent);
|
|
3421
|
+
case 3:
|
|
3422
|
+
case "end":
|
|
3423
|
+
return _context7.stop();
|
|
3424
|
+
}
|
|
3425
|
+
}, _callee7);
|
|
3426
|
+
}));
|
|
3427
|
+
return _isNoteValid.apply(this, arguments);
|
|
3428
|
+
}
|
|
3429
|
+
function isNftNoteValid(_x21, _x22) {
|
|
3430
|
+
return _isNftNoteValid.apply(this, arguments);
|
|
3431
|
+
}
|
|
3432
|
+
function _isNftNoteValid() {
|
|
3433
|
+
_isNftNoteValid = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(note, signature) {
|
|
3434
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
3435
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
3436
|
+
case 0:
|
|
3437
|
+
_context8.next = 2;
|
|
3438
|
+
return validateNote(note, signature);
|
|
3439
|
+
case 2:
|
|
3440
|
+
return _context8.abrupt("return", _context8.sent);
|
|
3441
|
+
case 3:
|
|
3442
|
+
case "end":
|
|
3443
|
+
return _context8.stop();
|
|
3444
|
+
}
|
|
3445
|
+
}, _callee8);
|
|
3446
|
+
}));
|
|
3447
|
+
return _isNftNoteValid.apply(this, arguments);
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3450
|
+
var _contractConfig;
|
|
3451
|
+
var contractConfig = (_contractConfig = {}, _contractConfig[ChainId.MAINNET] = {
|
|
3452
|
+
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
3453
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3454
|
+
nativeWrapper: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
3455
|
+
complianceManager: '0x630aD89523a18fA30F752297F3F53B7BC363488b',
|
|
3456
|
+
merkleTreeOperator: '0x152f1051c8D37Fba9A362Fc9b32a0eeF8496202F',
|
|
3457
|
+
darkpoolAssetManager: '0x159F3668c72BBeCdF1fb31beeD606Ec9649654eB',
|
|
3458
|
+
transferAssetManager: '0x0',
|
|
3459
|
+
otcSwapAssetManager: '0xB8096ecD7d3185b24AA218C509175185C11f13a9',
|
|
3460
|
+
stakingOperator: '0x539bcbc08F2cA42E50887dA4Db0DC34EbF0B090b',
|
|
3461
|
+
stakingAssetManager: '0x1Fa7Cb4925086128f3bb9e26761C9C75dbAC3CD1',
|
|
3462
|
+
batchJoinSplitAssetManager: '0x1346b13Ff3Bd19d882E2491cBdAb2DbFc59982E3',
|
|
3463
|
+
darkpoolSwapAssetManager: '0x0',
|
|
3464
|
+
nftAssetManager: '0xbB0679f6831Ee3736AE53D8fcECB9c0e684615d0',
|
|
3465
|
+
drakpoolSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-subgraph/version/v0.0.1/api',
|
|
3466
|
+
uniswapConfig: {
|
|
3467
|
+
swapRouterAddress: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45',
|
|
3468
|
+
quoterContractAddress: '0x61fFE014bA17989E743c5F6cB21bF9697530B21e',
|
|
3469
|
+
wrappedNativeTokenAddress: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
3470
|
+
v3PosNftAddress: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88',
|
|
3471
|
+
factoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
|
|
3472
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3?source=uniswap'
|
|
3473
|
+
}
|
|
3474
|
+
}, _contractConfig[ChainId.ARBITRUM_ONE] = {
|
|
3475
|
+
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
3476
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3477
|
+
nativeWrapper: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
|
|
3478
|
+
stakingOperator: '0xF4f1D4F28Be82D81135c13D255452B8325B585B0',
|
|
3479
|
+
stakingAssetManager: '0xB1CC5D9227323330E8a58e891c123B38D03f0BAA',
|
|
3480
|
+
complianceManager: '0x23A37b553c46f4864537Ab1e8d1e49804b47A5A7',
|
|
3481
|
+
merkleTreeOperator: '0x0e2aCb73EBB02bd4099d495bcb96F7522F84ddb7',
|
|
3482
|
+
darkpoolAssetManager: '0xf7C40b5057a1D1a3d58B02BCdb125E63ef380564',
|
|
3483
|
+
transferAssetManager: '0x0',
|
|
3484
|
+
otcSwapAssetManager: '0xcbFA6BB3eb4Bd9BF97866baE75FfB62f3aE897c0',
|
|
3485
|
+
batchJoinSplitAssetManager: '0xd39EA1e275ee468f977f93134a564aF76696E0fE',
|
|
3486
|
+
darkpoolSwapAssetManager: '0x0',
|
|
3487
|
+
nftAssetManager: '0x143242Ff430620a3FA3f9fEaB576050fb20C63BB',
|
|
3488
|
+
drakpoolSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-arb-subgraph/api'
|
|
3489
|
+
}, _contractConfig[ChainId.BounceBit] = {
|
|
3490
|
+
priceOracle: '0x0',
|
|
3491
|
+
ethAddress: '0x0000000000000000000000000000000000000000',
|
|
3492
|
+
nativeWrapper: '0xF4c20e5004C6FDCDdA920bDD491ba8C98a9c5863',
|
|
3493
|
+
stakingOperator: '0x4d459dDe25707CA353De15CC3B85b7C2e4bb380c',
|
|
3494
|
+
stakingAssetManager: '0xe6B0a94e1eA206B122a11a30dA7FB9ADaA12ef42',
|
|
3495
|
+
complianceManager: '0x1Fe002A6E413C70D5CB8477cDaA0422fc7611fCc',
|
|
3496
|
+
merkleTreeOperator: '0x159F3668c72BBeCdF1fb31beeD606Ec9649654eB',
|
|
3497
|
+
darkpoolAssetManager: '0x722133fBb559E2849e3402De3279Bd3059b7fe4E',
|
|
3498
|
+
transferAssetManager: '0x0',
|
|
3499
|
+
otcSwapAssetManager: '0xAa5e02284d1Fd0f6C12AFBDABc28Ed5aC5a6474b',
|
|
3500
|
+
batchJoinSplitAssetManager: '0x0',
|
|
3501
|
+
darkpoolSwapAssetManager: '0x0',
|
|
3502
|
+
nftAssetManager: '0x0',
|
|
3503
|
+
drakpoolSubgraphUrl: 'https://bb.subgraph.thesingularity.network/subgraphs/name/singularity/'
|
|
3504
|
+
}, _contractConfig[ChainId.BASE] = {
|
|
3505
|
+
priceOracle: '0xf224a25453D76A41c4427DD1C05369BC9f498444',
|
|
3506
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3507
|
+
nativeWrapper: '0x4200000000000000000000000000000000000006',
|
|
3508
|
+
complianceManager: '0xFa368E046B4051582662f7d1C033756dB55058cF',
|
|
3509
|
+
merkleTreeOperator: '0xdcd767f6f877B4Ef85d631f23e51ff3a2BCC9378',
|
|
3510
|
+
darkpoolAssetManager: '0x84eb120A35802460484015e6748375369e40468a',
|
|
3511
|
+
transferAssetManager: '0x0',
|
|
3512
|
+
stakingOperator: '0xfdA33b941E6C014bD079C6917b815EFA58976f37',
|
|
3513
|
+
stakingAssetManager: '0xa3d27E1Ca5057372478011FB781479B8A1fF7AA3',
|
|
3514
|
+
otcSwapAssetManager: '0x3D76Fd85FCc2593970d22Aa34bcC4c5444c57c9D',
|
|
3515
|
+
batchJoinSplitAssetManager: '0x7b497A97EC69621019fc7eC3D5EF06859AfEBaf1',
|
|
3516
|
+
darkpoolSwapAssetManager: '0x0',
|
|
3517
|
+
nftAssetManager: '0xC4e979C922E93938dBaBb6e1623a19cbc6132489',
|
|
3518
|
+
drakpoolSubgraphUrl: 'https://subgraph.satsuma-prod.com/1c6a44a9ed6e/pgs-team--611591/singularity-base-subgraph/api'
|
|
3519
|
+
}, _contractConfig[ChainId.SEPOLIA] = {
|
|
3520
|
+
priceOracle: '0x4Fe44a9aC8Ef059Be2dB97f9e3bcA32Ab698C2f2',
|
|
3521
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3522
|
+
nativeWrapper: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
|
|
3523
|
+
stakingOperator: '0xca7081e8C689C2BA887cEaCcfCB1961716CF5fc9',
|
|
3524
|
+
stakingAssetManager: '0x5041cad705244626E8BB9bd6D828b94EEAB09D8b',
|
|
3525
|
+
complianceManager: '0x08DD9cEf89923EDa02F56a4d4aB3FC4a96531443',
|
|
3526
|
+
merkleTreeOperator: '0x84026d6f3b6A4cEa7AD00Cd5154a8537129B3742',
|
|
3527
|
+
darkpoolAssetManager: '0xa10d309818527C8D8F5164f9D640515d6616bFeE',
|
|
3528
|
+
transferAssetManager: '0x0',
|
|
3529
|
+
otcSwapAssetManager: '0x549f3bAD265A0383394E0ABEC7b67b4ff750d2ca',
|
|
3530
|
+
batchJoinSplitAssetManager: '0x31816E27809fdc3cF73539d761133a301beEb9B0',
|
|
3531
|
+
darkpoolSwapAssetManager: '0x802ae625C2bdac1873B8bbb709679CC401F57abc',
|
|
3532
|
+
nftAssetManager: '0x0',
|
|
3533
|
+
drakpoolSubgraphUrl: ''
|
|
3534
|
+
}, _contractConfig[ChainId.BounceBitTestnet] = {
|
|
3535
|
+
priceOracle: '0x0',
|
|
3536
|
+
ethAddress: '0x0000000000000000000000000000000000000000',
|
|
3537
|
+
nativeWrapper: '0x0',
|
|
3538
|
+
stakingOperator: '0xEF8F70bB29DEAd5CEcaE26C6Cb19B987475B3e48',
|
|
3539
|
+
stakingAssetManager: '0x30cAA40e8D8d00fEAFc05732Ed75856f5eC7F89c',
|
|
3540
|
+
complianceManager: '0x1Fa7Cb4925086128f3bb9e26761C9C75dbAC3CD1',
|
|
3541
|
+
merkleTreeOperator: '0x40FecD96e94c3c2eE0Fb8bE5cE7073Bb3fB46F51',
|
|
3542
|
+
darkpoolAssetManager: '0xf21f124F395271e8435A93063AE2AD74829D7b69',
|
|
3543
|
+
transferAssetManager: '0x0',
|
|
3544
|
+
otcSwapAssetManager: '0x0',
|
|
3545
|
+
batchJoinSplitAssetManager: '0x0',
|
|
3546
|
+
darkpoolSwapAssetManager: '0x0',
|
|
3547
|
+
nftAssetManager: '0x0',
|
|
3548
|
+
drakpoolSubgraphUrl: ''
|
|
3549
|
+
}, _contractConfig[ChainId.HARDHAT] = {
|
|
3550
|
+
priceOracle: '0x0AdDd25a91563696D8567Df78D5A01C9a991F9B8',
|
|
3551
|
+
ethAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3552
|
+
nativeWrapper: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
3553
|
+
merkleTreeOperator: '0xCC5Bc84C3FDbcF262AaDD9F76652D6784293dD9e',
|
|
3554
|
+
complianceManager: '0x987Aa6E80e995d6A76C4d061eE324fc760Ea9F61',
|
|
3555
|
+
darkpoolAssetManager: '0xe24e7570Fe7207AdAaAa8c6c89a59850391B5276',
|
|
3556
|
+
transferAssetManager: '0x0',
|
|
3557
|
+
otcSwapAssetManager: '0x26Df0Ea798971A97Ae121514B32999DfDb220e1f',
|
|
3558
|
+
stakingOperator: '0x6B9C4119796C80Ced5a3884027985Fd31830555b',
|
|
3559
|
+
stakingAssetManager: '0xCd9BC6cE45194398d12e27e1333D5e1d783104dD',
|
|
3560
|
+
batchJoinSplitAssetManager: '0x0',
|
|
3561
|
+
darkpoolSwapAssetManager: '0x0',
|
|
3562
|
+
theDeepAssetManager: '0x0',
|
|
3563
|
+
nftAssetManager: '0x886a2A3ABF5B79AA5dFF1C73016BD07CFc817e04',
|
|
3564
|
+
drakpoolSubgraphUrl: 'https://34.142.142.240:8080/subgraphs/name/singularity/',
|
|
3565
|
+
uniswapConfig: {
|
|
3566
|
+
swapRouterAddress: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45',
|
|
3567
|
+
quoterContractAddress: '0x61fFE014bA17989E743c5F6cB21bF9697530B21e',
|
|
3568
|
+
wrappedNativeTokenAddress: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
3569
|
+
v3PosNftAddress: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88',
|
|
3570
|
+
factoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
|
|
3571
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3?source=uniswap'
|
|
3572
|
+
},
|
|
3573
|
+
sablierConfig: {
|
|
3574
|
+
aliasPrefixLinear: 'LL2',
|
|
3575
|
+
aliasPrefixDynamic: 'LD2',
|
|
3576
|
+
lockupLinear: '0xAFb979d9afAd1aD27C5eFf4E27226E3AB9e5dCC9',
|
|
3577
|
+
lockupDynamic: '0x7CC7e125d83A581ff438608490Cc0f7bDff79127',
|
|
3578
|
+
sablierDynamicAssetManager: '0x453439300B6C5C645737324b990f2d51137027bC',
|
|
3579
|
+
sablierLinearAssetManager: '0xB90AcF57C3BFE8e0E8215defc282B5F48b3edC74'
|
|
3580
|
+
}
|
|
3581
|
+
}, _contractConfig);
|
|
3582
|
+
|
|
3583
|
+
var _stakingTokenConfig;
|
|
3584
|
+
var stakingTokenConfig = (_stakingTokenConfig = {}, _stakingTokenConfig[ChainId.MAINNET] = [{
|
|
3585
|
+
originalToken: {
|
|
3586
|
+
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3587
|
+
decimals: 18,
|
|
3588
|
+
symbol: 'ETH',
|
|
3589
|
+
name: 'Ethereum'
|
|
3590
|
+
},
|
|
3591
|
+
stakingToken: {
|
|
3592
|
+
address: '0x1Df4fAe6CC88A19825dA7dCF8Fcac8E44BA14D2C',
|
|
3593
|
+
decimals: 18,
|
|
3594
|
+
symbol: 'sgETH',
|
|
3595
|
+
name: 'sgETH'
|
|
3596
|
+
}
|
|
3597
|
+
}, {
|
|
3598
|
+
originalToken: {
|
|
3599
|
+
address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
|
|
3600
|
+
decimals: 18,
|
|
3601
|
+
symbol: 'stETH',
|
|
3602
|
+
name: 'Lido Staked Ether'
|
|
3603
|
+
},
|
|
3604
|
+
stakingToken: {
|
|
3605
|
+
address: '0xe397804A9Ff78329997A2b07aF91D484f78e77Be',
|
|
3606
|
+
decimals: 18,
|
|
3607
|
+
symbol: 'sgSTETH',
|
|
3608
|
+
name: 'sgSTETH'
|
|
3609
|
+
}
|
|
3610
|
+
}, {
|
|
3611
|
+
originalToken: {
|
|
3612
|
+
address: '0xae78736cd615f374d3085123a210448e74fc6393',
|
|
3613
|
+
decimals: 18,
|
|
3614
|
+
symbol: 'rETH',
|
|
3615
|
+
name: 'Rocket Pool ETH'
|
|
3616
|
+
},
|
|
3617
|
+
stakingToken: {
|
|
3618
|
+
address: '0xA8B78eFF928c30e43A60d8920d1549177652045d',
|
|
3619
|
+
decimals: 18,
|
|
3620
|
+
symbol: 'sgRETH',
|
|
3621
|
+
name: 'sgRETH'
|
|
3622
|
+
}
|
|
3623
|
+
}, {
|
|
3624
|
+
originalToken: {
|
|
3625
|
+
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
|
3626
|
+
decimals: 6,
|
|
3627
|
+
symbol: 'USDT',
|
|
3628
|
+
name: 'Tether USD'
|
|
3629
|
+
},
|
|
3630
|
+
stakingToken: {
|
|
3631
|
+
address: '0x91605474f1774f3C1401291A265fa8A995effeb2',
|
|
3632
|
+
decimals: 6,
|
|
3633
|
+
symbol: 'sgUSDT',
|
|
3634
|
+
name: 'sgUSDT'
|
|
3635
|
+
}
|
|
3636
|
+
}, {
|
|
3637
|
+
originalToken: {
|
|
3638
|
+
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
3639
|
+
decimals: 6,
|
|
3640
|
+
symbol: 'USDC',
|
|
3641
|
+
name: 'USD Coin'
|
|
3642
|
+
},
|
|
3643
|
+
stakingToken: {
|
|
3644
|
+
address: '0x0692623f022a622b9CB33ffBEe6c14c8abebf4cc',
|
|
3645
|
+
decimals: 6,
|
|
3646
|
+
symbol: 'sgUSDC',
|
|
3647
|
+
name: 'sgUSDC'
|
|
3648
|
+
}
|
|
3649
|
+
}], _stakingTokenConfig[ChainId.ARBITRUM_ONE] = [{
|
|
3650
|
+
originalToken: {
|
|
3651
|
+
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3652
|
+
decimals: 18,
|
|
3653
|
+
symbol: 'ETH',
|
|
3654
|
+
name: 'Ethereum'
|
|
3655
|
+
},
|
|
3656
|
+
stakingToken: {
|
|
3657
|
+
address: '0xB2393C436a29edc40BA90b9944edB84466565E0c',
|
|
3658
|
+
decimals: 18,
|
|
3659
|
+
symbol: 'sgETH',
|
|
3660
|
+
name: 'sgETH'
|
|
3661
|
+
}
|
|
3662
|
+
}, {
|
|
3663
|
+
originalToken: {
|
|
3664
|
+
address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
|
|
3665
|
+
decimals: 6,
|
|
3666
|
+
symbol: 'USDT',
|
|
3667
|
+
name: 'Tether USD'
|
|
3668
|
+
},
|
|
3669
|
+
stakingToken: {
|
|
3670
|
+
address: '0xAB5a3Ab2ef9a03de376CAce74c901a0fccD2A06d',
|
|
3671
|
+
decimals: 6,
|
|
3672
|
+
symbol: 'sgUSDT',
|
|
3673
|
+
name: 'sgUSDT'
|
|
3674
|
+
}
|
|
3675
|
+
}, {
|
|
3676
|
+
originalToken: {
|
|
3677
|
+
address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
|
|
3678
|
+
decimals: 6,
|
|
3679
|
+
symbol: 'USDC',
|
|
3680
|
+
name: 'USD Coin'
|
|
3681
|
+
},
|
|
3682
|
+
stakingToken: {
|
|
3683
|
+
address: '0xFB6C93eF0B515d041b0DcDF427657E41DDDB8Da8',
|
|
3684
|
+
decimals: 6,
|
|
3685
|
+
symbol: 'sgUSDC',
|
|
3686
|
+
name: 'sgUSDC'
|
|
3687
|
+
}
|
|
3688
|
+
}], _stakingTokenConfig[ChainId.BASE] = [], _stakingTokenConfig[ChainId.SEPOLIA] = [{
|
|
3689
|
+
originalToken: {
|
|
3690
|
+
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3691
|
+
decimals: 18,
|
|
3692
|
+
symbol: 'ETH',
|
|
3693
|
+
name: 'Ethereum'
|
|
3694
|
+
},
|
|
3695
|
+
stakingToken: {
|
|
3696
|
+
address: '0x56fBD5d5C3e9D5f9Ae916F113232d52e6E377E71',
|
|
3697
|
+
decimals: 18,
|
|
3698
|
+
symbol: 'sgETH',
|
|
3699
|
+
name: 'sgETH'
|
|
3700
|
+
}
|
|
3701
|
+
}], _stakingTokenConfig[ChainId.BounceBit] = [{
|
|
3702
|
+
originalToken: {
|
|
3703
|
+
address: '0x0000000000000000000000000000000000000000',
|
|
3704
|
+
decimals: 18,
|
|
3705
|
+
symbol: 'BB',
|
|
3706
|
+
name: 'BB'
|
|
3707
|
+
},
|
|
3708
|
+
stakingToken: {
|
|
3709
|
+
address: '0x5D873095152b921222241c0Cbd82d83b47bB31D3',
|
|
3710
|
+
decimals: 18,
|
|
3711
|
+
symbol: 'sgBB',
|
|
3712
|
+
name: 'sgBB'
|
|
3713
|
+
}
|
|
3714
|
+
}, {
|
|
3715
|
+
originalToken: {
|
|
3716
|
+
address: '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC',
|
|
3717
|
+
decimals: 18,
|
|
3718
|
+
symbol: 'BBTC',
|
|
3719
|
+
name: 'BBTC'
|
|
3720
|
+
},
|
|
3721
|
+
stakingToken: {
|
|
3722
|
+
address: '0x578A43b97a9c46b13B153Df6AA05393b78E241Ee',
|
|
3723
|
+
decimals: 18,
|
|
3724
|
+
symbol: 'sgBBTC',
|
|
3725
|
+
name: 'sgBBTC'
|
|
3726
|
+
}
|
|
3727
|
+
}, {
|
|
3728
|
+
originalToken: {
|
|
3729
|
+
address: '0x77776b40C3d75cb07ce54dEA4b2Fd1D07F865222',
|
|
3730
|
+
decimals: 18,
|
|
3731
|
+
symbol: 'BBUSD',
|
|
3732
|
+
name: 'BBUSD'
|
|
3733
|
+
},
|
|
3734
|
+
stakingToken: {
|
|
3735
|
+
address: '0x9af2DDB1E3A30442f590f659e13a243Da15C86A0',
|
|
3736
|
+
decimals: 18,
|
|
3737
|
+
symbol: 'sgBBUSDC',
|
|
3738
|
+
name: 'sgBBUSDC'
|
|
3739
|
+
}
|
|
3740
|
+
}, {
|
|
3741
|
+
originalToken: {
|
|
3742
|
+
address: '0x22aAC17E571D6651880d057e310703fF4C7c3483',
|
|
3743
|
+
decimals: 18,
|
|
3744
|
+
symbol: 'stBB',
|
|
3745
|
+
name: 'stBB'
|
|
3746
|
+
},
|
|
3747
|
+
stakingToken: {
|
|
3748
|
+
address: '0x3dD11E06DAA99AD255C83545d05Ad27602e0907F',
|
|
3749
|
+
decimals: 18,
|
|
3750
|
+
symbol: 'sgSTBB',
|
|
3751
|
+
name: 'sgSTBB'
|
|
3752
|
+
}
|
|
3753
|
+
}], _stakingTokenConfig[ChainId.BounceBitTestnet] = [{
|
|
3754
|
+
originalToken: {
|
|
3755
|
+
address: '0x0000000000000000000000000000000000000000',
|
|
3756
|
+
decimals: 18,
|
|
3757
|
+
symbol: 'BB',
|
|
3758
|
+
name: 'BB'
|
|
3759
|
+
},
|
|
3760
|
+
stakingToken: {
|
|
3761
|
+
address: '0x1276801901cBC847077a8e7e27C973894c86157A',
|
|
3762
|
+
decimals: 18,
|
|
3763
|
+
symbol: 'sgBB',
|
|
3764
|
+
name: 'sgBB'
|
|
3765
|
+
}
|
|
3766
|
+
}], _stakingTokenConfig[ChainId.HARDHAT] = [{
|
|
3767
|
+
originalToken: {
|
|
3768
|
+
address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
|
3769
|
+
decimals: 18,
|
|
3770
|
+
symbol: 'ETH',
|
|
3771
|
+
name: 'Ethereum'
|
|
3772
|
+
},
|
|
3773
|
+
stakingToken: {
|
|
3774
|
+
address: '0x5fe2f174fe51474Cd198939C96e7dB65983EA307',
|
|
3775
|
+
decimals: 18,
|
|
3776
|
+
symbol: 'sgETH',
|
|
3777
|
+
name: 'sgETH'
|
|
3778
|
+
}
|
|
3779
|
+
}, {
|
|
3780
|
+
originalToken: {
|
|
3781
|
+
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
3782
|
+
decimals: 6,
|
|
3783
|
+
symbol: 'USDC',
|
|
3784
|
+
name: 'USDC'
|
|
3785
|
+
},
|
|
3786
|
+
stakingToken: {
|
|
3787
|
+
address: '0x8AFB0C54bAE39A5e56b984DF1C4b5702b2abf205',
|
|
3788
|
+
decimals: 6,
|
|
3789
|
+
symbol: 'sgUSDC',
|
|
3790
|
+
name: 'sgUSDC'
|
|
3791
|
+
}
|
|
3792
|
+
}], _stakingTokenConfig);
|
|
3793
|
+
|
|
3794
|
+
var DarkPool = /*#__PURE__*/function () {
|
|
3795
|
+
function DarkPool(signer, chainId, relayers, contracts, stakingConfigs, proofOptions) {
|
|
3796
|
+
// @ts-ignore
|
|
3797
|
+
this.signer = signer;
|
|
3798
|
+
// @ts-ignore
|
|
3799
|
+
this.provider = signer.provider;
|
|
3800
|
+
this.chainId = chainId;
|
|
3801
|
+
this.relayers = relayers;
|
|
3802
|
+
if (contracts) {
|
|
3803
|
+
this.contracts = contracts;
|
|
3804
|
+
} else {
|
|
3805
|
+
if (contractConfig[chainId]) {
|
|
3806
|
+
this.contracts = contractConfig[chainId];
|
|
3807
|
+
} else {
|
|
3808
|
+
throw new DarkpoolError('There is no default contract configuration for the provided chainId');
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
if (stakingConfigs) {
|
|
3812
|
+
this.stakingConfigs = stakingConfigs;
|
|
3813
|
+
} else {
|
|
3814
|
+
if (stakingTokenConfig[chainId]) {
|
|
3815
|
+
this.stakingConfigs = stakingTokenConfig[chainId];
|
|
3816
|
+
} else {
|
|
3817
|
+
this.stakingConfigs = [];
|
|
3818
|
+
}
|
|
3819
|
+
}
|
|
3820
|
+
if (proofOptions) {
|
|
3821
|
+
this.proofOptions = proofOptions;
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
var _proto = DarkPool.prototype;
|
|
3825
|
+
_proto.getRelayer = function getRelayer() {
|
|
3826
|
+
if (this.relayers.length === 0) {
|
|
3827
|
+
throw new DarkpoolError('Relayer is not initialized');
|
|
3828
|
+
}
|
|
3829
|
+
var index = Math.floor(Math.random() * this.relayers.length);
|
|
3830
|
+
return this.relayers[index];
|
|
3831
|
+
};
|
|
3832
|
+
return DarkPool;
|
|
3833
|
+
}();
|
|
3834
|
+
|
|
3835
|
+
export { BaseContext, BaseContractService, BaseRelayerContext, BaseRelayerService, DarkPool, DarkpoolError, DepositContext, DepositService, NoteOnChainStatus, WithdrawService, getMerklePathAndRoot, getNoteOnChainStatusByPublicKey, getNoteOnChainStatusBySignature, hexlify1, hexlify16, hexlify3, hexlify32, hexlify5, hexlify8, isAddressEquals, isHexEquals, isNativeAsset, isNftNoteValid, isNoteActive, isNoteLocked, isNoteSpent, isNoteValid, multiGetMerklePathAndRoot, transferCodeToNoteFooter, validateRecipientCode };
|
|
3836
|
+
//# sourceMappingURL=singularity-sdk-lite.esm.js.map
|