@logswap/sdk 0.5.73 → 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 +1 -6
- 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 +1 -6
- 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/README.md
CHANGED
|
@@ -44,6 +44,31 @@ Both are computed **offline** — no RPC, no deployment needed to address a mark
|
|
|
44
44
|
floor price (was `theta`), `refLogFloor` θ₀ — the reference floor income counts from (was
|
|
45
45
|
`theta0`), `cap` (d in 1e-6 log units, 0 uncapped), and per leg `virtualReserves` and `kappa`.
|
|
46
46
|
|
|
47
|
+
## Who may create what: the gate, the menus (C version 7, F version 26)
|
|
48
|
+
|
|
49
|
+
Since logswap-contract #60 (decisions 064–065) creation is curated at launch, on both managers:
|
|
50
|
+
|
|
51
|
+
- **The C gate is the public policy**, set in the C manager's constructor. A C market is admitted if
|
|
52
|
+
its creator, quote, pair, swap-fee tier (2, 5, 10, 25, 50, 100 bp) and tick spacing (10 or 100 bp)
|
|
53
|
+
are listed, and only one market per (base, quote, fee) exists. `cGateRules(c, { key, creator })`
|
|
54
|
+
reads every check in one round; `gateErrorAbi` decodes the refusals (`CreatorNotListed`,
|
|
55
|
+
`MarketExists`, `SpacingNotListed`, `PairNotListed`, `MintFeeNotListed`, `NoForwardedUser`,
|
|
56
|
+
`PadExists`).
|
|
57
|
+
- **`createMarket` stays one transaction**: the router is a trusted forwarder, so the gate checks
|
|
58
|
+
the router's `user()` — the wallet that sent the call — against the creator list.
|
|
59
|
+
- **The mint fee is per pool**, the creator's pick from the policy's menu, proposed at
|
|
60
|
+
`initialize` / `createMarket` / `fPoolInitialize` / `fPoolLaunch` (`mintFee?`). It defaults to
|
|
61
|
+
`presetMintFee(swapFee)`: twice the swap fee, capped at `FEE_MAX` — guidance, not a contract rule.
|
|
62
|
+
`policyMintFeeMenu(c, policy, candidates)` lists what a policy accepts; `getPool(...).mintFee` /
|
|
63
|
+
`getFPool(...).mintFee` read a pool's. `mintFee(p, x, rate)` previews it at the market's rate.
|
|
64
|
+
- **A fee of 0 is no fee**: `swapFeeOf` and `DEFAULT_FEE` are gone; `marketSwapFee` returns the key's
|
|
65
|
+
own fee for an initialized market.
|
|
66
|
+
- **C reads**: `getPool` reads the lens's `getPools`; `getPositionClass` reads the class through
|
|
67
|
+
`extsload` at `CPoolState`'s slot (the manager's typed views are gone).
|
|
68
|
+
- **Creators are curated on every kind** at launch (onboarding under a service agreement); the
|
|
69
|
+
collector's helpers: `policySetCreatorListed`, `policySetMintFeeListed`, `gateSetPairListed`,
|
|
70
|
+
`gateSetSpacingListed`, `gateSetForwarderTrusted`, `setCGate`.
|
|
71
|
+
|
|
47
72
|
## Capped F pools and the lien (F version 25)
|
|
48
73
|
|
|
49
74
|
- **The cap** (decisions 061) is a key field: `FPoolKey.cap` / `FPoolCreateArgs.cap`, d =
|
package/dist/admin.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* is the policy's (`PadPolicy.setSchedule`), capped by the manager at `POT_CUT_MAX`.
|
|
10
10
|
*/
|
|
11
11
|
import type { Address, Hash } from "viem";
|
|
12
|
+
import type { PoolKey } from "./keys.js";
|
|
12
13
|
import type { LogswapClient } from "./client.js";
|
|
13
14
|
import { type FPoolKey, type FPoolKind } from "./fpool.js";
|
|
14
15
|
/**
|
|
@@ -140,6 +141,200 @@ export declare function policyFeeAllowed(c: LogswapClient, policy: Address, fee:
|
|
|
140
141
|
listed: boolean;
|
|
141
142
|
allowed: boolean;
|
|
142
143
|
}>;
|
|
144
|
+
/** `setMintFeeListed` on any protocol policy (065): an entry of its mint-fee menu. The collector's. */
|
|
145
|
+
export declare function policySetMintFeeListed(c: LogswapClient, policy: Address, mintFee: bigint, listed: boolean): Promise<Hash>;
|
|
146
|
+
/** `setMintFeeCurated` on any protocol policy: on, a birth proposing an unlisted mint fee is refused (`MintFeeNotListed`). */
|
|
147
|
+
export declare function policySetMintFeeCurated(c: LogswapClient, policy: Address, curated: boolean): Promise<Hash>;
|
|
148
|
+
/**
|
|
149
|
+
* A policy's mint-fee menu, for a create form (065): which of `candidates` it lists, and whether it
|
|
150
|
+
* curates at all (uncurated, any fee in the domain is accepted — the desk's policy never curates).
|
|
151
|
+
* The candidates are the app's — typically {@link presetMintFee} of each listed swap tier.
|
|
152
|
+
*/
|
|
153
|
+
export declare function policyMintFeeMenu(c: LogswapClient, policy: Address, candidates: readonly bigint[]): Promise<{
|
|
154
|
+
curated: boolean;
|
|
155
|
+
listed: bigint[];
|
|
156
|
+
}>;
|
|
157
|
+
/** `setCreatorListed` on any protocol policy (064): a creator onboarded under a service agreement. */
|
|
158
|
+
export declare function policySetCreatorListed(c: LogswapClient, policy: Address, who: Address, listed: boolean): Promise<Hash>;
|
|
159
|
+
/** `setCreatorCurated` on any protocol policy: on, only listed creators may create on that kind (C: the caller; F: `key.creator`). */
|
|
160
|
+
export declare function policySetCreatorCurated(c: LogswapClient, policy: Address, curated: boolean): Promise<Hash>;
|
|
161
|
+
/** `PublicPolicy.setPairListed` (064): a C pair a market may be born on while pairs are curated. Directional (base, quote). */
|
|
162
|
+
export declare function gateSetPairListed(c: LogswapClient, policy: Address, base: Address, quote: Address, listed: boolean): Promise<Hash>;
|
|
163
|
+
/** `PublicPolicy.setPairCurated` (064). */
|
|
164
|
+
export declare function gateSetPairCurated(c: LogswapClient, policy: Address, curated: boolean): Promise<Hash>;
|
|
165
|
+
/** `PublicPolicy.setSpacingListed` (064): a C tick spacing, WAD (10 bp = 1e15, 100 bp = 1e16). Always consulted. */
|
|
166
|
+
export declare function gateSetSpacingListed(c: LogswapClient, policy: Address, tickSpacing: bigint, listed: boolean): Promise<Hash>;
|
|
167
|
+
/** `PublicPolicy.setForwarderTrusted` (064): a router whose `user()` the gate takes as the creator. */
|
|
168
|
+
export declare function gateSetForwarderTrusted(c: LogswapClient, policy: Address, forwarder: Address, trusted: boolean): Promise<Hash>;
|
|
169
|
+
/** `CPoolManager.setGate` (064): name, change or lift (`address(0)`) the C gate. The C collector's. */
|
|
170
|
+
export declare function setCGate(c: LogswapClient, gate: Address): Promise<Hash>;
|
|
171
|
+
/** The C manager's gate (`address(0)`: permissionless, a fee-free market then refused). */
|
|
172
|
+
export declare function cGate(c: LogswapClient): Promise<Address>;
|
|
173
|
+
export interface CGateRules {
|
|
174
|
+
creatorOk: boolean;
|
|
175
|
+
quoteOk: boolean;
|
|
176
|
+
pairOk: boolean;
|
|
177
|
+
feeOk: boolean;
|
|
178
|
+
spacingOk: boolean;
|
|
179
|
+
/** A market on (base, quote, fee) already exists, whatever its spacing: the gate refuses another (064 (b)). */
|
|
180
|
+
exists: boolean;
|
|
181
|
+
/** Whether `router` is a trusted forwarder — `createMarket` through it is then checked against `creator`. */
|
|
182
|
+
routerTrusted: boolean;
|
|
183
|
+
/** Every check passes: the gate would admit this market from this creator (the mint fee aside — see {@link policyMintFeeMenu}). */
|
|
184
|
+
admitted: boolean;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The public policy's C checks for one candidate market and creator, in one round of reads — what
|
|
188
|
+
* the create form shows before a wallet is asked (064). `router` is the router the form will go
|
|
189
|
+
* through (`c.addresses.router` by default).
|
|
190
|
+
*/
|
|
191
|
+
export declare function cGateRules(c: LogswapClient, a: {
|
|
192
|
+
key: PoolKey;
|
|
193
|
+
creator: Address;
|
|
194
|
+
router?: Address;
|
|
195
|
+
gate?: Address;
|
|
196
|
+
}): Promise<CGateRules>;
|
|
197
|
+
/**
|
|
198
|
+
* Every refusal a birth can meet at the gate or a policy (064, 065), for `decodeErrorResult` on a
|
|
199
|
+
* failed simulation: the public policy's errors plus the pad's `PadExists` (one pad per base).
|
|
200
|
+
*/
|
|
201
|
+
export declare const gateErrorAbi: readonly ({
|
|
202
|
+
readonly type: "error";
|
|
203
|
+
readonly inputs: readonly [{
|
|
204
|
+
readonly name: "base";
|
|
205
|
+
readonly internalType: "address";
|
|
206
|
+
readonly type: "address";
|
|
207
|
+
}, {
|
|
208
|
+
readonly name: "pad";
|
|
209
|
+
readonly internalType: "bytes32";
|
|
210
|
+
readonly type: "bytes32";
|
|
211
|
+
}];
|
|
212
|
+
readonly name: "PadExists";
|
|
213
|
+
} | {
|
|
214
|
+
readonly type: "error";
|
|
215
|
+
readonly inputs: readonly [];
|
|
216
|
+
readonly name: "BadFee";
|
|
217
|
+
} | {
|
|
218
|
+
readonly type: "error";
|
|
219
|
+
readonly inputs: readonly [];
|
|
220
|
+
readonly name: "BadRate";
|
|
221
|
+
} | {
|
|
222
|
+
readonly type: "error";
|
|
223
|
+
readonly inputs: readonly [{
|
|
224
|
+
readonly name: "creator";
|
|
225
|
+
readonly internalType: "address";
|
|
226
|
+
readonly type: "address";
|
|
227
|
+
}];
|
|
228
|
+
readonly name: "CreatorNotListed";
|
|
229
|
+
} | {
|
|
230
|
+
readonly type: "error";
|
|
231
|
+
readonly inputs: readonly [{
|
|
232
|
+
readonly name: "fee";
|
|
233
|
+
readonly internalType: "uint256";
|
|
234
|
+
readonly type: "uint256";
|
|
235
|
+
}];
|
|
236
|
+
readonly name: "FeeNotListed";
|
|
237
|
+
} | {
|
|
238
|
+
readonly type: "error";
|
|
239
|
+
readonly inputs: readonly [{
|
|
240
|
+
readonly name: "base";
|
|
241
|
+
readonly internalType: "address";
|
|
242
|
+
readonly type: "address";
|
|
243
|
+
}, {
|
|
244
|
+
readonly name: "quote";
|
|
245
|
+
readonly internalType: "address";
|
|
246
|
+
readonly type: "address";
|
|
247
|
+
}, {
|
|
248
|
+
readonly name: "fee";
|
|
249
|
+
readonly internalType: "uint256";
|
|
250
|
+
readonly type: "uint256";
|
|
251
|
+
}];
|
|
252
|
+
readonly name: "MarketExists";
|
|
253
|
+
} | {
|
|
254
|
+
readonly type: "error";
|
|
255
|
+
readonly inputs: readonly [{
|
|
256
|
+
readonly name: "mintFee";
|
|
257
|
+
readonly internalType: "uint256";
|
|
258
|
+
readonly type: "uint256";
|
|
259
|
+
}];
|
|
260
|
+
readonly name: "MintFeeNotListed";
|
|
261
|
+
} | {
|
|
262
|
+
readonly type: "error";
|
|
263
|
+
readonly inputs: readonly [];
|
|
264
|
+
readonly name: "NoCreator";
|
|
265
|
+
} | {
|
|
266
|
+
readonly type: "error";
|
|
267
|
+
readonly inputs: readonly [{
|
|
268
|
+
readonly name: "forwarder";
|
|
269
|
+
readonly internalType: "address";
|
|
270
|
+
readonly type: "address";
|
|
271
|
+
}];
|
|
272
|
+
readonly name: "NoForwardedUser";
|
|
273
|
+
} | {
|
|
274
|
+
readonly type: "error";
|
|
275
|
+
readonly inputs: readonly [];
|
|
276
|
+
readonly name: "NotAuthority";
|
|
277
|
+
} | {
|
|
278
|
+
readonly type: "error";
|
|
279
|
+
readonly inputs: readonly [];
|
|
280
|
+
readonly name: "NotCanonical";
|
|
281
|
+
} | {
|
|
282
|
+
readonly type: "error";
|
|
283
|
+
readonly inputs: readonly [];
|
|
284
|
+
readonly name: "NotCollector";
|
|
285
|
+
} | {
|
|
286
|
+
readonly type: "error";
|
|
287
|
+
readonly inputs: readonly [{
|
|
288
|
+
readonly name: "token";
|
|
289
|
+
readonly internalType: "address";
|
|
290
|
+
readonly type: "address";
|
|
291
|
+
}];
|
|
292
|
+
readonly name: "NotListed";
|
|
293
|
+
} | {
|
|
294
|
+
readonly type: "error";
|
|
295
|
+
readonly inputs: readonly [];
|
|
296
|
+
readonly name: "NotManager";
|
|
297
|
+
} | {
|
|
298
|
+
readonly type: "error";
|
|
299
|
+
readonly inputs: readonly [];
|
|
300
|
+
readonly name: "NotRegistry";
|
|
301
|
+
} | {
|
|
302
|
+
readonly type: "error";
|
|
303
|
+
readonly inputs: readonly [];
|
|
304
|
+
readonly name: "OneBase";
|
|
305
|
+
} | {
|
|
306
|
+
readonly type: "error";
|
|
307
|
+
readonly inputs: readonly [{
|
|
308
|
+
readonly name: "base";
|
|
309
|
+
readonly internalType: "address";
|
|
310
|
+
readonly type: "address";
|
|
311
|
+
}, {
|
|
312
|
+
readonly name: "quote";
|
|
313
|
+
readonly internalType: "address";
|
|
314
|
+
readonly type: "address";
|
|
315
|
+
}];
|
|
316
|
+
readonly name: "PairNotListed";
|
|
317
|
+
} | {
|
|
318
|
+
readonly type: "error";
|
|
319
|
+
readonly inputs: readonly [{
|
|
320
|
+
readonly name: "quote";
|
|
321
|
+
readonly internalType: "address";
|
|
322
|
+
readonly type: "address";
|
|
323
|
+
}];
|
|
324
|
+
readonly name: "QuoteNotListed";
|
|
325
|
+
} | {
|
|
326
|
+
readonly type: "error";
|
|
327
|
+
readonly inputs: readonly [];
|
|
328
|
+
readonly name: "Refused";
|
|
329
|
+
} | {
|
|
330
|
+
readonly type: "error";
|
|
331
|
+
readonly inputs: readonly [{
|
|
332
|
+
readonly name: "tickSpacing";
|
|
333
|
+
readonly internalType: "int256";
|
|
334
|
+
readonly type: "int256";
|
|
335
|
+
}];
|
|
336
|
+
readonly name: "SpacingNotListed";
|
|
337
|
+
})[];
|
|
143
338
|
/** `PublicPolicy.setListed`: an asset a curated seed may hold. */
|
|
144
339
|
export declare function publicSetListed(c: LogswapClient, policy: Address, token: Address, listed: boolean): Promise<Hash>;
|
|
145
340
|
/** `PublicPolicy.setCurated`: whether every public seed is checked against the list. */
|
package/dist/admin.js
CHANGED
|
@@ -205,6 +205,97 @@ export async function policyFeeAllowed(c, policy, fee) {
|
|
|
205
205
|
]);
|
|
206
206
|
return { curated, listed, allowed: !curated || listed };
|
|
207
207
|
}
|
|
208
|
+
/** `setMintFeeListed` on any protocol policy (065): an entry of its mint-fee menu. The collector's. */
|
|
209
|
+
export async function policySetMintFeeListed(c, policy, mintFee, listed) {
|
|
210
|
+
return write(c, policy, fPolicyBaseAbi, "setMintFeeListed", [mintFee, listed]);
|
|
211
|
+
}
|
|
212
|
+
/** `setMintFeeCurated` on any protocol policy: on, a birth proposing an unlisted mint fee is refused (`MintFeeNotListed`). */
|
|
213
|
+
export async function policySetMintFeeCurated(c, policy, curated) {
|
|
214
|
+
return write(c, policy, fPolicyBaseAbi, "setMintFeeCurated", [curated]);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* A policy's mint-fee menu, for a create form (065): which of `candidates` it lists, and whether it
|
|
218
|
+
* curates at all (uncurated, any fee in the domain is accepted — the desk's policy never curates).
|
|
219
|
+
* The candidates are the app's — typically {@link presetMintFee} of each listed swap tier.
|
|
220
|
+
*/
|
|
221
|
+
export async function policyMintFeeMenu(c, policy, candidates) {
|
|
222
|
+
const rd = (functionName, args = []) => c.public.readContract({ address: policy, abi: fPolicyBaseAbi, functionName, args });
|
|
223
|
+
const [curated, ...flags] = await Promise.all([rd("mintFeeCurated"), ...candidates.map((m) => rd("mintFeeListed", [m]))]);
|
|
224
|
+
return { curated, listed: candidates.filter((_, i) => flags[i]) };
|
|
225
|
+
}
|
|
226
|
+
/** `setCreatorListed` on any protocol policy (064): a creator onboarded under a service agreement. */
|
|
227
|
+
export async function policySetCreatorListed(c, policy, who, listed) {
|
|
228
|
+
return write(c, policy, fPolicyBaseAbi, "setCreatorListed", [who, listed]);
|
|
229
|
+
}
|
|
230
|
+
/** `setCreatorCurated` on any protocol policy: on, only listed creators may create on that kind (C: the caller; F: `key.creator`). */
|
|
231
|
+
export async function policySetCreatorCurated(c, policy, curated) {
|
|
232
|
+
return write(c, policy, fPolicyBaseAbi, "setCreatorCurated", [curated]);
|
|
233
|
+
}
|
|
234
|
+
/** `PublicPolicy.setPairListed` (064): a C pair a market may be born on while pairs are curated. Directional (base, quote). */
|
|
235
|
+
export async function gateSetPairListed(c, policy, base, quote, listed) {
|
|
236
|
+
return write(c, policy, publicPolicyAbi, "setPairListed", [base, quote, listed]);
|
|
237
|
+
}
|
|
238
|
+
/** `PublicPolicy.setPairCurated` (064). */
|
|
239
|
+
export async function gateSetPairCurated(c, policy, curated) {
|
|
240
|
+
return write(c, policy, publicPolicyAbi, "setPairCurated", [curated]);
|
|
241
|
+
}
|
|
242
|
+
/** `PublicPolicy.setSpacingListed` (064): a C tick spacing, WAD (10 bp = 1e15, 100 bp = 1e16). Always consulted. */
|
|
243
|
+
export async function gateSetSpacingListed(c, policy, tickSpacing, listed) {
|
|
244
|
+
return write(c, policy, publicPolicyAbi, "setSpacingListed", [tickSpacing, listed]);
|
|
245
|
+
}
|
|
246
|
+
/** `PublicPolicy.setForwarderTrusted` (064): a router whose `user()` the gate takes as the creator. */
|
|
247
|
+
export async function gateSetForwarderTrusted(c, policy, forwarder, trusted) {
|
|
248
|
+
return write(c, policy, publicPolicyAbi, "setForwarderTrusted", [forwarder, trusted]);
|
|
249
|
+
}
|
|
250
|
+
/** `CPoolManager.setGate` (064): name, change or lift (`address(0)`) the C gate. The C collector's. */
|
|
251
|
+
export async function setCGate(c, gate) {
|
|
252
|
+
return write(c, c.addresses.cPoolManager, cPoolManagerAbi, "setGate", [gate]);
|
|
253
|
+
}
|
|
254
|
+
/** The C manager's gate (`address(0)`: permissionless, a fee-free market then refused). */
|
|
255
|
+
export async function cGate(c) {
|
|
256
|
+
return c.public.readContract({ address: c.addresses.cPoolManager, abi: cPoolManagerAbi, functionName: "gate" });
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The public policy's C checks for one candidate market and creator, in one round of reads — what
|
|
260
|
+
* the create form shows before a wallet is asked (064). `router` is the router the form will go
|
|
261
|
+
* through (`c.addresses.router` by default).
|
|
262
|
+
*/
|
|
263
|
+
export async function cGateRules(c, a) {
|
|
264
|
+
const g = a.gate ?? c.addresses.publicPolicy;
|
|
265
|
+
const rd = (functionName, args = []) => c.public.readContract({ address: g, abi: publicPolicyAbi, functionName, args });
|
|
266
|
+
const { key } = a;
|
|
267
|
+
const [creatorCurated, creatorListed, quoteCurated, quoteListed, pairCurated, pairListed, feeCurated, feeListed, spacingListed, market, routerTrusted] = await Promise.all([
|
|
268
|
+
rd("creatorCurated"),
|
|
269
|
+
rd("creatorListed", [a.creator]),
|
|
270
|
+
rd("quoteCurated"),
|
|
271
|
+
rd("quoteListed", [key.quote]),
|
|
272
|
+
rd("pairCurated"),
|
|
273
|
+
rd("pairListed", [key.base, key.quote]),
|
|
274
|
+
rd("feeCurated"),
|
|
275
|
+
rd("feeListed", [key.swapFee]),
|
|
276
|
+
rd("spacingListed", [key.tickSpacing]),
|
|
277
|
+
rd("cMarketOf", [key.base, key.quote, key.swapFee]),
|
|
278
|
+
rd("forwarderTrusted", [a.router ?? c.addresses.router]),
|
|
279
|
+
]);
|
|
280
|
+
const r = {
|
|
281
|
+
creatorOk: !creatorCurated || creatorListed,
|
|
282
|
+
quoteOk: !quoteCurated || quoteListed,
|
|
283
|
+
pairOk: !pairCurated || pairListed,
|
|
284
|
+
feeOk: !feeCurated || feeListed,
|
|
285
|
+
spacingOk: spacingListed,
|
|
286
|
+
exists: BigInt(market) !== 0n,
|
|
287
|
+
routerTrusted,
|
|
288
|
+
};
|
|
289
|
+
return { ...r, admitted: r.creatorOk && r.quoteOk && r.pairOk && r.feeOk && r.spacingOk && !r.exists };
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Every refusal a birth can meet at the gate or a policy (064, 065), for `decodeErrorResult` on a
|
|
293
|
+
* failed simulation: the public policy's errors plus the pad's `PadExists` (one pad per base).
|
|
294
|
+
*/
|
|
295
|
+
export const gateErrorAbi = [
|
|
296
|
+
...publicPolicyAbi.filter((x) => x.type === "error"),
|
|
297
|
+
...padPolicyAbi.filter((x) => x.type === "error" && x.name === "PadExists"),
|
|
298
|
+
];
|
|
208
299
|
/** `PublicPolicy.setListed`: an asset a curated seed may hold. */
|
|
209
300
|
export async function publicSetListed(c, policy, token, listed) {
|
|
210
301
|
return write(c, policy, publicPolicyAbi, "setListed", [token, listed]);
|
package/dist/client.d.ts
CHANGED
|
@@ -75,8 +75,15 @@ export declare function createLogswapClient(args: {
|
|
|
75
75
|
* (`MINT_FEE_PROTOCOL_CUT` and `setFeeParams` are gone, decisions 058); the swap-fee tax at payout,
|
|
76
76
|
* `swapFeeTax` / `setSwapFeeTax` (060); `phi` is `swapFee` and `phiOf` `swapFeeOf` (059) — field
|
|
77
77
|
* names only, no pool id moved.
|
|
78
|
+
*
|
|
79
|
+
* **7** since 2026-10-12 (logswap-contract#60, decisions 064–065): the typed views (`getPool`,
|
|
80
|
+
* `ticks`, `tickBitmapWord`, `positions`, `feeAcct`, `idInfo`) are behind `extsload` — the pool
|
|
81
|
+
* reads through the lens's `getPools`, a class through `CPoolState`'s layout; a fee of 0 is no
|
|
82
|
+
* fee (`swapFeeOf` and `DEFAULT_FEE` are gone); the mint fee is the market's, proposed at
|
|
83
|
+
* `initialize` / `createMarket` and answered by the gate; the gate (`gate`, `setGate`) is the
|
|
84
|
+
* public policy, set at construction. No pool id moved.
|
|
78
85
|
*/
|
|
79
|
-
export declare const EXPECTED_VERSION =
|
|
86
|
+
export declare const EXPECTED_VERSION = 7n;
|
|
80
87
|
/**
|
|
81
88
|
* The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
|
|
82
89
|
* 4 was the income-only harvest cut).
|
|
@@ -88,7 +95,7 @@ export declare const EXPECTED_VERSION = 6n;
|
|
|
88
95
|
* passes it; when one lands, raise this constant in the same change, which is the discipline
|
|
89
96
|
* `EXPECTED_VERSION` enforces mechanically and this one asks for.
|
|
90
97
|
*/
|
|
91
|
-
export declare const EXPECTED_F_VERSION =
|
|
98
|
+
export declare const EXPECTED_F_VERSION = 26n;
|
|
92
99
|
export declare function assertVersion(c: LogswapClient, expected?: bigint): Promise<void>;
|
|
93
100
|
/**
|
|
94
101
|
* The versions say the managers are the right code; this says the rest of the addresses belong
|
package/dist/client.js
CHANGED
|
@@ -69,8 +69,15 @@ function guardChain(wallet, pub) {
|
|
|
69
69
|
* (`MINT_FEE_PROTOCOL_CUT` and `setFeeParams` are gone, decisions 058); the swap-fee tax at payout,
|
|
70
70
|
* `swapFeeTax` / `setSwapFeeTax` (060); `phi` is `swapFee` and `phiOf` `swapFeeOf` (059) — field
|
|
71
71
|
* names only, no pool id moved.
|
|
72
|
+
*
|
|
73
|
+
* **7** since 2026-10-12 (logswap-contract#60, decisions 064–065): the typed views (`getPool`,
|
|
74
|
+
* `ticks`, `tickBitmapWord`, `positions`, `feeAcct`, `idInfo`) are behind `extsload` — the pool
|
|
75
|
+
* reads through the lens's `getPools`, a class through `CPoolState`'s layout; a fee of 0 is no
|
|
76
|
+
* fee (`swapFeeOf` and `DEFAULT_FEE` are gone); the mint fee is the market's, proposed at
|
|
77
|
+
* `initialize` / `createMarket` and answered by the gate; the gate (`gate`, `setGate`) is the
|
|
78
|
+
* public policy, set at construction. No pool id moved.
|
|
72
79
|
*/
|
|
73
|
-
export const EXPECTED_VERSION =
|
|
80
|
+
export const EXPECTED_VERSION = 7n;
|
|
74
81
|
/**
|
|
75
82
|
* The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
|
|
76
83
|
* 4 was the income-only harvest cut).
|
|
@@ -147,8 +154,11 @@ export const EXPECTED_VERSION = 6n;
|
|
|
147
154
|
// 25 (logswap-contract#59): the views moved behind `extsload` (062) — this SDK reads them through the
|
|
148
155
|
// lens (`fPool`, `getFPools`, `fBundleOf`, `fDividendOf`, `fLienOf`); the capped F pool, `FPoolKey.cap`
|
|
149
156
|
// appended so every pool id moved (061); the lien, `lock` / `unlock` (063); θ is `logFloor`, θ₀ `refLogFloor`.
|
|
157
|
+
// 26 (logswap-contract#60): the mint fee is per pool, proposed at `initialize(key, mintFee)` and answered
|
|
158
|
+
// by the policy's `onInitialize` from its menu (065); `MINT_FEE` is gone; a fee of 0 is no fee; the
|
|
159
|
+
// policies curate creators, a public pool is uncapped, one pad per base (064). No pool id moved.
|
|
150
160
|
// A breaking bump: raised in the same change.
|
|
151
|
-
export const EXPECTED_F_VERSION =
|
|
161
|
+
export const EXPECTED_F_VERSION = 26n;
|
|
152
162
|
export async function assertVersion(c, expected = EXPECTED_VERSION) {
|
|
153
163
|
const { cPoolManagerAbi, fPoolManagerAbi } = await import("./generated.js");
|
|
154
164
|
// three independent reads: one round trip, not three in a row
|
package/dist/fpool.d.ts
CHANGED
|
@@ -90,6 +90,30 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
90
90
|
readonly type: "address";
|
|
91
91
|
}];
|
|
92
92
|
readonly stateMutability: "view";
|
|
93
|
+
}, {
|
|
94
|
+
readonly type: "function";
|
|
95
|
+
readonly inputs: readonly [];
|
|
96
|
+
readonly name: "creatorCurated";
|
|
97
|
+
readonly outputs: readonly [{
|
|
98
|
+
readonly name: "";
|
|
99
|
+
readonly internalType: "bool";
|
|
100
|
+
readonly type: "bool";
|
|
101
|
+
}];
|
|
102
|
+
readonly stateMutability: "view";
|
|
103
|
+
}, {
|
|
104
|
+
readonly type: "function";
|
|
105
|
+
readonly inputs: readonly [{
|
|
106
|
+
readonly name: "";
|
|
107
|
+
readonly internalType: "address";
|
|
108
|
+
readonly type: "address";
|
|
109
|
+
}];
|
|
110
|
+
readonly name: "creatorListed";
|
|
111
|
+
readonly outputs: readonly [{
|
|
112
|
+
readonly name: "";
|
|
113
|
+
readonly internalType: "bool";
|
|
114
|
+
readonly type: "bool";
|
|
115
|
+
}];
|
|
116
|
+
readonly stateMutability: "view";
|
|
93
117
|
}, {
|
|
94
118
|
readonly type: "function";
|
|
95
119
|
readonly inputs: readonly [];
|
|
@@ -219,6 +243,30 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
219
243
|
readonly type: "uint256";
|
|
220
244
|
}];
|
|
221
245
|
readonly stateMutability: "view";
|
|
246
|
+
}, {
|
|
247
|
+
readonly type: "function";
|
|
248
|
+
readonly inputs: readonly [];
|
|
249
|
+
readonly name: "mintFeeCurated";
|
|
250
|
+
readonly outputs: readonly [{
|
|
251
|
+
readonly name: "";
|
|
252
|
+
readonly internalType: "bool";
|
|
253
|
+
readonly type: "bool";
|
|
254
|
+
}];
|
|
255
|
+
readonly stateMutability: "view";
|
|
256
|
+
}, {
|
|
257
|
+
readonly type: "function";
|
|
258
|
+
readonly inputs: readonly [{
|
|
259
|
+
readonly name: "";
|
|
260
|
+
readonly internalType: "uint256";
|
|
261
|
+
readonly type: "uint256";
|
|
262
|
+
}];
|
|
263
|
+
readonly name: "mintFeeListed";
|
|
264
|
+
readonly outputs: readonly [{
|
|
265
|
+
readonly name: "";
|
|
266
|
+
readonly internalType: "bool";
|
|
267
|
+
readonly type: "bool";
|
|
268
|
+
}];
|
|
269
|
+
readonly stateMutability: "view";
|
|
222
270
|
}, {
|
|
223
271
|
readonly type: "function";
|
|
224
272
|
readonly inputs: readonly [{
|
|
@@ -276,12 +324,20 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
276
324
|
readonly internalType: "uint24";
|
|
277
325
|
readonly type: "uint24";
|
|
278
326
|
}];
|
|
327
|
+
}, {
|
|
328
|
+
readonly name: "mintFee";
|
|
329
|
+
readonly internalType: "uint256";
|
|
330
|
+
readonly type: "uint256";
|
|
279
331
|
}];
|
|
280
332
|
readonly name: "onInitialize";
|
|
281
333
|
readonly outputs: readonly [{
|
|
282
334
|
readonly name: "";
|
|
283
335
|
readonly internalType: "uint8";
|
|
284
336
|
readonly type: "uint8";
|
|
337
|
+
}, {
|
|
338
|
+
readonly name: "";
|
|
339
|
+
readonly internalType: "uint256";
|
|
340
|
+
readonly type: "uint256";
|
|
285
341
|
}];
|
|
286
342
|
readonly stateMutability: "nonpayable";
|
|
287
343
|
}, {
|
|
@@ -438,6 +494,30 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
438
494
|
readonly type: "bool";
|
|
439
495
|
}];
|
|
440
496
|
readonly stateMutability: "view";
|
|
497
|
+
}, {
|
|
498
|
+
readonly type: "function";
|
|
499
|
+
readonly inputs: readonly [{
|
|
500
|
+
readonly name: "curated";
|
|
501
|
+
readonly internalType: "bool";
|
|
502
|
+
readonly type: "bool";
|
|
503
|
+
}];
|
|
504
|
+
readonly name: "setCreatorCurated";
|
|
505
|
+
readonly outputs: readonly [];
|
|
506
|
+
readonly stateMutability: "nonpayable";
|
|
507
|
+
}, {
|
|
508
|
+
readonly type: "function";
|
|
509
|
+
readonly inputs: readonly [{
|
|
510
|
+
readonly name: "who";
|
|
511
|
+
readonly internalType: "address";
|
|
512
|
+
readonly type: "address";
|
|
513
|
+
}, {
|
|
514
|
+
readonly name: "listed";
|
|
515
|
+
readonly internalType: "bool";
|
|
516
|
+
readonly type: "bool";
|
|
517
|
+
}];
|
|
518
|
+
readonly name: "setCreatorListed";
|
|
519
|
+
readonly outputs: readonly [];
|
|
520
|
+
readonly stateMutability: "nonpayable";
|
|
441
521
|
}, {
|
|
442
522
|
readonly type: "function";
|
|
443
523
|
readonly inputs: readonly [{
|
|
@@ -462,6 +542,30 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
462
542
|
readonly name: "setFeeListed";
|
|
463
543
|
readonly outputs: readonly [];
|
|
464
544
|
readonly stateMutability: "nonpayable";
|
|
545
|
+
}, {
|
|
546
|
+
readonly type: "function";
|
|
547
|
+
readonly inputs: readonly [{
|
|
548
|
+
readonly name: "curated";
|
|
549
|
+
readonly internalType: "bool";
|
|
550
|
+
readonly type: "bool";
|
|
551
|
+
}];
|
|
552
|
+
readonly name: "setMintFeeCurated";
|
|
553
|
+
readonly outputs: readonly [];
|
|
554
|
+
readonly stateMutability: "nonpayable";
|
|
555
|
+
}, {
|
|
556
|
+
readonly type: "function";
|
|
557
|
+
readonly inputs: readonly [{
|
|
558
|
+
readonly name: "mintFee";
|
|
559
|
+
readonly internalType: "uint256";
|
|
560
|
+
readonly type: "uint256";
|
|
561
|
+
}, {
|
|
562
|
+
readonly name: "listed";
|
|
563
|
+
readonly internalType: "bool";
|
|
564
|
+
readonly type: "bool";
|
|
565
|
+
}];
|
|
566
|
+
readonly name: "setMintFeeListed";
|
|
567
|
+
readonly outputs: readonly [];
|
|
568
|
+
readonly stateMutability: "nonpayable";
|
|
465
569
|
}, {
|
|
466
570
|
readonly type: "function";
|
|
467
571
|
readonly inputs: readonly [{
|
|
@@ -554,6 +658,31 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
554
658
|
readonly indexed: true;
|
|
555
659
|
}];
|
|
556
660
|
readonly name: "AuthoritySet";
|
|
661
|
+
}, {
|
|
662
|
+
readonly type: "event";
|
|
663
|
+
readonly anonymous: false;
|
|
664
|
+
readonly inputs: readonly [{
|
|
665
|
+
readonly name: "curated";
|
|
666
|
+
readonly internalType: "bool";
|
|
667
|
+
readonly type: "bool";
|
|
668
|
+
readonly indexed: false;
|
|
669
|
+
}];
|
|
670
|
+
readonly name: "CreatorCuratedSet";
|
|
671
|
+
}, {
|
|
672
|
+
readonly type: "event";
|
|
673
|
+
readonly anonymous: false;
|
|
674
|
+
readonly inputs: readonly [{
|
|
675
|
+
readonly name: "creator";
|
|
676
|
+
readonly internalType: "address";
|
|
677
|
+
readonly type: "address";
|
|
678
|
+
readonly indexed: true;
|
|
679
|
+
}, {
|
|
680
|
+
readonly name: "listed";
|
|
681
|
+
readonly internalType: "bool";
|
|
682
|
+
readonly type: "bool";
|
|
683
|
+
readonly indexed: false;
|
|
684
|
+
}];
|
|
685
|
+
readonly name: "CreatorListed";
|
|
557
686
|
}, {
|
|
558
687
|
readonly type: "event";
|
|
559
688
|
readonly anonymous: false;
|
|
@@ -579,6 +708,31 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
579
708
|
readonly indexed: false;
|
|
580
709
|
}];
|
|
581
710
|
readonly name: "FeeListed";
|
|
711
|
+
}, {
|
|
712
|
+
readonly type: "event";
|
|
713
|
+
readonly anonymous: false;
|
|
714
|
+
readonly inputs: readonly [{
|
|
715
|
+
readonly name: "curated";
|
|
716
|
+
readonly internalType: "bool";
|
|
717
|
+
readonly type: "bool";
|
|
718
|
+
readonly indexed: false;
|
|
719
|
+
}];
|
|
720
|
+
readonly name: "MintFeeCuratedSet";
|
|
721
|
+
}, {
|
|
722
|
+
readonly type: "event";
|
|
723
|
+
readonly anonymous: false;
|
|
724
|
+
readonly inputs: readonly [{
|
|
725
|
+
readonly name: "mintFee";
|
|
726
|
+
readonly internalType: "uint256";
|
|
727
|
+
readonly type: "uint256";
|
|
728
|
+
readonly indexed: true;
|
|
729
|
+
}, {
|
|
730
|
+
readonly name: "listed";
|
|
731
|
+
readonly internalType: "bool";
|
|
732
|
+
readonly type: "bool";
|
|
733
|
+
readonly indexed: false;
|
|
734
|
+
}];
|
|
735
|
+
readonly name: "MintFeeListed";
|
|
582
736
|
}, {
|
|
583
737
|
readonly type: "event";
|
|
584
738
|
readonly anonymous: false;
|
|
@@ -642,6 +796,14 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
642
796
|
readonly type: "error";
|
|
643
797
|
readonly inputs: readonly [];
|
|
644
798
|
readonly name: "BadRate";
|
|
799
|
+
}, {
|
|
800
|
+
readonly type: "error";
|
|
801
|
+
readonly inputs: readonly [{
|
|
802
|
+
readonly name: "creator";
|
|
803
|
+
readonly internalType: "address";
|
|
804
|
+
readonly type: "address";
|
|
805
|
+
}];
|
|
806
|
+
readonly name: "CreatorNotListed";
|
|
645
807
|
}, {
|
|
646
808
|
readonly type: "error";
|
|
647
809
|
readonly inputs: readonly [{
|
|
@@ -650,6 +812,14 @@ export declare const fPolicyBaseAbi: readonly [{
|
|
|
650
812
|
readonly type: "uint256";
|
|
651
813
|
}];
|
|
652
814
|
readonly name: "FeeNotListed";
|
|
815
|
+
}, {
|
|
816
|
+
readonly type: "error";
|
|
817
|
+
readonly inputs: readonly [{
|
|
818
|
+
readonly name: "mintFee";
|
|
819
|
+
readonly internalType: "uint256";
|
|
820
|
+
readonly type: "uint256";
|
|
821
|
+
}];
|
|
822
|
+
readonly name: "MintFeeNotListed";
|
|
653
823
|
}, {
|
|
654
824
|
readonly type: "error";
|
|
655
825
|
readonly inputs: readonly [];
|
|
@@ -709,8 +879,10 @@ export interface FPoolState {
|
|
|
709
879
|
Q: bigint;
|
|
710
880
|
/** Total exposure. Grows on mint, shrinks on burn; never moves on a swap. */
|
|
711
881
|
L: bigint;
|
|
712
|
-
/** The swap fee, WAD (`phi` before F version 25, decisions 059).
|
|
882
|
+
/** 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. */
|
|
713
883
|
swapFee: bigint;
|
|
884
|
+
/** 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). */
|
|
885
|
+
mintFee: bigint;
|
|
714
886
|
/** θ₀, 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. */
|
|
715
887
|
refLogFloor: bigint;
|
|
716
888
|
/** θ = 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. */
|
|
@@ -1154,6 +1326,12 @@ export interface FPoolCreateArgs {
|
|
|
1154
1326
|
weights: bigint[];
|
|
1155
1327
|
/** 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). */
|
|
1156
1328
|
swapFee: bigint;
|
|
1329
|
+
/**
|
|
1330
|
+
* The pool's mint fee, WAD of newly-minted L — the creator's pick from the policy's menu (F version
|
|
1331
|
+
* 26, decisions 065; a curated menu refuses anything else with `MintFeeNotListed`). Defaults to
|
|
1332
|
+
* {@link presetMintFee}: twice the swap fee, capped at `FEE_MAX`.
|
|
1333
|
+
*/
|
|
1334
|
+
mintFee?: bigint;
|
|
1157
1335
|
/**
|
|
1158
1336
|
* The common cap (decisions 061): d = ln(cap price / floor price) in 1e-6 log units, a key field;
|
|
1159
1337
|
* 0 or absent is uncapped. From a leverage λ: {@link fPoolCapOfLeverage}.
|