@logswap/sdk 0.5.72 → 0.5.74

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
@@ -50,6 +50,7 @@ export const fPolicyBaseAbi = polPolicyAbi;
50
50
  import type { LogswapClient } from "./client.js";
51
51
  import { fallBackUnlessRejected, signerFor } from "./write.js";
52
52
  import { getEventLogs } from "./history.js";
53
+ import { presetMintFee } from "./positions.js";
53
54
 
54
55
  const WAD = 10n ** 18n;
55
56
  const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" as const;
@@ -72,8 +73,10 @@ export interface FPoolState {
72
73
  Q: bigint;
73
74
  /** Total exposure. Grows on mint, shrinks on burn; never moves on a swap. */
74
75
  L: bigint;
75
- /** The swap fee, WAD (`phi` before F version 25, decisions 059). At or above `FEE_MIN` — a zero-fee basket is not constructible. */
76
+ /** The swap fee, WAD (`phi` before F version 25, decisions 059). 0 is no fee (F version 26, decisions 065), admitted only if the policy lists it. */
76
77
  swapFee: bigint;
78
+ /** The pool's mint fee, WAD of newly-minted L: proposed at birth, the policy's answer from its menu (F version 26, decisions 065). */
79
+ mintFee: bigint;
77
80
  /** θ₀, the reference log floor: where the floor stood at the seed (re-based by a capital harvest and at each step); income is counted from it. `theta0` before F version 25. */
78
81
  refLogFloor: bigint;
79
82
  /** θ = X − Q/L, the log of the pool's current floor price: where the bid runs out. Derived, never stored. `theta` before F version 25. */
@@ -163,6 +166,7 @@ export async function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolStat
163
166
  Q: p.Q,
164
167
  L: p.L,
165
168
  swapFee: p.swapFee,
169
+ mintFee: p.mintFee,
166
170
  refLogFloor: p.refLogFloor,
167
171
  logFloor: v.logFloor,
168
172
  compositeX: v.compositeX,
@@ -996,6 +1000,12 @@ export interface FPoolCreateArgs {
996
1000
  weights: bigint[];
997
1001
  /** The swap fee, WAD (`phi` before F version 25). The base-for-base fee is pinned at 2φ on-chain. A curated policy admits only its listed tiers (decisions 059). */
998
1002
  swapFee: bigint;
1003
+ /**
1004
+ * The pool's mint fee, WAD of newly-minted L — the creator's pick from the policy's menu (F version
1005
+ * 26, decisions 065; a curated menu refuses anything else with `MintFeeNotListed`). Defaults to
1006
+ * {@link presetMintFee}: twice the swap fee, capped at `FEE_MAX`.
1007
+ */
1008
+ mintFee?: bigint;
999
1009
  /**
1000
1010
  * The common cap (decisions 061): d = ln(cap price / floor price) in 1e-6 log units, a key field;
1001
1011
  * 0 or absent is uncapped. From a leverage λ: {@link fPoolCapOfLeverage}.
@@ -1119,7 +1129,7 @@ export async function fPoolInitialize(c: LogswapClient, a: FPoolCreateArgs) {
1119
1129
  address: c.addresses.fPoolManager!,
1120
1130
  abi: fPoolManagerAbi,
1121
1131
  functionName: "initialize",
1122
- args: [key],
1132
+ args: [key, a.mintFee ?? presetMintFee(a.swapFee)],
1123
1133
  account: wallet.account,
1124
1134
  } as never);
1125
1135
  return c.wallet!.writeContract(request as never);
@@ -1437,7 +1447,7 @@ export function fPoolLaunchCalls(
1437
1447
  const enc = (functionName: string, args: unknown[]) =>
1438
1448
  encodeFunctionData({ abi: fPoolManagerAbi, functionName, args } as never) as Hex;
1439
1449
  const calls: Hex[] = [];
1440
- if (!a.initialized) calls.push(enc("initialize", [key]));
1450
+ if (!a.initialized) calls.push(enc("initialize", [key, a.mintFee ?? presetMintFee(a.swapFee)]));
1441
1451
  calls.push(enc("seed", [poolId, a.L0, companions[1]!, a.Q0]));
1442
1452
  // gen 0 by construction: a launch is the pool's FIRST seed — a relaunch is `fPoolRelaunch`.
1443
1453
  // No transfer to 0xdead: on a pad `seed` mints every share there itself.