@logswap/sdk 0.5.88 → 0.5.90

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  TypeScript SDK for [Logswap](https://logswap.org), the liquidity
4
4
  primitive introducing the **logarithmic invariant** — typed wrappers over the `CPoolManager` /
5
- `FPoolManager` / `LogswapRouter` / `LogswapLens` surface.
5
+ `FPoolManager` / `Router` / `Lens` surface.
6
6
 
7
7
  **Status: identity, reads and writes for both singletons.** Indexer next.
8
8
 
@@ -16,7 +16,7 @@ wrong is silent:
16
16
  | `src/keys.ts` | `PoolKey` and `poolId = keccak256(abi.encode(key))` — market identity |
17
17
  | `src/ids.ts` | the ERC-6909 id namespace: position-class ids, token-claim ids, floor/cap packing |
18
18
  | `src/client.ts` | the handle, plus `assertVersion` — refuse a deployment the ABI was not built for |
19
- | `src/pools.ts` | market discovery from `MarketCreated` logs, pool state, `lpEdge` = F − Σ/2 |
19
+ | `src/pools.ts` | market discovery from the C manager's `PoolCreated` logs, pool state, `lpEdge` = `feeGrowth` − Σ/2 |
20
20
  | `src/positions.ts` | classes, balances, claimable fees, the bit-255 position/claim split |
21
21
  | `src/swap.ts` | exact-in/out, multi-hop, and exact quotes via the revert-quoter |
22
22
  | `src/liquidity.ts` | mint, blended mint, zap, update, move, **harvest**, burn |
@@ -44,6 +44,28 @@ Both are computed **offline** — no RPC, no deployment needed to address a mark
44
44
  floor price (was `theta`), `refLogFloor` θ₀ — the reference floor income counts from (was
45
45
  `theta0`), `cap` (d in 1e-6 log units, 0 uncapped), and per leg `virtualReserves` and `kappa`.
46
46
 
47
+ ## C 13 (decisions 088–090): a C market is addressed by its pool id
48
+
49
+ The consumer API still takes a `PoolKey`; the SDK hashes it (`poolId(key)`) and calls the contracts with the id.
50
+ What changes for a consumer:
51
+
52
+ - **Names.** `PoolState.x` is `logPrice`, `PoolState.F` is `feeGrowth` (`lpEdge`, `feesQuote`, `edgeQuote`, `priceOf`,
53
+ `floorDistance` follow). `DiscoveredMarket.x0` and `createMarket` / `initializeMarket`'s `x0` are `initialLogPrice`.
54
+ `FPoolState.weights` is `liquidityWeights` (each base asset's derived fraction of `L`; the sponsor's `weights`
55
+ inputs to `fPoolBook` keep their name).
56
+ - **Events and discovery.** The C manager's `MarketCreated` is `PoolCreated`, in the F manager's field order
57
+ (`poolId, quote, creator, base, swapFee, policy, mintFee, tickSpacing, initialLogPrice, swapFeeTax`). `base` is no
58
+ longer an indexed topic, so `discoverMarkets({ base })` filters it client-side. Both managers emit `PoolCreated`, so an
59
+ indexer table is prefixed by its contract (`allCPoolManagerPoolCreateds`, `allFPoolManagerPoolCreateds`).
60
+ - **Router.** The named entries pass the tokens the caller expects (`WrongToken` on a mismatch); `execute` batches
61
+ carry the pool id in each action. `LogswapRouter` is `Router` and `LogswapLens` is `Lens` (the ABI exports are `routerAbi` / `lensAbi`;
62
+ the `logswap*` names stay as deprecated aliases for one minor). The router runs the trade path inline (swap, mint, zap-in, quote);
63
+ the management of an existing position (burn, claim, update, move, createMarket, F zap-out and roll-in) is `LiquidityFacet`, reached
64
+ by `fallback` at the same router address, so `routerAbi` is the merge and Permit2 still has one spender. `facetC()` is
65
+ `liquidityFacet()`; the `encode*` helpers left the contract for the ABI-only `routerActionsAbi`. Prefer the managers directly when
66
+ you need no recipient, deadline or Permit2 (decision 091).
67
+ - **Layout.** F `getPool` has `swapFee` / `mintFee` as `uint56`; the `extsload` words are in the contracts' `FPoolState`.
68
+
47
69
  ## Who may create what: the gate, the menus (C version 7, F version 26)
48
70
 
49
71
  Since logswap-contract #60 (decisions 064–065) creation is curated at launch, on both managers:
package/dist/actions.d.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import { type Address, type Hash, type Hex } from "viem";
21
21
  import type { LogswapClient } from "./client.js";
22
- import type { PoolKey } from "./keys.js";
22
+ import { type PoolKey } from "./keys.js";
23
23
  import type { Hop } from "./swap.js";
24
24
  import { type WriteOptions } from "./write.js";
25
25
  /** "The router's open delta of that token" — the swap-amount sentinel. `type(uint256).max`. */
package/dist/actions.js CHANGED
@@ -18,7 +18,8 @@
18
18
  * hand-written and a struct change is a `tsc`/vector failure, not a runtime surprise.
19
19
  */
20
20
  import { encodeAbiParameters } from "viem";
21
- import { logswapRouterAbi } from "./generated.js";
21
+ import { routerAbi, routerActionsAbi } from "./generated.js";
22
+ import { poolId as keyId } from "./keys.js";
22
23
  import { NO_CAP } from "./ids.js";
23
24
  import { resolveDeadline, resolveRecipient, sendRouterWriteWithPermits, simulateRouterWrite } from "./write.js";
24
25
  /** "The router's open delta of that token" — the swap-amount sentinel. `type(uint256).max`. */
@@ -38,43 +39,43 @@ export var Op;
38
39
  })(Op || (Op = {}));
39
40
  /* payload encoding ========================================================== */
40
41
  function payloadType(encoder) {
41
- const f = logswapRouterAbi.find((x) => x.type === "function" && x.name === encoder);
42
+ const f = routerActionsAbi.find((x) => x.type === "function" && x.name === encoder);
42
43
  if (!f?.inputs)
43
- throw new Error(`logswap: the router ABI has no ${encoder} — SDK and contracts disagree`);
44
+ throw new Error(`logswap: RouterActions has no ${encoder} — SDK and contracts disagree`);
44
45
  return f.inputs;
45
46
  }
46
47
  const enc = (encoder, value) => encodeAbiParameters(payloadType(encoder), [value]);
47
48
  /** Mint exposure `L` at `targetFloor` (off-grid blends the two adjacent rungs), `cap` optional. */
48
49
  export function mintAction(a) {
49
- return { op: Op.MintBlended, data: enc("encodeMint", { key: a.key, targetFloor: a.targetFloor, cap: a.cap ?? NO_CAP, L: a.L }) };
50
+ return { op: Op.MintBlended, data: enc("encodeMint", { poolId: keyId(a.key), targetFloor: a.targetFloor, cap: a.cap ?? NO_CAP, L: a.L }) };
50
51
  }
51
52
  /** Burn `shares[i]` of `ids[i]`; accrued fees are swept into the same batch. Needs the operator grant. */
52
53
  export function burnAction(a) {
53
54
  if (a.ids.length !== a.shares.length)
54
55
  throw new Error("logswap: ids and shares length mismatch");
55
- return { op: Op.Burn, data: enc("encodeBurn", { key: a.key, ids: a.ids, shares: a.shares }) };
56
+ return { op: Op.Burn, data: enc("encodeBurn", { poolId: keyId(a.key), ids: a.ids, shares: a.shares }) };
56
57
  }
57
58
  /** Exact-in swap. `amountIn` may be `OPEN_DELTA`: the input an earlier action left the router holding. */
58
59
  export function swapExactInAction(a) {
59
- return { op: Op.SwapExactIn, data: enc("encodeSwap", { key: a.key, baseSide: a.baseIn, amount: a.amountIn, limit: a.minOut ?? 0n }) };
60
+ return { op: Op.SwapExactIn, data: enc("encodeSwap", { poolId: keyId(a.key), baseSide: a.baseIn, amount: a.amountIn, limit: a.minOut ?? 0n }) };
60
61
  }
61
62
  /** Exact-out swap. `amountOut` may be `OPEN_DELTA`: the output an earlier action left the router owing. */
62
63
  export function swapExactOutAction(a) {
63
64
  return {
64
65
  op: Op.SwapExactOut,
65
- data: enc("encodeSwap", { key: a.key, baseSide: a.baseOut, amount: a.amountOut, limit: a.maxIn ?? UNBOUNDED }),
66
+ data: enc("encodeSwap", { poolId: keyId(a.key), baseSide: a.baseOut, amount: a.amountOut, limit: a.maxIn ?? UNBOUNDED }),
66
67
  };
67
68
  }
68
69
  /** Collect the caller's fees on `ids`; positions untouched. */
69
70
  export function claimAction(a) {
70
- return { op: Op.Claim, data: enc("encodeClaim", { key: a.key, ids: a.ids }) };
71
+ return { op: Op.Claim, data: enc("encodeClaim", { poolId: keyId(a.key), ids: a.ids }) };
71
72
  }
72
73
  /** The general edit — set `shares` of `fromId` to (`toFloor`, `toCap`, `newL`); `newL = 0` exits. */
73
74
  export function updateAction(a) {
74
75
  return {
75
76
  op: Op.Update,
76
77
  data: enc("encodeUpdate", {
77
- key: a.key,
78
+ poolId: keyId(a.key),
78
79
  fromId: a.fromId,
79
80
  shares: a.shares,
80
81
  toFloor: a.toFloor,
@@ -87,7 +88,7 @@ export function updateAction(a) {
87
88
  export function pathAction(a) {
88
89
  if (a.hops.length === 0)
89
90
  throw new Error("logswap: empty path");
90
- return { op: Op.Path, data: enc("encodePath", { hops: a.hops, amountIn: a.amountIn, minOut: a.minOut ?? 0n }) };
91
+ return { op: Op.Path, data: enc("encodePath", { hops: a.hops.map((h) => ({ poolId: keyId(h.key), baseIn: h.baseIn })), amountIn: a.amountIn, minOut: a.minOut ?? 0n }) };
91
92
  }
92
93
  /* settlement builders ======================================================= */
93
94
  /** A settlement over explicit tokens; missing bounds default to unbounded in, zero out. */
@@ -125,13 +126,13 @@ export function settleOnly(key, recipient, side, b = {}) {
125
126
  export async function execute(c, a) {
126
127
  const settle = { ...a.settle, recipient: a.settle.recipient ?? resolveRecipient(c, a) };
127
128
  const pull = a.pullTokens ?? settle.tokens.filter((_, i) => settle.maxIn[i] > 0n);
128
- return sendRouterWriteWithPermits(c, { abi: logswapRouterAbi, functionName: "execute", args: [a.actions, settle, resolveDeadline(a)] }, [...pull]);
129
+ return sendRouterWriteWithPermits(c, { abi: routerAbi, functionName: "execute", args: [a.actions, settle, resolveDeadline(a)] }, [...pull]);
129
130
  }
130
131
  /** Simulate a batch: the per-action returns and the signed flows (+ = paid in), without sending. */
131
132
  export async function simulateExecute(c, a) {
132
133
  const settle = { ...a.settle, recipient: a.settle.recipient ?? a.account ?? resolveRecipient(c, a) };
133
134
  const [results, flows] = await simulateRouterWrite(c, {
134
- abi: logswapRouterAbi,
135
+ abi: routerAbi,
135
136
  functionName: "execute",
136
137
  args: [a.actions, settle, resolveDeadline(a)],
137
138
  account: a.account,
package/dist/claims.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import type { Address, Hash } from "viem";
9
9
  import type { LogswapClient } from "./client.js";
10
- import type { PoolKey } from "./keys.js";
10
+ import { type PoolKey } from "./keys.js";
11
11
  import { type WriteOptions } from "./write.js";
12
12
  export interface ClaimFeesArgs extends WriteOptions {
13
13
  key: PoolKey;
package/dist/claims.js CHANGED
@@ -5,7 +5,8 @@
5
5
  * - a FEE claim — `claimFees`, withdrawing accrued quote while the position stays whole
6
6
  * - a TOKEN claim — a bearer IOU (bit-255-clear id) for inventory parked inside the manager
7
7
  */
8
- import { cPoolManagerAbi, logswapRouterAbi } from "./generated.js";
8
+ import { cPoolManagerAbi, routerAbi } from "./generated.js";
9
+ import { poolId as keyId } from "./keys.js";
9
10
  import { isPosition } from "./ids.js";
10
11
  import { requireWallet, resolveDeadline, resolveRecipient, sendRouterWrite } from "./write.js";
11
12
  /**
@@ -24,9 +25,9 @@ export async function claimFees(c, a) {
24
25
  }
25
26
  }
26
27
  return sendRouterWrite(c, {
27
- abi: logswapRouterAbi,
28
+ abi: routerAbi,
28
29
  functionName: "claim",
29
- args: [a.key, a.ids, resolveRecipient(c, a), resolveDeadline(a)],
30
+ args: [keyId(a.key), a.key.quote, a.ids, resolveRecipient(c, a), resolveDeadline(a)],
30
31
  });
31
32
  }
32
33
  /**
package/dist/client.d.ts CHANGED
@@ -119,7 +119,7 @@ export declare function clientChainId(c: LogswapClient): Promise<number>;
119
119
  * takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
120
120
  * `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
121
121
  */
122
- export declare const EXPECTED_VERSION = 12n;
122
+ export declare const EXPECTED_VERSION = 13n;
123
123
  /**
124
124
  * The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
125
125
  * 4 was the income-only harvest cut).
package/dist/client.js CHANGED
@@ -117,7 +117,11 @@ function guardChain(wallet, pub) {
117
117
  // takes no separate mint fee, `createMarket` neither; `getPool` drops `mintFee` and the gates' mint-fee menus are gone.
118
118
  // Every C pool id moved.
119
119
  // 12 (decisions 079-081): `Action` ordinals, the key is `CPoolKey` (names only). No pool id moved.
120
- export const EXPECTED_VERSION = 12n;
120
+ // 13 (decisions 088-090): a C pool is addressed by its `bytes32 poolId` after `initialize` (the key rides in calldata at `initialize`
121
+ // only; no pool id moved), the router's named entries take the tokens the caller expects (`WrongToken`), `claimById` / `burnById` /
122
+ // `claimManyFor` are `claim` / `burn` / `claimMany`, `mint(poolId, to, floor, cap, L)`, `MarketCreated` is `PoolCreated` (in F's field
123
+ // order), `x0` is `initialLogPrice`, `PoolView.x` / `.F` are `logPrice` / `feeGrowth`, `swapFee` / `mintFee` are `uint56`.
124
+ export const EXPECTED_VERSION = 13n;
121
125
  /**
122
126
  * The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
123
127
  * 4 was the income-only harvest cut).
@@ -216,7 +220,7 @@ export const EXPECTED_VERSION = 12n;
216
220
  // id moved); `initialize(key)`; `seed` / `retire` / `setLegs` are gone for `deployLiquidity(poolId, baseAssets,
217
221
  // quoteAmount, lnCapOverSeed, to)` (it SETS THE BOOK on an unfunded or a live pool), `close(poolId, to)` and
218
222
  // `regenerate(poolId, to)`; asset membership is fixed by the key; `LiquidityDeployed` echoes the input,
219
- // `GenerationSeeded` / `LegsSet` are gone; the lens `fPool` field is `baseLegs`, the cap `lnCapOverSeed`; the pot and the
223
+ // `GenerationSeeded` / `LegsSet` are gone; the lens `fPool` field is `baseAssets` (`baseLegs` before decision 090), the cap `lnCapOverSeed`; the pot and the
220
224
  // income fee are the income and the income tax (`IncomeReleased`, `incomeHeld`, `incomeTax`); a pad is uncapped.
221
225
  // 39 (decision 087): `swapFeeB4B` is gone; base-for-base pays `swapFee` once, not 2·swapFee.
222
226
  // A breaking bump: raised in the same change.
@@ -251,17 +255,17 @@ export async function assertVersion(c, expected = EXPECTED_VERSION) {
251
255
  * reverts because the router's Permit2 is not the one the user approved.
252
256
  */
253
257
  export async function assertWiring(c) {
254
- const { logswapRouterAbi, logswapLensAbi } = await import("./generated.js");
258
+ const { routerAbi, lensAbi } = await import("./generated.js");
255
259
  const rd = (address, abi, functionName) => c.public.readContract({ address, abi, functionName });
256
260
  const ZERO = "0x0000000000000000000000000000000000000000";
257
261
  const want = [
258
- ["router.mgr()", rd(c.addresses.router, logswapRouterAbi, "mgr"), c.addresses.cPoolManager],
259
- ["router.permit2()", rd(c.addresses.router, logswapRouterAbi, "permit2"), c.addresses.permit2 ?? ZERO],
260
- ["lens.mgr()", rd(c.addresses.lens, logswapLensAbi, "mgr"), c.addresses.cPoolManager],
262
+ ["router.mgr()", rd(c.addresses.router, routerAbi, "mgr"), c.addresses.cPoolManager],
263
+ ["router.permit2()", rd(c.addresses.router, routerAbi, "permit2"), c.addresses.permit2 ?? ZERO],
264
+ ["lens.mgr()", rd(c.addresses.lens, lensAbi, "mgr"), c.addresses.cPoolManager],
261
265
  ];
262
266
  if (c.addresses.fPoolManager) {
263
- want.push(["router.fmgr()", rd(c.addresses.router, logswapRouterAbi, "fmgr"), c.addresses.fPoolManager]);
264
- want.push(["lens.fmgr()", rd(c.addresses.lens, logswapLensAbi, "fmgr"), c.addresses.fPoolManager]);
267
+ want.push(["router.fmgr()", rd(c.addresses.router, routerAbi, "fmgr"), c.addresses.fPoolManager]);
268
+ want.push(["lens.fmgr()", rd(c.addresses.lens, lensAbi, "fmgr"), c.addresses.fPoolManager]);
265
269
  }
266
270
  const got = await Promise.all(want.map((w) => w[1]));
267
271
  const bad = want.flatMap(([what, , expected], i) => got[i].toLowerCase() === expected.toLowerCase() ? [] : [`${what} is ${got[i]}, expected ${expected}`]);
package/dist/fpool.d.ts CHANGED
@@ -827,8 +827,8 @@ export interface FPoolState {
827
827
  poolId: Hex;
828
828
  quote: Address;
829
829
  bases: Address[];
830
- /** WAD weights, summing to WAD. `L_j = w_j · L`. */
831
- weights: bigint[];
830
+ /** Each base asset's fraction of the pool's `L`, WAD, summing to WAD, derived at each deployment (`weights` before decision 090). `L_j = liquidityWeight_j · L`. */
831
+ liquidityWeights: bigint[];
832
832
  /** Per-asset log prices, WAD. Price is derived; `x` is the state. */
833
833
  x: bigint[];
834
834
  /** Quote reserve. The one leg a base→quote swap can exhaust. */
package/dist/fpool.js CHANGED
@@ -30,7 +30,7 @@
30
30
  * `addresses.router`.
31
31
  */
32
32
  import { decodeAbiParameters, encodeAbiParameters, encodeFunctionData, erc20Abi, keccak256, toFunctionSelector } from "viem";
33
- import { fPoolManagerAbi, logswapLensAbi, logswapRouterAbi, padPolicyAbi, polPolicyAbi, policyRegistryAbi, privatePolicyAbi, publicPolicyAbi } from "./generated.js";
33
+ import { fPoolManagerAbi, lensAbi, routerAbi, padPolicyAbi, polPolicyAbi, policyRegistryAbi, privatePolicyAbi, publicPolicyAbi } from "./generated.js";
34
34
  /**
35
35
  * One contract, one ABI (F version 12): `harvest`, `claim`, `retire`, `regenerate`,
36
36
  * `setLegs`, the names, the fee parameters are `FPoolManager`'s own code. The roles left it for
@@ -63,7 +63,7 @@ export const ASK_MINT = 2;
63
63
  async function rawFPool(c, poolId) {
64
64
  const [p] = await c.public.readContract({
65
65
  address: c.addresses.lens,
66
- abi: logswapLensAbi,
66
+ abi: lensAbi,
67
67
  functionName: "getFPools",
68
68
  args: [[poolId]],
69
69
  });
@@ -75,7 +75,7 @@ async function rawFPool(c, poolId) {
75
75
  export async function getFPool(c, poolId) {
76
76
  const v = await c.public.readContract({
77
77
  address: c.addresses.lens,
78
- abi: logswapLensAbi,
78
+ abi: lensAbi,
79
79
  functionName: "fPool",
80
80
  args: [poolId],
81
81
  });
@@ -91,9 +91,9 @@ export async function getFPool(c, poolId) {
91
91
  return {
92
92
  poolId,
93
93
  quote: p.quote,
94
- bases: v.baseLegs.map((l) => l.base),
95
- weights: v.baseLegs.map((l) => l.weight),
96
- x: v.baseLegs.map((l) => l.x), // derived by the manager: x_j = ln(w_j·L / R̃_j)
94
+ bases: v.baseAssets.map((l) => l.base),
95
+ liquidityWeights: v.baseAssets.map((l) => l.liquidityWeight),
96
+ x: v.baseAssets.map((l) => l.x), // derived by the manager: x_j = ln(w_j·L / R̃_j)
97
97
  Q: p.Q,
98
98
  L: p.L,
99
99
  swapFee: p.swapFee,
@@ -112,9 +112,9 @@ export async function getFPool(c, poolId) {
112
112
  seeded: p.seeded,
113
113
  gen: Number(p.gen),
114
114
  totalSupply: p.shares,
115
- reserves: v.baseLegs.map((l) => l.reserve), // the state
116
- virtualReserves: v.baseLegs.map((l) => l.virtualReserve),
117
- kappa: v.baseLegs.map((l) => l.kappa),
115
+ reserves: v.baseAssets.map((l) => l.reserve), // the state
116
+ virtualReserves: v.baseAssets.map((l) => l.virtualReserve),
117
+ kappa: v.baseAssets.map((l) => l.kappa),
118
118
  };
119
119
  }
120
120
  const F_KIND_NAMES = ["public", "private", "pol", "pad"];
@@ -211,7 +211,7 @@ export function fPoolShareValue(s) {
211
211
  for (let j = 0; j < s.reserves.length; j++) {
212
212
  const rv = s.virtualReserves[j];
213
213
  if (rv !== 0n)
214
- v += (((s.weights[j] * s.L) / WAD) * s.reserves[j]) / rv;
214
+ v += (((s.liquidityWeights[j] * s.L) / WAD) * s.reserves[j]) / rv;
215
215
  }
216
216
  }
217
217
  return (v * WAD) / s.totalSupply;
@@ -283,10 +283,10 @@ export function fPoolPreviewMintQuote(st, dL) {
283
283
  */
284
284
  export async function fPoolPreviewZapIn(c, poolId, dL) {
285
285
  // read-only lives on the LENS (the router's F flows moved to a facet; its previews came here)
286
- const { logswapLensAbi } = await import("./generated.js");
286
+ const { lensAbi } = await import("./generated.js");
287
287
  return c.public.readContract({
288
288
  address: c.addresses.lens,
289
- abi: logswapLensAbi,
289
+ abi: lensAbi,
290
290
  functionName: "previewZapIn",
291
291
  args: [poolId, dL],
292
292
  });
@@ -325,7 +325,7 @@ a) {
325
325
  export async function fPoolPreviewZapOut(c, a) {
326
326
  const { result } = await c.public.simulateContract({
327
327
  address: c.addresses.router,
328
- abi: logswapRouterAbi,
328
+ abi: routerAbi,
329
329
  functionName: "zapOut",
330
330
  args: [a.poolId, a.shares, a.tokenOut, 0n, a.account, defaultDeadline()],
331
331
  account: a.account,
@@ -354,10 +354,10 @@ export async function fPoolRollIn(c, a) {
354
354
  * seed.
355
355
  */
356
356
  export async function fPoolPreviewRollIn(c, poolId, gen, holder, shares) {
357
- const { logswapLensAbi } = await import("./generated.js");
357
+ const { lensAbi } = await import("./generated.js");
358
358
  const [dL, quoteShort, quoteExcess] = (await c.public.readContract({
359
359
  address: c.addresses.lens,
360
- abi: logswapLensAbi,
360
+ abi: lensAbi,
361
361
  functionName: "previewRollIn",
362
362
  args: [poolId, BigInt(gen), holder, shares],
363
363
  }));
@@ -393,7 +393,7 @@ export async function fPoolDividendOf(c, poolId, holder, gen) {
393
393
  const g = gen ?? (await fPoolGen(c, poolId));
394
394
  return c.public.readContract({
395
395
  address: c.addresses.lens,
396
- abi: logswapLensAbi,
396
+ abi: lensAbi,
397
397
  functionName: "fDividendOf",
398
398
  args: [poolId, BigInt(g), holder],
399
399
  });
@@ -407,7 +407,7 @@ export async function fPoolLienOf(c, poolId, owner, gen) {
407
407
  const g = gen ?? (await fPoolGen(c, poolId));
408
408
  const [locker, amount, owed] = await c.public.readContract({
409
409
  address: c.addresses.lens,
410
- abi: logswapLensAbi,
410
+ abi: lensAbi,
411
411
  functionName: "fLienOf",
412
412
  args: [fPoolShareId(poolId, g), owner],
413
413
  });
@@ -487,14 +487,14 @@ pullTokens = []) {
487
487
  const sigCalls = await permit2SigCalls(c, pullTokens).catch(fallBackUnlessRejected);
488
488
  if (sigCalls.length) {
489
489
  const { encodeFunctionData } = await import("viem");
490
- const inner = encodeFunctionData({ abi: logswapRouterAbi, functionName, args });
490
+ const inner = encodeFunctionData({ abi: routerAbi, functionName, args });
491
491
  fn = "multicall";
492
492
  sendArgs = [[...sigCalls, inner]];
493
493
  }
494
494
  }
495
495
  const { request } = await c.public.simulateContract({
496
496
  address: c.addresses.router,
497
- abi: logswapRouterAbi,
497
+ abi: routerAbi,
498
498
  functionName: fn,
499
499
  args: sendArgs,
500
500
  account: signerFor(c, account),
@@ -595,7 +595,7 @@ export async function fPoolShareBalance(c, poolId, owner, gen) {
595
595
  export async function fPoolBundleOf(c, poolId, gen) {
596
596
  const [supply, quote, base] = await c.public.readContract({
597
597
  address: c.addresses.lens,
598
- abi: logswapLensAbi,
598
+ abi: lensAbi,
599
599
  functionName: "fBundleOf",
600
600
  args: [poolId, BigInt(gen)],
601
601
  });
@@ -603,10 +603,10 @@ export async function fPoolBundleOf(c, poolId, gen) {
603
603
  }
604
604
  /** A holder's claims on a pool's retired generations — one row per generation still held. */
605
605
  export async function fPoolClaimsOf(c, poolId, owner) {
606
- const { logswapLensAbi } = await import("./generated.js");
606
+ const { lensAbi } = await import("./generated.js");
607
607
  const rows = (await c.public.readContract({
608
608
  address: c.addresses.lens,
609
- abi: logswapLensAbi,
609
+ abi: lensAbi,
610
610
  functionName: "fClaimsOf",
611
611
  args: [poolId, owner],
612
612
  }));
@@ -647,7 +647,7 @@ export async function fPoolQuoteSwap(c, a) {
647
647
  try {
648
648
  await c.public.simulateContract({
649
649
  address: c.addresses.router,
650
- abi: logswapRouterAbi,
650
+ abi: routerAbi,
651
651
  functionName: "quoteSwap",
652
652
  // the taker matters only on a gated pool: the connected account, or the zero address
653
653
  args: [a.poolId, a.kind, BigInt(a.j), BigInt(a.k ?? 0), a.amountIn, a.taker ?? c.wallet?.account?.address ?? ZERO_ADDRESS],
@@ -1506,11 +1506,11 @@ export async function fPoolShareHolders(c, poolIdHex, opts = {}) {
1506
1506
  }
1507
1507
  /** 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). */
1508
1508
  export async function getFPoolsRaw(c, poolIds) {
1509
- const { logswapLensAbi } = await import("./generated.js");
1510
- return (await c.public.readContract({ address: c.addresses.lens, abi: logswapLensAbi, functionName: "getFPools", args: [poolIds] }));
1509
+ const { lensAbi } = await import("./generated.js");
1510
+ return (await c.public.readContract({ address: c.addresses.lens, abi: lensAbi, functionName: "getFPools", args: [poolIds] }));
1511
1511
  }
1512
1512
  /** Share value from the lens — (L + Q)/shares, WAD per share — the same figure as `fPoolShareValue`, from one source. */
1513
1513
  export async function shareValueOnChain(c, poolId) {
1514
- const { logswapLensAbi } = await import("./generated.js");
1515
- return (await c.public.readContract({ address: c.addresses.lens, abi: logswapLensAbi, functionName: "shareValue", args: [poolId] }));
1514
+ const { lensAbi } = await import("./generated.js");
1515
+ return (await c.public.readContract({ address: c.addresses.lens, abi: lensAbi, functionName: "shareValue", args: [poolId] }));
1516
1516
  }