@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/README.md +25 -0
- package/dist/admin.d.ts +195 -0
- package/dist/admin.js +91 -0
- package/dist/client.d.ts +9 -2
- package/dist/client.js +12 -2
- package/dist/fpool.d.ts +179 -1
- package/dist/fpool.js +4 -2
- package/dist/generated.d.ts +1113 -214
- package/dist/generated.js +736 -101
- package/dist/indexer.js +3 -8
- package/dist/keys.d.ts +8 -6
- package/dist/keys.js +6 -5
- package/dist/liquidity.d.ts +8 -1
- package/dist/liquidity.js +5 -2
- package/dist/pools.d.ts +17 -9
- package/dist/pools.js +23 -22
- package/dist/positions.d.ts +20 -8
- package/dist/positions.js +36 -15
- package/package.json +1 -1
- package/src/admin.ts +123 -1
- package/src/client.ts +12 -2
- package/src/fpool.ts +13 -3
- package/src/generated.ts +736 -101
- package/src/indexer.ts +4 -9
- package/src/keys.ts +8 -6
- package/src/liquidity.ts +10 -2
- package/src/pools.ts +29 -24
- package/src/positions.ts +39 -16
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).
|
|
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.
|