@logswap/sdk 0.5.89 → 0.5.91

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.
Files changed (59) hide show
  1. package/README.md +80 -13
  2. package/dist/actions.js +6 -5
  3. package/dist/admin.d.ts +213 -219
  4. package/dist/admin.js +118 -144
  5. package/dist/chains.d.ts +13 -4
  6. package/dist/chains.js +23 -9
  7. package/dist/claims.d.ts +1 -1
  8. package/dist/claims.js +11 -9
  9. package/dist/client.d.ts +43 -20
  10. package/dist/client.js +75 -26
  11. package/dist/fees.d.ts +1 -1
  12. package/dist/fees.js +5 -4
  13. package/dist/fpool.d.ts +170 -460
  14. package/dist/fpool.js +175 -218
  15. package/dist/generated.d.ts +5753 -6227
  16. package/dist/generated.js +3097 -3664
  17. package/dist/history.js +13 -11
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.js +5 -5
  20. package/dist/indexer.d.ts +2 -2
  21. package/dist/indexer.js +12 -9
  22. package/dist/keys.d.ts +15 -3
  23. package/dist/keys.js +5 -1
  24. package/dist/liquidity.d.ts +1 -1
  25. package/dist/liquidity.js +16 -9
  26. package/dist/onboard.d.ts +16 -11
  27. package/dist/onboard.js +27 -21
  28. package/dist/pools.d.ts +2 -0
  29. package/dist/pools.js +21 -13
  30. package/dist/positions.d.ts +1 -1
  31. package/dist/positions.js +18 -17
  32. package/dist/quote.d.ts +15 -0
  33. package/dist/quote.js +36 -0
  34. package/dist/swap.d.ts +7 -9
  35. package/dist/swap.js +40 -25
  36. package/dist/views.d.ts +1 -1
  37. package/dist/write.d.ts +7 -2
  38. package/dist/write.js +10 -7
  39. package/package.json +3 -3
  40. package/src/actions.ts +6 -5
  41. package/src/admin.ts +168 -171
  42. package/src/chains.ts +33 -13
  43. package/src/claims.ts +11 -10
  44. package/src/client.ts +101 -39
  45. package/src/fees.ts +6 -6
  46. package/src/fpool.ts +240 -272
  47. package/src/generated.ts +3110 -3671
  48. package/src/history.ts +11 -9
  49. package/src/index.ts +5 -5
  50. package/src/indexer.ts +13 -11
  51. package/src/keys.ts +19 -3
  52. package/src/liquidity.ts +16 -10
  53. package/src/onboard.ts +29 -21
  54. package/src/pools.ts +23 -15
  55. package/src/positions.ts +18 -18
  56. package/src/quote.ts +36 -0
  57. package/src/swap.ts +46 -25
  58. package/src/views.ts +1 -2
  59. package/src/write.ts +11 -10
package/dist/client.d.ts CHANGED
@@ -3,33 +3,45 @@
3
3
  *
4
4
  * Construct once and pass to every helper. `wallet` is optional: read helpers need only `public`.
5
5
  *
6
- * **Three addresses, permanently.** Not three per market — every market lives in the one manager,
7
- * and a market is an `initialize(key, x0)` call rather than a deployment. So this is a constant of
8
- * the protocol, not configuration that grows.
6
+ * **One stack per manager, permanently** (decision 096): a manager, its router and its lens, for F and for
7
+ * C. Not per market — every market lives in the one manager of its side, and a market is an
8
+ * `initialize` call rather than a deployment. F ships first, so the C stack is optional: a chain
9
+ * that has not opted into C carries `address(0)` for it, and every C call throws a plain error there.
9
10
  */
10
11
  import type { Address, PublicClient, WalletClient } from "viem";
11
12
  import { type LogswapDeployment } from "./chains.js";
13
+ /** The two singletons: `C` is the concentrated one (a floor per position, a tick ladder), `F` the fungible one. */
14
+ export type Side = "C" | "F";
12
15
  export interface LogswapAddresses {
13
- /** The C singleton — a floor per position, on a tick ladder. ERC-6909 positions and token
14
- * claims live here. */
15
- cPoolManager: Address;
16
- /** User entry for every market: multicall, blended mint, zap, routes, Permit2. */
17
- router: Address;
18
- /** Read-only: ladder derivations and revert-quoter previews. */
19
- lens: Address;
16
+ /** The F singleton — fungible claims, one shared floor, n bases. ERC-6909 shares and token claims live here. */
17
+ managerF: Address;
18
+ /** F's user entry: swaps, zaps, roll-in, Permit2. Its own Permit2 spender. */
19
+ routerF: Address;
20
+ /** F's read-only lens: pool views and previews. */
21
+ lensF: Address;
20
22
  /**
21
- * The F-pool singleton — fungible claims, one shared floor, n bases. Optional only because a
22
- * deployment predating it will not carry the address; every F-pool call needs it.
23
+ * The C singleton — a floor per position, on a tick ladder. ERC-6909 positions and token claims live here.
24
+ * The C stack is optional: F ships first, and a chain that has not opted into C carries none.
23
25
  */
24
- fPoolManager?: Address;
26
+ managerC?: Address;
27
+ /** C's user entry: the batch, the named one-action entries, `createMarket`, Permit2. Its own Permit2 spender. */
28
+ routerC?: Address;
29
+ /** C's read-only lens: ladder derivations and views. */
30
+ lensC?: Address;
25
31
  /**
26
- * The protocol's four F policies, one per kind: every F pool names one in its key,
27
- * and the pool's roles, gates and terms live on it. A deployment predating them carries none.
32
+ * The LOG's policies (decision 098: immutable, deployed by the LOG): every pool names one in its key, and the pool's
33
+ * roles, gates and terms live on it. `publicPolicy` and `privatePolicy` are the LOG's two sponsored instances on F
34
+ * (`SponsorPolicyF`, kind `"sponsor"`: the open canonical one, and the gated one that is born gated); the artifact keys
35
+ * predate 098 and are kept. A deployment predating the policies carries none.
28
36
  */
29
37
  publicPolicy?: Address;
30
38
  privatePolicy?: Address;
31
39
  polPolicy?: Address;
32
40
  padPolicy?: Address;
41
+ /** The LOG's open sponsored instance on C (`SponsorPolicyC`): the policy of a public market. Absent with no C stack. */
42
+ publicPolicyC?: Address;
43
+ /** F's orphan policy (`OrphanPolicyF`, kind `"orphan"`): the policy `PolicyRegistry.orphan` moves a pool to. */
44
+ orphanPolicy?: Address;
33
45
  /**
34
46
  * The policy registry: what a pool of each kind may be born under, and the
35
47
  * owner that may move a pool between policies. Read from the F manager (`registry()`) when
@@ -38,9 +50,19 @@ export interface LogswapAddresses {
38
50
  policyRegistry?: Address;
39
51
  /** The devnet's token factory (`TokenFactory`, a mock): where launchable tokens come from. Optional. */
40
52
  tokenFactory?: Address;
41
- /** Optional — the router falls back to plain approvals when absent. */
53
+ /** Optional — each router falls back to plain approvals when absent. */
42
54
  permit2?: Address;
43
55
  }
56
+ /** Whether the deployment carries the C stack. */
57
+ export declare function hasC(c: LogswapClient): boolean;
58
+ /** The C manager; throws where the deployment has none. */
59
+ export declare function managerC(c: LogswapClient): Address;
60
+ /** The C router; throws where the deployment has none. */
61
+ export declare function routerC(c: LogswapClient): Address;
62
+ /** The C lens; throws where the deployment has none. */
63
+ export declare function lensC(c: LogswapClient): Address;
64
+ /** The router of `side` — the contract that pulls the caller's tokens, and the spender to approve. */
65
+ export declare function routerOf(c: LogswapClient, side: Side): Address;
44
66
  export interface LogswapClient {
45
67
  public: PublicClient;
46
68
  wallet?: WalletClient;
@@ -112,14 +134,14 @@ export declare function clientChainId(c: LogswapClient): Promise<number>;
112
134
  * **8** since 2026-10-13 (logswap-contract decision 066): the collector is split into two roles —
113
135
  * `feeCollector` / `proposeCollector` / `acceptCollector` are `treasury` / `proposeTreasury` (the
114
136
  * LOG Authority's) / `acceptTreasury`; `setSwapFeeTax` and `setGate` leave the manager: the tax is
115
- * each market's, answered by the gate (`PublicPolicy.swapFeeTax`, the LOG Authority's) at birth and
137
+ * each market's, answered by its policy at birth (since 098, `SponsorPolicyC.swapFeeTax`, an immutable) and
116
138
  * read as `getPool(key).swapFeeTax`; the gate is fixed at construction; `collectProtocolFees(key)` is
117
139
  * permissionless and pays the treasury. No pool id moved.
118
140
  * 9 (decision 071): the events — one `Swap` on both managers (`taker`, `feeToken`), `CSwapState`, C's `swap`
119
141
  * takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
120
142
  * `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
121
143
  */
122
- export declare const EXPECTED_VERSION = 13n;
144
+ export declare const EXPECTED_VERSION = 16n;
123
145
  /**
124
146
  * The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
125
147
  * 4 was the income-only harvest cut).
@@ -131,12 +153,13 @@ export declare const EXPECTED_VERSION = 13n;
131
153
  * passes it; when one lands, raise this constant in the same change, which is the discipline
132
154
  * `EXPECTED_VERSION` enforces mechanically and this one asks for.
133
155
  */
134
- export declare const EXPECTED_F_VERSION = 39n;
156
+ export declare const EXPECTED_F_VERSION = 40n;
135
157
  export declare function assertVersion(c: LogswapClient, expected?: bigint): Promise<void>;
136
158
  /**
137
159
  * The versions say the managers are the right code; this says the rest of the addresses belong
138
160
  * to THEM. A stale router or lens from a previous deployment passes every version check and then
139
161
  * fails in the worst way: approvals go to a router that pulls for another manager, or every pull
140
- * reverts because the router's Permit2 is not the one the user approved.
162
+ * reverts because the router's Permit2 is not the one the user approved. Each side is checked on its
163
+ * own: the router and the lens name their manager (`mgr()`), and the router its Permit2.
141
164
  */
142
165
  export declare function assertWiring(c: LogswapClient): Promise<void>;
package/dist/client.js CHANGED
@@ -3,11 +3,45 @@
3
3
  *
4
4
  * Construct once and pass to every helper. `wallet` is optional: read helpers need only `public`.
5
5
  *
6
- * **Three addresses, permanently.** Not three per market — every market lives in the one manager,
7
- * and a market is an `initialize(key, x0)` call rather than a deployment. So this is a constant of
8
- * the protocol, not configuration that grows.
6
+ * **One stack per manager, permanently** (decision 096): a manager, its router and its lens, for F and for
7
+ * C. Not per market — every market lives in the one manager of its side, and a market is an
8
+ * `initialize` call rather than a deployment. F ships first, so the C stack is optional: a chain
9
+ * that has not opted into C carries `address(0)` for it, and every C call throws a plain error there.
9
10
  */
10
11
  import { addressesOfDeployment, DEFAULT_MAX_LOG_RANGE, logswapChain } from "./chains.js";
12
+ const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
13
+ const NO_C = "logswap: this deployment has no C stack (managerC / routerC / lensC) — F ships first, C lands with its own deployment";
14
+ /** Whether the deployment carries the C stack. */
15
+ export function hasC(c) {
16
+ const a = c.addresses;
17
+ return has(a.managerC) && has(a.routerC) && has(a.lensC);
18
+ }
19
+ const has = (a) => !!a && a !== ZERO_ADDRESS;
20
+ /** The C manager; throws where the deployment has none. */
21
+ export function managerC(c) {
22
+ const a = c.addresses.managerC;
23
+ if (!has(a))
24
+ throw new Error(NO_C);
25
+ return a;
26
+ }
27
+ /** The C router; throws where the deployment has none. */
28
+ export function routerC(c) {
29
+ const a = c.addresses.routerC;
30
+ if (!has(a))
31
+ throw new Error(NO_C);
32
+ return a;
33
+ }
34
+ /** The C lens; throws where the deployment has none. */
35
+ export function lensC(c) {
36
+ const a = c.addresses.lensC;
37
+ if (!has(a))
38
+ throw new Error(NO_C);
39
+ return a;
40
+ }
41
+ /** The router of `side` — the contract that pulls the caller's tokens, and the spender to approve. */
42
+ export function routerOf(c, side) {
43
+ return side === "F" ? c.addresses.routerF : routerC(c);
44
+ }
11
45
  export function createLogswapClient(args) {
12
46
  const d = args.deployment;
13
47
  const addresses = args.addresses ?? (d && addressesOfDeployment(d));
@@ -106,7 +140,7 @@ function guardChain(wallet, pub) {
106
140
  * **8** since 2026-10-13 (logswap-contract decision 066): the collector is split into two roles —
107
141
  * `feeCollector` / `proposeCollector` / `acceptCollector` are `treasury` / `proposeTreasury` (the
108
142
  * LOG Authority's) / `acceptTreasury`; `setSwapFeeTax` and `setGate` leave the manager: the tax is
109
- * each market's, answered by the gate (`PublicPolicy.swapFeeTax`, the LOG Authority's) at birth and
143
+ * each market's, answered by its policy at birth (since 098, `SponsorPolicyC.swapFeeTax`, an immutable) and
110
144
  * read as `getPool(key).swapFeeTax`; the gate is fixed at construction; `collectProtocolFees(key)` is
111
145
  * permissionless and pays the treasury. No pool id moved.
112
146
  * 9 (decision 071): the events — one `Swap` on both managers (`taker`, `feeToken`), `CSwapState`, C's `swap`
@@ -121,7 +155,16 @@ function guardChain(wallet, pub) {
121
155
  // only; no pool id moved), the router's named entries take the tokens the caller expects (`WrongToken`), `claimById` / `burnById` /
122
156
  // `claimManyFor` are `claim` / `burn` / `claimMany`, `mint(poolId, to, floor, cap, L)`, `MarketCreated` is `PoolCreated` (in F's field
123
157
  // order), `x0` is `initialLogPrice`, `PoolView.x` / `.F` are `logPrice` / `feeGrowth`, `swapFee` / `mintFee` are `uint56`.
124
- export const EXPECTED_VERSION = 13n;
158
+ // 14 (decision 092): the C quoter is the router's (`Router.quoteSwap(poolId, exactIn, baseSide, amount, taker)`); `CPoolManager.quoteSwap`
159
+ // and the Lens's `previewSwapExactIn` / `Out` / `InBatch` are gone. No pool id moved.
160
+ // 15 (decision 097): `PoolKeyC` is `(base, quote, tickSpacing, policy, creator, salt, swapFee, mintFee)` — every C pool id moved; the creator
161
+ // initializes and makes the first mint (`NotCreator`); `PoolCreated` carries the salt; the backstop is held by 0xdead; a malformed policy
162
+ // answer is `BadTerms`. The names are decision 096's (no `c` prefix on a function or an event; `SwapState`); a router and a lens per manager.
163
+ // 16 (decision 098): the policies are immutable and the LOG's — `SponsorPolicyC` replaces `PublicPolicy` / `PrivatePolicy`; `setPermissions` /
164
+ // `PermissionsSet` are `setGates(poolId, gates, operator)` / `GatesSet`; the birth answer is `(flags, tax, operator)`; the policy's
165
+ // numbers (tiers, quotes, spacings, tax) are constructor immutables; the swap and mint gates are one bit each (`GATE_SWAP`,
166
+ // `GATE_MINT`) and the cached operator passes with no policy call. No pool id moved.
167
+ export const EXPECTED_VERSION = 16n;
125
168
  /**
126
169
  * The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
127
170
  * 4 was the income-only harvest cut).
@@ -224,24 +267,28 @@ export const EXPECTED_VERSION = 13n;
224
267
  // income fee are the income and the income tax (`IncomeReleased`, `incomeHeld`, `incomeTax`); a pad is uncapped.
225
268
  // 39 (decision 087): `swapFeeB4B` is gone; base-for-base pays `swapFee` once, not 2·swapFee.
226
269
  // A breaking bump: raised in the same change.
227
- export const EXPECTED_F_VERSION = 39n;
270
+ // 40 (decision 098): the policies are immutable and the LOG's — `SponsorPolicyF` replaces `PublicPolicy` / `PrivatePolicy`, `PolPolicy` /
271
+ // `PadPolicy` lose their setters (and the lists, the handover and `creator`: the authority is `key.creator` for life); `Pool.asks` is
272
+ // `Pool.flags` (`GATE_SWAP` 1, `GATE_MINT` 2, `SEED_TO_DEAD` 4) and `Pool.operator` caches the operator; `setPermissions` /
273
+ // `PermissionsSet` are `setGates` / `GatesSet`; the registry's `migrate(manager, key, to, permissions)` replaces `migratePrivate`,
274
+ // `orphan(manager, key)` moves a pool to `OrphanPolicyF`. No pool id moved.
275
+ export const EXPECTED_F_VERSION = 40n;
228
276
  export async function assertVersion(c, expected = EXPECTED_VERSION) {
229
- const { cPoolManagerAbi, fPoolManagerAbi } = await import("./generated.js");
230
- // three independent reads: one round trip, not three in a row
231
- const [got, gotF, wiring] = await Promise.all([
232
- c.public.readContract({ address: c.addresses.cPoolManager, abi: cPoolManagerAbi, functionName: "version" }),
233
- // the F manager carries its own tag; assert it the same way when deployed
234
- c.addresses.fPoolManager
235
- ? c.public.readContract({ address: c.addresses.fPoolManager, abi: fPoolManagerAbi, functionName: "version" })
236
- : Promise.resolve(null),
277
+ const { managerCAbi, managerFAbi } = await import("./generated.js");
278
+ const withC = hasC(c);
279
+ // independent reads: one round trip, not one per manager
280
+ const [gotC, gotF, wiring] = await Promise.all([
281
+ // the C stack is optional (F ships first); asserted the same way when deployed
282
+ withC ? c.public.readContract({ address: c.addresses.managerC, abi: managerCAbi, functionName: "version" }) : Promise.resolve(null),
283
+ c.public.readContract({ address: c.addresses.managerF, abi: managerFAbi, functionName: "version" }),
237
284
  assertWiring(c).then(() => null, (e) => e),
238
285
  ]);
239
- if (got !== expected) {
240
- throw new Error(`logswap: manager at ${c.addresses.cPoolManager} reports version ${got}, but this SDK was built ` +
286
+ if (gotC !== null && gotC !== expected) {
287
+ throw new Error(`logswap: C manager at ${c.addresses.managerC} reports version ${gotC}, but this SDK was built ` +
241
288
  `against version ${expected}. Upgrade the SDK or point at the matching deployment.`);
242
289
  }
243
- if (gotF !== null && gotF < EXPECTED_F_VERSION) {
244
- throw new Error(`logswap: F manager at ${c.addresses.fPoolManager} reports version ${gotF}, but this SDK needs ` +
290
+ if (gotF < EXPECTED_F_VERSION) {
291
+ throw new Error(`logswap: F manager at ${c.addresses.managerF} reports version ${gotF}, but this SDK needs ` +
245
292
  `at least F version ${EXPECTED_F_VERSION}. Upgrade the deployment or point at a newer one.`);
246
293
  }
247
294
  // the wiring's error is the less specific one, so a version mismatch is reported first
@@ -252,20 +299,22 @@ export async function assertVersion(c, expected = EXPECTED_VERSION) {
252
299
  * The versions say the managers are the right code; this says the rest of the addresses belong
253
300
  * to THEM. A stale router or lens from a previous deployment passes every version check and then
254
301
  * fails in the worst way: approvals go to a router that pulls for another manager, or every pull
255
- * reverts because the router's Permit2 is not the one the user approved.
302
+ * reverts because the router's Permit2 is not the one the user approved. Each side is checked on its
303
+ * own: the router and the lens name their manager (`mgr()`), and the router its Permit2.
256
304
  */
257
305
  export async function assertWiring(c) {
258
- const { logswapRouterAbi, logswapLensAbi } = await import("./generated.js");
306
+ const { routerCAbi, routerFAbi, lensCAbi, lensFAbi } = await import("./generated.js");
259
307
  const rd = (address, abi, functionName) => c.public.readContract({ address, abi, functionName });
260
308
  const ZERO = "0x0000000000000000000000000000000000000000";
261
309
  const want = [
262
- ["router.mgr()", rd(c.addresses.router, logswapRouterAbi, "mgr"), c.addresses.cPoolManager],
263
- ["router.permit2()", rd(c.addresses.router, logswapRouterAbi, "permit2"), c.addresses.permit2 ?? ZERO],
264
- ["lens.mgr()", rd(c.addresses.lens, logswapLensAbi, "mgr"), c.addresses.cPoolManager],
310
+ ["routerF.mgr()", rd(c.addresses.routerF, routerFAbi, "mgr"), c.addresses.managerF],
311
+ ["routerF.permit2()", rd(c.addresses.routerF, routerFAbi, "permit2"), c.addresses.permit2 ?? ZERO],
312
+ ["lensF.mgr()", rd(c.addresses.lensF, lensFAbi, "mgr"), c.addresses.managerF],
265
313
  ];
266
- if (c.addresses.fPoolManager) {
267
- want.push(["router.fmgr()", rd(c.addresses.router, logswapRouterAbi, "fmgr"), c.addresses.fPoolManager]);
268
- want.push(["lens.fmgr()", rd(c.addresses.lens, logswapLensAbi, "fmgr"), c.addresses.fPoolManager]);
314
+ if (hasC(c)) {
315
+ want.push(["routerC.mgr()", rd(c.addresses.routerC, routerCAbi, "mgr"), c.addresses.managerC]);
316
+ want.push(["routerC.permit2()", rd(c.addresses.routerC, routerCAbi, "permit2"), c.addresses.permit2 ?? ZERO]);
317
+ want.push(["lensC.mgr()", rd(c.addresses.lensC, lensCAbi, "mgr"), c.addresses.managerC]);
269
318
  }
270
319
  const got = await Promise.all(want.map((w) => w[1]));
271
320
  const bad = want.flatMap(([what, , expected], i) => got[i].toLowerCase() === expected.toLowerCase() ? [] : [`${what} is ${got[i]}, expected ${expected}`]);
package/dist/fees.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * Both equal φ·L·|Δx| summed over the swap's segments — the same φ·|dx| per unit L that `F` books.
12
12
  */
13
- import type { LogswapClient } from "./client.js";
13
+ import { type LogswapClient } from "./client.js";
14
14
  import type { DiscoveredMarket } from "./pools.js";
15
15
  /**
16
16
  * The fee one swap paid, in quote, from its `Swap` event's fields.
package/dist/fees.js CHANGED
@@ -10,14 +10,15 @@
10
10
  *
11
11
  * Both equal φ·L·|Δx| summed over the swap's segments — the same φ·|dx| per unit L that `F` books.
12
12
  */
13
- import { cPoolManagerAbi } from "./generated.js";
13
+ import { managerC } from "./client.js";
14
+ import { managerCAbi } from "./generated.js";
14
15
  import { getEventLogs } from "./history.js";
15
16
  import { swapFlows } from "./views.js";
16
17
  /** A C market's swap fees over [fromBlock, toBlock] from the indexer's swap_flow view; null when the indexer cannot answer. */
17
18
  async function windowFromView(c, indexer, poolId, fromBlock, toBlock) {
18
19
  try {
19
20
  const rows = await swapFlows(indexer, {
20
- condition: { side: "C", poolId: poolId.toLowerCase(), manager: c.addresses.cPoolManager.toLowerCase() },
21
+ condition: { side: "C", poolId: poolId.toLowerCase(), manager: managerC(c).toLowerCase() },
21
22
  filter: { blockNumber: { greaterThanOrEqualTo: fromBlock.toString(), lessThanOrEqualTo: toBlock.toString() } },
22
23
  });
23
24
  let fees = 0n;
@@ -102,7 +103,7 @@ export async function swapFees(c, m, opts = {}) {
102
103
  fromBlock = m.blockNumber;
103
104
  from = opened.timestamp;
104
105
  }
105
- const ev = cPoolManagerAbi.find((x) => x.type === "event" && x.name === "Swap");
106
+ const ev = managerCAbi.find((x) => x.type === "event" && x.name === "Swap");
106
107
  if (!ev)
107
108
  throw new Error("logswap: Swap event missing from the generated ABI");
108
109
  // the event carries the fee the swap charged (decisions 050), exactly — no re-derivation from φ;
@@ -115,7 +116,7 @@ export async function swapFees(c, m, opts = {}) {
115
116
  ({ fees, swaps } = viewed);
116
117
  }
117
118
  else if (fromBlock <= toBlock) {
118
- const { logs } = await getEventLogs(c, { indexer, address: c.addresses.cPoolManager, event: ev, args: { poolId: m.poolId }, fromBlock, toBlock });
119
+ const { logs } = await getEventLogs(c, { indexer, address: managerC(c), event: ev, args: { poolId: m.poolId }, fromBlock, toBlock });
119
120
  for (const l of logs)
120
121
  fees += l.args.fee;
121
122
  swaps = logs.length;