@logswap/sdk 0.5.90 → 0.5.92
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 +136 -31
- package/dist/actions.js +4 -3
- package/dist/admin.d.ts +96 -925
- package/dist/admin.js +113 -194
- package/dist/chains.d.ts +13 -4
- package/dist/chains.js +22 -9
- package/dist/claims.d.ts +1 -1
- package/dist/claims.js +11 -9
- package/dist/client.d.ts +42 -20
- package/dist/client.js +86 -26
- package/dist/fees.d.ts +1 -1
- package/dist/fees.js +5 -4
- package/dist/fpool.d.ts +327 -1120
- package/dist/fpool.js +408 -475
- package/dist/generated.d.ts +5017 -7631
- package/dist/generated.js +3040 -4879
- package/dist/history.js +12 -14
- package/dist/index.d.ts +5 -7
- package/dist/index.js +5 -7
- package/dist/indexer.d.ts +2 -2
- package/dist/indexer.js +12 -9
- package/dist/keys.d.ts +15 -3
- package/dist/keys.js +5 -1
- package/dist/liquidity.d.ts +1 -1
- package/dist/liquidity.js +16 -9
- package/dist/onboard.d.ts +16 -11
- package/dist/onboard.js +27 -21
- package/dist/pools.d.ts +2 -0
- package/dist/pools.js +21 -13
- package/dist/positions.d.ts +1 -1
- package/dist/positions.js +18 -17
- package/dist/quote.d.ts +15 -0
- package/dist/quote.js +36 -0
- package/dist/swap.d.ts +7 -9
- package/dist/swap.js +40 -25
- package/dist/views.d.ts +1 -1
- package/dist/write.d.ts +7 -2
- package/dist/write.js +10 -7
- package/package.json +3 -3
- package/src/actions.ts +4 -3
- package/src/admin.ts +143 -249
- package/src/chains.ts +32 -13
- package/src/claims.ts +11 -10
- package/src/client.ts +111 -39
- package/src/fees.ts +6 -6
- package/src/fpool.ts +555 -648
- package/src/generated.ts +3063 -4904
- package/src/history.ts +11 -11
- package/src/index.ts +5 -7
- package/src/indexer.ts +13 -11
- package/src/keys.ts +19 -3
- package/src/liquidity.ts +16 -10
- package/src/onboard.ts +29 -21
- package/src/pools.ts +23 -15
- package/src/positions.ts +18 -18
- package/src/quote.ts +36 -0
- package/src/swap.ts +46 -25
- package/src/views.ts +1 -2
- package/src/write.ts +11 -10
package/dist/fpool.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* fpool.ts — the `
|
|
2
|
+
* fpool.ts — the `ManagerF` surface: n bases, one quote, one shared floor.
|
|
3
3
|
*
|
|
4
|
-
* The other primitive. `
|
|
5
|
-
* `
|
|
4
|
+
* The other primitive. `ManagerC` gives every position its own floor on a tick ladder;
|
|
5
|
+
* `ManagerF` gives every share the SAME floor and deletes the ladder, the accumulators and the
|
|
6
6
|
* per-position accounting with it. Reading the two side by side is the fastest way to understand
|
|
7
7
|
* either.
|
|
8
8
|
*
|
|
@@ -18,809 +18,39 @@
|
|
|
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
|
-
*
|
|
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.
|
|
26
31
|
*
|
|
27
|
-
* **Zaps live on the ROUTER, not here.**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `
|
|
32
|
+
* **Zaps live on the ROUTER, not here.** `RouterF` is F's own router and its own Permit2 spender (decision 096: one
|
|
33
|
+
* router per manager; a second spender is a second signature, not a second on-chain approval). See
|
|
34
|
+
* `fPoolZapIn`/`fPoolZapOut` below, which target `addresses.routerF`; a wallet's Permit2 allowance for it is
|
|
35
|
+
* `onboardToken(c, "F", token, need)`.
|
|
31
36
|
*/
|
|
32
37
|
import { type Address, type Hash, type Hex } from "viem";
|
|
33
|
-
import {
|
|
38
|
+
import { managerFAbi, policyFAbi } from "./generated.js";
|
|
34
39
|
/**
|
|
35
|
-
* One contract, one ABI (F version 12): `harvest`, `claim`, `
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* {@link privatePolicyAbi} the desk's, {@link padPolicyAbi} / {@link polPolicyAbi} / {@link publicPolicyAbi}
|
|
39
|
-
* the kinds'.
|
|
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.
|
|
40
43
|
*/
|
|
41
|
-
export {
|
|
44
|
+
export { managerFAbi, policyFAbi };
|
|
45
|
+
import { type LogswapClient } from "./client.js";
|
|
42
46
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* in for the base — a call through it to any of the four policies decodes the base's functions.
|
|
47
|
+
* The bits a policy declares at birth, in `Pool.flags` (decision 098; `ASK_SWAP` / `ASK_MINT` before): with a gate bit off nothing is
|
|
48
|
+
* asked; with it on the manager admits the cached operator with no policy call and asks the policy about everyone else.
|
|
46
49
|
*/
|
|
47
|
-
export declare const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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: "cManager";
|
|
83
|
-
readonly outputs: readonly [{
|
|
84
|
-
readonly name: "";
|
|
85
|
-
readonly internalType: "address";
|
|
86
|
-
readonly type: "address";
|
|
87
|
-
}];
|
|
88
|
-
readonly stateMutability: "view";
|
|
89
|
-
}, {
|
|
90
|
-
readonly type: "function";
|
|
91
|
-
readonly inputs: readonly [{
|
|
92
|
-
readonly name: "";
|
|
93
|
-
readonly internalType: "bytes32";
|
|
94
|
-
readonly type: "bytes32";
|
|
95
|
-
}];
|
|
96
|
-
readonly name: "creator";
|
|
97
|
-
readonly outputs: readonly [{
|
|
98
|
-
readonly name: "";
|
|
99
|
-
readonly internalType: "address";
|
|
100
|
-
readonly type: "address";
|
|
101
|
-
}];
|
|
102
|
-
readonly stateMutability: "view";
|
|
103
|
-
}, {
|
|
104
|
-
readonly type: "function";
|
|
105
|
-
readonly inputs: readonly [];
|
|
106
|
-
readonly name: "feeCurated";
|
|
107
|
-
readonly outputs: readonly [{
|
|
108
|
-
readonly name: "";
|
|
109
|
-
readonly internalType: "bool";
|
|
110
|
-
readonly type: "bool";
|
|
111
|
-
}];
|
|
112
|
-
readonly stateMutability: "view";
|
|
113
|
-
}, {
|
|
114
|
-
readonly type: "function";
|
|
115
|
-
readonly inputs: readonly [{
|
|
116
|
-
readonly name: "";
|
|
117
|
-
readonly internalType: "uint256";
|
|
118
|
-
readonly type: "uint256";
|
|
119
|
-
}];
|
|
120
|
-
readonly name: "feeListed";
|
|
121
|
-
readonly outputs: readonly [{
|
|
122
|
-
readonly name: "";
|
|
123
|
-
readonly internalType: "bool";
|
|
124
|
-
readonly type: "bool";
|
|
125
|
-
}];
|
|
126
|
-
readonly stateMutability: "view";
|
|
127
|
-
}, {
|
|
128
|
-
readonly type: "function";
|
|
129
|
-
readonly inputs: readonly [{
|
|
130
|
-
readonly name: "poolId";
|
|
131
|
-
readonly internalType: "bytes32";
|
|
132
|
-
readonly type: "bytes32";
|
|
133
|
-
}];
|
|
134
|
-
readonly name: "incomeTax";
|
|
135
|
-
readonly outputs: readonly [{
|
|
136
|
-
readonly name: "";
|
|
137
|
-
readonly internalType: "address";
|
|
138
|
-
readonly type: "address";
|
|
139
|
-
}, {
|
|
140
|
-
readonly name: "";
|
|
141
|
-
readonly internalType: "uint256";
|
|
142
|
-
readonly type: "uint256";
|
|
143
|
-
}];
|
|
144
|
-
readonly stateMutability: "view";
|
|
145
|
-
}, {
|
|
146
|
-
readonly type: "function";
|
|
147
|
-
readonly inputs: readonly [];
|
|
148
|
-
readonly name: "incomeTaxRate";
|
|
149
|
-
readonly outputs: readonly [{
|
|
150
|
-
readonly name: "";
|
|
151
|
-
readonly internalType: "uint256";
|
|
152
|
-
readonly type: "uint256";
|
|
153
|
-
}];
|
|
154
|
-
readonly stateMutability: "view";
|
|
155
|
-
}, {
|
|
156
|
-
readonly type: "function";
|
|
157
|
-
readonly inputs: readonly [];
|
|
158
|
-
readonly name: "kind";
|
|
159
|
-
readonly outputs: readonly [{
|
|
160
|
-
readonly name: "";
|
|
161
|
-
readonly internalType: "bytes32";
|
|
162
|
-
readonly type: "bytes32";
|
|
163
|
-
}];
|
|
164
|
-
readonly stateMutability: "pure";
|
|
165
|
-
}, {
|
|
166
|
-
readonly type: "function";
|
|
167
|
-
readonly inputs: readonly [];
|
|
168
|
-
readonly name: "manager";
|
|
169
|
-
readonly outputs: readonly [{
|
|
170
|
-
readonly name: "";
|
|
171
|
-
readonly internalType: "contract FPoolManager";
|
|
172
|
-
readonly type: "address";
|
|
173
|
-
}];
|
|
174
|
-
readonly stateMutability: "view";
|
|
175
|
-
}, {
|
|
176
|
-
readonly type: "function";
|
|
177
|
-
readonly inputs: readonly [{
|
|
178
|
-
readonly name: "";
|
|
179
|
-
readonly internalType: "bytes32";
|
|
180
|
-
readonly type: "bytes32";
|
|
181
|
-
}];
|
|
182
|
-
readonly name: "managerOf";
|
|
183
|
-
readonly outputs: readonly [{
|
|
184
|
-
readonly name: "";
|
|
185
|
-
readonly internalType: "address";
|
|
186
|
-
readonly type: "address";
|
|
187
|
-
}];
|
|
188
|
-
readonly stateMutability: "view";
|
|
189
|
-
}, {
|
|
190
|
-
readonly type: "function";
|
|
191
|
-
readonly inputs: readonly [{
|
|
192
|
-
readonly name: "poolId";
|
|
193
|
-
readonly internalType: "bytes32";
|
|
194
|
-
readonly type: "bytes32";
|
|
195
|
-
}];
|
|
196
|
-
readonly name: "maxHarvest";
|
|
197
|
-
readonly outputs: readonly [{
|
|
198
|
-
readonly name: "";
|
|
199
|
-
readonly internalType: "uint256";
|
|
200
|
-
readonly type: "uint256";
|
|
201
|
-
}];
|
|
202
|
-
readonly stateMutability: "view";
|
|
203
|
-
}, {
|
|
204
|
-
readonly type: "function";
|
|
205
|
-
readonly inputs: readonly [{
|
|
206
|
-
readonly name: "a";
|
|
207
|
-
readonly internalType: "struct IFPolicy.Ask";
|
|
208
|
-
readonly type: "tuple";
|
|
209
|
-
readonly components: readonly [{
|
|
210
|
-
readonly name: "poolId";
|
|
211
|
-
readonly internalType: "bytes32";
|
|
212
|
-
readonly type: "bytes32";
|
|
213
|
-
}, {
|
|
214
|
-
readonly name: "gen";
|
|
215
|
-
readonly internalType: "uint256";
|
|
216
|
-
readonly type: "uint256";
|
|
217
|
-
}, {
|
|
218
|
-
readonly name: "action";
|
|
219
|
-
readonly internalType: "enum IFPolicy.Action";
|
|
220
|
-
readonly type: "uint8";
|
|
221
|
-
}, {
|
|
222
|
-
readonly name: "who";
|
|
223
|
-
readonly internalType: "address";
|
|
224
|
-
readonly type: "address";
|
|
225
|
-
}, {
|
|
226
|
-
readonly name: "amount";
|
|
227
|
-
readonly internalType: "uint256";
|
|
228
|
-
readonly type: "uint256";
|
|
229
|
-
}, {
|
|
230
|
-
readonly name: "income";
|
|
231
|
-
readonly internalType: "uint256";
|
|
232
|
-
readonly type: "uint256";
|
|
233
|
-
}, {
|
|
234
|
-
readonly name: "Q";
|
|
235
|
-
readonly internalType: "uint256";
|
|
236
|
-
readonly type: "uint256";
|
|
237
|
-
}, {
|
|
238
|
-
readonly name: "L";
|
|
239
|
-
readonly internalType: "uint256";
|
|
240
|
-
readonly type: "uint256";
|
|
241
|
-
}, {
|
|
242
|
-
readonly name: "n";
|
|
243
|
-
readonly internalType: "uint256";
|
|
244
|
-
readonly type: "uint256";
|
|
245
|
-
}];
|
|
246
|
-
}];
|
|
247
|
-
readonly name: "may";
|
|
248
|
-
readonly outputs: readonly [{
|
|
249
|
-
readonly name: "";
|
|
250
|
-
readonly internalType: "bytes4";
|
|
251
|
-
readonly type: "bytes4";
|
|
252
|
-
}];
|
|
253
|
-
readonly stateMutability: "view";
|
|
254
|
-
}, {
|
|
255
|
-
readonly type: "function";
|
|
256
|
-
readonly inputs: readonly [];
|
|
257
|
-
readonly name: "minQuoteRatio";
|
|
258
|
-
readonly outputs: readonly [{
|
|
259
|
-
readonly name: "";
|
|
260
|
-
readonly internalType: "uint256";
|
|
261
|
-
readonly type: "uint256";
|
|
262
|
-
}];
|
|
263
|
-
readonly stateMutability: "view";
|
|
264
|
-
}, {
|
|
265
|
-
readonly type: "function";
|
|
266
|
-
readonly inputs: readonly [{
|
|
267
|
-
readonly name: "";
|
|
268
|
-
readonly internalType: "bytes32";
|
|
269
|
-
readonly type: "bytes32";
|
|
270
|
-
}];
|
|
271
|
-
readonly name: "nameOf";
|
|
272
|
-
readonly outputs: readonly [{
|
|
273
|
-
readonly name: "";
|
|
274
|
-
readonly internalType: "bytes32";
|
|
275
|
-
readonly type: "bytes32";
|
|
276
|
-
}];
|
|
277
|
-
readonly stateMutability: "view";
|
|
278
|
-
}, {
|
|
279
|
-
readonly type: "function";
|
|
280
|
-
readonly inputs: readonly [{
|
|
281
|
-
readonly name: "";
|
|
282
|
-
readonly internalType: "address";
|
|
283
|
-
readonly type: "address";
|
|
284
|
-
}, {
|
|
285
|
-
readonly name: "";
|
|
286
|
-
readonly internalType: "struct CPoolKey";
|
|
287
|
-
readonly type: "tuple";
|
|
288
|
-
readonly components: readonly [{
|
|
289
|
-
readonly name: "base";
|
|
290
|
-
readonly internalType: "address";
|
|
291
|
-
readonly type: "address";
|
|
292
|
-
}, {
|
|
293
|
-
readonly name: "quote";
|
|
294
|
-
readonly internalType: "address";
|
|
295
|
-
readonly type: "address";
|
|
296
|
-
}, {
|
|
297
|
-
readonly name: "tickSpacing";
|
|
298
|
-
readonly internalType: "int256";
|
|
299
|
-
readonly type: "int256";
|
|
300
|
-
}, {
|
|
301
|
-
readonly name: "policy";
|
|
302
|
-
readonly internalType: "address";
|
|
303
|
-
readonly type: "address";
|
|
304
|
-
}, {
|
|
305
|
-
readonly name: "swapFee";
|
|
306
|
-
readonly internalType: "uint256";
|
|
307
|
-
readonly type: "uint256";
|
|
308
|
-
}, {
|
|
309
|
-
readonly name: "mintFee";
|
|
310
|
-
readonly internalType: "uint256";
|
|
311
|
-
readonly type: "uint256";
|
|
312
|
-
}];
|
|
313
|
-
}];
|
|
314
|
-
readonly name: "onCInitialize";
|
|
315
|
-
readonly outputs: readonly [{
|
|
316
|
-
readonly name: "";
|
|
317
|
-
readonly internalType: "uint8";
|
|
318
|
-
readonly type: "uint8";
|
|
319
|
-
}, {
|
|
320
|
-
readonly name: "";
|
|
321
|
-
readonly internalType: "uint256";
|
|
322
|
-
readonly type: "uint256";
|
|
323
|
-
}];
|
|
324
|
-
readonly stateMutability: "pure";
|
|
325
|
-
}, {
|
|
326
|
-
readonly type: "function";
|
|
327
|
-
readonly inputs: readonly [{
|
|
328
|
-
readonly name: "poolId";
|
|
329
|
-
readonly internalType: "bytes32";
|
|
330
|
-
readonly type: "bytes32";
|
|
331
|
-
}, {
|
|
332
|
-
readonly name: "key";
|
|
333
|
-
readonly internalType: "struct FPoolKey";
|
|
334
|
-
readonly type: "tuple";
|
|
335
|
-
readonly components: readonly [{
|
|
336
|
-
readonly name: "quote";
|
|
337
|
-
readonly internalType: "address";
|
|
338
|
-
readonly type: "address";
|
|
339
|
-
}, {
|
|
340
|
-
readonly name: "bases";
|
|
341
|
-
readonly internalType: "address[]";
|
|
342
|
-
readonly type: "address[]";
|
|
343
|
-
}, {
|
|
344
|
-
readonly name: "swapFee";
|
|
345
|
-
readonly internalType: "uint256";
|
|
346
|
-
readonly type: "uint256";
|
|
347
|
-
}, {
|
|
348
|
-
readonly name: "policy";
|
|
349
|
-
readonly internalType: "address";
|
|
350
|
-
readonly type: "address";
|
|
351
|
-
}, {
|
|
352
|
-
readonly name: "creator";
|
|
353
|
-
readonly internalType: "address";
|
|
354
|
-
readonly type: "address";
|
|
355
|
-
}, {
|
|
356
|
-
readonly name: "salt";
|
|
357
|
-
readonly internalType: "bytes32";
|
|
358
|
-
readonly type: "bytes32";
|
|
359
|
-
}, {
|
|
360
|
-
readonly name: "mintFee";
|
|
361
|
-
readonly internalType: "uint256";
|
|
362
|
-
readonly type: "uint256";
|
|
363
|
-
}];
|
|
364
|
-
}];
|
|
365
|
-
readonly name: "onInitialize";
|
|
366
|
-
readonly outputs: readonly [{
|
|
367
|
-
readonly name: "";
|
|
368
|
-
readonly internalType: "uint8";
|
|
369
|
-
readonly type: "uint8";
|
|
370
|
-
}];
|
|
371
|
-
readonly stateMutability: "nonpayable";
|
|
372
|
-
}, {
|
|
373
|
-
readonly type: "function";
|
|
374
|
-
readonly inputs: readonly [{
|
|
375
|
-
readonly name: "poolId";
|
|
376
|
-
readonly internalType: "bytes32";
|
|
377
|
-
readonly type: "bytes32";
|
|
378
|
-
}, {
|
|
379
|
-
readonly name: "from";
|
|
380
|
-
readonly internalType: "address";
|
|
381
|
-
readonly type: "address";
|
|
382
|
-
}, {
|
|
383
|
-
readonly name: "creator_";
|
|
384
|
-
readonly internalType: "address";
|
|
385
|
-
readonly type: "address";
|
|
386
|
-
}, {
|
|
387
|
-
readonly name: "authority_";
|
|
388
|
-
readonly internalType: "address";
|
|
389
|
-
readonly type: "address";
|
|
390
|
-
}, {
|
|
391
|
-
readonly name: "name_";
|
|
392
|
-
readonly internalType: "bytes32";
|
|
393
|
-
readonly type: "bytes32";
|
|
394
|
-
}];
|
|
395
|
-
readonly name: "onMigrate";
|
|
396
|
-
readonly outputs: readonly [{
|
|
397
|
-
readonly name: "";
|
|
398
|
-
readonly internalType: "uint8";
|
|
399
|
-
readonly type: "uint8";
|
|
400
|
-
}];
|
|
401
|
-
readonly stateMutability: "nonpayable";
|
|
402
|
-
}, {
|
|
403
|
-
readonly type: "function";
|
|
404
|
-
readonly inputs: readonly [{
|
|
405
|
-
readonly name: "a";
|
|
406
|
-
readonly internalType: "struct IFPolicy.Ask";
|
|
407
|
-
readonly type: "tuple";
|
|
408
|
-
readonly components: readonly [{
|
|
409
|
-
readonly name: "poolId";
|
|
410
|
-
readonly internalType: "bytes32";
|
|
411
|
-
readonly type: "bytes32";
|
|
412
|
-
}, {
|
|
413
|
-
readonly name: "gen";
|
|
414
|
-
readonly internalType: "uint256";
|
|
415
|
-
readonly type: "uint256";
|
|
416
|
-
}, {
|
|
417
|
-
readonly name: "action";
|
|
418
|
-
readonly internalType: "enum IFPolicy.Action";
|
|
419
|
-
readonly type: "uint8";
|
|
420
|
-
}, {
|
|
421
|
-
readonly name: "who";
|
|
422
|
-
readonly internalType: "address";
|
|
423
|
-
readonly type: "address";
|
|
424
|
-
}, {
|
|
425
|
-
readonly name: "amount";
|
|
426
|
-
readonly internalType: "uint256";
|
|
427
|
-
readonly type: "uint256";
|
|
428
|
-
}, {
|
|
429
|
-
readonly name: "income";
|
|
430
|
-
readonly internalType: "uint256";
|
|
431
|
-
readonly type: "uint256";
|
|
432
|
-
}, {
|
|
433
|
-
readonly name: "Q";
|
|
434
|
-
readonly internalType: "uint256";
|
|
435
|
-
readonly type: "uint256";
|
|
436
|
-
}, {
|
|
437
|
-
readonly name: "L";
|
|
438
|
-
readonly internalType: "uint256";
|
|
439
|
-
readonly type: "uint256";
|
|
440
|
-
}, {
|
|
441
|
-
readonly name: "n";
|
|
442
|
-
readonly internalType: "uint256";
|
|
443
|
-
readonly type: "uint256";
|
|
444
|
-
}];
|
|
445
|
-
}];
|
|
446
|
-
readonly name: "onRegenerate";
|
|
447
|
-
readonly outputs: readonly [{
|
|
448
|
-
readonly name: "t";
|
|
449
|
-
readonly internalType: "struct IFPolicy.Terms";
|
|
450
|
-
readonly type: "tuple";
|
|
451
|
-
readonly components: readonly [{
|
|
452
|
-
readonly name: "payee";
|
|
453
|
-
readonly internalType: "address";
|
|
454
|
-
readonly type: "address";
|
|
455
|
-
}, {
|
|
456
|
-
readonly name: "toPayee";
|
|
457
|
-
readonly internalType: "uint256";
|
|
458
|
-
readonly type: "uint256";
|
|
459
|
-
}, {
|
|
460
|
-
readonly name: "minQuoteRatio";
|
|
461
|
-
readonly internalType: "uint256";
|
|
462
|
-
readonly type: "uint256";
|
|
463
|
-
}, {
|
|
464
|
-
readonly name: "carried";
|
|
465
|
-
readonly internalType: "address";
|
|
466
|
-
readonly type: "address";
|
|
467
|
-
}];
|
|
468
|
-
}];
|
|
469
|
-
readonly stateMutability: "nonpayable";
|
|
470
|
-
}, {
|
|
471
|
-
readonly type: "function";
|
|
472
|
-
readonly inputs: readonly [{
|
|
473
|
-
readonly name: "";
|
|
474
|
-
readonly internalType: "bytes32";
|
|
475
|
-
readonly type: "bytes32";
|
|
476
|
-
}];
|
|
477
|
-
readonly name: "pendingAuthority";
|
|
478
|
-
readonly outputs: readonly [{
|
|
479
|
-
readonly name: "";
|
|
480
|
-
readonly internalType: "address";
|
|
481
|
-
readonly type: "address";
|
|
482
|
-
}];
|
|
483
|
-
readonly stateMutability: "view";
|
|
484
|
-
}, {
|
|
485
|
-
readonly type: "function";
|
|
486
|
-
readonly inputs: readonly [{
|
|
487
|
-
readonly name: "poolId";
|
|
488
|
-
readonly internalType: "bytes32";
|
|
489
|
-
readonly type: "bytes32";
|
|
490
|
-
}, {
|
|
491
|
-
readonly name: "next";
|
|
492
|
-
readonly internalType: "address";
|
|
493
|
-
readonly type: "address";
|
|
494
|
-
}];
|
|
495
|
-
readonly name: "proposeAuthority";
|
|
496
|
-
readonly outputs: readonly [];
|
|
497
|
-
readonly stateMutability: "nonpayable";
|
|
498
|
-
}, {
|
|
499
|
-
readonly type: "function";
|
|
500
|
-
readonly inputs: readonly [];
|
|
501
|
-
readonly name: "quoteCurated";
|
|
502
|
-
readonly outputs: readonly [{
|
|
503
|
-
readonly name: "";
|
|
504
|
-
readonly internalType: "bool";
|
|
505
|
-
readonly type: "bool";
|
|
506
|
-
}];
|
|
507
|
-
readonly stateMutability: "view";
|
|
508
|
-
}, {
|
|
509
|
-
readonly type: "function";
|
|
510
|
-
readonly inputs: readonly [{
|
|
511
|
-
readonly name: "";
|
|
512
|
-
readonly internalType: "address";
|
|
513
|
-
readonly type: "address";
|
|
514
|
-
}];
|
|
515
|
-
readonly name: "quoteListed";
|
|
516
|
-
readonly outputs: readonly [{
|
|
517
|
-
readonly name: "";
|
|
518
|
-
readonly internalType: "bool";
|
|
519
|
-
readonly type: "bool";
|
|
520
|
-
}];
|
|
521
|
-
readonly stateMutability: "view";
|
|
522
|
-
}, {
|
|
523
|
-
readonly type: "function";
|
|
524
|
-
readonly inputs: readonly [{
|
|
525
|
-
readonly name: "cManager_";
|
|
526
|
-
readonly internalType: "address";
|
|
527
|
-
readonly type: "address";
|
|
528
|
-
}];
|
|
529
|
-
readonly name: "setCManager";
|
|
530
|
-
readonly outputs: readonly [];
|
|
531
|
-
readonly stateMutability: "nonpayable";
|
|
532
|
-
}, {
|
|
533
|
-
readonly type: "function";
|
|
534
|
-
readonly inputs: readonly [{
|
|
535
|
-
readonly name: "curated";
|
|
536
|
-
readonly internalType: "bool";
|
|
537
|
-
readonly type: "bool";
|
|
538
|
-
}];
|
|
539
|
-
readonly name: "setFeeCurated";
|
|
540
|
-
readonly outputs: readonly [];
|
|
541
|
-
readonly stateMutability: "nonpayable";
|
|
542
|
-
}, {
|
|
543
|
-
readonly type: "function";
|
|
544
|
-
readonly inputs: readonly [{
|
|
545
|
-
readonly name: "fee";
|
|
546
|
-
readonly internalType: "uint256";
|
|
547
|
-
readonly type: "uint256";
|
|
548
|
-
}, {
|
|
549
|
-
readonly name: "listed";
|
|
550
|
-
readonly internalType: "bool";
|
|
551
|
-
readonly type: "bool";
|
|
552
|
-
}];
|
|
553
|
-
readonly name: "setFeeListed";
|
|
554
|
-
readonly outputs: readonly [];
|
|
555
|
-
readonly stateMutability: "nonpayable";
|
|
556
|
-
}, {
|
|
557
|
-
readonly type: "function";
|
|
558
|
-
readonly inputs: readonly [{
|
|
559
|
-
readonly name: "rate";
|
|
560
|
-
readonly internalType: "uint256";
|
|
561
|
-
readonly type: "uint256";
|
|
562
|
-
}];
|
|
563
|
-
readonly name: "setIncomeTaxRate";
|
|
564
|
-
readonly outputs: readonly [];
|
|
565
|
-
readonly stateMutability: "nonpayable";
|
|
566
|
-
}, {
|
|
567
|
-
readonly type: "function";
|
|
568
|
-
readonly inputs: readonly [{
|
|
569
|
-
readonly name: "ratio";
|
|
570
|
-
readonly internalType: "uint256";
|
|
571
|
-
readonly type: "uint256";
|
|
572
|
-
}];
|
|
573
|
-
readonly name: "setMinQuoteRatio";
|
|
574
|
-
readonly outputs: readonly [];
|
|
575
|
-
readonly stateMutability: "nonpayable";
|
|
576
|
-
}, {
|
|
577
|
-
readonly type: "function";
|
|
578
|
-
readonly inputs: readonly [{
|
|
579
|
-
readonly name: "poolId";
|
|
580
|
-
readonly internalType: "bytes32";
|
|
581
|
-
readonly type: "bytes32";
|
|
582
|
-
}, {
|
|
583
|
-
readonly name: "name_";
|
|
584
|
-
readonly internalType: "bytes32";
|
|
585
|
-
readonly type: "bytes32";
|
|
586
|
-
}];
|
|
587
|
-
readonly name: "setName";
|
|
588
|
-
readonly outputs: readonly [];
|
|
589
|
-
readonly stateMutability: "nonpayable";
|
|
590
|
-
}, {
|
|
591
|
-
readonly type: "function";
|
|
592
|
-
readonly inputs: readonly [{
|
|
593
|
-
readonly name: "curated";
|
|
594
|
-
readonly internalType: "bool";
|
|
595
|
-
readonly type: "bool";
|
|
596
|
-
}];
|
|
597
|
-
readonly name: "setQuoteCurated";
|
|
598
|
-
readonly outputs: readonly [];
|
|
599
|
-
readonly stateMutability: "nonpayable";
|
|
600
|
-
}, {
|
|
601
|
-
readonly type: "function";
|
|
602
|
-
readonly inputs: readonly [{
|
|
603
|
-
readonly name: "quote";
|
|
604
|
-
readonly internalType: "address";
|
|
605
|
-
readonly type: "address";
|
|
606
|
-
}, {
|
|
607
|
-
readonly name: "listed";
|
|
608
|
-
readonly internalType: "bool";
|
|
609
|
-
readonly type: "bool";
|
|
610
|
-
}];
|
|
611
|
-
readonly name: "setQuoteListed";
|
|
612
|
-
readonly outputs: readonly [];
|
|
613
|
-
readonly stateMutability: "nonpayable";
|
|
614
|
-
}, {
|
|
615
|
-
readonly type: "function";
|
|
616
|
-
readonly inputs: readonly [];
|
|
617
|
-
readonly name: "sponsor";
|
|
618
|
-
readonly outputs: readonly [{
|
|
619
|
-
readonly name: "";
|
|
620
|
-
readonly internalType: "address";
|
|
621
|
-
readonly type: "address";
|
|
622
|
-
}];
|
|
623
|
-
readonly stateMutability: "view";
|
|
624
|
-
}, {
|
|
625
|
-
readonly type: "event";
|
|
626
|
-
readonly anonymous: false;
|
|
627
|
-
readonly inputs: readonly [{
|
|
628
|
-
readonly name: "poolId";
|
|
629
|
-
readonly internalType: "bytes32";
|
|
630
|
-
readonly type: "bytes32";
|
|
631
|
-
readonly indexed: true;
|
|
632
|
-
}, {
|
|
633
|
-
readonly name: "current";
|
|
634
|
-
readonly internalType: "address";
|
|
635
|
-
readonly type: "address";
|
|
636
|
-
readonly indexed: true;
|
|
637
|
-
}, {
|
|
638
|
-
readonly name: "proposed";
|
|
639
|
-
readonly internalType: "address";
|
|
640
|
-
readonly type: "address";
|
|
641
|
-
readonly indexed: true;
|
|
642
|
-
}];
|
|
643
|
-
readonly name: "AuthorityProposed";
|
|
644
|
-
}, {
|
|
645
|
-
readonly type: "event";
|
|
646
|
-
readonly anonymous: false;
|
|
647
|
-
readonly inputs: readonly [{
|
|
648
|
-
readonly name: "poolId";
|
|
649
|
-
readonly internalType: "bytes32";
|
|
650
|
-
readonly type: "bytes32";
|
|
651
|
-
readonly indexed: true;
|
|
652
|
-
}, {
|
|
653
|
-
readonly name: "prev";
|
|
654
|
-
readonly internalType: "address";
|
|
655
|
-
readonly type: "address";
|
|
656
|
-
readonly indexed: true;
|
|
657
|
-
}, {
|
|
658
|
-
readonly name: "next";
|
|
659
|
-
readonly internalType: "address";
|
|
660
|
-
readonly type: "address";
|
|
661
|
-
readonly indexed: true;
|
|
662
|
-
}];
|
|
663
|
-
readonly name: "AuthoritySet";
|
|
664
|
-
}, {
|
|
665
|
-
readonly type: "event";
|
|
666
|
-
readonly anonymous: false;
|
|
667
|
-
readonly inputs: readonly [{
|
|
668
|
-
readonly name: "manager";
|
|
669
|
-
readonly internalType: "address";
|
|
670
|
-
readonly type: "address";
|
|
671
|
-
readonly indexed: true;
|
|
672
|
-
}];
|
|
673
|
-
readonly name: "CManagerSet";
|
|
674
|
-
}, {
|
|
675
|
-
readonly type: "event";
|
|
676
|
-
readonly anonymous: false;
|
|
677
|
-
readonly inputs: readonly [{
|
|
678
|
-
readonly name: "curated";
|
|
679
|
-
readonly internalType: "bool";
|
|
680
|
-
readonly type: "bool";
|
|
681
|
-
readonly indexed: false;
|
|
682
|
-
}];
|
|
683
|
-
readonly name: "FeeCuratedSet";
|
|
684
|
-
}, {
|
|
685
|
-
readonly type: "event";
|
|
686
|
-
readonly anonymous: false;
|
|
687
|
-
readonly inputs: readonly [{
|
|
688
|
-
readonly name: "fee";
|
|
689
|
-
readonly internalType: "uint256";
|
|
690
|
-
readonly type: "uint256";
|
|
691
|
-
readonly indexed: true;
|
|
692
|
-
}, {
|
|
693
|
-
readonly name: "listed";
|
|
694
|
-
readonly internalType: "bool";
|
|
695
|
-
readonly type: "bool";
|
|
696
|
-
readonly indexed: false;
|
|
697
|
-
}];
|
|
698
|
-
readonly name: "FeeListed";
|
|
699
|
-
}, {
|
|
700
|
-
readonly type: "event";
|
|
701
|
-
readonly anonymous: false;
|
|
702
|
-
readonly inputs: readonly [{
|
|
703
|
-
readonly name: "rate";
|
|
704
|
-
readonly internalType: "uint256";
|
|
705
|
-
readonly type: "uint256";
|
|
706
|
-
readonly indexed: false;
|
|
707
|
-
}];
|
|
708
|
-
readonly name: "IncomeTaxRateSet";
|
|
709
|
-
}, {
|
|
710
|
-
readonly type: "event";
|
|
711
|
-
readonly anonymous: false;
|
|
712
|
-
readonly inputs: readonly [{
|
|
713
|
-
readonly name: "ratio";
|
|
714
|
-
readonly internalType: "uint256";
|
|
715
|
-
readonly type: "uint256";
|
|
716
|
-
readonly indexed: false;
|
|
717
|
-
}];
|
|
718
|
-
readonly name: "MinQuoteRatioSet";
|
|
719
|
-
}, {
|
|
720
|
-
readonly type: "event";
|
|
721
|
-
readonly anonymous: false;
|
|
722
|
-
readonly inputs: readonly [{
|
|
723
|
-
readonly name: "poolId";
|
|
724
|
-
readonly internalType: "bytes32";
|
|
725
|
-
readonly type: "bytes32";
|
|
726
|
-
readonly indexed: true;
|
|
727
|
-
}, {
|
|
728
|
-
readonly name: "name";
|
|
729
|
-
readonly internalType: "bytes32";
|
|
730
|
-
readonly type: "bytes32";
|
|
731
|
-
readonly indexed: false;
|
|
732
|
-
}];
|
|
733
|
-
readonly name: "NameSet";
|
|
734
|
-
}, {
|
|
735
|
-
readonly type: "event";
|
|
736
|
-
readonly anonymous: false;
|
|
737
|
-
readonly inputs: readonly [{
|
|
738
|
-
readonly name: "curated";
|
|
739
|
-
readonly internalType: "bool";
|
|
740
|
-
readonly type: "bool";
|
|
741
|
-
readonly indexed: false;
|
|
742
|
-
}];
|
|
743
|
-
readonly name: "QuoteCuratedSet";
|
|
744
|
-
}, {
|
|
745
|
-
readonly type: "event";
|
|
746
|
-
readonly anonymous: false;
|
|
747
|
-
readonly inputs: readonly [{
|
|
748
|
-
readonly name: "quote";
|
|
749
|
-
readonly internalType: "address";
|
|
750
|
-
readonly type: "address";
|
|
751
|
-
readonly indexed: true;
|
|
752
|
-
}, {
|
|
753
|
-
readonly name: "listed";
|
|
754
|
-
readonly internalType: "bool";
|
|
755
|
-
readonly type: "bool";
|
|
756
|
-
readonly indexed: false;
|
|
757
|
-
}];
|
|
758
|
-
readonly name: "QuoteListed";
|
|
759
|
-
}, {
|
|
760
|
-
readonly type: "error";
|
|
761
|
-
readonly inputs: readonly [];
|
|
762
|
-
readonly name: "BadFee";
|
|
763
|
-
}, {
|
|
764
|
-
readonly type: "error";
|
|
765
|
-
readonly inputs: readonly [];
|
|
766
|
-
readonly name: "BadRate";
|
|
767
|
-
}, {
|
|
768
|
-
readonly type: "error";
|
|
769
|
-
readonly inputs: readonly [{
|
|
770
|
-
readonly name: "fee";
|
|
771
|
-
readonly internalType: "uint256";
|
|
772
|
-
readonly type: "uint256";
|
|
773
|
-
}];
|
|
774
|
-
readonly name: "FeeNotListed";
|
|
775
|
-
}, {
|
|
776
|
-
readonly type: "error";
|
|
777
|
-
readonly inputs: readonly [];
|
|
778
|
-
readonly name: "NoCreator";
|
|
779
|
-
}, {
|
|
780
|
-
readonly type: "error";
|
|
781
|
-
readonly inputs: readonly [];
|
|
782
|
-
readonly name: "NotAuthority";
|
|
783
|
-
}, {
|
|
784
|
-
readonly type: "error";
|
|
785
|
-
readonly inputs: readonly [];
|
|
786
|
-
readonly name: "NotLogAuthority";
|
|
787
|
-
}, {
|
|
788
|
-
readonly type: "error";
|
|
789
|
-
readonly inputs: readonly [];
|
|
790
|
-
readonly name: "NotManager";
|
|
791
|
-
}, {
|
|
792
|
-
readonly type: "error";
|
|
793
|
-
readonly inputs: readonly [];
|
|
794
|
-
readonly name: "NotRegistry";
|
|
795
|
-
}, {
|
|
796
|
-
readonly type: "error";
|
|
797
|
-
readonly inputs: readonly [];
|
|
798
|
-
readonly name: "NotSponsor";
|
|
799
|
-
}, {
|
|
800
|
-
readonly type: "error";
|
|
801
|
-
readonly inputs: readonly [];
|
|
802
|
-
readonly name: "OneBase";
|
|
803
|
-
}, {
|
|
804
|
-
readonly type: "error";
|
|
805
|
-
readonly inputs: readonly [{
|
|
806
|
-
readonly name: "quote";
|
|
807
|
-
readonly internalType: "address";
|
|
808
|
-
readonly type: "address";
|
|
809
|
-
}];
|
|
810
|
-
readonly name: "QuoteNotListed";
|
|
811
|
-
}, {
|
|
812
|
-
readonly type: "error";
|
|
813
|
-
readonly inputs: readonly [];
|
|
814
|
-
readonly name: "QuoteTooThin";
|
|
815
|
-
}, {
|
|
816
|
-
readonly type: "error";
|
|
817
|
-
readonly inputs: readonly [];
|
|
818
|
-
readonly name: "Refused";
|
|
819
|
-
}];
|
|
820
|
-
import { type LogswapClient } from "./client.js";
|
|
821
|
-
/** The optional questions a policy declared at birth, as bits of `Pool.asks`. */
|
|
822
|
-
export declare const ASK_SWAP = 1;
|
|
823
|
-
export declare const ASK_MINT = 2;
|
|
50
|
+
export declare const GATE_SWAP = 1;
|
|
51
|
+
export declare const GATE_MINT = 2;
|
|
52
|
+
/** `GATE_SWAP | GATE_MINT`: the bits `setGates` carries (`SEED_TO_DEAD` is the birth's alone). */
|
|
53
|
+
export declare const GATES: number;
|
|
824
54
|
/** Everything scalar about a basket pool, in one round trip's worth of reads. */
|
|
825
55
|
export interface FPoolState {
|
|
826
56
|
/** The pool's id — the hash of its key. There is no per-pool address. */
|
|
@@ -835,9 +65,9 @@ export interface FPoolState {
|
|
|
835
65
|
Q: bigint;
|
|
836
66
|
/** Total exposure. Grows on mint, shrinks on burn; never moves on a swap. */
|
|
837
67
|
L: bigint;
|
|
838
|
-
/** 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. */
|
|
839
69
|
swapFee: bigint;
|
|
840
|
-
/** 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}). */
|
|
841
71
|
mintFee: bigint;
|
|
842
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. */
|
|
843
73
|
refLogFloor: bigint;
|
|
@@ -856,29 +86,32 @@ export interface FPoolState {
|
|
|
856
86
|
/** Σ = ∫ Σ_j w_j (dx_j)², accrued even though the fee is fixed — the kernel stays calculable. */
|
|
857
87
|
realizedVariance: bigint;
|
|
858
88
|
/**
|
|
859
|
-
* The pool's policy: the contract the key names, holding the pool's roles
|
|
860
|
-
*
|
|
861
|
-
*
|
|
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.
|
|
862
92
|
*/
|
|
863
93
|
policy: Address;
|
|
864
|
-
/**
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
94
|
+
/**
|
|
95
|
+
* What the policy declared for the pool (`Pool.flags`, decision 098): the gate bits {@link GATE_SWAP} and {@link GATE_MINT} (set by the
|
|
96
|
+
* policy's `setGates` as the operator changes the modes) and the birth bit {@link SEED_TO_DEAD} (a pad's, the pool's for life).
|
|
97
|
+
*/
|
|
98
|
+
flags: number;
|
|
99
|
+
/**
|
|
100
|
+
* The operator the manager caches (`Pool.operator`): the one account that funds, harvests and closes the pool, admitted by a gated swap or
|
|
101
|
+
* mint with no policy call. The policy's `operator(poolId)`, synced at every appointment ({@link getFPoolRoles}).
|
|
102
|
+
*/
|
|
103
|
+
operator: Address;
|
|
868
104
|
/** The time (unix seconds) of the last harvest / composition action: no swap runs at that timestamp (F version 29; a block number before). */
|
|
869
105
|
restructureTime: number;
|
|
870
|
-
/** What the pool is — its POLICY's
|
|
106
|
+
/** What the pool is — a label read off its POLICY's immutables; see {@link FPoolKind}. */
|
|
871
107
|
kind: FPoolKind;
|
|
872
|
-
/** 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). */
|
|
873
109
|
seeded: boolean;
|
|
874
110
|
/**
|
|
875
|
-
* The live GENERATION.
|
|
876
|
-
* ({@link fPoolRedeem}) and
|
|
877
|
-
*
|
|
878
|
-
* ({@link
|
|
879
|
-
* as `gen + 1`, every other holder of `gen` is frozen out into its bundle. The share id carries
|
|
880
|
-
* it ({@link fPoolShareId}), so generations `0 … gen-1` are claims ({@link fPoolClaimsOf}) and
|
|
881
|
-
* `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.
|
|
882
115
|
*/
|
|
883
116
|
gen: number;
|
|
884
117
|
totalSupply: bigint;
|
|
@@ -889,65 +122,103 @@ export interface FPoolState {
|
|
|
889
122
|
/** κ_j = e^{−μ_j}, WAD: each leg's phantom reserve per unit of its liquidity. 0 uncapped. */
|
|
890
123
|
kappa: bigint[];
|
|
891
124
|
}
|
|
892
|
-
/** Read a basket pool whole: one lens call (`
|
|
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}. */
|
|
893
126
|
export declare function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolState>;
|
|
894
127
|
/**
|
|
895
|
-
* The kind of pool —
|
|
896
|
-
*
|
|
897
|
-
*
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
*
|
|
901
|
-
* its seed the pool's at birth (`SEED_TO_DEAD`) — open to all. private → pol → pad is the ladder
|
|
902
|
-
* of rigidity; public is a pol held by the protocol. 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}).
|
|
903
134
|
*/
|
|
904
|
-
export type FPoolKind = "public" | "
|
|
905
|
-
/** 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`. */
|
|
906
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;
|
|
907
168
|
/**
|
|
908
|
-
*
|
|
909
|
-
* chain:
|
|
910
|
-
* (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.
|
|
911
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. */
|
|
912
174
|
export declare function fPoolKindOfPolicy(c: LogswapClient, policy: Address): Promise<FPoolKind>;
|
|
913
|
-
/**
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
175
|
+
/**
|
|
176
|
+
* The pool's label — the last `NameSet` its policy emitted for it: the operator's word, mutable, never identity. Nothing is
|
|
177
|
+
* stored on chain (policy.md §4.3), so this is a log query — pass `indexer`, or set the client's. "" when never named.
|
|
178
|
+
*/
|
|
179
|
+
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.
|
|
188
|
+
*/
|
|
189
|
+
export type FPolicySlot = "public" | "private" | "pol" | "pad";
|
|
190
|
+
/** The deployment's policy for a slot — the one a key names when no `policy` is given. */
|
|
191
|
+
export declare function fPoolPolicyFor(c: LogswapClient, slot: FPolicySlot): Address;
|
|
917
192
|
/** The policy a pool named in its key — one read; {@link getFPool} carries it too. */
|
|
918
193
|
export declare function fPoolPolicyOf(c: LogswapClient, poolId: Hex): Promise<Address>;
|
|
919
194
|
/**
|
|
920
|
-
* A pool's roles, as its POLICY holds them.
|
|
921
|
-
*
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
* operator and no gate: those fields read zero / false.
|
|
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}).
|
|
925
199
|
*/
|
|
926
200
|
export interface FPoolRoles {
|
|
927
201
|
policy: Address;
|
|
928
|
-
|
|
202
|
+
/** The policy's authority now (`authority()`): its immutable, or the registry's LOG Authority when that is zero. */
|
|
929
203
|
authority: Address;
|
|
930
|
-
/** The
|
|
931
|
-
pendingAuthority: Address;
|
|
932
|
-
/** The desk's optional pool operator (decision 073): one delegate besides the authority, zero when none. */
|
|
204
|
+
/** The pool's operator (`operator(poolId)`): the authority at birth until re-appointed. Zero: the policy never held this pool. */
|
|
933
205
|
operator: Address;
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
swapExecutor: Address;
|
|
939
|
-
/** The policy's own ceiling on a harvest now — the bid ({@link FPoolDescription.harvestable}) narrowed by the policy's rule. */
|
|
940
|
-
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;
|
|
941
210
|
}
|
|
942
|
-
/** `
|
|
943
|
-
export type
|
|
944
|
-
/**
|
|
945
|
-
export declare
|
|
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>;
|
|
946
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. */
|
|
947
218
|
export type FPoolShape = "launch" | "basket";
|
|
948
219
|
export interface FPoolDescription {
|
|
949
|
-
shape: FPoolShape;
|
|
950
220
|
/** The pad is the launch shape, by the kind. */
|
|
221
|
+
shape: FPoolShape;
|
|
951
222
|
legs: number;
|
|
952
223
|
/** True when the pool holds no quote: an all-base resting ask. base→quote is the one blocked path. */
|
|
953
224
|
atFloor: boolean;
|
|
@@ -957,16 +228,22 @@ export interface FPoolDescription {
|
|
|
957
228
|
* from the first wei after it.
|
|
958
229
|
*/
|
|
959
230
|
unharvested: bigint;
|
|
960
|
-
/**
|
|
961
|
-
* The most a harvest may take now by the MANAGER's rule: the bid, `Q` once seeded (0 before).
|
|
962
|
-
* The manager's `harvestable()` getter was cut in F version 21; this is the same number, read
|
|
963
|
-
* off `getPool`. The policy may allow less (a pad: the income; a POL: above `minQuoteRatio`·L) —
|
|
964
|
-
* {@link FPoolRoles.maxHarvest}.
|
|
965
|
-
*/
|
|
966
|
-
harvestable: bigint;
|
|
967
|
-
/** 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. */
|
|
968
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;
|
|
969
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
|
+
};
|
|
970
247
|
export declare function describeFPool(c: LogswapClient, s: FPoolState): Promise<FPoolDescription>;
|
|
971
248
|
/** `p_j = e^{x_j}`, lossy the way any float conversion is. Compare in log space when it matters. */
|
|
972
249
|
export declare function fPoolPriceOf(x: bigint, scale?: number): number;
|
|
@@ -1127,16 +404,18 @@ export declare function fPoolPreviewRollIn(c: LogswapClient, poolId: Hex, gen: b
|
|
|
1127
404
|
quoteExcess: bigint;
|
|
1128
405
|
}>;
|
|
1129
406
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
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`).
|
|
1136
415
|
*/
|
|
1137
416
|
export declare function fPoolHarvest(c: LogswapClient, a: {
|
|
1138
417
|
poolId: Hex;
|
|
1139
|
-
|
|
418
|
+
extra?: bigint;
|
|
1140
419
|
to?: Address;
|
|
1141
420
|
account: Address;
|
|
1142
421
|
}): Promise<`0x${string}`>;
|
|
@@ -1285,37 +564,51 @@ export interface FPoolCreateArgs {
|
|
|
1285
564
|
quote: Address;
|
|
1286
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. */
|
|
1287
566
|
bases: Address[];
|
|
1288
|
-
/** The swap fee
|
|
1289
|
-
|
|
1290
|
-
/**
|
|
1291
|
-
|
|
1292
|
-
* 078): `2 * swapFee <= mintFee <= MINT_FEE_MAX`, checked by the manager (`BadParam`). Defaults to
|
|
1293
|
-
* {@link presetMintFee}: twice the swap fee.
|
|
1294
|
-
*/
|
|
1295
|
-
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;
|
|
1296
571
|
/**
|
|
1297
|
-
* Which of the
|
|
1298
|
-
* 049: the manager knows no kind):
|
|
1299
|
-
* is not named ({@link fPoolPolicyFor}), and it is what the policy will say it is.
|
|
572
|
+
* Which of the deployment's policies the key names when `policy` is not given ({@link fPoolPolicyFor}). NOT a key
|
|
573
|
+
* field (decisions 049: the manager knows no kind): the policy is, and its terms say what it is ({@link FPoolKind}).
|
|
1300
574
|
*/
|
|
1301
|
-
kind:
|
|
575
|
+
kind: FPolicySlot;
|
|
1302
576
|
/**
|
|
1303
|
-
* The pool's policy: the contract the key names, approved by the
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
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}).
|
|
1306
580
|
*/
|
|
1307
581
|
policy?: Address;
|
|
1308
|
-
/** Who is born holding the pool: immutable identity, the pool's first authority (the policy records it). */
|
|
1309
|
-
creator: Address;
|
|
1310
582
|
/**
|
|
1311
|
-
* The differentiator, and nothing else. Identity is the key's hash, so
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
1314
|
-
*
|
|
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.
|
|
1315
587
|
*/
|
|
1316
588
|
salt?: Hex;
|
|
1317
589
|
account: Address;
|
|
1318
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;
|
|
1319
612
|
/** `bytes32` ⇄ short UTF-8 text, for the pool and sponsor labels. */
|
|
1320
613
|
export declare function textToBytes32(text: string): Hex;
|
|
1321
614
|
export declare function bytes32ToText(word: Hex): string;
|
|
@@ -1325,33 +618,56 @@ export declare function sortFPoolLegs<T>(bases: Address[], ...companions: T[][])
|
|
|
1325
618
|
companions: T[][];
|
|
1326
619
|
};
|
|
1327
620
|
/**
|
|
1328
|
-
* The tuple an F pool's id hashes — `src/types/
|
|
1329
|
-
*
|
|
1330
|
-
*
|
|
1331
|
-
* 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`.
|
|
1332
624
|
*/
|
|
1333
625
|
export interface FPoolKey {
|
|
1334
626
|
quote: Address;
|
|
1335
|
-
/** Sorted ascending, unique; fixed for the pool's life. */
|
|
627
|
+
/** Sorted ascending, unique, 1..8; fixed for the pool's life. */
|
|
1336
628
|
bases: Address[];
|
|
1337
|
-
|
|
1338
|
-
|
|
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. */
|
|
1339
632
|
policy: Address;
|
|
1340
|
-
|
|
633
|
+
/** Zero under an open policy. */
|
|
1341
634
|
salt: Hex;
|
|
1342
|
-
/** The creator-selected mint fee, WAD, fixed for life: `2 * swapFee <= mintFee <= MINT_FEE_MAX`. */
|
|
1343
|
-
mintFee: bigint;
|
|
1344
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
|
+
}];
|
|
1345
656
|
/**
|
|
1346
657
|
* An F pool's id: `keccak256(abi.encode(key))`, offline — what `initialize` computes inline. The
|
|
1347
|
-
* manager's `idOf
|
|
1348
|
-
*
|
|
1349
|
-
* 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).
|
|
1350
660
|
*/
|
|
1351
661
|
export declare function fPoolIdOfKey(key: FPoolKey): Hex;
|
|
1352
|
-
/** 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). */
|
|
1353
663
|
export declare function fPoolKeyOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): FPoolKey;
|
|
1354
|
-
/**
|
|
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
|
+
*/
|
|
1355
671
|
export declare function fPoolInitialize(c: LogswapClient, a: FPoolCreateArgs): Promise<`0x${string}`>;
|
|
1356
672
|
/**
|
|
1357
673
|
* The pool id is the key's hash — pure, so it can be read before or after creation. Computed
|
|
@@ -1360,14 +676,11 @@ export declare function fPoolInitialize(c: LogswapClient, a: FPoolCreateArgs): P
|
|
|
1360
676
|
*/
|
|
1361
677
|
export declare function fPoolIdOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): Promise<Hex>;
|
|
1362
678
|
/**
|
|
1363
|
-
* Rebuild a live pool's KEY from its id: the `PoolCreated` log carries every field
|
|
1364
|
-
*
|
|
1365
|
-
* 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
|
|
1366
|
-
* 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.
|
|
1367
681
|
*/
|
|
1368
682
|
export declare function fPoolKeyOfPool(c: LogswapClient, poolId: Hex, opts?: {
|
|
1369
|
-
|
|
1370
|
-
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. */
|
|
1371
684
|
indexer?: string;
|
|
1372
685
|
}): Promise<FPoolKey>;
|
|
1373
686
|
/**
|
|
@@ -1471,73 +784,70 @@ export declare function fPoolBookL(baseAssets: readonly BaseAsset[], lnCapOverSe
|
|
|
1471
784
|
* carried holder, every other holder is frozen into the closing generation's bundle ({@link fPoolRedeem}), and the
|
|
1472
785
|
* carried book becomes the one named, at the supplied prices. A pad is forward-only ({@link fPoolRegenerate}).
|
|
1473
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
|
+
*/
|
|
1474
795
|
export declare function fPoolDeploy(c: LogswapClient, a: {
|
|
1475
796
|
poolId: Hex;
|
|
1476
797
|
quoteAmount: bigint;
|
|
1477
|
-
to?: Address;
|
|
1478
798
|
account: Address;
|
|
1479
799
|
} & ({
|
|
1480
800
|
baseAssets: BaseAsset[];
|
|
1481
801
|
lnCapOverSeed: number;
|
|
1482
802
|
} | FPoolBookSpec)): Promise<`0x${string}`>;
|
|
1483
803
|
/**
|
|
1484
|
-
* Close the pool
|
|
1485
|
-
*
|
|
1486
|
-
*
|
|
1487
|
-
*
|
|
1488
|
-
* `
|
|
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.
|
|
1489
809
|
*/
|
|
1490
|
-
export declare function
|
|
810
|
+
export declare function fPoolClose(c: LogswapClient, a: {
|
|
1491
811
|
poolId: Hex;
|
|
1492
812
|
to?: Address;
|
|
1493
813
|
account: Address;
|
|
814
|
+
flags?: number;
|
|
1494
815
|
}): Promise<`0x${string}`>;
|
|
1495
816
|
/**
|
|
1496
|
-
*
|
|
1497
|
-
* (
|
|
1498
|
-
*
|
|
1499
|
-
* 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`.
|
|
1500
820
|
*/
|
|
1501
|
-
export declare function
|
|
821
|
+
export declare function fPoolRelaunchCalls(a: {
|
|
1502
822
|
poolId: Hex;
|
|
823
|
+
gen: number | bigint;
|
|
824
|
+
shares: bigint;
|
|
825
|
+
quoteAmount: bigint;
|
|
1503
826
|
to?: Address;
|
|
1504
827
|
account: Address;
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
* the income part (with no treasury there is none). `[]` when the bid is already empty. Throws on a pad (a pad
|
|
1510
|
-
* never closes, whatever its bid), and when the pool's policy keeps a floor on the bid
|
|
1511
|
-
* (`PolPolicy.minQuoteRatio`): a `close` under that policy waits for the market.
|
|
1512
|
-
*/
|
|
1513
|
-
export declare function fPoolEmptyingHarvests(c: LogswapClient, poolId: Hex): Promise<bigint[]>;
|
|
828
|
+
} & ({
|
|
829
|
+
baseAssets: BaseAsset[];
|
|
830
|
+
lnCapOverSeed: number;
|
|
831
|
+
} | FPoolBookSpec)): Hex[];
|
|
1514
832
|
/**
|
|
1515
|
-
*
|
|
1516
|
-
*
|
|
1517
|
-
*
|
|
1518
|
-
*
|
|
1519
|
-
*
|
|
1520
|
-
* - the carried holder's and the dead shares' `g` shares are re-minted 1:1 as `g + 1`: they go on
|
|
1521
|
-
* as the pool;
|
|
1522
|
-
* - every OTHER holder of `g` is frozen out pro rata into generation `g`'s bundle (`GenerationRetired`)
|
|
1523
|
-
* and redeems it with {@link fPoolRedeem} / rolls it with {@link fPoolRollIn} (`gen: g`); their
|
|
1524
|
-
* dividends on `g` stay claimable ({@link fPoolClaim} with `gen: g`). {@link fPoolClaimsOf}
|
|
1525
|
-
* lists them;
|
|
1526
|
-
* - the income released (`IncomeReleased`), all in quote: `toPayee` to the payee and the rest into the bid
|
|
1527
|
-
* (the floor down). No share is minted; L does not move. The book keeps its reserves, marks and cap.
|
|
1528
|
-
*
|
|
1529
|
-
* A pad's gate is `threshold(poolId, gen)`, in its quote (`PadPolicy.NotGraduated` below it); POL and private carry the
|
|
1530
|
-
* authority and send it the whole income; a public pool refuses (`Refused`). A carried holder with no
|
|
1531
|
-
* 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}).
|
|
1532
838
|
*/
|
|
1533
|
-
export declare function
|
|
839
|
+
export declare function fPoolRelaunch(c: LogswapClient, a: {
|
|
1534
840
|
poolId: Hex;
|
|
841
|
+
quoteAmount: bigint;
|
|
1535
842
|
to?: Address;
|
|
1536
843
|
account: Address;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
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. */
|
|
1539
849
|
export declare const DEAD_ADDRESS: Address;
|
|
1540
|
-
/** 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. */
|
|
1541
851
|
export declare const F_MIN_SHARES = 1000n;
|
|
1542
852
|
/**
|
|
1543
853
|
* One genesis transaction: a swap the creator sends right after the seed, inside the launch's
|
|
@@ -1594,7 +904,7 @@ export interface FPoolLaunchArgs extends Omit<FPoolCreateArgs, "account"> {
|
|
|
1594
904
|
* `followup`: always left to it. Ignored when no row names a recipient.
|
|
1595
905
|
*/
|
|
1596
906
|
deliver?: "auto" | "followup";
|
|
1597
|
-
/** 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. */
|
|
1598
908
|
name?: string;
|
|
1599
909
|
/**
|
|
1600
910
|
* The pool already exists (a previous launch got as far as `initialize` and no further — a seed
|
|
@@ -1602,7 +912,7 @@ export interface FPoolLaunchArgs extends Omit<FPoolCreateArgs, "account"> {
|
|
|
1602
912
|
* out: the key is a pure function of the arguments and a second `initialize` can only revert.
|
|
1603
913
|
*/
|
|
1604
914
|
initialized?: boolean;
|
|
1605
|
-
/** Anything else, pre-encoded against {@link
|
|
915
|
+
/** Anything else, pre-encoded against {@link managerFAbi}, appended after the above. */
|
|
1606
916
|
extra?: Hex[];
|
|
1607
917
|
account: Address;
|
|
1608
918
|
}
|
|
@@ -1644,31 +954,21 @@ export declare function fPoolSendGenesisTransfers(c: LogswapClient, a: {
|
|
|
1644
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. */
|
|
1645
955
|
export declare function fPoolWalletBatchesAtomically(c: LogswapClient, account: Address): Promise<boolean>;
|
|
1646
956
|
/**
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
*
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
poolId: Hex;
|
|
1653
|
-
account: Address;
|
|
1654
|
-
policy?: Address;
|
|
1655
|
-
}): Promise<Hash[]>;
|
|
1656
|
-
/**
|
|
1657
|
-
* Create a pool as ONE transaction: `initialize`, `seed`, the seed lock, the opening buy, the
|
|
1658
|
-
* name, the private-pool gates — the manager's `multicall`, the creator as sender throughout.
|
|
1659
|
-
* 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.
|
|
1660
962
|
*
|
|
1661
|
-
* Why the manager and not the router: every one of these entries authenticates by `msg.sender
|
|
1662
|
-
*
|
|
1663
|
-
* — the authority, the holder of the seed shares — and the handover back is two-step, so it
|
|
1664
|
-
* could not even close in the same transaction. `multicall` is delegatecall-to-self, so the
|
|
1665
|
-
* 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.
|
|
1666
965
|
*
|
|
1667
|
-
* What the batch PULLS, by plain allowance to the manager (never Permit2): `r0[j]` of each base,
|
|
1668
|
-
*
|
|
1669
|
-
*
|
|
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}).
|
|
1670
969
|
*
|
|
1671
|
-
* 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.
|
|
1672
972
|
*/
|
|
1673
973
|
export declare function fPoolLaunch(c: LogswapClient, a: FPoolLaunchArgs & ({
|
|
1674
974
|
r0: bigint[];
|
|
@@ -1681,73 +981,56 @@ export declare function fPoolLaunch(c: LogswapClient, a: FPoolLaunchArgs & ({
|
|
|
1681
981
|
delivered: boolean;
|
|
1682
982
|
}>;
|
|
1683
983
|
/**
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1686
|
-
*
|
|
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.
|
|
1687
987
|
*/
|
|
1688
|
-
export declare function
|
|
1689
|
-
poolId: Hex;
|
|
1690
|
-
next: Address;
|
|
1691
|
-
account: Address;
|
|
1692
|
-
policy?: Address;
|
|
1693
|
-
}): Promise<`0x${string}`>;
|
|
1694
|
-
/**
|
|
1695
|
-
* Accept a pending proposal — step two; only the proposed address can. Indexed via the policy's
|
|
1696
|
-
* AuthoritySet. On the desk's policy this clears the operator (pending and accepted) and voids the
|
|
1697
|
-
* seller's list.
|
|
1698
|
-
*/
|
|
1699
|
-
export declare function fPoolAcceptAuthority(c: LogswapClient, a: {
|
|
988
|
+
export declare function fPoolAppointOperator(c: LogswapClient, a: {
|
|
1700
989
|
poolId: Hex;
|
|
990
|
+
operator: Address;
|
|
1701
991
|
account: Address;
|
|
1702
992
|
policy?: Address;
|
|
1703
993
|
}): Promise<`0x${string}`>;
|
|
1704
994
|
/**
|
|
1705
|
-
* Set the
|
|
1706
|
-
*
|
|
1707
|
-
* and must be omitted otherwise. Preserves mint admission. `burn` is never gated.
|
|
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.
|
|
1708
997
|
*/
|
|
1709
998
|
export declare function fPoolSetSwapMode(c: LogswapClient, a: {
|
|
1710
999
|
poolId: Hex;
|
|
1711
|
-
mode:
|
|
1712
|
-
executor?: Address;
|
|
1000
|
+
mode: FPoolMode;
|
|
1713
1001
|
account: Address;
|
|
1714
1002
|
policy?: Address;
|
|
1715
1003
|
}): Promise<`0x${string}`>;
|
|
1716
|
-
/**
|
|
1717
|
-
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: {
|
|
1718
1006
|
poolId: Hex;
|
|
1719
|
-
|
|
1007
|
+
mode: FPoolMode;
|
|
1720
1008
|
account: Address;
|
|
1721
1009
|
policy?: Address;
|
|
1722
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;
|
|
1723
1020
|
/**
|
|
1724
|
-
*
|
|
1725
|
-
*
|
|
1726
|
-
* the
|
|
1727
|
-
* block: no swap lands in it (047).
|
|
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.
|
|
1728
1024
|
*/
|
|
1729
|
-
export declare function
|
|
1730
|
-
|
|
1731
|
-
who: readonly Address[];
|
|
1732
|
-
allowed: boolean;
|
|
1733
|
-
account: Address;
|
|
1734
|
-
policy?: Address;
|
|
1735
|
-
}): Promise<`0x${string}`>;
|
|
1736
|
-
/** Add to or remove from the pool's TAKERS — who may swap only — in one call (the authority). Stamps the block. */
|
|
1737
|
-
export declare function fPoolSetTakers(c: LogswapClient, a: {
|
|
1738
|
-
poolId: Hex;
|
|
1025
|
+
export declare function fPolicySetRights(c: LogswapClient, a: {
|
|
1026
|
+
policy: Address;
|
|
1739
1027
|
who: readonly Address[];
|
|
1740
|
-
|
|
1028
|
+
right: FPolicyRight;
|
|
1741
1029
|
account: Address;
|
|
1742
|
-
policy?: Address;
|
|
1743
1030
|
}): Promise<`0x${string}`>;
|
|
1744
|
-
/**
|
|
1745
|
-
export declare function
|
|
1746
|
-
/**
|
|
1747
|
-
export declare function fPoolIsTaker(c: LogswapClient, poolId: Hex, who: Address, policy?: Address): Promise<boolean>;
|
|
1748
|
-
/** May swap: a minter or a taker (consulted only while the swap gate is on). */
|
|
1749
|
-
export declare function fPoolIsAllowed(c: LogswapClient, poolId: Hex, who: Address, policy?: Address): Promise<boolean>;
|
|
1750
|
-
/** Label the pool — the authority's own words on the pool's POLICY, mutable, never identity. At most 31 bytes of UTF-8. */
|
|
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. */
|
|
1751
1034
|
export declare function fPoolSetName(c: LogswapClient, a: {
|
|
1752
1035
|
poolId: Hex;
|
|
1753
1036
|
name: string;
|
|
@@ -1768,19 +1051,8 @@ export declare function fPoolSetSponsorName(c: LogswapClient, a: {
|
|
|
1768
1051
|
export declare function fPoolSponsorName(c: LogswapClient, who: Address): Promise<string>;
|
|
1769
1052
|
/** The registry the manager asks at every birth — `addresses.policyRegistry`, else the manager's word; zero on a bare deployment. */
|
|
1770
1053
|
export declare function fPoolRegistryOf(c: LogswapClient): Promise<Address>;
|
|
1771
|
-
/** Who
|
|
1772
|
-
export declare function fPoolRunners(s: Pick<FPoolRoles, "
|
|
1773
|
-
/**
|
|
1774
|
-
* Grant, replace or revoke the pool operator (the authority, on the desk's policy; decision 073): one optional delegate who may
|
|
1775
|
-
* `harvest`, `retire`, `regenerate` and `setLegs` besides the authority. Immediate, with no acceptance step, so check the
|
|
1776
|
-
* address; the zero address revokes. A handover or a policy move clears it.
|
|
1777
|
-
*/
|
|
1778
|
-
export declare function fPoolSetPoolOperator(c: LogswapClient, a: {
|
|
1779
|
-
poolId: Hex;
|
|
1780
|
-
operator: Address;
|
|
1781
|
-
account: Address;
|
|
1782
|
-
policy?: Address;
|
|
1783
|
-
}): Promise<`0x${string}`>;
|
|
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[];
|
|
1784
1056
|
/**
|
|
1785
1057
|
* Move shares (ERC-6909 `transfer`) — to another holder, or to `0xdead` to lock them for good.
|
|
1786
1058
|
* Burning to the dead address is a sponsor's way to make its liquidity permanent: the shares can
|
|
@@ -1799,16 +1071,19 @@ export interface DiscoveredFPool {
|
|
|
1799
1071
|
bases: Address[];
|
|
1800
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. */
|
|
1801
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]`. */
|
|
1802
1077
|
swapFee: bigint;
|
|
1803
|
-
/** The
|
|
1078
|
+
/** The mint fee, WAD: the list's next entry ({@link fMintFeeOf}). */
|
|
1804
1079
|
mintFee: bigint;
|
|
1805
1080
|
/** The generation-0 cap as ln(cap price / seed price), in 1e-6 log units; 0 uncapped, cap ∞ (decisions 061); 0 until deployed. */
|
|
1806
1081
|
lnCapOverSeed: number;
|
|
1807
1082
|
kind: FPoolKind;
|
|
1808
|
-
/** The pool's policy
|
|
1083
|
+
/** The pool's policy for life — the contract the key names. */
|
|
1809
1084
|
policy: Address;
|
|
1810
|
-
/**
|
|
1811
|
-
|
|
1085
|
+
/** The key's salt: zero under an open policy. */
|
|
1086
|
+
salt: Hex;
|
|
1812
1087
|
/** The block the pool was initialized in — its age, for annualising realized income. */
|
|
1813
1088
|
block: bigint;
|
|
1814
1089
|
/** Whether `deployLiquidity` has run; an unfunded pool has no floor and no float, so nothing to show. */
|
|
@@ -1824,84 +1099,27 @@ export interface DiscoveredFPool {
|
|
|
1824
1099
|
shape: FPoolShape;
|
|
1825
1100
|
}
|
|
1826
1101
|
/**
|
|
1827
|
-
* Every F pool ever created, from `PoolCreated` logs alone — plus
|
|
1828
|
-
*
|
|
1829
|
-
*
|
|
1830
|
-
*
|
|
1831
|
-
* 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.
|
|
1832
1106
|
*/
|
|
1833
1107
|
export declare function discoverFPools(c: LogswapClient, opts?: {
|
|
1834
1108
|
fromBlock?: bigint;
|
|
1835
1109
|
toBlock?: bigint;
|
|
1836
1110
|
indexer?: string;
|
|
1837
1111
|
}): Promise<DiscoveredFPool[]>;
|
|
1838
|
-
/** A pool an
|
|
1112
|
+
/** A pool an account runs or sponsors, with what the policy page shows of it. */
|
|
1839
1113
|
export interface FPoolControlled {
|
|
1840
1114
|
pool: DiscoveredFPool;
|
|
1841
1115
|
roles: FPoolRoles;
|
|
1842
1116
|
state: FPoolState;
|
|
1843
|
-
/** The policy's
|
|
1844
|
-
|
|
1845
|
-
}
|
|
1846
|
-
/** What a pool's policy says about it, by kind: the terms a buyer reads before entering. */
|
|
1847
|
-
export type FPoolRules = {
|
|
1848
|
-
kind: "pad";
|
|
1849
|
-
/** The pad's graduation count: the pool's generation (F version 21 — `PadPolicy.rung` is gone). */
|
|
1850
|
-
gen: number;
|
|
1851
|
-
/** @deprecated Equal to {@link gen} since F version 21, kept for callers; read `gen`. */
|
|
1852
|
-
rung: number;
|
|
1853
|
-
/** The income the next graduation needs, in the pad's quote: `PadPolicy.threshold(poolId, gen)` (T(0) is per quote, decision 070). */
|
|
1854
|
-
threshold: bigint;
|
|
1855
|
-
/** The dead shares' income held for the next graduation, in the pad's quote. */
|
|
1856
|
-
income: bigint;
|
|
1857
|
-
/** 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). */
|
|
1858
|
-
creatorShare: bigint;
|
|
1859
|
-
/** The income tax the dead shares pay on their own new income dividend (decisions 073, 085), WAD. */
|
|
1860
|
-
incomeTaxRate: bigint;
|
|
1861
|
-
/** The ranges the LOG Authority set on the policy NOW for the pads born after this read: what a new creator may choose. */
|
|
1862
|
-
ranges: PadRanges;
|
|
1863
|
-
} | {
|
|
1864
|
-
kind: "pol"; /** The reserve a harvest leaves in the bid and a redeployment must keep, a multiple of L (WAD). */
|
|
1865
|
-
minQuoteRatio: bigint; /** The income tax the pool's authority pays on its own new income dividend (decisions 073, 085), WAD. */
|
|
1866
|
-
incomeTaxRate: bigint;
|
|
1867
|
-
} | {
|
|
1868
|
-
kind: "public";
|
|
1869
|
-
} | {
|
|
1870
|
-
kind: "private";
|
|
1871
|
-
gateMint: boolean;
|
|
1872
|
-
swapMode: FPoolSwapMode;
|
|
1873
|
-
swapExecutor: Address;
|
|
1874
|
-
operator: Address;
|
|
1875
|
-
};
|
|
1876
|
-
/** The LOG Authority's range on a pad's creator choice (`PadPolicy`, decisions 056, 067), WAD fractions of the income released. */
|
|
1877
|
-
export interface PadRanges {
|
|
1878
|
-
creatorShareMin: bigint;
|
|
1879
|
-
/** At most the F manager's `PAYEE_CUT_MAX` (50%), which bounds a pad's payee whatever the policy (067). */
|
|
1880
|
-
creatorShareMax: bigint;
|
|
1117
|
+
/** The policy's immutables: the terms a holder reads before entering. */
|
|
1118
|
+
terms: FPolicyTerms;
|
|
1881
1119
|
}
|
|
1882
1120
|
/**
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
1885
|
-
* 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
|
|
1886
|
-
* chosen at launch (`FPoolLaunchArgs.salt`) and never changes; the policy refuses a cut outside its range.
|
|
1887
|
-
*/
|
|
1888
|
-
export declare function padSalt(s: {
|
|
1889
|
-
creatorShare: bigint;
|
|
1890
|
-
nonce?: bigint; /** @deprecated F version 28 has no burn (067): only 0 is accepted. */
|
|
1891
|
-
burnShare?: bigint;
|
|
1892
|
-
}): Hex;
|
|
1893
|
-
/** The inverse of {@link padSalt}. `burnShare` is the old field's bits, nonzero only on a salt the F version 28 policy refuses. */
|
|
1894
|
-
export declare function padSplitOfSalt(salt: Hex): {
|
|
1895
|
-
creatorShare: bigint;
|
|
1896
|
-
burnShare: bigint;
|
|
1897
|
-
nonce: bigint;
|
|
1898
|
-
};
|
|
1899
|
-
/** The policy's terms for one pool, by its kind. */
|
|
1900
|
-
export declare function getFPoolRules(c: LogswapClient, s: Pick<FPoolState, "poolId" | "policy" | "kind" | "gen">, roles?: FPoolRoles): Promise<FPoolRules>;
|
|
1901
|
-
/**
|
|
1902
|
-
* Every F pool `who` is the AUTHORITY of, across the four policies — the policy page's list. Pools
|
|
1903
|
-
* `who` created and handed over are not here (the buyer's page shows them); pools handed TO
|
|
1904
|
-
* `who` are. `pools` may be passed (from the 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.
|
|
1905
1123
|
*/
|
|
1906
1124
|
export declare function fPoolsControlledBy(c: LogswapClient, who: Address, opts?: {
|
|
1907
1125
|
pools?: DiscoveredFPool[];
|
|
@@ -1922,18 +1140,7 @@ export declare function fPoolShareHolders(c: LogswapClient, poolIdHex: Hex, opts
|
|
|
1922
1140
|
holder: Address;
|
|
1923
1141
|
shares: bigint;
|
|
1924
1142
|
}>>;
|
|
1925
|
-
/**
|
|
1926
|
-
* What a policy answers `onRegenerate` with: `IFPolicy.Terms` — four words, exactly 128 bytes since F version 28 (decision 067
|
|
1927
|
-
* removed `burn`). `carried` is the holder the next generation carries beside the dead shares; on a pad the manager requires
|
|
1928
|
-
* `0xdead` and caps `toPayee` at `PAYEE_CUT_MAX` of the income.
|
|
1929
|
-
*/
|
|
1930
|
-
export interface FPolicyTerms {
|
|
1931
|
-
payee: Address;
|
|
1932
|
-
toPayee: bigint;
|
|
1933
|
-
protocolCut: bigint;
|
|
1934
|
-
carried: Address;
|
|
1935
|
-
}
|
|
1936
|
-
/** Every F pool's raw state in one lens call (the manager's `Pool` struct: quote, swapFee, policy, seeded, gen, n, restructureTime, asks, lnCapOverSeed, Q, realizedVariance, L, shares, refLogFloor). */
|
|
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). */
|
|
1937
1144
|
export declare function getFPoolsRaw(c: LogswapClient, poolIds: Hex[]): Promise<readonly unknown[]>;
|
|
1938
1145
|
/** Share value from the lens — (L + Q)/shares, WAD per share — the same figure as `fPoolShareValue`, from one source. */
|
|
1939
1146
|
export declare function shareValueOnChain(c: LogswapClient, poolId: Hex): Promise<bigint>;
|