@logswap/sdk 0.5.73 → 0.5.75

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/fpool.d.ts CHANGED
@@ -90,6 +90,30 @@ export declare const fPolicyBaseAbi: readonly [{
90
90
  readonly type: "address";
91
91
  }];
92
92
  readonly stateMutability: "view";
93
+ }, {
94
+ readonly type: "function";
95
+ readonly inputs: readonly [];
96
+ readonly name: "creatorCurated";
97
+ readonly outputs: readonly [{
98
+ readonly name: "";
99
+ readonly internalType: "bool";
100
+ readonly type: "bool";
101
+ }];
102
+ readonly stateMutability: "view";
103
+ }, {
104
+ readonly type: "function";
105
+ readonly inputs: readonly [{
106
+ readonly name: "";
107
+ readonly internalType: "address";
108
+ readonly type: "address";
109
+ }];
110
+ readonly name: "creatorListed";
111
+ readonly outputs: readonly [{
112
+ readonly name: "";
113
+ readonly internalType: "bool";
114
+ readonly type: "bool";
115
+ }];
116
+ readonly stateMutability: "view";
93
117
  }, {
94
118
  readonly type: "function";
95
119
  readonly inputs: readonly [];
@@ -219,6 +243,30 @@ export declare const fPolicyBaseAbi: readonly [{
219
243
  readonly type: "uint256";
220
244
  }];
221
245
  readonly stateMutability: "view";
246
+ }, {
247
+ readonly type: "function";
248
+ readonly inputs: readonly [];
249
+ readonly name: "mintFeeCurated";
250
+ readonly outputs: readonly [{
251
+ readonly name: "";
252
+ readonly internalType: "bool";
253
+ readonly type: "bool";
254
+ }];
255
+ readonly stateMutability: "view";
256
+ }, {
257
+ readonly type: "function";
258
+ readonly inputs: readonly [{
259
+ readonly name: "";
260
+ readonly internalType: "uint256";
261
+ readonly type: "uint256";
262
+ }];
263
+ readonly name: "mintFeeListed";
264
+ readonly outputs: readonly [{
265
+ readonly name: "";
266
+ readonly internalType: "bool";
267
+ readonly type: "bool";
268
+ }];
269
+ readonly stateMutability: "view";
222
270
  }, {
223
271
  readonly type: "function";
224
272
  readonly inputs: readonly [{
@@ -276,12 +324,20 @@ export declare const fPolicyBaseAbi: readonly [{
276
324
  readonly internalType: "uint24";
277
325
  readonly type: "uint24";
278
326
  }];
327
+ }, {
328
+ readonly name: "mintFee";
329
+ readonly internalType: "uint256";
330
+ readonly type: "uint256";
279
331
  }];
280
332
  readonly name: "onInitialize";
281
333
  readonly outputs: readonly [{
282
334
  readonly name: "";
283
335
  readonly internalType: "uint8";
284
336
  readonly type: "uint8";
337
+ }, {
338
+ readonly name: "";
339
+ readonly internalType: "uint256";
340
+ readonly type: "uint256";
285
341
  }];
286
342
  readonly stateMutability: "nonpayable";
287
343
  }, {
@@ -438,6 +494,30 @@ export declare const fPolicyBaseAbi: readonly [{
438
494
  readonly type: "bool";
439
495
  }];
440
496
  readonly stateMutability: "view";
497
+ }, {
498
+ readonly type: "function";
499
+ readonly inputs: readonly [{
500
+ readonly name: "curated";
501
+ readonly internalType: "bool";
502
+ readonly type: "bool";
503
+ }];
504
+ readonly name: "setCreatorCurated";
505
+ readonly outputs: readonly [];
506
+ readonly stateMutability: "nonpayable";
507
+ }, {
508
+ readonly type: "function";
509
+ readonly inputs: readonly [{
510
+ readonly name: "who";
511
+ readonly internalType: "address";
512
+ readonly type: "address";
513
+ }, {
514
+ readonly name: "listed";
515
+ readonly internalType: "bool";
516
+ readonly type: "bool";
517
+ }];
518
+ readonly name: "setCreatorListed";
519
+ readonly outputs: readonly [];
520
+ readonly stateMutability: "nonpayable";
441
521
  }, {
442
522
  readonly type: "function";
443
523
  readonly inputs: readonly [{
@@ -462,6 +542,30 @@ export declare const fPolicyBaseAbi: readonly [{
462
542
  readonly name: "setFeeListed";
463
543
  readonly outputs: readonly [];
464
544
  readonly stateMutability: "nonpayable";
545
+ }, {
546
+ readonly type: "function";
547
+ readonly inputs: readonly [{
548
+ readonly name: "curated";
549
+ readonly internalType: "bool";
550
+ readonly type: "bool";
551
+ }];
552
+ readonly name: "setMintFeeCurated";
553
+ readonly outputs: readonly [];
554
+ readonly stateMutability: "nonpayable";
555
+ }, {
556
+ readonly type: "function";
557
+ readonly inputs: readonly [{
558
+ readonly name: "mintFee";
559
+ readonly internalType: "uint256";
560
+ readonly type: "uint256";
561
+ }, {
562
+ readonly name: "listed";
563
+ readonly internalType: "bool";
564
+ readonly type: "bool";
565
+ }];
566
+ readonly name: "setMintFeeListed";
567
+ readonly outputs: readonly [];
568
+ readonly stateMutability: "nonpayable";
465
569
  }, {
466
570
  readonly type: "function";
467
571
  readonly inputs: readonly [{
@@ -554,6 +658,31 @@ export declare const fPolicyBaseAbi: readonly [{
554
658
  readonly indexed: true;
555
659
  }];
556
660
  readonly name: "AuthoritySet";
661
+ }, {
662
+ readonly type: "event";
663
+ readonly anonymous: false;
664
+ readonly inputs: readonly [{
665
+ readonly name: "curated";
666
+ readonly internalType: "bool";
667
+ readonly type: "bool";
668
+ readonly indexed: false;
669
+ }];
670
+ readonly name: "CreatorCuratedSet";
671
+ }, {
672
+ readonly type: "event";
673
+ readonly anonymous: false;
674
+ readonly inputs: readonly [{
675
+ readonly name: "creator";
676
+ readonly internalType: "address";
677
+ readonly type: "address";
678
+ readonly indexed: true;
679
+ }, {
680
+ readonly name: "listed";
681
+ readonly internalType: "bool";
682
+ readonly type: "bool";
683
+ readonly indexed: false;
684
+ }];
685
+ readonly name: "CreatorListed";
557
686
  }, {
558
687
  readonly type: "event";
559
688
  readonly anonymous: false;
@@ -579,6 +708,31 @@ export declare const fPolicyBaseAbi: readonly [{
579
708
  readonly indexed: false;
580
709
  }];
581
710
  readonly name: "FeeListed";
711
+ }, {
712
+ readonly type: "event";
713
+ readonly anonymous: false;
714
+ readonly inputs: readonly [{
715
+ readonly name: "curated";
716
+ readonly internalType: "bool";
717
+ readonly type: "bool";
718
+ readonly indexed: false;
719
+ }];
720
+ readonly name: "MintFeeCuratedSet";
721
+ }, {
722
+ readonly type: "event";
723
+ readonly anonymous: false;
724
+ readonly inputs: readonly [{
725
+ readonly name: "mintFee";
726
+ readonly internalType: "uint256";
727
+ readonly type: "uint256";
728
+ readonly indexed: true;
729
+ }, {
730
+ readonly name: "listed";
731
+ readonly internalType: "bool";
732
+ readonly type: "bool";
733
+ readonly indexed: false;
734
+ }];
735
+ readonly name: "MintFeeListed";
582
736
  }, {
583
737
  readonly type: "event";
584
738
  readonly anonymous: false;
@@ -642,6 +796,14 @@ export declare const fPolicyBaseAbi: readonly [{
642
796
  readonly type: "error";
643
797
  readonly inputs: readonly [];
644
798
  readonly name: "BadRate";
799
+ }, {
800
+ readonly type: "error";
801
+ readonly inputs: readonly [{
802
+ readonly name: "creator";
803
+ readonly internalType: "address";
804
+ readonly type: "address";
805
+ }];
806
+ readonly name: "CreatorNotListed";
645
807
  }, {
646
808
  readonly type: "error";
647
809
  readonly inputs: readonly [{
@@ -650,6 +812,14 @@ export declare const fPolicyBaseAbi: readonly [{
650
812
  readonly type: "uint256";
651
813
  }];
652
814
  readonly name: "FeeNotListed";
815
+ }, {
816
+ readonly type: "error";
817
+ readonly inputs: readonly [{
818
+ readonly name: "mintFee";
819
+ readonly internalType: "uint256";
820
+ readonly type: "uint256";
821
+ }];
822
+ readonly name: "MintFeeNotListed";
653
823
  }, {
654
824
  readonly type: "error";
655
825
  readonly inputs: readonly [];
@@ -709,8 +879,10 @@ export interface FPoolState {
709
879
  Q: bigint;
710
880
  /** Total exposure. Grows on mint, shrinks on burn; never moves on a swap. */
711
881
  L: bigint;
712
- /** The swap fee, WAD (`phi` before F version 25, decisions 059). At or above `FEE_MIN` — a zero-fee basket is not constructible. */
882
+ /** 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. */
713
883
  swapFee: bigint;
884
+ /** 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). */
885
+ mintFee: bigint;
714
886
  /** θ₀, 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. */
715
887
  refLogFloor: bigint;
716
888
  /** θ = 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. */
@@ -1154,6 +1326,12 @@ export interface FPoolCreateArgs {
1154
1326
  weights: bigint[];
1155
1327
  /** 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). */
1156
1328
  swapFee: bigint;
1329
+ /**
1330
+ * The pool's mint fee, WAD of newly-minted L — the creator's pick from the policy's menu (F version
1331
+ * 26, decisions 065; a curated menu refuses anything else with `MintFeeNotListed`). Defaults to
1332
+ * {@link presetMintFee}: twice the swap fee, capped at `FEE_MAX`.
1333
+ */
1334
+ mintFee?: bigint;
1157
1335
  /**
1158
1336
  * The common cap (decisions 061): d = ln(cap price / floor price) in 1e-6 log units, a key field;
1159
1337
  * 0 or absent is uncapped. From a leverage λ: {@link fPoolCapOfLeverage}.
@@ -1234,7 +1412,8 @@ export declare function fPoolIdOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "ac
1234
1412
  */
1235
1413
  export declare function fPoolKeyOfPool(c: LogswapClient, poolId: Hex, opts?: {
1236
1414
  salt?: Hex;
1237
- fromBlock?: bigint;
1415
+ fromBlock?: bigint; /** The rindexer GraphQL endpoint: `FInitialize` from there, the node otherwise. The salt is in neither (the event does not carry it). */
1416
+ indexer?: string;
1238
1417
  }): Promise<FPoolKey>;
1239
1418
  /**
1240
1419
  * The reserve a leg holds at a mark: `R = Lj·e^{−x}`, WAD math. The seed names RESERVES —
package/dist/fpool.js CHANGED
@@ -47,6 +47,7 @@ export { fPoolManagerAbi, padPolicyAbi, polPolicyAbi, privatePolicyAbi, publicPo
47
47
  export const fPolicyBaseAbi = polPolicyAbi;
48
48
  import { fallBackUnlessRejected, signerFor } from "./write.js";
49
49
  import { getEventLogs } from "./history.js";
50
+ import { presetMintFee } from "./positions.js";
50
51
  const WAD = 10n ** 18n;
51
52
  const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
52
53
  /** The optional questions a policy declared at birth, as bits of `Pool.asks`. */
@@ -93,6 +94,7 @@ export async function getFPool(c, poolId) {
93
94
  Q: p.Q,
94
95
  L: p.L,
95
96
  swapFee: p.swapFee,
97
+ mintFee: p.mintFee,
96
98
  refLogFloor: p.refLogFloor,
97
99
  logFloor: v.logFloor,
98
100
  compositeX: v.compositeX,
@@ -756,7 +758,7 @@ export async function fPoolInitialize(c, a) {
756
758
  address: c.addresses.fPoolManager,
757
759
  abi: fPoolManagerAbi,
758
760
  functionName: "initialize",
759
- args: [key],
761
+ args: [key, a.mintFee ?? presetMintFee(a.swapFee)],
760
762
  account: wallet.account,
761
763
  });
762
764
  return c.wallet.writeContract(request);
@@ -777,13 +779,7 @@ export async function fPoolIdOf(c, a) {
777
779
  */
778
780
  export async function fPoolKeyOfPool(c, poolId, opts = {}) {
779
781
  const ev = fPoolManagerAbi.find((x) => x.type === "event" && x.name === "FInitialize");
780
- const logs = await c.public.getLogs({
781
- address: c.addresses.fPoolManager,
782
- event: ev,
783
- args: { poolId },
784
- fromBlock: opts.fromBlock ?? 0n,
785
- toBlock: "latest",
786
- });
782
+ const { logs } = await getEventLogs(c, { indexer: opts.indexer, address: c.addresses.fPoolManager, event: ev, args: { poolId }, fromBlock: opts.fromBlock ?? 0n });
787
783
  const l = logs[0];
788
784
  if (!l)
789
785
  throw new Error(`logswap: no FInitialize for F pool ${poolId}`);
@@ -993,7 +989,7 @@ export function fPoolLaunchCalls(poolId, a) {
993
989
  const enc = (functionName, args) => encodeFunctionData({ abi: fPoolManagerAbi, functionName, args });
994
990
  const calls = [];
995
991
  if (!a.initialized)
996
- calls.push(enc("initialize", [key]));
992
+ calls.push(enc("initialize", [key, a.mintFee ?? presetMintFee(a.swapFee)]));
997
993
  calls.push(enc("seed", [poolId, a.L0, companions[1], a.Q0]));
998
994
  // gen 0 by construction: a launch is the pool's FIRST seed — a relaunch is `fPoolRelaunch`.
999
995
  // No transfer to 0xdead: on a pad `seed` mints every share there itself.