@logswap/sdk 0.5.78 → 0.5.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/admin.d.ts +702 -51
- package/dist/admin.js +53 -46
- package/dist/client.d.ts +2 -2
- package/dist/client.js +4 -2
- package/dist/fpool.d.ts +185 -119
- package/dist/fpool.js +41 -42
- package/dist/generated.d.ts +1376 -700
- package/dist/generated.js +853 -472
- package/dist/history.d.ts +1 -2
- package/dist/history.js +3 -5
- package/dist/indexer.js +2 -1
- package/dist/keys.d.ts +6 -0
- package/dist/keys.js +2 -0
- package/dist/pools.d.ts +3 -3
- package/dist/pools.js +2 -1
- package/package.json +1 -1
- package/src/admin.ts +64 -54
- package/src/client.ts +4 -2
- package/src/fpool.ts +59 -55
- package/src/generated.ts +853 -472
- package/src/history.ts +3 -4
- package/src/indexer.ts +3 -2
- package/src/keys.ts +8 -0
- package/src/pools.ts +6 -5
package/dist/history.d.ts
CHANGED
|
@@ -63,8 +63,7 @@ export declare function getEventLogs<A = Record<string, unknown>>(c: LogswapClie
|
|
|
63
63
|
source: "indexer" | "chain";
|
|
64
64
|
}>;
|
|
65
65
|
/**
|
|
66
|
-
* A policy's name in the indexer for one of its events: `Policy
|
|
67
|
-
* two-signature `Listed`. Pass it as {@link EventLogsQuery.contract} for a policy outside the artifact.
|
|
66
|
+
* A policy's name in the indexer for one of its events: `Policy`. Pass it as {@link EventLogsQuery.contract} for a policy outside the artifact.
|
|
68
67
|
*/
|
|
69
68
|
export declare function indexedContractOf(kind: FPoolKind, event: string): string;
|
|
70
69
|
export declare function tableFor(c: LogswapClient, address: Address, event: string, contract?: string): {
|
package/dist/history.js
CHANGED
|
@@ -64,17 +64,15 @@ function contractName(c, address, event) {
|
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* A policy's name in the indexer for one of its events: `Policy
|
|
68
|
-
* two-signature `Listed`. Pass it as {@link EventLogsQuery.contract} for a policy outside the artifact.
|
|
67
|
+
* A policy's name in the indexer for one of its events: `Policy`. Pass it as {@link EventLogsQuery.contract} for a policy outside the artifact.
|
|
69
68
|
*/
|
|
70
69
|
export function indexedContractOf(kind, event) {
|
|
71
|
-
|
|
72
|
-
return kind === "private" ? "PrivatePolicy" : "PublicPolicy";
|
|
70
|
+
void kind; // `Listed` was the public and the private policy's since 064; the public policy dropped its asset list in F 33 (073), so it is unshared
|
|
73
71
|
return "Policy";
|
|
74
72
|
}
|
|
75
73
|
/** Events whose name two indexed contracts share: postgraphile prefixes their tables. */
|
|
76
74
|
// `CollectorProposed` / `CollectorAccepted` are C 7 / F 26 and older; `TreasuryProposed` / `TreasuryAccepted` replace them (066).
|
|
77
|
-
const SHARED = new Set(["Swap", "Transfer", "Approval", "OperatorSet", "CollectorProposed", "CollectorAccepted", "TreasuryProposed", "TreasuryAccepted", "Approved"
|
|
75
|
+
const SHARED = new Set(["Swap", "Transfer", "Approval", "OperatorSet", "CollectorProposed", "CollectorAccepted", "TreasuryProposed", "TreasuryAccepted", "Approved"]);
|
|
78
76
|
const plural = (n) => (/(s|x|ch|sh)$/.test(n) ? `${n}es` : `${n}s`);
|
|
79
77
|
/** A column's GraphQL name: postgraphile camelCases the snake_case rindexer writes (`F` → `f`). */
|
|
80
78
|
const column = (name) => name[0].toLowerCase() + name.slice(1);
|
package/dist/indexer.js
CHANGED
|
@@ -138,12 +138,13 @@ export async function indexerHealthy(url, signal) {
|
|
|
138
138
|
* everywhere else, so a wrong id fails loudly instead of addressing the wrong pool.
|
|
139
139
|
*/
|
|
140
140
|
export async function discoverMarketsIndexed(url, signal) {
|
|
141
|
-
const nodes = await gqlAll(url, "allMarketCreateds", "poolId base quote tickSpacing swapFee x0 blockNumber txHash contractAddress", { signal });
|
|
141
|
+
const nodes = await gqlAll(url, "allMarketCreateds", "poolId base quote tickSpacing swapFee policy x0 blockNumber txHash contractAddress", { signal });
|
|
142
142
|
return nodes.map((n) => {
|
|
143
143
|
const key = {
|
|
144
144
|
base: n.base,
|
|
145
145
|
quote: n.quote,
|
|
146
146
|
tickSpacing: BigInt(n.tickSpacing),
|
|
147
|
+
policy: n.policy,
|
|
147
148
|
swapFee: BigInt(n.swapFee), // rindexer names the column after the event's field: `swapFee` since C version 6 (logswap-be #40)
|
|
148
149
|
};
|
|
149
150
|
return {
|
package/dist/keys.d.ts
CHANGED
|
@@ -31,6 +31,12 @@ export interface PoolKey {
|
|
|
31
31
|
quote: Address;
|
|
32
32
|
/** Log-tick spacing, WAD. The LP-boundary ladder — position floors and caps. */
|
|
33
33
|
tickSpacing: bigint;
|
|
34
|
+
/**
|
|
35
|
+
* The C policy that admits this market (C version 10, decision 073): `PoolKey.policy`, a registry-approved
|
|
36
|
+
* policy, fixed for the market's life. Part of the id: the same pair under two policies is two markets.
|
|
37
|
+
* `address(0)` is a bare deployment with no registry.
|
|
38
|
+
*/
|
|
39
|
+
policy: Address;
|
|
34
40
|
/**
|
|
35
41
|
* The swap fee, WAD, fixed for the life of the market: {@link FEE_MIN} (1 bp) ≤ φ ≤ {@link FEE_MAX} (1%),
|
|
36
42
|
* or `0n`, which since C version 7 is NO fee (decisions 065; `DEFAULT_FEE` is gone). The gate
|
package/dist/keys.js
CHANGED
|
@@ -29,6 +29,7 @@ const POOL_KEY_ABI = [
|
|
|
29
29
|
{ name: "base", type: "address" },
|
|
30
30
|
{ name: "quote", type: "address" },
|
|
31
31
|
{ name: "tickSpacing", type: "int256" },
|
|
32
|
+
{ name: "policy", type: "address" },
|
|
32
33
|
{ name: "swapFee", type: "uint256" },
|
|
33
34
|
],
|
|
34
35
|
},
|
|
@@ -46,6 +47,7 @@ export function poolId(key) {
|
|
|
46
47
|
base: key.base,
|
|
47
48
|
quote: key.quote,
|
|
48
49
|
tickSpacing: key.tickSpacing,
|
|
50
|
+
policy: key.policy,
|
|
49
51
|
swapFee: key.swapFee,
|
|
50
52
|
},
|
|
51
53
|
]));
|
package/dist/pools.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface PoolState {
|
|
|
30
30
|
/** Fee-per-unit-L accumulator: $\phi \cdot \mathrm{TV}(\log p)$. */
|
|
31
31
|
F: bigint;
|
|
32
32
|
/** Quadratic variation of log-price, $\Sigma = \sum_{\text{swaps}} (\Delta x_{\text{swap}})^2$ — one term per swap. */
|
|
33
|
-
|
|
33
|
+
realizedVariance: bigint;
|
|
34
34
|
currentK: bigint;
|
|
35
35
|
protocolOwed: bigint;
|
|
36
36
|
minBackstopL: bigint;
|
|
@@ -98,7 +98,7 @@ export declare function cListable(price: number, baseDecimals: number, quoteDeci
|
|
|
98
98
|
*
|
|
99
99
|
* Signed: negative means variation has outrun fee income over the pool's life.
|
|
100
100
|
*/
|
|
101
|
-
export declare function lpEdge(state: Pick<PoolState, "F" | "
|
|
101
|
+
export declare function lpEdge(state: Pick<PoolState, "F" | "realizedVariance">): bigint;
|
|
102
102
|
/** A market discovered from a `MarketCreated` log — the full key, plus where it was created. */
|
|
103
103
|
export interface DiscoveredMarket {
|
|
104
104
|
key: PoolKey;
|
|
@@ -180,7 +180,7 @@ export declare function formatQuote(amount: bigint, quoteDecimals: number): stri
|
|
|
180
180
|
/** Fees the pool has accrued over its life, in QUOTE units: $F \cdot L$. */
|
|
181
181
|
export declare function feesQuote(state: Pick<PoolState, "F" | "lActive">): bigint;
|
|
182
182
|
/** The LP edge in QUOTE units: $(F - \tfrac12\Sigma) \cdot L$. Signed. */
|
|
183
|
-
export declare function edgeQuote(state: Pick<PoolState, "F" | "
|
|
183
|
+
export declare function edgeQuote(state: Pick<PoolState, "F" | "realizedVariance" | "lActive">): bigint;
|
|
184
184
|
/** The pool floor as a price. **Lossy** — display only, like {@link priceOf}. */
|
|
185
185
|
export declare function floorPrice(state: Pick<PoolState, "backstopFloor">, scale?: number): number;
|
|
186
186
|
/** $\log(p / p_{\text{floor}}) = x - \xi$ — how far spot sits above the floor, in log units (WAD). */
|
package/dist/pools.js
CHANGED
|
@@ -100,7 +100,7 @@ export function cListable(price, baseDecimals, quoteDecimals) {
|
|
|
100
100
|
* Signed: negative means variation has outrun fee income over the pool's life.
|
|
101
101
|
*/
|
|
102
102
|
export function lpEdge(state) {
|
|
103
|
-
return state.F - state.
|
|
103
|
+
return state.F - state.realizedVariance / 2n;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Enumerate markets from `MarketCreated` logs.
|
|
@@ -132,6 +132,7 @@ export async function discoverMarkets(c, opts = {}) {
|
|
|
132
132
|
base: a.base,
|
|
133
133
|
quote: a.quote,
|
|
134
134
|
tickSpacing: a.tickSpacing,
|
|
135
|
+
policy: a.policy,
|
|
135
136
|
swapFee: a.swapFee,
|
|
136
137
|
};
|
|
137
138
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logswap/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.80",
|
|
4
4
|
"description": "TypeScript SDK for Logswap, the liquidity primitive introducing the logarithmic invariant — typed wrappers over the CPoolManager / FPoolManager / Router / Lens surface.",
|
|
5
5
|
"license": "GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
package/src/admin.ts
CHANGED
|
@@ -214,15 +214,15 @@ export async function registryKindOf(c: LogswapClient, policy: Address): Promise
|
|
|
214
214
|
// ─── the policies' numbers (the LOG Authority's; each bounded where it reaches the manager) ─────
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
* `PadPolicy.setSchedule` (decisions 056, 067, 070): the rung's growth
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
217
|
+
* `PadPolicy.setSchedule` (decisions 056, 067, 070, 073): the rung's growth and the RANGE a creator chooses his cut of the pot
|
|
218
|
+
* inside at creation (its top ≤ the F manager's `PAYEE_CUT_MAX`). The rest of the pot deepens the bid — nothing is bought or
|
|
219
|
+
* burnt since F version 28, and the protocol takes no cut of the pot since F version 33 (its revenue is the income fee,
|
|
220
|
+
* {@link padSetIncomeFeeRate}). A change to the range applies to pads born after it; the growth moves every pad at its
|
|
221
221
|
* next rung. The rung is the pool's generation. `T(0)` is per quote since decision 070: {@link padSetThresholdBase}.
|
|
222
222
|
*/
|
|
223
223
|
export async function padSetSchedule(c: LogswapClient, policy: Address, s: PadSchedule): Promise<Hash> {
|
|
224
224
|
if ("thresholdBase" in s) throw new Error("logswap: T(0) is per quote since decision 070 — padSetThresholdBase(c, policy, quote, base)");
|
|
225
|
-
return write(c, policy, padPolicyAbi, "setSchedule", [s.thresholdGrowth, s.
|
|
225
|
+
return write(c, policy, padPolicyAbi, "setSchedule", [s.thresholdGrowth, s.creatorShareMin, s.creatorShareMax]);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
/**
|
|
@@ -267,7 +267,6 @@ export async function padThreshold(c: LogswapClient, policy: Address, poolId: He
|
|
|
267
267
|
/** A pad policy's schedule (decision 070: without `T(0)`, which is per quote — {@link padThresholdBases}). WAD numbers. */
|
|
268
268
|
export interface PadSchedule {
|
|
269
269
|
thresholdGrowth: bigint;
|
|
270
|
-
protocolShare: bigint;
|
|
271
270
|
creatorShareMin: bigint;
|
|
272
271
|
creatorShareMax: bigint;
|
|
273
272
|
}
|
|
@@ -275,18 +274,23 @@ export interface PadSchedule {
|
|
|
275
274
|
/** Read {@link PadSchedule} off a pad policy. */
|
|
276
275
|
export async function padScheduleOf(c: LogswapClient, policy: Address): Promise<PadSchedule> {
|
|
277
276
|
const rd = (functionName: string) => c.public.readContract({ address: policy, abi: padPolicyAbi, functionName } as never) as Promise<bigint>;
|
|
278
|
-
const [thresholdGrowth,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
return
|
|
277
|
+
const [thresholdGrowth, creatorShareMin, creatorShareMax] = await Promise.all([rd("thresholdGrowth"), rd("creatorShareMin"), rd("creatorShareMax")]);
|
|
278
|
+
return { thresholdGrowth, creatorShareMin, creatorShareMax };
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** `PolPolicy.setMinQuoteRatio` (decision 073): the reserve a harvest must leave in the bid (`may(Harvest)` refuses less) and a relaunch's seed must bring, a multiple of the pool's L in WAD (at most 100e18). The policy sponsor's. */
|
|
282
|
+
export async function polSetMinQuoteRatio(c: LogswapClient, policy: Address, ratio: bigint): Promise<Hash> {
|
|
283
|
+
return write(c, policy, polPolicyAbi, "setMinQuoteRatio", [ratio]);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** `PadPolicy.setIncomeFeeRate` (decision 073): the share of its new income dividend the dead shares pay LOG Treasury, WAD, at most 50%. The policy sponsor's. */
|
|
287
|
+
export async function padSetIncomeFeeRate(c: LogswapClient, policy: Address, rate: bigint): Promise<Hash> {
|
|
288
|
+
return write(c, policy, padPolicyAbi, "setIncomeFeeRate", [rate]);
|
|
285
289
|
}
|
|
286
290
|
|
|
287
|
-
/** `PolPolicy.
|
|
288
|
-
export async function
|
|
289
|
-
return write(c, policy, polPolicyAbi, "
|
|
291
|
+
/** `PolPolicy.setIncomeFeeRate` (decision 073): the share of its new income dividend the pool's authority pays LOG Treasury, WAD, at most 50%. Paid on the authority's own shares only: an authority that holds through another address pays nothing. The policy sponsor's. */
|
|
292
|
+
export async function polSetIncomeFeeRate(c: LogswapClient, policy: Address, rate: bigint): Promise<Hash> {
|
|
293
|
+
return write(c, policy, polPolicyAbi, "setIncomeFeeRate", [rate]);
|
|
290
294
|
}
|
|
291
295
|
|
|
292
296
|
/** `setQuoteListed` on any protocol policy: a quote a pool of that kind may be born against while it curates quotes. The LOG Authority's. */
|
|
@@ -353,14 +357,31 @@ export async function policyMintFeeMenu(c: LogswapClient, policy: Address, candi
|
|
|
353
357
|
return { curated, listed: candidates.filter((_, i) => flags[i]) };
|
|
354
358
|
}
|
|
355
359
|
|
|
356
|
-
/** `
|
|
357
|
-
export
|
|
358
|
-
|
|
360
|
+
/** `PolicyRegistry.CreationMode` (decision 073): who may create under a policy. Open = 0, Restricted = 1 (the initializer list), SponsorOnly = 2 (bound to a sponsor, permanent). */
|
|
361
|
+
export type CreationMode = "open" | "restricted" | "sponsorOnly";
|
|
362
|
+
const CREATION_MODES: readonly CreationMode[] = ["open", "restricted", "sponsorOnly"];
|
|
363
|
+
|
|
364
|
+
/** `PolicyRegistry.setCreationMode(policy, mode)` (the LOG Authority): replaces the per-policy creator lists (064). A sponsor-bound policy cannot leave `sponsorOnly`. */
|
|
365
|
+
export async function registrySetCreationMode(c: LogswapClient, policy: Address, mode: CreationMode): Promise<Hash> {
|
|
366
|
+
return registryWrite(c, "setCreationMode", [policy, CREATION_MODES.indexOf(mode)]);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** `PolicyRegistry.setInitializerListed(policy, who, allowed)` (the LOG Authority): who may create under a `restricted` policy, authenticated as the caller or a trusted forwarder's user. */
|
|
370
|
+
export async function registrySetInitializerListed(c: LogswapClient, policy: Address, who: Address, allowed: boolean): Promise<Hash> {
|
|
371
|
+
return registryWrite(c, "setInitializerListed", [policy, who, allowed]);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** `PolicyRegistry.setForwarderTrusted` (the LOG Authority): a router whose `user()` names the creator. Moved off the public policy in F version 33. */
|
|
375
|
+
export async function registrySetForwarderTrusted(c: LogswapClient, forwarder: Address, trusted: boolean): Promise<Hash> {
|
|
376
|
+
return registryWrite(c, "setForwarderTrusted", [forwarder, trusted]);
|
|
359
377
|
}
|
|
360
378
|
|
|
361
|
-
/** `
|
|
362
|
-
export async function
|
|
363
|
-
|
|
379
|
+
/** `PolicyRegistry.creationMode(policy)`. */
|
|
380
|
+
export async function registryCreationMode(c: LogswapClient, policy: Address): Promise<CreationMode> {
|
|
381
|
+
const registry = await policyRegistryOf(c);
|
|
382
|
+
if (registry === ZERO) return "open";
|
|
383
|
+
const m = (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "creationMode", args: [policy] } as never)) as number;
|
|
384
|
+
return CREATION_MODES[Number(m)] ?? "open";
|
|
364
385
|
}
|
|
365
386
|
|
|
366
387
|
/** `PublicPolicy.setPairListed` (064): a C pair a market may be born on while pairs are curated. Directional (base, quote). */
|
|
@@ -378,52 +399,46 @@ export async function gateSetSpacingListed(c: LogswapClient, policy: Address, ti
|
|
|
378
399
|
return write(c, policy, publicPolicyAbi, "setSpacingListed", [tickSpacing, listed]);
|
|
379
400
|
}
|
|
380
401
|
|
|
381
|
-
/** `PublicPolicy.setForwarderTrusted` (064): a router whose `user()` the gate takes as the creator. */
|
|
382
|
-
export async function gateSetForwarderTrusted(c: LogswapClient, policy: Address, forwarder: Address, trusted: boolean): Promise<Hash> {
|
|
383
|
-
return write(c, policy, publicPolicyAbi, "setForwarderTrusted", [forwarder, trusted]);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
402
|
/**
|
|
387
403
|
* @deprecated C version 8 fixes the gate at construction (066): there is no `setGate`. Open or close
|
|
388
|
-
* C through the gate's lists (`
|
|
404
|
+
* C through the gate's lists (`registrySetCreationMode`, `gateSetPairCurated`, `gateSetSpacingListed`, …).
|
|
389
405
|
*/
|
|
390
406
|
export async function setCGate(_c: LogswapClient, _gate: Address): Promise<Hash> {
|
|
391
407
|
throw new Error("logswap: the C gate is fixed at construction since C version 8 (decision 066); change its lists instead");
|
|
392
408
|
}
|
|
393
409
|
|
|
394
|
-
/** The C manager's gate (`address(0)`: permissionless, a fee-free market then refused). */
|
|
395
|
-
export async function cGate(c: LogswapClient): Promise<Address> {
|
|
396
|
-
return c.public.readContract({ address: c.addresses.cPoolManager, abi: cPoolManagerAbi, functionName: "gate" } as never) as Promise<Address>;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
410
|
export interface CGateRules {
|
|
411
|
+
/** The registry admits `creator` to create under `key.policy` (creation mode, initializer list, sponsor binding; decision 073). */
|
|
400
412
|
creatorOk: boolean;
|
|
401
413
|
quoteOk: boolean;
|
|
402
414
|
pairOk: boolean;
|
|
403
415
|
feeOk: boolean;
|
|
404
416
|
spacingOk: boolean;
|
|
405
|
-
/** A market on (base, quote, fee) already exists, whatever its spacing: the
|
|
417
|
+
/** A market on (base, quote, fee) already exists, whatever its spacing: the policy refuses another (064 (b)). */
|
|
406
418
|
exists: boolean;
|
|
407
|
-
/** Whether `router` is a trusted forwarder — `createMarket` through it is then checked against `creator`. */
|
|
419
|
+
/** Whether `router` is a trusted forwarder on the registry — `createMarket` through it is then checked against `creator`. */
|
|
408
420
|
routerTrusted: boolean;
|
|
409
|
-
/** Every check passes: the
|
|
421
|
+
/** Every check passes: the policy would admit this market from this creator (the mint fee aside — see {@link policyMintFeeMenu}). */
|
|
410
422
|
admitted: boolean;
|
|
411
423
|
}
|
|
412
424
|
|
|
413
425
|
/**
|
|
414
426
|
* The public policy's C checks for one candidate market and creator, in one round of reads — what
|
|
415
|
-
* the create form shows before a wallet is asked (064).
|
|
416
|
-
*
|
|
427
|
+
* the create form shows before a wallet is asked (064, 073). The policy is `key.policy`; the registry
|
|
428
|
+
* is asked `admit(policy, caller, 0)`, with the caller being the router when it is a trusted forwarder
|
|
429
|
+
* (it then names `creator` itself) and `creator` otherwise.
|
|
417
430
|
*/
|
|
418
431
|
export async function cGateRules(c: LogswapClient, a: { key: PoolKey; creator: Address; router?: Address; gate?: Address }): Promise<CGateRules> {
|
|
419
|
-
const g = a.gate ?? (
|
|
432
|
+
const g = a.gate ?? (a.key.policy as Address);
|
|
420
433
|
const rd = <T>(functionName: string, args: readonly unknown[] = []) =>
|
|
421
434
|
c.public.readContract({ address: g, abi: publicPolicyAbi, functionName, args } as never) as Promise<T>;
|
|
422
435
|
const { key } = a;
|
|
423
|
-
const
|
|
436
|
+
const registry = await policyRegistryOf(c);
|
|
437
|
+
const router = a.router ?? c.addresses.router;
|
|
438
|
+
const registryRd = <T>(functionName: string, args: readonly unknown[]) =>
|
|
439
|
+
c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName, args } as never) as Promise<T>;
|
|
440
|
+
const [quoteCurated, quoteListed, pairCurated, pairListed, feeCurated, feeListed, spacingListed, market, routerTrusted, creatorOk] =
|
|
424
441
|
await Promise.all([
|
|
425
|
-
rd<boolean>("creatorCurated"),
|
|
426
|
-
rd<boolean>("creatorListed", [a.creator]),
|
|
427
442
|
rd<boolean>("quoteCurated"),
|
|
428
443
|
rd<boolean>("quoteListed", [key.quote]),
|
|
429
444
|
rd<boolean>("pairCurated"),
|
|
@@ -432,10 +447,13 @@ export async function cGateRules(c: LogswapClient, a: { key: PoolKey; creator: A
|
|
|
432
447
|
rd<boolean>("feeListed", [key.swapFee]),
|
|
433
448
|
rd<boolean>("spacingListed", [key.tickSpacing]),
|
|
434
449
|
rd<Hex>("cMarketOf", [key.base, key.quote, key.swapFee]),
|
|
435
|
-
|
|
450
|
+
registry === ZERO ? Promise.resolve(false) : registryRd<boolean>("forwarderTrusted", [router]),
|
|
451
|
+
registry === ZERO
|
|
452
|
+
? Promise.resolve(true)
|
|
453
|
+
: registryRd<Address>("admit", [g, a.creator, ZERO]).then(() => true, () => false),
|
|
436
454
|
]);
|
|
437
455
|
const r = {
|
|
438
|
-
creatorOk
|
|
456
|
+
creatorOk,
|
|
439
457
|
quoteOk: !quoteCurated || quoteListed,
|
|
440
458
|
pairOk: !pairCurated || pairListed,
|
|
441
459
|
feeOk: !feeCurated || feeListed,
|
|
@@ -453,19 +471,11 @@ export async function cGateRules(c: LogswapClient, a: { key: PoolKey; creator: A
|
|
|
453
471
|
*/
|
|
454
472
|
export const gateErrorAbi = [
|
|
455
473
|
...publicPolicyAbi.filter((x) => x.type === "error"),
|
|
474
|
+
// creation admission moved to the registry in F 33 / C 10 (073): a refusal there surfaces through the manager's birth
|
|
475
|
+
...policyRegistryAbi.filter((x) => x.type === "error" && ["SponsorOnly", "InitializerNotListed", "InvalidForwardedUser", "NotListed"].includes(x.name)),
|
|
456
476
|
...padPolicyAbi.filter((x) => x.type === "error" && (x.name === "PadExists" || x.name === "NoThreshold")),
|
|
457
477
|
] as const;
|
|
458
478
|
|
|
459
|
-
/** `PublicPolicy.setListed`: an asset a curated seed may hold. */
|
|
460
|
-
export async function publicSetListed(c: LogswapClient, policy: Address, token: Address, listed: boolean): Promise<Hash> {
|
|
461
|
-
return write(c, policy, publicPolicyAbi, "setListed", [token, listed]);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/** `PublicPolicy.setCurated`: whether every public seed is checked against the list. */
|
|
465
|
-
export async function publicSetCurated(c: LogswapClient, policy: Address, curated: boolean): Promise<Hash> {
|
|
466
|
-
return write(c, policy, publicPolicyAbi, "setCurated", [curated]);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
479
|
// ─── the LOG Treasury (066): receives, administers nothing ───────────────────
|
|
470
480
|
|
|
471
481
|
function manager(c: LogswapClient, side: "C" | "F"): { address: Address; abi: readonly unknown[] } {
|
package/src/client.ts
CHANGED
|
@@ -180,7 +180,7 @@ function guardChain(wallet: WalletClient, pub: PublicClient): WalletClient {
|
|
|
180
180
|
* takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
|
|
181
181
|
* `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
|
|
182
182
|
*/
|
|
183
|
-
export const EXPECTED_VERSION =
|
|
183
|
+
export const EXPECTED_VERSION = 10n;
|
|
184
184
|
/**
|
|
185
185
|
* The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
|
|
186
186
|
* 4 was the income-only harvest cut).
|
|
@@ -272,8 +272,10 @@ export const EXPECTED_VERSION = 9n;
|
|
|
272
272
|
// 30 (decision 071): the events — `FSwap` is the shared `Swap` plus `FSwapState`, object-word names
|
|
273
273
|
// (`PoolCreated`, `GenerationSeeded`, `SharesMinted`, ...), `PoolCreated` carries the mint fee.
|
|
274
274
|
// No pool id moved.
|
|
275
|
+
// 31 (decision 072): `DividendClaimed` names the generation (`gen`, indexed, after `poolId`); `lock` / `unlock` emit
|
|
276
|
+
// `LienLocked` / `LienUnlocked`. No selector, storage layout or pool id moved.
|
|
275
277
|
// A breaking bump: raised in the same change.
|
|
276
|
-
export const EXPECTED_F_VERSION =
|
|
278
|
+
export const EXPECTED_F_VERSION = 33n;
|
|
277
279
|
|
|
278
280
|
export async function assertVersion(c: LogswapClient, expected = EXPECTED_VERSION): Promise<void> {
|
|
279
281
|
const { cPoolManagerAbi, fPoolManagerAbi } = await import("./generated.js");
|
package/src/fpool.ts
CHANGED
|
@@ -93,7 +93,7 @@ export interface FPoolState {
|
|
|
93
93
|
*/
|
|
94
94
|
lnCapOverFloor: number;
|
|
95
95
|
/** Σ = ∫ Σ_j w_j (dx_j)², accrued even though the fee is fixed — the kernel stays calculable. */
|
|
96
|
-
|
|
96
|
+
realizedVariance: bigint;
|
|
97
97
|
/**
|
|
98
98
|
* The pool's policy: the contract the key names, holding the pool's roles
|
|
99
99
|
* and answering every question the manager does not decide itself. Read its roles with
|
|
@@ -174,7 +174,7 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
|
|
|
174
174
|
compositeX: v.compositeX,
|
|
175
175
|
unharvested: v.unharvested,
|
|
176
176
|
lnCapOverFloor: Number(p.lnCapOverFloor),
|
|
177
|
-
|
|
177
|
+
realizedVariance: p.realizedVariance,
|
|
178
178
|
policy: p.policy,
|
|
179
179
|
asks: Number(p.asks),
|
|
180
180
|
name,
|
|
@@ -260,14 +260,21 @@ export interface FPoolRoles {
|
|
|
260
260
|
authority: Address;
|
|
261
261
|
/** The proposed next authority, until it accepts — zero when nothing is pending. */
|
|
262
262
|
pendingAuthority: Address;
|
|
263
|
+
/** The desk's optional pool operator (decision 073): one delegate besides the authority, zero when none. */
|
|
263
264
|
operator: Address;
|
|
264
|
-
pendingOperator: Address;
|
|
265
265
|
gateMint: boolean;
|
|
266
|
-
|
|
266
|
+
/** The desk's swap admission (decision 073): open to all, listed takers/minters only, or one cached executor. */
|
|
267
|
+
swapMode: FPoolSwapMode;
|
|
268
|
+
/** The executor in `executor` mode, zero otherwise. */
|
|
269
|
+
swapExecutor: Address;
|
|
267
270
|
/** The policy's own ceiling on a harvest now — the bid ({@link FPoolDescription.harvestable}) narrowed by the policy's rule. */
|
|
268
271
|
maxHarvest: bigint;
|
|
269
272
|
}
|
|
270
273
|
|
|
274
|
+
/** `PrivatePolicy.SwapMode`: Open = 0, Listed = 1, Executor = 2. */
|
|
275
|
+
export type FPoolSwapMode = "open" | "listed" | "executor";
|
|
276
|
+
const SWAP_MODES: readonly FPoolSwapMode[] = ["open", "listed", "executor"];
|
|
277
|
+
|
|
271
278
|
/** Read a pool's roles from its policy. `state` saves the `getPool` round trip when already in hand. */
|
|
272
279
|
export async function getFPoolRoles(c: LogswapClient, poolId: Hex, state?: Pick<FPoolState, "policy" | "kind">): Promise<FPoolRoles> {
|
|
273
280
|
const s = state ?? (await getFPool(c, poolId));
|
|
@@ -280,15 +287,11 @@ export async function getFPoolRoles(c: LogswapClient, poolId: Hex, state?: Pick<
|
|
|
280
287
|
rdPolicy<bigint>(fPolicyBaseAbi, "maxHarvest"),
|
|
281
288
|
]);
|
|
282
289
|
const desk = s.kind === "private";
|
|
283
|
-
const
|
|
284
|
-
? await
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
rdPolicy<boolean>(privatePolicyAbi, "gateSwap"),
|
|
289
|
-
])
|
|
290
|
-
: [ZERO_ADDRESS, ZERO_ADDRESS, false, false];
|
|
291
|
-
return { policy: s.policy, creator, authority, pendingAuthority, operator, pendingOperator, gateMint, gateSwap, maxHarvest };
|
|
290
|
+
const permissions = desk
|
|
291
|
+
? ((await c.public.readContract({ address: s.policy, abi: privatePolicyAbi, functionName: "permissionsOf", args: [poolId] } as never)) as readonly [number, Address, boolean, Address, Address])
|
|
292
|
+
: undefined;
|
|
293
|
+
const [mode, swapExecutor, gateMint, , operator] = permissions ?? [0, ZERO_ADDRESS, false, ZERO_ADDRESS, ZERO_ADDRESS];
|
|
294
|
+
return { policy: s.policy, creator, authority, pendingAuthority, operator, gateMint, swapMode: SWAP_MODES[Number(mode)] ?? "open", swapExecutor, maxHarvest };
|
|
292
295
|
}
|
|
293
296
|
|
|
294
297
|
/** Which of the two products a pool is configured as — a pad is a launch, anything else a basket/pool. A UI has to choose what to render. */
|
|
@@ -309,7 +312,7 @@ export interface FPoolDescription {
|
|
|
309
312
|
/**
|
|
310
313
|
* The most a harvest may take now by the MANAGER's rule: the bid, `Q` once seeded (0 before).
|
|
311
314
|
* The manager's `harvestable()` getter was cut in F version 21; this is the same number, read
|
|
312
|
-
* off `getPool`. The policy may allow less (a pad: the income; a POL: above `
|
|
315
|
+
* off `getPool`. The policy may allow less (a pad: the income; a POL: above `minQuoteRatio`·L) —
|
|
313
316
|
* {@link FPoolRoles.maxHarvest}.
|
|
314
317
|
*/
|
|
315
318
|
harvestable: bigint;
|
|
@@ -670,7 +673,7 @@ export async function fPoolLienOf(c: LogswapClient, poolId: Hex, owner: Address,
|
|
|
670
673
|
*/
|
|
671
674
|
export async function fPoolLock(c: LogswapClient, a: { poolId: Hex; owner: Address; amount: bigint; gen?: bigint | number; account: Address }) {
|
|
672
675
|
const g = a.gen ?? (await fPoolGen(c, a.poolId));
|
|
673
|
-
return writeFPool0(c, "
|
|
676
|
+
return writeFPool0(c, "lienLock", [fPoolShareId(a.poolId, g), a.owner, a.amount], a.account);
|
|
674
677
|
}
|
|
675
678
|
|
|
676
679
|
/**
|
|
@@ -683,7 +686,7 @@ export async function fPoolUnlock(
|
|
|
683
686
|
a: { poolId: Hex; owner: Address; amount: bigint; to: Address; gen?: bigint | number; account: Address },
|
|
684
687
|
) {
|
|
685
688
|
const g = a.gen ?? (await fPoolGen(c, a.poolId));
|
|
686
|
-
return writeFPool0(c, "
|
|
689
|
+
return writeFPool0(c, "lienUnlock", [fPoolShareId(a.poolId, g), a.owner, a.amount, a.to], a.account);
|
|
687
690
|
}
|
|
688
691
|
|
|
689
692
|
/** Bank the owner's pending into the lien now — `unlock(id, owner, 0, owner)`: dividends bank lazily. The locker's. */
|
|
@@ -1178,7 +1181,7 @@ export async function fPoolKeyOfPool(c: LogswapClient, poolId: Hex, opts: { salt
|
|
|
1178
1181
|
if (fPoolIdOfKey(key).toLowerCase() !== poolId.toLowerCase() && opts.salt === undefined) {
|
|
1179
1182
|
// a pad's salt carries its split (decisions 056): rebuild it from the policy's record with the default nonce
|
|
1180
1183
|
try {
|
|
1181
|
-
const
|
|
1184
|
+
const creatorShare = BigInt((await c.public.readContract({ address: a.policy, abi: padPolicyAbi, functionName: "creatorShareOf", args: [poolId] } as never)) as bigint | number);
|
|
1182
1185
|
const padKey = { ...key, salt: padSalt({ creatorShare }) };
|
|
1183
1186
|
if (fPoolIdOfKey(padKey).toLowerCase() === poolId.toLowerCase()) return padKey;
|
|
1184
1187
|
} catch {
|
|
@@ -1320,7 +1323,7 @@ export async function fPoolRetire(c: LogswapClient, a: { poolId: Hex; account: A
|
|
|
1320
1323
|
* `harvest(Q)` does it: the protocol's cut leaves the pool with the amount (with no treasury
|
|
1321
1324
|
* there is no cut). `[]` when the bid is already empty. Throws on a pad (F version 21: a pad
|
|
1322
1325
|
* never retires, whatever its bid), and when the pool's policy keeps a floor on the bid
|
|
1323
|
-
* (`PolPolicy.
|
|
1326
|
+
* (`PolPolicy.minQuoteRatio`): a `retire` under that policy waits for the market.
|
|
1324
1327
|
*/
|
|
1325
1328
|
export async function fPoolEmptyingHarvests(c: LogswapClient, poolId: Hex): Promise<bigint[]> {
|
|
1326
1329
|
const s = await getFPool(c, poolId);
|
|
@@ -1591,7 +1594,7 @@ export async function fPoolWalletBatchesAtomically(c: LogswapClient, account: Ad
|
|
|
1591
1594
|
export async function fPoolDeskOpening(c: LogswapClient, a: { poolId: Hex; account: Address; policy?: Address }): Promise<Hash[]> {
|
|
1592
1595
|
const policy = a.policy ?? fPoolPolicyFor(c, "private");
|
|
1593
1596
|
return [
|
|
1594
|
-
await
|
|
1597
|
+
await fPoolSetMintGate(c, { poolId: a.poolId, gated: true, account: a.account, policy }),
|
|
1595
1598
|
await fPoolSetMinters(c, { poolId: a.poolId, who: [a.account], allowed: true, account: a.account, policy }),
|
|
1596
1599
|
];
|
|
1597
1600
|
}
|
|
@@ -1693,12 +1696,21 @@ export async function fPoolAcceptAuthority(c: LogswapClient, a: { poolId: Hex; a
|
|
|
1693
1696
|
|
|
1694
1697
|
// ─── the desk's controls (PrivatePolicy) ───────────────────────────────
|
|
1695
1698
|
|
|
1696
|
-
/**
|
|
1697
|
-
|
|
1699
|
+
/**
|
|
1700
|
+
* Set the desk's swap admission (the authority, on the desk's policy; decision 073): `open`, `listed` (the minters and takers
|
|
1701
|
+
* lists) or `executor` (one address, cached on the manager, no policy call per swap). `executor` is required in `executor` mode
|
|
1702
|
+
* and must be omitted otherwise. Preserves mint admission. `burn` is never gated.
|
|
1703
|
+
*/
|
|
1704
|
+
export async function fPoolSetSwapMode(
|
|
1698
1705
|
c: LogswapClient,
|
|
1699
|
-
a: { poolId: Hex;
|
|
1706
|
+
a: { poolId: Hex; mode: FPoolSwapMode; executor?: Address; account: Address; policy?: Address },
|
|
1700
1707
|
) {
|
|
1701
|
-
return writePolicy(c, privatePolicyAbi, a, "
|
|
1708
|
+
return writePolicy(c, privatePolicyAbi, a, "setSwapMode", [SWAP_MODES.indexOf(a.mode), a.executor ?? ZERO_ADDRESS]);
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
/** Turn mint admission on or off (the authority, on the desk's policy), preserving the swap mode and its executor. */
|
|
1712
|
+
export async function fPoolSetMintGate(c: LogswapClient, a: { poolId: Hex; gated: boolean; account: Address; policy?: Address }) {
|
|
1713
|
+
return writePolicy(c, privatePolicyAbi, a, "setMintGate", [a.gated]);
|
|
1702
1714
|
}
|
|
1703
1715
|
|
|
1704
1716
|
/**
|
|
@@ -1785,23 +1797,18 @@ async function registryAddress(c: LogswapClient): Promise<Address> {
|
|
|
1785
1797
|
return registry;
|
|
1786
1798
|
}
|
|
1787
1799
|
|
|
1788
|
-
/** Who
|
|
1789
|
-
export function
|
|
1790
|
-
return s.operator === ZERO_ADDRESS ? s.authority : s.operator;
|
|
1800
|
+
/** Who may run the pool (decision 073): the authority always, and the optional delegate. */
|
|
1801
|
+
export function fPoolRunners(s: Pick<FPoolRoles, "authority" | "operator">): Address[] {
|
|
1802
|
+
return s.operator === ZERO_ADDRESS ? [s.authority] : [s.authority, s.operator];
|
|
1791
1803
|
}
|
|
1792
1804
|
|
|
1793
1805
|
/**
|
|
1794
|
-
*
|
|
1795
|
-
* `harvest`, `retire`, `regenerate
|
|
1796
|
-
*
|
|
1806
|
+
* Grant, replace or revoke the pool operator (the authority, on the desk's policy; decision 073): one optional delegate who may
|
|
1807
|
+
* `harvest`, `retire`, `regenerate` and `setLegs` besides the authority. Immediate, with no acceptance step, so check the
|
|
1808
|
+
* address; the zero address revokes. A handover or a policy move clears it.
|
|
1797
1809
|
*/
|
|
1798
|
-
export async function
|
|
1799
|
-
return writePolicy(c, privatePolicyAbi, a, "
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
/** The proposed operator takes the role. */
|
|
1803
|
-
export async function fPoolAcceptOperator(c: LogswapClient, a: { poolId: Hex; account: Address; policy?: Address }) {
|
|
1804
|
-
return writePolicy(c, privatePolicyAbi, a, "acceptOperator", []);
|
|
1810
|
+
export async function fPoolSetPoolOperator(c: LogswapClient, a: { poolId: Hex; operator: Address; account: Address; policy?: Address }) {
|
|
1811
|
+
return writePolicy(c, privatePolicyAbi, a, "setPoolOperator", [a.operator]);
|
|
1805
1812
|
}
|
|
1806
1813
|
|
|
1807
1814
|
/**
|
|
@@ -1949,20 +1956,19 @@ export type FPoolRules =
|
|
|
1949
1956
|
/** The pot the next graduation needs, in the pad's quote: `PadPolicy.threshold(poolId, gen)` (T(0) is per quote, decision 070). */
|
|
1950
1957
|
threshold: bigint;
|
|
1951
1958
|
pot: bigint;
|
|
1952
|
-
/** This pad's
|
|
1959
|
+
/** This pad's creator share, recorded at its birth from the key's salt and never changed (decisions 056, 057, 067): a fraction of the pot. The rest deepens the bid; nothing is bought or burnt (067). */
|
|
1953
1960
|
creatorShare: bigint;
|
|
1954
|
-
|
|
1961
|
+
/** The income fee the dead shares pay on their own new income dividend (decision 073), WAD. */
|
|
1962
|
+
incomeFeeRate: bigint;
|
|
1955
1963
|
/** The ranges the LOG Authority set on the policy NOW for the pads born after this read: what a new creator may choose. */
|
|
1956
1964
|
ranges: PadRanges;
|
|
1957
1965
|
}
|
|
1958
|
-
| { kind: "pol";
|
|
1959
|
-
| { kind: "public"
|
|
1960
|
-
| { kind: "private"; gateMint: boolean;
|
|
1966
|
+
| { kind: "pol"; /** The reserve a harvest leaves in the bid and a relaunch's seed must bring, a multiple of L (WAD). */ minQuoteRatio: bigint; /** The income fee the pool's authority pays on its own new income dividend (decision 073), WAD. */ incomeFeeRate: bigint }
|
|
1967
|
+
| { kind: "public" }
|
|
1968
|
+
| { kind: "private"; gateMint: boolean; swapMode: FPoolSwapMode; swapExecutor: Address; operator: Address };
|
|
1961
1969
|
|
|
1962
1970
|
/** The LOG Authority's range on a pad's creator choice (`PadPolicy`, decisions 056, 067), WAD fractions of the pot. */
|
|
1963
1971
|
export interface PadRanges {
|
|
1964
|
-
/** The protocol's share of the pot, recorded into each pad at birth. */
|
|
1965
|
-
protocolShare: bigint;
|
|
1966
1972
|
creatorShareMin: bigint;
|
|
1967
1973
|
/** At most the F manager's `PAYEE_CUT_MAX` (50%), which bounds a pad's payee whatever the policy (067). */
|
|
1968
1974
|
creatorShareMax: bigint;
|
|
@@ -1999,29 +2005,27 @@ export async function getFPoolRules(c: LogswapClient, s: Pick<FPoolState, "poolI
|
|
|
1999
2005
|
case "pad": {
|
|
2000
2006
|
// the rung is the manager's generation (F version 21): a move carries it, nothing to ask the policy
|
|
2001
2007
|
const gen = s.gen;
|
|
2002
|
-
const [
|
|
2003
|
-
rd<
|
|
2008
|
+
const [creatorShare, pot, threshold, incomeFeeRate, creatorShareMin, creatorShareMax] = await Promise.all([
|
|
2009
|
+
rd<bigint | number>(padPolicyAbi, "creatorShareOf", [s.poolId]).then(BigInt),
|
|
2004
2010
|
fPoolDividendOf(c, s.poolId, DEAD_ADDRESS, gen),
|
|
2005
2011
|
rd<bigint>(padPolicyAbi, "threshold", [s.poolId, BigInt(gen)]),
|
|
2006
|
-
rd<bigint>(padPolicyAbi, "
|
|
2012
|
+
rd<bigint>(padPolicyAbi, "incomeFeeRate"),
|
|
2007
2013
|
rd<bigint>(padPolicyAbi, "creatorShareMin"),
|
|
2008
2014
|
rd<bigint>(padPolicyAbi, "creatorShareMax"),
|
|
2009
2015
|
]);
|
|
2010
|
-
const
|
|
2011
|
-
|
|
2012
|
-
return { kind: "pad", gen, rung: gen, threshold, pot, creatorShare, protocolShare, ranges };
|
|
2016
|
+
const ranges: PadRanges = { creatorShareMin, creatorShareMax };
|
|
2017
|
+
return { kind: "pad", gen, rung: gen, threshold, pot, creatorShare, incomeFeeRate, ranges };
|
|
2013
2018
|
}
|
|
2014
2019
|
case "pol": {
|
|
2015
|
-
const [
|
|
2016
|
-
return { kind: "pol",
|
|
2020
|
+
const [minQuoteRatio, incomeFeeRate] = await Promise.all([rd<bigint>(polPolicyAbi, "minQuoteRatio"), rd<bigint>(polPolicyAbi, "incomeFeeRate")]);
|
|
2021
|
+
return { kind: "pol", minQuoteRatio, incomeFeeRate };
|
|
2017
2022
|
}
|
|
2018
2023
|
case "public": {
|
|
2019
|
-
|
|
2020
|
-
return { kind: "public", curated };
|
|
2024
|
+
return { kind: "public" };
|
|
2021
2025
|
}
|
|
2022
2026
|
case "private": {
|
|
2023
2027
|
const r = roles ?? (await getFPoolRoles(c, s.poolId, s));
|
|
2024
|
-
return { kind: "private", gateMint: r.gateMint,
|
|
2028
|
+
return { kind: "private", gateMint: r.gateMint, swapMode: r.swapMode, swapExecutor: r.swapExecutor, operator: r.operator };
|
|
2025
2029
|
}
|
|
2026
2030
|
}
|
|
2027
2031
|
}
|
|
@@ -2110,7 +2114,7 @@ export interface FPolicyTerms {
|
|
|
2110
2114
|
carried: Address;
|
|
2111
2115
|
}
|
|
2112
2116
|
|
|
2113
|
-
/** Every F pool's raw state in one lens call (the manager's `Pool` struct: quote, swapFee, policy, seeded, gen, n, restructureTime, asks, lnCapOverFloor, Q,
|
|
2117
|
+
/** Every F pool's raw state in one lens call (the manager's `Pool` struct: quote, swapFee, policy, seeded, gen, n, restructureTime, asks, lnCapOverFloor, Q, realizedVariance, L, shares, refLogFloor). */
|
|
2114
2118
|
export async function getFPoolsRaw(c: LogswapClient, poolIds: Hex[]): Promise<readonly unknown[]> {
|
|
2115
2119
|
const { logswapLensAbi } = await import("./generated.js");
|
|
2116
2120
|
return (await c.public.readContract({ address: c.addresses.lens, abi: logswapLensAbi, functionName: "getFPools", args: [poolIds] } as never)) as readonly unknown[];
|