@logswap/sdk 0.5.91 → 0.5.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -18
- package/dist/admin.d.ts +48 -871
- package/dist/admin.js +55 -110
- package/dist/chains.d.ts +4 -4
- package/dist/chains.js +2 -3
- package/dist/client.d.ts +6 -7
- package/dist/client.js +12 -1
- package/dist/fpool.d.ts +298 -801
- package/dist/fpool.js +312 -336
- package/dist/generated.d.ts +1707 -3843
- package/dist/generated.js +982 -2248
- package/dist/history.js +7 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/write.js +2 -2
- package/package.json +1 -1
- package/src/admin.ts +66 -169
- package/src/chains.ts +6 -7
- package/src/client.ts +17 -7
- package/src/fpool.ts +449 -510
- package/src/generated.ts +938 -2210
- package/src/history.ts +5 -7
- package/src/index.ts +1 -1
- package/src/write.ts +2 -2
package/dist/fpool.d.ts
CHANGED
|
@@ -18,14 +18,16 @@
|
|
|
18
18
|
* and release) — and nothing in the maths. `describeFPool` below reports
|
|
19
19
|
* which shape a given pool is, because a UI has to decide what to render.
|
|
20
20
|
*
|
|
21
|
-
* **The roles are the policy's
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* ({@link
|
|
27
|
-
*
|
|
28
|
-
*
|
|
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.
|
|
29
31
|
*
|
|
30
32
|
* **Zaps live on the ROUTER, not here.** `RouterF` is F's own router and its own Permit2 spender (decision 096: one
|
|
31
33
|
* router per manager; a second spender is a second signature, not a second on-chain approval). See
|
|
@@ -33,517 +35,13 @@
|
|
|
33
35
|
* `onboardToken(c, "F", token, need)`.
|
|
34
36
|
*/
|
|
35
37
|
import { type Address, type Hash, type Hex } from "viem";
|
|
36
|
-
import { managerFAbi,
|
|
38
|
+
import { managerFAbi, policyFAbi } from "./generated.js";
|
|
37
39
|
/**
|
|
38
|
-
* One contract, one ABI (F version 12): `harvest`, `claim`, `
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `"sponsor"`, decision 098), {@link padPolicyAbi} / {@link polPolicyAbi} the other kinds', and
|
|
42
|
-
* {@link orphanPolicyFAbi} the neutral policy of a pool the LOG orphaned.
|
|
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
43
|
*/
|
|
44
|
-
export { managerFAbi,
|
|
45
|
-
/**
|
|
46
|
-
* What the protocol's policies share: `authority`, `nameOf` / `setName`, `kind`, `maxHarvest`
|
|
47
|
-
* (a harvest has no cut, decisions 056). `polPolicyAbi` is a superset of it, so it stands in for the base: a call
|
|
48
|
-
* through it to any F policy decodes the base's functions (`maxHarvest` is absent on the orphan policy, which refuses every harvest).
|
|
49
|
-
*/
|
|
50
|
-
export declare const fPolicyBaseAbi: readonly [{
|
|
51
|
-
readonly type: "constructor";
|
|
52
|
-
readonly inputs: readonly [{
|
|
53
|
-
readonly name: "manager_";
|
|
54
|
-
readonly internalType: "contract ManagerF";
|
|
55
|
-
readonly type: "address";
|
|
56
|
-
}, {
|
|
57
|
-
readonly name: "sponsor_";
|
|
58
|
-
readonly internalType: "address";
|
|
59
|
-
readonly type: "address";
|
|
60
|
-
}, {
|
|
61
|
-
readonly name: "incomeTaxRate_";
|
|
62
|
-
readonly internalType: "uint256";
|
|
63
|
-
readonly type: "uint256";
|
|
64
|
-
}, {
|
|
65
|
-
readonly name: "minQuoteRatio_";
|
|
66
|
-
readonly internalType: "uint256";
|
|
67
|
-
readonly type: "uint256";
|
|
68
|
-
}];
|
|
69
|
-
readonly stateMutability: "nonpayable";
|
|
70
|
-
}, {
|
|
71
|
-
readonly type: "function";
|
|
72
|
-
readonly inputs: readonly [{
|
|
73
|
-
readonly name: "";
|
|
74
|
-
readonly internalType: "bytes32";
|
|
75
|
-
readonly type: "bytes32";
|
|
76
|
-
}];
|
|
77
|
-
readonly name: "authority";
|
|
78
|
-
readonly outputs: readonly [{
|
|
79
|
-
readonly name: "";
|
|
80
|
-
readonly internalType: "address";
|
|
81
|
-
readonly type: "address";
|
|
82
|
-
}];
|
|
83
|
-
readonly stateMutability: "view";
|
|
84
|
-
}, {
|
|
85
|
-
readonly type: "function";
|
|
86
|
-
readonly inputs: readonly [{
|
|
87
|
-
readonly name: "poolId";
|
|
88
|
-
readonly internalType: "bytes32";
|
|
89
|
-
readonly type: "bytes32";
|
|
90
|
-
}];
|
|
91
|
-
readonly name: "incomeTax";
|
|
92
|
-
readonly outputs: readonly [{
|
|
93
|
-
readonly name: "";
|
|
94
|
-
readonly internalType: "address";
|
|
95
|
-
readonly type: "address";
|
|
96
|
-
}, {
|
|
97
|
-
readonly name: "";
|
|
98
|
-
readonly internalType: "uint256";
|
|
99
|
-
readonly type: "uint256";
|
|
100
|
-
}];
|
|
101
|
-
readonly stateMutability: "view";
|
|
102
|
-
}, {
|
|
103
|
-
readonly type: "function";
|
|
104
|
-
readonly inputs: readonly [];
|
|
105
|
-
readonly name: "incomeTaxRate";
|
|
106
|
-
readonly outputs: readonly [{
|
|
107
|
-
readonly name: "";
|
|
108
|
-
readonly internalType: "uint256";
|
|
109
|
-
readonly type: "uint256";
|
|
110
|
-
}];
|
|
111
|
-
readonly stateMutability: "view";
|
|
112
|
-
}, {
|
|
113
|
-
readonly type: "function";
|
|
114
|
-
readonly inputs: readonly [];
|
|
115
|
-
readonly name: "kind";
|
|
116
|
-
readonly outputs: readonly [{
|
|
117
|
-
readonly name: "";
|
|
118
|
-
readonly internalType: "bytes32";
|
|
119
|
-
readonly type: "bytes32";
|
|
120
|
-
}];
|
|
121
|
-
readonly stateMutability: "pure";
|
|
122
|
-
}, {
|
|
123
|
-
readonly type: "function";
|
|
124
|
-
readonly inputs: readonly [];
|
|
125
|
-
readonly name: "manager";
|
|
126
|
-
readonly outputs: readonly [{
|
|
127
|
-
readonly name: "";
|
|
128
|
-
readonly internalType: "address";
|
|
129
|
-
readonly type: "address";
|
|
130
|
-
}];
|
|
131
|
-
readonly stateMutability: "view";
|
|
132
|
-
}, {
|
|
133
|
-
readonly type: "function";
|
|
134
|
-
readonly inputs: readonly [{
|
|
135
|
-
readonly name: "poolId";
|
|
136
|
-
readonly internalType: "bytes32";
|
|
137
|
-
readonly type: "bytes32";
|
|
138
|
-
}];
|
|
139
|
-
readonly name: "maxHarvest";
|
|
140
|
-
readonly outputs: readonly [{
|
|
141
|
-
readonly name: "";
|
|
142
|
-
readonly internalType: "uint256";
|
|
143
|
-
readonly type: "uint256";
|
|
144
|
-
}];
|
|
145
|
-
readonly stateMutability: "view";
|
|
146
|
-
}, {
|
|
147
|
-
readonly type: "function";
|
|
148
|
-
readonly inputs: readonly [{
|
|
149
|
-
readonly name: "a";
|
|
150
|
-
readonly internalType: "struct IPolicy.Ask";
|
|
151
|
-
readonly type: "tuple";
|
|
152
|
-
readonly components: readonly [{
|
|
153
|
-
readonly name: "poolId";
|
|
154
|
-
readonly internalType: "bytes32";
|
|
155
|
-
readonly type: "bytes32";
|
|
156
|
-
}, {
|
|
157
|
-
readonly name: "gen";
|
|
158
|
-
readonly internalType: "uint256";
|
|
159
|
-
readonly type: "uint256";
|
|
160
|
-
}, {
|
|
161
|
-
readonly name: "action";
|
|
162
|
-
readonly internalType: "enum IPolicy.Action";
|
|
163
|
-
readonly type: "uint8";
|
|
164
|
-
}, {
|
|
165
|
-
readonly name: "who";
|
|
166
|
-
readonly internalType: "address";
|
|
167
|
-
readonly type: "address";
|
|
168
|
-
}, {
|
|
169
|
-
readonly name: "amount";
|
|
170
|
-
readonly internalType: "uint256";
|
|
171
|
-
readonly type: "uint256";
|
|
172
|
-
}, {
|
|
173
|
-
readonly name: "income";
|
|
174
|
-
readonly internalType: "uint256";
|
|
175
|
-
readonly type: "uint256";
|
|
176
|
-
}, {
|
|
177
|
-
readonly name: "Q";
|
|
178
|
-
readonly internalType: "uint256";
|
|
179
|
-
readonly type: "uint256";
|
|
180
|
-
}, {
|
|
181
|
-
readonly name: "L";
|
|
182
|
-
readonly internalType: "uint256";
|
|
183
|
-
readonly type: "uint256";
|
|
184
|
-
}, {
|
|
185
|
-
readonly name: "n";
|
|
186
|
-
readonly internalType: "uint256";
|
|
187
|
-
readonly type: "uint256";
|
|
188
|
-
}];
|
|
189
|
-
}];
|
|
190
|
-
readonly name: "may";
|
|
191
|
-
readonly outputs: readonly [{
|
|
192
|
-
readonly name: "";
|
|
193
|
-
readonly internalType: "bytes4";
|
|
194
|
-
readonly type: "bytes4";
|
|
195
|
-
}];
|
|
196
|
-
readonly stateMutability: "view";
|
|
197
|
-
}, {
|
|
198
|
-
readonly type: "function";
|
|
199
|
-
readonly inputs: readonly [];
|
|
200
|
-
readonly name: "minQuoteRatio";
|
|
201
|
-
readonly outputs: readonly [{
|
|
202
|
-
readonly name: "";
|
|
203
|
-
readonly internalType: "uint256";
|
|
204
|
-
readonly type: "uint256";
|
|
205
|
-
}];
|
|
206
|
-
readonly stateMutability: "view";
|
|
207
|
-
}, {
|
|
208
|
-
readonly type: "function";
|
|
209
|
-
readonly inputs: readonly [{
|
|
210
|
-
readonly name: "";
|
|
211
|
-
readonly internalType: "bytes32";
|
|
212
|
-
readonly type: "bytes32";
|
|
213
|
-
}];
|
|
214
|
-
readonly name: "nameOf";
|
|
215
|
-
readonly outputs: readonly [{
|
|
216
|
-
readonly name: "";
|
|
217
|
-
readonly internalType: "bytes32";
|
|
218
|
-
readonly type: "bytes32";
|
|
219
|
-
}];
|
|
220
|
-
readonly stateMutability: "view";
|
|
221
|
-
}, {
|
|
222
|
-
readonly type: "function";
|
|
223
|
-
readonly inputs: readonly [{
|
|
224
|
-
readonly name: "";
|
|
225
|
-
readonly internalType: "bytes32";
|
|
226
|
-
readonly type: "bytes32";
|
|
227
|
-
}, {
|
|
228
|
-
readonly name: "";
|
|
229
|
-
readonly internalType: "address";
|
|
230
|
-
readonly type: "address";
|
|
231
|
-
}, {
|
|
232
|
-
readonly name: "";
|
|
233
|
-
readonly internalType: "struct PoolKeyC";
|
|
234
|
-
readonly type: "tuple";
|
|
235
|
-
readonly components: readonly [{
|
|
236
|
-
readonly name: "base";
|
|
237
|
-
readonly internalType: "address";
|
|
238
|
-
readonly type: "address";
|
|
239
|
-
}, {
|
|
240
|
-
readonly name: "quote";
|
|
241
|
-
readonly internalType: "address";
|
|
242
|
-
readonly type: "address";
|
|
243
|
-
}, {
|
|
244
|
-
readonly name: "tickSpacing";
|
|
245
|
-
readonly internalType: "int256";
|
|
246
|
-
readonly type: "int256";
|
|
247
|
-
}, {
|
|
248
|
-
readonly name: "policy";
|
|
249
|
-
readonly internalType: "address";
|
|
250
|
-
readonly type: "address";
|
|
251
|
-
}, {
|
|
252
|
-
readonly name: "creator";
|
|
253
|
-
readonly internalType: "address";
|
|
254
|
-
readonly type: "address";
|
|
255
|
-
}, {
|
|
256
|
-
readonly name: "salt";
|
|
257
|
-
readonly internalType: "bytes32";
|
|
258
|
-
readonly type: "bytes32";
|
|
259
|
-
}, {
|
|
260
|
-
readonly name: "swapFee";
|
|
261
|
-
readonly internalType: "uint256";
|
|
262
|
-
readonly type: "uint256";
|
|
263
|
-
}, {
|
|
264
|
-
readonly name: "mintFee";
|
|
265
|
-
readonly internalType: "uint256";
|
|
266
|
-
readonly type: "uint256";
|
|
267
|
-
}];
|
|
268
|
-
}];
|
|
269
|
-
readonly name: "onInitialize";
|
|
270
|
-
readonly outputs: readonly [{
|
|
271
|
-
readonly name: "";
|
|
272
|
-
readonly internalType: "uint8";
|
|
273
|
-
readonly type: "uint8";
|
|
274
|
-
}, {
|
|
275
|
-
readonly name: "";
|
|
276
|
-
readonly internalType: "uint256";
|
|
277
|
-
readonly type: "uint256";
|
|
278
|
-
}, {
|
|
279
|
-
readonly name: "";
|
|
280
|
-
readonly internalType: "address";
|
|
281
|
-
readonly type: "address";
|
|
282
|
-
}];
|
|
283
|
-
readonly stateMutability: "nonpayable";
|
|
284
|
-
}, {
|
|
285
|
-
readonly type: "function";
|
|
286
|
-
readonly inputs: readonly [{
|
|
287
|
-
readonly name: "poolId";
|
|
288
|
-
readonly internalType: "bytes32";
|
|
289
|
-
readonly type: "bytes32";
|
|
290
|
-
}, {
|
|
291
|
-
readonly name: "";
|
|
292
|
-
readonly internalType: "address";
|
|
293
|
-
readonly type: "address";
|
|
294
|
-
}, {
|
|
295
|
-
readonly name: "key";
|
|
296
|
-
readonly internalType: "struct PoolKeyF";
|
|
297
|
-
readonly type: "tuple";
|
|
298
|
-
readonly components: readonly [{
|
|
299
|
-
readonly name: "quote";
|
|
300
|
-
readonly internalType: "address";
|
|
301
|
-
readonly type: "address";
|
|
302
|
-
}, {
|
|
303
|
-
readonly name: "bases";
|
|
304
|
-
readonly internalType: "address[]";
|
|
305
|
-
readonly type: "address[]";
|
|
306
|
-
}, {
|
|
307
|
-
readonly name: "swapFee";
|
|
308
|
-
readonly internalType: "uint256";
|
|
309
|
-
readonly type: "uint256";
|
|
310
|
-
}, {
|
|
311
|
-
readonly name: "policy";
|
|
312
|
-
readonly internalType: "address";
|
|
313
|
-
readonly type: "address";
|
|
314
|
-
}, {
|
|
315
|
-
readonly name: "creator";
|
|
316
|
-
readonly internalType: "address";
|
|
317
|
-
readonly type: "address";
|
|
318
|
-
}, {
|
|
319
|
-
readonly name: "salt";
|
|
320
|
-
readonly internalType: "bytes32";
|
|
321
|
-
readonly type: "bytes32";
|
|
322
|
-
}, {
|
|
323
|
-
readonly name: "mintFee";
|
|
324
|
-
readonly internalType: "uint256";
|
|
325
|
-
readonly type: "uint256";
|
|
326
|
-
}];
|
|
327
|
-
}];
|
|
328
|
-
readonly name: "onInitialize";
|
|
329
|
-
readonly outputs: readonly [{
|
|
330
|
-
readonly name: "";
|
|
331
|
-
readonly internalType: "uint8";
|
|
332
|
-
readonly type: "uint8";
|
|
333
|
-
}, {
|
|
334
|
-
readonly name: "";
|
|
335
|
-
readonly internalType: "uint256";
|
|
336
|
-
readonly type: "uint256";
|
|
337
|
-
}, {
|
|
338
|
-
readonly name: "";
|
|
339
|
-
readonly internalType: "address";
|
|
340
|
-
readonly type: "address";
|
|
341
|
-
}];
|
|
342
|
-
readonly stateMutability: "nonpayable";
|
|
343
|
-
}, {
|
|
344
|
-
readonly type: "function";
|
|
345
|
-
readonly inputs: readonly [{
|
|
346
|
-
readonly name: "poolId";
|
|
347
|
-
readonly internalType: "bytes32";
|
|
348
|
-
readonly type: "bytes32";
|
|
349
|
-
}, {
|
|
350
|
-
readonly name: "from";
|
|
351
|
-
readonly internalType: "address";
|
|
352
|
-
readonly type: "address";
|
|
353
|
-
}, {
|
|
354
|
-
readonly name: "";
|
|
355
|
-
readonly internalType: "address";
|
|
356
|
-
readonly type: "address";
|
|
357
|
-
}, {
|
|
358
|
-
readonly name: "authority_";
|
|
359
|
-
readonly internalType: "address";
|
|
360
|
-
readonly type: "address";
|
|
361
|
-
}, {
|
|
362
|
-
readonly name: "name_";
|
|
363
|
-
readonly internalType: "bytes32";
|
|
364
|
-
readonly type: "bytes32";
|
|
365
|
-
}];
|
|
366
|
-
readonly name: "onMigrate";
|
|
367
|
-
readonly outputs: readonly [{
|
|
368
|
-
readonly name: "";
|
|
369
|
-
readonly internalType: "uint8";
|
|
370
|
-
readonly type: "uint8";
|
|
371
|
-
}];
|
|
372
|
-
readonly stateMutability: "nonpayable";
|
|
373
|
-
}, {
|
|
374
|
-
readonly type: "function";
|
|
375
|
-
readonly inputs: readonly [{
|
|
376
|
-
readonly name: "a";
|
|
377
|
-
readonly internalType: "struct IPolicy.Ask";
|
|
378
|
-
readonly type: "tuple";
|
|
379
|
-
readonly components: readonly [{
|
|
380
|
-
readonly name: "poolId";
|
|
381
|
-
readonly internalType: "bytes32";
|
|
382
|
-
readonly type: "bytes32";
|
|
383
|
-
}, {
|
|
384
|
-
readonly name: "gen";
|
|
385
|
-
readonly internalType: "uint256";
|
|
386
|
-
readonly type: "uint256";
|
|
387
|
-
}, {
|
|
388
|
-
readonly name: "action";
|
|
389
|
-
readonly internalType: "enum IPolicy.Action";
|
|
390
|
-
readonly type: "uint8";
|
|
391
|
-
}, {
|
|
392
|
-
readonly name: "who";
|
|
393
|
-
readonly internalType: "address";
|
|
394
|
-
readonly type: "address";
|
|
395
|
-
}, {
|
|
396
|
-
readonly name: "amount";
|
|
397
|
-
readonly internalType: "uint256";
|
|
398
|
-
readonly type: "uint256";
|
|
399
|
-
}, {
|
|
400
|
-
readonly name: "income";
|
|
401
|
-
readonly internalType: "uint256";
|
|
402
|
-
readonly type: "uint256";
|
|
403
|
-
}, {
|
|
404
|
-
readonly name: "Q";
|
|
405
|
-
readonly internalType: "uint256";
|
|
406
|
-
readonly type: "uint256";
|
|
407
|
-
}, {
|
|
408
|
-
readonly name: "L";
|
|
409
|
-
readonly internalType: "uint256";
|
|
410
|
-
readonly type: "uint256";
|
|
411
|
-
}, {
|
|
412
|
-
readonly name: "n";
|
|
413
|
-
readonly internalType: "uint256";
|
|
414
|
-
readonly type: "uint256";
|
|
415
|
-
}];
|
|
416
|
-
}];
|
|
417
|
-
readonly name: "onRegenerate";
|
|
418
|
-
readonly outputs: readonly [{
|
|
419
|
-
readonly name: "t";
|
|
420
|
-
readonly internalType: "struct IPolicy.Terms";
|
|
421
|
-
readonly type: "tuple";
|
|
422
|
-
readonly components: readonly [{
|
|
423
|
-
readonly name: "payee";
|
|
424
|
-
readonly internalType: "address";
|
|
425
|
-
readonly type: "address";
|
|
426
|
-
}, {
|
|
427
|
-
readonly name: "toPayee";
|
|
428
|
-
readonly internalType: "uint256";
|
|
429
|
-
readonly type: "uint256";
|
|
430
|
-
}, {
|
|
431
|
-
readonly name: "minQuoteRatio";
|
|
432
|
-
readonly internalType: "uint256";
|
|
433
|
-
readonly type: "uint256";
|
|
434
|
-
}, {
|
|
435
|
-
readonly name: "carried";
|
|
436
|
-
readonly internalType: "address";
|
|
437
|
-
readonly type: "address";
|
|
438
|
-
}];
|
|
439
|
-
}];
|
|
440
|
-
readonly stateMutability: "nonpayable";
|
|
441
|
-
}, {
|
|
442
|
-
readonly type: "function";
|
|
443
|
-
readonly inputs: readonly [];
|
|
444
|
-
readonly name: "registry";
|
|
445
|
-
readonly outputs: readonly [{
|
|
446
|
-
readonly name: "";
|
|
447
|
-
readonly internalType: "address";
|
|
448
|
-
readonly type: "address";
|
|
449
|
-
}];
|
|
450
|
-
readonly stateMutability: "view";
|
|
451
|
-
}, {
|
|
452
|
-
readonly type: "function";
|
|
453
|
-
readonly inputs: readonly [{
|
|
454
|
-
readonly name: "poolId";
|
|
455
|
-
readonly internalType: "bytes32";
|
|
456
|
-
readonly type: "bytes32";
|
|
457
|
-
}, {
|
|
458
|
-
readonly name: "name_";
|
|
459
|
-
readonly internalType: "bytes32";
|
|
460
|
-
readonly type: "bytes32";
|
|
461
|
-
}];
|
|
462
|
-
readonly name: "setName";
|
|
463
|
-
readonly outputs: readonly [];
|
|
464
|
-
readonly stateMutability: "nonpayable";
|
|
465
|
-
}, {
|
|
466
|
-
readonly type: "function";
|
|
467
|
-
readonly inputs: readonly [];
|
|
468
|
-
readonly name: "sponsor";
|
|
469
|
-
readonly outputs: readonly [{
|
|
470
|
-
readonly name: "";
|
|
471
|
-
readonly internalType: "address";
|
|
472
|
-
readonly type: "address";
|
|
473
|
-
}];
|
|
474
|
-
readonly stateMutability: "view";
|
|
475
|
-
}, {
|
|
476
|
-
readonly type: "event";
|
|
477
|
-
readonly anonymous: false;
|
|
478
|
-
readonly inputs: readonly [{
|
|
479
|
-
readonly name: "poolId";
|
|
480
|
-
readonly internalType: "bytes32";
|
|
481
|
-
readonly type: "bytes32";
|
|
482
|
-
readonly indexed: true;
|
|
483
|
-
}, {
|
|
484
|
-
readonly name: "prev";
|
|
485
|
-
readonly internalType: "address";
|
|
486
|
-
readonly type: "address";
|
|
487
|
-
readonly indexed: true;
|
|
488
|
-
}, {
|
|
489
|
-
readonly name: "next";
|
|
490
|
-
readonly internalType: "address";
|
|
491
|
-
readonly type: "address";
|
|
492
|
-
readonly indexed: true;
|
|
493
|
-
}];
|
|
494
|
-
readonly name: "AuthoritySet";
|
|
495
|
-
}, {
|
|
496
|
-
readonly type: "event";
|
|
497
|
-
readonly anonymous: false;
|
|
498
|
-
readonly inputs: readonly [{
|
|
499
|
-
readonly name: "poolId";
|
|
500
|
-
readonly internalType: "bytes32";
|
|
501
|
-
readonly type: "bytes32";
|
|
502
|
-
readonly indexed: true;
|
|
503
|
-
}, {
|
|
504
|
-
readonly name: "name";
|
|
505
|
-
readonly internalType: "bytes32";
|
|
506
|
-
readonly type: "bytes32";
|
|
507
|
-
readonly indexed: false;
|
|
508
|
-
}];
|
|
509
|
-
readonly name: "NameSet";
|
|
510
|
-
}, {
|
|
511
|
-
readonly type: "error";
|
|
512
|
-
readonly inputs: readonly [];
|
|
513
|
-
readonly name: "AlreadyHeld";
|
|
514
|
-
}, {
|
|
515
|
-
readonly type: "error";
|
|
516
|
-
readonly inputs: readonly [];
|
|
517
|
-
readonly name: "BadRate";
|
|
518
|
-
}, {
|
|
519
|
-
readonly type: "error";
|
|
520
|
-
readonly inputs: readonly [];
|
|
521
|
-
readonly name: "NoCreator";
|
|
522
|
-
}, {
|
|
523
|
-
readonly type: "error";
|
|
524
|
-
readonly inputs: readonly [];
|
|
525
|
-
readonly name: "NotAuthority";
|
|
526
|
-
}, {
|
|
527
|
-
readonly type: "error";
|
|
528
|
-
readonly inputs: readonly [];
|
|
529
|
-
readonly name: "NotManager";
|
|
530
|
-
}, {
|
|
531
|
-
readonly type: "error";
|
|
532
|
-
readonly inputs: readonly [];
|
|
533
|
-
readonly name: "NotRegistry";
|
|
534
|
-
}, {
|
|
535
|
-
readonly type: "error";
|
|
536
|
-
readonly inputs: readonly [];
|
|
537
|
-
readonly name: "OneBase";
|
|
538
|
-
}, {
|
|
539
|
-
readonly type: "error";
|
|
540
|
-
readonly inputs: readonly [];
|
|
541
|
-
readonly name: "QuoteTooThin";
|
|
542
|
-
}, {
|
|
543
|
-
readonly type: "error";
|
|
544
|
-
readonly inputs: readonly [];
|
|
545
|
-
readonly name: "Refused";
|
|
546
|
-
}];
|
|
44
|
+
export { managerFAbi, policyFAbi };
|
|
547
45
|
import { type LogswapClient } from "./client.js";
|
|
548
46
|
/**
|
|
549
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
|
|
@@ -567,9 +65,9 @@ export interface FPoolState {
|
|
|
567
65
|
Q: bigint;
|
|
568
66
|
/** Total exposure. Grows on mint, shrinks on burn; never moves on a swap. */
|
|
569
67
|
L: bigint;
|
|
570
|
-
/** The swap fee, WAD
|
|
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. */
|
|
571
69
|
swapFee: bigint;
|
|
572
|
-
/** The
|
|
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}). */
|
|
573
71
|
mintFee: bigint;
|
|
574
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. */
|
|
575
73
|
refLogFloor: bigint;
|
|
@@ -588,34 +86,32 @@ export interface FPoolState {
|
|
|
588
86
|
/** Σ = ∫ Σ_j w_j (dx_j)², accrued even though the fee is fixed — the kernel stays calculable. */
|
|
589
87
|
realizedVariance: bigint;
|
|
590
88
|
/**
|
|
591
|
-
* The pool's policy: the contract the key names, holding the pool's roles
|
|
592
|
-
*
|
|
593
|
-
*
|
|
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.
|
|
594
92
|
*/
|
|
595
93
|
policy: Address;
|
|
596
94
|
/**
|
|
597
|
-
* What the policy declared for the pool (`Pool.flags`, decision 098): the gate bits {@link GATE_SWAP} and {@link GATE_MINT} (
|
|
598
|
-
*
|
|
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).
|
|
599
97
|
*/
|
|
600
98
|
flags: number;
|
|
601
|
-
/**
|
|
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
|
+
*/
|
|
602
103
|
operator: Address;
|
|
603
|
-
/** The sponsor's own label for this pool — the policy's word, mutable and never identity. "" when unnamed. */
|
|
604
|
-
name: string;
|
|
605
104
|
/** The time (unix seconds) of the last harvest / composition action: no swap runs at that timestamp (F version 29; a block number before). */
|
|
606
105
|
restructureTime: number;
|
|
607
|
-
/** What the pool is — its POLICY's
|
|
106
|
+
/** What the pool is — a label read off its POLICY's immutables; see {@link FPoolKind}. */
|
|
608
107
|
kind: FPoolKind;
|
|
609
|
-
/** False before the first `deployLiquidity` — and between a `close` and the next one. */
|
|
108
|
+
/** False before the first `deployLiquidity` — and between a `close` and the next one (the pool is INACTIVE: listed, or closed). */
|
|
610
109
|
seeded: boolean;
|
|
611
110
|
/**
|
|
612
|
-
* The live GENERATION.
|
|
613
|
-
* ({@link fPoolRedeem}) and
|
|
614
|
-
*
|
|
615
|
-
* ({@link
|
|
616
|
-
* as `gen + 1`, every other holder of `gen` is frozen out into its bundle. The share id carries
|
|
617
|
-
* it ({@link fPoolShareId}), so generations `0 … gen-1` are claims ({@link fPoolClaimsOf}) and
|
|
618
|
-
* `gen` is the pool. On a pad, `gen` is the graduation count — the rung.
|
|
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.
|
|
619
115
|
*/
|
|
620
116
|
gen: number;
|
|
621
117
|
totalSupply: bigint;
|
|
@@ -626,32 +122,69 @@ export interface FPoolState {
|
|
|
626
122
|
/** κ_j = e^{−μ_j}, WAD: each leg's phantom reserve per unit of its liquidity. 0 uncapped. */
|
|
627
123
|
kappa: bigint[];
|
|
628
124
|
}
|
|
629
|
-
/** Read a basket pool whole: one lens call (`pool`, F version 25) plus the policy's
|
|
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}. */
|
|
630
126
|
export declare function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolState>;
|
|
631
127
|
/**
|
|
632
|
-
* The kind of pool —
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
* policy
|
|
637
|
-
*
|
|
638
|
-
* (`SEED_TO_DEAD`) — open to all. `orphan`: the pool the LOG moved off a rogue or lost sponsor, no owner and no
|
|
639
|
-
* setting (`PolicyRegistry.orphan`): swap and mint stay open, holders burn, claim and redeem. Every rate, role and gate is the policy's.
|
|
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}).
|
|
640
134
|
*/
|
|
641
|
-
export type FPoolKind = "
|
|
642
|
-
/** The policy's birth-time declaration that the
|
|
135
|
+
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`. */
|
|
643
137
|
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
|
+
export interface FPolicyTerms {
|
|
140
|
+
policy: Address;
|
|
141
|
+
/** The authority as deployed; zero defers to the LOG Authority of the day — {@link getFPoolRoles} reads the live answer (`authority()`). */
|
|
142
|
+
fixedAuthority: Address;
|
|
143
|
+
/** Anyone initializes; the salt must be zero; no gate is ever set on its pools. */
|
|
144
|
+
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
|
+
seedToDead: boolean;
|
|
147
|
+
/** A harvest takes income and never capital. */
|
|
148
|
+
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
|
+
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
|
+
feeMask: number;
|
|
153
|
+
/** Legs per pool, 1..8. */
|
|
154
|
+
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
|
+
lnCapMin: number;
|
|
157
|
+
/** WAD, a multiple of L: the bid a deploy must bring and a harvest must leave. */
|
|
158
|
+
quoteBuffer: bigint;
|
|
159
|
+
/** The policy lists the quotes a pool may be born on (`quoteListed`); false: any quote. */
|
|
160
|
+
quoteCurated: boolean;
|
|
161
|
+
/** The policy lists the bases a pool may hold (`baseListed`); false: any base. */
|
|
162
|
+
baseCurated: boolean;
|
|
163
|
+
/** The label the terms spell: {@link fPolicyKindOf}. */
|
|
164
|
+
kind: FPoolKind;
|
|
165
|
+
}
|
|
166
|
+
/** The label a policy's terms spell (see {@link FPoolKind}). Pure. */
|
|
167
|
+
export declare function fPolicyKindOf(t: Pick<FPolicyTerms, "open" | "seedToDead" | "quoteBuffer">): FPoolKind;
|
|
644
168
|
/**
|
|
645
|
-
*
|
|
646
|
-
* chain:
|
|
647
|
-
* (a policy that is not one of the protocol's four shapes) throws; the app has no screen for it.
|
|
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.
|
|
648
171
|
*/
|
|
172
|
+
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. */
|
|
649
174
|
export declare function fPoolKindOfPolicy(c: LogswapClient, policy: Address): Promise<FPoolKind>;
|
|
650
|
-
/** The pool's label, as its policy holds it. "" when unnamed. */
|
|
651
|
-
export declare function fPoolNameOf(c: LogswapClient, poolId: Hex, policy?: Address): Promise<string>;
|
|
652
175
|
/**
|
|
653
|
-
* The
|
|
654
|
-
*
|
|
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
|
+
export declare function fPoolNameOf(c: LogswapClient, poolId: Hex, opts?: {
|
|
180
|
+
policy?: Address;
|
|
181
|
+
fromBlock?: bigint;
|
|
182
|
+
indexer?: string;
|
|
183
|
+
}): 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.
|
|
655
188
|
*/
|
|
656
189
|
export type FPolicySlot = "public" | "private" | "pol" | "pad";
|
|
657
190
|
/** The deployment's policy for a slot — the one a key names when no `policy` is given. */
|
|
@@ -659,33 +192,33 @@ export declare function fPoolPolicyFor(c: LogswapClient, slot: FPolicySlot): Add
|
|
|
659
192
|
/** The policy a pool named in its key — one read; {@link getFPool} carries it too. */
|
|
660
193
|
export declare function fPoolPolicyOf(c: LogswapClient, poolId: Hex): Promise<Address>;
|
|
661
194
|
/**
|
|
662
|
-
* A pool's roles, as its POLICY holds them (
|
|
663
|
-
*
|
|
664
|
-
*
|
|
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}).
|
|
665
199
|
*/
|
|
666
200
|
export interface FPoolRoles {
|
|
667
201
|
policy: Address;
|
|
202
|
+
/** The policy's authority now (`authority()`): its immutable, or the registry's LOG Authority when that is zero. */
|
|
668
203
|
authority: Address;
|
|
669
|
-
/** The
|
|
204
|
+
/** The pool's operator (`operator(poolId)`): the authority at birth until re-appointed. Zero: the policy never held this pool. */
|
|
670
205
|
operator: Address;
|
|
671
|
-
/**
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
|
|
675
|
-
/** The policy's own ceiling on a harvest now — the bid ({@link FPoolDescription.harvestable}) narrowed by the policy's rule. Zero on an orphaned pool. */
|
|
676
|
-
maxHarvest: bigint;
|
|
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
|
+
swapMode: FPoolMode;
|
|
208
|
+
/** Mint admission, at least as restrictive as the swap mode (`ModeOrder`): the same three, the mint list in `listed`. */
|
|
209
|
+
mintMode: FPoolMode;
|
|
677
210
|
}
|
|
678
|
-
/** `
|
|
679
|
-
export type
|
|
680
|
-
/** The
|
|
681
|
-
export declare const
|
|
682
|
-
/** Read a pool's roles from its policy. `state` saves the `getPool` round trip when already in hand. */
|
|
683
|
-
export declare function getFPoolRoles(c: LogswapClient, poolId: Hex, state?: Pick<FPoolState, "policy"
|
|
211
|
+
/** `IPolicyF.Mode`: Open = 0, Listed = 1, Operator = 2 — the order `open < listed < operator` is what `mintMode ≥ swapMode` compares. */
|
|
212
|
+
export type FPoolMode = "open" | "listed" | "operator";
|
|
213
|
+
/** The gate modes in `IPolicyF.Mode` order — the index is the on-chain ordinal. */
|
|
214
|
+
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
|
+
export declare function getFPoolRoles(c: LogswapClient, poolId: Hex, state?: Pick<FPoolState, "policy">): Promise<FPoolRoles>;
|
|
684
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. */
|
|
685
218
|
export type FPoolShape = "launch" | "basket";
|
|
686
219
|
export interface FPoolDescription {
|
|
687
|
-
shape: FPoolShape;
|
|
688
220
|
/** The pad is the launch shape, by the kind. */
|
|
221
|
+
shape: FPoolShape;
|
|
689
222
|
legs: number;
|
|
690
223
|
/** True when the pool holds no quote: an all-base resting ask. base→quote is the one blocked path. */
|
|
691
224
|
atFloor: boolean;
|
|
@@ -695,16 +228,22 @@ export interface FPoolDescription {
|
|
|
695
228
|
* from the first wei after it.
|
|
696
229
|
*/
|
|
697
230
|
unharvested: bigint;
|
|
698
|
-
/**
|
|
699
|
-
* The most a harvest may take now by the MANAGER's rule: the bid, `Q` once seeded (0 before).
|
|
700
|
-
* The manager's `harvestable()` getter was cut in F version 21; this is the same number, read
|
|
701
|
-
* off `getPool`. The policy may allow less (a pad: the income; a POL: above `minQuoteRatio`·L) —
|
|
702
|
-
* {@link FPoolRoles.maxHarvest}.
|
|
703
|
-
*/
|
|
704
|
-
harvestable: bigint;
|
|
705
|
-
/** The dead shares' banked dividend — a pad's income, the creator's until a rung is climbed (decision 085: formerly the pot). */
|
|
231
|
+
/** What a harvest takes with `extra` 0: the income, at most the bid. */
|
|
706
232
|
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
|
+
capitalRoom: bigint;
|
|
235
|
+
/** The most a harvest may take now, income and capital: `income + capitalRoom`. */
|
|
236
|
+
harvestable: bigint;
|
|
707
237
|
}
|
|
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
|
+
export declare function fPoolHarvestRoom(s: Pick<FPoolState, "Q" | "L" | "unharvested" | "flags">, t: Pick<FPolicyTerms, "incomeHarvestOnly" | "quoteBuffer">): {
|
|
244
|
+
income: bigint;
|
|
245
|
+
capital: bigint;
|
|
246
|
+
};
|
|
708
247
|
export declare function describeFPool(c: LogswapClient, s: FPoolState): Promise<FPoolDescription>;
|
|
709
248
|
/** `p_j = e^{x_j}`, lossy the way any float conversion is. Compare in log space when it matters. */
|
|
710
249
|
export declare function fPoolPriceOf(x: bigint, scale?: number): number;
|
|
@@ -865,16 +404,18 @@ export declare function fPoolPreviewRollIn(c: LogswapClient, poolId: Hex, gen: b
|
|
|
865
404
|
quoteExcess: bigint;
|
|
866
405
|
}>;
|
|
867
406
|
/**
|
|
868
|
-
*
|
|
869
|
-
*
|
|
870
|
-
*
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
*
|
|
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`).
|
|
874
415
|
*/
|
|
875
416
|
export declare function fPoolHarvest(c: LogswapClient, a: {
|
|
876
417
|
poolId: Hex;
|
|
877
|
-
|
|
418
|
+
extra?: bigint;
|
|
878
419
|
to?: Address;
|
|
879
420
|
account: Address;
|
|
880
421
|
}): Promise<`0x${string}`>;
|
|
@@ -1023,36 +564,51 @@ export interface FPoolCreateArgs {
|
|
|
1023
564
|
quote: Address;
|
|
1024
565
|
/** 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. */
|
|
1025
566
|
bases: Address[];
|
|
1026
|
-
/** The swap fee
|
|
1027
|
-
|
|
1028
|
-
/**
|
|
1029
|
-
|
|
1030
|
-
* 078): `2 * swapFee <= mintFee <= MINT_FEE_MAX`, checked by the manager (`BadParam`). Defaults to
|
|
1031
|
-
* {@link presetMintFee}: twice the swap fee.
|
|
1032
|
-
*/
|
|
1033
|
-
mintFee?: bigint;
|
|
567
|
+
/** 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`. */
|
|
568
|
+
swapFeeIdx?: number;
|
|
569
|
+
/** The swap fee, WAD — one of the list's eight values ({@link fFeeIndexOf} throws otherwise); the index is what the key carries. */
|
|
570
|
+
swapFee?: bigint;
|
|
1034
571
|
/**
|
|
1035
572
|
* Which of the deployment's policies the key names when `policy` is not given ({@link fPoolPolicyFor}). NOT a key
|
|
1036
|
-
* field (decisions 049: the manager knows no kind): the policy is, and
|
|
573
|
+
* field (decisions 049: the manager knows no kind): the policy is, and its terms say what it is ({@link FPoolKind}).
|
|
1037
574
|
*/
|
|
1038
575
|
kind: FPolicySlot;
|
|
1039
576
|
/**
|
|
1040
|
-
* The pool's policy: the contract the key names, approved by the registry
|
|
1041
|
-
* deployment's policy for `kind
|
|
1042
|
-
*
|
|
577
|
+
* The pool's policy for life: the contract the key names, approved by the registry (`PolicyNotApproved`). Defaults to the
|
|
578
|
+
* deployment's policy for `kind`. An open policy admits anyone; a closed one its authority alone (`Refused`). The policy's
|
|
579
|
+
* authority is the pool's operator at birth: the one account that then funds it ({@link fPoolDeploy}).
|
|
1043
580
|
*/
|
|
1044
581
|
policy?: Address;
|
|
1045
|
-
/** Who is born holding the pool: immutable identity, the pool's authority for life (the policy records it) and the initializer (`NotCreator`). */
|
|
1046
|
-
creator: Address;
|
|
1047
582
|
/**
|
|
1048
|
-
* The differentiator, and nothing else. Identity is the key's hash, so
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
583
|
+
* The differentiator, and nothing else. Identity is the key's hash, so a sponsor cannot run two pools of the same shape
|
|
584
|
+
* without varying it — the second `initialize` would land on the first pool's id. Zero under an open policy (`NotCanonical`):
|
|
585
|
+
* one public pool per shape and swap fee. Defaults to zero. A pool's NAME is not this: names are events on the policy
|
|
586
|
+
* ({@link fPoolSetName}), so a rename forks nothing.
|
|
1052
587
|
*/
|
|
1053
588
|
salt?: Hex;
|
|
1054
589
|
account: Address;
|
|
1055
590
|
}
|
|
591
|
+
/** `FeeParams.FEE_LIST` in bp: the eight swap fees an F pool may be born with. The key carries the index. */
|
|
592
|
+
export declare const F_FEE_LIST_BP: readonly [1, 2, 5, 10, 20, 50, 100, 200];
|
|
593
|
+
/** The list in WAD (1 bp = 1e14). No zero: the fee-free pool cannot be born. */
|
|
594
|
+
export declare const F_FEE_LIST: readonly bigint[];
|
|
595
|
+
/** The fee at `idx` of the list, WAD. Throws off the list. */
|
|
596
|
+
export declare function fFeeOf(idx: number): bigint;
|
|
597
|
+
/** 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). */
|
|
598
|
+
export declare function fMintFeeIdxOf(swapFeeIdx: number): number;
|
|
599
|
+
/** The mint fee, WAD of newly-minted L, a pool born at `swapFeeIdx` charges on outside mints. */
|
|
600
|
+
export declare function fMintFeeOf(swapFeeIdx: number): bigint;
|
|
601
|
+
/** 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. */
|
|
602
|
+
export declare function fFeeIndexOf(fee: bigint): number;
|
|
603
|
+
/** Whether a policy's `feeMask` admits `idx`: a bit per index, an empty mask admitting all eight. */
|
|
604
|
+
export declare function fFeeListed(feeMask: number, idx: number): boolean;
|
|
605
|
+
/** The indices a policy's `feeMask` admits, ascending. */
|
|
606
|
+
export declare function fFeesAllowed(feeMask: number): number[];
|
|
607
|
+
/** The swap fee index of create arguments given either way; both given must agree. */
|
|
608
|
+
export declare function fPoolSwapFeeIdxOf(a: {
|
|
609
|
+
swapFeeIdx?: number;
|
|
610
|
+
swapFee?: bigint;
|
|
611
|
+
}): number;
|
|
1056
612
|
/** `bytes32` ⇄ short UTF-8 text, for the pool and sponsor labels. */
|
|
1057
613
|
export declare function textToBytes32(text: string): Hex;
|
|
1058
614
|
export declare function bytes32ToText(word: Hex): string;
|
|
@@ -1062,33 +618,56 @@ export declare function sortFPoolLegs<T>(bases: Address[], ...companions: T[][])
|
|
|
1062
618
|
companions: T[][];
|
|
1063
619
|
};
|
|
1064
620
|
/**
|
|
1065
|
-
* The tuple an F pool's id hashes — `src/types/
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
* cap: those belong to a generation's `deployLiquidity` (decision 075), and the mint fee is part of identity (078).
|
|
621
|
+
* The tuple an F pool's id hashes — `src/types/PoolKeyF.sol`, field order load-bearing (it is the ABI encoding order).
|
|
622
|
+
* Stored by the manager at `initialize` and never in calldata again. No creator, no mint fee, no weights and no cap
|
|
623
|
+
* (policy.md §5): both fees follow from `swapFeeIdx`, the book belongs to a generation's `deployLiquidity`.
|
|
1069
624
|
*/
|
|
1070
625
|
export interface FPoolKey {
|
|
1071
626
|
quote: Address;
|
|
1072
|
-
/** Sorted ascending, unique; fixed for the pool's life. */
|
|
627
|
+
/** Sorted ascending, unique, 1..8; fixed for the pool's life. */
|
|
1073
628
|
bases: Address[];
|
|
1074
|
-
|
|
1075
|
-
|
|
629
|
+
/** Into {@link F_FEE_LIST}; the mint fee is the next entry ({@link fMintFeeIdxOf}). */
|
|
630
|
+
swapFeeIdx: number;
|
|
631
|
+
/** The pool's policy for life. */
|
|
1076
632
|
policy: Address;
|
|
1077
|
-
|
|
633
|
+
/** Zero under an open policy. */
|
|
1078
634
|
salt: Hex;
|
|
1079
|
-
/** The creator-selected mint fee, WAD, fixed for life: `2 * swapFee <= mintFee <= MINT_FEE_MAX`. */
|
|
1080
|
-
mintFee: bigint;
|
|
1081
635
|
}
|
|
636
|
+
/** The key's ABI as `abi.encode(key)` lays it out: what {@link fPoolIdOfKey} hashes. */
|
|
637
|
+
export declare const F_POOL_KEY_ABI: readonly [{
|
|
638
|
+
readonly type: "tuple";
|
|
639
|
+
readonly components: readonly [{
|
|
640
|
+
readonly name: "quote";
|
|
641
|
+
readonly type: "address";
|
|
642
|
+
}, {
|
|
643
|
+
readonly name: "bases";
|
|
644
|
+
readonly type: "address[]";
|
|
645
|
+
}, {
|
|
646
|
+
readonly name: "swapFeeIdx";
|
|
647
|
+
readonly type: "uint8";
|
|
648
|
+
}, {
|
|
649
|
+
readonly name: "policy";
|
|
650
|
+
readonly type: "address";
|
|
651
|
+
}, {
|
|
652
|
+
readonly name: "salt";
|
|
653
|
+
readonly type: "bytes32";
|
|
654
|
+
}];
|
|
655
|
+
}];
|
|
1082
656
|
/**
|
|
1083
657
|
* An F pool's id: `keccak256(abi.encode(key))`, offline — what `initialize` computes inline. The
|
|
1084
|
-
* manager's `idOf
|
|
1085
|
-
*
|
|
1086
|
-
* one the pool was initialized with: bases sorted ({@link fPoolKeyOf} sorts them), the birth policy.
|
|
658
|
+
* manager's `idOf` getter was cut in F version 21; this is the same hash (checked against Foundry's encoder in the
|
|
659
|
+
* tests). The key must be the one the pool was initialized with: bases sorted ({@link fPoolKeyOf} sorts them).
|
|
1087
660
|
*/
|
|
1088
661
|
export declare function fPoolIdOfKey(key: FPoolKey): Hex;
|
|
1089
|
-
/** The key as the manager hashes it: bases sorted, the
|
|
662
|
+
/** 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). */
|
|
1090
663
|
export declare function fPoolKeyOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): FPoolKey;
|
|
1091
|
-
/**
|
|
664
|
+
/**
|
|
665
|
+
* List the pool — `initialize(key)` (policy.md §9): no funds move; the pool is inactive until its operator funds it
|
|
666
|
+
* ({@link fPoolDeploy}). Anyone under an open policy (salt zero), the policy's authority alone under a closed one
|
|
667
|
+
* (`Refused`); refused past the policy's sunset (`PolicyNotApproved`), off the policy's fee mask (`FeeNotListed`), quote or
|
|
668
|
+
* base list (`QuoteNotListed`, `BaseNotListed`), or with more legs than it allows (`TooManyLegs`). Returns the tx hash;
|
|
669
|
+
* read the id with {@link fPoolIdOf}.
|
|
670
|
+
*/
|
|
1092
671
|
export declare function fPoolInitialize(c: LogswapClient, a: FPoolCreateArgs): Promise<`0x${string}`>;
|
|
1093
672
|
/**
|
|
1094
673
|
* The pool id is the key's hash — pure, so it can be read before or after creation. Computed
|
|
@@ -1097,14 +676,11 @@ export declare function fPoolInitialize(c: LogswapClient, a: FPoolCreateArgs): P
|
|
|
1097
676
|
*/
|
|
1098
677
|
export declare function fPoolIdOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): Promise<Hex>;
|
|
1099
678
|
/**
|
|
1100
|
-
* Rebuild a live pool's KEY from its id: the `PoolCreated` log carries every field
|
|
1101
|
-
*
|
|
1102
|
-
* without naming one; a pad's carries its split, so it is rebuilt from the policy's record with nonce 0 — pass `opts.salt` for another nonce). The result is checked against the id, so a wrong salt throws rather than
|
|
1103
|
-
* returning a key that names another pool. What {@link fPoolMigrate} needs when handed an id.
|
|
679
|
+
* Rebuild a live pool's KEY from its id: the `PoolCreated` log carries every field, the salt included (F 41). The result
|
|
680
|
+
* is checked against the id.
|
|
1104
681
|
*/
|
|
1105
682
|
export declare function fPoolKeyOfPool(c: LogswapClient, poolId: Hex, opts?: {
|
|
1106
|
-
|
|
1107
|
-
fromBlock?: bigint; /** The rindexer GraphQL endpoint: `PoolCreated` from there, the node otherwise. The salt is in neither (the event does not carry it). */
|
|
683
|
+
fromBlock?: bigint; /** The rindexer GraphQL endpoint: `PoolCreated` from there, the node otherwise. */
|
|
1108
684
|
indexer?: string;
|
|
1109
685
|
}): Promise<FPoolKey>;
|
|
1110
686
|
/**
|
|
@@ -1208,73 +784,70 @@ export declare function fPoolBookL(baseAssets: readonly BaseAsset[], lnCapOverSe
|
|
|
1208
784
|
* carried holder, every other holder is frozen into the closing generation's bundle ({@link fPoolRedeem}), and the
|
|
1209
785
|
* carried book becomes the one named, at the supplied prices. A pad is forward-only ({@link fPoolRegenerate}).
|
|
1210
786
|
*/
|
|
787
|
+
/**
|
|
788
|
+
* Fund the pool — `deployLiquidity(poolId, baseAssets, quoteAmount, lnCapOverSeed)` (policy.md §9): the book of this generation,
|
|
789
|
+
* on an INACTIVE pool — listed and never funded, or closed (`PoolActive` otherwise). The operator's alone (`NotOperator`): it pays
|
|
790
|
+
* every leg's amount and `quoteAmount` by plain allowance to the manager ({@link approveTokenForFPoolManager}) and holds the shares —
|
|
791
|
+
* all but `MIN_SHARES`, which go to 0xdead; every share does on a pad. Refused past the policy's sunset (`PolicyNotApproved`),
|
|
792
|
+
* under its buffer (`QuoteTooThin`), with a cap under its `lnCapMin` (`CapTooClose`). An amount of 0 leaves a leg dormant. Pass the
|
|
793
|
+
* book raw (`baseAssets` + `lnCapOverSeed`) or as a {@link FPoolBookSpec}.
|
|
794
|
+
*/
|
|
1211
795
|
export declare function fPoolDeploy(c: LogswapClient, a: {
|
|
1212
796
|
poolId: Hex;
|
|
1213
797
|
quoteAmount: bigint;
|
|
1214
|
-
to?: Address;
|
|
1215
798
|
account: Address;
|
|
1216
799
|
} & ({
|
|
1217
800
|
baseAssets: BaseAsset[];
|
|
1218
801
|
lnCapOverSeed: number;
|
|
1219
802
|
} | FPoolBookSpec)): Promise<`0x${string}`>;
|
|
1220
803
|
/**
|
|
1221
|
-
* Close the pool
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1225
|
-
* `
|
|
804
|
+
* Close the pool (policy.md §9) — at any bid. The manager harvests the income first (a dividend to every share, the operator's
|
|
805
|
+
* paid to `to`), freezes every reserve and the bid into generation `gen`'s bundle — every share of it redeems pro rata
|
|
806
|
+
* ({@link fPoolRedeem}), forever — and moves the counter to `gen + 1`, the generation the next {@link fPoolDeploy} opens under
|
|
807
|
+
* the same id, policy, roles and gates. The operator's alone. Throws before sending on a pad: a pad never closes
|
|
808
|
+
* (`PadNeverCloses`). Pass `flags` when in hand to save the read.
|
|
1226
809
|
*/
|
|
1227
|
-
export declare function
|
|
810
|
+
export declare function fPoolClose(c: LogswapClient, a: {
|
|
1228
811
|
poolId: Hex;
|
|
1229
812
|
to?: Address;
|
|
1230
813
|
account: Address;
|
|
814
|
+
flags?: number;
|
|
1231
815
|
}): Promise<`0x${string}`>;
|
|
1232
816
|
/**
|
|
1233
|
-
*
|
|
1234
|
-
* (
|
|
1235
|
-
*
|
|
1236
|
-
* should call. Throws before sending on a pad: a pad never closes.
|
|
817
|
+
* The relaunch's calls — what `regenerate` was (policy.md §9): `close(poolId, to)`, `redeem(poolId, gen, operator, shares)` for the
|
|
818
|
+
* operator's own shares of the generation closed (left out at 0), then `deployLiquidity` with the next book. Pure, so a form can show
|
|
819
|
+
* what it is about to send; {@link fPoolRelaunch} sends them as one `multicall`.
|
|
1237
820
|
*/
|
|
1238
|
-
export declare function
|
|
821
|
+
export declare function fPoolRelaunchCalls(a: {
|
|
1239
822
|
poolId: Hex;
|
|
823
|
+
gen: number | bigint;
|
|
824
|
+
shares: bigint;
|
|
825
|
+
quoteAmount: bigint;
|
|
1240
826
|
to?: Address;
|
|
1241
827
|
account: Address;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
* the income part (with no treasury there is none). `[]` when the bid is already empty. Throws on a pad (a pad
|
|
1247
|
-
* never closes, whatever its bid), and when the pool's policy keeps a floor on the bid
|
|
1248
|
-
* (`PolPolicy.minQuoteRatio`): a `close` under that policy waits for the market.
|
|
1249
|
-
*/
|
|
1250
|
-
export declare function fPoolEmptyingHarvests(c: LogswapClient, poolId: Hex): Promise<bigint[]>;
|
|
828
|
+
} & ({
|
|
829
|
+
baseAssets: BaseAsset[];
|
|
830
|
+
lnCapOverSeed: number;
|
|
831
|
+
} | FPoolBookSpec)): Hex[];
|
|
1251
832
|
/**
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
*
|
|
1257
|
-
* - the carried holder's and the dead shares' `g` shares are re-minted 1:1 as `g + 1`: they go on
|
|
1258
|
-
* as the pool;
|
|
1259
|
-
* - every OTHER holder of `g` is frozen out pro rata into generation `g`'s bundle (`GenerationRetired`)
|
|
1260
|
-
* and redeems it with {@link fPoolRedeem} / rolls it with {@link fPoolRollIn} (`gen: g`); their
|
|
1261
|
-
* dividends on `g` stay claimable ({@link fPoolClaim} with `gen: g`). {@link fPoolClaimsOf}
|
|
1262
|
-
* lists them;
|
|
1263
|
-
* - the income released (`IncomeReleased`), all in quote: `toPayee` to the payee and the rest into the bid
|
|
1264
|
-
* (the floor down). No share is minted; L does not move. The book keeps its reserves, marks and cap.
|
|
1265
|
-
*
|
|
1266
|
-
* A pad's gate is `threshold(poolId, gen)`, in its quote (`PadPolicy.NotGraduated` below it); POL and a non-canonical sponsored pool carry the
|
|
1267
|
-
* authority and send it the whole income; a canonical sponsored pool (the LOG's open instance) refuses (`Refused`). A carried holder with no
|
|
1268
|
-
* share is `BadTerms`. Whoever runs the pool. To change the book (reserves, prices, cap) use {@link fPoolDeploy}.
|
|
833
|
+
* Relaunch the pool as ONE transaction: close generation `gen`, redeem the operator's own shares of it (its funds come back),
|
|
834
|
+
* fund `gen + 1` with the book given — the manager's `multicall`, the operator as sender. Every other holder is frozen into the
|
|
835
|
+
* bundle and redeems it ({@link fPoolRedeem}); the new book may re-weight any of the key's bases and pick its own cap. The
|
|
836
|
+
* deploy pulls its amounts and `quoteAmount` from the operator in the same transaction the redeem pays it, so the allowances
|
|
837
|
+
* must cover the pull. Not on a pad (a pad never closes); not on an inactive pool (fund it with {@link fPoolDeploy}).
|
|
1269
838
|
*/
|
|
1270
|
-
export declare function
|
|
839
|
+
export declare function fPoolRelaunch(c: LogswapClient, a: {
|
|
1271
840
|
poolId: Hex;
|
|
841
|
+
quoteAmount: bigint;
|
|
1272
842
|
to?: Address;
|
|
1273
843
|
account: Address;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
844
|
+
} & ({
|
|
845
|
+
baseAssets: BaseAsset[];
|
|
846
|
+
lnCapOverSeed: number;
|
|
847
|
+
} | FPoolBookSpec)): Promise<`0x${string}`>;
|
|
848
|
+
/** Where a pad's seed lives: `deployLiquidity` mints every share of a pad here itself. */
|
|
1276
849
|
export declare const DEAD_ADDRESS: Address;
|
|
1277
|
-
/** The manager's `MIN_SHARES`: the
|
|
850
|
+
/** 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. */
|
|
1278
851
|
export declare const F_MIN_SHARES = 1000n;
|
|
1279
852
|
/**
|
|
1280
853
|
* One genesis transaction: a swap the creator sends right after the seed, inside the launch's
|
|
@@ -1331,7 +904,7 @@ export interface FPoolLaunchArgs extends Omit<FPoolCreateArgs, "account"> {
|
|
|
1331
904
|
* `followup`: always left to it. Ignored when no row names a recipient.
|
|
1332
905
|
*/
|
|
1333
906
|
deliver?: "auto" | "followup";
|
|
1334
|
-
/** The pool's label (≤ 31 bytes of UTF-8) — the policy's
|
|
907
|
+
/** 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. */
|
|
1335
908
|
name?: string;
|
|
1336
909
|
/**
|
|
1337
910
|
* The pool already exists (a previous launch got as far as `initialize` and no further — a seed
|
|
@@ -1381,30 +954,21 @@ export declare function fPoolSendGenesisTransfers(c: LogswapClient, a: {
|
|
|
1381
954
|
/** 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. */
|
|
1382
955
|
export declare function fPoolWalletBatchesAtomically(c: LogswapClient, account: Address): Promise<boolean>;
|
|
1383
956
|
/**
|
|
1384
|
-
*
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
poolId: Hex;
|
|
1390
|
-
account: Address;
|
|
1391
|
-
policy?: Address;
|
|
1392
|
-
}): Promise<Hash[]>;
|
|
1393
|
-
/**
|
|
1394
|
-
* Create a pool as ONE transaction: `initialize`, `seed`, the seed lock, the opening buy, the
|
|
1395
|
-
* name — the manager's `multicall`, the creator as sender throughout (the creator is the initializer, `NotCreator`).
|
|
1396
|
-
* Either every call lands or none does; there is no half-built pool to resume.
|
|
957
|
+
* Create a pool as ONE transaction: `initialize`, `deployLiquidity`, the opening buys — the manager's `multicall`, one sender
|
|
958
|
+
* throughout. Either every call lands or none does; there is no half-built pool to resume. The sender must be the policy's
|
|
959
|
+
* AUTHORITY: it is the pool's operator at birth, and `deployLiquidity` is the operator's (`NotOperator`). Under an open
|
|
960
|
+
* policy anyone may list a pool ({@link fPoolInitialize}) but only the LOG — its authority — funds it, so a launch under the
|
|
961
|
+
* public policy is the LOG's; a sponsor launches under its own policy.
|
|
1397
962
|
*
|
|
1398
|
-
* Why the manager and not the router: every one of these entries authenticates by `msg.sender
|
|
1399
|
-
*
|
|
1400
|
-
* — the authority, the holder of the seed shares — and `initialize` would refuse it (`NotCreator`). `multicall` is delegatecall-to-self, so the
|
|
1401
|
-
* sender survives, which is what the manager's own doc says a router cannot do.
|
|
963
|
+
* Why the manager and not the router: every one of these entries authenticates by `msg.sender`. Routed, the router would be
|
|
964
|
+
* the sender — the operator, the holder of the seed shares. `multicall` is delegatecall-to-self, so the sender survives.
|
|
1402
965
|
*
|
|
1403
|
-
* What the batch PULLS, by plain allowance to the manager (never Permit2): `r0[j]` of each base,
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
966
|
+
* What the batch PULLS, by plain allowance to the manager (never Permit2): `r0[j]` of each base, `quoteAmount` of quote, plus
|
|
967
|
+
* each opening buy's `amountIn` of quote. Grant those first — one `approve` per token, once ever
|
|
968
|
+
* ({@link approveTokenForFPoolManager}, {@link fPoolManagerAllowanceOk}).
|
|
1406
969
|
*
|
|
1407
|
-
* Returns the hash and the pool's id (the key's hash, {@link fPoolIdOf}).
|
|
970
|
+
* Returns the hash and the pool's id (the key's hash, {@link fPoolIdOf}). The name, when given, is a second transaction on
|
|
971
|
+
* the policy ({@link fPoolSetName}); the gate modes are {@link fPoolSetSwapMode} / {@link fPoolSetMintMode} after it.
|
|
1408
972
|
*/
|
|
1409
973
|
export declare function fPoolLaunch(c: LogswapClient, a: FPoolLaunchArgs & ({
|
|
1410
974
|
r0: bigint[];
|
|
@@ -1417,8 +981,9 @@ export declare function fPoolLaunch(c: LogswapClient, a: FPoolLaunchArgs & ({
|
|
|
1417
981
|
delivered: boolean;
|
|
1418
982
|
}>;
|
|
1419
983
|
/**
|
|
1420
|
-
* Appoint the pool's operator (the
|
|
1421
|
-
*
|
|
984
|
+
* Appoint the pool's operator (the AUTHORITY's; zero resets it to the authority): the account that funds, harvests, closes and sets the
|
|
985
|
+
* 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
|
|
986
|
+
* a contract (an executor). `InactivePool` on a pool the policy never held.
|
|
1422
987
|
*/
|
|
1423
988
|
export declare function fPoolAppointOperator(c: LogswapClient, a: {
|
|
1424
989
|
poolId: Hex;
|
|
@@ -1427,36 +992,45 @@ export declare function fPoolAppointOperator(c: LogswapClient, a: {
|
|
|
1427
992
|
policy?: Address;
|
|
1428
993
|
}): Promise<`0x${string}`>;
|
|
1429
994
|
/**
|
|
1430
|
-
* Set swap
|
|
1431
|
-
* `
|
|
995
|
+
* Set the pool's swap gate (the OPERATOR's): `open`, `listed` (the policy's swap list, {@link fPolicySetRights}; the operator always
|
|
996
|
+
* passes) or `operator`. The mint mode must stay at least as restrictive (`ModeOrder`). `burn`, `redeem` and `claim` are never gated.
|
|
1432
997
|
*/
|
|
1433
998
|
export declare function fPoolSetSwapMode(c: LogswapClient, a: {
|
|
1434
999
|
poolId: Hex;
|
|
1435
|
-
mode:
|
|
1000
|
+
mode: FPoolMode;
|
|
1436
1001
|
account: Address;
|
|
1437
1002
|
policy?: Address;
|
|
1438
1003
|
}): Promise<`0x${string}`>;
|
|
1439
|
-
/**
|
|
1440
|
-
export declare function
|
|
1004
|
+
/** 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. */
|
|
1005
|
+
export declare function fPoolSetMintMode(c: LogswapClient, a: {
|
|
1441
1006
|
poolId: Hex;
|
|
1442
|
-
|
|
1007
|
+
mode: FPoolMode;
|
|
1443
1008
|
account: Address;
|
|
1444
1009
|
policy?: Address;
|
|
1445
1010
|
}): Promise<`0x${string}`>;
|
|
1011
|
+
/** The bits of `PolicyF.rights`: listed for swaps; listed for mints, which implies swaps. */
|
|
1012
|
+
export declare const RIGHT_SWAP = 1;
|
|
1013
|
+
export declare const RIGHT_MINT = 2;
|
|
1014
|
+
/** What a policy lists an address for: nothing, swaps, or mints (and so swaps). */
|
|
1015
|
+
export type FPolicyRight = "none" | "swap" | "mint";
|
|
1016
|
+
/** The on-chain bits of a right (`MINT` is written as `MINT | SWAP`, as the policy does). */
|
|
1017
|
+
export declare function fPolicyRightBits(right: FPolicyRight): number;
|
|
1018
|
+
/** The right the bits spell. */
|
|
1019
|
+
export declare function fPolicyRightOf(bits: number | bigint): FPolicyRight;
|
|
1446
1020
|
/**
|
|
1447
|
-
*
|
|
1448
|
-
*
|
|
1021
|
+
* 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
|
|
1022
|
+
* — 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);
|
|
1023
|
+
* the modes are each pool's. Stamps nothing: an address removed in a block can still swap in that block.
|
|
1449
1024
|
*/
|
|
1450
|
-
export declare function
|
|
1451
|
-
|
|
1025
|
+
export declare function fPolicySetRights(c: LogswapClient, a: {
|
|
1026
|
+
policy: Address;
|
|
1452
1027
|
who: readonly Address[];
|
|
1453
|
-
|
|
1028
|
+
right: FPolicyRight;
|
|
1454
1029
|
account: Address;
|
|
1455
|
-
policy?: Address;
|
|
1456
1030
|
}): Promise<`0x${string}`>;
|
|
1457
|
-
/**
|
|
1458
|
-
export declare function
|
|
1459
|
-
/** Label the pool
|
|
1031
|
+
/** What `policy` lists `who` for now (`rights`). */
|
|
1032
|
+
export declare function fPolicyRightsOf(c: LogswapClient, policy: Address, who: Address): Promise<FPolicyRight>;
|
|
1033
|
+
/** Label the pool (the OPERATOR's): a `NameSet` event on the policy, nothing stored — mutable, never identity. At most 31 bytes of UTF-8. */
|
|
1460
1034
|
export declare function fPoolSetName(c: LogswapClient, a: {
|
|
1461
1035
|
poolId: Hex;
|
|
1462
1036
|
name: string;
|
|
@@ -1477,8 +1051,8 @@ export declare function fPoolSetSponsorName(c: LogswapClient, a: {
|
|
|
1477
1051
|
export declare function fPoolSponsorName(c: LogswapClient, who: Address): Promise<string>;
|
|
1478
1052
|
/** The registry the manager asks at every birth — `addresses.policyRegistry`, else the manager's word; zero on a bare deployment. */
|
|
1479
1053
|
export declare function fPoolRegistryOf(c: LogswapClient): Promise<Address>;
|
|
1480
|
-
/** Who
|
|
1481
|
-
export declare function fPoolRunners(s: Pick<FPoolRoles, "
|
|
1054
|
+
/** 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. */
|
|
1055
|
+
export declare function fPoolRunners(s: Pick<FPoolRoles, "operator">): Address[];
|
|
1482
1056
|
/**
|
|
1483
1057
|
* Move shares (ERC-6909 `transfer`) — to another holder, or to `0xdead` to lock them for good.
|
|
1484
1058
|
* Burning to the dead address is a sponsor's way to make its liquidity permanent: the shares can
|
|
@@ -1497,16 +1071,19 @@ export interface DiscoveredFPool {
|
|
|
1497
1071
|
bases: Address[];
|
|
1498
1072
|
/** The generation-0 allocation, from the pool's first `LiquidityDeployed` ({@link fPoolBookWeights}); `[]` until it is deployed — F 38 keeps no weights in the key. */
|
|
1499
1073
|
weights: bigint[];
|
|
1074
|
+
/** The key's swap fee index (policy.md §6). */
|
|
1075
|
+
swapFeeIdx: number;
|
|
1076
|
+
/** The swap fee, WAD: `F_FEE_LIST[swapFeeIdx]`. */
|
|
1500
1077
|
swapFee: bigint;
|
|
1501
|
-
/** The
|
|
1078
|
+
/** The mint fee, WAD: the list's next entry ({@link fMintFeeOf}). */
|
|
1502
1079
|
mintFee: bigint;
|
|
1503
1080
|
/** The generation-0 cap as ln(cap price / seed price), in 1e-6 log units; 0 uncapped, cap ∞ (decisions 061); 0 until deployed. */
|
|
1504
1081
|
lnCapOverSeed: number;
|
|
1505
1082
|
kind: FPoolKind;
|
|
1506
|
-
/** The pool's policy
|
|
1083
|
+
/** The pool's policy for life — the contract the key names. */
|
|
1507
1084
|
policy: Address;
|
|
1508
|
-
/**
|
|
1509
|
-
|
|
1085
|
+
/** The key's salt: zero under an open policy. */
|
|
1086
|
+
salt: Hex;
|
|
1510
1087
|
/** The block the pool was initialized in — its age, for annualising realized income. */
|
|
1511
1088
|
block: bigint;
|
|
1512
1089
|
/** Whether `deployLiquidity` has run; an unfunded pool has no floor and no float, so nothing to show. */
|
|
@@ -1522,96 +1099,27 @@ export interface DiscoveredFPool {
|
|
|
1522
1099
|
shape: FPoolShape;
|
|
1523
1100
|
}
|
|
1524
1101
|
/**
|
|
1525
|
-
* Every F pool ever created, from `PoolCreated` logs alone — plus
|
|
1526
|
-
*
|
|
1527
|
-
*
|
|
1528
|
-
*
|
|
1529
|
-
* a scan from block 0 per call is what made the first load wait on the node.
|
|
1102
|
+
* Every F pool ever created, from `PoolCreated` logs alone — plus the terms of each distinct policy, read once and cached.
|
|
1103
|
+
* Possible only because the event carries the full key (quote, policy, bases, swapFeeIdx, salt) — the poolId is a hash and
|
|
1104
|
+
* could never be inverted; contracts PR #17 exists for exactly this call. With `indexer`, the logs come from it (the node
|
|
1105
|
+
* when it fails): a scan from block 0 per call is what made the first load wait on the node.
|
|
1530
1106
|
*/
|
|
1531
1107
|
export declare function discoverFPools(c: LogswapClient, opts?: {
|
|
1532
1108
|
fromBlock?: bigint;
|
|
1533
1109
|
toBlock?: bigint;
|
|
1534
1110
|
indexer?: string;
|
|
1535
1111
|
}): Promise<DiscoveredFPool[]>;
|
|
1536
|
-
/** A pool an
|
|
1112
|
+
/** A pool an account runs or sponsors, with what the policy page shows of it. */
|
|
1537
1113
|
export interface FPoolControlled {
|
|
1538
1114
|
pool: DiscoveredFPool;
|
|
1539
1115
|
roles: FPoolRoles;
|
|
1540
1116
|
state: FPoolState;
|
|
1541
|
-
/** The policy's
|
|
1542
|
-
|
|
1543
|
-
}
|
|
1544
|
-
/** What a pool's policy says about it, by kind: the terms a buyer reads before entering. */
|
|
1545
|
-
export type FPoolRules = {
|
|
1546
|
-
kind: "pad";
|
|
1547
|
-
/** The pad's graduation count: the pool's generation (F version 21 — `PadPolicy.rung` is gone). */
|
|
1548
|
-
gen: number;
|
|
1549
|
-
/** @deprecated Equal to {@link gen} since F version 21, kept for callers; read `gen`. */
|
|
1550
|
-
rung: number;
|
|
1551
|
-
/** The income the next graduation needs, in the pad's quote: `PadPolicy.threshold(poolId, gen)` (T(0) is per quote, decision 070). */
|
|
1552
|
-
threshold: bigint;
|
|
1553
|
-
/** The dead shares' income held for the next graduation, in the pad's quote. */
|
|
1554
|
-
income: bigint;
|
|
1555
|
-
/** This pad's creator share, recorded at its birth from the key's salt and never changed (decisions 056, 057, 067): a fraction of the income released. The rest deepens the bid; nothing is bought or burnt (067). */
|
|
1556
|
-
creatorShare: bigint;
|
|
1557
|
-
/** The income tax the dead shares pay on their own new income dividend (decisions 073, 085), WAD. */
|
|
1558
|
-
incomeTaxRate: bigint;
|
|
1559
|
-
/** The ranges the LOG Authority set on the policy NOW for the pads born after this read: what a new creator may choose. */
|
|
1560
|
-
ranges: PadRanges;
|
|
1561
|
-
} | {
|
|
1562
|
-
kind: "pol"; /** The reserve a harvest leaves in the bid and a redeployment must keep, a multiple of L (WAD). */
|
|
1563
|
-
minQuoteRatio: bigint; /** The income tax the pool's authority pays on its own new income dividend (decisions 073, 085), WAD. */
|
|
1564
|
-
incomeTaxRate: bigint;
|
|
1565
|
-
} | {
|
|
1566
|
-
kind: "sponsor";
|
|
1567
|
-
/** The sponsor (`sponsor()`): the account allowed to create under the policy (the LOG's own instances: the LOG Authority of the day). */
|
|
1568
|
-
sponsor: Address;
|
|
1569
|
-
/** `salt` must be zero and the book uncapped (`NotCanonical`): the LOG's open instance. */
|
|
1570
|
-
canonical: boolean;
|
|
1571
|
-
/** The authority may gate swaps and mints (false on the open instance: a public pool can never be gated). */
|
|
1572
|
-
gatesAvailable: boolean;
|
|
1573
|
-
/** The pool is born with `GATE_SWAP` and its creator as operator. */
|
|
1574
|
-
bornGated: boolean;
|
|
1575
|
-
/** The swap-fee tiers a pool may be born with, a mask over the family's table (0: any fee in the manager's domain). */
|
|
1576
|
-
swapTiers: bigint;
|
|
1577
|
-
/** The mint-fee tiers, the same (0: any). */
|
|
1578
|
-
mintTiers: bigint;
|
|
1579
|
-
/** The pool's own state: the mint gate, the swap mode and the operator. */
|
|
1580
|
-
gateMint: boolean;
|
|
1581
|
-
swapMode: FPoolSwapMode;
|
|
1582
|
-
operator: Address;
|
|
1583
|
-
} | {
|
|
1584
|
-
kind: "orphan";
|
|
1585
|
-
};
|
|
1586
|
-
/** The LOG Authority's range on a pad's creator choice (`PadPolicy`, decisions 056, 067), WAD fractions of the income released. */
|
|
1587
|
-
export interface PadRanges {
|
|
1588
|
-
creatorShareMin: bigint;
|
|
1589
|
-
/** At most the F manager's `PAYEE_CUT_MAX` (50%), which bounds a pad's payee whatever the policy (067). */
|
|
1590
|
-
creatorShareMax: bigint;
|
|
1117
|
+
/** The policy's immutables: the terms a holder reads before entering. */
|
|
1118
|
+
terms: FPolicyTerms;
|
|
1591
1119
|
}
|
|
1592
1120
|
/**
|
|
1593
|
-
*
|
|
1594
|
-
*
|
|
1595
|
-
* set — and a nonce in the low 128 that tells two otherwise identical pads apart. It is part of the pool's identity, so it is
|
|
1596
|
-
* chosen at launch (`FPoolLaunchArgs.salt`) and never changes; the policy refuses a cut outside its range.
|
|
1597
|
-
*/
|
|
1598
|
-
export declare function padSalt(s: {
|
|
1599
|
-
creatorShare: bigint;
|
|
1600
|
-
nonce?: bigint; /** @deprecated F version 28 has no burn (067): only 0 is accepted. */
|
|
1601
|
-
burnShare?: bigint;
|
|
1602
|
-
}): Hex;
|
|
1603
|
-
/** The inverse of {@link padSalt}. `burnShare` is the old field's bits, nonzero only on a salt the F version 28 policy refuses. */
|
|
1604
|
-
export declare function padSplitOfSalt(salt: Hex): {
|
|
1605
|
-
creatorShare: bigint;
|
|
1606
|
-
burnShare: bigint;
|
|
1607
|
-
nonce: bigint;
|
|
1608
|
-
};
|
|
1609
|
-
/** The policy's terms for one pool, by its kind. */
|
|
1610
|
-
export declare function getFPoolRules(c: LogswapClient, s: Pick<FPoolState, "poolId" | "policy" | "kind" | "gen">, roles?: FPoolRoles): Promise<FPoolRules>;
|
|
1611
|
-
/**
|
|
1612
|
-
* Every F pool `who` is the AUTHORITY of, across the policies — the policy page's list. The authority is `key.creator` for
|
|
1613
|
-
* life (decision 098), so these are the pools `who` created, minus any the LOG orphaned. `pools` may be passed (from the
|
|
1614
|
-
* indexer, say) to skip the log scan.
|
|
1121
|
+
* Every F pool `who` runs (its operator) or sponsors (the authority of its policy) — the policy page's list. `roles` tells
|
|
1122
|
+
* which. `pools` may be passed (from the indexer, say) to skip the log scan.
|
|
1615
1123
|
*/
|
|
1616
1124
|
export declare function fPoolsControlledBy(c: LogswapClient, who: Address, opts?: {
|
|
1617
1125
|
pools?: DiscoveredFPool[];
|
|
@@ -1632,17 +1140,6 @@ export declare function fPoolShareHolders(c: LogswapClient, poolIdHex: Hex, opts
|
|
|
1632
1140
|
holder: Address;
|
|
1633
1141
|
shares: bigint;
|
|
1634
1142
|
}>>;
|
|
1635
|
-
/**
|
|
1636
|
-
* What a policy answers `onRegenerate` with: `IFPolicy.Terms` — four words, exactly 128 bytes since F version 28 (decision 067
|
|
1637
|
-
* removed `burn`). `carried` is the holder the next generation carries beside the dead shares; on a pad the manager requires
|
|
1638
|
-
* `0xdead` and caps `toPayee` at `PAYEE_CUT_MAX` of the income.
|
|
1639
|
-
*/
|
|
1640
|
-
export interface FPolicyTerms {
|
|
1641
|
-
payee: Address;
|
|
1642
|
-
toPayee: bigint;
|
|
1643
|
-
protocolCut: bigint;
|
|
1644
|
-
carried: Address;
|
|
1645
|
-
}
|
|
1646
1143
|
/** 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). */
|
|
1647
1144
|
export declare function getFPoolsRaw(c: LogswapClient, poolIds: Hex[]): Promise<readonly unknown[]>;
|
|
1648
1145
|
/** Share value from the lens — (L + Q)/shares, WAD per share — the same figure as `fPoolShareValue`, from one source. */
|