@boostxyz/cli 1.1.0-alpha.34
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/LICENSE +674 -0
- package/README.md +162 -0
- package/dist/cli.cjs +27 -0
- package/dist/cli.js +99 -0
- package/dist/commands/deploy.cjs +1 -0
- package/dist/commands/deploy.js +10141 -0
- package/dist/commands/seed.cjs +2 -0
- package/dist/commands/seed.js +947 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +9 -0
- package/dist/utils-D0bdHF2y.js +64 -0
- package/dist/utils-DX4pZJ98.cjs +3 -0
- package/package.json +56 -0
|
@@ -0,0 +1,947 @@
|
|
|
1
|
+
import X from "node:fs/promises";
|
|
2
|
+
import e0 from "node:path";
|
|
3
|
+
import { Deployable as t0, SignatureType as v, FilterType as $, PrimitiveType as k, StrategyType as E, BOOST_REGISTRY_ADDRESSES as a0, BoostRegistry as n0, BOOST_CORE_ADDRESSES as c0, BoostCore as i0, Roles as U, allowListFromAddress as r0 } from "@boostxyz/sdk";
|
|
4
|
+
import { simulateContract as o0, readContract as s0, writeContract as d0 } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/viem@2.21.16_bufferutil@4.0.8_typescript@5.6.2_utf-8-validate@6.0.4_zod@3.23.8/node_modules/viem/_esm/actions/index.js";
|
|
5
|
+
import { createClient as f0, custom as b0, isHex as u0, isAddress as R, pad as l0, toFunctionSelector as p0, toEventSelector as m0, parseEther as H, zeroAddress as L } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/viem@2.21.16_bufferutil@4.0.8_typescript@5.6.2_utf-8-validate@6.0.4_zod@3.23.8/node_modules/viem/_esm/index.js";
|
|
6
|
+
import { parseAccount as y0, getAddress as h0 } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/viem@2.21.16_bufferutil@4.0.8_typescript@5.6.2_utf-8-validate@6.0.4_zod@3.23.8/node_modules/viem/_esm/utils/index.js";
|
|
7
|
+
import { privateKeyToAccount as g0 } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/viem@2.21.16_bufferutil@4.0.8_typescript@5.6.2_utf-8-validate@6.0.4_zod@3.23.8/node_modules/viem/_esm/accounts/index.js";
|
|
8
|
+
import { deepEqual as w0 } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/@wagmi+core@2.13.8_@tanstack+query-core@5.32.0_@types+react@18.3.0_immer@10.0.2_react@18.3.0__rf4knvbttxkigkqzlfrm4rcvsi/node_modules/@wagmi/core/dist/esm/exports/index.js";
|
|
9
|
+
import { z as c } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs";
|
|
10
|
+
import { g as v0 } from "../utils-D0bdHF2y.js";
|
|
11
|
+
function A(a) {
|
|
12
|
+
const t = a.state.current, e = a.state.connections.get(t), n = e == null ? void 0 : e.accounts, r = n == null ? void 0 : n[0], o = a.chains.find((f) => f.id === (e == null ? void 0 : e.chainId)), i = a.state.status;
|
|
13
|
+
switch (i) {
|
|
14
|
+
case "connected":
|
|
15
|
+
return {
|
|
16
|
+
address: r,
|
|
17
|
+
addresses: n,
|
|
18
|
+
chain: o,
|
|
19
|
+
chainId: e == null ? void 0 : e.chainId,
|
|
20
|
+
connector: e == null ? void 0 : e.connector,
|
|
21
|
+
isConnected: !0,
|
|
22
|
+
isConnecting: !1,
|
|
23
|
+
isDisconnected: !1,
|
|
24
|
+
isReconnecting: !1,
|
|
25
|
+
status: i
|
|
26
|
+
};
|
|
27
|
+
case "reconnecting":
|
|
28
|
+
return {
|
|
29
|
+
address: r,
|
|
30
|
+
addresses: n,
|
|
31
|
+
chain: o,
|
|
32
|
+
chainId: e == null ? void 0 : e.chainId,
|
|
33
|
+
connector: e == null ? void 0 : e.connector,
|
|
34
|
+
isConnected: !!r,
|
|
35
|
+
isConnecting: !1,
|
|
36
|
+
isDisconnected: !1,
|
|
37
|
+
isReconnecting: !0,
|
|
38
|
+
status: i
|
|
39
|
+
};
|
|
40
|
+
case "connecting":
|
|
41
|
+
return {
|
|
42
|
+
address: r,
|
|
43
|
+
addresses: n,
|
|
44
|
+
chain: o,
|
|
45
|
+
chainId: e == null ? void 0 : e.chainId,
|
|
46
|
+
connector: e == null ? void 0 : e.connector,
|
|
47
|
+
isConnected: !1,
|
|
48
|
+
isConnecting: !0,
|
|
49
|
+
isDisconnected: !1,
|
|
50
|
+
isReconnecting: !1,
|
|
51
|
+
status: i
|
|
52
|
+
};
|
|
53
|
+
case "disconnected":
|
|
54
|
+
return {
|
|
55
|
+
address: void 0,
|
|
56
|
+
addresses: void 0,
|
|
57
|
+
chain: void 0,
|
|
58
|
+
chainId: void 0,
|
|
59
|
+
connector: void 0,
|
|
60
|
+
isConnected: !1,
|
|
61
|
+
isConnecting: !1,
|
|
62
|
+
isDisconnected: !0,
|
|
63
|
+
isReconnecting: !1,
|
|
64
|
+
status: i
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function B(a) {
|
|
69
|
+
return a.state.chainId;
|
|
70
|
+
}
|
|
71
|
+
function P(a, t, e) {
|
|
72
|
+
const n = a[t.name];
|
|
73
|
+
if (typeof n == "function")
|
|
74
|
+
return n;
|
|
75
|
+
const r = a[e];
|
|
76
|
+
return typeof r == "function" ? r : (o) => t(a, o);
|
|
77
|
+
}
|
|
78
|
+
const C0 = "2.13.8", A0 = () => `@wagmi/core@${C0}`;
|
|
79
|
+
var z = function(a, t, e, n) {
|
|
80
|
+
if (e === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
|
|
81
|
+
if (typeof t == "function" ? a !== t || !n : !t.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
82
|
+
return e === "m" ? n : e === "a" ? n.call(a) : n ? n.value : t.get(a);
|
|
83
|
+
}, C, q;
|
|
84
|
+
class w extends Error {
|
|
85
|
+
get docsBaseUrl() {
|
|
86
|
+
return "https://wagmi.sh/core";
|
|
87
|
+
}
|
|
88
|
+
get version() {
|
|
89
|
+
return A0();
|
|
90
|
+
}
|
|
91
|
+
constructor(t, e = {}) {
|
|
92
|
+
var n;
|
|
93
|
+
super(), C.add(this), Object.defineProperty(this, "details", {
|
|
94
|
+
enumerable: !0,
|
|
95
|
+
configurable: !0,
|
|
96
|
+
writable: !0,
|
|
97
|
+
value: void 0
|
|
98
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
99
|
+
enumerable: !0,
|
|
100
|
+
configurable: !0,
|
|
101
|
+
writable: !0,
|
|
102
|
+
value: void 0
|
|
103
|
+
}), Object.defineProperty(this, "metaMessages", {
|
|
104
|
+
enumerable: !0,
|
|
105
|
+
configurable: !0,
|
|
106
|
+
writable: !0,
|
|
107
|
+
value: void 0
|
|
108
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
109
|
+
enumerable: !0,
|
|
110
|
+
configurable: !0,
|
|
111
|
+
writable: !0,
|
|
112
|
+
value: void 0
|
|
113
|
+
}), Object.defineProperty(this, "name", {
|
|
114
|
+
enumerable: !0,
|
|
115
|
+
configurable: !0,
|
|
116
|
+
writable: !0,
|
|
117
|
+
value: "WagmiCoreError"
|
|
118
|
+
});
|
|
119
|
+
const r = e.cause instanceof w ? e.cause.details : (n = e.cause) != null && n.message ? e.cause.message : e.details, o = e.cause instanceof w && e.cause.docsPath || e.docsPath;
|
|
120
|
+
this.message = [
|
|
121
|
+
t || "An error occurred.",
|
|
122
|
+
"",
|
|
123
|
+
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
124
|
+
...o ? [
|
|
125
|
+
`Docs: ${this.docsBaseUrl}${o}.html${e.docsSlug ? `#${e.docsSlug}` : ""}`
|
|
126
|
+
] : [],
|
|
127
|
+
...r ? [`Details: ${r}`] : [],
|
|
128
|
+
`Version: ${this.version}`
|
|
129
|
+
].join(`
|
|
130
|
+
`), e.cause && (this.cause = e.cause), this.details = r, this.docsPath = o, this.metaMessages = e.metaMessages, this.shortMessage = t;
|
|
131
|
+
}
|
|
132
|
+
walk(t) {
|
|
133
|
+
return z(this, C, "m", q).call(this, this, t);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
C = /* @__PURE__ */ new WeakSet(), q = function a(t, e) {
|
|
137
|
+
return e != null && e(t) ? t : t.cause ? z(this, C, "m", a).call(this, t.cause, e) : t;
|
|
138
|
+
};
|
|
139
|
+
class I0 extends w {
|
|
140
|
+
constructor() {
|
|
141
|
+
super("Connector not connected."), Object.defineProperty(this, "name", {
|
|
142
|
+
enumerable: !0,
|
|
143
|
+
configurable: !0,
|
|
144
|
+
writable: !0,
|
|
145
|
+
value: "ConnectorNotConnectedError"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
class T0 extends w {
|
|
150
|
+
constructor({ address: t, connector: e }) {
|
|
151
|
+
super(`Account "${t}" not found for connector "${e.name}".`), Object.defineProperty(this, "name", {
|
|
152
|
+
enumerable: !0,
|
|
153
|
+
configurable: !0,
|
|
154
|
+
writable: !0,
|
|
155
|
+
value: "ConnectorAccountNotFoundError"
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
class S0 extends w {
|
|
160
|
+
constructor({ connectionChainId: t, connectorChainId: e }) {
|
|
161
|
+
super(`The current chain of the connector (id: ${e}) does not match the connection's chain (id: ${t}).`, {
|
|
162
|
+
metaMessages: [
|
|
163
|
+
`Current Chain ID: ${e}`,
|
|
164
|
+
`Expected Chain ID: ${t}`
|
|
165
|
+
]
|
|
166
|
+
}), Object.defineProperty(this, "name", {
|
|
167
|
+
enumerable: !0,
|
|
168
|
+
configurable: !0,
|
|
169
|
+
writable: !0,
|
|
170
|
+
value: "ConnectorChainMismatchError"
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
class x0 extends w {
|
|
175
|
+
constructor({ connector: t }) {
|
|
176
|
+
super(`Connector "${t.name}" unavailable while reconnecting.`, {
|
|
177
|
+
details: [
|
|
178
|
+
"During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.",
|
|
179
|
+
"All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.",
|
|
180
|
+
"This error commonly occurs for connectors that asynchronously inject after reconnection has already started."
|
|
181
|
+
].join(" ")
|
|
182
|
+
}), Object.defineProperty(this, "name", {
|
|
183
|
+
enumerable: !0,
|
|
184
|
+
configurable: !0,
|
|
185
|
+
writable: !0,
|
|
186
|
+
value: "ConnectorUnavailableReconnectingError"
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async function W(a, t = {}) {
|
|
191
|
+
let e;
|
|
192
|
+
if (t.connector) {
|
|
193
|
+
const { connector: s } = t;
|
|
194
|
+
if (a.state.status === "reconnecting" && !s.getAccounts && !s.getChainId)
|
|
195
|
+
throw new x0({ connector: s });
|
|
196
|
+
const [y, I] = await Promise.all([
|
|
197
|
+
s.getAccounts(),
|
|
198
|
+
s.getChainId()
|
|
199
|
+
]);
|
|
200
|
+
e = {
|
|
201
|
+
accounts: y,
|
|
202
|
+
chainId: I,
|
|
203
|
+
connector: s
|
|
204
|
+
};
|
|
205
|
+
} else
|
|
206
|
+
e = a.state.connections.get(a.state.current);
|
|
207
|
+
if (!e)
|
|
208
|
+
throw new I0();
|
|
209
|
+
const n = t.chainId ?? e.chainId, r = await e.connector.getChainId();
|
|
210
|
+
if (r !== e.chainId)
|
|
211
|
+
throw new S0({
|
|
212
|
+
connectionChainId: e.chainId,
|
|
213
|
+
connectorChainId: r
|
|
214
|
+
});
|
|
215
|
+
const o = e.connector;
|
|
216
|
+
if (o.getClient)
|
|
217
|
+
return o.getClient({ chainId: n });
|
|
218
|
+
const i = y0(t.account ?? e.accounts[0]);
|
|
219
|
+
if (i.address = h0(i.address), t.account && !e.accounts.some((s) => s.toLowerCase() === i.address.toLowerCase()))
|
|
220
|
+
throw new T0({
|
|
221
|
+
address: i.address,
|
|
222
|
+
connector: o
|
|
223
|
+
});
|
|
224
|
+
const f = a.chains.find((s) => s.id === n), m = await e.connector.getProvider({ chainId: n });
|
|
225
|
+
return f0({
|
|
226
|
+
account: i,
|
|
227
|
+
chain: f,
|
|
228
|
+
name: "Connector Client",
|
|
229
|
+
transport: (s) => b0(m)({ ...s, retryCount: 0 })
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
async function M(a, t) {
|
|
233
|
+
const { abi: e, chainId: n, connector: r, ...o } = t;
|
|
234
|
+
let i;
|
|
235
|
+
t.account ? i = t.account : i = (await W(a, {
|
|
236
|
+
chainId: n,
|
|
237
|
+
connector: r
|
|
238
|
+
})).account;
|
|
239
|
+
const f = a.getClient({ chainId: n }), m = P(f, o0, "simulateContract"), { result: s, request: y } = await m({ ...o, abi: e, account: i });
|
|
240
|
+
return {
|
|
241
|
+
chainId: f.chain.id,
|
|
242
|
+
result: s,
|
|
243
|
+
request: { __mode: "prepared", ...y, chainId: n }
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function N(a) {
|
|
247
|
+
return a.address !== void 0 && typeof a.address == "object" ? (t, e) => {
|
|
248
|
+
var n;
|
|
249
|
+
const r = B(t), o = A(t), i = (e == null ? void 0 : e.chainId) ?? o.chainId ?? r;
|
|
250
|
+
return M(t, {
|
|
251
|
+
...e,
|
|
252
|
+
...a.functionName ? { functionName: a.functionName } : {},
|
|
253
|
+
address: (n = a.address) == null ? void 0 : n[i],
|
|
254
|
+
abi: a.abi
|
|
255
|
+
});
|
|
256
|
+
} : (t, e) => M(t, {
|
|
257
|
+
...e,
|
|
258
|
+
...a.address ? { address: a.address } : {},
|
|
259
|
+
...a.functionName ? { functionName: a.functionName } : {},
|
|
260
|
+
abi: a.abi
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function V(a, t) {
|
|
264
|
+
const { chainId: e, ...n } = t, r = a.getClient({ chainId: e });
|
|
265
|
+
return P(r, s0, "readContract")(n);
|
|
266
|
+
}
|
|
267
|
+
function K(a) {
|
|
268
|
+
return a.address !== void 0 && typeof a.address == "object" ? (t, e) => {
|
|
269
|
+
var n;
|
|
270
|
+
const r = B(t), o = A(t), i = (e == null ? void 0 : e.chainId) ?? o.chainId ?? r;
|
|
271
|
+
return V(t, {
|
|
272
|
+
...e,
|
|
273
|
+
...a.functionName ? { functionName: a.functionName } : {},
|
|
274
|
+
address: (n = a.address) == null ? void 0 : n[i],
|
|
275
|
+
abi: a.abi
|
|
276
|
+
});
|
|
277
|
+
} : (t, e) => V(t, {
|
|
278
|
+
...e,
|
|
279
|
+
...a.address ? { address: a.address } : {},
|
|
280
|
+
...a.functionName ? { functionName: a.functionName } : {},
|
|
281
|
+
abi: a.abi
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
async function _(a, t) {
|
|
285
|
+
const { account: e, chainId: n, connector: r, __mode: o, ...i } = t;
|
|
286
|
+
let f;
|
|
287
|
+
typeof e == "object" && e.type === "local" ? f = a.getClient({ chainId: n }) : f = await W(a, { account: e, chainId: n, connector: r });
|
|
288
|
+
const { connector: m } = A(a);
|
|
289
|
+
let s;
|
|
290
|
+
if (o === "prepared" || m != null && m.supportsSimulation)
|
|
291
|
+
s = i;
|
|
292
|
+
else {
|
|
293
|
+
const { request: y } = await M(a, {
|
|
294
|
+
...i,
|
|
295
|
+
account: e,
|
|
296
|
+
chainId: n
|
|
297
|
+
});
|
|
298
|
+
s = y;
|
|
299
|
+
}
|
|
300
|
+
return await P(f, d0, "writeContract")({
|
|
301
|
+
...s,
|
|
302
|
+
...e ? { account: e } : {},
|
|
303
|
+
chain: n ? { id: n } : null
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function D(a) {
|
|
307
|
+
return a.address !== void 0 && typeof a.address == "object" ? (t, e) => {
|
|
308
|
+
var n;
|
|
309
|
+
const r = B(t), o = A(t);
|
|
310
|
+
let i;
|
|
311
|
+
return e.chainId ? i = e.chainId : e.account && e.account === o.address || e.account === void 0 ? i = o.chainId : i = r, _(t, {
|
|
312
|
+
...e,
|
|
313
|
+
...a.functionName ? { functionName: a.functionName } : {},
|
|
314
|
+
address: i ? (n = a.address) == null ? void 0 : n[i] : void 0,
|
|
315
|
+
abi: a.abi
|
|
316
|
+
});
|
|
317
|
+
} : (t, e) => _(t, {
|
|
318
|
+
...e,
|
|
319
|
+
...a.address ? { address: a.address } : {},
|
|
320
|
+
...a.functionName ? { functionName: a.functionName } : {},
|
|
321
|
+
abi: a.abi
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
const p = [
|
|
325
|
+
{ type: "error", inputs: [], name: "AllowanceOverflow" },
|
|
326
|
+
{ type: "error", inputs: [], name: "AllowanceUnderflow" },
|
|
327
|
+
{ type: "error", inputs: [], name: "InsufficientAllowance" },
|
|
328
|
+
{ type: "error", inputs: [], name: "InsufficientBalance" },
|
|
329
|
+
{ type: "error", inputs: [], name: "InvalidPermit" },
|
|
330
|
+
{ type: "error", inputs: [], name: "PermitExpired" },
|
|
331
|
+
{ type: "error", inputs: [], name: "TotalSupplyOverflow" },
|
|
332
|
+
{
|
|
333
|
+
type: "event",
|
|
334
|
+
anonymous: !1,
|
|
335
|
+
inputs: [
|
|
336
|
+
{
|
|
337
|
+
name: "owner",
|
|
338
|
+
internalType: "address",
|
|
339
|
+
type: "address",
|
|
340
|
+
indexed: !0
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: "spender",
|
|
344
|
+
internalType: "address",
|
|
345
|
+
type: "address",
|
|
346
|
+
indexed: !0
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
name: "amount",
|
|
350
|
+
internalType: "uint256",
|
|
351
|
+
type: "uint256",
|
|
352
|
+
indexed: !1
|
|
353
|
+
}
|
|
354
|
+
],
|
|
355
|
+
name: "Approval"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
type: "event",
|
|
359
|
+
anonymous: !1,
|
|
360
|
+
inputs: [
|
|
361
|
+
{ name: "from", internalType: "address", type: "address", indexed: !0 },
|
|
362
|
+
{ name: "to", internalType: "address", type: "address", indexed: !0 },
|
|
363
|
+
{
|
|
364
|
+
name: "amount",
|
|
365
|
+
internalType: "uint256",
|
|
366
|
+
type: "uint256",
|
|
367
|
+
indexed: !1
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
name: "Transfer"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
type: "function",
|
|
374
|
+
inputs: [],
|
|
375
|
+
name: "DOMAIN_SEPARATOR",
|
|
376
|
+
outputs: [{ name: "result", internalType: "bytes32", type: "bytes32" }],
|
|
377
|
+
stateMutability: "view"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
type: "function",
|
|
381
|
+
inputs: [
|
|
382
|
+
{ name: "owner", internalType: "address", type: "address" },
|
|
383
|
+
{ name: "spender", internalType: "address", type: "address" }
|
|
384
|
+
],
|
|
385
|
+
name: "allowance",
|
|
386
|
+
outputs: [{ name: "result", internalType: "uint256", type: "uint256" }],
|
|
387
|
+
stateMutability: "view"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
type: "function",
|
|
391
|
+
inputs: [
|
|
392
|
+
{ name: "spender", internalType: "address", type: "address" },
|
|
393
|
+
{ name: "amount", internalType: "uint256", type: "uint256" }
|
|
394
|
+
],
|
|
395
|
+
name: "approve",
|
|
396
|
+
outputs: [{ name: "", internalType: "bool", type: "bool" }],
|
|
397
|
+
stateMutability: "nonpayable"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
type: "function",
|
|
401
|
+
inputs: [{ name: "owner", internalType: "address", type: "address" }],
|
|
402
|
+
name: "balanceOf",
|
|
403
|
+
outputs: [{ name: "result", internalType: "uint256", type: "uint256" }],
|
|
404
|
+
stateMutability: "view"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
type: "function",
|
|
408
|
+
inputs: [],
|
|
409
|
+
name: "decimals",
|
|
410
|
+
outputs: [{ name: "", internalType: "uint8", type: "uint8" }],
|
|
411
|
+
stateMutability: "view"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
type: "function",
|
|
415
|
+
inputs: [
|
|
416
|
+
{ name: "to", internalType: "address", type: "address" },
|
|
417
|
+
{ name: "amount", internalType: "uint256", type: "uint256" }
|
|
418
|
+
],
|
|
419
|
+
name: "mint",
|
|
420
|
+
outputs: [],
|
|
421
|
+
stateMutability: "nonpayable"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
type: "function",
|
|
425
|
+
inputs: [
|
|
426
|
+
{ name: "to", internalType: "address", type: "address" },
|
|
427
|
+
{ name: "amount", internalType: "uint256", type: "uint256" }
|
|
428
|
+
],
|
|
429
|
+
name: "mintPayable",
|
|
430
|
+
outputs: [],
|
|
431
|
+
stateMutability: "payable"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
type: "function",
|
|
435
|
+
inputs: [],
|
|
436
|
+
name: "name",
|
|
437
|
+
outputs: [{ name: "", internalType: "string", type: "string" }],
|
|
438
|
+
stateMutability: "pure"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
type: "function",
|
|
442
|
+
inputs: [{ name: "owner", internalType: "address", type: "address" }],
|
|
443
|
+
name: "nonces",
|
|
444
|
+
outputs: [{ name: "result", internalType: "uint256", type: "uint256" }],
|
|
445
|
+
stateMutability: "view"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
type: "function",
|
|
449
|
+
inputs: [
|
|
450
|
+
{ name: "owner", internalType: "address", type: "address" },
|
|
451
|
+
{ name: "spender", internalType: "address", type: "address" },
|
|
452
|
+
{ name: "value", internalType: "uint256", type: "uint256" },
|
|
453
|
+
{ name: "deadline", internalType: "uint256", type: "uint256" },
|
|
454
|
+
{ name: "v", internalType: "uint8", type: "uint8" },
|
|
455
|
+
{ name: "r", internalType: "bytes32", type: "bytes32" },
|
|
456
|
+
{ name: "s", internalType: "bytes32", type: "bytes32" }
|
|
457
|
+
],
|
|
458
|
+
name: "permit",
|
|
459
|
+
outputs: [],
|
|
460
|
+
stateMutability: "nonpayable"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
type: "function",
|
|
464
|
+
inputs: [],
|
|
465
|
+
name: "symbol",
|
|
466
|
+
outputs: [{ name: "", internalType: "string", type: "string" }],
|
|
467
|
+
stateMutability: "pure"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
type: "function",
|
|
471
|
+
inputs: [],
|
|
472
|
+
name: "totalSupply",
|
|
473
|
+
outputs: [{ name: "result", internalType: "uint256", type: "uint256" }],
|
|
474
|
+
stateMutability: "view"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
type: "function",
|
|
478
|
+
inputs: [
|
|
479
|
+
{ name: "to", internalType: "address", type: "address" },
|
|
480
|
+
{ name: "amount", internalType: "uint256", type: "uint256" }
|
|
481
|
+
],
|
|
482
|
+
name: "transfer",
|
|
483
|
+
outputs: [{ name: "", internalType: "bool", type: "bool" }],
|
|
484
|
+
stateMutability: "nonpayable"
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
type: "function",
|
|
488
|
+
inputs: [
|
|
489
|
+
{ name: "from", internalType: "address", type: "address" },
|
|
490
|
+
{ name: "to", internalType: "address", type: "address" },
|
|
491
|
+
{ name: "amount", internalType: "uint256", type: "uint256" }
|
|
492
|
+
],
|
|
493
|
+
name: "transferFrom",
|
|
494
|
+
outputs: [{ name: "", internalType: "bool", type: "bool" }],
|
|
495
|
+
stateMutability: "nonpayable"
|
|
496
|
+
}
|
|
497
|
+
], E0 = /* @__PURE__ */ K({
|
|
498
|
+
abi: p,
|
|
499
|
+
functionName: "allowance"
|
|
500
|
+
}), M0 = /* @__PURE__ */ K({
|
|
501
|
+
abi: p,
|
|
502
|
+
functionName: "balanceOf"
|
|
503
|
+
}), R0 = /* @__PURE__ */ D({
|
|
504
|
+
abi: p,
|
|
505
|
+
functionName: "approve"
|
|
506
|
+
}), B0 = /* @__PURE__ */ D({
|
|
507
|
+
abi: p,
|
|
508
|
+
functionName: "mint"
|
|
509
|
+
}), P0 = /* @__PURE__ */ D({
|
|
510
|
+
abi: p,
|
|
511
|
+
functionName: "mintPayable"
|
|
512
|
+
}), N0 = /* @__PURE__ */ N({
|
|
513
|
+
abi: p,
|
|
514
|
+
functionName: "approve"
|
|
515
|
+
}), D0 = /* @__PURE__ */ N({
|
|
516
|
+
abi: p,
|
|
517
|
+
functionName: "mint"
|
|
518
|
+
}), j0 = /* @__PURE__ */ N({
|
|
519
|
+
abi: p,
|
|
520
|
+
functionName: "mintPayable"
|
|
521
|
+
}), O0 = "0x6080604052348015600e575f80fd5b50610e138061001c5f395ff3fe6080604052600436106100dc575f3560e01c806340c10f191161007e57806395d89b411161005857806395d89b41146102bc578063a9059cbb146102e6578063d505accf14610322578063dd62ed3e1461034a576100dc565b806340c10f191461021c57806370a08231146102445780637ecebe0014610280576100dc565b806318160ddd116100ba57806318160ddd1461016257806323b872dd1461018c578063313ce567146101c85780633644e515146101f2576100dc565b806306fdde03146100e0578063095ea7b31461010a57806317d304b014610146575b5f80fd5b3480156100eb575f80fd5b506100f4610386565b60405161010191906109bf565b60405180910390f35b348015610115575f80fd5b50610130600480360381019061012b9190610a70565b6103c3565b60405161013d9190610ac8565b60405180910390f35b610160600480360381019061015b9190610a70565b610413565b005b34801561016d575f80fd5b50610176610470565b6040516101839190610af0565b60405180910390f35b348015610197575f80fd5b506101b260048036038101906101ad9190610b09565b610481565b6040516101bf9190610ac8565b60405180910390f35b3480156101d3575f80fd5b506101dc610552565b6040516101e99190610b74565b60405180910390f35b3480156101fd575f80fd5b5061020661055a565b6040516102139190610ba5565b60405180910390f35b348015610227575f80fd5b50610242600480360381019061023d9190610a70565b6105ea565b005b34801561024f575f80fd5b5061026a60048036038101906102659190610bbe565b6105f8565b6040516102779190610af0565b60405180910390f35b34801561028b575f80fd5b506102a660048036038101906102a19190610bbe565b610611565b6040516102b39190610af0565b60405180910390f35b3480156102c7575f80fd5b506102d061062a565b6040516102dd91906109bf565b60405180910390f35b3480156102f1575f80fd5b5061030c60048036038101906103079190610a70565b610667565b6040516103199190610ac8565b60405180910390f35b34801561032d575f80fd5b5061034860048036038101906103439190610c3d565b6106f5565b005b348015610355575f80fd5b50610370600480360381019061036b9190610cda565b610891565b60405161037d9190610af0565b60405180910390f35b60606040518060400160405280600a81526020017f4d6f636b20455243323000000000000000000000000000000000000000000000815250905090565b5f82602052637f5e9f20600c52335f52816034600c2055815f52602c5160601c337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560205fa36001905092915050565b6064816104209190610d45565b341015610462576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045990610dbf565b60405180910390fd5b61046c82826108af565b5050565b5f6805345cdf77eb68f44c54905090565b5f61048d848484610941565b8360601b33602052637f5e9f208117600c526034600c20805460018101156104ca57808511156104c4576313be252b5f526004601cfd5b84810382555b6387a211a28317600c526020600c208054808711156104f05763f4d678b85f526004601cfd5b8681038255875f526020600c2087815401815587602052600c5160601c8660601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a3505050505050610547848484610946565b600190509392505050565b5f6012905090565b5f8061056461094b565b90505f801b810361058157610577610386565b8051906020012090505b6040517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81528160208201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604082015246606082015230608082015260a081209250505090565b6105f482826108af565b5050565b5f6387a211a2600c52815f526020600c20549050919050565b5f6338377508600c52815f526020600c20549050919050565b60606040518060400160405280600481526020017f4d4f434b00000000000000000000000000000000000000000000000000000000815250905090565b5f610673338484610941565b6387a211a2600c52335f526020600c2080548084111561069a5763f4d678b85f526004601cfd5b8381038255845f526020600c2084815401815584602052600c5160601c337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a35050506106eb338484610946565b6001905092915050565b5f6106fe61094b565b90505f801b810361071b57610711610386565b8051906020012090505b8442111561073057631a15a3cc5f526004601cfd5b6040518860601b60601c98508760601b60601c975065383775081901600e52885f526020600c2080547f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528360208401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604084015246606084015230608084015260a08320602e527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983528a60208401528960408401528860608401528060808401528760a084015260c08320604e526042602c205f528660ff16602052856040528460605260208060805f60015afa8b3d51146108385763ddafbaef5f526004601cfd5b80820183558a637f5e9f2060a01b17604052896034602c20558a8c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925602060608801a3836040525f606052505050505050505050505050565b5f81602052637f5e9f20600c52825f526034600c2054905092915050565b6108ba5f8383610941565b6805345cdf77eb68f44c54818101818110156108dd5763e5cfe9575f526004601cfd5b806805345cdf77eb68f44c556387a211a2600c52835f526020600c2083815401815583602052600c5160601c5f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a350505061093d5f8383610946565b5050565b505050565b505050565b5f90565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6109918261094f565b61099b8185610959565b93506109ab818560208601610969565b6109b481610977565b840191505092915050565b5f6020820190508181035f8301526109d78184610987565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a0c826109e3565b9050919050565b610a1c81610a02565b8114610a26575f80fd5b50565b5f81359050610a3781610a13565b92915050565b5f819050919050565b610a4f81610a3d565b8114610a59575f80fd5b50565b5f81359050610a6a81610a46565b92915050565b5f8060408385031215610a8657610a856109df565b5b5f610a9385828601610a29565b9250506020610aa485828601610a5c565b9150509250929050565b5f8115159050919050565b610ac281610aae565b82525050565b5f602082019050610adb5f830184610ab9565b92915050565b610aea81610a3d565b82525050565b5f602082019050610b035f830184610ae1565b92915050565b5f805f60608486031215610b2057610b1f6109df565b5b5f610b2d86828701610a29565b9350506020610b3e86828701610a29565b9250506040610b4f86828701610a5c565b9150509250925092565b5f60ff82169050919050565b610b6e81610b59565b82525050565b5f602082019050610b875f830184610b65565b92915050565b5f819050919050565b610b9f81610b8d565b82525050565b5f602082019050610bb85f830184610b96565b92915050565b5f60208284031215610bd357610bd26109df565b5b5f610be084828501610a29565b91505092915050565b610bf281610b59565b8114610bfc575f80fd5b50565b5f81359050610c0d81610be9565b92915050565b610c1c81610b8d565b8114610c26575f80fd5b50565b5f81359050610c3781610c13565b92915050565b5f805f805f805f60e0888a031215610c5857610c576109df565b5b5f610c658a828b01610a29565b9750506020610c768a828b01610a29565b9650506040610c878a828b01610a5c565b9550506060610c988a828b01610a5c565b9450506080610ca98a828b01610bff565b93505060a0610cba8a828b01610c29565b92505060c0610ccb8a828b01610c29565b91505092959891949750929550565b5f8060408385031215610cf057610cef6109df565b5b5f610cfd85828601610a29565b9250506020610d0e85828601610a29565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f610d4f82610a3d565b9150610d5a83610a3d565b925082610d6a57610d69610d18565b5b828204905092915050565b7f4d6f636b45524332303a2067696d6d65206d6f7265206d6f6e657921000000005f82015250565b5f610da9601c83610959565b9150610db482610d75565b602082019050919050565b5f6020820190508181035f830152610dd681610d9d565b905091905056fea2646970667358221220a588f9f821e157f856641e8171dc78ec959e3c73080238aa8696355fc5d4a5d064736f6c634300081a0033";
|
|
522
|
+
class Q extends t0 {
|
|
523
|
+
async balanceOf(t, e) {
|
|
524
|
+
return await M0(this._config, {
|
|
525
|
+
address: this.assertValidAddress(),
|
|
526
|
+
args: [t],
|
|
527
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
528
|
+
...e
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
async allowance(t, e, n) {
|
|
532
|
+
return await E0(this._config, {
|
|
533
|
+
address: this.assertValidAddress(),
|
|
534
|
+
args: [t, e],
|
|
535
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
536
|
+
...n
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
async approve(t, e, n) {
|
|
540
|
+
return await this.awaitResult(this.approveRaw(t, e, n));
|
|
541
|
+
}
|
|
542
|
+
async approveRaw(t, e, n) {
|
|
543
|
+
const { request: r, result: o } = await N0(this._config, {
|
|
544
|
+
address: this.assertValidAddress(),
|
|
545
|
+
args: [t, e],
|
|
546
|
+
...this.optionallyAttachAccount(),
|
|
547
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
548
|
+
...n
|
|
549
|
+
});
|
|
550
|
+
return { hash: await R0(this._config, r), result: o };
|
|
551
|
+
}
|
|
552
|
+
async mint(t, e, n) {
|
|
553
|
+
return await this.awaitResult(this.mintRaw(t, e, n));
|
|
554
|
+
}
|
|
555
|
+
async mintRaw(t, e, n) {
|
|
556
|
+
const { request: r, result: o } = await D0(this._config, {
|
|
557
|
+
address: this.assertValidAddress(),
|
|
558
|
+
args: [t, e],
|
|
559
|
+
...this.optionallyAttachAccount(),
|
|
560
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
561
|
+
...n
|
|
562
|
+
});
|
|
563
|
+
return { hash: await B0(this._config, r), result: o };
|
|
564
|
+
}
|
|
565
|
+
async mintPayable(t, e, n) {
|
|
566
|
+
return await this.awaitResult(
|
|
567
|
+
// biome-ignore lint/suspicious/noExplicitAny: this is a mock contract, it's fine
|
|
568
|
+
this.mintPayableRaw(t, e, n)
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
async mintPayableRaw(t, e, n) {
|
|
572
|
+
const { request: r, result: o } = await j0(
|
|
573
|
+
this._config,
|
|
574
|
+
{
|
|
575
|
+
address: this.assertValidAddress(),
|
|
576
|
+
args: [t, e],
|
|
577
|
+
...this.optionallyAttachAccount(),
|
|
578
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
579
|
+
...n
|
|
580
|
+
}
|
|
581
|
+
);
|
|
582
|
+
return { hash: await P0(this._config, r), result: o };
|
|
583
|
+
}
|
|
584
|
+
buildParameters(t = {}, e) {
|
|
585
|
+
const [, n] = this.validateDeploymentConfig(t, e);
|
|
586
|
+
return {
|
|
587
|
+
abi: p,
|
|
588
|
+
bytecode: O0,
|
|
589
|
+
...this.optionallyAttachAccount(n.account)
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
const F0 = [
|
|
594
|
+
{
|
|
595
|
+
account: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
596
|
+
key: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
account: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
|
|
600
|
+
key: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
account: "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
|
|
604
|
+
key: "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
account: "0x90F79bf6EB2c4f870365E785982E1f101E93b906",
|
|
608
|
+
key: "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
account: "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",
|
|
612
|
+
key: "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
account: "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
|
|
616
|
+
key: "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
account: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
|
|
620
|
+
key: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
account: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
|
|
624
|
+
key: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
account: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
|
|
628
|
+
key: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
account: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
|
|
632
|
+
key: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
|
633
|
+
}
|
|
634
|
+
].map((a) => ({
|
|
635
|
+
...a,
|
|
636
|
+
privateKey: g0(a.key)
|
|
637
|
+
})), L0 = "test test test test test test test test test test test junk", pe = async function(t, e) {
|
|
638
|
+
const n = e.privateKey, r = e.mnemonic ?? L0, o = e.chain || "anvil", [{ config: i, account: f }, m] = v0({
|
|
639
|
+
chain: o,
|
|
640
|
+
rpcUrl: e.rpcUrl,
|
|
641
|
+
privateKey: n,
|
|
642
|
+
mnemonic: r
|
|
643
|
+
}), s = m.id;
|
|
644
|
+
if (t.at(0) === "generate")
|
|
645
|
+
return ne({ account: f == null ? void 0 : f.address, chainId: s });
|
|
646
|
+
if (t.at(0) === "erc20") {
|
|
647
|
+
let u = new Q({ config: i, account: f }, {});
|
|
648
|
+
return await u.deploy(), {
|
|
649
|
+
erc20: u.assertValidAddress()
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
const y = a0[s];
|
|
653
|
+
if (!y)
|
|
654
|
+
throw new Error(
|
|
655
|
+
`Unable to select a deployed BoostRegistry with chain ID ${s}`
|
|
656
|
+
);
|
|
657
|
+
const I = new n0({
|
|
658
|
+
config: i,
|
|
659
|
+
account: f,
|
|
660
|
+
address: y
|
|
661
|
+
}), T = c0[s];
|
|
662
|
+
if (!T)
|
|
663
|
+
throw new Error(
|
|
664
|
+
`Unable to select a deployed BoostCore with chain ID ${s}`
|
|
665
|
+
);
|
|
666
|
+
const l = new i0({
|
|
667
|
+
config: i,
|
|
668
|
+
account: f,
|
|
669
|
+
address: T
|
|
670
|
+
});
|
|
671
|
+
if (!t.length) throw new Error("No seed provided");
|
|
672
|
+
const G = await Promise.all(t.map(V0));
|
|
673
|
+
let S, O;
|
|
674
|
+
const F = [];
|
|
675
|
+
for (const u of G) {
|
|
676
|
+
let h;
|
|
677
|
+
if (typeof u.budget == "string" && R(u.budget))
|
|
678
|
+
h = l.ManagedBudget(u.budget);
|
|
679
|
+
else if (w0(O, u.budget) && S)
|
|
680
|
+
h = S;
|
|
681
|
+
else {
|
|
682
|
+
const b = {
|
|
683
|
+
...u.budget,
|
|
684
|
+
authorized: [...u.budget.authorized, T],
|
|
685
|
+
roles: [...u.budget.roles, U.MANAGER]
|
|
686
|
+
};
|
|
687
|
+
h = await I.initialize(
|
|
688
|
+
crypto.randomUUID(),
|
|
689
|
+
l.ManagedBudget(b)
|
|
690
|
+
), S = h, O = u.budget;
|
|
691
|
+
}
|
|
692
|
+
const J = u.incentives.map(async (b) => {
|
|
693
|
+
let g = 0n;
|
|
694
|
+
switch (b.type) {
|
|
695
|
+
case "AllowListIncentive":
|
|
696
|
+
return l.AllowListIncentive(b);
|
|
697
|
+
case "ERC20Incentive":
|
|
698
|
+
return b.strategy === E.RAFFLE && (g += b.reward), b.strategy === E.POOL && (g += b.reward * b.limit), b.shouldMintAndAllocate && await x(h, g, b.asset, {
|
|
699
|
+
config: i,
|
|
700
|
+
account: f
|
|
701
|
+
}), l.ERC20Incentive(b);
|
|
702
|
+
case "ERC20VariableCriteriaIncentive":
|
|
703
|
+
return g += b.limit, b.shouldMintAndAllocate && await x(h, g, b.asset, {
|
|
704
|
+
config: i,
|
|
705
|
+
account: f
|
|
706
|
+
}), l.ERC20VariableCriteriaIncentive(b);
|
|
707
|
+
case "ERC20VariableIncentive":
|
|
708
|
+
return g += b.limit, b.shouldMintAndAllocate && await x(h, g, b.asset, {
|
|
709
|
+
config: i,
|
|
710
|
+
account: f
|
|
711
|
+
}), l.ERC20VariableIncentive(b);
|
|
712
|
+
}
|
|
713
|
+
}), Z = await Promise.all(J), Y = await l.createBoost({
|
|
714
|
+
protocolFee: u.protocolFee,
|
|
715
|
+
maxParticipants: u.maxParticipants,
|
|
716
|
+
budget: h,
|
|
717
|
+
action: l.EventAction(u.action),
|
|
718
|
+
validator: l.SignerValidator(u.validator),
|
|
719
|
+
allowList: await te(u, { core: l }),
|
|
720
|
+
incentives: Z
|
|
721
|
+
});
|
|
722
|
+
F.push(Y.id.toString());
|
|
723
|
+
}
|
|
724
|
+
return {
|
|
725
|
+
boostIds: F
|
|
726
|
+
};
|
|
727
|
+
};
|
|
728
|
+
async function x(a, t, e, n) {
|
|
729
|
+
if (e && t) {
|
|
730
|
+
let r = new Q(n, e);
|
|
731
|
+
await ae(n, r, a, H(t.toString()));
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
async function V0(a) {
|
|
735
|
+
const t = await X.readFile(e0.normalize(a), {
|
|
736
|
+
encoding: "utf8"
|
|
737
|
+
});
|
|
738
|
+
return ee.parse(JSON.parse(t));
|
|
739
|
+
}
|
|
740
|
+
const _0 = c.custom(u0, "invalid Hex payload"), d = c.string().transform((a, t) => (/^0x[a-fA-F0-9]{40}$/.test(a) || t.addIssue({
|
|
741
|
+
code: c.ZodIssueCode.custom,
|
|
742
|
+
message: `Invalid Address ${a}`
|
|
743
|
+
}), a)).pipe(c.custom(R, "invalid eth address")), $0 = c.coerce.number().min(1).max(2).transform(BigInt).pipe(c.custom()), k0 = c.object({
|
|
744
|
+
type: c.literal("ManagedBudget"),
|
|
745
|
+
owner: d,
|
|
746
|
+
authorized: c.array(d),
|
|
747
|
+
roles: c.array($0)
|
|
748
|
+
}).refine(
|
|
749
|
+
(a) => a.authorized.length === a.roles.length,
|
|
750
|
+
"length mismatch authorized and roles"
|
|
751
|
+
), j = c.custom().pipe(
|
|
752
|
+
c.string().regex(/^(event|function) .*/, {
|
|
753
|
+
message: "signature must start with `event` or function`"
|
|
754
|
+
}).transform((a) => {
|
|
755
|
+
if (a.startsWith("event")) return l0(p0(a));
|
|
756
|
+
if (a.startsWith("function")) return m0(a);
|
|
757
|
+
throw new Error("unreachable");
|
|
758
|
+
})
|
|
759
|
+
), U0 = c.object({
|
|
760
|
+
signatureType: c.nativeEnum(v),
|
|
761
|
+
signature: j,
|
|
762
|
+
fieldIndex: c.number().nonnegative(),
|
|
763
|
+
targetContract: d,
|
|
764
|
+
chainid: c.number().nonnegative()
|
|
765
|
+
}), H0 = c.object({
|
|
766
|
+
filterType: c.nativeEnum($),
|
|
767
|
+
fieldType: c.nativeEnum(k),
|
|
768
|
+
fieldIndex: c.number().nonnegative(),
|
|
769
|
+
filterData: _0
|
|
770
|
+
}), z0 = c.object({
|
|
771
|
+
signature: j,
|
|
772
|
+
signatureType: c.nativeEnum(v),
|
|
773
|
+
actionType: c.number().optional(),
|
|
774
|
+
targetContract: d,
|
|
775
|
+
chainid: c.number().nonnegative(),
|
|
776
|
+
actionParameter: H0
|
|
777
|
+
}), q0 = c.object({
|
|
778
|
+
type: c.literal("EventAction"),
|
|
779
|
+
actionClaimant: U0,
|
|
780
|
+
actionSteps: c.array(z0).max(4)
|
|
781
|
+
}), W0 = c.object({
|
|
782
|
+
type: c.literal("SignerValidator"),
|
|
783
|
+
signers: c.array(d),
|
|
784
|
+
validatorCaller: d
|
|
785
|
+
}), K0 = c.object({
|
|
786
|
+
type: c.literal("SimpleDenyList"),
|
|
787
|
+
owner: d,
|
|
788
|
+
denied: c.array(d)
|
|
789
|
+
}), Q0 = c.object({
|
|
790
|
+
type: c.literal("SimpleAllowList"),
|
|
791
|
+
owner: d,
|
|
792
|
+
allowed: c.array(d)
|
|
793
|
+
}), G0 = c.object({
|
|
794
|
+
type: c.literal("AllowListIncentive"),
|
|
795
|
+
allowList: d,
|
|
796
|
+
limit: c.coerce.bigint()
|
|
797
|
+
}), J0 = c.object({
|
|
798
|
+
type: c.literal("ERC20Incentive"),
|
|
799
|
+
asset: d,
|
|
800
|
+
shouldMintAndAllocate: c.boolean().optional().default(!1),
|
|
801
|
+
strategy: c.nativeEnum(E),
|
|
802
|
+
reward: c.coerce.bigint(),
|
|
803
|
+
limit: c.coerce.bigint(),
|
|
804
|
+
manager: d.optional()
|
|
805
|
+
}), Z0 = c.object({
|
|
806
|
+
type: c.literal("ERC20VariableIncentive"),
|
|
807
|
+
asset: d,
|
|
808
|
+
shouldMintAndAllocate: c.boolean().optional().default(!1),
|
|
809
|
+
reward: c.coerce.bigint(),
|
|
810
|
+
limit: c.coerce.bigint(),
|
|
811
|
+
manager: d
|
|
812
|
+
}), Y0 = c.object({
|
|
813
|
+
criteriaType: c.nativeEnum(v),
|
|
814
|
+
signature: j,
|
|
815
|
+
fieldIndex: c.number().nonnegative(),
|
|
816
|
+
targetContract: d
|
|
817
|
+
}), X0 = c.object({
|
|
818
|
+
type: c.literal("ERC20VariableCriteriaIncentive"),
|
|
819
|
+
asset: d,
|
|
820
|
+
shouldMintAndAllocate: c.boolean().optional().default(!1),
|
|
821
|
+
reward: c.coerce.bigint(),
|
|
822
|
+
limit: c.coerce.bigint(),
|
|
823
|
+
manager: d.optional(),
|
|
824
|
+
criteria: Y0
|
|
825
|
+
}), ee = c.object({
|
|
826
|
+
protocolFee: c.coerce.bigint(),
|
|
827
|
+
maxParticipants: c.coerce.bigint(),
|
|
828
|
+
budget: c.union([d, k0]),
|
|
829
|
+
action: c.union([d, q0]),
|
|
830
|
+
validator: c.union([d, W0]),
|
|
831
|
+
allowList: c.union([
|
|
832
|
+
d,
|
|
833
|
+
K0,
|
|
834
|
+
Q0
|
|
835
|
+
]),
|
|
836
|
+
incentives: c.array(
|
|
837
|
+
c.union([
|
|
838
|
+
G0,
|
|
839
|
+
J0,
|
|
840
|
+
X0,
|
|
841
|
+
Z0
|
|
842
|
+
])
|
|
843
|
+
)
|
|
844
|
+
});
|
|
845
|
+
async function te({ allowList: a }, { core: t }) {
|
|
846
|
+
if (typeof a == "string" && R(a))
|
|
847
|
+
return await r0(
|
|
848
|
+
//@ts-expect-error i do what i want
|
|
849
|
+
{ config: t._config, account: t._account },
|
|
850
|
+
a
|
|
851
|
+
);
|
|
852
|
+
switch (a.type) {
|
|
853
|
+
case "SimpleAllowList":
|
|
854
|
+
return t.SimpleAllowList(a);
|
|
855
|
+
case "SimpleDenyList":
|
|
856
|
+
return t.SimpleDenyList(a);
|
|
857
|
+
default:
|
|
858
|
+
throw new Error("unusupported AllowList: " + a);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
async function ae(a, t, e, n = H("110")) {
|
|
862
|
+
return await t.mint(a.account.address, n), await t.approve(e.assertValidAddress(), n), await e.allocate({
|
|
863
|
+
amount: n,
|
|
864
|
+
asset: t.assertValidAddress(),
|
|
865
|
+
target: a.account.address
|
|
866
|
+
}), { budget: e, erc20: t };
|
|
867
|
+
}
|
|
868
|
+
function ne({
|
|
869
|
+
asset: a = "0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D",
|
|
870
|
+
account: t = F0[0].account,
|
|
871
|
+
chainId: e
|
|
872
|
+
}) {
|
|
873
|
+
return {
|
|
874
|
+
protocolFee: 0n,
|
|
875
|
+
maxParticipants: 10n,
|
|
876
|
+
budget: {
|
|
877
|
+
type: "ManagedBudget",
|
|
878
|
+
owner: t,
|
|
879
|
+
authorized: [t],
|
|
880
|
+
roles: [U.MANAGER]
|
|
881
|
+
},
|
|
882
|
+
action: {
|
|
883
|
+
type: "EventAction",
|
|
884
|
+
actionClaimant: {
|
|
885
|
+
signatureType: v.FUNC,
|
|
886
|
+
signature: "function mint(address to, uint256 amount)",
|
|
887
|
+
fieldIndex: 0,
|
|
888
|
+
targetContract: L,
|
|
889
|
+
chainid: e
|
|
890
|
+
},
|
|
891
|
+
actionSteps: [
|
|
892
|
+
{
|
|
893
|
+
signature: "event Minted(address to, uint256 amount)",
|
|
894
|
+
signatureType: v.FUNC,
|
|
895
|
+
actionType: 0,
|
|
896
|
+
targetContract: L,
|
|
897
|
+
chainid: e,
|
|
898
|
+
actionParameter: {
|
|
899
|
+
filterType: $.EQUAL,
|
|
900
|
+
fieldType: k.ADDRESS,
|
|
901
|
+
fieldIndex: 0,
|
|
902
|
+
filterData: t
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
]
|
|
906
|
+
},
|
|
907
|
+
validator: {
|
|
908
|
+
type: "SignerValidator",
|
|
909
|
+
signers: [t],
|
|
910
|
+
validatorCaller: t
|
|
911
|
+
},
|
|
912
|
+
allowList: {
|
|
913
|
+
type: "SimpleDenyList",
|
|
914
|
+
owner: t,
|
|
915
|
+
denied: []
|
|
916
|
+
},
|
|
917
|
+
incentives: [
|
|
918
|
+
{
|
|
919
|
+
type: "ERC20Incentive",
|
|
920
|
+
asset: a,
|
|
921
|
+
shouldMintAndAllocate: !1,
|
|
922
|
+
strategy: 0,
|
|
923
|
+
reward: 1n,
|
|
924
|
+
limit: 1n,
|
|
925
|
+
manager: t
|
|
926
|
+
}
|
|
927
|
+
]
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
export {
|
|
931
|
+
U0 as ActionClaimantSchema,
|
|
932
|
+
H0 as ActionStepCriteriaSchema,
|
|
933
|
+
z0 as ActionStepSchema,
|
|
934
|
+
G0 as AllowListIncentiveSchema,
|
|
935
|
+
ee as BoostSeedConfigSchema,
|
|
936
|
+
J0 as ERC20IncentiveSchema,
|
|
937
|
+
X0 as ERC20VariableCriteriaIncentiveSchema,
|
|
938
|
+
Z0 as ERC20VariableIncentiveSchema,
|
|
939
|
+
q0 as EventActionSchema,
|
|
940
|
+
Y0 as IncentiveCriteriaSchema,
|
|
941
|
+
k0 as ManagedBudgetSchema,
|
|
942
|
+
W0 as SignerValidatorSchema,
|
|
943
|
+
Q0 as SimpleAllowListSchema,
|
|
944
|
+
K0 as SimpleDenyListSchema,
|
|
945
|
+
ne as makeSeed,
|
|
946
|
+
pe as seed
|
|
947
|
+
};
|