@spectratools/aborean-cli 0.10.2 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +157 -148
- package/dist/index.js +6646 -0
- package/package.json +9 -3
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,11 @@ import { readFileSync } from "fs";
|
|
|
5
5
|
import { dirname, resolve } from "path";
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
7
|
import { checksumAddress as checksumAddress6 } from "@spectratools/cli-shared";
|
|
8
|
+
import {
|
|
9
|
+
initTelemetry,
|
|
10
|
+
shutdownTelemetry,
|
|
11
|
+
withCommandSpan
|
|
12
|
+
} from "@spectratools/cli-shared/telemetry";
|
|
8
13
|
import { Cli as Cli8, z as z9 } from "incur";
|
|
9
14
|
import { formatUnits as formatUnits4 } from "viem";
|
|
10
15
|
|
|
@@ -6478,159 +6483,163 @@ cli.command("status", {
|
|
|
6478
6483
|
}),
|
|
6479
6484
|
examples: [{ description: "Fetch the current Aborean protocol status" }],
|
|
6480
6485
|
async run(c) {
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6486
|
+
return withCommandSpan("aborean status", {}, async () => {
|
|
6487
|
+
const client = createAboreanPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
6488
|
+
const [
|
|
6489
|
+
v2PoolCount,
|
|
6490
|
+
clPoolCount,
|
|
6491
|
+
gaugeCount,
|
|
6492
|
+
totalVotingWeight,
|
|
6493
|
+
veABXTotalSupply,
|
|
6494
|
+
veABXLockedSupply,
|
|
6495
|
+
activePeriod,
|
|
6496
|
+
weekSeconds,
|
|
6497
|
+
epochCount,
|
|
6498
|
+
weeklyEmission,
|
|
6499
|
+
v2PoolSnapshot
|
|
6500
|
+
] = await Promise.all([
|
|
6501
|
+
client.readContract({
|
|
6502
|
+
abi: poolFactoryAbi,
|
|
6503
|
+
address: ABOREAN_V2_ADDRESSES.poolFactory,
|
|
6504
|
+
functionName: "allPoolsLength"
|
|
6505
|
+
}),
|
|
6506
|
+
client.readContract({
|
|
6507
|
+
abi: clFactoryAbi,
|
|
6508
|
+
address: ABOREAN_CL_ADDRESSES.clFactory,
|
|
6509
|
+
functionName: "allPoolsLength"
|
|
6510
|
+
}),
|
|
6511
|
+
client.readContract({
|
|
6512
|
+
abi: voterAbi,
|
|
6513
|
+
address: ABOREAN_V2_ADDRESSES.voter,
|
|
6514
|
+
functionName: "length"
|
|
6515
|
+
}),
|
|
6516
|
+
client.readContract({
|
|
6517
|
+
abi: voterAbi,
|
|
6518
|
+
address: ABOREAN_V2_ADDRESSES.voter,
|
|
6519
|
+
functionName: "totalWeight"
|
|
6520
|
+
}),
|
|
6521
|
+
client.readContract({
|
|
6522
|
+
abi: votingEscrowAbi,
|
|
6523
|
+
address: ABOREAN_V2_ADDRESSES.votingEscrow,
|
|
6524
|
+
functionName: "totalSupply"
|
|
6525
|
+
}),
|
|
6526
|
+
client.readContract({
|
|
6527
|
+
abi: votingEscrowAbi,
|
|
6528
|
+
address: ABOREAN_V2_ADDRESSES.votingEscrow,
|
|
6529
|
+
functionName: "supply"
|
|
6530
|
+
}),
|
|
6531
|
+
client.readContract({
|
|
6532
|
+
abi: minterAbi,
|
|
6533
|
+
address: ABOREAN_V2_ADDRESSES.minter,
|
|
6534
|
+
functionName: "activePeriod"
|
|
6535
|
+
}),
|
|
6536
|
+
client.readContract({
|
|
6537
|
+
abi: minterAbi,
|
|
6538
|
+
address: ABOREAN_V2_ADDRESSES.minter,
|
|
6539
|
+
functionName: "WEEK"
|
|
6540
|
+
}),
|
|
6541
|
+
client.readContract({
|
|
6542
|
+
abi: minterAbi,
|
|
6543
|
+
address: ABOREAN_V2_ADDRESSES.minter,
|
|
6544
|
+
functionName: "epochCount"
|
|
6545
|
+
}),
|
|
6546
|
+
client.readContract({
|
|
6547
|
+
abi: minterAbi,
|
|
6548
|
+
address: ABOREAN_V2_ADDRESSES.minter,
|
|
6549
|
+
functionName: "weekly"
|
|
6550
|
+
}),
|
|
6551
|
+
readTopV2PoolsSnapshot(client, 5)
|
|
6552
|
+
]);
|
|
6553
|
+
let vaultRelayCount = 0;
|
|
6554
|
+
let vaultManagedVotingPower = "0";
|
|
6555
|
+
let vaultNote = null;
|
|
6556
|
+
try {
|
|
6557
|
+
const vaultSnapshot = await readVaultSummary(client);
|
|
6558
|
+
vaultRelayCount = vaultSnapshot.relayCount;
|
|
6559
|
+
vaultManagedVotingPower = vaultSnapshot.totals.managedVotingPower;
|
|
6560
|
+
} catch (error) {
|
|
6561
|
+
vaultNote = error instanceof Error ? error.message : "vault snapshot unavailable";
|
|
6562
|
+
}
|
|
6563
|
+
let lendingAvailable = false;
|
|
6564
|
+
let lendingMarketCount = 0;
|
|
6565
|
+
let lendingMorpho = "";
|
|
6566
|
+
let lendingSupplyByLoanToken = [];
|
|
6567
|
+
let lendingNote = null;
|
|
6568
|
+
try {
|
|
6569
|
+
const lendingSnapshot = await readLendingSummary(client);
|
|
6570
|
+
lendingAvailable = lendingSnapshot.available;
|
|
6571
|
+
lendingMarketCount = lendingSnapshot.marketCount;
|
|
6572
|
+
lendingMorpho = lendingSnapshot.morpho;
|
|
6573
|
+
lendingSupplyByLoanToken = lendingSnapshot.supplyByLoanToken;
|
|
6574
|
+
} catch (error) {
|
|
6575
|
+
lendingMorpho = "";
|
|
6576
|
+
lendingNote = error instanceof Error ? error.message : "lending snapshot unavailable";
|
|
6577
|
+
}
|
|
6578
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
6579
|
+
const epochEnd = Number(activePeriod) + Number(weekSeconds);
|
|
6580
|
+
return c.ok(
|
|
6581
|
+
{
|
|
6582
|
+
v2PoolCount: Number(v2PoolCount),
|
|
6583
|
+
clPoolCount: Number(clPoolCount),
|
|
6584
|
+
gaugeCount: Number(gaugeCount),
|
|
6585
|
+
totalVotingWeight: String(totalVotingWeight),
|
|
6586
|
+
veABXTotalSupply: String(veABXTotalSupply),
|
|
6587
|
+
veABXLockedSupply: String(veABXLockedSupply),
|
|
6588
|
+
epoch: {
|
|
6589
|
+
activePeriod: Number(activePeriod),
|
|
6590
|
+
epochEnd,
|
|
6591
|
+
secondsRemaining: Math.max(0, epochEnd - now),
|
|
6592
|
+
epochCount: Number(epochCount),
|
|
6593
|
+
weeklyEmission: String(weeklyEmission)
|
|
6594
|
+
},
|
|
6595
|
+
topPools: v2PoolSnapshot.topPools,
|
|
6596
|
+
tvl: {
|
|
6597
|
+
v2ReserveUnitEstimate: v2PoolSnapshot.reserveUnitTvl,
|
|
6598
|
+
vaultManagedVotingPower
|
|
6599
|
+
},
|
|
6600
|
+
vaults: {
|
|
6601
|
+
relayCount: vaultRelayCount,
|
|
6602
|
+
managedVotingPower: vaultManagedVotingPower,
|
|
6603
|
+
note: vaultNote
|
|
6604
|
+
},
|
|
6605
|
+
lending: {
|
|
6606
|
+
available: lendingAvailable,
|
|
6607
|
+
morpho: lendingMorpho,
|
|
6608
|
+
marketCount: lendingMarketCount,
|
|
6609
|
+
supplyByLoanToken: lendingSupplyByLoanToken,
|
|
6610
|
+
note: lendingNote
|
|
6611
|
+
}
|
|
6598
6612
|
},
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
description: "List active gauges"
|
|
6622
|
-
},
|
|
6623
|
-
{
|
|
6624
|
-
command: "ve stats",
|
|
6625
|
-
description: "View veABX global stats"
|
|
6626
|
-
}
|
|
6627
|
-
]
|
|
6613
|
+
c.format === "json" || c.format === "jsonl" ? void 0 : {
|
|
6614
|
+
cta: {
|
|
6615
|
+
description: "Drill down:",
|
|
6616
|
+
commands: [
|
|
6617
|
+
{
|
|
6618
|
+
command: "pools list",
|
|
6619
|
+
description: "List V2 AMM pools"
|
|
6620
|
+
},
|
|
6621
|
+
{
|
|
6622
|
+
command: "cl pools",
|
|
6623
|
+
description: "List Slipstream CL pools"
|
|
6624
|
+
},
|
|
6625
|
+
{
|
|
6626
|
+
command: "gauges list",
|
|
6627
|
+
description: "List active gauges"
|
|
6628
|
+
},
|
|
6629
|
+
{
|
|
6630
|
+
command: "ve stats",
|
|
6631
|
+
description: "View veABX global stats"
|
|
6632
|
+
}
|
|
6633
|
+
]
|
|
6634
|
+
}
|
|
6628
6635
|
}
|
|
6629
|
-
|
|
6630
|
-
);
|
|
6636
|
+
);
|
|
6637
|
+
});
|
|
6631
6638
|
}
|
|
6632
6639
|
});
|
|
6633
6640
|
applyFriendlyErrorHandling(cli);
|
|
6641
|
+
initTelemetry("aborean");
|
|
6642
|
+
process.on("beforeExit", () => shutdownTelemetry());
|
|
6634
6643
|
cli.serve();
|
|
6635
6644
|
export {
|
|
6636
6645
|
cli
|