@logswap/sdk 0.5.65 → 0.5.66

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.
@@ -1741,26 +1741,6 @@ export declare const fPoolManagerAbi: readonly [{
1741
1741
  readonly type: "uint256";
1742
1742
  }];
1743
1743
  readonly stateMutability: "view";
1744
- }, {
1745
- readonly type: "function";
1746
- readonly inputs: readonly [];
1747
- readonly name: "FEE_MAX";
1748
- readonly outputs: readonly [{
1749
- readonly name: "";
1750
- readonly internalType: "uint256";
1751
- readonly type: "uint256";
1752
- }];
1753
- readonly stateMutability: "view";
1754
- }, {
1755
- readonly type: "function";
1756
- readonly inputs: readonly [];
1757
- readonly name: "FEE_MIN";
1758
- readonly outputs: readonly [{
1759
- readonly name: "";
1760
- readonly internalType: "uint256";
1761
- readonly type: "uint256";
1762
- }];
1763
- readonly stateMutability: "view";
1764
1744
  }, {
1765
1745
  readonly type: "function";
1766
1746
  readonly inputs: readonly [];
@@ -2162,63 +2142,6 @@ export declare const fPoolManagerAbi: readonly [{
2162
2142
  readonly name: "harvest";
2163
2143
  readonly outputs: readonly [];
2164
2144
  readonly stateMutability: "nonpayable";
2165
- }, {
2166
- readonly type: "function";
2167
- readonly inputs: readonly [{
2168
- readonly name: "poolId";
2169
- readonly internalType: "bytes32";
2170
- readonly type: "bytes32";
2171
- }];
2172
- readonly name: "harvestable";
2173
- readonly outputs: readonly [{
2174
- readonly name: "";
2175
- readonly internalType: "uint256";
2176
- readonly type: "uint256";
2177
- }];
2178
- readonly stateMutability: "view";
2179
- }, {
2180
- readonly type: "function";
2181
- readonly inputs: readonly [{
2182
- readonly name: "key";
2183
- readonly internalType: "struct FPoolKey";
2184
- readonly type: "tuple";
2185
- readonly components: readonly [{
2186
- readonly name: "quote";
2187
- readonly internalType: "address";
2188
- readonly type: "address";
2189
- }, {
2190
- readonly name: "bases";
2191
- readonly internalType: "address[]";
2192
- readonly type: "address[]";
2193
- }, {
2194
- readonly name: "weights";
2195
- readonly internalType: "uint256[]";
2196
- readonly type: "uint256[]";
2197
- }, {
2198
- readonly name: "phi";
2199
- readonly internalType: "uint256";
2200
- readonly type: "uint256";
2201
- }, {
2202
- readonly name: "policy";
2203
- readonly internalType: "address";
2204
- readonly type: "address";
2205
- }, {
2206
- readonly name: "creator";
2207
- readonly internalType: "address";
2208
- readonly type: "address";
2209
- }, {
2210
- readonly name: "salt";
2211
- readonly internalType: "bytes32";
2212
- readonly type: "bytes32";
2213
- }];
2214
- }];
2215
- readonly name: "idOf";
2216
- readonly outputs: readonly [{
2217
- readonly name: "";
2218
- readonly internalType: "bytes32";
2219
- readonly type: "bytes32";
2220
- }];
2221
- readonly stateMutability: "pure";
2222
2145
  }, {
2223
2146
  readonly type: "function";
2224
2147
  readonly inputs: readonly [{
@@ -2500,24 +2423,6 @@ export declare const fPoolManagerAbi: readonly [{
2500
2423
  readonly type: "address";
2501
2424
  }];
2502
2425
  readonly stateMutability: "view";
2503
- }, {
2504
- readonly type: "function";
2505
- readonly inputs: readonly [{
2506
- readonly name: "poolId";
2507
- readonly internalType: "bytes32";
2508
- readonly type: "bytes32";
2509
- }, {
2510
- readonly name: "j";
2511
- readonly internalType: "uint256";
2512
- readonly type: "uint256";
2513
- }];
2514
- readonly name: "reserveOf";
2515
- readonly outputs: readonly [{
2516
- readonly name: "";
2517
- readonly internalType: "uint256";
2518
- readonly type: "uint256";
2519
- }];
2520
- readonly stateMutability: "view";
2521
2426
  }, {
2522
2427
  readonly type: "function";
2523
2428
  readonly inputs: readonly [{
@@ -6681,6 +6586,10 @@ export declare const padPolicyAbi: readonly [{
6681
6586
  readonly name: "burn";
6682
6587
  readonly internalType: "uint256";
6683
6588
  readonly type: "uint256";
6589
+ }, {
6590
+ readonly name: "carried";
6591
+ readonly internalType: "address";
6592
+ readonly type: "address";
6684
6593
  }];
6685
6594
  }];
6686
6595
  readonly stateMutability: "nonpayable";
@@ -6746,20 +6655,6 @@ export declare const padPolicyAbi: readonly [{
6746
6655
  readonly type: "bool";
6747
6656
  }];
6748
6657
  readonly stateMutability: "view";
6749
- }, {
6750
- readonly type: "function";
6751
- readonly inputs: readonly [{
6752
- readonly name: "";
6753
- readonly internalType: "bytes32";
6754
- readonly type: "bytes32";
6755
- }];
6756
- readonly name: "rung";
6757
- readonly outputs: readonly [{
6758
- readonly name: "";
6759
- readonly internalType: "uint256";
6760
- readonly type: "uint256";
6761
- }];
6762
- readonly stateMutability: "view";
6763
6658
  }, {
6764
6659
  readonly type: "function";
6765
6660
  readonly inputs: readonly [{
@@ -6978,26 +6873,6 @@ export declare const padPolicyAbi: readonly [{
6978
6873
  readonly indexed: false;
6979
6874
  }];
6980
6875
  readonly name: "QuoteListed";
6981
- }, {
6982
- readonly type: "event";
6983
- readonly anonymous: false;
6984
- readonly inputs: readonly [{
6985
- readonly name: "poolId";
6986
- readonly internalType: "bytes32";
6987
- readonly type: "bytes32";
6988
- readonly indexed: true;
6989
- }, {
6990
- readonly name: "from";
6991
- readonly internalType: "address";
6992
- readonly type: "address";
6993
- readonly indexed: true;
6994
- }, {
6995
- readonly name: "rung";
6996
- readonly internalType: "uint256";
6997
- readonly type: "uint256";
6998
- readonly indexed: false;
6999
- }];
7000
- readonly name: "RungCarried";
7001
6876
  }, {
7002
6877
  readonly type: "event";
7003
6878
  readonly anonymous: false;
@@ -7449,6 +7324,10 @@ export declare const polPolicyAbi: readonly [{
7449
7324
  readonly name: "burn";
7450
7325
  readonly internalType: "uint256";
7451
7326
  readonly type: "uint256";
7327
+ }, {
7328
+ readonly name: "carried";
7329
+ readonly internalType: "address";
7330
+ readonly type: "address";
7452
7331
  }];
7453
7332
  }];
7454
7333
  readonly stateMutability: "nonpayable";
@@ -8581,6 +8460,10 @@ export declare const privatePolicyAbi: readonly [{
8581
8460
  readonly name: "burn";
8582
8461
  readonly internalType: "uint256";
8583
8462
  readonly type: "uint256";
8463
+ }, {
8464
+ readonly name: "carried";
8465
+ readonly internalType: "address";
8466
+ readonly type: "address";
8584
8467
  }];
8585
8468
  }];
8586
8469
  readonly stateMutability: "nonpayable";
@@ -9385,6 +9268,10 @@ export declare const publicPolicyAbi: readonly [{
9385
9268
  readonly name: "burn";
9386
9269
  readonly internalType: "uint256";
9387
9270
  readonly type: "uint256";
9271
+ }, {
9272
+ readonly name: "carried";
9273
+ readonly internalType: "address";
9274
+ readonly type: "address";
9388
9275
  }];
9389
9276
  }];
9390
9277
  readonly stateMutability: "nonpayable";
package/dist/generated.js CHANGED
@@ -1097,20 +1097,6 @@ export const fPoolManagerAbi = [
1097
1097
  outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
1098
1098
  stateMutability: 'view',
1099
1099
  },
1100
- {
1101
- type: 'function',
1102
- inputs: [],
1103
- name: 'FEE_MAX',
1104
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
1105
- stateMutability: 'view',
1106
- },
1107
- {
1108
- type: 'function',
1109
- inputs: [],
1110
- name: 'FEE_MIN',
1111
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
1112
- stateMutability: 'view',
1113
- },
1114
1100
  {
1115
1101
  type: 'function',
1116
1102
  inputs: [],
@@ -1327,35 +1313,6 @@ export const fPoolManagerAbi = [
1327
1313
  outputs: [],
1328
1314
  stateMutability: 'nonpayable',
1329
1315
  },
1330
- {
1331
- type: 'function',
1332
- inputs: [{ name: 'poolId', internalType: 'bytes32', type: 'bytes32' }],
1333
- name: 'harvestable',
1334
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
1335
- stateMutability: 'view',
1336
- },
1337
- {
1338
- type: 'function',
1339
- inputs: [
1340
- {
1341
- name: 'key',
1342
- internalType: 'struct FPoolKey',
1343
- type: 'tuple',
1344
- components: [
1345
- { name: 'quote', internalType: 'address', type: 'address' },
1346
- { name: 'bases', internalType: 'address[]', type: 'address[]' },
1347
- { name: 'weights', internalType: 'uint256[]', type: 'uint256[]' },
1348
- { name: 'phi', internalType: 'uint256', type: 'uint256' },
1349
- { name: 'policy', internalType: 'address', type: 'address' },
1350
- { name: 'creator', internalType: 'address', type: 'address' },
1351
- { name: 'salt', internalType: 'bytes32', type: 'bytes32' },
1352
- ],
1353
- },
1354
- ],
1355
- name: 'idOf',
1356
- outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
1357
- stateMutability: 'pure',
1358
- },
1359
1316
  {
1360
1317
  type: 'function',
1361
1318
  inputs: [
@@ -1513,16 +1470,6 @@ export const fPoolManagerAbi = [
1513
1470
  ],
1514
1471
  stateMutability: 'view',
1515
1472
  },
1516
- {
1517
- type: 'function',
1518
- inputs: [
1519
- { name: 'poolId', internalType: 'bytes32', type: 'bytes32' },
1520
- { name: 'j', internalType: 'uint256', type: 'uint256' },
1521
- ],
1522
- name: 'reserveOf',
1523
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
1524
- stateMutability: 'view',
1525
- },
1526
1473
  {
1527
1474
  type: 'function',
1528
1475
  inputs: [{ name: 'poolId', internalType: 'bytes32', type: 'bytes32' }],
@@ -3940,6 +3887,7 @@ export const padPolicyAbi = [
3940
3887
  { name: 'toPayee', internalType: 'uint256', type: 'uint256' },
3941
3888
  { name: 'protocolCut', internalType: 'uint256', type: 'uint256' },
3942
3889
  { name: 'burn', internalType: 'uint256', type: 'uint256' },
3890
+ { name: 'carried', internalType: 'address', type: 'address' },
3943
3891
  ],
3944
3892
  },
3945
3893
  ],
@@ -3983,13 +3931,6 @@ export const padPolicyAbi = [
3983
3931
  outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
3984
3932
  stateMutability: 'view',
3985
3933
  },
3986
- {
3987
- type: 'function',
3988
- inputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
3989
- name: 'rung',
3990
- outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
3991
- stateMutability: 'view',
3992
- },
3993
3934
  {
3994
3935
  type: 'function',
3995
3936
  inputs: [{ name: '_harvestCut', internalType: 'uint256', type: 'uint256' }],
@@ -4167,26 +4108,6 @@ export const padPolicyAbi = [
4167
4108
  ],
4168
4109
  name: 'QuoteListed',
4169
4110
  },
4170
- {
4171
- type: 'event',
4172
- anonymous: false,
4173
- inputs: [
4174
- {
4175
- name: 'poolId',
4176
- internalType: 'bytes32',
4177
- type: 'bytes32',
4178
- indexed: true,
4179
- },
4180
- { name: 'from', internalType: 'address', type: 'address', indexed: true },
4181
- {
4182
- name: 'rung',
4183
- internalType: 'uint256',
4184
- type: 'uint256',
4185
- indexed: false,
4186
- },
4187
- ],
4188
- name: 'RungCarried',
4189
- },
4190
4111
  {
4191
4112
  type: 'event',
4192
4113
  anonymous: false,
@@ -4457,6 +4378,7 @@ export const polPolicyAbi = [
4457
4378
  { name: 'toPayee', internalType: 'uint256', type: 'uint256' },
4458
4379
  { name: 'protocolCut', internalType: 'uint256', type: 'uint256' },
4459
4380
  { name: 'burn', internalType: 'uint256', type: 'uint256' },
4381
+ { name: 'carried', internalType: 'address', type: 'address' },
4460
4382
  ],
4461
4383
  },
4462
4384
  ],
@@ -5223,6 +5145,7 @@ export const privatePolicyAbi = [
5223
5145
  { name: 'toPayee', internalType: 'uint256', type: 'uint256' },
5224
5146
  { name: 'protocolCut', internalType: 'uint256', type: 'uint256' },
5225
5147
  { name: 'burn', internalType: 'uint256', type: 'uint256' },
5148
+ { name: 'carried', internalType: 'address', type: 'address' },
5226
5149
  ],
5227
5150
  },
5228
5151
  ],
@@ -5751,6 +5674,7 @@ export const publicPolicyAbi = [
5751
5674
  { name: 'toPayee', internalType: 'uint256', type: 'uint256' },
5752
5675
  { name: 'protocolCut', internalType: 'uint256', type: 'uint256' },
5753
5676
  { name: 'burn', internalType: 'uint256', type: 'uint256' },
5677
+ { name: 'carried', internalType: 'address', type: 'address' },
5754
5678
  ],
5755
5679
  },
5756
5680
  ],
package/dist/keys.d.ts CHANGED
@@ -11,6 +11,15 @@
11
11
  * if the two ever disagree, that test fails rather than the SDK silently addressing the wrong pool.
12
12
  */
13
13
  import { type Address, type Hex } from "viem";
14
+ /**
15
+ * The fee domain of the family, `FeeParams.FEE_MIN` / `FEE_MAX` (decisions 043): one bound for a
16
+ * C market's φ and an F pool's alike, WAD. 1 bp and 1%. The F manager no longer answers
17
+ * `FEE_MIN()` / `FEE_MAX()` (F version 21 cut the getters for bytecode); every F policy still
18
+ * checks φ against these at `onInitialize`, and the C side re-exposes them through the lens's
19
+ * `cParams()`. Constants here, so a create form bounds φ with no read.
20
+ */
21
+ export declare const FEE_MIN: bigint;
22
+ export declare const FEE_MAX: bigint;
14
23
  /**
15
24
  * The economic tuple that IS the market. Field order is load-bearing: it is the ABI encoding order,
16
25
  * so it must match `src/types/PoolKey.sol` exactly.
@@ -21,7 +30,7 @@ export interface PoolKey {
21
30
  /** Log-tick spacing, WAD. The LP-boundary ladder — position floors and caps. */
22
31
  tickSpacing: bigint;
23
32
  /**
24
- * The swap fee, WAD, fixed for the life of the market: `FEE_MIN` (1 bp) ≤ φ ≤ `FEE_MAX` (25%),
33
+ * The swap fee, WAD, fixed for the life of the market: {@link FEE_MIN} (1 bp) ≤ φ ≤ {@link FEE_MAX} (1%),
25
34
  * or `0n`, which selects `DEFAULT_FEE` (2 bp) at read time. Four fields since C version 4
26
35
  *: `kappa` and `alpha` left with the variance kernel, and `phiMin` — a floor with
27
36
  * nothing above it — became `phi`. Every pool id changed with the shape.
package/dist/keys.js CHANGED
@@ -11,6 +11,15 @@
11
11
  * if the two ever disagree, that test fails rather than the SDK silently addressing the wrong pool.
12
12
  */
13
13
  import { encodeAbiParameters, keccak256 } from "viem";
14
+ /**
15
+ * The fee domain of the family, `FeeParams.FEE_MIN` / `FEE_MAX` (decisions 043): one bound for a
16
+ * C market's φ and an F pool's alike, WAD. 1 bp and 1%. The F manager no longer answers
17
+ * `FEE_MIN()` / `FEE_MAX()` (F version 21 cut the getters for bytecode); every F policy still
18
+ * checks φ against these at `onInitialize`, and the C side re-exposes them through the lens's
19
+ * `cParams()`. Constants here, so a create form bounds φ with no read.
20
+ */
21
+ export const FEE_MIN = 10n ** 14n;
22
+ export const FEE_MAX = 10n ** 16n;
14
23
  const POOL_KEY_ABI = [
15
24
  {
16
25
  type: "tuple",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logswap/sdk",
3
- "version": "0.5.65",
3
+ "version": "0.5.66",
4
4
  "description": "TypeScript SDK for Logswap, the liquidity primitive introducing the logarithmic invariant — typed wrappers over the CPoolManager / FPoolManager / Router / Lens surface.",
5
5
  "license": "GPL-2.0-or-later",
6
6
  "type": "module",
package/src/admin.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  import type { Address, Hash } from "viem";
15
15
  import type { LogswapClient } from "./client.js";
16
16
  import { cPoolManagerAbi, fPoolManagerAbi, padPolicyAbi, polPolicyAbi, policyRegistryAbi, publicPolicyAbi } from "./generated.js";
17
- import { bytes32ToText, fPolicyBaseAbi, fPoolKindOfPolicy, textToBytes32, type FPoolKind } from "./fpool.js";
17
+ import { bytes32ToText, fPolicyBaseAbi, fPoolKeyOfPool, fPoolKindOfPolicy, textToBytes32, type FPoolKey, type FPoolKind } from "./fpool.js";
18
18
 
19
19
  function wallet(c: LogswapClient) {
20
20
  if (!c.wallet) throw new Error("a wallet client is required");
@@ -138,13 +138,36 @@ export async function setPolicyApproved(c: LogswapClient, policy: Address, appro
138
138
  }
139
139
 
140
140
  /**
141
- * Move a pool to another approved policy of the same kind: the registry
142
- * owner's alone, orchestrated on the registry — `migrate(manager, poolId, to)`. The new policy
143
- * takes the authority and the name from the old; the operator and the lists void; no swap lands
144
- * in the block.
141
+ * Move a pool to another approved policy of the same kind: the registry owner's alone,
142
+ * orchestrated on the registry — `migrate(manager, key, to)` since F version 20 (it took the
143
+ * pool's id before). The registry checks the key against the manager (`NoPool`), checks the
144
+ * manager is its own (`WrongManager`), and compares the two policies' tags recorded at approval
145
+ * ({@link registryKindOf}). The new policy is brought the creator (the key's), the authority and
146
+ * the name (read off the old policy defensively, the key's creator standing in when it cannot
147
+ * answer); the operator and the lists void; no swap lands in the block.
148
+ *
149
+ * Pass the pool's `key` when in hand. Given only `poolId`, the key is rebuilt from the pool's
150
+ * `FInitialize` log ({@link fPoolKeyOfPool}) with `salt` (zero by default) and checked against
151
+ * the id — the log does not carry the salt, so a salted pool needs it named.
152
+ */
153
+ export async function fPoolMigrate(
154
+ c: LogswapClient,
155
+ a: { to: Address } & ({ key: FPoolKey } | { poolId: `0x${string}`; salt?: `0x${string}`; fromBlock?: bigint }),
156
+ ): Promise<Hash> {
157
+ const key = "key" in a ? a.key : await fPoolKeyOfPool(c, a.poolId, { salt: a.salt, fromBlock: a.fromBlock });
158
+ return registryWrite(c, "migrate", [c.addresses.fPoolManager as Address, key, a.to]);
159
+ }
160
+
161
+ /**
162
+ * The kind tag the registry recorded for `policy` at approval (`kindOf`, F version 20) — refreshed
163
+ * on re-approval and kept after a revoke; what `migrate` compares, never the policy's live
164
+ * answer. "" for a policy the registry never approved (or a deployment with no registry).
145
165
  */
146
- export async function fPoolMigrate(c: LogswapClient, a: { poolId: `0x${string}`; to: Address }): Promise<Hash> {
147
- return registryWrite(c, "migrate", [c.addresses.fPoolManager as Address, a.poolId, a.to]);
166
+ export async function registryKindOf(c: LogswapClient, policy: Address): Promise<FPoolKind | ""> {
167
+ const registry = await policyRegistryOf(c);
168
+ if (registry === ZERO) return "";
169
+ const word = (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "kindOf", args: [policy] } as never)) as `0x${string}`;
170
+ return bytes32ToText(word) as FPoolKind | "";
148
171
  }
149
172
 
150
173
  // ─── the policies' numbers (the collector's; each bounded where it reaches the manager) ─────
@@ -154,7 +177,7 @@ export async function setHarvestCut(c: LogswapClient, policy: Address, rateWad:
154
177
  return write(c, policy, fPolicyBaseAbi, "setHarvestCut", [rateWad]);
155
178
  }
156
179
 
157
- /** `PadPolicy.setSchedule`: `T(0)`, the rung's growth, the creator's and the protocol's shares of the pot (≤ `POT_CUT_MAX`), the burn per rung (≤ `BURN_MAX`). */
180
+ /** `PadPolicy.setSchedule`: `T(0)`, the rung's growth, the creator's and the protocol's shares of the pot (≤ `POT_CUT_MAX`), the burn per rung (≤ `BURN_MAX`). The rung is the pool's generation since F version 21. */
158
181
  export async function padSetSchedule(
159
182
  c: LogswapClient,
160
183
  policy: Address,
package/src/client.ts CHANGED
@@ -165,7 +165,19 @@ export const EXPECTED_VERSION = 5n;
165
165
  // is the policy at birth, `migrate` moves a pool for the registry's owner; `stamp` / `setAsks` are
166
166
  // the policy's; the desk's `setAllowed` / `isAllowed` are `setMinters` / `setTakers` / `isMinter` /
167
167
  // `isTaker`; a pad and a POL hold one base (`OneBase`).
168
- export const EXPECTED_F_VERSION = 19n;
168
+ // 18–19: no role, no kind and no name on the manager (049); the events carry what a reader needs (050).
169
+ // 20 (2026-09-25, logswap-contract #53): policy isolation — `PolicyRegistry.migrate(manager, key, to)`
170
+ // takes the pool's KEY (was its id), `kindOf(policy)` is the tag recorded at approval, the
171
+ // registry emits `Migrated`; `IFPolicy.onMigrate` is brought the creator, authority and name;
172
+ // the desk's lists are keyed by `listEpoch`. The manager's ABI did not move.
173
+ // 21 (2026-09-26, #54): `regenerate` is the generation step — the policy's `Terms` name a
174
+ // `carried` holder (a fifth word, 160 B), every other holder is frozen out pro rata into
175
+ // generation g's bundle and redeems it (`fPoolRedeem` / `fPoolRollIn` with gen = g), and the
176
+ // pool goes on as g + 1. The manager lost `FEE_MIN` / `FEE_MAX` (see keys.ts), `harvestable`
177
+ // (the bid: `getPool().Q` when L > 0), `idOf(FPoolKey)` (hashed locally, `fPoolIdOfKey`) and
178
+ // `reserveOf` (`legOf`'s fourth word). `PadPolicy.rung` is gone: the pad's rung is `gen`, the
179
+ // next threshold `threshold(gen)`. A pad never retires; a public pool refuses `regenerate`.
180
+ export const EXPECTED_F_VERSION = 21n;
169
181
 
170
182
  export async function assertVersion(c: LogswapClient, expected = EXPECTED_VERSION): Promise<void> {
171
183
  const { cPoolManagerAbi, fPoolManagerAbi } = await import("./generated.js");