@logswap/sdk 0.5.87 → 0.5.89

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/src/fpool.ts CHANGED
@@ -67,8 +67,8 @@ export interface FPoolState {
67
67
  poolId: Hex;
68
68
  quote: Address;
69
69
  bases: Address[];
70
- /** WAD weights, summing to WAD. `L_j = w_j · L`. */
71
- weights: bigint[];
70
+ /** 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`. */
71
+ liquidityWeights: bigint[];
72
72
  /** Per-asset log prices, WAD. Price is derived; `x` is the state. */
73
73
  x: bigint[];
74
74
  /** Quote reserve. The one leg a base→quote swap can exhaust. */
@@ -164,9 +164,9 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
164
164
  return {
165
165
  poolId,
166
166
  quote: p.quote,
167
- bases: v.baseLegs.map((l) => l.base),
168
- weights: v.baseLegs.map((l) => l.weight),
169
- x: v.baseLegs.map((l) => l.x), // derived by the manager: x_j = ln(w_j·L / R̃_j)
167
+ bases: v.baseAssets.map((l) => l.base),
168
+ liquidityWeights: v.baseAssets.map((l) => l.liquidityWeight),
169
+ x: v.baseAssets.map((l) => l.x), // derived by the manager: x_j = ln(w_j·L / R̃_j)
170
170
  Q: p.Q,
171
171
  L: p.L,
172
172
  swapFee: p.swapFee,
@@ -185,9 +185,9 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
185
185
  seeded: p.seeded,
186
186
  gen: Number(p.gen),
187
187
  totalSupply: p.shares,
188
- reserves: v.baseLegs.map((l) => l.reserve), // the state
189
- virtualReserves: v.baseLegs.map((l) => l.virtualReserve),
190
- kappa: v.baseLegs.map((l) => l.kappa),
188
+ reserves: v.baseAssets.map((l) => l.reserve), // the state
189
+ virtualReserves: v.baseAssets.map((l) => l.virtualReserve),
190
+ kappa: v.baseAssets.map((l) => l.kappa),
191
191
  };
192
192
  }
193
193
 
@@ -355,7 +355,7 @@ export function fPoolShareValue(s: FPoolState): bigint {
355
355
  v = s.Q;
356
356
  for (let j = 0; j < s.reserves.length; j++) {
357
357
  const rv = s.virtualReserves[j]!;
358
- if (rv !== 0n) v += (((s.weights[j]! * s.L) / WAD) * s.reserves[j]!) / rv;
358
+ if (rv !== 0n) v += (((s.liquidityWeights[j]! * s.L) / WAD) * s.reserves[j]!) / rv;
359
359
  }
360
360
  }
361
361
  return (v * WAD) / s.totalSupply;
@@ -1004,7 +1004,7 @@ export interface FPoolCreateArgs {
1004
1004
  quote: Address;
1005
1005
  /** 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. */
1006
1006
  bases: Address[];
1007
- /** The swap fee, WAD. The base-for-base fee is pinned at 2φ on-chain. A curated policy admits only its listed tiers (decisions 059). */
1007
+ /** The swap fee, WAD. Base-for-base pays it once, like any swap (F 39). A curated policy admits only its listed tiers (decisions 059). */
1008
1008
  swapFee: bigint;
1009
1009
  /**
1010
1010
  * The pool's mint fee, WAD of newly-minted L — the creator's pick, a key field fixed for life (F 38, decision