@logswap/sdk 0.5.99 → 0.5.101
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 +104 -36
- package/dist/actions.d.ts +8 -8
- package/dist/actions.js +8 -8
- package/dist/admin.d.ts +16 -36
- package/dist/admin.js +26 -57
- package/dist/chains.d.ts +1 -1
- package/dist/client.d.ts +5 -5
- package/dist/client.js +19 -3
- package/dist/fees.js +2 -24
- package/dist/fpool.d.ts +10 -6
- package/dist/fpool.js +15 -25
- package/dist/generated.d.ts +1611 -2189
- package/dist/generated.js +947 -1224
- package/dist/history.d.ts +1 -1
- package/dist/history.js +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/indexer.d.ts +1 -1
- package/dist/indexer.js +5 -12
- package/dist/keys.d.ts +39 -52
- package/dist/keys.js +59 -38
- package/dist/liquidity.d.ts +2 -24
- package/dist/liquidity.js +7 -33
- package/dist/pools.d.ts +23 -14
- package/dist/pools.js +36 -28
- package/dist/positions.d.ts +2 -7
- package/dist/positions.js +6 -25
- package/package.json +1 -1
- package/src/actions.ts +12 -12
- package/src/admin.ts +42 -85
- package/src/chains.ts +1 -1
- package/src/client.ts +21 -5
- package/src/fees.ts +2 -22
- package/src/fpool.ts +19 -26
- package/src/generated.ts +951 -1228
- package/src/history.ts +2 -2
- package/src/index.ts +1 -2
- package/src/indexer.ts +6 -13
- package/src/keys.ts +80 -74
- package/src/liquidity.ts +7 -47
- package/src/pools.ts +45 -33
- package/src/positions.ts +7 -27
- package/dist/views.d.ts +0 -281
- package/dist/views.js +0 -188
- package/src/views.ts +0 -480
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ wrong is silent:
|
|
|
14
14
|
|
|
15
15
|
| module | what it does |
|
|
16
16
|
|---|---|
|
|
17
|
-
| `src/keys.ts` | `PoolKey` and `poolId = keccak256(abi.encode(key))` — market identity |
|
|
17
|
+
| `src/keys.ts` | `PoolKey` and `poolId = keccak256(abi.encode(key))` — market identity; the fee list and the spacing list |
|
|
18
18
|
| `src/ids.ts` | the ERC-6909 id namespace: position-class ids, token-claim ids, floor/cap packing |
|
|
19
19
|
| `src/client.ts` | the handle, plus `assertVersion` — refuse a deployment the ABI was not built for |
|
|
20
20
|
| `src/pools.ts` | market discovery from the C manager's `PoolCreated` logs, pool state, `lpEdge` = `feeGrowth` − Σ/2 |
|
|
@@ -45,6 +45,96 @@ Both are computed **offline** — no RPC, no deployment needed to address a mark
|
|
|
45
45
|
floor price (was `theta`), `refLogFloor` θ₀ — the reference floor income counts from (was
|
|
46
46
|
`theta0`), `cap` (d in 1e-6 log units, 0 uncapped), and per leg `virtualReserves` and `kappa`.
|
|
47
47
|
|
|
48
|
+
## C 20 / F 44 (contracts #146)
|
|
49
|
+
|
|
50
|
+
- `PoolCreated` (both managers) indexes `poolId`, `quote`, `policy`; `creator` is data. `discoverMarkets` filters `quote`
|
|
51
|
+
and `policy` by topic, `base` and `creator` after decoding.
|
|
52
|
+
- C `FeesClaimed` names `to`. `RouterC.user()` is gone. `SameAsset` replaces `IdenticalTokens`; a zero C burn reverts
|
|
53
|
+
`ZeroAmount`.
|
|
54
|
+
- `LensC.params()` returns `(feeList, spacingList, noCap, cVersion)`; `LensF.params()` returns `(feeList, fVersion)`.
|
|
55
|
+
- `EXPECTED_VERSION` 20, `EXPECTED_F_VERSION` 44.
|
|
56
|
+
|
|
57
|
+
## C 19 / F 43 (contracts #145)
|
|
58
|
+
|
|
59
|
+
- `PoolCreated` (both managers) indexes `poolId`, `creator`, `policy`; `quote` is data. `discoverMarkets` takes
|
|
60
|
+
`policy` and `creator` as topic filters and filters `quote` and `base` after decoding.
|
|
61
|
+
- F: `SharesRedeemed` and `DividendClaimed` index `(poolId, owner, gen)`, as `SharesMinted` and `SharesBurned`.
|
|
62
|
+
- F: `dps` and `incomeHeld` are no longer `ManagerF` functions; the SDK never read them by call.
|
|
63
|
+
- `EXPECTED_VERSION` 19, `EXPECTED_F_VERSION` 43.
|
|
64
|
+
|
|
65
|
+
## C 18 / F 42 (decisions 099, 100): the C key by index, the backstop at `initialize`, `PolicyC`
|
|
66
|
+
|
|
67
|
+
Contracts `logswap/logswap-contract#143`. **Every C pool id and position id moved**; F is unchanged (`EXPECTED_F_VERSION` stays 42).
|
|
68
|
+
This is a breaking release for C. Where a section below describes the C key, C market creation, `SponsorPolicyC` or the
|
|
69
|
+
registry's creation modes, this one supersedes it.
|
|
70
|
+
|
|
71
|
+
- **The key.** `PoolKey = { quote, base, swapFeeIdx, spacingIdx, policy, salt }` (`PoolKeyC`), `poolId = keccak256(abi.encode(key))`.
|
|
72
|
+
`swapFeeIdx` indexes `FEE_LIST` (1, 2, 5, 10, 20, 50, 100, 200 bp; one list for both managers, `F_FEE_LIST` is the same array), the
|
|
73
|
+
mint fee is the next entry (the same at the top) and `spacingIdx` indexes `SPACING_LIST` (`[1e15, 1e16, 1e17]`). `creator`, `swapFee`,
|
|
74
|
+
`mintFee` and `tickSpacing` are no key fields. The resolved values are `swapFeeOfKey(key)`, `mintFeeOfKey(key)` and
|
|
75
|
+
`tickSpacingOf(key)`; `feeOfIdx`, `feeIdxOf`, `mintFeeIdxOf` and `spacingIdxOf` convert, and throw off a list. `poolId` throws for
|
|
76
|
+
an index off its list. There is no fee-free market: `FEE_MIN` is 1 bp and `FEE_MAX` is now 200 bp.
|
|
77
|
+
- **Creation is one manager call.** `initializeMarket(c, { key, initialLogPrice, account })` calls `ManagerC.initialize`, which mints
|
|
78
|
+
the permanent backstop in the call: `account` pays dust of both tokens (and the mint fee on it) by **plain ERC-20 allowance to the
|
|
79
|
+
manager**. `approveTokenForCManager(c, token, account, amount?)` grants it and `cManagerAllowanceOk` reads it; Permit2 and the router
|
|
80
|
+
are not involved. `createMarket` and `CreateMarketArgs` are removed (`RouterC.createMarket` is gone), and so is the check that the
|
|
81
|
+
account is the key's creator. `PoolState` has no `backstopSeeded`: an initialized market has its backstop.
|
|
82
|
+
- **Discovery.** `PoolCreated` carries `swapFeeIdx` and `spacingIdx`; `discoverMarkets` and `discoverMarketsIndexed` rebuild the
|
|
83
|
+
six-field key, and `DiscoveredMarket.creator` names who opened it. The indexer's `allCPoolManagerPoolCreateds` rows need the columns
|
|
84
|
+
`swapFeeIdx` and `spacingIdx` (logswap-be follows); `tickSpacing`, `swapFee` and `mintFee` are no longer read.
|
|
85
|
+
- **Policies.** `policyCAbi` (`PolicyC`) replaces `sponsorPolicyCAbi`. `PolicyC` has `PolicyF`'s gate surface (`authority`, `open`,
|
|
86
|
+
`feeMask`, the quote list, the operator, the two modes, `rights`) plus `baseCurated` / `baseListed`, `swapFeeTax` and `mayInit`.
|
|
87
|
+
`cGateRules(c, { key, creator, gate? })` reads it: the result is `{ creatorOk, quoteOk, baseOk, feeOk, saltOk, policyOk, exists,
|
|
88
|
+
admitted }`; `creator` is required, `router` is not taken, and `mintFeeOk`, `spacingOk` and `routerTrusted` are gone (the mint fee
|
|
89
|
+
follows the swap fee, the spacing is the manager's list). `policySpacingAllowed` is removed.
|
|
90
|
+
- **Registry.** `CreationMode`, `registryCreationMode` and `registrySetCreationMode` are removed (`admit`, `creationMode`,
|
|
91
|
+
`setCreationMode`, `sponsorOf` left the contract): who creates under a policy is the policy's rule. `gateErrorAbi` carries
|
|
92
|
+
`PolicyC`'s and `PolicyF`'s errors and the registry's `NotListed`.
|
|
93
|
+
- **Mint fee helpers.** `minMintFee`, `isValidMintFee` and `presetMintFee` are removed: the mint fee is not chosen. `mintFee(p, x,
|
|
94
|
+
rate)` still previews it; pass `mintFeeOfKey(key)`.
|
|
95
|
+
- **Errors.** `SpacingZero`, `BackstopTooSmall`, `BackstopMustBeUncapped` and `NotCreator` left `ManagerC`; `PolicyNotApproved` is new.
|
|
96
|
+
- **Unchanged for a caller.** `claimFees` (the router's `claim`; the manager's own `claim` gained an `owner`, which the SDK does not
|
|
97
|
+
call directly), every swap, mint, edit and burn, and all of F.
|
|
98
|
+
- **Versions.** `EXPECTED_VERSION` is 18; `EXPECTED_F_VERSION` stays 42.
|
|
99
|
+
|
|
100
|
+
## C 17 / F 42 (decision 107): every event names its actor; `mint` takes a payer; the routers emit no event
|
|
101
|
+
|
|
102
|
+
Contracts `logswap/logswap-contract#142`. No pool id and no position id moved; the manager bindings regenerate.
|
|
103
|
+
|
|
104
|
+
- **`mint` takes a payer.** C `mint(poolId, payer, to, floor, cap, L)`, F `mint(poolId, payer, to, L, maxQuoteIn)`. `payer` is the
|
|
105
|
+
account the caller declares as funding the mint; only the event reads it. `fPoolMint` passes its `account` (a direct call: the
|
|
106
|
+
sender funds). The routed C mints (`mint`, `zapIn`, `execute`) are unchanged for a caller: the router declares its user.
|
|
107
|
+
- **F `claim` takes an owner.** `claim(poolId, gen, owner, to)`: the owner or its ERC-6909 operator. `fPoolClaim` takes an
|
|
108
|
+
optional `owner` (the `account` by default), as `fPoolBurn` and `fPoolRedeem` do.
|
|
109
|
+
- **`Settle.to`.** `RouterC`'s entries and its `Settle` struct name the receiving account `to` (`recipient` before). The SDK's
|
|
110
|
+
`Settle`, `settlement({ … to })` and `execute({ settle: { … to? } })` follow: **a caller that built a `Settle` with `recipient`
|
|
111
|
+
must rename the field**. `settleInKind` / `settleOnly` take it positionally and do not move; `WriteOptions.recipient` (the SDK's
|
|
112
|
+
own option on the named writers) is unchanged.
|
|
113
|
+
- **The actor, per event.** No `RouterCall`: a router emits no event, and nothing is attributed through a per-transaction lookup.
|
|
114
|
+
Read the user off the event itself:
|
|
115
|
+
|
|
116
|
+
| Action | Event | Actor |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| swap (both) | `Swap` | `taker` when `sender` is the deployment's router, else `sender` |
|
|
119
|
+
| mint (both) | `PositionMinted`, `SharesMinted` | `payer` when `sender` is the deployment's router, else `sender`; `to` holds the shares |
|
|
120
|
+
| burn, update, claim (C) | `PositionBurned`, `PositionUpdated`, `FeesClaimed` | `owner` |
|
|
121
|
+
| burn, redeem, claim (F) | `SharesBurned`, `SharesRedeemed`, `DividendClaimed` | `owner` |
|
|
122
|
+
| birth | `PoolCreated` | `creator` (the third topic on both managers) |
|
|
123
|
+
| deploy, harvest, close (F) | `LiquidityDeployed`, `IncomeHarvested`, `GenerationFrozen` | `operator` (a topic) |
|
|
124
|
+
| `collectProtocolFees` (C) | `ProtocolFeesCollected` | `sender` (a topic) |
|
|
125
|
+
|
|
126
|
+
- **Event shapes** (`getEventLogs` decodes by field name, so a consumer keyed on the old names follows):
|
|
127
|
+
`PositionMinted(poolId, to, id, sender, payer, shares, dBase, dQuote)`;
|
|
128
|
+
`SharesMinted(poolId, to, gen, sender, payer, L, shares, dQuote, poolL, supply)` and `SharesBurned` index `gen`;
|
|
129
|
+
F `PoolCreated(poolId, quote, creator, policy, bases, swapFeeIdx, salt)` (`policy` is data now, so it no longer filters as a topic);
|
|
130
|
+
`ProtocolFeesCollected(poolId, sender, to, amount)`; `ClassRegistered(poolId, id, floor, cap, capped)` (`poolId` first).
|
|
131
|
+
Renamed to `owner`: `PositionBurned.from`, `SharesBurned.from`, and `holder` on `FeesClaimed`, `PositionUpdated`, `DividendClaimed`.
|
|
132
|
+
`discoverFPools` rows carry `creator`.
|
|
133
|
+
- **Errors.** `RouterF.BadToken` is `WrongToken`, the name `RouterC` already uses.
|
|
134
|
+
- **Indexer.** The topic hashes moved (a pure rename's stands, and so does `SharesBurned`'s, whose `gen` is now a topic), and the columns follow the field names (`owner`, `sender`, `payer`,
|
|
135
|
+
`creator`, `operator`): the rindexer tables must be rebuilt from this ABI (logswap-be follows). Until then a read falls back to the node.
|
|
136
|
+
- **Versions.** `EXPECTED_VERSION` is 17 (C) and `EXPECTED_F_VERSION` is 42.
|
|
137
|
+
|
|
48
138
|
## F 41 (`policy.md`): one policy contract, the operator runs the pool, the fee is an index
|
|
49
139
|
|
|
50
140
|
Follows contracts `f3d1420` (logswap-contract #120, squash-merged to main on 2026-11-07). A breaking release: every F pool id moved, and the F policy surface is replaced.
|
|
@@ -89,6 +179,8 @@ The C side is untouched until Policy C follows.
|
|
|
89
179
|
|
|
90
180
|
## C 16 / F 40 (decision 098): immutable, LOG-deployed policies; one sponsored policy per manager
|
|
91
181
|
|
|
182
|
+
(On C, superseded by C 18: `PolicyC` replaces `SponsorPolicyC` and the registry has no creation modes.)
|
|
183
|
+
|
|
92
184
|
Follows contracts `99827f8`. This is a breaking release: the policy surface is replaced.
|
|
93
185
|
|
|
94
186
|
- **Kinds.** `PublicPolicy` and `PrivatePolicy` are gone. A policy says it is `"sponsor"` (`SponsorPolicyF` / `SponsorPolicyC`: the LOG's own
|
|
@@ -123,7 +215,7 @@ Follows contracts `99827f8`. This is a breaking release: the policy surface is r
|
|
|
123
215
|
|
|
124
216
|
## C 15 / F 39 (decisions 096, 097): a router and a lens per manager, and a C market has a creator and a salt
|
|
125
217
|
|
|
126
|
-
(The policy parts of this section are superseded by the one above.)
|
|
218
|
+
(The policy parts of this section are superseded by the one above; the C key and `createMarket` by C 18.)
|
|
127
219
|
|
|
128
220
|
Follows contracts `f3164de` (096 + #112 + #113 + #115 + #116). What changes for a consumer:
|
|
129
221
|
|
|
@@ -220,37 +312,14 @@ answers only partly.
|
|
|
220
312
|
shared tables with `contract: indexedContractOf(kind, event)` (or `kind` on `getEventsLogs`).
|
|
221
313
|
- `tokensCreated` lists the factory's tokens (`addresses.tokenFactory`): the token list's provenance.
|
|
222
314
|
|
|
223
|
-
## Indexer views
|
|
224
|
-
|
|
225
|
-
The
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
| --- | --- | --- |
|
|
232
|
-
| `poolDirectory` | `allPoolDirectories` | a pool of either manager, its kind and birth |
|
|
233
|
-
| `eventUsers` | `allEventUsers` | a manager event and who did it (the router's caller when routed) |
|
|
234
|
-
| `poolHolders` | `allPoolHolders` | a current ERC-6909 balance, with C's backstop and F's dead shares flagged |
|
|
235
|
-
| `walletPositions` | `allWalletPositions` | a wallet's holding; F valued at the latest share value |
|
|
236
|
-
| `walletPoolFlows` | `allWalletPoolFlows` | a wallet's in/out, fees and dividends per pool |
|
|
237
|
-
| `swapFlows` | `allSwapFlows` | a swap's volume and fee in quote |
|
|
238
|
-
| `priceTicks` | `allPriceTicks` | a price point per (pool, base) |
|
|
239
|
-
| `candles(url, "minute" \| "hour" \| "day")` | `allCandle…s` | OHLC with volume and fees |
|
|
240
|
-
| `poolTvlHours` | `allPoolTvlHours` | the hour's last snapshot: TVL, liquidity |
|
|
241
|
-
| `poolSummaries` | `allPoolSummaries` | 24 h / 7 d volume, fees, APY; latest TVL |
|
|
242
|
-
| `generationSteps` | `allGenerationSteps` | a generation step and the split of the income it released |
|
|
243
|
-
| `padStatuses` | `allPadStatuses` | each pad and POL now, with the next threshold and progress |
|
|
244
|
-
| `protocolRevenueDays` | `allProtocolRevenueDays` | protocol revenue per day and source |
|
|
245
|
-
|
|
246
|
-
Given an `indexer`, three functions now take their figure from a view and keep their previous path
|
|
247
|
-
as the fallback, with the same answer on the same data:
|
|
248
|
-
- `holdingsOf`: the owner's held class ids from `pool_holder`, then the lens as before;
|
|
249
|
-
- `fPoolShareHolders`: the holders from `pool_holder`;
|
|
250
|
-
- `swapFees`: the window from `swap_flow`.
|
|
251
|
-
|
|
252
|
-
What stays a live read: a C position's value and every unclaimed fee or dividend (the lens: `cLegsOf`,
|
|
253
|
-
`cHeldByIds`, `dividendOf`). They accrue without events, so no view holds them.
|
|
315
|
+
## Indexer views
|
|
316
|
+
|
|
317
|
+
The SDK reads the indexer's event tables (`getEventLogs`, `indexer.ts`) and nothing above them. The derived views
|
|
318
|
+
(logswap-backend `devnet/VIEWS.md`: every F pool's replayed state, swap flows, candles, holders, positions, rules,
|
|
319
|
+
revenue) are read by the app's `@logswap/base` (`packages/base/src/indexer.ts` in logswap-app), which follows their
|
|
320
|
+
schema; the readers that lived here (`views.ts`) asked columns the indexer no longer has and are gone.
|
|
321
|
+
|
|
322
|
+
What stays a live read: every unclaimed fee or dividend (the lens: `dividendOf`). It accrues without events.
|
|
254
323
|
|
|
255
324
|
## The F pool's life: four calls (F 41, `policy.md` §9–10)
|
|
256
325
|
|
|
@@ -344,9 +413,8 @@ What changes for readers:
|
|
|
344
413
|
- **The SDK hides the manager/router/lens split.** Which contract hosts which action is currently
|
|
345
414
|
decided by EIP-170 headroom, not by design — so a future re-homing must be an SDK patch, not a
|
|
346
415
|
breaking change for consumers.
|
|
347
|
-
- **
|
|
348
|
-
|
|
349
|
-
Always address a market by the key it was initialized with.
|
|
416
|
+
- **Address a market by its exact key.** The key carries indices (`swapFeeIdx`, `spacingIdx`), never resolved values; two keys
|
|
417
|
+
that differ in any field, the salt included, are **different markets with different ids**.
|
|
350
418
|
- **Split every ERC-6909 `Transfer` on bit 255.** Clear means a token claim, not a position; an
|
|
351
419
|
indexer that ignores this reports phantom LP positions for market makers parking inventory.
|
|
352
420
|
|
package/dist/actions.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `execute(actions, settle)` runs a list of actions — mint, burn, update, claim, swap, path, in any
|
|
5
5
|
* order, across any C markets — under ONE manager lock. Each action accrues deltas on the router
|
|
6
6
|
* and settles nothing; the batch settles once per token in `settle.tokens`, pulling at most
|
|
7
|
-
* `maxIn[i]` from the caller and taking at least `minOut[i]` to
|
|
7
|
+
* `maxIn[i]` from the caller and taking at least `minOut[i]` to `settle.to`. A touched token
|
|
8
8
|
* left off the list fails the manager's own close (`TokensNotSettled`), so the list is also the
|
|
9
9
|
* caller's statement of which tokens may move.
|
|
10
10
|
*
|
|
@@ -44,8 +44,8 @@ export interface Settle {
|
|
|
44
44
|
tokens: readonly Address[];
|
|
45
45
|
maxIn: readonly bigint[];
|
|
46
46
|
minOut: readonly bigint[];
|
|
47
|
-
/** Receives whatever is taken, and the shares the actions mint. */
|
|
48
|
-
|
|
47
|
+
/** Receives whatever is taken, and the shares the actions mint (`Settle.to`; `recipient` before C 17). */
|
|
48
|
+
to: Address;
|
|
49
49
|
}
|
|
50
50
|
/** Mint exposure `L` at `targetFloor` (off-grid blends the two adjacent rungs), `cap` optional. */
|
|
51
51
|
export declare function mintAction(a: {
|
|
@@ -99,7 +99,7 @@ export declare function settlement(a: {
|
|
|
99
99
|
tokens: readonly Address[];
|
|
100
100
|
maxIn?: readonly bigint[];
|
|
101
101
|
minOut?: readonly bigint[];
|
|
102
|
-
|
|
102
|
+
to: Address;
|
|
103
103
|
}): Settle;
|
|
104
104
|
export interface PairBounds {
|
|
105
105
|
maxBaseIn?: bigint;
|
|
@@ -108,19 +108,19 @@ export interface PairBounds {
|
|
|
108
108
|
minQuoteOut?: bigint;
|
|
109
109
|
}
|
|
110
110
|
/** Settle both of a market's tokens, in kind. */
|
|
111
|
-
export declare function settleInKind(key: PoolKey,
|
|
111
|
+
export declare function settleInKind(key: PoolKey, to: Address, b?: PairBounds): Settle;
|
|
112
112
|
/**
|
|
113
113
|
* Settle in ONE of a market's tokens: the other is bound to zero both ways, so the batch must have
|
|
114
114
|
* netted it — which is what a trailing `OPEN_DELTA` swap does.
|
|
115
115
|
*/
|
|
116
|
-
export declare function settleOnly(key: PoolKey,
|
|
116
|
+
export declare function settleOnly(key: PoolKey, to: Address, side: "base" | "quote", b?: {
|
|
117
117
|
maxIn?: bigint;
|
|
118
118
|
minOut?: bigint;
|
|
119
119
|
}): Settle;
|
|
120
120
|
export interface ExecuteArgs extends WriteOptions {
|
|
121
121
|
actions: readonly Action[];
|
|
122
|
-
settle: Omit<Settle, "
|
|
123
|
-
|
|
122
|
+
settle: Omit<Settle, "to"> & {
|
|
123
|
+
to?: Address;
|
|
124
124
|
};
|
|
125
125
|
/** Tokens the batch may pull, for the Permit2 signatures. Defaults to every token with `maxIn > 0`. */
|
|
126
126
|
pullTokens?: readonly Address[];
|
package/dist/actions.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `execute(actions, settle)` runs a list of actions — mint, burn, update, claim, swap, path, in any
|
|
5
5
|
* order, across any C markets — under ONE manager lock. Each action accrues deltas on the router
|
|
6
6
|
* and settles nothing; the batch settles once per token in `settle.tokens`, pulling at most
|
|
7
|
-
* `maxIn[i]` from the caller and taking at least `minOut[i]` to
|
|
7
|
+
* `maxIn[i]` from the caller and taking at least `minOut[i]` to `settle.to`. A touched token
|
|
8
8
|
* left off the list fails the manager's own close (`TokensNotSettled`), so the list is also the
|
|
9
9
|
* caller's statement of which tokens may move.
|
|
10
10
|
*
|
|
@@ -98,39 +98,39 @@ export function settlement(a) {
|
|
|
98
98
|
const minOut = a.minOut ?? a.tokens.map(() => 0n);
|
|
99
99
|
if (maxIn.length !== n || minOut.length !== n)
|
|
100
100
|
throw new Error("logswap: settlement bounds length mismatch");
|
|
101
|
-
return { tokens: a.tokens, maxIn, minOut,
|
|
101
|
+
return { tokens: a.tokens, maxIn, minOut, to: a.to };
|
|
102
102
|
}
|
|
103
103
|
/** Settle both of a market's tokens, in kind. */
|
|
104
|
-
export function settleInKind(key,
|
|
104
|
+
export function settleInKind(key, to, b = {}) {
|
|
105
105
|
return settlement({
|
|
106
106
|
tokens: [key.base, key.quote],
|
|
107
107
|
maxIn: [b.maxBaseIn ?? UNBOUNDED, b.maxQuoteIn ?? UNBOUNDED],
|
|
108
108
|
minOut: [b.minBaseOut ?? 0n, b.minQuoteOut ?? 0n],
|
|
109
|
-
|
|
109
|
+
to,
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* Settle in ONE of a market's tokens: the other is bound to zero both ways, so the batch must have
|
|
114
114
|
* netted it — which is what a trailing `OPEN_DELTA` swap does.
|
|
115
115
|
*/
|
|
116
|
-
export function settleOnly(key,
|
|
116
|
+
export function settleOnly(key, to, side, b = {}) {
|
|
117
117
|
const base = side === "base";
|
|
118
118
|
return settlement({
|
|
119
119
|
tokens: [key.base, key.quote],
|
|
120
120
|
maxIn: [base ? (b.maxIn ?? UNBOUNDED) : 0n, base ? 0n : (b.maxIn ?? UNBOUNDED)],
|
|
121
121
|
minOut: [base ? (b.minOut ?? 0n) : 0n, base ? 0n : (b.minOut ?? 0n)],
|
|
122
|
-
|
|
122
|
+
to,
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
/** Run a batch: one lock, one settlement per token, one transaction (Permit2 signatures ride inside). */
|
|
126
126
|
export async function execute(c, a) {
|
|
127
|
-
const settle = { ...a.settle,
|
|
127
|
+
const settle = { ...a.settle, to: a.settle.to ?? resolveRecipient(c, a) };
|
|
128
128
|
const pull = a.pullTokens ?? settle.tokens.filter((_, i) => settle.maxIn[i] > 0n);
|
|
129
129
|
return sendRouterWriteWithPermits(c, { side: "C", abi: routerCAbi, functionName: "execute", args: [a.actions, settle, resolveDeadline(a)] }, [...pull]);
|
|
130
130
|
}
|
|
131
131
|
/** Simulate a batch: the per-action returns and the signed flows (+ = paid in), without sending. */
|
|
132
132
|
export async function simulateExecute(c, a) {
|
|
133
|
-
const settle = { ...a.settle,
|
|
133
|
+
const settle = { ...a.settle, to: a.settle.to ?? a.account ?? resolveRecipient(c, a) };
|
|
134
134
|
const [results, flows] = await simulateRouterWrite(c, {
|
|
135
135
|
side: "C",
|
|
136
136
|
abi: routerCAbi,
|
package/dist/admin.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare function policyApproved(c: LogswapClient, policy: Address): Promi
|
|
|
42
42
|
/** One policy on the registry's list, with what it is. */
|
|
43
43
|
export interface RegistryEntry {
|
|
44
44
|
policy: Address;
|
|
45
|
-
/** The label the policy's terms spell ({@link fPolicyTermsOf}) — what a pool born under it is; `null` for a policy that answers no F terms (
|
|
45
|
+
/** The label the policy's terms spell ({@link fPolicyTermsOf}) — what a pool born under it is; `null` for a policy that answers no F terms (a `PolicyC`). */
|
|
46
46
|
kind: FPoolKind | null;
|
|
47
47
|
/** The name recorded at approval (`approve(policy, name)`). */
|
|
48
48
|
name: string;
|
|
@@ -120,65 +120,45 @@ export declare function policyFeeAllowed(c: LogswapClient, policy: Address, swap
|
|
|
120
120
|
listed: boolean;
|
|
121
121
|
allowed: boolean;
|
|
122
122
|
}>;
|
|
123
|
-
/** `PolicyRegistry.CreationMode` (decisions 073, 098): who may create under a policy. Open = 0, SponsorOnly = 1 (the policy's own immutable sponsor, who must also be the key's creator). `Restricted` and the initializer list are gone. */
|
|
124
|
-
export type CreationMode = "open" | "sponsorOnly";
|
|
125
|
-
/** `PolicyRegistry.setCreationMode(policy, mode)` (the LOG Authority). A sponsored policy is approved `sponsorOnly`. */
|
|
126
|
-
export declare function registrySetCreationMode(c: LogswapClient, policy: Address, mode: CreationMode): Promise<Hash>;
|
|
127
123
|
/** `PolicyRegistry.setForwarderTrusted` (the LOG Authority): a router whose `user()` names the creator. Moved off the public policy in F version 33. */
|
|
128
124
|
export declare function registrySetForwarderTrusted(c: LogswapClient, forwarder: Address, trusted: boolean): Promise<Hash>;
|
|
129
|
-
/** `PolicyRegistry.creationMode(policy)`. */
|
|
130
125
|
/**
|
|
131
126
|
* `PolicyRegistry.userOf(caller)` (C 15, decision 097): the account a caller acts for — the user a trusted forwarder
|
|
132
|
-
* (a router) names, else the caller itself. The account
|
|
133
|
-
* first minter; what a create form compares to the key's `creator`.
|
|
127
|
+
* (a router) names, else the caller itself. The account a manager names as a pool's creator and asks its policy about at a birth.
|
|
134
128
|
*/
|
|
135
129
|
export declare function registryUserOf(c: LogswapClient, caller: Address): Promise<Address>;
|
|
136
|
-
export declare function registryCreationMode(c: LogswapClient, policy: Address): Promise<CreationMode>;
|
|
137
|
-
/** Whether `policy` (a `SponsorPolicyC`) admits C tick spacing `tickSpacing`: it curates spacings (`spacingCurated`) and lists it, or it does not curate. */
|
|
138
|
-
export declare function policySpacingAllowed(c: LogswapClient, policy: Address, tickSpacing: bigint): Promise<{
|
|
139
|
-
curated: boolean;
|
|
140
|
-
listed: boolean;
|
|
141
|
-
allowed: boolean;
|
|
142
|
-
}>;
|
|
143
130
|
export interface CGateRules {
|
|
144
|
-
/**
|
|
145
|
-
* The registry admits `creator` to create under `key.policy` (creation mode and sponsor binding; decisions 073, 097, 098):
|
|
146
|
-
* `admit(policy, creator, creator)` resolves to `creator`. Both managers then require the initializer to BE the key's creator (`NotCreator`).
|
|
147
|
-
*/
|
|
131
|
+
/** The policy admits `creator` (`PolicyBase._admitBirth`): anyone on an open policy, the policy's authority on a closed one (`Refused`). */
|
|
148
132
|
creatorOk: boolean;
|
|
149
133
|
/** The quote is on the policy's list, or the policy lists none (`quoteCurated`). */
|
|
150
134
|
quoteOk: boolean;
|
|
151
|
-
/** The
|
|
135
|
+
/** The base is on the policy's list, or the policy lists none (`baseCurated`; `BaseNotListed`). */
|
|
136
|
+
baseOk: boolean;
|
|
137
|
+
/** The swap fee's index is on the policy's `feeMask` (an empty mask lists all eight; `FeeNotListed`). The mint fee follows it. */
|
|
152
138
|
feeOk: boolean;
|
|
153
|
-
/**
|
|
154
|
-
mintFeeOk: boolean;
|
|
155
|
-
/** The tick spacing is on the policy's list, or it lists none (`spacingCurated`). */
|
|
156
|
-
spacingOk: boolean;
|
|
157
|
-
/** A canonical policy (the LOG's open instance) needs `salt` zero (`NotCanonical`); a desk's may run several markets of one shape. */
|
|
139
|
+
/** An open policy needs `salt` zero (`NotCanonical`); a closed one may run several markets of one shape. */
|
|
158
140
|
saltOk: boolean;
|
|
141
|
+
/** The registry lists the policy and its sunset has not passed (`PolicyNotApproved`); true on a deployment with no registry. */
|
|
142
|
+
policyOk: boolean;
|
|
159
143
|
/** This exact market (the key's id) is already initialized: another is a different key. */
|
|
160
144
|
exists: boolean;
|
|
161
|
-
/**
|
|
162
|
-
routerTrusted: boolean;
|
|
163
|
-
/** Every check passes: the policy would admit this market from this creator (the manager checks the fee domain, `BadParam`). */
|
|
145
|
+
/** Every check passes: the policy would admit this market from this creator (the manager checks the two indices, `BadParam`). */
|
|
164
146
|
admitted: boolean;
|
|
165
147
|
}
|
|
166
148
|
/**
|
|
167
|
-
* A
|
|
168
|
-
* is asked (
|
|
169
|
-
*
|
|
170
|
-
* trusted forwarder's `user()`). The policy's pair list is gone (098).
|
|
149
|
+
* A C policy's birth checks for one candidate market and creator, in one round of reads — what the create form shows before a
|
|
150
|
+
* wallet is asked (C 18, decisions 099, 100: `PolicyC.mayInit`). The policy is `key.policy`; `creator` is the account that will call
|
|
151
|
+
* {@link initializeMarket}. The spacing is the manager's list ({@link SPACING_LIST}) and none of the policy's.
|
|
171
152
|
*/
|
|
172
153
|
export declare function cGateRules(c: LogswapClient, a: {
|
|
173
154
|
key: PoolKey;
|
|
174
|
-
creator
|
|
175
|
-
router?: Address;
|
|
155
|
+
creator: Address;
|
|
176
156
|
gate?: Address;
|
|
177
157
|
}): Promise<CGateRules>;
|
|
178
158
|
/**
|
|
179
159
|
* Every refusal a birth can meet at a policy or the registry (064, 065, 098; policy.md §4.4), for `decodeErrorResult` on a
|
|
180
|
-
* failed simulation: the
|
|
181
|
-
* `BaseNotListed`, `TooManyLegs`, `AlreadyHeld`, …) and the registry's
|
|
160
|
+
* failed simulation: the C policy's errors, the F policy's (`Refused`, `NotCanonical`, `FeeNotListed`, `QuoteNotListed`,
|
|
161
|
+
* `BaseNotListed`, `TooManyLegs`, `AlreadyHeld`, …) and the registry's `NotListed`. One entry per distinct signature.
|
|
182
162
|
*/
|
|
183
163
|
type AbiError = {
|
|
184
164
|
type: "error";
|
package/dist/admin.js
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
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
15
|
* payer's slice, capped by the manager at `INCOME_TAX_MAX`.
|
|
16
16
|
*/
|
|
17
|
-
import { poolId as keyId } from "./keys.js";
|
|
18
|
-
import { managerC
|
|
17
|
+
import { poolId as keyId, FEE_LIST } from "./keys.js";
|
|
18
|
+
import { managerC } from "./client.js";
|
|
19
19
|
import { getPool } from "./pools.js";
|
|
20
|
-
import { managerCAbi, managerFAbi, policyFAbi,
|
|
20
|
+
import { managerCAbi, managerFAbi, policyFAbi, policyCAbi, policyRegistryAbi } from "./generated.js";
|
|
21
21
|
import { bytes32ToText, fFeeListed, fPoolKindOfPolicy, fPolicyTermsOf, textToBytes32 } from "./fpool.js";
|
|
22
22
|
function wallet(c) {
|
|
23
23
|
if (!c.wallet)
|
|
@@ -37,9 +37,9 @@ function write(c, address, abi, functionName, args) {
|
|
|
37
37
|
export async function cSwapFeeTax(c, policy) {
|
|
38
38
|
const address = policy ?? c.addresses.publicPolicyC;
|
|
39
39
|
if (!address)
|
|
40
|
-
throw new Error("logswap: this deployment carries no C
|
|
40
|
+
throw new Error("logswap: this deployment carries no C policy (addresses.publicPolicyC); pass one");
|
|
41
41
|
const [tax, max] = await Promise.all([
|
|
42
|
-
c.public.readContract({ address, abi:
|
|
42
|
+
c.public.readContract({ address, abi: policyCAbi, functionName: "swapFeeTax" }),
|
|
43
43
|
c.public.readContract({ address: managerC(c), abi: managerCAbi, functionName: "SWAP_FEE_TAX_MAX" }),
|
|
44
44
|
]);
|
|
45
45
|
return { tax, max };
|
|
@@ -188,20 +188,13 @@ export async function policyFeeAllowed(c, policy, swapFeeIdx) {
|
|
|
188
188
|
const listed = fFeeListed(feeMask, swapFeeIdx);
|
|
189
189
|
return { curated: feeMask !== 0, listed, allowed: listed };
|
|
190
190
|
}
|
|
191
|
-
const CREATION_MODES = ["open", "sponsorOnly"];
|
|
192
|
-
/** `PolicyRegistry.setCreationMode(policy, mode)` (the LOG Authority). A sponsored policy is approved `sponsorOnly`. */
|
|
193
|
-
export async function registrySetCreationMode(c, policy, mode) {
|
|
194
|
-
return registryWrite(c, "setCreationMode", [policy, CREATION_MODES.indexOf(mode)]);
|
|
195
|
-
}
|
|
196
191
|
/** `PolicyRegistry.setForwarderTrusted` (the LOG Authority): a router whose `user()` names the creator. Moved off the public policy in F version 33. */
|
|
197
192
|
export async function registrySetForwarderTrusted(c, forwarder, trusted) {
|
|
198
193
|
return registryWrite(c, "setForwarderTrusted", [forwarder, trusted]);
|
|
199
194
|
}
|
|
200
|
-
/** `PolicyRegistry.creationMode(policy)`. */
|
|
201
195
|
/**
|
|
202
196
|
* `PolicyRegistry.userOf(caller)` (C 15, decision 097): the account a caller acts for — the user a trusted forwarder
|
|
203
|
-
* (a router) names, else the caller itself. The account
|
|
204
|
-
* first minter; what a create form compares to the key's `creator`.
|
|
197
|
+
* (a router) names, else the caller itself. The account a manager names as a pool's creator and asks its policy about at a birth.
|
|
205
198
|
*/
|
|
206
199
|
export async function registryUserOf(c, caller) {
|
|
207
200
|
const registry = await policyRegistryOf(c);
|
|
@@ -209,60 +202,36 @@ export async function registryUserOf(c, caller) {
|
|
|
209
202
|
return caller;
|
|
210
203
|
return (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "userOf", args: [caller] }));
|
|
211
204
|
}
|
|
212
|
-
export async function registryCreationMode(c, policy) {
|
|
213
|
-
const registry = await policyRegistryOf(c);
|
|
214
|
-
if (registry === ZERO)
|
|
215
|
-
return "open";
|
|
216
|
-
const m = (await c.public.readContract({ address: registry, abi: policyRegistryAbi, functionName: "creationMode", args: [policy] }));
|
|
217
|
-
return CREATION_MODES[Number(m)] ?? "open";
|
|
218
|
-
}
|
|
219
|
-
/** Whether `policy` (a `SponsorPolicyC`) admits C tick spacing `tickSpacing`: it curates spacings (`spacingCurated`) and lists it, or it does not curate. */
|
|
220
|
-
export async function policySpacingAllowed(c, policy, tickSpacing) {
|
|
221
|
-
const [curated, listed] = await Promise.all([
|
|
222
|
-
c.public.readContract({ address: policy, abi: sponsorPolicyCAbi, functionName: "spacingCurated" }),
|
|
223
|
-
c.public.readContract({ address: policy, abi: sponsorPolicyCAbi, functionName: "spacingListed", args: [tickSpacing] }),
|
|
224
|
-
]);
|
|
225
|
-
return { curated, listed, allowed: !curated || listed };
|
|
226
|
-
}
|
|
227
205
|
/**
|
|
228
|
-
* A
|
|
229
|
-
* is asked (
|
|
230
|
-
*
|
|
231
|
-
* trusted forwarder's `user()`). The policy's pair list is gone (098).
|
|
206
|
+
* A C policy's birth checks for one candidate market and creator, in one round of reads — what the create form shows before a
|
|
207
|
+
* wallet is asked (C 18, decisions 099, 100: `PolicyC.mayInit`). The policy is `key.policy`; `creator` is the account that will call
|
|
208
|
+
* {@link initializeMarket}. The spacing is the manager's list ({@link SPACING_LIST}) and none of the policy's.
|
|
232
209
|
*/
|
|
233
210
|
export async function cGateRules(c, a) {
|
|
234
211
|
const g = a.gate ?? a.key.policy;
|
|
235
|
-
const rd = (functionName, args = []) => c.public.readContract({ address: g, abi:
|
|
212
|
+
const rd = (functionName, args = []) => c.public.readContract({ address: g, abi: policyCAbi, functionName, args });
|
|
236
213
|
const { key } = a;
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const [quoteCurated, quoteListed, feeListed, mintFeeListed, spacingCurated, spacingListed, canonical, state, routerTrusted, creatorOk] = await Promise.all([
|
|
214
|
+
const [open, authority, feeMask, quoteCurated, quoteListed, baseCurated, baseListed, state, policyOk] = await Promise.all([
|
|
215
|
+
rd("open"),
|
|
216
|
+
rd("authority"),
|
|
217
|
+
rd("feeMask"),
|
|
242
218
|
rd("quoteCurated"),
|
|
243
219
|
rd("quoteListed", [key.quote]),
|
|
244
|
-
rd("
|
|
245
|
-
rd("
|
|
246
|
-
rd("spacingCurated"),
|
|
247
|
-
rd("spacingListed", [key.tickSpacing]),
|
|
248
|
-
rd("canonical"),
|
|
220
|
+
rd("baseCurated"),
|
|
221
|
+
rd("baseListed", [key.base]),
|
|
249
222
|
getPool(c, key),
|
|
250
|
-
|
|
251
|
-
registry === ZERO
|
|
252
|
-
? Promise.resolve(true)
|
|
253
|
-
: registryRd("admit", [g, creator, creator]).then((who) => who.toLowerCase() === creator.toLowerCase(), () => false),
|
|
223
|
+
policyApproved(c, g),
|
|
254
224
|
]);
|
|
255
225
|
const r = {
|
|
256
|
-
creatorOk,
|
|
226
|
+
creatorOk: open || authority.toLowerCase() === a.creator.toLowerCase(),
|
|
257
227
|
quoteOk: !quoteCurated || quoteListed,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
228
|
+
baseOk: !baseCurated || baseListed,
|
|
229
|
+
feeOk: key.swapFeeIdx < FEE_LIST.length && fFeeListed(Number(feeMask), key.swapFeeIdx),
|
|
230
|
+
saltOk: !open || key.salt === "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
231
|
+
policyOk,
|
|
262
232
|
exists: state.initialized,
|
|
263
|
-
routerTrusted,
|
|
264
233
|
};
|
|
265
|
-
return { ...r, admitted: r.creatorOk && r.quoteOk && r.
|
|
234
|
+
return { ...r, admitted: r.creatorOk && r.quoteOk && r.baseOk && r.feeOk && r.saltOk && r.policyOk && !r.exists };
|
|
266
235
|
}
|
|
267
236
|
const isAbiError = (x) => x.type === "error";
|
|
268
237
|
export const gateErrorAbi = (() => {
|
|
@@ -270,10 +239,10 @@ export const gateErrorAbi = (() => {
|
|
|
270
239
|
const sig = (x) => `${x.name}(${x.inputs.map((i) => i.type).join(",")})`;
|
|
271
240
|
const all = (abi) => abi.filter(isAbiError);
|
|
272
241
|
const errors = [
|
|
273
|
-
...all(
|
|
242
|
+
...all(policyCAbi),
|
|
274
243
|
...all(policyFAbi),
|
|
275
|
-
//
|
|
276
|
-
...all(policyRegistryAbi).filter((x) =>
|
|
244
|
+
// who creates under a policy is the policy's rule (C 18, decision 100); the registry only lists the policy
|
|
245
|
+
...all(policyRegistryAbi).filter((x) => x.name === "NotListed"),
|
|
277
246
|
];
|
|
278
247
|
return errors.filter((x) => (seen.has(sig(x)) ? false : (seen.add(sig(x)), true)));
|
|
279
248
|
})();
|
package/dist/chains.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ export interface LogswapDeployment {
|
|
|
139
139
|
polPolicy: Address;
|
|
140
140
|
/** The LOG's pad policy on F (`PolicyF`, `seedToDead`: income-only harvests, never closes). */
|
|
141
141
|
padPolicy: Address;
|
|
142
|
-
/** The LOG's open
|
|
142
|
+
/** The LOG's open policy on C (`PolicyC`, `open`: anyone creates at salt zero, no gate ever). Absent while the chain has no C stack. */
|
|
143
143
|
publicPolicyC?: Address;
|
|
144
144
|
/** The devnet's token factory; local deployments only. */
|
|
145
145
|
tokenFactory?: Address;
|
package/dist/client.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface LogswapAddresses {
|
|
|
24
24
|
* The C stack is optional: F ships first, and a chain that has not opted into C carries none.
|
|
25
25
|
*/
|
|
26
26
|
managerC?: Address;
|
|
27
|
-
/** C's user entry: the batch, the named one-action entries,
|
|
27
|
+
/** C's user entry: the batch, the named one-action entries, Permit2 (a market is opened on the manager). Its own Permit2 spender. */
|
|
28
28
|
routerC?: Address;
|
|
29
29
|
/** C's read-only lens: ladder derivations and views. */
|
|
30
30
|
lensC?: Address;
|
|
@@ -39,7 +39,7 @@ export interface LogswapAddresses {
|
|
|
39
39
|
privatePolicy?: Address;
|
|
40
40
|
polPolicy?: Address;
|
|
41
41
|
padPolicy?: Address;
|
|
42
|
-
/** The LOG's open
|
|
42
|
+
/** The LOG's open policy on C (`PolicyC`): the policy of a public market. Absent with no C stack. */
|
|
43
43
|
publicPolicyC?: Address;
|
|
44
44
|
/**
|
|
45
45
|
* The policy registry: what a pool of each kind may be born under, and the
|
|
@@ -133,14 +133,14 @@ export declare function clientChainId(c: LogswapClient): Promise<number>;
|
|
|
133
133
|
* **8** since 2026-10-13 (logswap-contract decision 066): the collector is split into two roles —
|
|
134
134
|
* `feeCollector` / `proposeCollector` / `acceptCollector` are `treasury` / `proposeTreasury` (the
|
|
135
135
|
* LOG Authority's) / `acceptTreasury`; `setSwapFeeTax` and `setGate` leave the manager: the tax is
|
|
136
|
-
* each market's, answered by its policy at birth (
|
|
136
|
+
* each market's, answered by its policy at birth (`PolicyC.swapFeeTax`, an immutable; `SponsorPolicyC` before C 18) and
|
|
137
137
|
* read as `getPool(key).swapFeeTax`; the gate is fixed at construction; `collectProtocolFees(key)` is
|
|
138
138
|
* permissionless and pays the treasury. No pool id moved.
|
|
139
139
|
* 9 (decision 071): the events — one `Swap` on both managers (`taker`, `feeToken`), `CSwapState`, C's `swap`
|
|
140
140
|
* takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
|
|
141
141
|
* `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
|
|
142
142
|
*/
|
|
143
|
-
export declare const EXPECTED_VERSION =
|
|
143
|
+
export declare const EXPECTED_VERSION = 20n;
|
|
144
144
|
/**
|
|
145
145
|
* The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
|
|
146
146
|
* 4 was the income-only harvest cut).
|
|
@@ -152,7 +152,7 @@ export declare const EXPECTED_VERSION = 16n;
|
|
|
152
152
|
* passes it; when one lands, raise this constant in the same change, which is the discipline
|
|
153
153
|
* `EXPECTED_VERSION` enforces mechanically and this one asks for.
|
|
154
154
|
*/
|
|
155
|
-
export declare const EXPECTED_F_VERSION =
|
|
155
|
+
export declare const EXPECTED_F_VERSION = 44n;
|
|
156
156
|
export declare function assertVersion(c: LogswapClient, expected?: bigint): Promise<void>;
|
|
157
157
|
/**
|
|
158
158
|
* The versions say the managers are the right code; this says the rest of the addresses belong
|
package/dist/client.js
CHANGED
|
@@ -140,7 +140,7 @@ function guardChain(wallet, pub) {
|
|
|
140
140
|
* **8** since 2026-10-13 (logswap-contract decision 066): the collector is split into two roles —
|
|
141
141
|
* `feeCollector` / `proposeCollector` / `acceptCollector` are `treasury` / `proposeTreasury` (the
|
|
142
142
|
* LOG Authority's) / `acceptTreasury`; `setSwapFeeTax` and `setGate` leave the manager: the tax is
|
|
143
|
-
* each market's, answered by its policy at birth (
|
|
143
|
+
* each market's, answered by its policy at birth (`PolicyC.swapFeeTax`, an immutable; `SponsorPolicyC` before C 18) and
|
|
144
144
|
* read as `getPool(key).swapFeeTax`; the gate is fixed at construction; `collectProtocolFees(key)` is
|
|
145
145
|
* permissionless and pays the treasury. No pool id moved.
|
|
146
146
|
* 9 (decision 071): the events — one `Swap` on both managers (`taker`, `feeToken`), `CSwapState`, C's `swap`
|
|
@@ -164,7 +164,18 @@ function guardChain(wallet, pub) {
|
|
|
164
164
|
// `PermissionsSet` are `setGates(poolId, gates, operator)` / `GatesSet`; the birth answer is `(flags, tax, operator)`; the policy's
|
|
165
165
|
// numbers (tiers, quotes, spacings, tax) are constructor immutables; the swap and mint gates are one bit each (`GATE_SWAP`,
|
|
166
166
|
// `GATE_MINT`) and the cached operator passes with no policy call. No pool id moved.
|
|
167
|
-
|
|
167
|
+
// 17 (decision 107): every event names its actor and the routers emit none (`RouterCall` is gone). `mint(poolId, payer, to, floor, cap, L)`;
|
|
168
|
+
// `PositionMinted(poolId, to, id, sender, payer, shares, dBase, dQuote)`; `ProtocolFeesCollected(poolId, sender, to, amount)`;
|
|
169
|
+
// `ClassRegistered(poolId, id, floor, cap, capped)` (poolId first); the account acted on is `owner` on `PositionBurned` (was `from`),
|
|
170
|
+
// `PositionUpdated` and `FeesClaimed` (was `holder`); `RouterC`'s entries and `Settle` name the receiver `to` (was `recipient`). No pool id moved.
|
|
171
|
+
// 18 (decisions 099, 100): `PoolKeyC` is `(quote, base, swapFeeIdx, spacingIdx, policy, salt)` — every C pool id and position id moved; the
|
|
172
|
+
// fee is an index into the family's list (the mint fee the next entry) and the spacing an index into `[1e15, 1e16, 1e17]`; `initialize(key, x0)`
|
|
173
|
+
// mints the backstop in the call (the caller pays dust of both tokens by allowance to the manager) and `RouterC.createMarket` is gone;
|
|
174
|
+
// `PoolCreated` carries the two indices; `claim(poolId, id, owner, to)`; `PoolView` has no `backstopSeeded`; `LensC.params()` is
|
|
175
|
+
// `(spacingList, noCap, cVersion)`; `PolicyC` replaces `SponsorPolicyC` (F's gate surface plus `baseListed`, `swapFeeTax`, `mayInit`); the
|
|
176
|
+
// registry lost its creation modes (`admit`, `creationMode`, `setCreationMode`, `sponsorOf`). `SpacingZero`, `BackstopTooSmall`,
|
|
177
|
+
// `BackstopMustBeUncapped` and `NotCreator` are gone, `PolicyNotApproved` is new.
|
|
178
|
+
export const EXPECTED_VERSION = 20n;
|
|
168
179
|
/**
|
|
169
180
|
* The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
|
|
170
181
|
* 4 was the income-only harvest cut).
|
|
@@ -283,7 +294,12 @@ export const EXPECTED_VERSION = 16n;
|
|
|
283
294
|
// `IncomeHarvested(poolId, to, gen, income, capital, tax, toOperator, Q)`; `GenerationFrozen` from `close` alone; `IncomeReleased` and
|
|
284
295
|
// `PolicyMigrated` are gone. The policy's name is an event (`NameSet`), its lists are per policy (`setRights`, `RightsSet`), its
|
|
285
296
|
// modes per pool (`setSwapMode` / `setMintMode`, each Open < Listed < Operator with `mintMode ≥ swapMode`).
|
|
286
|
-
|
|
297
|
+
// 42 (decision 107): every event names its actor and the routers emit none (`RouterCall` is gone). `mint(poolId, payer, to, L, maxQuoteIn)`;
|
|
298
|
+
// `claim(poolId, gen, owner, to)` (the owner or its ERC-6909 operator); `SharesMinted(poolId, to, gen, sender, payer, L, shares, dQuote,
|
|
299
|
+
// poolL, supply)`; `SharesBurned` indexes `gen` and names `owner` (was `from`), `DividendClaimed` names `owner` (was `holder`);
|
|
300
|
+
// `PoolCreated(poolId, quote, creator, policy, bases, swapFeeIdx, salt)` (`creator` a topic, `policy` data); `LiquidityDeployed`,
|
|
301
|
+
// `IncomeHarvested` and `GenerationFrozen` carry `operator` as a topic; `RouterF.BadToken` is `WrongToken`. No pool id moved.
|
|
302
|
+
export const EXPECTED_F_VERSION = 44n;
|
|
287
303
|
export async function assertVersion(c, expected = EXPECTED_VERSION) {
|
|
288
304
|
const { managerCAbi, managerFAbi } = await import("./generated.js");
|
|
289
305
|
const withC = hasC(c);
|