@logswap/sdk 0.5.44 → 0.5.46
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 +3 -3
- package/dist/admin.d.ts +41 -9
- package/dist/admin.js +53 -14
- package/dist/client.d.ts +15 -2
- package/dist/client.js +16 -2
- package/dist/fpool.d.ts +682 -74
- package/dist/fpool.js +251 -113
- package/dist/generated.d.ts +2507 -872
- package/dist/generated.js +1645 -490
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/indexer.js +3 -5
- package/dist/keys.d.ts +9 -8
- package/dist/keys.js +4 -8
- package/dist/liquidity.d.ts +2 -0
- package/dist/liquidity.js +1 -0
- package/dist/pools.d.ts +7 -4
- package/dist/pools.js +8 -6
- package/package.json +1 -1
- package/src/admin.ts +68 -15
- package/src/client.ts +24 -2
- package/src/fpool.ts +365 -162
- package/src/generated.ts +1653 -490
- package/src/index.ts +1 -1
- package/src/indexer.ts +5 -7
- package/src/keys.ts +11 -14
- package/src/liquidity.ts +3 -0
- package/src/pools.ts +9 -8
package/README.md
CHANGED
|
@@ -85,9 +85,9 @@ runs once and explicitly rather than being chained into both.
|
|
|
85
85
|
- **The SDK hides the manager/router/lens split.** Which contract hosts which action is currently
|
|
86
86
|
decided by EIP-170 headroom, not by design — so a future re-homing must be an SDK patch, not a
|
|
87
87
|
breaking change for consumers.
|
|
88
|
-
- **Zero is not the default.**
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
- **Zero is not the default.** A `phi` of `0n` resolves to `DEFAULT_FEE` at *read* time, so a key
|
|
89
|
+
carrying `0n` and one carrying the resolved value are **different markets with different ids**.
|
|
90
|
+
Always address a market by the key it was initialized with.
|
|
91
91
|
- **Split every ERC-6909 `Transfer` on bit 255.** Clear means a token claim, not a position; an
|
|
92
92
|
indexer that ignores this reports phantom LP positions for market makers parking inventory.
|
|
93
93
|
|
package/dist/admin.d.ts
CHANGED
|
@@ -1,14 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* admin — the protocol's (feeCollector's) writes: the protocol's
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* admin — the protocol's (feeCollector's) writes: the protocol's cut of the mint fee on both
|
|
3
|
+
* managers, the hooks a pool of each kind may be born with, the hooks' own numbers, and the
|
|
4
|
+
* two-step collector handover. Plain writes to the managers and the hooks; no router.
|
|
5
|
+
*
|
|
6
|
+
* One vocabulary (decisions 040): both managers call the protocol's cut of the mint fee
|
|
7
|
+
* `MINT_FEE_PROTOCOL_CUT` and set it through `setFeeParams(uint256)` — one cut each since C
|
|
8
|
+
* version 4 / F version 14. The harvest's cut is the hook's answer at every harvest (decisions
|
|
9
|
+
* 044), set on the hook (`setHarvestCut`) and capped by the manager (`HARVEST_CUT_MAX`); the
|
|
10
|
+
* release's protocol share likewise (`POT_CUT_MAX`).
|
|
6
11
|
*/
|
|
7
|
-
import type { Address, Hash
|
|
12
|
+
import type { Address, Hash } from "viem";
|
|
8
13
|
import type { LogswapClient } from "./client.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
import { type FPoolKind } from "./fpool.js";
|
|
15
|
+
/** The C manager's `setFeeParams(mintFeeProtocolCut)` — one cut. */
|
|
16
|
+
export declare function setFeeParamsC(c: LogswapClient, mintFeeProtocolCutWad: bigint): Promise<Hash>;
|
|
17
|
+
/** The F manager's `setFeeParams(mintFeeProtocolCut)` — one cut, the C manager's shape (F version 14). */
|
|
18
|
+
export declare function setFeeParams(c: LogswapClient, mintFeeProtocolCutWad: bigint): Promise<Hash>;
|
|
19
|
+
/**
|
|
20
|
+
* Approve a hook for pools of `kind` to be born with, or withdraw the approval (decisions 041,
|
|
21
|
+
* 044). Read at `initialize` and never again: a live pool keeps its hook.
|
|
22
|
+
*/
|
|
23
|
+
export declare function setHookApproved(c: LogswapClient, kind: FPoolKind, hook: Address, approved: boolean): Promise<Hash>;
|
|
24
|
+
/** Whether `hook` is approved for pools of `kind`. */
|
|
25
|
+
export declare function hookApproved(c: LogswapClient, kind: FPoolKind, hook: Address): Promise<boolean>;
|
|
26
|
+
/** The protocol's rate on the income part of every harvest under `hook`, WAD ≤ `HARVEST_CUT_MAX`. */
|
|
27
|
+
export declare function setHarvestCut(c: LogswapClient, hook: Address, rateWad: bigint): Promise<Hash>;
|
|
28
|
+
/** `PadHook.setSchedule`: `T(0)`, the rung's growth, the creator's and the protocol's shares of the pot (≤ `POT_CUT_MAX`), the burn per rung (≤ `BURN_MAX`). */
|
|
29
|
+
export declare function padSetSchedule(c: LogswapClient, hook: Address, s: {
|
|
30
|
+
thresholdBase: bigint;
|
|
31
|
+
thresholdGrowth: bigint;
|
|
32
|
+
creatorShare: bigint;
|
|
33
|
+
protocolShare: bigint;
|
|
34
|
+
burnPerRung: bigint;
|
|
35
|
+
}): Promise<Hash>;
|
|
36
|
+
/** `PolHook.setPolicy`: what every harvest leaves in the bid and what a relaunch's seed must bring, WAD fractions of L. */
|
|
37
|
+
export declare function polSetPolicy(c: LogswapClient, hook: Address, s: {
|
|
38
|
+
keepQuote: bigint;
|
|
39
|
+
minQuoteAtSeed: bigint;
|
|
40
|
+
}): Promise<Hash>;
|
|
41
|
+
/** `PublicHook.setListed`: an asset a curated seed may hold. */
|
|
42
|
+
export declare function publicSetListed(c: LogswapClient, hook: Address, token: Address, listed: boolean): Promise<Hash>;
|
|
43
|
+
/** `PublicHook.setCurated`: whether every public seed is checked against the list. */
|
|
44
|
+
export declare function publicSetCurated(c: LogswapClient, hook: Address, curated: boolean): Promise<Hash>;
|
|
13
45
|
export declare function proposeCollector(c: LogswapClient, side: "C" | "F", next: Address): Promise<Hash>;
|
|
14
46
|
export declare function acceptCollector(c: LogswapClient, side: "C" | "F"): Promise<Hash>;
|
package/dist/admin.js
CHANGED
|
@@ -1,32 +1,71 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* admin — the protocol's (feeCollector's) writes: the protocol's
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* admin — the protocol's (feeCollector's) writes: the protocol's cut of the mint fee on both
|
|
3
|
+
* managers, the hooks a pool of each kind may be born with, the hooks' own numbers, and the
|
|
4
|
+
* two-step collector handover. Plain writes to the managers and the hooks; no router.
|
|
5
|
+
*
|
|
6
|
+
* One vocabulary (decisions 040): both managers call the protocol's cut of the mint fee
|
|
7
|
+
* `MINT_FEE_PROTOCOL_CUT` and set it through `setFeeParams(uint256)` — one cut each since C
|
|
8
|
+
* version 4 / F version 14. The harvest's cut is the hook's answer at every harvest (decisions
|
|
9
|
+
* 044), set on the hook (`setHarvestCut`) and capped by the manager (`HARVEST_CUT_MAX`); the
|
|
10
|
+
* release's protocol share likewise (`POT_CUT_MAX`).
|
|
6
11
|
*/
|
|
7
|
-
import { cPoolManagerAbi, fPoolManagerAbi } from "./generated.js";
|
|
12
|
+
import { cPoolManagerAbi, fPoolManagerAbi, padHookAbi, polHookAbi, publicHookAbi } from "./generated.js";
|
|
13
|
+
import { F_KIND, fHookBaseAbi } from "./fpool.js";
|
|
8
14
|
function wallet(c) {
|
|
9
15
|
if (!c.wallet)
|
|
10
16
|
throw new Error("a wallet client is required");
|
|
11
17
|
return c.wallet;
|
|
12
18
|
}
|
|
13
|
-
|
|
14
|
-
return wallet(c).writeContract({ address
|
|
19
|
+
function write(c, address, abi, functionName, args) {
|
|
20
|
+
return wallet(c).writeContract({ address, abi, functionName, args, chain: c.wallet.chain, account: c.wallet.account });
|
|
15
21
|
}
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
/** The C manager's `setFeeParams(mintFeeProtocolCut)` — one cut. */
|
|
23
|
+
export async function setFeeParamsC(c, mintFeeProtocolCutWad) {
|
|
24
|
+
return write(c, c.addresses.cPoolManager, cPoolManagerAbi, "setFeeParams", [mintFeeProtocolCutWad]);
|
|
18
25
|
}
|
|
19
|
-
/**
|
|
20
|
-
export async function
|
|
21
|
-
return
|
|
26
|
+
/** The F manager's `setFeeParams(mintFeeProtocolCut)` — one cut, the C manager's shape (F version 14). */
|
|
27
|
+
export async function setFeeParams(c, mintFeeProtocolCutWad) {
|
|
28
|
+
return write(c, c.addresses.fPoolManager, fPoolManagerAbi, "setFeeParams", [mintFeeProtocolCutWad]);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Approve a hook for pools of `kind` to be born with, or withdraw the approval (decisions 041,
|
|
32
|
+
* 044). Read at `initialize` and never again: a live pool keeps its hook.
|
|
33
|
+
*/
|
|
34
|
+
export async function setHookApproved(c, kind, hook, approved) {
|
|
35
|
+
return write(c, c.addresses.fPoolManager, fPoolManagerAbi, "setHookApproved", [F_KIND[kind], hook, approved]);
|
|
36
|
+
}
|
|
37
|
+
/** Whether `hook` is approved for pools of `kind`. */
|
|
38
|
+
export async function hookApproved(c, kind, hook) {
|
|
39
|
+
return c.public.readContract({ address: c.addresses.fPoolManager, abi: fPoolManagerAbi, functionName: "hookApproved", args: [F_KIND[kind], hook] });
|
|
40
|
+
}
|
|
41
|
+
// ─── the hooks' numbers (the collector's; each bounded where it reaches the manager) ─────
|
|
42
|
+
/** The protocol's rate on the income part of every harvest under `hook`, WAD ≤ `HARVEST_CUT_MAX`. */
|
|
43
|
+
export async function setHarvestCut(c, hook, rateWad) {
|
|
44
|
+
return write(c, hook, fHookBaseAbi, "setHarvestCut", [rateWad]);
|
|
45
|
+
}
|
|
46
|
+
/** `PadHook.setSchedule`: `T(0)`, the rung's growth, the creator's and the protocol's shares of the pot (≤ `POT_CUT_MAX`), the burn per rung (≤ `BURN_MAX`). */
|
|
47
|
+
export async function padSetSchedule(c, hook, s) {
|
|
48
|
+
return write(c, hook, padHookAbi, "setSchedule", [s.thresholdBase, s.thresholdGrowth, s.creatorShare, s.protocolShare, s.burnPerRung]);
|
|
49
|
+
}
|
|
50
|
+
/** `PolHook.setPolicy`: what every harvest leaves in the bid and what a relaunch's seed must bring, WAD fractions of L. */
|
|
51
|
+
export async function polSetPolicy(c, hook, s) {
|
|
52
|
+
return write(c, hook, polHookAbi, "setPolicy", [s.keepQuote, s.minQuoteAtSeed]);
|
|
53
|
+
}
|
|
54
|
+
/** `PublicHook.setListed`: an asset a curated seed may hold. */
|
|
55
|
+
export async function publicSetListed(c, hook, token, listed) {
|
|
56
|
+
return write(c, hook, publicHookAbi, "setListed", [token, listed]);
|
|
57
|
+
}
|
|
58
|
+
/** `PublicHook.setCurated`: whether every public seed is checked against the list. */
|
|
59
|
+
export async function publicSetCurated(c, hook, curated) {
|
|
60
|
+
return write(c, hook, publicHookAbi, "setCurated", [curated]);
|
|
22
61
|
}
|
|
23
62
|
export async function proposeCollector(c, side, next) {
|
|
24
63
|
const address = side === "C" ? c.addresses.cPoolManager : c.addresses.fPoolManager;
|
|
25
64
|
const abi = side === "C" ? cPoolManagerAbi : fPoolManagerAbi;
|
|
26
|
-
return
|
|
65
|
+
return write(c, address, abi, "proposeCollector", [next]);
|
|
27
66
|
}
|
|
28
67
|
export async function acceptCollector(c, side) {
|
|
29
68
|
const address = side === "C" ? c.addresses.cPoolManager : c.addresses.fPoolManager;
|
|
30
69
|
const abi = side === "C" ? cPoolManagerAbi : fPoolManagerAbi;
|
|
31
|
-
return
|
|
70
|
+
return write(c, address, abi, "acceptCollector", []);
|
|
32
71
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -21,6 +21,14 @@ export interface LogswapAddresses {
|
|
|
21
21
|
* deployment predating it will not carry the address; every F-pool call needs it.
|
|
22
22
|
*/
|
|
23
23
|
fPoolManager?: Address;
|
|
24
|
+
/**
|
|
25
|
+
* The protocol's four F hooks, one per kind (decisions 044): every F pool names one in its key,
|
|
26
|
+
* and the pool's roles, gates and terms live on it. A deployment predating them carries none.
|
|
27
|
+
*/
|
|
28
|
+
publicHook?: Address;
|
|
29
|
+
privateHook?: Address;
|
|
30
|
+
polHook?: Address;
|
|
31
|
+
padHook?: Address;
|
|
24
32
|
/** Optional — the router falls back to plain approvals when absent. */
|
|
25
33
|
permit2?: Address;
|
|
26
34
|
}
|
|
@@ -51,8 +59,13 @@ export declare function createLogswapClient(args: {
|
|
|
51
59
|
* **3** since 2026-09-03 (contracts `d8406fb`): `burnById` and `update` take an `owner`, `update`
|
|
52
60
|
* mints to `to`, `positions()` returns `aps` as uint128 — and a returned quote flow now carries the
|
|
53
61
|
* swept fees (decisions 018), which is why `exit`'s settle-to-one-asset math changed with it.
|
|
62
|
+
*
|
|
63
|
+
* **4** since 2026-09-18 (decisions 042 + 040): `PoolKey` is `(base, quote, tickSpacing, phi)` —
|
|
64
|
+
* the variance kernel and its two key fields are gone, so every pool id changed; `phiEff` is
|
|
65
|
+
* `phiOf`; `getPool` lost `sigma2Ema`; `Initialize` lost two fields; the cut is
|
|
66
|
+
* `MINT_FEE_PROTOCOL_CUT` / `setFeeParams`.
|
|
54
67
|
*/
|
|
55
|
-
export declare const EXPECTED_VERSION =
|
|
68
|
+
export declare const EXPECTED_VERSION = 4n;
|
|
56
69
|
/**
|
|
57
70
|
* The F manager's own tag (contracts 25a7bcf: 5 — the key's salt, pool names, the sponsor registry;
|
|
58
71
|
* 4 was the income-only harvest cut).
|
|
@@ -64,5 +77,5 @@ export declare const EXPECTED_VERSION = 3n;
|
|
|
64
77
|
* passes it; when one lands, raise this constant in the same change, which is the discipline
|
|
65
78
|
* `EXPECTED_VERSION` enforces mechanically and this one asks for.
|
|
66
79
|
*/
|
|
67
|
-
export declare const EXPECTED_F_VERSION =
|
|
80
|
+
export declare const EXPECTED_F_VERSION = 15n;
|
|
68
81
|
export declare function assertVersion(c: LogswapClient, expected?: bigint): Promise<void>;
|
package/dist/client.js
CHANGED
|
@@ -27,8 +27,13 @@ export function createLogswapClient(args) {
|
|
|
27
27
|
* **3** since 2026-09-03 (contracts `d8406fb`): `burnById` and `update` take an `owner`, `update`
|
|
28
28
|
* mints to `to`, `positions()` returns `aps` as uint128 — and a returned quote flow now carries the
|
|
29
29
|
* swept fees (decisions 018), which is why `exit`'s settle-to-one-asset math changed with it.
|
|
30
|
+
*
|
|
31
|
+
* **4** since 2026-09-18 (decisions 042 + 040): `PoolKey` is `(base, quote, tickSpacing, phi)` —
|
|
32
|
+
* the variance kernel and its two key fields are gone, so every pool id changed; `phiEff` is
|
|
33
|
+
* `phiOf`; `getPool` lost `sigma2Ema`; `Initialize` lost two fields; the cut is
|
|
34
|
+
* `MINT_FEE_PROTOCOL_CUT` / `setFeeParams`.
|
|
30
35
|
*/
|
|
31
|
-
export const EXPECTED_VERSION =
|
|
36
|
+
export const EXPECTED_VERSION = 4n;
|
|
32
37
|
/**
|
|
33
38
|
* The F manager's own tag (contracts 25a7bcf: 5 — the key's salt, pool names, the sponsor registry;
|
|
34
39
|
* 4 was the income-only harvest cut).
|
|
@@ -66,7 +71,16 @@ export const EXPECTED_VERSION = 3n;
|
|
|
66
71
|
// is voided by the handover of the role that granted it); `setLegs` needs a generation to have
|
|
67
72
|
// lived (`gen > 0`); `initialize` refuses a codeless base and `mint` refuses `to = address(0)`
|
|
68
73
|
// on both managers. Layout unchanged.
|
|
69
|
-
|
|
74
|
+
// 14 (2026-09-20): the hook (decisions 041) — `FPoolKey.hook`, every pool id moves; `dissolve` is
|
|
75
|
+
// `retire`, `regenerate` releases the dead shares' pot, `harvestable`/`unharvested` are the
|
|
76
|
+
// readouts; `feePerL`, `edgePerL`, `HARVEST_PROTOCOL_CUT`, `harvestCutExempt` are gone.
|
|
77
|
+
// 15 (2026-09-20): the hook answers every question (decisions 044) — `FPoolKey.authority` is
|
|
78
|
+
// `creator` (every pool id moves again); the roles, gates and list are the pool's HOOK's
|
|
79
|
+
// (`FHookBase` / `PrivateHook`), not the manager's: `getPool` has `hook` and `asks` and no
|
|
80
|
+
// role; `proposeAuthority`, `appointOperator`, `setGates`, `setAllowed` are hook writes;
|
|
81
|
+
// `hookApproved(kind, hook)` / `setHookApproved(kind, hook, ok)`; `Regenerated` names the payee;
|
|
82
|
+
// `HARVEST_CUT_MAX` / `POT_CUT_MAX` cap what a hook may route to the protocol.
|
|
83
|
+
export const EXPECTED_F_VERSION = 15n;
|
|
70
84
|
export async function assertVersion(c, expected = EXPECTED_VERSION) {
|
|
71
85
|
const { cPoolManagerAbi } = await import("./generated.js");
|
|
72
86
|
const got = await c.public.readContract({
|