@logswap/sdk 0.5.102 → 0.5.103

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.
Files changed (64) hide show
  1. package/README.md +14 -418
  2. package/dist/actions.d.ts +0 -39
  3. package/dist/actions.js +0 -39
  4. package/dist/admin.d.ts +0 -106
  5. package/dist/admin.js +1 -96
  6. package/dist/chains.d.ts +0 -49
  7. package/dist/chains.js +0 -30
  8. package/dist/claims.d.ts +0 -32
  9. package/dist/claims.js +0 -30
  10. package/dist/client.d.ts +0 -116
  11. package/dist/client.js +1 -231
  12. package/dist/fees.d.ts +1 -45
  13. package/dist/fees.js +0 -44
  14. package/dist/fpool.d.ts +4 -612
  15. package/dist/fpool.js +14 -490
  16. package/dist/generated.js +0 -30
  17. package/dist/history.d.ts +0 -61
  18. package/dist/history.js +5 -74
  19. package/dist/ids.d.ts +0 -30
  20. package/dist/ids.js +0 -31
  21. package/dist/index.d.ts +0 -7
  22. package/dist/index.js +0 -7
  23. package/dist/indexer.d.ts +0 -68
  24. package/dist/indexer.js +1 -77
  25. package/dist/keys.d.ts +0 -50
  26. package/dist/keys.js +0 -35
  27. package/dist/liquidity.d.ts +0 -128
  28. package/dist/liquidity.js +1 -107
  29. package/dist/onboard.d.ts +0 -52
  30. package/dist/onboard.js +1 -59
  31. package/dist/pools.d.ts +3 -157
  32. package/dist/pools.js +1 -164
  33. package/dist/positions.d.ts +0 -102
  34. package/dist/positions.js +1 -90
  35. package/dist/quote.d.ts +0 -14
  36. package/dist/quote.js +0 -14
  37. package/dist/swap.d.ts +0 -31
  38. package/dist/swap.js +5 -37
  39. package/dist/tokencache.d.ts +0 -48
  40. package/dist/tokencache.js +1 -73
  41. package/dist/write.d.ts +1 -87
  42. package/dist/write.js +1 -87
  43. package/package.json +3 -8
  44. package/src/actions.ts +0 -208
  45. package/src/admin.ts +0 -350
  46. package/src/chains.ts +0 -278
  47. package/src/claims.ts +0 -111
  48. package/src/client.ts +0 -436
  49. package/src/fees.ts +0 -138
  50. package/src/fpool.ts +0 -2049
  51. package/src/generated.ts +0 -4345
  52. package/src/history.ts +0 -383
  53. package/src/ids.ts +0 -78
  54. package/src/index.ts +0 -26
  55. package/src/indexer.ts +0 -264
  56. package/src/keys.ts +0 -138
  57. package/src/liquidity.ts +0 -456
  58. package/src/onboard.ts +0 -253
  59. package/src/pools.ts +0 -465
  60. package/src/positions.ts +0 -297
  61. package/src/quote.ts +0 -36
  62. package/src/swap.ts +0 -181
  63. package/src/tokencache.ts +0 -178
  64. package/src/write.ts +0 -236
package/dist/fpool.d.ts CHANGED
@@ -1,336 +1,128 @@
1
- /**
2
- * fpool.ts — the `ManagerF` surface: n bases, one quote, one shared floor.
3
- *
4
- * The other primitive. `ManagerC` gives every position its own floor on a tick ladder;
5
- * `ManagerF` gives every share the SAME floor and deletes the ladder, the accumulators and the
6
- * per-position accounting with it. Reading the two side by side is the fastest way to understand
7
- * either.
8
- *
9
- * **A pool is an ID, not an address.** Both primitives are singletons now, so neither has a
10
- * per-pool deployment — but they are addressed differently and for a reason. The C manager rides
11
- * its whole `PoolKey` in calldata because that key is small, fixed and wholly needed. An F-pool
12
- * key is variable-length and only ever partially needed (no swap path is O(n)), so it is stored
13
- * once at `initialize` and every later call names `(poolId, j)`. Callers hold a `bytes32`.
14
- *
15
- * **Two products, one contract.** The basket (n > 1) and the launch (n = 1, the creator alone on
16
- * the lever) are the same bytecode under two key fields — the KIND (what the manager promises
17
- * structurally) and the POLICY (the pool's policy: its roles, its gates, the terms of every harvest
18
- * and release) — and nothing in the maths. `describeFPool` below reports
19
- * which shape a given pool is, because a UI has to decide what to render.
20
- *
21
- * **The roles are the policy's** (policy.md; F version 41). The manager holds no authority, gate or list: it asks
22
- * the pool's policy `may(poolId, action, who)` and acts on the answer (the one thing it caches is the operator,
23
- * admitted with no call). One policy contract, `PolicyF`, serves every F pool; its kinds — public, desk, POL, pad —
24
- * are parameter sets, every one an immutable ({@link FPolicyTerms}). The policy's AUTHORITY (immutable; the LOG
25
- * Authority of the day on the LOG's own instances) appoints each pool's OPERATOR, who runs the pool: funds it
26
- * ({@link fPoolDeploy}), harvests, closes, sets its gate modes and its name. `getFPool` carries the policy and what
27
- * it declared (`flags`), {@link getFPoolRoles} reads the roles FROM the policy, and every setting is a write to the
28
- * policy ({@link fPoolAppointOperator}, {@link fPoolSetSwapMode}, {@link fPoolSetMintMode}, {@link fPolicySetRights}, …).
29
- * A policy has no setter of its own: a change is a new policy, approved by the registry; the key's policy is the
30
- * pool's for life.
31
- *
32
- * **Zaps live on the ROUTER, not here.** `RouterF` is F's own router and its own Permit2 spender (decision 096: one
33
- * router per manager; a second spender is a second signature, not a second on-chain approval). See
34
- * `fPoolZapIn`/`fPoolZapOut` below, which target `addresses.routerF`; a wallet's Permit2 allowance for it is
35
- * `onboardToken(c, "F", token, need)`.
36
- */
37
1
  import { type Address, type Hash, type Hex } from "viem";
38
2
  import { managerFAbi, policyFAbi } from "./generated.js";
39
- /**
40
- * One contract, one ABI (F version 12): `harvest`, `claim`, `close`, `deployLiquidity`, the fee list are `ManagerF`'s own
41
- * code. The roles left it for the policy in F version 15; since F 41 there is one policy contract, {@link policyFAbi}
42
- * (`PolicyF`, policy.md): every F pool's operator, gate modes and lists.
43
- */
44
3
  export { managerFAbi, policyFAbi };
45
4
  import { type LogswapClient } from "./client.js";
46
- /**
47
- * The bits a policy declares at birth, in `Pool.flags` (decision 098; `ASK_SWAP` / `ASK_MINT` before): with a gate bit off nothing is
48
- * asked; with it on the manager admits the cached operator with no policy call and asks the policy about everyone else.
49
- */
50
5
  export declare const GATE_SWAP = 1;
51
6
  export declare const GATE_MINT = 2;
52
- /** `GATE_SWAP | GATE_MINT`: the bits `setGates` carries (`SEED_TO_DEAD` is the birth's alone). */
53
7
  export declare const GATES: number;
54
- /** Everything scalar about a basket pool, in one round trip's worth of reads. */
55
8
  export interface FPoolState {
56
- /** The pool's id — the hash of its key. There is no per-pool address. */
57
9
  poolId: Hex;
58
10
  quote: Address;
59
11
  bases: Address[];
60
- /** Each base asset's fraction of the pool's `L`, WAD, summing to WAD, derived at each deployment (`weights` before decision 090). `L_j = liquidityWeight_j · L`. */
61
12
  liquidityWeights: bigint[];
62
- /** Per-asset log prices, WAD. Price is derived; `x` is the state. */
63
13
  x: bigint[];
64
- /** Quote reserve. The one leg a base→quote swap can exhaust. */
65
14
  Q: bigint;
66
- /** Total exposure. Grows on mint, shrinks on burn; never moves on a swap. */
67
15
  L: bigint;
68
- /** The swap fee, WAD: `F_FEE_LIST[key.swapFeeIdx]`, resolved by the manager at the birth (policy.md §6). Never 0: the list has no zero. */
69
16
  swapFee: bigint;
70
- /** The mint fee, WAD of newly-minted L: the list's next entry after the swap fee (the same at the top), resolved at the birth — nothing was chosen ({@link fMintFeeOf}). */
71
17
  mintFee: bigint;
72
- /** The reference log floor (`refLogFloor`): where the floor stood at the seed (re-based by a capital harvest and at each step); income is counted from it. `theta0` before F version 25. */
73
18
  refLogFloor: bigint;
74
- /** logFloor = X − Q/L, the log of the pool's current floor price: where the bid runs out. Derived, never stored. `theta` before F version 25. */
75
19
  logFloor: bigint;
76
- /** X = Σ w_j x_j, the composite index. */
77
20
  compositeX: bigint;
78
- /** This generation's income still in the pool, quote: L·(refLogFloor − logFloor). */
79
21
  unharvested: bigint;
80
- /**
81
- * The pool's one cap as a log ratio (decisions 061, 075): ln(cap price / seed price) in 1e-6 log units, set by the
82
- * generation's `deployLiquidity`; each asset's maximum price is its own seed price times it. 0 is uncapped (cap ∞).
83
- * The liquidity per unit of base value is 1/(1 − e^{−value}): {@link fPoolLeverageOfCap}.
84
- */
85
22
  lnCapOverSeed: number;
86
- /** Σ = ∫ Σ_j w_j (dx_j)², accrued even though the fee is fixed — the kernel stays calculable. */
87
23
  realizedVariance: bigint;
88
- /**
89
- * The pool's policy for life: the contract the key names, holding the pool's roles and answering every question the
90
- * manager does not decide itself. Read its roles with {@link getFPoolRoles}, its terms with {@link fPolicyTermsOf}; one
91
- * of the deployment's four ({@link fPoolPolicyFor}) on every protocol pool.
92
- */
93
24
  policy: Address;
94
- /**
95
- * What the policy declared for the pool (`Pool.flags`, decision 098): the gate bits {@link GATE_SWAP} and {@link GATE_MINT} (set by the
96
- * policy's `setGates` as the operator changes the modes) and the birth bit {@link SEED_TO_DEAD} (a pad's, the pool's for life).
97
- */
98
25
  flags: number;
99
- /**
100
- * The operator the manager caches (`Pool.operator`): the one account that funds, harvests and closes the pool, admitted by a gated swap or
101
- * mint with no policy call. The policy's `operator(poolId)`, synced at every appointment ({@link getFPoolRoles}).
102
- */
103
26
  operator: Address;
104
- /** The time (unix seconds) of the last harvest / composition action: no swap runs at that timestamp (F version 29; a block number before). */
105
27
  restructureTime: number;
106
- /** What the pool is — a label read off its POLICY's immutables; see {@link FPoolKind}. */
107
28
  kind: FPoolKind;
108
- /** False before the first `deployLiquidity` — and between a `close` and the next one (the pool is INACTIVE: listed, or closed). */
109
29
  seeded: boolean;
110
- /**
111
- * The live GENERATION (policy.md §10). The first is 0. A `close` freezes it into a bundle its shares redeem
112
- * ({@link fPoolRedeem}) and moves the counter to `gen + 1`, the generation the next {@link fPoolDeploy} opens — so an
113
- * inactive pool after a close already reads the number its next deploy will carry. The share id carries it
114
- * ({@link fPoolShareId}): generations `0 … gen-1` are claims ({@link fPoolClaimsOf}) and `gen` is the pool.
115
- */
116
30
  gen: number;
117
31
  totalSupply: bigint;
118
- /** What the pool holds of each base — the STATE; the mark `x` is derived from it. */
119
32
  reserves: bigint[];
120
- /** The reserve every price reads: `reserves[j] + L_j·κ_j` on a capped pool (061), `reserves[j]` otherwise. */
121
33
  virtualReserves: bigint[];
122
- /** κ_j = e^{−μ_j}, WAD: each leg's phantom reserve per unit of its liquidity. 0 uncapped. */
123
34
  kappa: bigint[];
124
35
  }
125
- /** Read a basket pool whole: one lens call (`pool`, F version 25) plus the policy's terms (cached per policy). The name is a log query apart: {@link fPoolNameOf}. */
126
36
  export declare function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolState>;
127
- /**
128
- * The kind of pool — a LABEL read off its policy's immutables (policy.md §4.1; the manager knows no kind, and the policy's
129
- * `kind()` says `"f"` for every instance). `public`: an `open` policy — anyone creates at salt zero, no gate ever, the
130
- * LOG runs the pool. `pad`: `seedToDead` — the deploy's shares are the pool's, a harvest takes income only, the pool never
131
- * closes. `pol`: a closed policy keeping a bid under its pools (`quoteBuffer`), a treasury's. `desk`: any other closed
132
- * policy — a sponsor's, gates by pool. The LOG's four instances are one of each ({@link fPoolPolicyFor}); a third
133
- * party's policy is whatever its terms say ({@link fPolicyKindOf}).
134
- */
135
37
  export type FPoolKind = "public" | "desk" | "pol" | "pad";
136
- /** The policy's birth-time declaration that the deploy's shares are the pool's (`seedToDead`, a pad's), in `flags`. */
137
38
  export declare const SEED_TO_DEAD = 4;
138
- /** A policy's parameters — `PolicyF`'s immutables (policy.md §4.1), set at its deployment and never changed. */
139
39
  export interface FPolicyTerms {
140
40
  policy: Address;
141
- /** The authority as deployed; zero defers to the LOG Authority of the day — {@link getFPoolRoles} reads the live answer (`authority()`). */
142
41
  fixedAuthority: Address;
143
- /** Anyone initializes; the salt must be zero; no gate is ever set on its pools. */
144
42
  open: boolean;
145
- /** The deploy's shares go to 0xdead: a pad. The pool never closes and a harvest takes income only (the manager's rule as well). */
146
43
  seedToDead: boolean;
147
- /** A harvest takes income and never capital. */
148
44
  incomeHarvestOnly: boolean;
149
- /** WAD, at most the manager's `INCOME_TAX_MAX`: the tax on the payer's slice of each harvest's income (§8). */
150
45
  incomeTaxRate: bigint;
151
- /** The entries of {@link F_FEE_LIST} a pool may be born with, a bit per index; 0 lists all eight ({@link fFeesAllowed}). */
152
46
  feeMask: number;
153
- /** Legs per pool, 1..8. */
154
47
  lenMax: number;
155
- /** Millionths of ln(cap / seed price): the least distance a cap may sit above the seed price; 0 allows any cap, none included (§7). */
156
48
  lnCapMin: number;
157
- /** WAD, a multiple of L: the bid a deploy must bring and a harvest must leave. */
158
49
  quoteBuffer: bigint;
159
- /** The policy lists the quotes a pool may be born on (`quoteListed`); false: any quote. */
160
50
  quoteCurated: boolean;
161
- /** The policy lists the bases a pool may hold (`baseListed`); false: any base. */
162
51
  baseCurated: boolean;
163
- /** The label the terms spell: {@link fPolicyKindOf}. */
164
52
  kind: FPoolKind;
165
53
  }
166
- /** The label a policy's terms spell (see {@link FPoolKind}). Pure. */
167
54
  export declare function fPolicyKindOf(t: Pick<FPolicyTerms, "open" | "seedToDead" | "quoteBuffer">): FPoolKind;
168
- /**
169
- * A policy's terms, read once per policy address and cached for the client's chain (the policies sit at one address on
170
- * every release chain): every field is an immutable, so the first read is the last. A failed read is not cached.
171
- */
172
55
  export declare function fPolicyTermsOf(c: LogswapClient, policy: Address): Promise<FPolicyTerms>;
173
- /** What a policy IS, as a label: {@link fPolicyTermsOf}'s `kind`. One read per policy address, cached. */
174
56
  export declare function fPoolKindOfPolicy(c: LogswapClient, policy: Address): Promise<FPoolKind>;
175
- /**
176
- * The pool's label — the last `NameSet` its policy emitted for it: the operator's word, mutable, never identity. Nothing is
177
- * stored on chain (policy.md §4.3), so this is a log query — pass `indexer`, or set the client's. "" when never named.
178
- */
179
57
  export declare function fPoolNameOf(c: LogswapClient, poolId: Hex, opts?: {
180
58
  policy?: Address;
181
59
  fromBlock?: bigint;
182
60
  indexer?: string;
183
61
  }): Promise<string>;
184
- /**
185
- * The deployment's named policies (its artifact keys): the LOG's four `PolicyF` instances — `public` (open: anyone creates at
186
- * salt zero, no gate ever), `private` (the LOG's desk: closed, gates by pool), `pol`, `pad`. The keys predate the one-contract
187
- * policy and are kept.
188
- */
189
62
  export type FPolicySlot = "public" | "private" | "pol" | "pad";
190
- /** The deployment's policy for a slot — the one a key names when no `policy` is given. */
191
63
  export declare function fPoolPolicyFor(c: LogswapClient, slot: FPolicySlot): Address;
192
- /** The policy a pool named in its key — one read; {@link getFPool} carries it too. */
193
64
  export declare function fPoolPolicyOf(c: LogswapClient, poolId: Hex): Promise<Address>;
194
- /**
195
- * A pool's roles, as its POLICY holds them (policy.md §2). The AUTHORITY is the policy's — one address per policy, immutable,
196
- * the LOG Authority of the day on the LOG's own instances — and appoints the pool's OPERATOR (zero resets it to the authority),
197
- * who runs the pool: `deployLiquidity`, `harvest`, `close`, the two gate modes, the name; the operator pays the seed and holds
198
- * its shares. The modes are the pool's; the lists they consult are the policy's ({@link fPolicyRightsOf}).
199
- */
200
65
  export interface FPoolRoles {
201
66
  policy: Address;
202
- /** The policy's authority now (`authority()`): its immutable, or the registry's LOG Authority when that is zero. */
203
67
  authority: Address;
204
- /** The pool's operator (`operator(poolId)`): the authority at birth until re-appointed. Zero: the policy never held this pool. */
205
68
  operator: Address;
206
- /** Swap admission: everyone (`open`), the policy's swap list (`listed`; the operator always passes) or the operator alone. Always `open` under an open policy. */
207
69
  swapMode: FPoolMode;
208
- /** Mint admission, at least as restrictive as the swap mode (`ModeOrder`): the same three, the mint list in `listed`. */
209
70
  mintMode: FPoolMode;
210
71
  }
211
- /** `IPolicyF.Mode`: Open = 0, Listed = 1, Operator = 2 — the order `open < listed < operator` is what `mintMode ≥ swapMode` compares. */
212
72
  export type FPoolMode = "open" | "listed" | "operator";
213
- /** The gate modes in `IPolicyF.Mode` order — the index is the on-chain ordinal. */
214
73
  export declare const fPoolModes: readonly FPoolMode[];
215
- /** Read a pool's roles from its policy. `state` saves the `getPool` round trip when the policy is already in hand. */
216
74
  export declare function getFPoolRoles(c: LogswapClient, poolId: Hex, state?: Pick<FPoolState, "policy">): Promise<FPoolRoles>;
217
- /** 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. */
218
75
  export type FPoolShape = "launch" | "basket";
219
76
  export interface FPoolDescription {
220
- /** The pad is the launch shape, by the kind. */
221
77
  shape: FPoolShape;
222
78
  legs: number;
223
- /** True when the pool holds no quote: an all-base resting ask. base→quote is the one blocked path. */
224
79
  atFloor: boolean;
225
- /**
226
- * This generation's fee income still in the pool, quote: `L·(refLogFloor − logFloor)` (F version 14 —
227
- * `feePerL` before, per unit L). A harvest of capital moves the reference floor, so this counts
228
- * from the first wei after it.
229
- */
230
80
  unharvested: bigint;
231
- /** What a harvest takes with `extra` 0: the income, at most the bid. */
232
81
  income: bigint;
233
- /** The most capital a harvest may take beside the income (`extra`): `Q − income − quoteBuffer·L`; 0 under an income-only policy and on a pad ({@link fPoolHarvestRoom}). */
234
82
  capitalRoom: bigint;
235
- /** The most a harvest may take now, income and capital: `income + capitalRoom`. */
236
83
  harvestable: bigint;
237
84
  }
238
- /**
239
- * What a harvest may take now (policy.md §9): the income `I = min(unharvested, Q)` always; capital on top of it up to
240
- * `Q − I − quoteBuffer·L` (`QuoteTooThin` past it), none where the policy is income-only (`IncomeOnly`) or the pool a pad
241
- * (`SEED_TO_DEAD`: the manager's own rule, `HarvestLimit`). Nothing on an unfunded pool.
242
- */
243
85
  export declare function fPoolHarvestRoom(s: Pick<FPoolState, "Q" | "L" | "unharvested" | "flags">, t: Pick<FPolicyTerms, "incomeHarvestOnly" | "quoteBuffer">): {
244
86
  income: bigint;
245
87
  capital: bigint;
246
88
  };
247
89
  export declare function describeFPool(c: LogswapClient, s: FPoolState): Promise<FPoolDescription>;
248
- /** `p_j = e^{x_j}`, lossy the way any float conversion is. Compare in log space when it matters. */
249
90
  export declare function fPoolPriceOf(x: bigint, scale?: number): number;
250
- /**
251
- * Value per share at the pool's own marks, WAD. Uncapped, `V = L + Q`. Capped (decisions 061), leg
252
- * j's base is worth `L_j·R_j/R̃_j`, less than `L_j` by the phantom the cap removed — the lens's
253
- * `shareValue`, without the call.
254
- */
255
91
  export declare function fPoolShareValue(s: FPoolState): bigint;
256
92
  export interface FPoolSwapArgs {
257
93
  poolId: Hex;
258
- /** Leg index into `bases`. */
259
94
  j: number;
260
95
  amountIn: bigint;
261
- /**
262
- * The least the swap must return. Required: an F swap is exact-in, and without a floor on the
263
- * output a front-run takes the difference. {@link fPoolQuoteSwap} is exact; bound it with
264
- * {@link withSlippage} (`"output"`).
265
- */
266
96
  minOut: bigint;
267
- /** Who receives the out leg. Defaults to the account. */
268
97
  to?: Address;
269
- /** Absolute unix seconds. Defaulted to a bounded window, as every router write is. */
270
98
  deadline?: bigint;
271
99
  account: Address;
272
100
  }
273
101
  export declare function fPoolSwapQuoteIn(c: LogswapClient, a: FPoolSwapArgs): Promise<`0x${string}`>;
274
102
  export declare function fPoolSwapBaseIn(c: LogswapClient, a: FPoolSwapArgs): Promise<`0x${string}`>;
275
- /**
276
- * Base j → base k. Needs no quote, works at Q = 0, and cannot cross the floor: X is held
277
- * exactly up to the in-kind fee. Note it moves BOTH quote prices — p_j down, p_k up — because the
278
- * pool has one coordinate per asset and every trade moves at least one.
279
- */
280
103
  export declare function fPoolSwapBaseForBase(c: LogswapClient, a: FPoolSwapArgs & {
281
104
  k: number;
282
105
  }): Promise<`0x${string}`>;
283
- /** Deposit dL/L of every reserve, receive shares ∝ dL. logFloor is untouched by construction. */
284
- export declare function fPoolMint(c: LogswapClient,
285
- /** `maxQuoteIn` is required: the quote leg is Q·dL/L at landing, and Q moves with every swap. */
286
- a: {
106
+ export declare function fPoolMint(c: LogswapClient, a: {
287
107
  poolId: Hex;
288
108
  dL: bigint;
289
109
  maxQuoteIn: bigint;
290
110
  account: Address;
291
111
  to?: Address;
292
112
  }): Promise<`0x${string}`>;
293
- /**
294
- * Burn shares for the pro-rata slice of every reserve. Available at any Q, and after dissolution.
295
- * By owner: the account burns its own shares; an
296
- * operator may pass another owner's address, as on the C manager's `burnById`.
297
- */
298
- export declare function fPoolBurn(c: LogswapClient,
299
- /** `minQuoteOut` is required: the quote slice is Q·shares/S at landing. See {@link fPoolPreviewBurn}. */
300
- a: {
113
+ export declare function fPoolBurn(c: LogswapClient, a: {
301
114
  poolId: Hex;
302
115
  shares: bigint;
303
116
  minQuoteOut: bigint;
304
117
  account: Address;
305
118
  owner?: Address;
306
119
  }): Promise<`0x${string}`>;
307
- /**
308
- * What burning `shares` returns at today's state — the manager's own arithmetic: every reserve and
309
- * the quote pro rata, rounded down (FPoolManager.burn). Exact until the next swap or mint.
310
- */
311
120
  export declare function fPoolPreviewBurn(st: Pick<FPoolState, "Q" | "reserves" | "totalSupply">, shares: bigint): {
312
121
  quoteOut: bigint;
313
122
  basesOut: bigint[];
314
123
  };
315
- /**
316
- * The quote {@link fPoolMint} pulls for `dL` at today's state: Q·dL/L, rounded up (the pool never
317
- * under-collects), before any mint fee — so bound it with {@link withSlippage} (`"input"`).
318
- */
319
124
  export declare function fPoolPreviewMintQuote(st: Pick<FPoolState, "Q" | "L">, dL: bigint): bigint;
320
- /**
321
- * Quote needed to zap into exposure `dL`. An UPPER bound: buying each leg raises its mark, so the
322
- * mint consumes less base than was bought for it and every zap ends with a refund. Size from this
323
- * and expect change back — do not treat it as exact.
324
- */
325
125
  export declare function fPoolPreviewZapIn(c: LogswapClient, poolId: Hex, dL: bigint): Promise<bigint>;
326
- /**
327
- * Buy `dL` of the basket with quote alone.
328
- *
329
- * The imbalanced part goes through the pool's own curve before anything is minted. That is not a
330
- * penalty: minting against a quote-only deposit would be a zero-slippage, zero-fee swap at stale
331
- * spot, paid for by the existing LPs. Routing it through
332
- * the curve deletes the subsidy and hands the fee and impact to the incumbents instead.
333
- */
334
126
  export declare function fPoolZapIn(c: LogswapClient, a: {
335
127
  poolId: Hex;
336
128
  dL: bigint;
@@ -340,16 +132,7 @@ export declare function fPoolZapIn(c: LogswapClient, a: {
340
132
  account: Address;
341
133
  deadline?: bigint;
342
134
  }): Promise<`0x${string}`>;
343
- /**
344
- * Sell shares into ONE token — the quote, or any base.
345
- *
346
- * Into a base the other legs route through `swapBaseForBase`, which needs no quote and cannot
347
- * cross the floor; only the burn's own quote slice touches the quote leg. Into the quote every
348
- * base leg is sold, which is the one path a drained quote leg can block.
349
- */
350
- export declare function fPoolZapOut(c: LogswapClient,
351
- /** `minOut` is required: the sale routes every leg through the curve. See {@link fPoolPreviewZapOut}. */
352
- a: {
135
+ export declare function fPoolZapOut(c: LogswapClient, a: {
353
136
  poolId: Hex;
354
137
  shares: bigint;
355
138
  tokenOut: Address;
@@ -358,29 +141,14 @@ a: {
358
141
  account: Address;
359
142
  deadline?: bigint;
360
143
  }): Promise<`0x${string}`>;
361
- /**
362
- * What {@link fPoolZapOut} returns at today's state: the router's own `zapOut`, simulated as the
363
- * holder with no bound. Exact, but it needs what the real call needs — the shares, and the router
364
- * as the holder's ERC-6909 operator — so it throws where the zap-out itself would revert.
365
- */
366
144
  export declare function fPoolPreviewZapOut(c: LogswapClient, a: {
367
145
  poolId: Hex;
368
146
  shares: bigint;
369
147
  tokenOut: Address;
370
148
  account: Address;
371
149
  }): Promise<bigint>;
372
- /**
373
- * Roll a retired generation's bundle into the pool's live one, on the
374
- * router under one lock: redeem `shares` of generation `gen` in place — the legs, the quote and
375
- * any unpulled dividend come back — buy through the pool's own curve only what the live
376
- * generation's ratio lacks, mint `dL` of it to `to`, and refund the rest in kind. Quote the
377
- * bundle does not cover is pulled from the payer, at most `maxQuoteIn`; surplus base is
378
- * refunded, never sold. Size `dL` with {@link fPoolPreviewRollIn}. The router must be the
379
- * caller's ERC-6909 operator ({@link approveRouterForFPool}).
380
- */
381
150
  export declare function fPoolRollIn(c: LogswapClient, a: {
382
151
  poolId: Hex;
383
- /** the retired generation whose shares roll */
384
152
  gen: bigint | number;
385
153
  shares: bigint;
386
154
  dL: bigint;
@@ -390,41 +158,17 @@ export declare function fPoolRollIn(c: LogswapClient, a: {
390
158
  account: Address;
391
159
  deadline?: bigint;
392
160
  }): Promise<`0x${string}`>;
393
- /**
394
- * The roll `holder`'s `shares` of retired generation `gen` fund into the live one WITHOUT a
395
- * trade: the largest `dL` the bundle's base covers on every leg, and the quote the bundle is
396
- * short of (pass it as `maxQuoteIn`) or over (refunded — the up direction's distribution) at
397
- * that `dL`. A leg the live generation admitted since makes `dL` zero: such a roll must buy, so
398
- * size it below with `previewZapIn` in mind. Zero for the live generation, or before the next
399
- * seed.
400
- */
401
161
  export declare function fPoolPreviewRollIn(c: LogswapClient, poolId: Hex, gen: bigint | number, holder: Address, shares: bigint): Promise<{
402
162
  dL: bigint;
403
163
  quoteShort: bigint;
404
164
  quoteExcess: bigint;
405
165
  }>;
406
- /**
407
- * Harvest (policy.md §9): take this generation's income — `L·(refLogFloor − logFloor)`, the fees since the floor was last
408
- * referenced — and `extra` of capital on top of it, out of the bid; price-neutral, no base moves. Both accrue as a DIVIDEND to
409
- * every share, settled lazily on each holder's next transfer, mint or burn or pulled with {@link fPoolClaim}; the income is taxed
410
- * on the payer's slice (the operator's; 0xdead's on a pad, whose net slice goes to the operator) at the policy's `incomeTaxRate`.
411
- * The operator's own settled dividend — this harvest's and anything pending — is paid to `to` in the same call: one transaction,
412
- * and the operator (usually a contract) routes the payout through `to`. The operator's alone (`NotOperator`). `extra` must fit the
413
- * room ({@link fPoolHarvestRoom}): 0 on a pad (`HarvestLimit`) and under an income-only policy (`IncomeOnly`), within the buffer
414
- * otherwise (`QuoteTooThin`).
415
- */
416
166
  export declare function fPoolHarvest(c: LogswapClient, a: {
417
167
  poolId: Hex;
418
168
  extra?: bigint;
419
169
  to?: Address;
420
170
  account: Address;
421
171
  }): Promise<`0x${string}`>;
422
- /**
423
- * Pull an owner's settled dividend on a generation's shares without moving them;
424
- * anyone with shares. `gen` defaults to the live generation; a retired generation's harvests
425
- * stay claimable under its own id. By owner (F 42), as {@link fPoolBurn} and {@link fPoolRedeem}: the account claims its
426
- * own, and an ERC-6909 operator may pass another `owner`. Paid to `to` (the account by default).
427
- */
428
172
  export declare function fPoolClaim(c: LogswapClient, a: {
429
173
  poolId: Hex;
430
174
  gen?: bigint | number;
@@ -432,30 +176,13 @@ export declare function fPoolClaim(c: LogswapClient, a: {
432
176
  to?: Address;
433
177
  account: Address;
434
178
  }): Promise<`0x${string}`>;
435
- /**
436
- * A holder's claimable dividend as of now on generation `gen` (the live one by default) — banked
437
- * plus pending on the current balance; under a lien, the free fraction's only: the locked
438
- * fraction's is the lien's ({@link fPoolLienOf}, decisions 063).
439
- */
440
179
  export declare function fPoolDividendOf(c: LogswapClient, poolId: Hex, holder: Address, gen?: bigint | number): Promise<bigint>;
441
- /** A lien on one share id: the locker, the amount locked, and the dividend the lien holds (banked). */
442
180
  export interface FPoolLien {
443
181
  locker: Address;
444
182
  amount: bigint;
445
183
  owed: bigint;
446
184
  }
447
- /**
448
- * The lien on `owner`'s shares of `poolId`'s generation `gen` (the live one by default). `owed` counts
449
- * what has been banked into it; the locked fraction of the owner's pending since its last bank is
450
- * not yet in it — {@link fPoolBankLien} banks it.
451
- */
452
185
  export declare function fPoolLienOf(c: LogswapClient, poolId: Hex, owner: Address, gen?: bigint | number): Promise<FPoolLien>;
453
- /**
454
- * Lock `amount` of `owner`'s shares for the caller, the locker (`account`). Paid with the owner's
455
- * per-id allowance to the locker — the owner first sends `approve(locker, shareId, amount)` on the
456
- * F manager ({@link fPoolApproveShares}) — or an operator grant. One locker per (id, owner) while a
457
- * lien stands. In practice the lending contract calls `lock` itself; this is the EOA path.
458
- */
459
186
  export declare function fPoolLock(c: LogswapClient, a: {
460
187
  poolId: Hex;
461
188
  owner: Address;
@@ -463,11 +190,6 @@ export declare function fPoolLock(c: LogswapClient, a: {
463
190
  gen?: bigint | number;
464
191
  account: Address;
465
192
  }): Promise<`0x${string}`>;
466
- /**
467
- * The locker's `unlock`: `amount` of the lien lifted with its share of the lien's dividend, credited
468
- * to `to` — the owner (a release) or anyone else (a seizure, the shares moving to `to`). It banks
469
- * first. The locker's alone.
470
- */
471
193
  export declare function fPoolUnlock(c: LogswapClient, a: {
472
194
  poolId: Hex;
473
195
  owner: Address;
@@ -476,14 +198,12 @@ export declare function fPoolUnlock(c: LogswapClient, a: {
476
198
  gen?: bigint | number;
477
199
  account: Address;
478
200
  }): Promise<`0x${string}`>;
479
- /** Bank the owner's pending into the lien now — `unlock(id, owner, 0, owner)`: dividends bank lazily. The locker's. */
480
201
  export declare function fPoolBankLien(c: LogswapClient, a: {
481
202
  poolId: Hex;
482
203
  owner: Address;
483
204
  gen?: bigint | number;
484
205
  account: Address;
485
206
  }): Promise<`0x${string}`>;
486
- /** The owner's per-id allowance to a locker on the F manager's ERC-6909 shares — what `lock` spends. */
487
207
  export declare function fPoolApproveShares(c: LogswapClient, a: {
488
208
  poolId: Hex;
489
209
  spender: Address;
@@ -491,34 +211,20 @@ export declare function fPoolApproveShares(c: LogswapClient, a: {
491
211
  gen?: bigint | number;
492
212
  account: Address;
493
213
  }): Promise<`0x${string}`>;
494
- /** Plain ERC-20 approval to the F manager — the allowance every DIRECT call pulls against. */
495
214
  export declare function approveTokenForFPoolManager(c: LogswapClient, token: Address): Promise<Hash>;
496
- /** Does `owner` have enough allowance on `token` for the MANAGER to pull `need`? */
497
215
  export declare function fPoolManagerAllowanceOk(c: LogswapClient, token: Address, owner: Address, need: bigint): Promise<boolean>;
498
216
  export declare function isRouterOperatorForFPool(c: LogswapClient, owner: Address): Promise<boolean>;
499
- /** Approve the router to move this account's F-pool shares. Needed once, before any `fPoolZapOut`. */
500
217
  export declare function approveRouterForFPool(c: LogswapClient, account: Address): Promise<`0x${string}`>;
501
- /**
502
- * The ERC-6909 id carrying generation `gen` of a pool's shares: bit 255 set (the
503
- * share flag), the pool id's top 239 bits, the generation in the low 16. Each generation's shares
504
- * are their own asset — a retired one is a claim on its bundle, the live one on the pool.
505
- */
506
218
  export declare function fPoolShareId(poolId: Hex, gen?: bigint | number): bigint;
507
- /** The generation a share id carries — its low 16 bits. */
508
219
  export declare function fPoolGenOfShareId(id: bigint): number;
509
- /** The pool's live generation, one read. */
510
220
  export declare function fPoolGen(c: LogswapClient, poolId: Hex): Promise<number>;
511
- /** The ERC-6909 id carrying claims on a token. Bit 255 clear, so it can never meet a share id. */
512
221
  export declare function fPoolClaimId(token: Address): bigint;
513
- /** A holder's shares of generation `gen` — the live one by default. */
514
222
  export declare function fPoolShareBalance(c: LogswapClient, poolId: Hex, owner: Address, gen?: bigint | number): Promise<bigint>;
515
- /** A retired generation's bundle: what is left to redeem — supply, quote, base per leg index. */
516
223
  export declare function fPoolBundleOf(c: LogswapClient, poolId: Hex, gen: bigint | number): Promise<{
517
224
  supply: bigint;
518
225
  quote: bigint;
519
226
  base: bigint[];
520
227
  }>;
521
- /** A holder's claim on one retired generation, as the lens reports it: what `redeem` pays now. */
522
228
  export interface FPoolClaimRow {
523
229
  gen: number;
524
230
  shares: bigint;
@@ -526,13 +232,7 @@ export interface FPoolClaimRow {
526
232
  quote: bigint;
527
233
  dividend: bigint;
528
234
  }
529
- /** A holder's claims on a pool's retired generations — one row per generation still held. */
530
235
  export declare function fPoolClaimsOf(c: LogswapClient, poolId: Hex, owner: Address): Promise<FPoolClaimRow[]>;
531
- /**
532
- * Redeem `shares` of a RETIRED generation: its bundle, pro rata — the base per
533
- * leg and the quote — plus the owner's settled dividend. Not `burn`: nothing can move a bundle's
534
- * ratio, so there is no slippage to bound. The owner, or an operator of theirs.
535
- */
536
236
  export declare function fPoolRedeem(c: LogswapClient, a: {
537
237
  poolId: Hex;
538
238
  gen: bigint | number;
@@ -546,14 +246,6 @@ export declare enum FPoolQuoteKind {
546
246
  BaseIn = 1,
547
247
  BaseForBase = 2
548
248
  }
549
- /**
550
- * An EXACT quote — what execution returns, not an estimate.
551
- *
552
- * `quoteSwap` runs the real swap and reverts with the answer, so the value has to be decoded out
553
- * of the revert rather than returned. That is the point of the pattern: there is no second pricing
554
- * path to drift from the first. It needs no tokens, no approvals and no balance, so it works from
555
- * a disconnected wallet — unlike `fPoolPreviewZapIn`, which is a genuine upper bound.
556
- */
557
249
  export declare function fPoolQuoteSwap(c: LogswapClient, a: {
558
250
  poolId: Hex;
559
251
  kind: FPoolQuoteKind;
@@ -564,78 +256,39 @@ export declare function fPoolQuoteSwap(c: LogswapClient, a: {
564
256
  }): Promise<bigint>;
565
257
  export interface FPoolCreateArgs {
566
258
  quote: Address;
567
- /** The pool's assets, in any order; sorted into the key's canonical order before the call. The set is fixed for the pool's life. */
568
259
  bases: Address[];
569
- /** The swap fee as its index into {@link F_FEE_LIST} (policy.md §6); the mint fee is the list's next entry, nothing to choose. One of this or `swapFee`. */
570
260
  swapFeeIdx?: number;
571
- /** The swap fee, WAD — one of the list's eight values ({@link fFeeIndexOf} throws otherwise); the index is what the key carries. */
572
261
  swapFee?: bigint;
573
- /**
574
- * Which of the deployment's policies the key names when `policy` is not given ({@link fPoolPolicyFor}). NOT a key
575
- * field (decisions 049: the manager knows no kind): the policy is, and its terms say what it is ({@link FPoolKind}).
576
- */
577
262
  kind: FPolicySlot;
578
- /**
579
- * The pool's policy for life: the contract the key names, approved by the registry (`PolicyNotApproved`). Defaults to the
580
- * deployment's policy for `kind`. An open policy admits anyone; a closed one its authority alone (`Refused`). The policy's
581
- * authority is the pool's operator at birth: the one account that then funds it ({@link fPoolDeploy}).
582
- */
583
263
  policy?: Address;
584
- /**
585
- * The differentiator, and nothing else. Identity is the key's hash, so a sponsor cannot run two pools of the same shape
586
- * without varying it — the second `initialize` would land on the first pool's id. Zero under an open policy (`NotCanonical`):
587
- * one public pool per shape and swap fee. Defaults to zero. A pool's NAME is not this: names are events on the policy
588
- * ({@link fPoolSetName}), so a rename forks nothing.
589
- */
590
264
  salt?: Hex;
591
265
  account: Address;
592
266
  }
593
- /** `FeeParams.FEE_LIST` in bp: the eight swap fees an F pool may be born with. The key carries the index. */
594
267
  export declare const F_FEE_LIST_BP: readonly [1, 2, 5, 10, 20, 50, 100, 200];
595
- /** The list in WAD (1 bp = 1e14). No zero: the fee-free pool cannot be born. */
596
268
  export declare const F_FEE_LIST: readonly bigint[];
597
- /** The fee at `idx` of the list, WAD. Throws off the list. */
598
269
  export declare function fFeeOf(idx: number): bigint;
599
- /** The mint fee's index for a swap fee's: the next entry, the same at the top (`FeeParams.mintIdx`). Every pair has `mintFee ≥ 2·swapFee` but the top's (200 → 200 bp). */
600
270
  export declare function fMintFeeIdxOf(swapFeeIdx: number): number;
601
- /** The mint fee, WAD of newly-minted L, a pool born at `swapFeeIdx` charges on outside mints. */
602
271
  export declare function fMintFeeOf(swapFeeIdx: number): bigint;
603
- /** The list index of a WAD fee. Throws when the fee is not one of the eight: no F pool can be born at it. */
604
272
  export declare function fFeeIndexOf(fee: bigint): number;
605
- /** Whether a policy's `feeMask` admits `idx`: a bit per index, an empty mask admitting all eight. */
606
273
  export declare function fFeeListed(feeMask: number, idx: number): boolean;
607
- /** The indices a policy's `feeMask` admits, ascending. */
608
274
  export declare function fFeesAllowed(feeMask: number): number[];
609
- /** The swap fee index of create arguments given either way; both given must agree. */
610
275
  export declare function fPoolSwapFeeIdxOf(a: {
611
276
  swapFeeIdx?: number;
612
277
  swapFee?: bigint;
613
278
  }): number;
614
- /** `bytes32` ⇄ short UTF-8 text, for the pool and sponsor labels. */
615
279
  export declare function textToBytes32(text: string): Hex;
616
280
  export declare function bytes32ToText(word: Hex): string;
617
- /** Sort legs by base address (the key's canonical order), carrying companion arrays along. */
618
281
  export declare function sortFPoolLegs<T>(bases: Address[], ...companions: T[][]): {
619
282
  bases: Address[];
620
283
  companions: T[][];
621
284
  };
622
- /**
623
- * The tuple an F pool's id hashes — `src/types/PoolKeyF.sol`, field order load-bearing (it is the ABI encoding order).
624
- * Stored by the manager at `initialize` and never in calldata again. No creator, no mint fee, no weights and no cap
625
- * (policy.md §5): both fees follow from `swapFeeIdx`, the book belongs to a generation's `deployLiquidity`.
626
- */
627
285
  export interface FPoolKey {
628
286
  quote: Address;
629
- /** Sorted ascending, unique, 1..8; fixed for the pool's life. */
630
287
  bases: Address[];
631
- /** Into {@link F_FEE_LIST}; the mint fee is the next entry ({@link fMintFeeIdxOf}). */
632
288
  swapFeeIdx: number;
633
- /** The pool's policy for life. */
634
289
  policy: Address;
635
- /** Zero under an open policy. */
636
290
  salt: Hex;
637
291
  }
638
- /** The key's ABI as `abi.encode(key)` lays it out: what {@link fPoolIdOfKey} hashes. */
639
292
  export declare const F_POOL_KEY_ABI: readonly [{
640
293
  readonly type: "tuple";
641
294
  readonly components: readonly [{
@@ -655,97 +308,38 @@ export declare const F_POOL_KEY_ABI: readonly [{
655
308
  readonly type: "bytes32";
656
309
  }];
657
310
  }];
658
- /**
659
- * An F pool's id: `keccak256(abi.encode(key))`, offline — what `initialize` computes inline. The
660
- * manager's `idOf` getter was cut in F version 21; this is the same hash (checked against Foundry's encoder in the
661
- * tests). The key must be the one the pool was initialized with: bases sorted ({@link fPoolKeyOf} sorts them).
662
- */
663
311
  export declare function fPoolIdOfKey(key: FPoolKey): Hex;
664
- /** The key as the manager hashes it: bases sorted, the fee as its index, the slot's policy filled in when none is named. No kind in it (049). */
665
312
  export declare function fPoolKeyOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): FPoolKey;
666
- /**
667
- * List the pool — `initialize(key)` (policy.md §9): no funds move; the pool is inactive until its operator funds it
668
- * ({@link fPoolDeploy}). Anyone under an open policy (salt zero), the policy's authority alone under a closed one
669
- * (`Refused`); refused past the policy's sunset (`PolicyNotApproved`), off the policy's fee mask (`FeeNotListed`), quote or
670
- * base list (`QuoteNotListed`, `BaseNotListed`), or with more legs than it allows (`TooManyLegs`). Returns the tx hash;
671
- * read the id with {@link fPoolIdOf}.
672
- */
673
313
  export declare function fPoolInitialize(c: LogswapClient, a: FPoolCreateArgs): Promise<`0x${string}`>;
674
- /**
675
- * The pool id is the key's hash — pure, so it can be read before or after creation. Computed
676
- * locally since F version 21 ({@link fPoolIdOfKey}; the manager's `idOf` is gone): no RPC. Still
677
- * async, so callers written against the read keep working.
678
- */
679
314
  export declare function fPoolIdOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): Promise<Hex>;
680
- /**
681
- * Rebuild a live pool's KEY from its id: the `PoolCreated` log carries every field, the salt included (F 41). The result
682
- * is checked against the id.
683
- */
684
315
  export declare function fPoolKeyOfPool(c: LogswapClient, poolId: Hex, opts?: {
685
- fromBlock?: bigint; /** The rindexer GraphQL endpoint: `PoolCreated` from there, the node otherwise. */
316
+ fromBlock?: bigint;
686
317
  indexer?: string;
687
318
  }): Promise<FPoolKey>;
688
- /**
689
- * The reserve a leg holds at a mark: `R = Lj·e^{−x}`, WAD math. A deployment names the TOTAL base
690
- * reserve and the price that values it, and the price follows from the pair, `p = Lj / R` — so this is
691
- * the one conversion from a wanted mark to what the pool will hold, done here, on the way in. Float
692
- * precision (~1e-16 relative) is what a deployment needs: any reserve is legal, and the mark
693
- * the pool derives from it is the one the sponsor meant to within that.
694
- */
695
319
  export declare function fPoolReserveAt(Lj: bigint, x: bigint, k?: number): bigint;
696
- /**
697
- * The cap constant k = e^{−lnCapOverSeed} (decisions 061, 075): every leg's phantom is c_j = r_j·k/(1 − k), and the
698
- * generation's liquidity is its base value over 1 − k. 0 on an uncapped pool. It no longer depends on the bid:
699
- * the cap is a ratio of the cap price to each asset's own seed price.
700
- */
701
320
  export declare function fPoolCapK(lnCapOverSeed: number): number;
702
- /**
703
- * The pool's `lnCapOverSeed` = ln(cap price / seed price) (1e-6 log units) for a leverage λ: ln(λ/(λ − 1))
704
- * (decisions 061), so λ = 1/(1 − seed/cap) = L / (base value) and the cap sits λ/(λ − 1) × the seed price — λ = 2
705
- * puts it at twice. **λ = 1 is uncapped**: cap ∞, `lnCapOverSeed` 0. A λ under 1, or one so close to
706
- * 1 (or so large) that d leaves a uint24 of 1e-6 units, is refused.
707
- */
708
321
  export declare function fPoolCapOfLeverage(lambda: number): number;
709
- /** The leverage λ = 1/(1 − e^{−x}) for x = `lnCapOverSeed` (1e-6 log units); 1 for an uncapped pool (cap ∞). */
710
322
  export declare function fPoolLeverageOfCap(lnCapOverSeed: number): number;
711
- /** A pool's leverage, ready to tag: `capped` false and `capOverSeed` Infinity for an uncapped pool. */
712
323
  export interface FPoolLeverage {
713
- /** λ at the seed; exactly 1 when uncapped. */
714
324
  lambda: number;
715
325
  capped: boolean;
716
- /** The cap's price over the seed's, e^d = λ/(λ − 1): 2 at λ = 2; Infinity when uncapped. */
717
326
  capOverSeed: number;
718
- /** "1×" uncapped; otherwise λ to two decimals, trailing zeros dropped ("2×", "1.5×"), never "1×" for a capped pool ("1.01×" at least shown as "≈1×"). */
719
327
  label: string;
720
328
  }
721
- /**
722
- * The leverage tag of a pool from its `lnCapOverSeed` (decisions 061): `1×` means no cap — the only way a tag
723
- * reads 1× — and a capped pool always reads above it, so the two can never be confused on screen.
724
- */
725
329
  export declare function fPoolLeverage(lnCapOverSeed: number): FPoolLeverage;
726
- /** The `lnCapOverSeed` from deployment args: as given, else from `leverage`, else 0 (uncapped, cap ∞). Both given and disagreeing is refused. */
727
330
  export declare function fPoolCapOfArgs(a: {
728
331
  lnCapOverSeed?: number;
729
332
  leverage?: number;
730
333
  }): number;
731
- /**
732
- * One entry of `deployLiquidity`'s input (F 38, decision 084): the TOTAL base reserve the asset has after the call
733
- * (0 leaves it out) and the price that values it, quote atomic units per base atomic unit, 1e36-scaled.
734
- */
735
334
  export interface BaseAsset {
736
335
  base: Address;
737
336
  amount: bigint;
738
337
  priceX36: bigint;
739
338
  }
740
- /** The book a deployment names, from the sponsor's terms: weights, total liquidity `L0`, and either the wanted marks `x0` or the reserves `r0`. */
741
339
  export type FPoolBookSpec = {
742
- /** The pool's assets, in any order; the result is sorted into the key's order. */
743
340
  bases: Address[];
744
- /** WAD, one per asset, summing to 1e18; 0 leaves the asset out (not in generation 0). `L_j = w_j · L0`. */
745
341
  weights: bigint[];
746
- /** The book's total liquidity, quote units. */
747
342
  L0: bigint;
748
- /** The pool's one cap, or the leverage it stands for; absent is uncapped. */
749
343
  lnCapOverSeed?: number;
750
344
  leverage?: number;
751
345
  } & ({
@@ -753,47 +347,12 @@ export type FPoolBookSpec = {
753
347
  } | {
754
348
  r0: bigint[];
755
349
  });
756
- /**
757
- * The `baseAssets` (and cap) a deployment sends for a wanted book — what the old seed did with reserves and
758
- * marks, as the amounts and prices the manager takes now. Per asset: the reserve `r_j` (given as `r0`, or
759
- * {@link fPoolReserveAt} the wanted mark `x0`) and the price that makes its value `L_j · (1 − k)`:
760
- * `priceX36 = ceil(L_j(1 − k) · 1e36 / r_j)`. A zero weight is an asset left out. Sorted by base address, the
761
- * key's order, with the companions carried along.
762
- */
763
350
  export declare function fPoolBook(a: FPoolBookSpec): {
764
351
  baseAssets: BaseAsset[];
765
352
  lnCapOverSeed: number;
766
353
  };
767
- /**
768
- * The allocation a `deployLiquidity` book implies: asset `j`'s value `amount_j · priceX36_j / 1e36` over the sum,
769
- * normalized as the manager does it (cumulative shares, floored), so the weights sum to exactly 1e18. A zero-value
770
- * book has no allocation (`[]`). What an indexer derives from `LiquidityDeployed` instead of reading the weights.
771
- */
772
354
  export declare function fPoolBookWeights(baseAssets: readonly BaseAsset[]): bigint[];
773
- /**
774
- * The book's total liquidity `L` from a `LiquidityDeployed` input: the values' sum over `1 − k`, `k = e^{−cap}`.
775
- * Exact when uncapped; with a cap it carries the float error of `k` (~1e-16 relative) — read the pool for the wei.
776
- */
777
355
  export declare function fPoolBookL(baseAssets: readonly BaseAsset[], lnCapOverSeed: number): bigint;
778
- /**
779
- * Put liquidity into the pool, the authority's: `deployLiquidity` (F 38, decisions 083, 084). It SETS THE BOOK:
780
- * `baseAssets[j].amount` is the total base reserve of asset `j` after the call (0 removes it), `quoteAmount` the
781
- * total bid, and the manager settles each figure against what the pool holds — a larger total is pulled from the
782
- * caller, a smaller one pushed to `to` — so one call can replace an asset by another. Pass the book outright
783
- * (`baseAssets`, `lnCapOverSeed`) or the sponsor's terms ({@link fPoolBook}: `weights`, `L0` and marks `x0` or
784
- * reserves `r0`, in any order). On an UNFUNDED pool (new, or after {@link fPoolClose}) it funds the first or the next
785
- * generation. On a LIVE pool it is a regeneration that sets the book: income settles to `to`, the policy picks the
786
- * carried holder, every other holder is frozen into the closing generation's bundle ({@link fPoolRedeem}), and the
787
- * carried book becomes the one named, at the supplied prices. A pad is forward-only ({@link fPoolRegenerate}).
788
- */
789
- /**
790
- * Fund the pool — `deployLiquidity(poolId, baseAssets, quoteAmount, lnCapOverSeed)` (policy.md §9): the book of this generation,
791
- * on an INACTIVE pool — listed and never funded, or closed (`PoolActive` otherwise). The operator's alone (`NotOperator`): it pays
792
- * every leg's amount and `quoteAmount` by plain allowance to the manager ({@link approveTokenForFPoolManager}) and holds the shares —
793
- * all but `MIN_SHARES`, which go to 0xdead; every share does on a pad. Refused past the policy's sunset (`PolicyNotApproved`),
794
- * under its buffer (`QuoteTooThin`), with a cap under its `lnCapMin` (`CapTooClose`). An amount of 0 leaves a leg dormant. Pass the
795
- * book raw (`baseAssets` + `lnCapOverSeed`) or as a {@link FPoolBookSpec}.
796
- */
797
356
  export declare function fPoolDeploy(c: LogswapClient, a: {
798
357
  poolId: Hex;
799
358
  quoteAmount: bigint;
@@ -802,24 +361,12 @@ export declare function fPoolDeploy(c: LogswapClient, a: {
802
361
  baseAssets: BaseAsset[];
803
362
  lnCapOverSeed: number;
804
363
  } | FPoolBookSpec)): Promise<`0x${string}`>;
805
- /**
806
- * Close the pool (policy.md §9) — at any bid. The manager harvests the income first (a dividend to every share, the operator's
807
- * paid to `to`), freezes every reserve and the bid into generation `gen`'s bundle — every share of it redeems pro rata
808
- * ({@link fPoolRedeem}), forever — and moves the counter to `gen + 1`, the generation the next {@link fPoolDeploy} opens under
809
- * the same id, policy, roles and gates. The operator's alone. Throws before sending on a pad: a pad never closes
810
- * (`PadNeverCloses`). Pass `flags` when in hand to save the read.
811
- */
812
364
  export declare function fPoolClose(c: LogswapClient, a: {
813
365
  poolId: Hex;
814
366
  to?: Address;
815
367
  account: Address;
816
368
  flags?: number;
817
369
  }): Promise<`0x${string}`>;
818
- /**
819
- * The relaunch's calls — what `regenerate` was (policy.md §9): `close(poolId, to)`, `redeem(poolId, gen, operator, shares)` for the
820
- * operator's own shares of the generation closed (left out at 0), then `deployLiquidity` with the next book. Pure, so a form can show
821
- * what it is about to send; {@link fPoolRelaunch} sends them as one `multicall`.
822
- */
823
370
  export declare function fPoolRelaunchCalls(a: {
824
371
  poolId: Hex;
825
372
  gen: number | bigint;
@@ -831,13 +378,6 @@ export declare function fPoolRelaunchCalls(a: {
831
378
  baseAssets: BaseAsset[];
832
379
  lnCapOverSeed: number;
833
380
  } | FPoolBookSpec)): Hex[];
834
- /**
835
- * Relaunch the pool as ONE transaction: close generation `gen`, redeem the operator's own shares of it (its funds come back),
836
- * fund `gen + 1` with the book given — the manager's `multicall`, the operator as sender. Every other holder is frozen into the
837
- * bundle and redeems it ({@link fPoolRedeem}); the new book may re-weight any of the key's bases and pick its own cap. The
838
- * deploy pulls its amounts and `quoteAmount` from the operator in the same transaction the redeem pays it, so the allowances
839
- * must cover the pull. Not on a pad (a pad never closes); not on an inactive pool (fund it with {@link fPoolDeploy}).
840
- */
841
381
  export declare function fPoolRelaunch(c: LogswapClient, a: {
842
382
  poolId: Hex;
843
383
  quoteAmount: bigint;
@@ -847,131 +387,55 @@ export declare function fPoolRelaunch(c: LogswapClient, a: {
847
387
  baseAssets: BaseAsset[];
848
388
  lnCapOverSeed: number;
849
389
  } | FPoolBookSpec)): Promise<`0x${string}`>;
850
- /** Where a pad's seed lives: `deployLiquidity` mints every share of a pad here itself. */
851
390
  export declare const DEAD_ADDRESS: Address;
852
- /** The manager's `MIN_SHARES`: the deploy mints this much to 0xdead on every pool, the rest to the operator — or, on a pad, to 0xdead too. */
853
391
  export declare const F_MIN_SHARES = 1000n;
854
- /**
855
- * One genesis transaction: a swap the creator sends right after the seed, inside the launch's
856
- * `multicall`. A `buy` spends `amountIn` of quote for leg `j` (an index into `bases` AS GIVEN); a
857
- * `sell` spends `amountIn` of that leg for quote. The creator pays and is paid — the manager settles
858
- * to its sender — so a `recipient` is paid by an ERC-20 transfer of the row's output
859
- * ({@link fPoolGenesisTransfers}); without one the output stays with the creator.
860
- */
861
392
  export interface FPoolGenesisRow {
862
393
  side: "buy" | "sell";
863
394
  j: number;
864
395
  amountIn: bigint;
865
- /** Defaults to 0. With a `recipient`, {@link fPoolLaunch} pins it to the simulated output, which is what the transfer pays. */
866
396
  minOut?: bigint;
867
397
  recipient?: Address;
868
398
  }
869
- /** An ERC-20 transfer owed to a genesis recipient: one per (token, recipient), rows summed. */
870
399
  export interface FPoolGenesisTransfer {
871
400
  token: Address;
872
401
  to: Address;
873
402
  amount: bigint;
874
403
  }
875
404
  export interface FPoolLaunchArgs extends Omit<FPoolCreateArgs, "account"> {
876
- /** WAD, one per asset (in `bases` order), summing to 1e18; `L_j = w_j · L0`. The generation's allocation (F 38: not in the key). */
877
405
  weights: bigint[];
878
- /** The generation's total liquidity, quote units. */
879
406
  L0: bigint;
880
- /** The pool's one cap as ln(cap price / seed price), 1e-6 log units, or the leverage it stands for; absent is uncapped. A pad is always uncapped (`PadUncapped`). */
881
407
  lnCapOverSeed?: number;
882
408
  leverage?: number;
883
- /** The bid the deployment pulls (`quoteAmount`). A pad deploys at 0 — pure float, a resting ask, nothing raised. */
884
409
  quoteAmount: bigint;
885
- /**
886
- * An opening buy of leg `j` (an index into `bases` AS GIVEN) for `amountIn` of quote, ON THE
887
- * MANAGER — the same sender, a plain allowance to the manager, the router nowhere near it. A
888
- * pad seeds at Q = 0, so until someone trades it the mark sits at p₀; buying inside the launch
889
- * gives it a price that has moved and a buffer under it. Nothing can trade between the seed and
890
- * this buy — they are one transaction — so `minOut` is safe at its default of 0.
891
- */
892
410
  openBuy?: {
893
411
  j: number;
894
412
  amountIn: bigint;
895
413
  minOut?: bigint;
896
414
  };
897
- /**
898
- * The genesis transactions: an ordered list of swaps right after the seed, each with an optional
899
- * recipient ({@link FPoolGenesisRow}). The same batch as `openBuy`, which stays as the one-buy
900
- * case and runs first when both are given. See `specs/f-pools/opening.md`.
901
- */
902
415
  openBatch?: FPoolGenesisRow[];
903
- /**
904
- * How a row's recipient is paid. `auto` (default): in the launch's own transaction when the
905
- * wallet batches atomically (EIP-5792), else left to {@link fPoolSendGenesisTransfers};
906
- * `followup`: always left to it. Ignored when no row names a recipient.
907
- */
908
416
  deliver?: "auto" | "followup";
909
- /** The pool's label (≤ 31 bytes of UTF-8) — a `NameSet` event on the policy, the operator's (049), written right after the batch by {@link fPoolLaunch}; not in the batch. */
910
417
  name?: string;
911
- /**
912
- * The pool already exists (a previous launch got as far as `initialize` and no further — a seed
913
- * that reverted, a closed tab, before the launch was one transaction), so `initialize` is left
914
- * out: the key is a pure function of the arguments and a second `initialize` can only revert.
915
- */
916
418
  initialized?: boolean;
917
- /** Anything else, pre-encoded against {@link managerFAbi}, appended after the above. */
918
419
  extra?: Hex[];
919
420
  account: Address;
920
421
  }
921
- /**
922
- * The launch's calls, in order — the batch {@link fPoolLaunch} sends. Pure, so a form can show
923
- * what it is about to send, and a test can decode it. Legs are sorted here with their weights and
924
- * reserves (the key's canonical order; `openBuy.j` is re-indexed to match), and the weights are
925
- * checked here, where the message is readable.
926
- */
927
422
  export declare function fPoolLaunchCalls(poolId: Hex, a: FPoolLaunchArgs & ({
928
423
  r0: bigint[];
929
424
  } | {
930
425
  x0: bigint[];
931
426
  })): Hex[];
932
- /** The genesis rows in the order they run: `openBuy` first when given, then `openBatch`. Legs as given. */
933
427
  export declare function fPoolGenesisRows(a: Pick<FPoolLaunchArgs, "openBuy" | "openBatch">): FPoolGenesisRow[];
934
- /**
935
- * What each genesis row returned, read by simulating the launch's `multicall` on the chain — the
936
- * contract's own rounding, no re-implementation. Exact at send time: the pool is new, and nothing
937
- * can trade between the seed and the rows. Needs the creator's funds and allowances, as the launch
938
- * does. One output per row, in {@link fPoolGenesisRows} order: base for a buy, quote for a sell.
939
- */
940
428
  export declare function fPoolGenesisOutputs(c: LogswapClient, poolId: Hex, a: FPoolLaunchArgs & ({
941
429
  r0: bigint[];
942
430
  } | {
943
431
  x0: bigint[];
944
432
  })): Promise<bigint[]>;
945
- /**
946
- * The transfers that pay the recipients: each row's output (`outs`, aligned with
947
- * {@link fPoolGenesisRows}) to its `recipient`, summed per (token, recipient), zero amounts dropped.
948
- * The token is the leg's base for a buy and the quote for a sell. Pure.
949
- */
950
433
  export declare function fPoolGenesisTransfers(a: Pick<FPoolLaunchArgs, "quote" | "bases" | "openBuy" | "openBatch">, outs: bigint[]): FPoolGenesisTransfer[];
951
- /** Pay genesis recipients with plain ERC-20 transfers, one transaction each, in order. For a launch that did not deliver itself. */
952
434
  export declare function fPoolSendGenesisTransfers(c: LogswapClient, a: {
953
435
  transfers: FPoolGenesisTransfer[];
954
436
  account: Address;
955
437
  }): Promise<Hash[]>;
956
- /** Whether the wallet runs a batch of calls atomically (EIP-5792 `atomic` capability), on the client's chain. A wallet without it, or one that errors, says no. */
957
438
  export declare function fPoolWalletBatchesAtomically(c: LogswapClient, account: Address): Promise<boolean>;
958
- /**
959
- * Create a pool as ONE transaction: `initialize`, `deployLiquidity`, the opening buys — the manager's `multicall`, one sender
960
- * throughout. Either every call lands or none does; there is no half-built pool to resume. The sender must be the policy's
961
- * AUTHORITY: it is the pool's operator at birth, and `deployLiquidity` is the operator's (`NotOperator`). Under an open
962
- * policy anyone may list a pool ({@link fPoolInitialize}) but only the LOG — its authority — funds it, so a launch under the
963
- * public policy is the LOG's; a sponsor launches under its own policy.
964
- *
965
- * Why the manager and not the router: every one of these entries authenticates by `msg.sender`. Routed, the router would be
966
- * the sender — the operator, the holder of the seed shares. `multicall` is delegatecall-to-self, so the sender survives.
967
- *
968
- * What the batch PULLS, by plain allowance to the manager (never Permit2): `r0[j]` of each base, `quoteAmount` of quote, plus
969
- * each opening buy's `amountIn` of quote. Grant those first — one `approve` per token, once ever
970
- * ({@link approveTokenForFPoolManager}, {@link fPoolManagerAllowanceOk}).
971
- *
972
- * Returns the hash and the pool's id (the key's hash, {@link fPoolIdOf}). The name, when given, is a second transaction on
973
- * the policy ({@link fPoolSetName}); the gate modes are {@link fPoolSetSwapMode} / {@link fPoolSetMintMode} after it.
974
- */
975
439
  export declare function fPoolLaunch(c: LogswapClient, a: FPoolLaunchArgs & ({
976
440
  r0: bigint[];
977
441
  } | {
@@ -982,84 +446,50 @@ export declare function fPoolLaunch(c: LogswapClient, a: FPoolLaunchArgs & ({
982
446
  transfers: FPoolGenesisTransfer[];
983
447
  delivered: boolean;
984
448
  }>;
985
- /**
986
- * Appoint the pool's operator (the AUTHORITY's; zero resets it to the authority): the account that funds, harvests, closes and sets the
987
- * pool's modes and name, admitted by the gates with no policy call. Immediate, with no acceptance step, so check the address; it may be
988
- * a contract (an executor). `InactivePool` on a pool the policy never held.
989
- */
990
449
  export declare function fPoolAppointOperator(c: LogswapClient, a: {
991
450
  poolId: Hex;
992
451
  operator: Address;
993
452
  account: Address;
994
453
  policy?: Address;
995
454
  }): Promise<`0x${string}`>;
996
- /**
997
- * Set the pool's swap gate (the OPERATOR's): `open`, `listed` (the policy's swap list, {@link fPolicySetRights}; the operator always
998
- * passes) or `operator`. The mint mode must stay at least as restrictive (`ModeOrder`). `burn`, `redeem` and `claim` are never gated.
999
- */
1000
455
  export declare function fPoolSetSwapMode(c: LogswapClient, a: {
1001
456
  poolId: Hex;
1002
457
  mode: FPoolMode;
1003
458
  account: Address;
1004
459
  policy?: Address;
1005
460
  }): Promise<`0x${string}`>;
1006
- /** Set the pool's mint gate (the OPERATOR's): at least as restrictive as the swap mode (`ModeOrder`); `listed` consults the policy's mint list. */
1007
461
  export declare function fPoolSetMintMode(c: LogswapClient, a: {
1008
462
  poolId: Hex;
1009
463
  mode: FPoolMode;
1010
464
  account: Address;
1011
465
  policy?: Address;
1012
466
  }): Promise<`0x${string}`>;
1013
- /** The bits of `PolicyF.rights`: listed for swaps; listed for mints, which implies swaps. */
1014
467
  export declare const RIGHT_SWAP = 1;
1015
468
  export declare const RIGHT_MINT = 2;
1016
- /** What a policy lists an address for: nothing, swaps, or mints (and so swaps). */
1017
469
  export type FPolicyRight = "none" | "swap" | "mint";
1018
- /** The on-chain bits of a right (`MINT` is written as `MINT | SWAP`, as the policy does). */
1019
470
  export declare function fPolicyRightBits(right: FPolicyRight): number;
1020
- /** The right the bits spell. */
1021
471
  export declare function fPolicyRightOf(bits: number | bigint): FPolicyRight;
1022
- /**
1023
- * List addresses on the POLICY (the AUTHORITY's): `swap` admits them where a pool's swap mode is `listed`, `mint` where its mint mode is
1024
- * — and to swap as well (`MINT ⇒ SWAP`); `none` unlists. One pair of lists per policy, shared by every pool under it (policy.md §4.2);
1025
- * the modes are each pool's. Stamps nothing: an address removed in a block can still swap in that block.
1026
- */
1027
472
  export declare function fPolicySetRights(c: LogswapClient, a: {
1028
473
  policy: Address;
1029
474
  who: readonly Address[];
1030
475
  right: FPolicyRight;
1031
476
  account: Address;
1032
477
  }): Promise<`0x${string}`>;
1033
- /** What `policy` lists `who` for now (`rights`). */
1034
478
  export declare function fPolicyRightsOf(c: LogswapClient, policy: Address, who: Address): Promise<FPolicyRight>;
1035
- /** Label the pool (the OPERATOR's): a `NameSet` event on the policy, nothing stored — mutable, never identity. At most 31 bytes of UTF-8. */
1036
479
  export declare function fPoolSetName(c: LogswapClient, a: {
1037
480
  poolId: Hex;
1038
481
  name: string;
1039
482
  account: Address;
1040
483
  policy?: Address;
1041
484
  }): Promise<`0x${string}`>;
1042
- /**
1043
- * What the PROTOCOL says an address is — "Keyrock" — on the REGISTRY. Only its
1044
- * owner, the LOG authority, may write it, which is what makes it an attestation rather than a
1045
- * claim anyone could make about themselves.
1046
- */
1047
485
  export declare function fPoolSetSponsorName(c: LogswapClient, a: {
1048
486
  who: Address;
1049
487
  name: string;
1050
488
  account: Address;
1051
489
  }): Promise<`0x${string}`>;
1052
- /** The protocol's attestation for an address, or "" when unattested — which most addresses are, and every address on a deployment with no registry. */
1053
490
  export declare function fPoolSponsorName(c: LogswapClient, who: Address): Promise<string>;
1054
- /** The registry the manager asks at every birth — `addresses.policyRegistry`, else the manager's word; zero on a bare deployment. */
1055
491
  export declare function fPoolRegistryOf(c: LogswapClient): Promise<Address>;
1056
- /** Who runs the pool (policy.md §2): its operator — the one account the manager admits to fund, harvest and close. Empty on a pool the policy never held. */
1057
492
  export declare function fPoolRunners(s: Pick<FPoolRoles, "operator">): Address[];
1058
- /**
1059
- * Move shares (ERC-6909 `transfer`) — to another holder, or to `0xdead` to lock them for good.
1060
- * Burning to the dead address is a sponsor's way to make its liquidity permanent: the shares can
1061
- * never be redeemed.
1062
- */
1063
493
  export declare function fPoolTransferShares(c: LogswapClient, a: {
1064
494
  poolId: Hex;
1065
495
  to: Address;
@@ -1071,71 +501,35 @@ export interface DiscoveredFPool {
1071
501
  poolId: Hex;
1072
502
  quote: Address;
1073
503
  bases: Address[];
1074
- /** The generation-0 allocation, from the pool's first `LiquidityDeployed` ({@link fPoolBookWeights}); `[]` until it is deployed — F 38 keeps no weights in the key. */
1075
504
  weights: bigint[];
1076
- /** The key's swap fee index (policy.md §6). */
1077
505
  swapFeeIdx: number;
1078
- /** The swap fee, WAD: `F_FEE_LIST[swapFeeIdx]`. */
1079
506
  swapFee: bigint;
1080
- /** The mint fee, WAD: the list's next entry ({@link fMintFeeOf}). */
1081
507
  mintFee: bigint;
1082
- /** The generation-0 cap as ln(cap price / seed price), in 1e-6 log units; 0 uncapped, cap ∞ (decisions 061); 0 until deployed. */
1083
508
  lnCapOverSeed: number;
1084
509
  kind: FPoolKind;
1085
- /** The pool's policy for life — the contract the key names. */
1086
510
  policy: Address;
1087
- /** The key's salt: zero under an open policy. */
1088
511
  salt: Hex;
1089
- /** The account that created the pool (`PoolCreated.creator`, F 42): the one the policy judged. Not a key field. */
1090
512
  creator: Address;
1091
- /** The block the pool was initialized in — its age, for annualising realized income. */
1092
513
  block: bigint;
1093
- /** Whether `deployLiquidity` has run; an unfunded pool has no floor and no float, so nothing to show. */
1094
514
  seeded: boolean;
1095
- /** The quote the pool was born with. Zero is the launchpad's signature. */
1096
515
  q0: bigint;
1097
- /**
1098
- * The PRODUCT the pool is, by the spec's definition rather than a guess: a LAUNCH is one asset
1099
- * born at Q = 0 — a resting ask under a token, nothing raised, the creator alone on the lever;
1100
- * everything else is a liquidity BASKET (public, quote-funded). Read from the Seeded log, so a
1101
- * one-asset pool seeded WITH quote files correctly as liquidity, not as a pad.
1102
- */
1103
516
  shape: FPoolShape;
1104
517
  }
1105
- /**
1106
- * Every F pool ever created, from `PoolCreated` logs alone — plus the terms of each distinct policy, read once and cached.
1107
- * Possible only because the event carries the full key (quote, policy, bases, swapFeeIdx, salt) and the creator — the poolId is a hash and
1108
- * could never be inverted; contracts PR #17 exists for exactly this call. With `indexer`, the logs come from it (the node
1109
- * when it fails): a scan from block 0 per call is what made the first load wait on the node.
1110
- */
1111
518
  export declare function discoverFPools(c: LogswapClient, opts?: {
1112
519
  fromBlock?: bigint;
1113
520
  toBlock?: bigint;
1114
521
  indexer?: string;
1115
522
  }): Promise<DiscoveredFPool[]>;
1116
- /** A pool an account runs or sponsors, with what the policy page shows of it. */
1117
523
  export interface FPoolControlled {
1118
524
  pool: DiscoveredFPool;
1119
525
  roles: FPoolRoles;
1120
526
  state: FPoolState;
1121
- /** The policy's immutables: the terms a holder reads before entering. */
1122
527
  terms: FPolicyTerms;
1123
528
  }
1124
- /**
1125
- * Every F pool `who` runs (its operator) or sponsors (the authority of its policy) — the policy page's list. `roles` tells
1126
- * which. `pools` may be passed (from the indexer, say) to skip the log scan.
1127
- */
1128
529
  export declare function fPoolsControlledBy(c: LogswapClient, who: Address, opts?: {
1129
530
  pools?: DiscoveredFPool[];
1130
531
  fromBlock?: bigint;
1131
532
  }): Promise<FPoolControlled[]>;
1132
- /**
1133
- * Every holder of a pool's shares, from the ERC-6909 Transfer stream — the id is an indexed
1134
- * topic, so one filtered log query aggregates the whole ledger. The 0xdead entry is the
1135
- * MIN_SHARES lock from seeding; callers usually label rather than hide it. Pass `indexer`: the Transfer rows come from
1136
- * its tables — a node prunes its logs (anvil keeps about a day), and a ledger rebuilt from a pruned stream loses every
1137
- * holder minted before the cut. (The indexer's derived views are read by the app's `@logswap/base`, not here.)
1138
- */
1139
533
  export declare function fPoolShareHolders(c: LogswapClient, poolIdHex: Hex, opts?: {
1140
534
  fromBlock?: bigint;
1141
535
  gen?: bigint | number;
@@ -1144,7 +538,5 @@ export declare function fPoolShareHolders(c: LogswapClient, poolIdHex: Hex, opts
1144
538
  holder: Address;
1145
539
  shares: bigint;
1146
540
  }>>;
1147
- /** Every F pool's raw state in one lens call (the manager's `Pool` struct: quote, swapFee, restructureTime, flags, policy, seeded, gen, n, lnCapOverSeed, Q, realizedVariance, L, shares, refLogFloor, operator, mintFee). */
1148
541
  export declare function getFPoolsRaw(c: LogswapClient, poolIds: Hex[]): Promise<readonly unknown[]>;
1149
- /** Share value from the lens — (L + Q)/shares, WAD per share — the same figure as `fPoolShareValue`, from one source. */
1150
542
  export declare function shareValueOnChain(c: LogswapClient, poolId: Hex): Promise<bigint>;