@logswap/sdk 0.5.45 → 0.5.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fpool.d.ts CHANGED
@@ -12,10 +12,17 @@
12
12
  * key is variable-length and only ever partially needed (no swap path is O(n)), so it is stored
13
13
  * once at `initialize` and every later call names `(poolId, j)`. Callers hold a `bytes32`.
14
14
  *
15
- * **Two products, one contract.** The basket (n > 1, public authority) and the launch (n = 1, the
16
- * creator alone on the lever) are the same bytecode under different settings — what separates them
17
- * is who holds `authority` and how many bases there are, and nothing in the maths. `describeFPool`
18
- * below reports which shape a given pool is, because a UI has to decide what to render.
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 HOOK (the pool's policy: its roles, its gates, the terms of every harvest
18
+ * and release; decisions 041, 044) — 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 hook's, not the manager's** (F version 15). The manager holds no
22
+ * authority, operator, gate or list: it asks the pool's hook `may(who, action)` and acts on the
23
+ * answer. So `getFPool` carries the hook and what it declared, {@link getFPoolRoles} reads the
24
+ * roles FROM the hook, and every role write — the handover, the operator, the gates, the list —
25
+ * is a write to the hook ({@link fPoolProposeAuthority}, {@link fPoolSetGates}, …).
19
26
  *
20
27
  * **Zaps live on the ROUTER, not here.** Permit2 is AllowanceTransfer mode, whose standing
21
28
  * allowance is keyed by spender, so a second router would cost the user an allowance per token
@@ -23,16 +30,491 @@
23
30
  * `addresses.router`.
24
31
  */
25
32
  import { type Address, type Hash, type Hex } from "viem";
26
- import { fPoolManagerAbi } from "./generated.js";
33
+ import { fPoolManagerAbi, padHookAbi, polHookAbi, privateHookAbi, publicHookAbi } from "./generated.js";
34
+ /**
35
+ * One contract, one ABI (decisions 039, F version 12): `harvest`, `claim`, `retire`, `regenerate`,
36
+ * `setLegs`, the names, the fee parameters are `FPoolManager`'s own code. The roles left it for
37
+ * the hooks in F version 15 (decisions 044): {@link fHookBaseAbi} is what every hook shares,
38
+ * {@link privateHookAbi} the desk's, {@link padHookAbi} / {@link polHookAbi} / {@link publicHookAbi}
39
+ * the kinds'.
40
+ */
41
+ export { fPoolManagerAbi, padHookAbi, polHookAbi, privateHookAbi, publicHookAbi };
27
42
  /**
28
- * One contract, one ABI (decisions 039, F version 12): the sponsor surface — `harvest`, `claim`,
29
- * `dissolve`, the handover, the gates, the operator, `setLegs`, the names, the fee parameters —
30
- * is `FPoolManager`'s own code again. From 031 to 038 it was a delegatecall facet
31
- * (`FPoolSponsor`) and this ABI was the union of the two compiled halves; the union is gone with
32
- * the facet, and the generated ABI is the whole surface.
43
+ * What every protocol hook shares (`FHookBase`): the roles and their handover, `harvestCut`,
44
+ * `maxHarvest`. `polHookAbi` is a superset of it and carries nothing that collides, so it stands
45
+ * in for the base — a call through it to any of the four hooks decodes the base's functions.
33
46
  */
34
- export { fPoolManagerAbi };
47
+ export declare const fHookBaseAbi: readonly [{
48
+ readonly type: "constructor";
49
+ readonly inputs: readonly [{
50
+ readonly name: "_manager";
51
+ readonly internalType: "contract FPoolManager";
52
+ readonly type: "address";
53
+ }];
54
+ readonly stateMutability: "nonpayable";
55
+ }, {
56
+ readonly type: "function";
57
+ readonly inputs: readonly [{
58
+ readonly name: "poolId";
59
+ readonly internalType: "bytes32";
60
+ readonly type: "bytes32";
61
+ }];
62
+ readonly name: "acceptAuthority";
63
+ readonly outputs: readonly [];
64
+ readonly stateMutability: "nonpayable";
65
+ }, {
66
+ readonly type: "function";
67
+ readonly inputs: readonly [{
68
+ readonly name: "";
69
+ readonly internalType: "bytes32";
70
+ readonly type: "bytes32";
71
+ }];
72
+ readonly name: "authority";
73
+ readonly outputs: readonly [{
74
+ readonly name: "";
75
+ readonly internalType: "address";
76
+ readonly type: "address";
77
+ }];
78
+ readonly stateMutability: "view";
79
+ }, {
80
+ readonly type: "function";
81
+ readonly inputs: readonly [{
82
+ readonly name: "";
83
+ readonly internalType: "bytes32";
84
+ readonly type: "bytes32";
85
+ }];
86
+ readonly name: "creator";
87
+ readonly outputs: readonly [{
88
+ readonly name: "";
89
+ readonly internalType: "address";
90
+ readonly type: "address";
91
+ }];
92
+ readonly stateMutability: "view";
93
+ }, {
94
+ readonly type: "function";
95
+ readonly inputs: readonly [];
96
+ readonly name: "harvestCut";
97
+ readonly outputs: readonly [{
98
+ readonly name: "";
99
+ readonly internalType: "uint256";
100
+ readonly type: "uint256";
101
+ }];
102
+ readonly stateMutability: "view";
103
+ }, {
104
+ readonly type: "function";
105
+ readonly inputs: readonly [];
106
+ readonly name: "keepQuote";
107
+ readonly outputs: readonly [{
108
+ readonly name: "";
109
+ readonly internalType: "uint256";
110
+ readonly type: "uint256";
111
+ }];
112
+ readonly stateMutability: "view";
113
+ }, {
114
+ readonly type: "function";
115
+ readonly inputs: readonly [];
116
+ readonly name: "manager";
117
+ readonly outputs: readonly [{
118
+ readonly name: "";
119
+ readonly internalType: "contract FPoolManager";
120
+ readonly type: "address";
121
+ }];
122
+ readonly stateMutability: "view";
123
+ }, {
124
+ readonly type: "function";
125
+ readonly inputs: readonly [{
126
+ readonly name: "poolId";
127
+ readonly internalType: "bytes32";
128
+ readonly type: "bytes32";
129
+ }];
130
+ readonly name: "maxHarvest";
131
+ readonly outputs: readonly [{
132
+ readonly name: "";
133
+ readonly internalType: "uint256";
134
+ readonly type: "uint256";
135
+ }];
136
+ readonly stateMutability: "view";
137
+ }, {
138
+ readonly type: "function";
139
+ readonly inputs: readonly [{
140
+ readonly name: "a";
141
+ readonly internalType: "struct IFHook.Ask";
142
+ readonly type: "tuple";
143
+ readonly components: readonly [{
144
+ readonly name: "poolId";
145
+ readonly internalType: "bytes32";
146
+ readonly type: "bytes32";
147
+ }, {
148
+ readonly name: "gen";
149
+ readonly internalType: "uint256";
150
+ readonly type: "uint256";
151
+ }, {
152
+ readonly name: "action";
153
+ readonly internalType: "enum IFHook.Action";
154
+ readonly type: "uint8";
155
+ }, {
156
+ readonly name: "who";
157
+ readonly internalType: "address";
158
+ readonly type: "address";
159
+ }, {
160
+ readonly name: "amount";
161
+ readonly internalType: "uint256";
162
+ readonly type: "uint256";
163
+ }, {
164
+ readonly name: "income";
165
+ readonly internalType: "uint256";
166
+ readonly type: "uint256";
167
+ }, {
168
+ readonly name: "Q";
169
+ readonly internalType: "uint256";
170
+ readonly type: "uint256";
171
+ }, {
172
+ readonly name: "L";
173
+ readonly internalType: "uint256";
174
+ readonly type: "uint256";
175
+ }, {
176
+ readonly name: "n";
177
+ readonly internalType: "uint256";
178
+ readonly type: "uint256";
179
+ }];
180
+ }];
181
+ readonly name: "may";
182
+ readonly outputs: readonly [{
183
+ readonly name: "";
184
+ readonly internalType: "bytes4";
185
+ readonly type: "bytes4";
186
+ }];
187
+ readonly stateMutability: "view";
188
+ }, {
189
+ readonly type: "function";
190
+ readonly inputs: readonly [];
191
+ readonly name: "minQuoteAtSeed";
192
+ readonly outputs: readonly [{
193
+ readonly name: "";
194
+ readonly internalType: "uint256";
195
+ readonly type: "uint256";
196
+ }];
197
+ readonly stateMutability: "view";
198
+ }, {
199
+ readonly type: "function";
200
+ readonly inputs: readonly [{
201
+ readonly name: "a";
202
+ readonly internalType: "struct IFHook.Ask";
203
+ readonly type: "tuple";
204
+ readonly components: readonly [{
205
+ readonly name: "poolId";
206
+ readonly internalType: "bytes32";
207
+ readonly type: "bytes32";
208
+ }, {
209
+ readonly name: "gen";
210
+ readonly internalType: "uint256";
211
+ readonly type: "uint256";
212
+ }, {
213
+ readonly name: "action";
214
+ readonly internalType: "enum IFHook.Action";
215
+ readonly type: "uint8";
216
+ }, {
217
+ readonly name: "who";
218
+ readonly internalType: "address";
219
+ readonly type: "address";
220
+ }, {
221
+ readonly name: "amount";
222
+ readonly internalType: "uint256";
223
+ readonly type: "uint256";
224
+ }, {
225
+ readonly name: "income";
226
+ readonly internalType: "uint256";
227
+ readonly type: "uint256";
228
+ }, {
229
+ readonly name: "Q";
230
+ readonly internalType: "uint256";
231
+ readonly type: "uint256";
232
+ }, {
233
+ readonly name: "L";
234
+ readonly internalType: "uint256";
235
+ readonly type: "uint256";
236
+ }, {
237
+ readonly name: "n";
238
+ readonly internalType: "uint256";
239
+ readonly type: "uint256";
240
+ }];
241
+ }];
242
+ readonly name: "onHarvest";
243
+ readonly outputs: readonly [{
244
+ readonly name: "amount";
245
+ readonly internalType: "uint256";
246
+ readonly type: "uint256";
247
+ }, {
248
+ readonly name: "cut";
249
+ readonly internalType: "uint256";
250
+ readonly type: "uint256";
251
+ }];
252
+ readonly stateMutability: "view";
253
+ }, {
254
+ readonly type: "function";
255
+ readonly inputs: readonly [{
256
+ readonly name: "poolId";
257
+ readonly internalType: "bytes32";
258
+ readonly type: "bytes32";
259
+ }, {
260
+ readonly name: "key";
261
+ readonly internalType: "struct FPoolKey";
262
+ readonly type: "tuple";
263
+ readonly components: readonly [{
264
+ readonly name: "quote";
265
+ readonly internalType: "address";
266
+ readonly type: "address";
267
+ }, {
268
+ readonly name: "bases";
269
+ readonly internalType: "address[]";
270
+ readonly type: "address[]";
271
+ }, {
272
+ readonly name: "weights";
273
+ readonly internalType: "uint256[]";
274
+ readonly type: "uint256[]";
275
+ }, {
276
+ readonly name: "phi";
277
+ readonly internalType: "uint256";
278
+ readonly type: "uint256";
279
+ }, {
280
+ readonly name: "kind";
281
+ readonly internalType: "enum Kind";
282
+ readonly type: "uint8";
283
+ }, {
284
+ readonly name: "hook";
285
+ readonly internalType: "address";
286
+ readonly type: "address";
287
+ }, {
288
+ readonly name: "creator";
289
+ readonly internalType: "address";
290
+ readonly type: "address";
291
+ }, {
292
+ readonly name: "salt";
293
+ readonly internalType: "bytes32";
294
+ readonly type: "bytes32";
295
+ }];
296
+ }];
297
+ readonly name: "onInitialize";
298
+ readonly outputs: readonly [{
299
+ readonly name: "";
300
+ readonly internalType: "uint8";
301
+ readonly type: "uint8";
302
+ }];
303
+ readonly stateMutability: "nonpayable";
304
+ }, {
305
+ readonly type: "function";
306
+ readonly inputs: readonly [{
307
+ readonly name: "a";
308
+ readonly internalType: "struct IFHook.Ask";
309
+ readonly type: "tuple";
310
+ readonly components: readonly [{
311
+ readonly name: "poolId";
312
+ readonly internalType: "bytes32";
313
+ readonly type: "bytes32";
314
+ }, {
315
+ readonly name: "gen";
316
+ readonly internalType: "uint256";
317
+ readonly type: "uint256";
318
+ }, {
319
+ readonly name: "action";
320
+ readonly internalType: "enum IFHook.Action";
321
+ readonly type: "uint8";
322
+ }, {
323
+ readonly name: "who";
324
+ readonly internalType: "address";
325
+ readonly type: "address";
326
+ }, {
327
+ readonly name: "amount";
328
+ readonly internalType: "uint256";
329
+ readonly type: "uint256";
330
+ }, {
331
+ readonly name: "income";
332
+ readonly internalType: "uint256";
333
+ readonly type: "uint256";
334
+ }, {
335
+ readonly name: "Q";
336
+ readonly internalType: "uint256";
337
+ readonly type: "uint256";
338
+ }, {
339
+ readonly name: "L";
340
+ readonly internalType: "uint256";
341
+ readonly type: "uint256";
342
+ }, {
343
+ readonly name: "n";
344
+ readonly internalType: "uint256";
345
+ readonly type: "uint256";
346
+ }];
347
+ }];
348
+ readonly name: "onRegenerate";
349
+ readonly outputs: readonly [{
350
+ readonly name: "t";
351
+ readonly internalType: "struct IFHook.Terms";
352
+ readonly type: "tuple";
353
+ readonly components: readonly [{
354
+ readonly name: "payee";
355
+ readonly internalType: "address";
356
+ readonly type: "address";
357
+ }, {
358
+ readonly name: "toPayee";
359
+ readonly internalType: "uint256";
360
+ readonly type: "uint256";
361
+ }, {
362
+ readonly name: "protocolCut";
363
+ readonly internalType: "uint256";
364
+ readonly type: "uint256";
365
+ }, {
366
+ readonly name: "burn";
367
+ readonly internalType: "uint256";
368
+ readonly type: "uint256";
369
+ }];
370
+ }];
371
+ readonly stateMutability: "nonpayable";
372
+ }, {
373
+ readonly type: "function";
374
+ readonly inputs: readonly [{
375
+ readonly name: "";
376
+ readonly internalType: "bytes32";
377
+ readonly type: "bytes32";
378
+ }];
379
+ readonly name: "pendingAuthority";
380
+ readonly outputs: readonly [{
381
+ readonly name: "";
382
+ readonly internalType: "address";
383
+ readonly type: "address";
384
+ }];
385
+ readonly stateMutability: "view";
386
+ }, {
387
+ readonly type: "function";
388
+ readonly inputs: readonly [{
389
+ readonly name: "poolId";
390
+ readonly internalType: "bytes32";
391
+ readonly type: "bytes32";
392
+ }, {
393
+ readonly name: "next";
394
+ readonly internalType: "address";
395
+ readonly type: "address";
396
+ }];
397
+ readonly name: "proposeAuthority";
398
+ readonly outputs: readonly [];
399
+ readonly stateMutability: "nonpayable";
400
+ }, {
401
+ readonly type: "function";
402
+ readonly inputs: readonly [{
403
+ readonly name: "_harvestCut";
404
+ readonly internalType: "uint256";
405
+ readonly type: "uint256";
406
+ }];
407
+ readonly name: "setHarvestCut";
408
+ readonly outputs: readonly [];
409
+ readonly stateMutability: "nonpayable";
410
+ }, {
411
+ readonly type: "function";
412
+ readonly inputs: readonly [{
413
+ readonly name: "_keepQuote";
414
+ readonly internalType: "uint256";
415
+ readonly type: "uint256";
416
+ }, {
417
+ readonly name: "_minQuoteAtSeed";
418
+ readonly internalType: "uint256";
419
+ readonly type: "uint256";
420
+ }];
421
+ readonly name: "setPolicy";
422
+ readonly outputs: readonly [];
423
+ readonly stateMutability: "nonpayable";
424
+ }, {
425
+ readonly type: "event";
426
+ readonly anonymous: false;
427
+ readonly inputs: readonly [{
428
+ readonly name: "poolId";
429
+ readonly internalType: "bytes32";
430
+ readonly type: "bytes32";
431
+ readonly indexed: true;
432
+ }, {
433
+ readonly name: "current";
434
+ readonly internalType: "address";
435
+ readonly type: "address";
436
+ readonly indexed: true;
437
+ }, {
438
+ readonly name: "proposed";
439
+ readonly internalType: "address";
440
+ readonly type: "address";
441
+ readonly indexed: true;
442
+ }];
443
+ readonly name: "AuthorityProposed";
444
+ }, {
445
+ readonly type: "event";
446
+ readonly anonymous: false;
447
+ readonly inputs: readonly [{
448
+ readonly name: "poolId";
449
+ readonly internalType: "bytes32";
450
+ readonly type: "bytes32";
451
+ readonly indexed: true;
452
+ }, {
453
+ readonly name: "prev";
454
+ readonly internalType: "address";
455
+ readonly type: "address";
456
+ readonly indexed: true;
457
+ }, {
458
+ readonly name: "next";
459
+ readonly internalType: "address";
460
+ readonly type: "address";
461
+ readonly indexed: true;
462
+ }];
463
+ readonly name: "AuthoritySet";
464
+ }, {
465
+ readonly type: "event";
466
+ readonly anonymous: false;
467
+ readonly inputs: readonly [{
468
+ readonly name: "harvestCut";
469
+ readonly internalType: "uint256";
470
+ readonly type: "uint256";
471
+ readonly indexed: false;
472
+ }];
473
+ readonly name: "HarvestCutSet";
474
+ }, {
475
+ readonly type: "event";
476
+ readonly anonymous: false;
477
+ readonly inputs: readonly [{
478
+ readonly name: "keepQuote";
479
+ readonly internalType: "uint256";
480
+ readonly type: "uint256";
481
+ readonly indexed: false;
482
+ }, {
483
+ readonly name: "minQuoteAtSeed";
484
+ readonly internalType: "uint256";
485
+ readonly type: "uint256";
486
+ readonly indexed: false;
487
+ }];
488
+ readonly name: "PolicySet";
489
+ }, {
490
+ readonly type: "error";
491
+ readonly inputs: readonly [];
492
+ readonly name: "BadRate";
493
+ }, {
494
+ readonly type: "error";
495
+ readonly inputs: readonly [];
496
+ readonly name: "NotAuthority";
497
+ }, {
498
+ readonly type: "error";
499
+ readonly inputs: readonly [];
500
+ readonly name: "NotCollector";
501
+ }, {
502
+ readonly type: "error";
503
+ readonly inputs: readonly [];
504
+ readonly name: "NotManager";
505
+ }, {
506
+ readonly type: "error";
507
+ readonly inputs: readonly [];
508
+ readonly name: "QuoteTooThin";
509
+ }, {
510
+ readonly type: "error";
511
+ readonly inputs: readonly [];
512
+ readonly name: "Refused";
513
+ }];
35
514
  import type { LogswapClient } from "./client.js";
515
+ /** The optional questions a hook declared at birth (decisions 044), as bits of `Pool.asks`. */
516
+ export declare const ASK_SWAP = 1;
517
+ export declare const ASK_MINT = 2;
36
518
  /** Everything scalar about a basket pool, in one round trip's worth of reads. */
37
519
  export interface FPoolState {
38
520
  /** The pool's id — the hash of its key. There is no per-pool address. */
@@ -57,32 +539,25 @@ export interface FPoolState {
57
539
  compositeX: bigint;
58
540
  /** Σ = ∫ Σ_j w_j (dx_j)², accrued even though the fee is fixed — the kernel stays calculable. */
59
541
  bigSigma: bigint;
60
- /** The cold key (decisions 037): seeds the pool, hands it over, names it, gates it (private). A creator, a treasury, a governance contract. */
61
- authority: Address;
62
- /** The proposed next authority, until it accepts — zero when nothing is pending (decisions 020). */
63
- pendingAuthority: Address;
64
542
  /**
65
- * The hot key that RUNS the pool (decisions 037): `harvest`, `dissolve`, `setLegs`. Zero means
66
- * the authority itself — see {@link fPoolOperatorOf}. Appointed two-step on a private pool.
543
+ * The pool's policy (decisions 041, 044): the contract the key names, holding the pool's roles
544
+ * and answering every question the manager does not decide itself. Read its roles with
545
+ * {@link getFPoolRoles}; one of the deployment's four ({@link fPoolHookFor}) on every protocol pool.
67
546
  */
68
- operator: Address;
69
- /** The proposed next operator, until it accepts — zero when nothing is pending. */
70
- pendingOperator: Address;
547
+ hook: Address;
548
+ /** Whether the hook asked to be consulted on swaps ({@link ASK_SWAP}) and mints ({@link ASK_MINT}) — the desk's hook does, no other. */
549
+ asks: number;
71
550
  /** The sponsor's own label for this pool, mutable and never identity. "" when unnamed. */
72
551
  name: string;
73
- /** Only `allowed` accounts may receive minted shares. */
74
- gateMint: boolean;
75
- /** Only `allowed` takers may swap. */
76
- gateSwap: boolean;
77
552
  /** The block of the last harvest / composition action: no swap runs in it. */
78
553
  restructureBlock: number;
79
554
  /** The rung — see {@link FPoolKind}. */
80
555
  kind: FPoolKind;
81
- /** False before the first seed — and between a dissolve and the next one (decisions 032). */
556
+ /** False before the first seed — and between a retire and the next one (decisions 032). */
82
557
  seeded: boolean;
83
558
  /**
84
- * The live GENERATION (decisions 032). Every dissolve retires one into a frozen bundle its
85
- * shares redeem ({@link fPoolRedeem}) and opens the next; the share id carries it
559
+ * The live GENERATION (decisions 032). Every retire freezes one into a bundle its shares
560
+ * redeem ({@link fPoolRedeem}) and opens the next; the share id carries it
86
561
  * ({@link fPoolShareId}), so generations `0 … gen-1` are retired claims and `gen` is the pool.
87
562
  */
88
563
  gen: number;
@@ -93,14 +568,14 @@ export interface FPoolState {
93
568
  /** Read a basket pool whole. Batched — viem multicalls these when the transport allows. */
94
569
  export declare function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolState>;
95
570
  /**
96
- * The kind of pool (decisions 036, 038). `public`: the protocol's own pool — born with the fee
97
- * collector as its authority (which may hand it to a governance contract); no gates, no operator.
98
- * `private`, the desk: every entry — gates, a list, an operator that reshapes the legs between
99
- * generations, an unbounded harvest, the seed kept. `pol`, a treasury's pool or a basket: no
100
- * gates, no operator — composition and access fixed at birth; harvest unbounded, seed the
101
- * seeder's. `pad`, a launch: a POL whose harvest never lifts the floor above the seed floor and
102
- * whose seed the contract minted to 0xdead — one asset, open to all. private → pol → pad is the
103
- * ladder of rigidity; public is a pol held by the protocol.
571
+ * The kind of pool (decisions 036, 038, 044) — what the manager promises structurally, whatever
572
+ * the pool's hook answers. `public`: the protocol's own pool — its hook requires the collector as
573
+ * creator; no gate, no operator. `private`, the desk: the one kind whose hook may gate swaps and
574
+ * mints, with an operator that reshapes the legs between generations. `pol`, a treasury's pool
575
+ * or a basket: composition and access fixed at birth. `pad`, a launch: a POL whose harvest is
576
+ * income only whatever its hook says and whose seed the contract minted to 0xdead — one asset,
577
+ * open to all. private → pol → pad is the ladder of rigidity; public is a pol held by the
578
+ * protocol. Every rate, role and gate is the hook's.
104
579
  */
105
580
  export type FPoolKind = "public" | "private" | "pol" | "pad";
106
581
  /** The key's enum values. */
@@ -111,18 +586,50 @@ export declare const F_KIND: {
111
586
  readonly pad: 3;
112
587
  };
113
588
  export declare function fPoolKindOf(n: number | bigint): FPoolKind;
589
+ /** The deployment's hook for a kind (decisions 044): what a key of that kind names. */
590
+ export declare function fPoolHookFor(c: LogswapClient, kind: FPoolKind): Address;
591
+ /** The hook a pool named in its key — one read; {@link getFPool} carries it too. */
592
+ export declare function fPoolHookOf(c: LogswapClient, poolId: Hex): Promise<Address>;
593
+ /**
594
+ * A pool's roles, as its HOOK holds them (decisions 044). `creator` is immutable identity —
595
+ * who was born holding the pool; `authority` is the cold key that owns it now, the creator until
596
+ * a two-step handover; on the desk's kind the `operator` runs it (zero = the authority itself,
597
+ * {@link fPoolOperatorOf}) and the two gates and the list are its. Every other kind has no
598
+ * operator and no gate: those fields read zero / false.
599
+ */
600
+ export interface FPoolRoles {
601
+ hook: Address;
602
+ creator: Address;
603
+ authority: Address;
604
+ /** The proposed next authority, until it accepts — zero when nothing is pending (decisions 020). */
605
+ pendingAuthority: Address;
606
+ operator: Address;
607
+ pendingOperator: Address;
608
+ gateMint: boolean;
609
+ gateSwap: boolean;
610
+ /** The hook's own ceiling on a harvest now — the manager's `harvestable` narrowed by the hook's rule. */
611
+ maxHarvest: bigint;
612
+ }
613
+ /** Read a pool's roles from its hook. `state` saves the `getPool` round trip when already in hand. */
614
+ export declare function getFPoolRoles(c: LogswapClient, poolId: Hex, state?: Pick<FPoolState, "hook" | "kind">): Promise<FPoolRoles>;
114
615
  /** 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. */
115
616
  export type FPoolShape = "launch" | "basket";
116
617
  export interface FPoolDescription {
117
618
  shape: FPoolShape;
118
- /** n = 1 with a private authority is the launch shape (f-pool §6.5). */
619
+ /** The pad is the launch shape, by the kind (decisions 036). */
119
620
  legs: number;
120
621
  /** True when the pool holds no quote: an all-base resting ask. base→quote is the one blocked path. */
121
622
  atFloor: boolean;
122
- /** Fee income earned per unit L so far, `θ₀ − θ` with the lever's displacement backed out. */
123
- feePerL: bigint;
124
- /** The model-free LP edge, `F − ½Σ`. Exact at any n: V is separable in the logs. */
125
- edgePerL: bigint;
623
+ /**
624
+ * This generation's fee income still in the pool, quote: `L·(θ₀ − θ)` (F version 14 —
625
+ * `feePerL` before, per unit L). A harvest of capital moves the reference floor, so this counts
626
+ * from the first wei after it.
627
+ */
628
+ unharvested: bigint;
629
+ /** The most a harvest may take now by the KIND's promise: the bid, and on a pad the income. The hook may allow less — {@link FPoolRoles.maxHarvest}. */
630
+ harvestable: bigint;
631
+ /** The dead shares' banked dividend — a pad's pot, the creator's income until a rung is climbed (decisions 041). */
632
+ pot: bigint;
126
633
  }
127
634
  export declare function describeFPool(c: LogswapClient, s: FPoolState): Promise<FPoolDescription>;
128
635
  /** `p_j = e^{x_j}`, lossy the way any float conversion is. Compare in log space when it matters. */
@@ -352,7 +859,14 @@ export interface FPoolCreateArgs {
352
859
  phi: bigint;
353
860
  /** The rung (decisions 036) — see {@link FPoolKind}. In the key: the pool's identity, never changed after. */
354
861
  kind: FPoolKind;
355
- authority: Address;
862
+ /**
863
+ * The pool's policy (decisions 041, 044): the contract the key names, approved by the protocol
864
+ * for the kind. Defaults to the deployment's hook for `kind` ({@link fPoolHookFor}) — the one
865
+ * every protocol pool names.
866
+ */
867
+ hook?: Address;
868
+ /** Who is born holding the pool: immutable identity, the pool's first authority (the hook records it). */
869
+ creator: Address;
356
870
  /**
357
871
  * The differentiator, and nothing else. Identity is the key's hash, so one sponsor cannot run
358
872
  * two pools of the same shape without varying it — the second `initialize` would land on the
@@ -370,6 +884,17 @@ export declare function sortFPoolLegs<T>(bases: Address[], ...companions: T[][])
370
884
  bases: Address[];
371
885
  companions: T[][];
372
886
  };
887
+ /** The key as the manager hashes it: legs sorted, the kind's hook filled in when none is named. */
888
+ export declare function fPoolKeyOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): {
889
+ quote: `0x${string}`;
890
+ bases: `0x${string}`[];
891
+ weights: bigint[];
892
+ phi: bigint;
893
+ kind: 0 | 1 | 3 | 2;
894
+ hook: `0x${string}`;
895
+ creator: `0x${string}`;
896
+ salt: `0x${string}`;
897
+ };
373
898
  /** Create the pool (no funds move — `seed` arms it). Returns the tx hash; read the id with `fPoolIdOf`. */
374
899
  export declare function fPoolInitialize(c: LogswapClient, a: FPoolCreateArgs): Promise<`0x${string}`>;
375
900
  /** The pool id is the key's hash — pure, so it can be read before or after creation. */
@@ -401,22 +926,22 @@ export declare function fPoolSeed(c: LogswapClient, a: {
401
926
  weights: bigint[];
402
927
  })): Promise<`0x${string}`>;
403
928
  /**
404
- * Retire the live generation (decisions 025, 032, 035) — the raw entry. Allowed only at an empty
405
- * bid, Q ≤ L/1e9, on every pool: the market took it, or the authority harvested it out first
406
- * ({@link fPoolRetire} does both in one transaction). The live (S, Q, R_j) become a frozen bundle
407
- * every share of this generation redeems ({@link fPoolRedeem}) or rolls ({@link fPoolRollIn}),
408
- * forever; the pool is unseeded until the next {@link fPoolSeed}, which opens generation
409
- * `gen + 1` under the same id, gates and lists.
929
+ * Retire the live generation (decisions 025, 032, 035) — the raw entry (`dissolve` before F
930
+ * version 14). Allowed only at an empty bid, Q ≤ L/1e9, on every pool: the market took it, or the
931
+ * operator harvested it out first ({@link fPoolRetire} does both in one transaction). The live
932
+ * (S, Q, R_j) become a frozen bundle every share of this generation redeems ({@link fPoolRedeem})
933
+ * or rolls ({@link fPoolRollIn}), forever; the pool is unseeded until the next {@link fPoolSeed},
934
+ * which opens generation `gen + 1` under the same id, hook, roles, gates and lists.
410
935
  */
411
- export declare function fPoolDissolve(c: LogswapClient, a: {
936
+ export declare function fPoolRetireRaw(c: LogswapClient, a: {
412
937
  poolId: Hex;
413
938
  account: Address;
414
939
  }): Promise<`0x${string}`>;
415
940
  /**
416
- * Retire the live generation as ONE transaction: the harvests that empty the bid
941
+ * Retire the live generation as ONE transaction: the harvest that empties the bid
417
942
  * ({@link fPoolEmptyingHarvests} — a dividend to every share; none when it is already empty),
418
- * then `dissolve` — the manager's `multicall`, the authority as sender. What a sponsor's
419
- * "dissolve" button should call. Throws before sending on a pad that still bids.
943
+ * then `retire` — the manager's `multicall`, the operator as sender. What a sponsor's
944
+ * "retire" button should call. Throws before sending on a pad that still bids.
420
945
  */
421
946
  export declare function fPoolRetire(c: LogswapClient, a: {
422
947
  poolId: Hex;
@@ -424,25 +949,37 @@ export declare function fPoolRetire(c: LogswapClient, a: {
424
949
  }): Promise<`0x${string}`>;
425
950
  /**
426
951
  * The harvests that empty an unlocked pool's bid, in order — what a relaunch sends before its
427
- * `dissolve` (decisions 035: a dissolve needs an empty bid on every pool). One `harvest(Q)` when a
428
- * collector is set. With none, the cut on income STAYS in the pool as LP quote (decisions 002)
429
- * and reads as taken income, so a second harvest — capital, no cut — takes the rest; the
430
- * contract's own arithmetic, replayed. `[]` when the bid is already empty. Throws on a
431
- * pad that still bids (its bid empties only as the market sells it down), and in
432
- * the one shape two harvests cannot empty (no collector, income above Q — harvest by hand).
952
+ * `retire` (decisions 035: a retire needs an empty bid on every pool). Since F version 14 one
953
+ * `harvest(Q)` does it: the protocol's cut leaves the pool with the amount (with no collector
954
+ * there is no cut). `[]` when the bid is already empty. Throws on a pad that still bids (its bid
955
+ * empties only as the market sells it down), and when the pool's hook keeps a floor on the bid
956
+ * (`PolHook.keepQuote`, decisions 044): a `retire` under that hook waits for the market.
433
957
  */
434
958
  export declare function fPoolEmptyingHarvests(c: LogswapClient, poolId: Hex): Promise<bigint[]>;
959
+ /**
960
+ * Release the dead shares' pot under the hook's terms (decisions 041, 044) — a pad's graduation.
961
+ * The manager harvests the generation's income first (the pot then holds everything the dead
962
+ * shares earned), asks the hook, and applies its answer: a share to the payee it names (the pad's
963
+ * creator — the pool's authority), a cut to the collector, the rest bought in as more of the
964
+ * float the pool owns, a slice of every reserve burned. The hook refuses under its rung's
965
+ * threshold (`PadHook.NotGraduated`). Whoever runs the pool.
966
+ */
967
+ export declare function fPoolRegenerate(c: LogswapClient, a: {
968
+ poolId: Hex;
969
+ to?: Address;
970
+ account: Address;
971
+ }): Promise<`0x${string}`>;
435
972
  /**
436
973
  * The relaunch as ONE transaction (decisions 025, 032, 035, 037): `harvest` the bid out — a
437
- * dividend to every share, {@link fPoolEmptyingHarvests} — `dissolve` the live generation at the
974
+ * dividend to every share, {@link fPoolEmptyingHarvests} — `retire` the live generation at the
438
975
  * empty bid, `redeem` the caller's own shares of it (when `shares` > 0), optionally `setLegs` the
439
976
  * next generation's composition (`legs`: a private pool's reshape — retire, admit, reweight), and
440
977
  * `seed` it with what came back — the manager's `multicall`, one sender throughout, the same
441
978
  * pool. The operator's when one is appointed and the seed's inventory is its own; by default the
442
- * authority's. Gates, allowlist and names carry over; anything else goes in `extra`, pre-encoded
443
- * against {@link fPoolManagerAbi}. The seed names reserves (decisions 029): `r0` outright — one
444
- * per leg of the NEXT table, 0 for a retired leg — or `x0` marks against the next table's
445
- * `weights`.
979
+ * authority's. The hook, its roles, gates, allowlist and the name carry over; anything else goes
980
+ * in `extra`, pre-encoded against {@link fPoolManagerAbi}. The seed names reserves (decisions
981
+ * 029): `r0` outright — one per leg of the NEXT table, 0 for a retired leg — or `x0` marks
982
+ * against the next table's `weights`.
446
983
  */
447
984
  export declare function fPoolRelaunch(c: LogswapClient, a: {
448
985
  poolId: Hex;
@@ -506,6 +1043,16 @@ export declare function fPoolLaunchCalls(poolId: Hex, a: FPoolLaunchArgs & ({
506
1043
  } | {
507
1044
  x0: bigint[];
508
1045
  })): Hex[];
1046
+ /**
1047
+ * The desk's opening posture, on its hook (decisions 044): gated minting, the creator listed. No
1048
+ * appointment: the authority is the operator until one is appointed (decisions 037). Two writes
1049
+ * to `PrivateHook`; the launch batch cannot carry them (they are not manager calls).
1050
+ */
1051
+ export declare function fPoolDeskOpening(c: LogswapClient, a: {
1052
+ poolId: Hex;
1053
+ account: Address;
1054
+ hook?: Address;
1055
+ }): Promise<Hash[]>;
509
1056
  /**
510
1057
  * Create a pool as ONE transaction: `initialize`, `seed`, the seed lock, the opening buy, the
511
1058
  * name, the private-pool gates — the manager's `multicall`, the creator as sender throughout.
@@ -532,36 +1079,47 @@ export declare function fPoolLaunch(c: LogswapClient, a: FPoolLaunchArgs & ({
532
1079
  poolId: Hex;
533
1080
  }>;
534
1081
  /**
535
- * Propose the next authority — step one of two (contracts `2aa6b7b`, decisions 020). Nothing moves
1082
+ * Propose the next authority — step one of two (decisions 020), on the pool's hook. Nothing moves
536
1083
  * until `next` accepts; proposing again (the zero address included) cancels a pending proposal.
537
- * Indexed on-chain via AuthorityProposed.
1084
+ * Indexed on-chain via the hook's AuthorityProposed.
538
1085
  */
539
1086
  export declare function fPoolProposeAuthority(c: LogswapClient, a: {
540
1087
  poolId: Hex;
541
1088
  next: Address;
542
1089
  account: Address;
1090
+ hook?: Address;
543
1091
  }): Promise<`0x${string}`>;
544
- /** Accept a pending proposal — step two; only the proposed address can. Indexed via AuthoritySet. */
1092
+ /**
1093
+ * Accept a pending proposal — step two; only the proposed address can. Indexed via the hook's
1094
+ * AuthoritySet. On the desk's hook this clears the operator (pending and accepted) and voids the
1095
+ * seller's list (decisions 040, 044).
1096
+ */
545
1097
  export declare function fPoolAcceptAuthority(c: LogswapClient, a: {
546
1098
  poolId: Hex;
547
1099
  account: Address;
1100
+ hook?: Address;
548
1101
  }): Promise<`0x${string}`>;
549
- /** Turn the mint / swap gates on or off (authority). `burn` is never gated. */
1102
+ /** Turn the mint / swap gates on or off (the authority, on the desk's hook). `burn` is never gated. */
550
1103
  export declare function fPoolSetGates(c: LogswapClient, a: {
551
1104
  poolId: Hex;
552
1105
  gateMint: boolean;
553
1106
  gateSwap: boolean;
554
1107
  account: Address;
1108
+ hook?: Address;
555
1109
  }): Promise<`0x${string}`>;
556
- /** Add to or remove from the pool's list, in one call (authority). */
1110
+ /**
1111
+ * Add to or remove from the pool's list, in one call (the authority, on the desk's hook). The list
1112
+ * is keyed by the authority that granted it: a handover starts the buyer with an empty one.
1113
+ */
557
1114
  export declare function fPoolSetAllowed(c: LogswapClient, a: {
558
1115
  poolId: Hex;
559
1116
  who: readonly Address[];
560
1117
  allowed: boolean;
561
1118
  account: Address;
1119
+ hook?: Address;
562
1120
  }): Promise<`0x${string}`>;
563
- /** Whether `who` is on the pool's list (consulted only while a gate is on). */
564
- export declare function fPoolIsAllowed(c: LogswapClient, poolId: Hex, who: Address): Promise<boolean>;
1121
+ /** Whether `who` is on the pool's list under its current authority (consulted only while a gate is on). */
1122
+ export declare function fPoolIsAllowed(c: LogswapClient, poolId: Hex, who: Address, hook?: Address): Promise<boolean>;
565
1123
  /** Label the pool — the sponsor's own words, mutable, never identity. At most 31 bytes of UTF-8. */
566
1124
  export declare function fPoolSetName(c: LogswapClient, a: {
567
1125
  poolId: Hex;
@@ -580,25 +1138,27 @@ export declare function fPoolSetSponsorName(c: LogswapClient, a: {
580
1138
  /** The protocol's attestation for an address, or "" when unattested — which most addresses are. */
581
1139
  export declare function fPoolSponsorName(c: LogswapClient, who: Address): Promise<string>;
582
1140
  /** Who runs the pool (decisions 037): the appointed operator, or the authority until one is. */
583
- export declare function fPoolOperatorOf(s: Pick<FPoolState, "authority" | "operator">): Address;
1141
+ export declare function fPoolOperatorOf(s: Pick<FPoolRoles, "authority" | "operator">): Address;
584
1142
  /**
585
- * Propose the operator (authority; private pools only) — the hot key that runs the pool: `harvest`,
586
- * `dissolve`, `setLegs`. Two-step: the proposed address takes the role with
1143
+ * Propose the operator (the authority, on the desk's hook) — the hot key that runs the pool:
1144
+ * `harvest`, `retire`, `regenerate`, `setLegs`. Two-step: the proposed address takes the role with
587
1145
  * {@link fPoolAcceptOperator}. The zero address clears at once — the role returns to the authority.
588
1146
  */
589
1147
  export declare function fPoolAppointOperator(c: LogswapClient, a: {
590
1148
  poolId: Hex;
591
1149
  operator: Address;
592
1150
  account: Address;
1151
+ hook?: Address;
593
1152
  }): Promise<`0x${string}`>;
594
1153
  /** The proposed operator takes the role. */
595
1154
  export declare function fPoolAcceptOperator(c: LogswapClient, a: {
596
1155
  poolId: Hex;
597
1156
  account: Address;
1157
+ hook?: Address;
598
1158
  }): Promise<`0x${string}`>;
599
1159
  /**
600
1160
  * The next generation's composition (operator; private pools only; ONLY while the pool is
601
- * unseeded — between a dissolve and the seed that prices it, decisions 037). `weights` has one
1161
+ * unseeded — between a retire and the seed that prices it, decisions 037). `weights` has one
602
1162
  * entry per leg the pool has ever had, in index order (0 retires a leg; indices are never reused),
603
1163
  * then one per base in `newBases`, appended; they sum to 1e18 exactly. No value moves: the
604
1164
  * following {@link fPoolSeed} names every reserve. A live reshape is {@link fPoolRelaunch} with
@@ -629,7 +1189,10 @@ export interface DiscoveredFPool {
629
1189
  weights: bigint[];
630
1190
  phi: bigint;
631
1191
  kind: FPoolKind;
632
- authority: Address;
1192
+ /** The pool's policy — the hook the key names (decisions 041, 044). */
1193
+ hook: Address;
1194
+ /** Who was born holding the pool (immutable). The LIVE authority is the hook's — {@link getFPoolRoles}. */
1195
+ creator: Address;
633
1196
  /** The block the pool was initialized in — its age, for annualising realized income. */
634
1197
  block: bigint;
635
1198
  /** Whether `seed` has run; an unseeded pool has no floor and no float, so nothing to show. */
@@ -653,6 +1216,51 @@ export declare function discoverFPools(c: LogswapClient, opts?: {
653
1216
  fromBlock?: bigint;
654
1217
  toBlock?: bigint;
655
1218
  }): Promise<DiscoveredFPool[]>;
1219
+ /** A pool an authority controls, with what the policy page shows of it. */
1220
+ export interface FPoolControlled {
1221
+ pool: DiscoveredFPool;
1222
+ roles: FPoolRoles;
1223
+ state: FPoolState;
1224
+ /** The hook's numbers for this pool's kind — a pad's rung and threshold, a POL's floors, the desk's list flags. */
1225
+ policy: FPoolPolicy;
1226
+ }
1227
+ /** What a pool's hook says about it, by kind: the terms a buyer reads before entering. */
1228
+ export type FPoolPolicy = {
1229
+ kind: "pad";
1230
+ harvestCut: bigint;
1231
+ rung: number;
1232
+ threshold: bigint;
1233
+ pot: bigint;
1234
+ creatorShare: bigint;
1235
+ protocolShare: bigint;
1236
+ burnPerRung: bigint;
1237
+ } | {
1238
+ kind: "pol";
1239
+ harvestCut: bigint;
1240
+ keepQuote: bigint;
1241
+ minQuoteAtSeed: bigint;
1242
+ } | {
1243
+ kind: "public";
1244
+ harvestCut: bigint;
1245
+ curated: boolean;
1246
+ } | {
1247
+ kind: "private";
1248
+ harvestCut: bigint;
1249
+ gateMint: boolean;
1250
+ gateSwap: boolean;
1251
+ operator: Address;
1252
+ };
1253
+ /** The hook's terms for one pool, by its kind. */
1254
+ export declare function getFPoolPolicy(c: LogswapClient, s: Pick<FPoolState, "poolId" | "hook" | "kind" | "gen">, roles?: FPoolRoles): Promise<FPoolPolicy>;
1255
+ /**
1256
+ * Every F pool `who` is the AUTHORITY of, across the four hooks — the policy page's list. Pools
1257
+ * `who` created and handed over are not here (the buyer's page shows them); pools handed TO
1258
+ * `who` are. `pools` may be passed (from the indexer, say) to skip the log scan.
1259
+ */
1260
+ export declare function fPoolsControlledBy(c: LogswapClient, who: Address, opts?: {
1261
+ pools?: DiscoveredFPool[];
1262
+ fromBlock?: bigint;
1263
+ }): Promise<FPoolControlled[]>;
656
1264
  /**
657
1265
  * Every holder of a pool's shares, from the ERC-6909 Transfer stream — the id is an indexed
658
1266
  * topic, so one filtered log query aggregates the whole ledger. The 0xdead entry is the