@logswap/sdk 0.5.91 → 0.5.92
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 +61 -18
- package/dist/admin.d.ts +48 -871
- package/dist/admin.js +55 -110
- package/dist/chains.d.ts +4 -4
- package/dist/chains.js +2 -3
- package/dist/client.d.ts +6 -7
- package/dist/client.js +12 -1
- package/dist/fpool.d.ts +298 -801
- package/dist/fpool.js +312 -336
- package/dist/generated.d.ts +1707 -3843
- package/dist/generated.js +982 -2248
- package/dist/history.js +7 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/write.js +2 -2
- package/package.json +1 -1
- package/src/admin.ts +66 -169
- package/src/chains.ts +6 -7
- package/src/client.ts +17 -7
- package/src/fpool.ts +449 -510
- package/src/generated.ts +938 -2210
- package/src/history.ts +5 -7
- package/src/index.ts +1 -1
- package/src/write.ts +2 -2
package/dist/admin.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* admin — the protocol's writes: the policies a pool may be born
|
|
3
|
-
* creation modes
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* admin — the protocol's writes: the policies a pool may be born under (the registry's list, its sunsets), the C manager's
|
|
3
|
+
* creation modes, the two roles' two-step handovers (decision 066): the LOG Authority (the registry's `logAuthority`)
|
|
4
|
+
* administers the registry and both managers; the LOG Treasury (`treasury` on each manager) only receives, and is replaced by
|
|
5
|
+
* the authority's `proposeTreasury`. Plain writes to the managers and the registry; no router.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* The policies are immutable and deployed by the LOG (decision 098; policy.md): a policy has no setter of its numbers — its fee
|
|
8
|
+
* mask, quotes, bases, buffer, tax and cap bound are constructor immutables — so there is no wrapper that writes one. A change is
|
|
9
|
+
* a new policy, approved ({@link registryApprove}); the old one is sunset ({@link registrySunset}) and its pools run to their next
|
|
10
|
+
* close. The key's policy is the pool's for life: the registry's `migrate` and `orphan` are gone (F 41). What remains here for the
|
|
11
|
+
* policies is reading their numbers; their per-pool settings are in `fpool.ts`.
|
|
10
12
|
*
|
|
11
|
-
* The mint fee has no cut to set since C version 6 / F version 24 (decisions 058): the whole fee
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* The mint fee has no cut to set since C version 6 / F version 24 (decisions 058): the whole fee is the protocol's on both
|
|
14
|
+
* managers. A harvest has no cut (056); the protocol's share of a harvest's income is the policy's `incomeTaxRate` on the
|
|
15
|
+
* payer's slice, capped by the manager at `INCOME_TAX_MAX`.
|
|
14
16
|
*/
|
|
15
17
|
import { poolId as keyId } from "./keys.js";
|
|
16
18
|
import { managerC, routerC } from "./client.js";
|
|
17
19
|
import { getPool } from "./pools.js";
|
|
18
|
-
import { managerCAbi, managerFAbi,
|
|
19
|
-
import { bytes32ToText,
|
|
20
|
+
import { managerCAbi, managerFAbi, policyFAbi, policyRegistryAbi, sponsorPolicyCAbi } from "./generated.js";
|
|
21
|
+
import { bytes32ToText, fFeeListed, fPoolKindOfPolicy, fPolicyTermsOf, textToBytes32 } from "./fpool.js";
|
|
20
22
|
function wallet(c) {
|
|
21
23
|
if (!c.wallet)
|
|
22
24
|
throw new Error("a wallet client is required");
|
|
@@ -66,9 +68,9 @@ export async function policyApproved(c, policy) {
|
|
|
66
68
|
return c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "isApproved", args: [policy] });
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
69
|
-
* Every policy listed, sunset ones included — one flat list, each with the kind
|
|
70
|
-
*
|
|
71
|
-
* with no registry.
|
|
71
|
+
* Every policy listed, sunset ones included — one flat list, each with the kind its terms spell; `kind` narrows it to one,
|
|
72
|
+
* which is what a create form's dropdown reads. The registry is one list for both managers: a C policy is on it with `kind`
|
|
73
|
+
* `null`. Empty with no registry.
|
|
72
74
|
*/
|
|
73
75
|
export async function registryPolicies(c, kind) {
|
|
74
76
|
const registry = await policyRegistryOf(c);
|
|
@@ -80,7 +82,7 @@ export async function registryPolicies(c, kind) {
|
|
|
80
82
|
const all = await Promise.all(list.map(async (policy) => {
|
|
81
83
|
const [[listed, until, , name], tag] = await Promise.all([
|
|
82
84
|
c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "entries", args: [policy] }),
|
|
83
|
-
fPoolKindOfPolicy(c, policy),
|
|
85
|
+
fPoolKindOfPolicy(c, policy).catch(() => null), // a C policy answers no F terms
|
|
84
86
|
]);
|
|
85
87
|
return { policy, kind: tag, name: bytes32ToText(name), until, approved: listed && (until === 0n || now < until) };
|
|
86
88
|
}));
|
|
@@ -144,58 +146,12 @@ export const registryAcceptOwner = acceptLogAuthority;
|
|
|
144
146
|
* {@link registryApprove} under the policy's own tag as its name, false is {@link registryRevoke}.
|
|
145
147
|
*/
|
|
146
148
|
export async function setPolicyApproved(c, policy, approved) {
|
|
147
|
-
return approved ? registryApprove(c, policy, await fPoolKindOfPolicy(c, policy)) : registryRevoke(c, policy);
|
|
148
|
-
}
|
|
149
|
-
function permissionsArg(p = {}) {
|
|
150
|
-
return { swapMode: fPoolSwapModes.indexOf(p.swapMode ?? "open"), operator: p.operator ?? ZERO, mintGated: p.mintGated ?? false, listed: p.listed ?? [] };
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Move a pool to another approved policy of the same kind: the LOG Authority's alone, a forced move
|
|
154
|
-
* (adoption at regeneration by the pool authority's consent is specified, not built — logswap-docs
|
|
155
|
-
* `specs/governance/policy-adoption.md`), orchestrated on the registry — `migrate(manager, key, to, permissions)`
|
|
156
|
-
* (decision 098; `migratePrivate` is gone). The registry checks the key against the manager (`NoPool`), the manager is its
|
|
157
|
-
* own (`WrongManager`), the two policies' tags recorded at approval ({@link registryKindOf}; every sponsored policy shares
|
|
158
|
-
* `"sponsor"`), the creation mode against the pool's authority (`SponsorOnly`: a sponsor's pool moves only under a policy of
|
|
159
|
-
* the same sponsor, or one open to anyone) and that the pool never held the target (`AlreadyHeld`). The new policy is
|
|
160
|
-
* brought the authority and the name (read off the old policy defensively, the key's creator standing in when it cannot
|
|
161
|
-
* answer); `permissions` installs the pool's swap mode, operator, mint gate and whitelist under it in the same transaction ({@link MigrationPermissions});
|
|
162
|
-
* the key, its fees and its id are untouched; no swap lands in the block. F only until C ships a `setPolicy`.
|
|
163
|
-
*
|
|
164
|
-
* Pass the pool's `key` when in hand. Given only `poolId`, the key is rebuilt from the pool's
|
|
165
|
-
* `PoolCreated` log ({@link fPoolKeyOfPool}) with `salt` (zero by default) and checked against
|
|
166
|
-
* the id — the log does not carry the salt, so a salted pool needs it named.
|
|
167
|
-
*/
|
|
168
|
-
export async function fPoolMigrate(c, a) {
|
|
169
|
-
const key = "key" in a ? a.key : await fPoolKeyOfPool(c, a.poolId, { salt: a.salt, fromBlock: a.fromBlock });
|
|
170
|
-
return registryWrite(c, "migrate", [c.addresses.managerF, key, a.to, permissionsArg(a.permissions)]);
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* `PolicyRegistry.orphan(manager, key)` (decision 098): move a pool whose sponsor went rogue or lost its key to the manager's orphan policy
|
|
174
|
-
* ({@link registryOrphanPolicyOf}) — no owner and no setting; swap and mint open; `deployLiquidity`, `harvest`, `close` and the generation
|
|
175
|
-
* step refused; income tax zero. The LOG Authority's alone, needing no consent, and FINAL: a pool never leaves the orphan policy (`Orphaned`).
|
|
176
|
-
* `key` as in {@link fPoolMigrate}.
|
|
177
|
-
*/
|
|
178
|
-
export async function fPoolOrphan(c, a) {
|
|
179
|
-
const key = "key" in a ? a.key : await fPoolKeyOfPool(c, a.poolId, { salt: a.salt, fromBlock: a.fromBlock });
|
|
180
|
-
return registryWrite(c, "orphan", [c.addresses.managerF, key]);
|
|
181
|
-
}
|
|
182
|
-
/** The orphan policy registered for a manager (`orphanPolicy(manager)`): F's by default; zero when none is registered or the deployment has no registry. */
|
|
183
|
-
export async function registryOrphanPolicyOf(c, side = "F") {
|
|
184
|
-
const registry = await policyRegistryOf(c);
|
|
185
|
-
if (registry === ZERO)
|
|
186
|
-
return ZERO;
|
|
187
|
-
const mgr = side === "C" ? managerC(c) : c.addresses.managerF;
|
|
188
|
-
return (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "orphanPolicy", args: [mgr] }));
|
|
189
|
-
}
|
|
190
|
-
/** `PolicyRegistry.setOrphanPolicy(manager, policy)`: register the approved policy tagged `"orphan"` that answers `manager` (F's by default). The LOG Authority's. */
|
|
191
|
-
export async function registrySetOrphanPolicy(c, policy, side = "F") {
|
|
192
|
-
const mgr = side === "C" ? managerC(c) : c.addresses.managerF;
|
|
193
|
-
return registryWrite(c, "setOrphanPolicy", [mgr, policy]);
|
|
149
|
+
return approved ? registryApprove(c, policy, await fPoolKindOfPolicy(c, policy).catch(() => "policy")) : registryRevoke(c, policy);
|
|
194
150
|
}
|
|
195
151
|
/**
|
|
196
|
-
* The
|
|
197
|
-
* on re-approval and kept after a revoke
|
|
198
|
-
*
|
|
152
|
+
* The name the registry recorded for `policy` at approval (`kindOf`, F version 20: `approve(policy, name)`'s word) — refreshed
|
|
153
|
+
* on re-approval and kept after a revoke. The LOG's own instances are approved as `public`, `private`, `pol`, `pad`; what a
|
|
154
|
+
* policy IS is its terms ({@link fPolicyTermsOf}). "" for a policy the registry never approved (or a deployment with no registry).
|
|
199
155
|
*/
|
|
200
156
|
export async function registryKindOf(c, policy) {
|
|
201
157
|
const registry = await policyRegistryOf(c);
|
|
@@ -204,46 +160,33 @@ export async function registryKindOf(c, policy) {
|
|
|
204
160
|
const word = (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "kindOf", args: [policy] }));
|
|
205
161
|
return bytes32ToText(word);
|
|
206
162
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const [set, base] = await Promise.all([rd("thresholdSet", quote), rd("thresholdBaseOf", quote)]);
|
|
212
|
-
return { quote, set, base };
|
|
213
|
-
}));
|
|
214
|
-
}
|
|
215
|
-
/** `PadPolicy.thresholdOf(quote, rung)` (decision 070): the income a pad quoted in `quote` must bank to climb `rung` (0 reads `T(0)`). */
|
|
216
|
-
export async function padThresholdOf(c, policy, quote, rung = 0n) {
|
|
217
|
-
return (await c.public.readContract({ address: policy, abi: padPolicyAbi, functionName: "thresholdOf", args: [quote, BigInt(rung)] }));
|
|
218
|
-
}
|
|
219
|
-
/** `PadPolicy.threshold(poolId, rung)` (decision 070): the income pad `poolId` must bank to climb `rung`, in its own quote. */
|
|
220
|
-
export async function padThreshold(c, policy, poolId, rung) {
|
|
221
|
-
return (await c.public.readContract({ address: policy, abi: padPolicyAbi, functionName: "threshold", args: [poolId, BigInt(rung)] }));
|
|
222
|
-
}
|
|
223
|
-
/** Read {@link PadSchedule} off a pad policy. */
|
|
224
|
-
export async function padScheduleOf(c, policy) {
|
|
225
|
-
const rd = (functionName) => c.public.readContract({ address: policy, abi: padPolicyAbi, functionName });
|
|
226
|
-
const [thresholdGrowth, creatorShareMin, creatorShareMax] = await Promise.all([rd("thresholdGrowth"), rd("creatorShareMin"), rd("creatorShareMax")]);
|
|
227
|
-
return { thresholdGrowth, creatorShareMin, creatorShareMax };
|
|
228
|
-
}
|
|
229
|
-
/** Whether `quote` passes a sponsored `policy`'s birth check now: it curates quotes (`quoteCurated`, a non-empty list set in the constructor) and lists it, or it does not curate. */
|
|
163
|
+
// ─── the F policy's lists: immutable, so read-only here (policy.md §4.1) ─────
|
|
164
|
+
// The quotes a pool may be born on, the bases it may hold and the fee entries it may use are constructor values of the
|
|
165
|
+
// policy the LOG deploys. The whole set of numbers is `fPolicyTermsOf`; these answer one candidate.
|
|
166
|
+
/** Whether `quote` passes an F `policy`'s birth check now: it curates quotes (`quoteCurated`, a non-empty list set in the constructor) and lists it, or it does not curate. */
|
|
230
167
|
export async function policyQuoteAllowed(c, policy, quote) {
|
|
231
168
|
const [curated, listed] = await Promise.all([
|
|
232
|
-
c.public.readContract({ address: policy, abi:
|
|
233
|
-
c.public.readContract({ address: policy, abi:
|
|
169
|
+
c.public.readContract({ address: policy, abi: policyFAbi, functionName: "quoteCurated" }),
|
|
170
|
+
c.public.readContract({ address: policy, abi: policyFAbi, functionName: "quoteListed", args: [quote] }),
|
|
171
|
+
]);
|
|
172
|
+
return { curated, listed, allowed: !curated || listed };
|
|
173
|
+
}
|
|
174
|
+
/** Whether `base` passes an F `policy`'s birth check now: it curates bases (`baseCurated`) and lists it, or it does not curate. */
|
|
175
|
+
export async function policyBaseAllowed(c, policy, base) {
|
|
176
|
+
const [curated, listed] = await Promise.all([
|
|
177
|
+
c.public.readContract({ address: policy, abi: policyFAbi, functionName: "baseCurated" }),
|
|
178
|
+
c.public.readContract({ address: policy, abi: policyFAbi, functionName: "baseListed", args: [base] }),
|
|
234
179
|
]);
|
|
235
180
|
return { curated, listed, allowed: !curated || listed };
|
|
236
181
|
}
|
|
237
182
|
/**
|
|
238
|
-
* Whether
|
|
239
|
-
*
|
|
183
|
+
* Whether the swap fee at `swapFeeIdx` of the F fee list passes `policy`'s birth check now (`feeMask`, policy.md §6). `curated` is true
|
|
184
|
+
* when the policy masks the list (a non-zero mask); with none, every entry is allowed. The mint fee follows the swap fee and is not asked.
|
|
240
185
|
*/
|
|
241
|
-
export async function policyFeeAllowed(c, policy,
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
]);
|
|
246
|
-
return { curated: tiers !== 0n, listed, allowed: listed };
|
|
186
|
+
export async function policyFeeAllowed(c, policy, swapFeeIdx) {
|
|
187
|
+
const { feeMask } = await fPolicyTermsOf(c, policy);
|
|
188
|
+
const listed = fFeeListed(feeMask, swapFeeIdx);
|
|
189
|
+
return { curated: feeMask !== 0, listed, allowed: listed };
|
|
247
190
|
}
|
|
248
191
|
const CREATION_MODES = ["open", "sponsorOnly"];
|
|
249
192
|
/** `PolicyRegistry.setCreationMode(policy, mode)` (the LOG Authority). A sponsored policy is approved `sponsorOnly`. */
|
|
@@ -321,17 +264,19 @@ export async function cGateRules(c, a) {
|
|
|
321
264
|
};
|
|
322
265
|
return { ...r, admitted: r.creatorOk && r.quoteOk && r.feeOk && r.mintFeeOk && r.spacingOk && r.saltOk && !r.exists };
|
|
323
266
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
];
|
|
267
|
+
const isAbiError = (x) => x.type === "error";
|
|
268
|
+
export const gateErrorAbi = (() => {
|
|
269
|
+
const seen = new Set();
|
|
270
|
+
const sig = (x) => `${x.name}(${x.inputs.map((i) => i.type).join(",")})`;
|
|
271
|
+
const all = (abi) => abi.filter(isAbiError);
|
|
272
|
+
const errors = [
|
|
273
|
+
...all(sponsorPolicyCAbi),
|
|
274
|
+
...all(policyFAbi),
|
|
275
|
+
// creation admission is the registry's (F 33 / C 10, 073): a refusal there surfaces through the manager's birth
|
|
276
|
+
...all(policyRegistryAbi).filter((x) => ["SponsorOnly", "InvalidForwardedUser", "NotListed"].includes(x.name)),
|
|
277
|
+
];
|
|
278
|
+
return errors.filter((x) => (seen.has(sig(x)) ? false : (seen.add(sig(x)), true)));
|
|
279
|
+
})();
|
|
335
280
|
// ─── the LOG Treasury (066): receives, administers nothing ───────────────────
|
|
336
281
|
function manager(c, side) {
|
|
337
282
|
return side === "C" ? { address: managerC(c), abi: managerCAbi } : { address: c.addresses.managerF, abi: managerFAbi };
|
package/dist/chains.d.ts
CHANGED
|
@@ -131,16 +131,16 @@ export interface LogswapDeployment {
|
|
|
131
131
|
managerC?: Address;
|
|
132
132
|
routerC?: Address;
|
|
133
133
|
lensC?: Address;
|
|
134
|
-
/** The LOG's open
|
|
134
|
+
/** The LOG's open F policy (`PolicyF`, `open`: anyone creates at salt zero, no gate ever; policy.md). */
|
|
135
135
|
publicPolicy: Address;
|
|
136
|
-
/** The LOG's
|
|
136
|
+
/** The LOG's desk on F (`PolicyF`, closed: the LOG creates, gates by pool). The artifact key predates 098 and is kept. */
|
|
137
137
|
privatePolicy: Address;
|
|
138
|
+
/** The LOG's POL policy on F (`PolicyF`: one base, a bid buffer, an income tax). */
|
|
138
139
|
polPolicy: Address;
|
|
140
|
+
/** The LOG's pad policy on F (`PolicyF`, `seedToDead`: income-only harvests, never closes). */
|
|
139
141
|
padPolicy: Address;
|
|
140
142
|
/** The LOG's open sponsored instance on C (`SponsorPolicyC`). Absent while the chain has no C stack. */
|
|
141
143
|
publicPolicyC?: Address;
|
|
142
|
-
/** F's orphan policy (`OrphanPolicyF`, decision 098): where `PolicyRegistry.orphan` moves a pool. Absent on an artifact that predates it. */
|
|
143
|
-
orphanPolicy?: Address;
|
|
144
144
|
/** The devnet's token factory; local deployments only. */
|
|
145
145
|
tokenFactory?: Address;
|
|
146
146
|
}
|
package/dist/chains.js
CHANGED
|
@@ -114,8 +114,8 @@ const REQUIRED_ADDRESSES = [
|
|
|
114
114
|
"padPolicy",
|
|
115
115
|
];
|
|
116
116
|
const OPTIONAL_ADDRESSES = ["createX", "tokenFactory"];
|
|
117
|
-
/** Policies an artifact may carry as `address(0)` (no C stack
|
|
118
|
-
const OPTIONAL_POLICIES = ["publicPolicyC"
|
|
117
|
+
/** Policies an artifact may carry as `address(0)` (no C stack): zero is absent. An `orphanPolicy` key on an older artifact is ignored (F 41 has none). */
|
|
118
|
+
const OPTIONAL_POLICIES = ["publicPolicyC"];
|
|
119
119
|
/** The C stack: all three, or none (`address(0)` — the chain has not opted into C yet). */
|
|
120
120
|
const C_STACK = ["managerC", "routerC", "lensC"];
|
|
121
121
|
function uint(o, k) {
|
|
@@ -192,7 +192,6 @@ export function addressesOfDeployment(d) {
|
|
|
192
192
|
polPolicy: d.polPolicy,
|
|
193
193
|
padPolicy: d.padPolicy,
|
|
194
194
|
...(d.publicPolicyC ? { publicPolicyC: d.publicPolicyC } : {}),
|
|
195
|
-
...(d.orphanPolicy ? { orphanPolicy: d.orphanPolicy } : {}),
|
|
196
195
|
policyRegistry: d.policyRegistry,
|
|
197
196
|
permit2: d.permit2,
|
|
198
197
|
...(d.tokenFactory ? { tokenFactory: d.tokenFactory } : {}),
|
package/dist/client.d.ts
CHANGED
|
@@ -29,10 +29,11 @@ export interface LogswapAddresses {
|
|
|
29
29
|
/** C's read-only lens: ladder derivations and views. */
|
|
30
30
|
lensC?: Address;
|
|
31
31
|
/**
|
|
32
|
-
* The LOG's policies (decision 098: immutable, deployed by the LOG): every pool names one in its key, and the pool's
|
|
33
|
-
* roles, gates and terms live on it.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* The LOG's policies (decision 098: immutable, deployed by the LOG): every pool names one in its key for life, and the pool's
|
|
33
|
+
* roles, gates and terms live on it. On F the four are instances of one contract, `PolicyF` (F 41, policy.md), told apart by
|
|
34
|
+
* their immutables: `publicPolicy` is the open one (anyone creates at salt zero, no gate ever), `privatePolicy` the LOG's desk
|
|
35
|
+
* (closed, gates by pool), `polPolicy` and `padPolicy` the treasury's and the launch's. The artifact keys predate 098 and are
|
|
36
|
+
* kept. A deployment predating the policies carries none.
|
|
36
37
|
*/
|
|
37
38
|
publicPolicy?: Address;
|
|
38
39
|
privatePolicy?: Address;
|
|
@@ -40,8 +41,6 @@ export interface LogswapAddresses {
|
|
|
40
41
|
padPolicy?: Address;
|
|
41
42
|
/** The LOG's open sponsored instance on C (`SponsorPolicyC`): the policy of a public market. Absent with no C stack. */
|
|
42
43
|
publicPolicyC?: Address;
|
|
43
|
-
/** F's orphan policy (`OrphanPolicyF`, kind `"orphan"`): the policy `PolicyRegistry.orphan` moves a pool to. */
|
|
44
|
-
orphanPolicy?: Address;
|
|
45
44
|
/**
|
|
46
45
|
* The policy registry: what a pool of each kind may be born under, and the
|
|
47
46
|
* owner that may move a pool between policies. Read from the F manager (`registry()`) when
|
|
@@ -153,7 +152,7 @@ export declare const EXPECTED_VERSION = 16n;
|
|
|
153
152
|
* passes it; when one lands, raise this constant in the same change, which is the discipline
|
|
154
153
|
* `EXPECTED_VERSION` enforces mechanically and this one asks for.
|
|
155
154
|
*/
|
|
156
|
-
export declare const EXPECTED_F_VERSION =
|
|
155
|
+
export declare const EXPECTED_F_VERSION = 41n;
|
|
157
156
|
export declare function assertVersion(c: LogswapClient, expected?: bigint): Promise<void>;
|
|
158
157
|
/**
|
|
159
158
|
* The versions say the managers are the right code; this says the rest of the addresses belong
|
package/dist/client.js
CHANGED
|
@@ -272,7 +272,18 @@ export const EXPECTED_VERSION = 16n;
|
|
|
272
272
|
// `Pool.flags` (`GATE_SWAP` 1, `GATE_MINT` 2, `SEED_TO_DEAD` 4) and `Pool.operator` caches the operator; `setPermissions` /
|
|
273
273
|
// `PermissionsSet` are `setGates` / `GatesSet`; the registry's `migrate(manager, key, to, permissions)` replaces `migratePrivate`,
|
|
274
274
|
// `orphan(manager, key)` moves a pool to `OrphanPolicyF`. No pool id moved.
|
|
275
|
-
|
|
275
|
+
// 41 (policy.md): one policy contract, `PolicyF`, whose kinds are parameter sets — `SponsorPolicyF`, `PolPolicy`, `PadPolicy` and
|
|
276
|
+
// `OrphanPolicyF` are gone. The AUTHORITY is the policy's (immutable) and appoints each pool's OPERATOR, who funds, harvests, closes
|
|
277
|
+
// and sets the modes and the name. `PoolKeyF` is `(quote, bases, swapFeeIdx, policy, salt)` — no creator, no mint fee: the swap fee is
|
|
278
|
+
// an index into `FEE_LIST` (1, 2, 5, 10, 20, 50, 100, 200 bp) and the mint fee the next entry — so EVERY POOL ID MOVED.
|
|
279
|
+
// `deployLiquidity(poolId, baseAssets, quoteAmount, lnCapOverSeed)` on an inactive pool only (no `to`: the operator holds the
|
|
280
|
+
// shares); `harvest(poolId, extra, to)` takes the income and `extra` capital; `close(poolId, to)` at any bid, harvesting first,
|
|
281
|
+
// refused on a pad; `regenerate` is gone (`multicall(close, redeem, deployLiquidity)`); the registry's `migrate`, `orphan` and
|
|
282
|
+
// `setOrphanPolicy` are gone, `sunset` also refuses `deployLiquidity`. `PoolCreated(poolId, quote, policy, bases, swapFeeIdx, salt)`;
|
|
283
|
+
// `IncomeHarvested(poolId, to, gen, income, capital, tax, toOperator, Q)`; `GenerationFrozen` from `close` alone; `IncomeReleased` and
|
|
284
|
+
// `PolicyMigrated` are gone. The policy's name is an event (`NameSet`), its lists are per policy (`setRights`, `RightsSet`), its
|
|
285
|
+
// modes per pool (`setSwapMode` / `setMintMode`, each Open < Listed < Operator with `mintMode ≥ swapMode`).
|
|
286
|
+
export const EXPECTED_F_VERSION = 41n;
|
|
276
287
|
export async function assertVersion(c, expected = EXPECTED_VERSION) {
|
|
277
288
|
const { managerCAbi, managerFAbi } = await import("./generated.js");
|
|
278
289
|
const withC = hasC(c);
|