@logswap/sdk 0.5.47 → 0.5.49

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/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 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.
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 hook's answer at every harvest (decisions
9
- * 044), set on the hook (`setHarvestCut`) and capped by the manager (`HARVEST_CUT_MAX`); 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, padHookAbi, polHookAbi, publicHookAbi } from "./generated.js";
16
- import { F_KIND, fHookBaseAbi, type FPoolKind } from "./fpool.js";
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 hook 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 hook.
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 setHookApproved(c: LogswapClient, kind: FPoolKind, hook: Address, approved: boolean): Promise<Hash> {
41
- return write(c, c.addresses.fPoolManager as Address, fPoolManagerAbi, "setHookApproved", [F_KIND[kind], hook, approved]);
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 `hook` is approved for pools of `kind`. */
45
- export async function hookApproved(c: LogswapClient, kind: FPoolKind, hook: Address): Promise<boolean> {
46
- return c.public.readContract({ address: c.addresses.fPoolManager as Address, abi: fPoolManagerAbi, functionName: "hookApproved", args: [F_KIND[kind], hook] } as never) as Promise<boolean>;
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 hooks' numbers (the collector's; each bounded where it reaches the manager) ─────
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 `hook`, WAD ≤ `HARVEST_CUT_MAX`. */
52
- export async function setHarvestCut(c: LogswapClient, hook: Address, rateWad: bigint): Promise<Hash> {
53
- return write(c, hook, fHookBaseAbi, "setHarvestCut", [rateWad]);
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
- /** `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`). */
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
- hook: Address,
59
+ policy: Address,
60
60
  s: { thresholdBase: bigint; thresholdGrowth: bigint; creatorShare: bigint; protocolShare: bigint; burnPerRung: bigint },
61
61
  ): Promise<Hash> {
62
- return write(c, hook, padHookAbi, "setSchedule", [s.thresholdBase, s.thresholdGrowth, s.creatorShare, s.protocolShare, s.burnPerRung]);
62
+ return write(c, policy, padPolicyAbi, "setSchedule", [s.thresholdBase, s.thresholdGrowth, s.creatorShare, s.protocolShare, s.burnPerRung]);
63
63
  }
64
64
 
65
- /** `PolHook.setPolicy`: what every harvest leaves in the bid and what a relaunch's seed must bring, WAD fractions of L. */
66
- export async function polSetPolicy(c: LogswapClient, hook: Address, s: { keepQuote: bigint; minQuoteAtSeed: bigint }): Promise<Hash> {
67
- return write(c, hook, polHookAbi, "setPolicy", [s.keepQuote, s.minQuoteAtSeed]);
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
- /** `PublicHook.setListed`: an asset a curated seed may hold. */
71
- export async function publicSetListed(c: LogswapClient, hook: Address, token: Address, listed: boolean): Promise<Hash> {
72
- return write(c, hook, publicHookAbi, "setListed", [token, listed]);
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
- /** `PublicHook.setCurated`: whether every public seed is checked against the list. */
76
- export async function publicSetCurated(c: LogswapClient, hook: Address, curated: boolean): Promise<Hash> {
77
- return write(c, hook, publicHookAbi, "setCurated", [curated]);
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 hooks, one per kind (decisions 044): every F pool names one in its key,
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
- publicHook?: Address;
31
- privateHook?: Address;
32
- polHook?: Address;
33
- padHook?: Address;
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 hook (decisions 041) — `FPoolKey.hook`, every pool id moves; `dissolve` is
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 hook answers every question (decisions 044) — `FPoolKey.authority` is
117
- // `creator` (every pool id moves again); the roles, gates and list are the pool's HOOK's
118
- // (`FHookBase` / `PrivateHook`), not the manager's: `getPool` has `hook` and `asks` and no
119
- // role; `proposeAuthority`, `appointOperator`, `setGates`, `setAllowed` are hook writes;
120
- // `hookApproved(kind, hook)` / `setHookApproved(kind, hook, ok)`; `Regenerated` names the payee;
121
- // `HARVEST_CUT_MAX` / `POT_CUT_MAX` cap what a hook may route to the protocol.
122
- export const EXPECTED_F_VERSION = 15n;
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");