@spectratools/aborean-cli 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cli.js +653 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 spectra-the-bot
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
import { dirname, resolve } from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import { Cli, z } from "incur";
|
|
8
|
+
|
|
9
|
+
// src/contracts/abis/CLFactory.abi.json
|
|
10
|
+
var CLFactory_abi_default = [
|
|
11
|
+
{
|
|
12
|
+
type: "function",
|
|
13
|
+
name: "allPoolsLength",
|
|
14
|
+
inputs: [],
|
|
15
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
16
|
+
stateMutability: "view"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: "function",
|
|
20
|
+
name: "allPools",
|
|
21
|
+
inputs: [{ name: "index", type: "uint256", internalType: "uint256" }],
|
|
22
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
23
|
+
stateMutability: "view"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "function",
|
|
27
|
+
name: "getPool",
|
|
28
|
+
inputs: [
|
|
29
|
+
{ name: "tokenA", type: "address", internalType: "address" },
|
|
30
|
+
{ name: "tokenB", type: "address", internalType: "address" },
|
|
31
|
+
{ name: "tickSpacing", type: "int24", internalType: "int24" }
|
|
32
|
+
],
|
|
33
|
+
outputs: [{ name: "pool", type: "address", internalType: "address" }],
|
|
34
|
+
stateMutability: "view"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "function",
|
|
38
|
+
name: "owner",
|
|
39
|
+
inputs: [],
|
|
40
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
41
|
+
stateMutability: "view"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "function",
|
|
45
|
+
name: "poolImplementation",
|
|
46
|
+
inputs: [],
|
|
47
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
48
|
+
stateMutability: "view"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "function",
|
|
52
|
+
name: "voter",
|
|
53
|
+
inputs: [],
|
|
54
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
55
|
+
stateMutability: "view"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: "function",
|
|
59
|
+
name: "tickSpacings",
|
|
60
|
+
inputs: [],
|
|
61
|
+
outputs: [{ name: "", type: "int24[]", internalType: "int24[]" }],
|
|
62
|
+
stateMutability: "view"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "function",
|
|
66
|
+
name: "tickSpacingToFee",
|
|
67
|
+
inputs: [{ name: "tickSpacing", type: "int24", internalType: "int24" }],
|
|
68
|
+
outputs: [{ name: "fee", type: "uint24", internalType: "uint24" }],
|
|
69
|
+
stateMutability: "view"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "function",
|
|
73
|
+
name: "isPool",
|
|
74
|
+
inputs: [{ name: "pool", type: "address", internalType: "address" }],
|
|
75
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
76
|
+
stateMutability: "view"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "function",
|
|
80
|
+
name: "getSwapFee",
|
|
81
|
+
inputs: [{ name: "pool", type: "address", internalType: "address" }],
|
|
82
|
+
outputs: [{ name: "", type: "uint24", internalType: "uint24" }],
|
|
83
|
+
stateMutability: "view"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: "function",
|
|
87
|
+
name: "getUnstakedFee",
|
|
88
|
+
inputs: [{ name: "pool", type: "address", internalType: "address" }],
|
|
89
|
+
outputs: [{ name: "", type: "uint24", internalType: "uint24" }],
|
|
90
|
+
stateMutability: "view"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: "function",
|
|
94
|
+
name: "defaultUnstakedFee",
|
|
95
|
+
inputs: [],
|
|
96
|
+
outputs: [{ name: "", type: "uint24", internalType: "uint24" }],
|
|
97
|
+
stateMutability: "view"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: "function",
|
|
101
|
+
name: "swapFeeModule",
|
|
102
|
+
inputs: [],
|
|
103
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
104
|
+
stateMutability: "view"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: "function",
|
|
108
|
+
name: "unstakedFeeModule",
|
|
109
|
+
inputs: [],
|
|
110
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
111
|
+
stateMutability: "view"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: "function",
|
|
115
|
+
name: "factoryRegistry",
|
|
116
|
+
inputs: [],
|
|
117
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
118
|
+
stateMutability: "view"
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
// src/contracts/abis/PoolFactory.abi.json
|
|
123
|
+
var PoolFactory_abi_default = [
|
|
124
|
+
{
|
|
125
|
+
type: "function",
|
|
126
|
+
name: "allPoolsLength",
|
|
127
|
+
inputs: [],
|
|
128
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
129
|
+
stateMutability: "view"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: "function",
|
|
133
|
+
name: "allPools",
|
|
134
|
+
inputs: [{ name: "index", type: "uint256", internalType: "uint256" }],
|
|
135
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
136
|
+
stateMutability: "view"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "function",
|
|
140
|
+
name: "getPool",
|
|
141
|
+
inputs: [
|
|
142
|
+
{ name: "tokenA", type: "address", internalType: "address" },
|
|
143
|
+
{ name: "tokenB", type: "address", internalType: "address" },
|
|
144
|
+
{ name: "stable", type: "bool", internalType: "bool" }
|
|
145
|
+
],
|
|
146
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
147
|
+
stateMutability: "view"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: "function",
|
|
151
|
+
name: "isPair",
|
|
152
|
+
inputs: [{ name: "pool", type: "address", internalType: "address" }],
|
|
153
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
154
|
+
stateMutability: "view"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
type: "function",
|
|
158
|
+
name: "getFee",
|
|
159
|
+
inputs: [
|
|
160
|
+
{ name: "pool", type: "address", internalType: "address" },
|
|
161
|
+
{ name: "stable", type: "bool", internalType: "bool" }
|
|
162
|
+
],
|
|
163
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
164
|
+
stateMutability: "view"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
type: "function",
|
|
168
|
+
name: "implementation",
|
|
169
|
+
inputs: [],
|
|
170
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
171
|
+
stateMutability: "view"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: "function",
|
|
175
|
+
name: "voter",
|
|
176
|
+
inputs: [],
|
|
177
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
178
|
+
stateMutability: "view"
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
|
|
182
|
+
// src/contracts/abis/Voter.abi.json
|
|
183
|
+
var Voter_abi_default = [
|
|
184
|
+
{
|
|
185
|
+
type: "function",
|
|
186
|
+
name: "length",
|
|
187
|
+
inputs: [],
|
|
188
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
189
|
+
stateMutability: "view"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
type: "function",
|
|
193
|
+
name: "totalWeight",
|
|
194
|
+
inputs: [],
|
|
195
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
196
|
+
stateMutability: "view"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: "function",
|
|
200
|
+
name: "gauges",
|
|
201
|
+
inputs: [{ name: "pool", type: "address", internalType: "address" }],
|
|
202
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
203
|
+
stateMutability: "view"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
type: "function",
|
|
207
|
+
name: "poolForGauge",
|
|
208
|
+
inputs: [{ name: "gauge", type: "address", internalType: "address" }],
|
|
209
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
210
|
+
stateMutability: "view"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
type: "function",
|
|
214
|
+
name: "weights",
|
|
215
|
+
inputs: [{ name: "pool", type: "address", internalType: "address" }],
|
|
216
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
217
|
+
stateMutability: "view"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
type: "function",
|
|
221
|
+
name: "isAlive",
|
|
222
|
+
inputs: [{ name: "gauge", type: "address", internalType: "address" }],
|
|
223
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
224
|
+
stateMutability: "view"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
type: "function",
|
|
228
|
+
name: "isGauge",
|
|
229
|
+
inputs: [{ name: "", type: "address", internalType: "address" }],
|
|
230
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
231
|
+
stateMutability: "view"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
type: "function",
|
|
235
|
+
name: "ve",
|
|
236
|
+
inputs: [],
|
|
237
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
238
|
+
stateMutability: "view"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: "function",
|
|
242
|
+
name: "minter",
|
|
243
|
+
inputs: [],
|
|
244
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
245
|
+
stateMutability: "view"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: "function",
|
|
249
|
+
name: "factoryRegistry",
|
|
250
|
+
inputs: [],
|
|
251
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
252
|
+
stateMutability: "view"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: "function",
|
|
256
|
+
name: "forwarder",
|
|
257
|
+
inputs: [],
|
|
258
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
259
|
+
stateMutability: "view"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
type: "function",
|
|
263
|
+
name: "governor",
|
|
264
|
+
inputs: [],
|
|
265
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
266
|
+
stateMutability: "view"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
type: "function",
|
|
270
|
+
name: "emergencyCouncil",
|
|
271
|
+
inputs: [],
|
|
272
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
273
|
+
stateMutability: "view"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
type: "function",
|
|
277
|
+
name: "maxVotingNum",
|
|
278
|
+
inputs: [],
|
|
279
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
280
|
+
stateMutability: "view"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
type: "function",
|
|
284
|
+
name: "claimable",
|
|
285
|
+
inputs: [{ name: "gauge", type: "address", internalType: "address" }],
|
|
286
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
287
|
+
stateMutability: "view"
|
|
288
|
+
}
|
|
289
|
+
];
|
|
290
|
+
|
|
291
|
+
// src/contracts/abis/VotingEscrow.abi.json
|
|
292
|
+
var VotingEscrow_abi_default = [
|
|
293
|
+
{
|
|
294
|
+
type: "function",
|
|
295
|
+
name: "totalSupply",
|
|
296
|
+
inputs: [],
|
|
297
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
298
|
+
stateMutability: "view"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
type: "function",
|
|
302
|
+
name: "balanceOf",
|
|
303
|
+
inputs: [{ name: "owner", type: "address", internalType: "address" }],
|
|
304
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
305
|
+
stateMutability: "view"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
type: "function",
|
|
309
|
+
name: "locked",
|
|
310
|
+
inputs: [{ name: "tokenId", type: "uint256", internalType: "uint256" }],
|
|
311
|
+
outputs: [
|
|
312
|
+
{ name: "amount", type: "int128", internalType: "int128" },
|
|
313
|
+
{ name: "end", type: "uint256", internalType: "uint256" },
|
|
314
|
+
{ name: "isPermanent", type: "bool", internalType: "bool" }
|
|
315
|
+
],
|
|
316
|
+
stateMutability: "view"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
type: "function",
|
|
320
|
+
name: "ownerOf",
|
|
321
|
+
inputs: [{ name: "tokenId", type: "uint256", internalType: "uint256" }],
|
|
322
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
323
|
+
stateMutability: "view"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
type: "function",
|
|
327
|
+
name: "tokenOfOwnerByIndex",
|
|
328
|
+
inputs: [
|
|
329
|
+
{ name: "owner", type: "address", internalType: "address" },
|
|
330
|
+
{ name: "index", type: "uint256", internalType: "uint256" }
|
|
331
|
+
],
|
|
332
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
333
|
+
stateMutability: "view"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
type: "function",
|
|
337
|
+
name: "balanceOfNFT",
|
|
338
|
+
inputs: [{ name: "tokenId", type: "uint256", internalType: "uint256" }],
|
|
339
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
340
|
+
stateMutability: "view"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
type: "function",
|
|
344
|
+
name: "token",
|
|
345
|
+
inputs: [],
|
|
346
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
347
|
+
stateMutability: "view"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
type: "function",
|
|
351
|
+
name: "supply",
|
|
352
|
+
inputs: [],
|
|
353
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
354
|
+
stateMutability: "view"
|
|
355
|
+
}
|
|
356
|
+
];
|
|
357
|
+
|
|
358
|
+
// src/contracts/abis.ts
|
|
359
|
+
var clFactoryAbi = CLFactory_abi_default;
|
|
360
|
+
var poolFactoryAbi = PoolFactory_abi_default;
|
|
361
|
+
var voterAbi = Voter_abi_default;
|
|
362
|
+
var votingEscrowAbi = VotingEscrow_abi_default;
|
|
363
|
+
|
|
364
|
+
// src/contracts/addresses.ts
|
|
365
|
+
var ABOREAN_V2_ADDRESSES = {
|
|
366
|
+
/** ABX protocol token (ERC-20) */
|
|
367
|
+
abx: "0x4C68E4102c0F120cce9F08625bd12079806b7C4D",
|
|
368
|
+
/** Airdrop distributor for permanently locked veNFTs */
|
|
369
|
+
airdropDistributor: "0xd29d05bFfb2F0AfBB76ed217d726Ff5922253086",
|
|
370
|
+
/** Registry of approved pool/gauge/reward factories */
|
|
371
|
+
factoryRegistry: "0x5927E0C4b307Af16260327DE3276CE17d8A4aB49",
|
|
372
|
+
/** Trusted forwarder */
|
|
373
|
+
forwarder: "0x3f91b806F1968Fca85C08A7eE9A7262D7207A9c1",
|
|
374
|
+
/** Gauge factory (v2) */
|
|
375
|
+
gaugeFactory: "0x29BfEd845b1C10e427766b21d4533800B6f4e111",
|
|
376
|
+
/** Managed rewards factory */
|
|
377
|
+
managedRewardsFactory: "0x889d93f9c3586ec7CD287eE4e7C96E544985Ee95",
|
|
378
|
+
/** Protocol token minter — distributes emissions to Voter and rebases to RewardsDistributor */
|
|
379
|
+
minter: "0x58564Fcfc5a0C57887eFC0beDeC3EB5Ec37f1626",
|
|
380
|
+
/** V2 Pool implementation */
|
|
381
|
+
pool: "0x3E5791019A9Fae2805d69965b06dcEFC43Cd1A79",
|
|
382
|
+
/** V2 Pool factory */
|
|
383
|
+
poolFactory: "0xF6cDfFf7Ad51caaD860e7A35d6D4075d74039a6B",
|
|
384
|
+
/** Rebases distribution for veNFT lockers */
|
|
385
|
+
rewardsDistributor: "0x36cbf77D8F8355D7A077d670C29E290E41367072",
|
|
386
|
+
/** V2 swap router */
|
|
387
|
+
router: "0xE8142D2f82036B6FC1e79E4aE85cF53FBFfDC998",
|
|
388
|
+
/** veNFT art proxy */
|
|
389
|
+
veArtProxy: "0x53AF068205CB466d7Ce6e55fD1E64eB9eBcB7ce0",
|
|
390
|
+
/** Handles votes, gauge creation, and emission distribution */
|
|
391
|
+
voter: "0xC0F53703e9f4b79fA2FB09a2aeBA487FA97729c9",
|
|
392
|
+
/** Vote-escrow NFT (veABX) */
|
|
393
|
+
votingEscrow: "0x27B04370D8087e714a9f557c1EFF7901cea6bB63",
|
|
394
|
+
/** Voting rewards factory */
|
|
395
|
+
votingRewardsFactory: "0xCEf48ee1b2F7c0833D6F097c69D1ed4159b60958"
|
|
396
|
+
};
|
|
397
|
+
var ABOREAN_CL_ADDRESSES = {
|
|
398
|
+
/** CL pool factory */
|
|
399
|
+
clFactory: "0x8cfE21F272FdFDdf42851f6282c0f998756eEf27",
|
|
400
|
+
/** CL gauge factory */
|
|
401
|
+
clGaugeFactory: "0xF0361d1aD99971791C002E9c281B18739e9abad8",
|
|
402
|
+
/** CL gauge implementation */
|
|
403
|
+
clGauge: "0xB037CBbD1208fBc58D3cAc91a22E55D7727ac2BF",
|
|
404
|
+
/** CL pool implementation */
|
|
405
|
+
clPool: "0x751C0c219Ef28A96d6B3926b8247fe508C4277BC",
|
|
406
|
+
/** Custom swap fee module */
|
|
407
|
+
customSwapFeeModule: "0xd09DCeeB71bF20FE229E0dd5D739060efFB60e14",
|
|
408
|
+
/** Custom unstaked fee module */
|
|
409
|
+
customUnstakedFeeModule: "0x2F59EC82D990DdbE501b2B5E9796e3d5BB45438F",
|
|
410
|
+
/** Mixed-route quoter (v2 + CL paths) */
|
|
411
|
+
mixedRouteQuoterV1: "0x9dB89879fEB50fDeAa52EF9a1235BAC242E4Efc7",
|
|
412
|
+
/** NFT position manager for CL positions */
|
|
413
|
+
nonfungiblePositionManager: "0xa4890B89dC628baE614780079ACc951Fb0ECdC5F",
|
|
414
|
+
/** NFT position descriptor (metadata) */
|
|
415
|
+
nonfungibleTokenPositionDescriptor: "0x04113b91BF0F9D87d712f3CA843Fb1374AEE8A89",
|
|
416
|
+
/** Quoter V2 for CL swap quotes */
|
|
417
|
+
quoterV2: "0x9055782E3797231b970C067d067Ee7dFA3396Cdd",
|
|
418
|
+
/** CL swap router */
|
|
419
|
+
swapRouter: "0xAda5d0E79681038A9547fe6a59f1413F3E720839"
|
|
420
|
+
};
|
|
421
|
+
var ABOREAN_ADDRESSES = {
|
|
422
|
+
...ABOREAN_V2_ADDRESSES,
|
|
423
|
+
...ABOREAN_CL_ADDRESSES
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
// src/contracts/client.ts
|
|
427
|
+
import { http, createPublicClient, defineChain } from "viem";
|
|
428
|
+
var abstractMainnet = defineChain({
|
|
429
|
+
id: 2741,
|
|
430
|
+
name: "Abstract Mainnet",
|
|
431
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
432
|
+
rpcUrls: {
|
|
433
|
+
default: { http: ["https://api.mainnet.abs.xyz"] },
|
|
434
|
+
public: { http: ["https://api.mainnet.abs.xyz"] }
|
|
435
|
+
},
|
|
436
|
+
contracts: {
|
|
437
|
+
multicall3: {
|
|
438
|
+
address: "0xcA11bde05977b3631167028862bE2a173976CA11"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
function createAboreanPublicClient(rpcUrl) {
|
|
443
|
+
return createPublicClient({
|
|
444
|
+
chain: abstractMainnet,
|
|
445
|
+
transport: http(rpcUrl ?? process.env.ABSTRACT_RPC_URL ?? "https://api.mainnet.abs.xyz")
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// src/error-handling.ts
|
|
450
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
451
|
+
import { Errors } from "incur";
|
|
452
|
+
var VIEM_VERSION_PATTERN = /\n*Version:\s*viem@[^\n]+/i;
|
|
453
|
+
var VIEM_VERSION_PATTERN_GLOBAL = /\n*Version:\s*viem@[^\n]+/gi;
|
|
454
|
+
var debugFlagStore = new AsyncLocalStorage();
|
|
455
|
+
var VIEM_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
456
|
+
"CallExecutionError",
|
|
457
|
+
"ContractFunctionExecutionError",
|
|
458
|
+
"ContractFunctionRevertedError",
|
|
459
|
+
"HttpRequestError",
|
|
460
|
+
"InvalidAddressError",
|
|
461
|
+
"TransactionExecutionError"
|
|
462
|
+
]);
|
|
463
|
+
function parseDebugFlag(argv) {
|
|
464
|
+
const cleaned = [];
|
|
465
|
+
let debug = false;
|
|
466
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
467
|
+
const token = argv[i];
|
|
468
|
+
if (token === "--debug") {
|
|
469
|
+
debug = true;
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
if (token === "--debug=true" || token === "--debug=1") {
|
|
473
|
+
debug = true;
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
if (token === "--debug=false" || token === "--debug=0") {
|
|
477
|
+
debug = false;
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
cleaned.push(token);
|
|
481
|
+
}
|
|
482
|
+
return { argv: cleaned, debug };
|
|
483
|
+
}
|
|
484
|
+
function isViemLikeError(error) {
|
|
485
|
+
if (!(error instanceof Error)) return false;
|
|
486
|
+
const shortMessage = error.shortMessage;
|
|
487
|
+
return VIEM_ERROR_NAMES.has(error.name) || VIEM_VERSION_PATTERN.test(error.message) || typeof shortMessage === "string" && error.message.includes("Docs: https://viem.sh");
|
|
488
|
+
}
|
|
489
|
+
function sanitizeViemMessage(message) {
|
|
490
|
+
return message.replace(VIEM_VERSION_PATTERN_GLOBAL, "").trim();
|
|
491
|
+
}
|
|
492
|
+
function toFriendlyViemError(error) {
|
|
493
|
+
const shortMessage = typeof error.shortMessage === "string" && error.shortMessage.trim().length > 0 ? error.shortMessage.trim() : void 0;
|
|
494
|
+
if (error.name === "InvalidAddressError" || shortMessage?.startsWith('Address "')) {
|
|
495
|
+
return {
|
|
496
|
+
code: "INVALID_ADDRESS",
|
|
497
|
+
message: `${shortMessage ?? "Invalid address."} Use a valid 0x-prefixed 20-byte address. Run with --debug for full error details.`
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
if (shortMessage?.toLowerCase().includes("http request failed") || error.message.toLowerCase().includes("http request failed")) {
|
|
501
|
+
return {
|
|
502
|
+
code: "RPC_CONNECTION_FAILED",
|
|
503
|
+
message: "RPC connection failed. Check ABSTRACT_RPC_URL and try again. Run with --debug for full error details."
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
if (shortMessage || VIEM_VERSION_PATTERN.test(error.message)) {
|
|
507
|
+
return {
|
|
508
|
+
code: "UPSTREAM_ERROR",
|
|
509
|
+
message: `${sanitizeViemMessage(shortMessage ?? error.message)} Run with --debug for full error details.`
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
return void 0;
|
|
513
|
+
}
|
|
514
|
+
function isMissingRequiredArgValidation(error) {
|
|
515
|
+
return error.fieldErrors.some((fieldError) => {
|
|
516
|
+
const msg = fieldError.message.toLowerCase();
|
|
517
|
+
return msg.includes("received undefined") || fieldError.received === "";
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
function missingArgPaths(error) {
|
|
521
|
+
const paths = /* @__PURE__ */ new Set();
|
|
522
|
+
for (const fieldError of error.fieldErrors) {
|
|
523
|
+
const msg = fieldError.message.toLowerCase();
|
|
524
|
+
if (msg.includes("received undefined") || fieldError.received === "") {
|
|
525
|
+
paths.add(fieldError.path);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return [...paths];
|
|
529
|
+
}
|
|
530
|
+
function toFriendlyValidationError(ctx, error) {
|
|
531
|
+
const missing = missingArgPaths(error);
|
|
532
|
+
if (missing.length === 0) return void 0;
|
|
533
|
+
const helpCommand = `${ctx.name} ${ctx.command} --help`;
|
|
534
|
+
const argsList = missing.join(", ");
|
|
535
|
+
return {
|
|
536
|
+
code: "VALIDATION_ERROR",
|
|
537
|
+
cta: {
|
|
538
|
+
description: "See command usage:",
|
|
539
|
+
commands: [{ command: helpCommand }]
|
|
540
|
+
},
|
|
541
|
+
message: missing.length === 1 ? `Missing required argument: ${argsList}. Run \`${helpCommand}\` for usage.` : `Missing required arguments: ${argsList}. Run \`${helpCommand}\` for usage.`
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
function handleError(ctx, error) {
|
|
545
|
+
if (debugFlagStore.getStore()) throw error;
|
|
546
|
+
if (error instanceof Errors.ValidationError && isMissingRequiredArgValidation(error)) {
|
|
547
|
+
const friendly = toFriendlyValidationError(ctx, error);
|
|
548
|
+
if (friendly) {
|
|
549
|
+
return ctx.error(friendly);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (isViemLikeError(error)) {
|
|
553
|
+
const friendly = toFriendlyViemError(error);
|
|
554
|
+
if (friendly) {
|
|
555
|
+
return ctx.error(friendly);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
throw error;
|
|
559
|
+
}
|
|
560
|
+
function applyFriendlyErrorHandling(cli2) {
|
|
561
|
+
const originalServe = cli2.serve.bind(cli2);
|
|
562
|
+
cli2.serve = (async (argv, options) => {
|
|
563
|
+
const rawArgv = argv ?? process.argv.slice(2);
|
|
564
|
+
const parsed = parseDebugFlag(rawArgv);
|
|
565
|
+
return debugFlagStore.run(parsed.debug, () => originalServe(parsed.argv, options));
|
|
566
|
+
});
|
|
567
|
+
cli2.use(async (context, next) => {
|
|
568
|
+
try {
|
|
569
|
+
await next();
|
|
570
|
+
} catch (error) {
|
|
571
|
+
return handleError(context, error);
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// src/cli.ts
|
|
577
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
578
|
+
var pkg = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf8"));
|
|
579
|
+
var cli = Cli.create("aborean", {
|
|
580
|
+
version: pkg.version,
|
|
581
|
+
description: "Aborean Finance DEX CLI for Abstract chain."
|
|
582
|
+
});
|
|
583
|
+
var rootEnv = z.object({
|
|
584
|
+
ABSTRACT_RPC_URL: z.string().optional().describe("Abstract RPC URL override")
|
|
585
|
+
});
|
|
586
|
+
cli.command("status", {
|
|
587
|
+
description: "Get a cross-contract Aborean protocol snapshot (pool counts, gauge count, veABX supply).",
|
|
588
|
+
env: rootEnv,
|
|
589
|
+
output: z.object({
|
|
590
|
+
v2PoolCount: z.number().describe("Number of V2 AMM pools"),
|
|
591
|
+
clPoolCount: z.number().describe("Number of Slipstream (CL) pools"),
|
|
592
|
+
gaugeCount: z.number().describe("Number of pools with gauges"),
|
|
593
|
+
totalVotingWeight: z.string().describe("Total voting weight (wei)"),
|
|
594
|
+
veABXTotalSupply: z.string().describe("Total veABX supply (wei)"),
|
|
595
|
+
veABXLockedSupply: z.string().describe("Total ABX locked in VotingEscrow (wei)")
|
|
596
|
+
}),
|
|
597
|
+
examples: [{ description: "Fetch the current Aborean protocol status" }],
|
|
598
|
+
async run(c) {
|
|
599
|
+
const client = createAboreanPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
600
|
+
const [
|
|
601
|
+
v2PoolCount,
|
|
602
|
+
clPoolCount,
|
|
603
|
+
gaugeCount,
|
|
604
|
+
totalVotingWeight,
|
|
605
|
+
veABXTotalSupply,
|
|
606
|
+
veABXLockedSupply
|
|
607
|
+
] = await Promise.all([
|
|
608
|
+
client.readContract({
|
|
609
|
+
abi: poolFactoryAbi,
|
|
610
|
+
address: ABOREAN_V2_ADDRESSES.poolFactory,
|
|
611
|
+
functionName: "allPoolsLength"
|
|
612
|
+
}),
|
|
613
|
+
client.readContract({
|
|
614
|
+
abi: clFactoryAbi,
|
|
615
|
+
address: ABOREAN_CL_ADDRESSES.clFactory,
|
|
616
|
+
functionName: "allPoolsLength"
|
|
617
|
+
}),
|
|
618
|
+
client.readContract({
|
|
619
|
+
abi: voterAbi,
|
|
620
|
+
address: ABOREAN_V2_ADDRESSES.voter,
|
|
621
|
+
functionName: "length"
|
|
622
|
+
}),
|
|
623
|
+
client.readContract({
|
|
624
|
+
abi: voterAbi,
|
|
625
|
+
address: ABOREAN_V2_ADDRESSES.voter,
|
|
626
|
+
functionName: "totalWeight"
|
|
627
|
+
}),
|
|
628
|
+
client.readContract({
|
|
629
|
+
abi: votingEscrowAbi,
|
|
630
|
+
address: ABOREAN_V2_ADDRESSES.votingEscrow,
|
|
631
|
+
functionName: "totalSupply"
|
|
632
|
+
}),
|
|
633
|
+
client.readContract({
|
|
634
|
+
abi: votingEscrowAbi,
|
|
635
|
+
address: ABOREAN_V2_ADDRESSES.votingEscrow,
|
|
636
|
+
functionName: "supply"
|
|
637
|
+
})
|
|
638
|
+
]);
|
|
639
|
+
return c.ok({
|
|
640
|
+
v2PoolCount: Number(v2PoolCount),
|
|
641
|
+
clPoolCount: Number(clPoolCount),
|
|
642
|
+
gaugeCount: Number(gaugeCount),
|
|
643
|
+
totalVotingWeight: String(totalVotingWeight),
|
|
644
|
+
veABXTotalSupply: String(veABXTotalSupply),
|
|
645
|
+
veABXLockedSupply: String(veABXLockedSupply)
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
applyFriendlyErrorHandling(cli);
|
|
650
|
+
cli.serve();
|
|
651
|
+
export {
|
|
652
|
+
cli
|
|
653
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spectratools/aborean-cli",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "CLI for Aborean Finance DEX on Abstract (pools, swaps, gauges, voting escrow).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "spectra-the-bot",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"aborean",
|
|
10
|
+
"abstract",
|
|
11
|
+
"dex",
|
|
12
|
+
"amm",
|
|
13
|
+
"ve33",
|
|
14
|
+
"ethereum",
|
|
15
|
+
"web3",
|
|
16
|
+
"cli",
|
|
17
|
+
"incur",
|
|
18
|
+
"spectratools"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/spectra-the-bot/spectra-tools.git",
|
|
23
|
+
"directory": "packages/aborean"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/spectra-the-bot/spectra-tools/tree/main/packages/aborean#readme",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20"
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"aborean-cli": "./dist/cli.js"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"incur": "^0.2.2",
|
|
34
|
+
"ox": "^0.14.0",
|
|
35
|
+
"viem": "^2.47.0",
|
|
36
|
+
"@spectratools/cli-shared": "0.1.1"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"typescript": "5.7.3",
|
|
40
|
+
"vitest": "2.1.8"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"main": "./dist/cli.js",
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup",
|
|
49
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
50
|
+
"test": "vitest run"
|
|
51
|
+
}
|
|
52
|
+
}
|