@logswap/sdk 0.5.37 → 0.5.38
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/client.d.ts +1 -1
- package/dist/client.js +6 -3
- package/dist/fpool.d.ts +302 -73
- package/dist/fpool.js +104 -52
- package/dist/generated.d.ts +257 -46
- package/dist/generated.js +171 -25
- package/package.json +1 -1
- package/src/client.ts +6 -3
- package/src/fpool.ts +143 -68
- package/src/generated.ts +171 -25
package/src/fpool.ts
CHANGED
|
@@ -85,10 +85,14 @@ export interface FPoolState {
|
|
|
85
85
|
* The pad's promise. Pairs with a locked seed (shares at 0xdead) — the class is the two bits.
|
|
86
86
|
*/
|
|
87
87
|
lockStrike: boolean;
|
|
88
|
+
/** False before the first seed — and between a dissolve and the next one (decisions 032). */
|
|
88
89
|
seeded: boolean;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
/**
|
|
91
|
+
* The live GENERATION (decisions 032). Every dissolve retires one into a frozen bundle its
|
|
92
|
+
* shares redeem ({@link fPoolRedeem}) and opens the next; the share id carries it
|
|
93
|
+
* ({@link fPoolShareId}), so generations `0 … gen-1` are retired claims and `gen` is the pool.
|
|
94
|
+
*/
|
|
95
|
+
gen: number;
|
|
92
96
|
totalSupply: bigint;
|
|
93
97
|
/** What the pool holds of each base — the STATE since decisions 026; the mark `x` is derived from it. */
|
|
94
98
|
reserves: bigint[];
|
|
@@ -114,7 +118,7 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
|
|
|
114
118
|
authority: Address;
|
|
115
119
|
lockStrike: boolean;
|
|
116
120
|
seeded: boolean;
|
|
117
|
-
|
|
121
|
+
gen: number;
|
|
118
122
|
n: number;
|
|
119
123
|
restructureBlock: number;
|
|
120
124
|
gateMint: boolean;
|
|
@@ -130,7 +134,6 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
|
|
|
130
134
|
minBuffer: bigint;
|
|
131
135
|
incomeTaken: bigint;
|
|
132
136
|
name: Hex;
|
|
133
|
-
successor: Hex;
|
|
134
137
|
}>("getPool", [poolId]);
|
|
135
138
|
|
|
136
139
|
// A pool that was never created reads as an all-zero struct rather than reverting, so the
|
|
@@ -154,7 +157,7 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
|
|
|
154
157
|
const weights = legs.map((l) => l[1]);
|
|
155
158
|
const x = legs.map((l) => l[2]); // derived by the manager: x_j = ln(w_j·L / R_j) (decisions 026)
|
|
156
159
|
const reserves = legs.map((l) => l[3]); // the state
|
|
157
|
-
const { quote, Q, L, phi, theta0, bigSigma, authority, pendingAuthority, operator, minBuffer, gateMint, gateSwap, restructureBlock, lockStrike, seeded,
|
|
160
|
+
const { quote, Q, L, phi, theta0, bigSigma, authority, pendingAuthority, operator, minBuffer, gateMint, gateSwap, restructureBlock, lockStrike, seeded, gen } = p;
|
|
158
161
|
const totalSupply = p.shares;
|
|
159
162
|
|
|
160
163
|
return {
|
|
@@ -180,8 +183,7 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
|
|
|
180
183
|
restructureBlock: Number(restructureBlock),
|
|
181
184
|
lockStrike,
|
|
182
185
|
seeded,
|
|
183
|
-
|
|
184
|
-
successor,
|
|
186
|
+
gen: Number(gen),
|
|
185
187
|
totalSupply,
|
|
186
188
|
reserves,
|
|
187
189
|
};
|
|
@@ -371,18 +373,20 @@ export async function fPoolZapOut(
|
|
|
371
373
|
}
|
|
372
374
|
|
|
373
375
|
/**
|
|
374
|
-
* Roll a
|
|
375
|
-
* lock:
|
|
376
|
-
* back — buy through
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
376
|
+
* Roll a retired generation's bundle into the pool's live one (decisions 025, 032), on the
|
|
377
|
+
* router under one lock: redeem `shares` of generation `gen` in place — the legs, the quote and
|
|
378
|
+
* any unpulled dividend come back — buy through the pool's own curve only what the live
|
|
379
|
+
* generation's ratio lacks, mint `dL` of it to `to`, and refund the rest in kind. Quote the
|
|
380
|
+
* bundle does not cover is pulled from the payer, at most `maxQuoteIn`; surplus base is
|
|
381
|
+
* refunded, never sold. Size `dL` with {@link fPoolPreviewRollIn}. The router must be the
|
|
382
|
+
* caller's ERC-6909 operator ({@link approveRouterForFPool}).
|
|
380
383
|
*/
|
|
381
384
|
export async function fPoolRollIn(
|
|
382
385
|
c: LogswapClient,
|
|
383
386
|
a: {
|
|
384
|
-
|
|
385
|
-
|
|
387
|
+
poolId: Hex;
|
|
388
|
+
/** the retired generation whose shares roll */
|
|
389
|
+
gen: bigint | number;
|
|
386
390
|
shares: bigint;
|
|
387
391
|
dL: bigint;
|
|
388
392
|
maxQuoteIn?: bigint;
|
|
@@ -396,22 +400,23 @@ export async function fPoolRollIn(
|
|
|
396
400
|
return writeRouter(
|
|
397
401
|
c,
|
|
398
402
|
"rollIn",
|
|
399
|
-
[a.
|
|
403
|
+
[a.poolId, BigInt(a.gen), a.shares, a.dL, a.maxQuoteIn ?? 0n, a.minShares ?? 0n, to, a.deadline ?? defaultDeadline()],
|
|
400
404
|
a.account,
|
|
401
405
|
);
|
|
402
406
|
}
|
|
403
407
|
|
|
404
408
|
/**
|
|
405
|
-
* The roll `holder`'s `shares` of `
|
|
406
|
-
* the bundle's base covers on every
|
|
407
|
-
* as `maxQuoteIn`) or over (refunded — the up direction's distribution) at
|
|
408
|
-
*
|
|
409
|
-
* with `previewZapIn` in mind.
|
|
409
|
+
* The roll `holder`'s `shares` of retired generation `gen` fund into the live one WITHOUT a
|
|
410
|
+
* trade: the largest `dL` the bundle's base covers on every leg, and the quote the bundle is
|
|
411
|
+
* short of (pass it as `maxQuoteIn`) or over (refunded — the up direction's distribution) at
|
|
412
|
+
* that `dL`. A leg the live generation admitted since makes `dL` zero: such a roll must buy, so
|
|
413
|
+
* size it below with `previewZapIn` in mind. Zero for the live generation, or before the next
|
|
414
|
+
* seed.
|
|
410
415
|
*/
|
|
411
416
|
export async function fPoolPreviewRollIn(
|
|
412
417
|
c: LogswapClient,
|
|
413
|
-
|
|
414
|
-
|
|
418
|
+
poolId: Hex,
|
|
419
|
+
gen: bigint | number,
|
|
415
420
|
holder: Address,
|
|
416
421
|
shares: bigint,
|
|
417
422
|
): Promise<{ dL: bigint; quoteShort: bigint; quoteExcess: bigint }> {
|
|
@@ -420,7 +425,7 @@ export async function fPoolPreviewRollIn(
|
|
|
420
425
|
address: c.addresses.lens,
|
|
421
426
|
abi: logswapLensAbi,
|
|
422
427
|
functionName: "previewRollIn",
|
|
423
|
-
args: [
|
|
428
|
+
args: [poolId, BigInt(gen), holder, shares],
|
|
424
429
|
} as never)) as readonly [bigint, bigint, bigint];
|
|
425
430
|
return { dL, quoteShort, quoteExcess };
|
|
426
431
|
}
|
|
@@ -438,18 +443,24 @@ export async function fPoolHarvest(c: LogswapClient, a: { poolId: Hex; amount: b
|
|
|
438
443
|
return writeFPool(c, a.poolId, "harvest", [a.amount, a.to ?? a.account], a.account);
|
|
439
444
|
}
|
|
440
445
|
|
|
441
|
-
/**
|
|
442
|
-
|
|
443
|
-
|
|
446
|
+
/**
|
|
447
|
+
* Pull one's settled dividend (decisions 028) on a generation's shares without moving them;
|
|
448
|
+
* anyone with shares. `gen` defaults to the live generation; a retired generation's harvests
|
|
449
|
+
* stay claimable under its own id (decisions 032).
|
|
450
|
+
*/
|
|
451
|
+
export async function fPoolClaim(c: LogswapClient, a: { poolId: Hex; gen?: bigint | number; to?: Address; account: Address }) {
|
|
452
|
+
const gen = a.gen ?? (await fPoolGen(c, a.poolId));
|
|
453
|
+
return writeFPool(c, a.poolId, "claim", [BigInt(gen), a.to ?? a.account], a.account);
|
|
444
454
|
}
|
|
445
455
|
|
|
446
|
-
/** A holder's dividend as of now — banked plus pending on the current balance (decisions 028). */
|
|
447
|
-
export async function fPoolDividendOf(c: LogswapClient, poolId: Hex, holder: Address): Promise<bigint> {
|
|
456
|
+
/** A holder's dividend as of now on generation `gen` (the live one by default) — banked plus pending on the current balance (decisions 028). */
|
|
457
|
+
export async function fPoolDividendOf(c: LogswapClient, poolId: Hex, holder: Address, gen?: bigint | number): Promise<bigint> {
|
|
458
|
+
const g = gen ?? (await fPoolGen(c, poolId));
|
|
448
459
|
return c.public.readContract({
|
|
449
460
|
address: c.addresses.fPoolManager!,
|
|
450
461
|
abi: fPoolManagerAbi,
|
|
451
462
|
functionName: "dividendOf",
|
|
452
|
-
args: [poolId, holder],
|
|
463
|
+
args: [poolId, BigInt(g), holder],
|
|
453
464
|
} as never) as Promise<bigint>;
|
|
454
465
|
}
|
|
455
466
|
|
|
@@ -598,9 +609,29 @@ export async function approveRouterForFPool(c: LogswapClient, account: Address)
|
|
|
598
609
|
// than read from the chain: it is pure, and a client that has to call to learn an id cannot build
|
|
599
610
|
// a multicall that uses it.
|
|
600
611
|
|
|
601
|
-
/**
|
|
602
|
-
|
|
603
|
-
|
|
612
|
+
/**
|
|
613
|
+
* The ERC-6909 id carrying generation `gen` of a pool's shares (decisions 032): bit 255 set (the
|
|
614
|
+
* share flag), the pool id's top 239 bits, the generation in the low 16. Each generation's shares
|
|
615
|
+
* are their own asset — a retired one is a claim on its bundle, the live one on the pool.
|
|
616
|
+
*/
|
|
617
|
+
export function fPoolShareId(poolId: Hex, gen: bigint | number = 0n): bigint {
|
|
618
|
+
return (1n << 255n) | ((BigInt(poolId) >> 17n) << 16n) | BigInt(gen);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** The generation a share id carries — its low 16 bits. */
|
|
622
|
+
export function fPoolGenOfShareId(id: bigint): number {
|
|
623
|
+
return Number(id & 0xffffn);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/** The pool's live generation, one read. */
|
|
627
|
+
export async function fPoolGen(c: LogswapClient, poolId: Hex): Promise<number> {
|
|
628
|
+
const p = (await c.public.readContract({
|
|
629
|
+
address: c.addresses.fPoolManager!,
|
|
630
|
+
abi: fPoolManagerAbi,
|
|
631
|
+
functionName: "getPool",
|
|
632
|
+
args: [poolId],
|
|
633
|
+
} as never)) as { gen: number };
|
|
634
|
+
return Number(p.gen);
|
|
604
635
|
}
|
|
605
636
|
|
|
606
637
|
/** The ERC-6909 id carrying claims on a token. Bit 255 clear, so it can never meet a share id. */
|
|
@@ -608,15 +639,65 @@ export function fPoolClaimId(token: Address): bigint {
|
|
|
608
639
|
return BigInt(token);
|
|
609
640
|
}
|
|
610
641
|
|
|
611
|
-
|
|
642
|
+
/** A holder's shares of generation `gen` — the live one by default. */
|
|
643
|
+
export async function fPoolShareBalance(c: LogswapClient, poolId: Hex, owner: Address, gen?: bigint | number): Promise<bigint> {
|
|
644
|
+
const g = gen ?? (await fPoolGen(c, poolId));
|
|
612
645
|
return c.public.readContract({
|
|
613
646
|
address: c.addresses.fPoolManager!,
|
|
614
647
|
abi: fPoolManagerAbi,
|
|
615
648
|
functionName: "balanceOf",
|
|
616
|
-
args: [owner, fPoolShareId(poolId)],
|
|
649
|
+
args: [owner, fPoolShareId(poolId, g)],
|
|
617
650
|
} as never) as Promise<bigint>;
|
|
618
651
|
}
|
|
619
652
|
|
|
653
|
+
/** A retired generation's bundle (decisions 032): what is left to redeem — supply, quote, base per leg index. */
|
|
654
|
+
export async function fPoolBundleOf(
|
|
655
|
+
c: LogswapClient,
|
|
656
|
+
poolId: Hex,
|
|
657
|
+
gen: bigint | number,
|
|
658
|
+
): Promise<{ supply: bigint; quote: bigint; base: bigint[] }> {
|
|
659
|
+
const [supply, quote, base] = (await c.public.readContract({
|
|
660
|
+
address: c.addresses.fPoolManager!,
|
|
661
|
+
abi: fPoolManagerAbi,
|
|
662
|
+
functionName: "bundleOf",
|
|
663
|
+
args: [poolId, BigInt(gen)],
|
|
664
|
+
} as never)) as readonly [bigint, bigint, readonly bigint[]];
|
|
665
|
+
return { supply, quote, base: [...base] };
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/** A holder's claim on one retired generation, as the lens reports it: what `redeem` pays now. */
|
|
669
|
+
export interface FPoolClaimRow {
|
|
670
|
+
gen: number;
|
|
671
|
+
shares: bigint;
|
|
672
|
+
base: bigint[];
|
|
673
|
+
quote: bigint;
|
|
674
|
+
dividend: bigint;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/** A holder's claims on a pool's retired generations — one row per generation still held (decisions 032). */
|
|
678
|
+
export async function fPoolClaimsOf(c: LogswapClient, poolId: Hex, owner: Address): Promise<FPoolClaimRow[]> {
|
|
679
|
+
const { logswapLensAbi } = await import("./generated.js");
|
|
680
|
+
const rows = (await c.public.readContract({
|
|
681
|
+
address: c.addresses.lens,
|
|
682
|
+
abi: logswapLensAbi,
|
|
683
|
+
functionName: "fClaimsOf",
|
|
684
|
+
args: [poolId, owner],
|
|
685
|
+
} as never)) as readonly { gen: bigint; shares: bigint; base: readonly bigint[]; quote: bigint; dividend: bigint }[];
|
|
686
|
+
return rows.map((r) => ({ gen: Number(r.gen), shares: r.shares, base: [...r.base], quote: r.quote, dividend: r.dividend }));
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Redeem `shares` of a RETIRED generation (decisions 032): its bundle, pro rata — the base per
|
|
691
|
+
* leg and the quote — plus the owner's settled dividend. Not `burn`: nothing can move a bundle's
|
|
692
|
+
* ratio, so there is no slippage to bound. The owner, or an operator of theirs.
|
|
693
|
+
*/
|
|
694
|
+
export async function fPoolRedeem(
|
|
695
|
+
c: LogswapClient,
|
|
696
|
+
a: { poolId: Hex; gen: bigint | number; shares: bigint; owner?: Address; account: Address },
|
|
697
|
+
) {
|
|
698
|
+
return writeFPool(c, a.poolId, "redeem", [BigInt(a.gen), a.owner ?? a.account, a.shares], a.account);
|
|
699
|
+
}
|
|
700
|
+
|
|
620
701
|
export async function fPoolClaimBalance(c: LogswapClient, token: Address, owner: Address): Promise<bigint> {
|
|
621
702
|
return c.public.readContract({
|
|
622
703
|
address: c.addresses.fPoolManager!,
|
|
@@ -796,51 +877,44 @@ export async function fPoolSeed(
|
|
|
796
877
|
}
|
|
797
878
|
|
|
798
879
|
/**
|
|
799
|
-
*
|
|
800
|
-
* and on a pool that is not strike-locked at any Q
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
880
|
+
* Retire the live generation (decisions 025, 032). Allowed at Q ≤ L/1e9 on every pool — the
|
|
881
|
+
* market filled the ask — and on a pool that is not strike-locked at any Q. The live (S, Q, R_j)
|
|
882
|
+
* become a frozen bundle every share of this generation redeems ({@link fPoolRedeem}) or rolls
|
|
883
|
+
* ({@link fPoolRollIn}), forever; the pool is unseeded until the next {@link fPoolSeed}, which
|
|
884
|
+
* opens generation `gen + 1` under the same id, gates, lists and promises.
|
|
804
885
|
*/
|
|
805
|
-
export async function fPoolDissolve(c: LogswapClient, a: { poolId: Hex;
|
|
806
|
-
return writeFPool(c, a.poolId, "dissolve", [
|
|
886
|
+
export async function fPoolDissolve(c: LogswapClient, a: { poolId: Hex; account: Address }) {
|
|
887
|
+
return writeFPool(c, a.poolId, "dissolve", [], a.account);
|
|
807
888
|
}
|
|
808
889
|
|
|
809
890
|
/**
|
|
810
|
-
* The sponsor's relaunch as ONE transaction (decisions 025): `
|
|
811
|
-
* `
|
|
812
|
-
* came back — the manager's `multicall`, the sponsor as sender throughout
|
|
813
|
-
* operator,
|
|
814
|
-
* against {@link fPoolManagerAbi}.
|
|
815
|
-
*
|
|
891
|
+
* The sponsor's relaunch as ONE transaction (decisions 025, 032): `dissolve` the live generation,
|
|
892
|
+
* `redeem` the sponsor's own shares of it (when `shares` > 0), `seed` the next generation with
|
|
893
|
+
* what came back — the manager's `multicall`, the sponsor as sender throughout, the same pool.
|
|
894
|
+
* Gates, allowlist, operator, `minBuffer` and names carry over; anything else goes in `extra`,
|
|
895
|
+
* pre-encoded against {@link fPoolManagerAbi}. The seed names reserves (decisions 029): `r0`
|
|
896
|
+
* outright, or `x0` marks against the key's `weights`.
|
|
816
897
|
*/
|
|
817
898
|
export async function fPoolRelaunch(
|
|
818
899
|
c: LogswapClient,
|
|
819
900
|
a: {
|
|
820
901
|
poolId: Hex;
|
|
821
|
-
|
|
822
|
-
/** the sponsor's old shares to burn — its whole balance, usually */
|
|
902
|
+
/** the sponsor's shares of the retiring generation to redeem inside the batch — its whole balance, usually; 0 to keep the claim */
|
|
823
903
|
shares: bigint;
|
|
824
904
|
L0: bigint;
|
|
825
905
|
Q0: bigint;
|
|
826
|
-
r0: bigint[];
|
|
827
906
|
extra?: Hex[];
|
|
828
907
|
account: Address;
|
|
829
|
-
},
|
|
908
|
+
} & ({ r0: bigint[] } | { x0: bigint[]; weights: bigint[] }),
|
|
830
909
|
) {
|
|
831
|
-
const
|
|
832
|
-
const
|
|
833
|
-
quote: a.nextKey.quote, bases, weights: companions[0]!, phi: a.nextKey.phi, lockStrike: a.nextKey.lockStrike,
|
|
834
|
-
authority: a.nextKey.authority, salt: a.nextKey.salt ?? ZERO_SALT,
|
|
835
|
-
};
|
|
836
|
-
const next = await fPoolIdOf(c, a.nextKey);
|
|
910
|
+
const gen = await fPoolGen(c, a.poolId);
|
|
911
|
+
const r0 = "r0" in a ? a.r0 : a.x0.map((x, j) => fPoolReserveAt((a.weights[j]! * a.L0) / WAD, x));
|
|
837
912
|
const enc = (functionName: string, args: unknown[]) =>
|
|
838
913
|
encodeFunctionData({ abi: fPoolManagerAbi, functionName, args } as never) as Hex;
|
|
839
914
|
const calls: Hex[] = [
|
|
840
|
-
enc("
|
|
841
|
-
enc("
|
|
842
|
-
enc("
|
|
843
|
-
enc("seed", [next, a.L0, a.r0, a.Q0]),
|
|
915
|
+
enc("dissolve", [a.poolId]),
|
|
916
|
+
...(a.shares > 0n ? [enc("redeem", [a.poolId, BigInt(gen), a.account, a.shares])] : []),
|
|
917
|
+
enc("seed", [a.poolId, a.L0, r0, a.Q0]),
|
|
844
918
|
...(a.extra ?? []),
|
|
845
919
|
];
|
|
846
920
|
return writeFPool0(c, "multicall", [calls], a.account);
|
|
@@ -962,14 +1036,15 @@ export async function fPoolAdmitLeg(
|
|
|
962
1036
|
*/
|
|
963
1037
|
export async function fPoolTransferShares(
|
|
964
1038
|
c: LogswapClient,
|
|
965
|
-
a: { poolId: Hex; to: Address; shares: bigint; account: Address },
|
|
1039
|
+
a: { poolId: Hex; to: Address; shares: bigint; account: Address; gen?: bigint | number },
|
|
966
1040
|
) {
|
|
967
1041
|
const wallet = requireWallet(c);
|
|
1042
|
+
const gen = a.gen ?? (await fPoolGen(c, a.poolId));
|
|
968
1043
|
const { request } = await c.public.simulateContract({
|
|
969
1044
|
address: c.addresses.fPoolManager!,
|
|
970
1045
|
abi: fPoolManagerAbi,
|
|
971
1046
|
functionName: "transfer",
|
|
972
|
-
args: [a.to, fPoolShareId(a.poolId), a.shares],
|
|
1047
|
+
args: [a.to, fPoolShareId(a.poolId, gen), a.shares],
|
|
973
1048
|
account: a.account,
|
|
974
1049
|
} as never);
|
|
975
1050
|
return wallet.writeContract(request as never);
|
|
@@ -1061,12 +1136,12 @@ export async function discoverFPools(
|
|
|
1061
1136
|
export async function fPoolShareHolders(
|
|
1062
1137
|
c: LogswapClient,
|
|
1063
1138
|
poolIdHex: Hex,
|
|
1064
|
-
opts: { fromBlock?: bigint } = {},
|
|
1139
|
+
opts: { fromBlock?: bigint; gen?: bigint | number } = {},
|
|
1065
1140
|
): Promise<Array<{ holder: Address; shares: bigint }>> {
|
|
1066
1141
|
type Ev = Extract<(typeof fPoolManagerAbi)[number], { type: "event"; name: "Transfer" }>;
|
|
1067
1142
|
const ev = fPoolManagerAbi.find((x): x is Ev => x.type === "event" && x.name === "Transfer");
|
|
1068
1143
|
if (!ev) throw new Error("logswap: 6909 Transfer event missing from the generated ABI");
|
|
1069
|
-
const id = fPoolShareId(poolIdHex);
|
|
1144
|
+
const id = fPoolShareId(poolIdHex, opts.gen ?? (await fPoolGen(c, poolIdHex)));
|
|
1070
1145
|
const logs = await c.public.getLogs({
|
|
1071
1146
|
address: c.addresses.fPoolManager!,
|
|
1072
1147
|
event: ev,
|
|
@@ -1086,7 +1161,7 @@ export async function fPoolShareHolders(
|
|
|
1086
1161
|
.sort((a, b) => (b.shares > a.shares ? 1 : -1));
|
|
1087
1162
|
}
|
|
1088
1163
|
|
|
1089
|
-
/** Every F pool's state in one lens call (the raw manager struct: quote, phi, authority, lockStrike, seeded,
|
|
1164
|
+
/** Every F pool's state in one lens call (the raw manager struct: quote, phi, authority, lockStrike, seeded, gen, n, Q, L, shares, theta0, bigSigma, leverTheta). */
|
|
1090
1165
|
export async function getFPoolsRaw(c: LogswapClient, poolIds: Hex[]): Promise<readonly unknown[]> {
|
|
1091
1166
|
const { logswapLensAbi } = await import("./generated.js");
|
|
1092
1167
|
return (await c.public.readContract({ address: c.addresses.lens, abi: logswapLensAbi, functionName: "getFPools", args: [poolIds] } as never)) as readonly unknown[];
|