@logswap/sdk 0.5.46 → 0.5.48
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/admin.d.ts +19 -19
- package/dist/admin.js +29 -29
- package/dist/client.d.ts +6 -6
- package/dist/client.js +11 -8
- package/dist/fpool.d.ts +82 -82
- package/dist/fpool.js +99 -99
- package/dist/generated.d.ts +103 -103
- package/dist/generated.js +132 -79
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/admin.ts +29 -29
- package/src/client.ts +16 -13
- package/src/fpool.ts +133 -133
- package/src/generated.ts +132 -79
- package/src/index.ts +1 -1
package/src/admin.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* admin — the protocol's (feeCollector's) writes: the protocol's cut of the mint fee on both
|
|
3
|
-
* managers, the
|
|
4
|
-
* two-step collector handover. Plain writes to the managers and the
|
|
3
|
+
* managers, the policies a pool of each kind may be born with, the policies' own numbers, and the
|
|
4
|
+
* two-step collector handover. Plain writes to the managers and the policies; no router.
|
|
5
5
|
*
|
|
6
6
|
* One vocabulary (decisions 040): both managers call the protocol's cut of the mint fee
|
|
7
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
|
|
9
|
-
* 044), set on the
|
|
8
|
+
* version 4 / F version 14. The harvest's cut is the policy's answer at every harvest (decisions
|
|
9
|
+
* 044), set on the policy (`setHarvestCut`) and capped by the manager (`HARVEST_CUT_MAX`); the
|
|
10
10
|
* release's protocol share likewise (`POT_CUT_MAX`).
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type { Address, Hash } from "viem";
|
|
14
14
|
import type { LogswapClient } from "./client.js";
|
|
15
|
-
import { cPoolManagerAbi, fPoolManagerAbi,
|
|
16
|
-
import { F_KIND,
|
|
15
|
+
import { cPoolManagerAbi, fPoolManagerAbi, padPolicyAbi, polPolicyAbi, publicPolicyAbi } from "./generated.js";
|
|
16
|
+
import { F_KIND, fPolicyBaseAbi, type FPoolKind } from "./fpool.js";
|
|
17
17
|
|
|
18
18
|
function wallet(c: LogswapClient) {
|
|
19
19
|
if (!c.wallet) throw new Error("a wallet client is required");
|
|
@@ -34,47 +34,47 @@ export async function setFeeParams(c: LogswapClient, mintFeeProtocolCutWad: bigi
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Approve a
|
|
38
|
-
* 044). Read at `initialize` and never again: a live pool keeps its
|
|
37
|
+
* Approve a policy for pools of `kind` to be born with, or withdraw the approval (decisions 041,
|
|
38
|
+
* 044). Read at `initialize` and never again: a live pool keeps its policy.
|
|
39
39
|
*/
|
|
40
|
-
export async function
|
|
41
|
-
return write(c, c.addresses.fPoolManager as Address, fPoolManagerAbi, "
|
|
40
|
+
export async function setPolicyApproved(c: LogswapClient, kind: FPoolKind, policy: Address, approved: boolean): Promise<Hash> {
|
|
41
|
+
return write(c, c.addresses.fPoolManager as Address, fPoolManagerAbi, "setPolicyApproved", [F_KIND[kind], policy, approved]);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
/** Whether `
|
|
45
|
-
export async function
|
|
46
|
-
return c.public.readContract({ address: c.addresses.fPoolManager as Address, abi: fPoolManagerAbi, functionName: "
|
|
44
|
+
/** Whether `policy` is approved for pools of `kind`. */
|
|
45
|
+
export async function policyApproved(c: LogswapClient, kind: FPoolKind, policy: Address): Promise<boolean> {
|
|
46
|
+
return c.public.readContract({ address: c.addresses.fPoolManager as Address, abi: fPoolManagerAbi, functionName: "policyApproved", args: [F_KIND[kind], policy] } as never) as Promise<boolean>;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// ─── the
|
|
49
|
+
// ─── the policies' numbers (the collector's; each bounded where it reaches the manager) ─────
|
|
50
50
|
|
|
51
|
-
/** The protocol's rate on the income part of every harvest under `
|
|
52
|
-
export async function setHarvestCut(c: LogswapClient,
|
|
53
|
-
return write(c,
|
|
51
|
+
/** The protocol's rate on the income part of every harvest under `policy`, WAD ≤ `HARVEST_CUT_MAX`. */
|
|
52
|
+
export async function setHarvestCut(c: LogswapClient, policy: Address, rateWad: bigint): Promise<Hash> {
|
|
53
|
+
return write(c, policy, fPolicyBaseAbi, "setHarvestCut", [rateWad]);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/** `
|
|
56
|
+
/** `PadPolicy.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`). */
|
|
57
57
|
export async function padSetSchedule(
|
|
58
58
|
c: LogswapClient,
|
|
59
|
-
|
|
59
|
+
policy: Address,
|
|
60
60
|
s: { thresholdBase: bigint; thresholdGrowth: bigint; creatorShare: bigint; protocolShare: bigint; burnPerRung: bigint },
|
|
61
61
|
): Promise<Hash> {
|
|
62
|
-
return write(c,
|
|
62
|
+
return write(c, policy, padPolicyAbi, "setSchedule", [s.thresholdBase, s.thresholdGrowth, s.creatorShare, s.protocolShare, s.burnPerRung]);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/** `
|
|
66
|
-
export async function
|
|
67
|
-
return write(c,
|
|
65
|
+
/** `PolPolicy.setRules`: what every harvest leaves in the bid and what a relaunch's seed must bring, WAD fractions of L. */
|
|
66
|
+
export async function polSetRules(c: LogswapClient, policy: Address, s: { keepQuote: bigint; minQuoteAtSeed: bigint }): Promise<Hash> {
|
|
67
|
+
return write(c, policy, polPolicyAbi, "setRules", [s.keepQuote, s.minQuoteAtSeed]);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/** `
|
|
71
|
-
export async function publicSetListed(c: LogswapClient,
|
|
72
|
-
return write(c,
|
|
70
|
+
/** `PublicPolicy.setListed`: an asset a curated seed may hold. */
|
|
71
|
+
export async function publicSetListed(c: LogswapClient, policy: Address, token: Address, listed: boolean): Promise<Hash> {
|
|
72
|
+
return write(c, policy, publicPolicyAbi, "setListed", [token, listed]);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
/** `
|
|
76
|
-
export async function publicSetCurated(c: LogswapClient,
|
|
77
|
-
return write(c,
|
|
75
|
+
/** `PublicPolicy.setCurated`: whether every public seed is checked against the list. */
|
|
76
|
+
export async function publicSetCurated(c: LogswapClient, policy: Address, curated: boolean): Promise<Hash> {
|
|
77
|
+
return write(c, policy, publicPolicyAbi, "setCurated", [curated]);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export async function proposeCollector(c: LogswapClient, side: "C" | "F", next: Address): Promise<Hash> {
|
package/src/client.ts
CHANGED
|
@@ -24,13 +24,13 @@ export interface LogswapAddresses {
|
|
|
24
24
|
*/
|
|
25
25
|
fPoolManager?: Address;
|
|
26
26
|
/**
|
|
27
|
-
* The protocol's four F
|
|
27
|
+
* The protocol's four F policies, one per kind (decisions 044): every F pool names one in its key,
|
|
28
28
|
* and the pool's roles, gates and terms live on it. A deployment predating them carries none.
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
publicPolicy?: Address;
|
|
31
|
+
privatePolicy?: Address;
|
|
32
|
+
polPolicy?: Address;
|
|
33
|
+
padPolicy?: Address;
|
|
34
34
|
/** Optional — the router falls back to plain approvals when absent. */
|
|
35
35
|
permit2?: Address;
|
|
36
36
|
}
|
|
@@ -110,16 +110,19 @@ export const EXPECTED_VERSION = 4n;
|
|
|
110
110
|
// is voided by the handover of the role that granted it); `setLegs` needs a generation to have
|
|
111
111
|
// lived (`gen > 0`); `initialize` refuses a codeless base and `mint` refuses `to = address(0)`
|
|
112
112
|
// on both managers. Layout unchanged.
|
|
113
|
-
// 14 (2026-09-20): the
|
|
113
|
+
// 14 (2026-09-20): the policy (decisions 041) — `FPoolKey.policy`, every pool id moves; `dissolve` is
|
|
114
114
|
// `retire`, `regenerate` releases the dead shares' pot, `harvestable`/`unharvested` are the
|
|
115
115
|
// readouts; `feePerL`, `edgePerL`, `HARVEST_PROTOCOL_CUT`, `harvestCutExempt` are gone.
|
|
116
|
-
// 15 (2026-09-20): the
|
|
117
|
-
// `creator` (every pool id moves again); the roles, gates and list are the pool's
|
|
118
|
-
// (`
|
|
119
|
-
// role; `proposeAuthority`, `appointOperator`, `setGates`, `setAllowed` are
|
|
120
|
-
// `
|
|
121
|
-
// `HARVEST_CUT_MAX` / `POT_CUT_MAX` cap what a
|
|
122
|
-
|
|
116
|
+
// 15 (2026-09-20): the policy answers every question (decisions 044) — `FPoolKey.authority` is
|
|
117
|
+
// `creator` (every pool id moves again); the roles, gates and list are the pool's POLICY's
|
|
118
|
+
// (`FPolicyBase` / `PrivatePolicy`), not the manager's: `getPool` has `policy` and `asks` and no
|
|
119
|
+
// role; `proposeAuthority`, `appointOperator`, `setGates`, `setAllowed` are policy writes;
|
|
120
|
+
// `policyApproved(kind, policy)` / `setPolicyApproved(kind, policy, ok)`; `Regenerated` names the payee;
|
|
121
|
+
// `HARVEST_CUT_MAX` / `POT_CUT_MAX` cap what a policy may route to the protocol.
|
|
122
|
+
// 16 (2026-09-21): the word is POLICY (decisions 045) — a rename, no pool id moves: `FPoolKey.policy`,
|
|
123
|
+
// `IFPolicy`, `FPolicyBase`, `PublicPolicy` … `PadPolicy`, `policyApproved` / `setPolicyApproved`,
|
|
124
|
+
// `PolicyApproved`; `PolPolicy.setPolicy` / `PolicySet` are `setRules` / `RulesSet`.
|
|
125
|
+
export const EXPECTED_F_VERSION = 16n;
|
|
123
126
|
|
|
124
127
|
export async function assertVersion(c: LogswapClient, expected = EXPECTED_VERSION): Promise<void> {
|
|
125
128
|
const { cPoolManagerAbi } = await import("./generated.js");
|