@logswap/sdk 0.5.44 → 0.5.45

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/dist/indexer.js CHANGED
@@ -100,7 +100,7 @@ export async function indexerHealthy(url, signal) {
100
100
  */
101
101
  export async function discoverMarketsIndexed(url, signal) {
102
102
  const q = `{ allInitializes(first: 1000) { nodes {
103
- poolId base quote tickSpacing phiMin kappa alpha x0 blockNumber txHash
103
+ poolId base quote tickSpacing phi x0 blockNumber txHash
104
104
  } } }`;
105
105
  const d = await gql(url, q, undefined, signal);
106
106
  return d.allInitializes.nodes.map((n) => {
@@ -108,9 +108,7 @@ export async function discoverMarketsIndexed(url, signal) {
108
108
  base: n.base,
109
109
  quote: n.quote,
110
110
  tickSpacing: BigInt(n.tickSpacing),
111
- phiMin: BigInt(n.phiMin),
112
- kappa: BigInt(n.kappa),
113
- alpha: BigInt(n.alpha),
111
+ phi: BigInt(n.phi),
114
112
  };
115
113
  return {
116
114
  key,
@@ -142,7 +140,7 @@ export async function discoverMarketsBest(c, url, signal) {
142
140
  await c.public.readContract({
143
141
  address: c.addresses.cPoolManager,
144
142
  abi: cPoolManagerAbi,
145
- functionName: "phiEff",
143
+ functionName: "phiOf",
146
144
  args: [m.key],
147
145
  });
148
146
  return m;
package/dist/keys.d.ts CHANGED
@@ -20,18 +20,19 @@ export interface PoolKey {
20
20
  quote: Address;
21
21
  /** Log-tick spacing, WAD. The LP-boundary ladder — position floors and caps. */
22
22
  tickSpacing: bigint;
23
- /** Fee floor, WAD. `0n` selects `DEFAULT_FEE_MIN` (2 bp) at read time. */
24
- phiMin: bigint;
25
- /** Variance-fee coefficient, WAD. `0n` disables the dynamic fee. */
26
- kappa: bigint;
27
- /** EMA decay, WAD. `0n` selects `DEFAULT_ALPHA` (1/2) at read time. */
28
- alpha: bigint;
23
+ /**
24
+ * The swap fee, WAD, fixed for the life of the market: `FEE_MIN` (1 bp) ≤ φ ≤ `FEE_MAX` (25%),
25
+ * or `0n`, which selects `DEFAULT_FEE` (2 bp) at read time. Four fields since C version 4
26
+ * (decisions 042): `kappa` and `alpha` left with the variance kernel, and `phiMin` — a floor with
27
+ * nothing above it — became `phi`. Every pool id changed with the shape.
28
+ */
29
+ phi: bigint;
29
30
  }
30
31
  /**
31
32
  * `poolId = keccak256(abi.encode(key))` — the primary key of the entire read model.
32
33
  *
33
- * Note the zero-vs-default caveat the Solidity type documents: `phiMin` and `alpha` of `0` resolve
34
- * to their defaults at READ time, so a key carrying `0n` and one carrying the resolved default are
34
+ * Note the zero-vs-default caveat the Solidity type documents: a `phi` of `0` resolves to
35
+ * `DEFAULT_FEE` at READ time, so a key carrying `0n` and one carrying the resolved default are
35
36
  * DIFFERENT markets with different ids, even though they behave identically. Always address a
36
37
  * market by the key it was initialized with.
37
38
  */
package/dist/keys.js CHANGED
@@ -18,17 +18,15 @@ const POOL_KEY_ABI = [
18
18
  { name: "base", type: "address" },
19
19
  { name: "quote", type: "address" },
20
20
  { name: "tickSpacing", type: "int256" },
21
- { name: "phiMin", type: "uint256" },
22
- { name: "kappa", type: "uint256" },
23
- { name: "alpha", type: "uint256" },
21
+ { name: "phi", type: "uint256" },
24
22
  ],
25
23
  },
26
24
  ];
27
25
  /**
28
26
  * `poolId = keccak256(abi.encode(key))` — the primary key of the entire read model.
29
27
  *
30
- * Note the zero-vs-default caveat the Solidity type documents: `phiMin` and `alpha` of `0` resolve
31
- * to their defaults at READ time, so a key carrying `0n` and one carrying the resolved default are
28
+ * Note the zero-vs-default caveat the Solidity type documents: a `phi` of `0` resolves to
29
+ * `DEFAULT_FEE` at READ time, so a key carrying `0n` and one carrying the resolved default are
32
30
  * DIFFERENT markets with different ids, even though they behave identically. Always address a
33
31
  * market by the key it was initialized with.
34
32
  */
@@ -38,9 +36,7 @@ export function poolId(key) {
38
36
  base: key.base,
39
37
  quote: key.quote,
40
38
  tickSpacing: key.tickSpacing,
41
- phiMin: key.phiMin,
42
- kappa: key.kappa,
43
- alpha: key.alpha,
39
+ phi: key.phi,
44
40
  },
45
41
  ]));
46
42
  }
package/dist/pools.d.ts CHANGED
@@ -26,9 +26,8 @@ export interface PoolState {
26
26
  reserveQuote: bigint;
27
27
  /** Fee-per-unit-L accumulator: $\phi \cdot \mathrm{TV}(\log p)$. */
28
28
  F: bigint;
29
- /** Quadratic variation of log-price, $\Sigma = \int (dx)^2$. */
29
+ /** Quadratic variation of log-price, $\Sigma = \sum_{\text{swaps}} (\Delta x_{\text{swap}})^2$ — one term per swap (decisions 042). */
30
30
  bigSigma: bigint;
31
- sigma2Ema: bigint;
32
31
  currentK: bigint;
33
32
  protocolOwed: bigint;
34
33
  minBackstopL: bigint;
@@ -36,8 +35,12 @@ export interface PoolState {
36
35
  }
37
36
  /** Read a market's full state by key. */
38
37
  export declare function getPool(c: LogswapClient, key: PoolKey): Promise<PoolState>;
39
- /** The effective fee right now: $\max(\phi_{\min}, \kappa\sqrt{\sigma^2_{\text{ema}}})$, capped. */
40
- export declare function phiEff(c: LogswapClient, key: PoolKey): Promise<bigint>;
38
+ /**
39
+ * The market's fee: the key's `phi` with `0n` resolved to `DEFAULT_FEE`. Constant for the market's
40
+ * life (C version 4, decisions 042 — `phiEff` and the variance kernel before). Reverts for a key
41
+ * nobody initialized, which `discoverMarkets` relies on to drop a stale indexer's rows.
42
+ */
43
+ export declare function phiOf(c: LogswapClient, key: PoolKey): Promise<bigint>;
41
44
  /**
42
45
  * Price from the stored log-price. **Lossy** — `x` is exact and this is a float, so use it for
43
46
  * display and never for arithmetic you intend to send back on-chain.
package/dist/pools.js CHANGED
@@ -25,12 +25,16 @@ export async function getPool(c, key) {
25
25
  });
26
26
  return v;
27
27
  }
28
- /** The effective fee right now: $\max(\phi_{\min}, \kappa\sqrt{\sigma^2_{\text{ema}}})$, capped. */
29
- export async function phiEff(c, key) {
28
+ /**
29
+ * The market's fee: the key's `phi` with `0n` resolved to `DEFAULT_FEE`. Constant for the market's
30
+ * life (C version 4, decisions 042 — `phiEff` and the variance kernel before). Reverts for a key
31
+ * nobody initialized, which `discoverMarkets` relies on to drop a stale indexer's rows.
32
+ */
33
+ export async function phiOf(c, key) {
30
34
  return c.public.readContract({
31
35
  address: c.addresses.cPoolManager,
32
36
  abi: cPoolManagerAbi,
33
- functionName: "phiEff",
37
+ functionName: "phiOf",
34
38
  args: [key],
35
39
  });
36
40
  }
@@ -88,9 +92,7 @@ export async function discoverMarkets(c, opts = {}) {
88
92
  base: a.base,
89
93
  quote: a.quote,
90
94
  tickSpacing: a.tickSpacing,
91
- phiMin: a.phiMin,
92
- kappa: a.kappa,
93
- alpha: a.alpha,
95
+ phi: a.phi,
94
96
  };
95
97
  return {
96
98
  key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logswap/sdk",
3
- "version": "0.5.44",
3
+ "version": "0.5.45",
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
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * admin — the protocol's (feeCollector's) writes: the protocol's cuts, the harvest-cut exemption,
3
3
  * and the two-step collector handover, on both managers. Plain writes to the managers; no router.
4
- * One vocabulary (decisions 040): the C manager's `setProtocolFeeCut` / `PROTOCOL_FEE_CUT` are the
5
- * same words as F's `setFeeParams` / `MINT_FEE_PROTOCOL_CUT` until C version 4 renames them.
4
+ * One vocabulary (decisions 040): both managers call the protocol's cut of the mint fee
5
+ * `MINT_FEE_PROTOCOL_CUT` and set it through `setFeeParams` — one cut on C (since version 4,
6
+ * decisions 042; `setProtocolFeeCut` / `PROTOCOL_FEE_CUT` before), two on F.
6
7
  */
7
8
 
8
9
  import type { Address, Hash, Hex } from "viem";
@@ -14,9 +15,11 @@ function wallet(c: LogswapClient) {
14
15
  return c.wallet;
15
16
  }
16
17
 
17
- export async function setProtocolFeeCut(c: LogswapClient, cutWad: bigint): Promise<Hash> {
18
- return wallet(c).writeContract({ address: c.addresses.cPoolManager, abi: cPoolManagerAbi, functionName: "setProtocolFeeCut", args: [cutWad], chain: c.wallet!.chain, account: c.wallet!.account! } as never);
18
+ /** The C manager's `setFeeParams(mintFeeProtocolCut)` — one cut. */
19
+ export async function setFeeParamsC(c: LogswapClient, mintFeeProtocolCutWad: bigint): Promise<Hash> {
20
+ return wallet(c).writeContract({ address: c.addresses.cPoolManager, abi: cPoolManagerAbi, functionName: "setFeeParams", args: [mintFeeProtocolCutWad], chain: c.wallet!.chain, account: c.wallet!.account! } as never);
19
21
  }
22
+ /** The F manager's `setFeeParams(mintFeeProtocolCut, harvestProtocolCut)` — two cuts. */
20
23
  export async function setFeeParams(c: LogswapClient, mintFeeProtocolCutWad: bigint, harvestProtocolCutWad: bigint): Promise<Hash> {
21
24
  return wallet(c).writeContract({ address: c.addresses.fPoolManager as Address, abi: fPoolManagerAbi, functionName: "setFeeParams", args: [mintFeeProtocolCutWad, harvestProtocolCutWad], chain: c.wallet!.chain, account: c.wallet!.account! } as never);
22
25
  }
package/src/client.ts CHANGED
@@ -58,8 +58,13 @@ export function createLogswapClient(args: {
58
58
  * **3** since 2026-09-03 (contracts `d8406fb`): `burnById` and `update` take an `owner`, `update`
59
59
  * mints to `to`, `positions()` returns `aps` as uint128 — and a returned quote flow now carries the
60
60
  * swept fees (decisions 018), which is why `exit`'s settle-to-one-asset math changed with it.
61
+ *
62
+ * **4** since 2026-09-18 (decisions 042 + 040): `PoolKey` is `(base, quote, tickSpacing, phi)` —
63
+ * the variance kernel and its two key fields are gone, so every pool id changed; `phiEff` is
64
+ * `phiOf`; `getPool` lost `sigma2Ema`; `Initialize` lost two fields; the cut is
65
+ * `MINT_FEE_PROTOCOL_CUT` / `setFeeParams`.
61
66
  */
62
- export const EXPECTED_VERSION = 3n;
67
+ export const EXPECTED_VERSION = 4n;
63
68
  /**
64
69
  * The F manager's own tag (contracts 25a7bcf: 5 — the key's salt, pool names, the sponsor registry;
65
70
  * 4 was the income-only harvest cut).