@logswap/sdk 0.5.80 → 0.5.82
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 +35 -14
- package/dist/admin.d.ts +18 -47
- package/dist/admin.js +13 -31
- package/dist/client.d.ts +2 -2
- package/dist/client.js +13 -2
- package/dist/fpool.d.ts +174 -270
- package/dist/fpool.js +191 -175
- package/dist/generated.d.ts +484 -734
- package/dist/generated.js +251 -476
- package/dist/history.js +14 -3
- package/dist/indexer.d.ts +1 -1
- package/dist/indexer.js +3 -2
- package/dist/keys.d.ts +17 -1
- package/dist/keys.js +16 -0
- package/dist/liquidity.d.ts +0 -5
- package/dist/liquidity.js +1 -2
- package/dist/pools.d.ts +5 -8
- package/dist/pools.js +7 -7
- package/dist/positions.d.ts +4 -5
- package/dist/positions.js +6 -7
- package/dist/views.d.ts +6 -10
- package/dist/views.js +6 -6
- package/package.json +1 -1
- package/src/admin.ts +14 -36
- package/src/client.ts +13 -2
- package/src/fpool.ts +267 -245
- package/src/generated.ts +251 -476
- package/src/history.ts +17 -3
- package/src/indexer.ts +4 -3
- package/src/keys.ts +26 -1
- package/src/liquidity.ts +1 -7
- package/src/pools.ts +9 -11
- package/src/positions.ts +6 -7
- package/src/views.ts +12 -16
package/README.md
CHANGED
|
@@ -52,21 +52,23 @@ Since logswap-contract #60 (decisions 064–065) creation is curated at launch,
|
|
|
52
52
|
its creator, quote, pair, swap-fee tier (2, 5, 10, 25, 50, 100 bp) and tick spacing (10 or 100 bp)
|
|
53
53
|
are listed, and only one market per (base, quote, fee) exists. `cGateRules(c, { key, creator })`
|
|
54
54
|
reads every check in one round; `gateErrorAbi` decodes the refusals (`CreatorNotListed`,
|
|
55
|
-
`MarketExists`, `SpacingNotListed`, `PairNotListed`, `
|
|
55
|
+
`MarketExists`, `SpacingNotListed`, `PairNotListed`, `NoForwardedUser`,
|
|
56
56
|
`PadExists`).
|
|
57
57
|
- **`createMarket` stays one transaction**: the router is a trusted forwarder, so the gate checks
|
|
58
58
|
the router's `user()` — the wallet that sent the call — against the creator list.
|
|
59
|
-
- **The mint fee is
|
|
60
|
-
|
|
61
|
-
`
|
|
62
|
-
`
|
|
63
|
-
|
|
59
|
+
- **The mint fee is a key field** (C 12 / F 38, decision 078): the creator's pick, fixed for the pool's life and
|
|
60
|
+
part of its id (`PoolKey.mintFee`, `FPoolKey.mintFee`; `mintFee?` on `fPoolInitialize` / `fPoolLaunch`). The
|
|
61
|
+
managers require `2 * swapFee <= mintFee <= MINT_FEE_MAX` (2%) and revert `BadParam`; `isValidMintFee`,
|
|
62
|
+
`minMintFee` and `MINT_FEE_MAX` are exported, and `presetMintFee(swapFee)` is the least the managers accept,
|
|
63
|
+
twice the swap fee. `initialize`, `initializeMarket` and `createMarket` take no separate argument, the policies
|
|
64
|
+
keep no menu, and C's `getPool` no longer returns it (read `key.mintFee`; `getFPool(...).mintFee` still reads
|
|
65
|
+
an F pool's). `mintFee(p, x, rate)` previews it at the market's rate.
|
|
64
66
|
- **A fee of 0 is no fee**: `swapFeeOf` and `DEFAULT_FEE` are gone; `marketSwapFee` returns the key's
|
|
65
67
|
own fee for an initialized market.
|
|
66
68
|
- **C reads**: `getPool` reads the lens's `getPools`; `getPositionClass` reads the class through
|
|
67
69
|
`extsload` at `CPoolState`'s slot (the manager's typed views are gone).
|
|
68
70
|
- **Creators are curated on every kind** at launch (onboarding under a service agreement); the
|
|
69
|
-
LOG Authority's helpers: `policySetCreatorListed`, `
|
|
71
|
+
LOG Authority's helpers: `policySetCreatorListed`, `gateSetPairListed`,
|
|
70
72
|
`gateSetSpacingListed`, `gateSetForwarderTrusted`, `setCGate`.
|
|
71
73
|
- **Two roles (decision 066, C 8 / F 27).** `logAuthority()` reads the LOG Authority (the
|
|
72
74
|
registry's `logAuthority`; `proposeLogAuthority` / `acceptLogAuthority`), which administers the
|
|
@@ -112,7 +114,7 @@ progress as `number`, times as unix seconds. Every reader takes the GraphQL endp
|
|
|
112
114
|
| `candles(url, "minute" \| "hour" \| "day")` | `allCandle…s` | OHLC with volume and fees |
|
|
113
115
|
| `poolTvlHours` | `allPoolTvlHours` | the hour's last snapshot: TVL, liquidity |
|
|
114
116
|
| `poolSummaries` | `allPoolSummaries` | 24 h / 7 d volume, fees, APY; latest TVL |
|
|
115
|
-
| `generationSteps` | `allGenerationSteps` | a
|
|
117
|
+
| `generationSteps` | `allGenerationSteps` | a generation step and the split of the income it released |
|
|
116
118
|
| `padStatuses` | `allPadStatuses` | each pad and POL now, with the next threshold and progress |
|
|
117
119
|
| `protocolRevenueDays` | `allProtocolRevenueDays` | protocol revenue per day and source |
|
|
118
120
|
|
|
@@ -125,13 +127,32 @@ as the fallback, with the same answer on the same data:
|
|
|
125
127
|
What stays a live read: a C position's value and every unclaimed fee or dividend (the lens: `legsOf`,
|
|
126
128
|
`heldByIds`, `fDividendOf`). They accrue without events, so no view holds them.
|
|
127
129
|
|
|
128
|
-
##
|
|
130
|
+
## The F pool's life: four calls (F 38)
|
|
131
|
+
|
|
132
|
+
- **`fPoolInitialize`** creates an unfunded pool. Its key is `(quote, bases, swapFee, policy, creator, salt,
|
|
133
|
+
mintFee)`: no weights and no cap, and the set of `bases` is fixed for the pool's life.
|
|
134
|
+
- **`fPoolDeploy`** (`deployLiquidity`, decisions 083, 084) is the authority's and SETS THE BOOK. Each
|
|
135
|
+
`baseAssets[j]` is the TOTAL base reserve of asset `j` after the call (`0` leaves it out) and the price
|
|
136
|
+
that values it (`priceX36`), `quoteAmount` is the total bid, and the manager settles the difference with the caller:
|
|
137
|
+
a larger total is pulled, a smaller one is pushed to `to`, so one call replaces an asset by another. Pass the
|
|
138
|
+
book outright (`baseAssets`, `lnCapOverSeed`) or the sponsor's terms (`bases`, `weights`, `L0` and the wanted
|
|
139
|
+
marks `x0` or the reserves `r0`; `fPoolBook` builds the book). On an UNFUNDED pool (new, or after `fPoolClose`)
|
|
140
|
+
it funds the first or next generation. On a LIVE pool it is a regeneration that sets the book: income settles to
|
|
141
|
+
`to`, every holder but the carried ones is frozen into the closing generation's bundle (`fPoolRedeem`), and the
|
|
142
|
+
carried book becomes the one named. A pad is forward-only (`PadForwardOnly`): it uses `fPoolRegenerate`.
|
|
143
|
+
- **`fPoolRegenerate`** is the same routine with nothing changed: the generation step, the pad's graduation.
|
|
144
|
+
- **`fPoolClose`** harvests the bid out and closes the pool at an empty bid; the pool keeps its id and every role.
|
|
145
|
+
- **The cap** (decisions 061, 075) is the pool's one log ratio `lnCapOverSeed` = ln(cap price / seed price) in 1e-6 log
|
|
146
|
+
units, chosen at each deployment: each asset's maximum price is its own seed price times it.
|
|
147
|
+
`fPoolCapOfLeverage(λ)` gives it for a leverage (λ = 2 → the cap at twice the seed price),
|
|
148
|
+
`fPoolLeverageOfCap(d)` the inverse, and `fPoolCapK(d)` = e^{−d} the constant that scales each reserve by (1 − k)
|
|
149
|
+
and divides the base value by (1 − k) to give the liquidity. A pad is uncapped (`PadUncapped`).
|
|
150
|
+
- **`LiquidityDeployed`** echoes the deployment: `(quoteAmount, baseAssets, lnCapOverSeed)`.
|
|
151
|
+
`fPoolBookWeights` and `fPoolBookL` derive the allocation and the liquidity from it. A regeneration emits no
|
|
152
|
+
such event; the freeze-out is read from `GenerationRetired` and `IncomeReleased`.
|
|
153
|
+
- **Income and income tax** (decision 085): the dead shares' dividend and the share of it the treasury takes are
|
|
154
|
+
the income and the income tax (`IncomeReleased`, `incomeHeld`, `incomeTax`, `padSetIncomeTaxRate`).
|
|
129
155
|
|
|
130
|
-
- **The cap** (decisions 061) is a key field: `FPoolKey.cap` / `FPoolCreateArgs.cap`, d =
|
|
131
|
-
ln(cap/floor) in 1e-6 log units. `fPoolCapOfLeverage(λ)` gives d for a leverage at the floor
|
|
132
|
-
(λ = 2 → the cap at twice the floor), `fPoolLeverageOfCap(d)` the inverse. Seeding by marks
|
|
133
|
-
(`x0`) on a capped pool scales each reserve by (1 − k), k = `fPoolCapK(cap, Q0, L0)`: the mark
|
|
134
|
-
reads the virtual reserve R̃ = R + c. A seed priced at or above its cap is refused.
|
|
135
156
|
- **The lien** (decisions 063): a lending contract locks an owner's shares in place.
|
|
136
157
|
`fPoolApproveShares` (the owner's per-id allowance), `fPoolLock` / `fPoolUnlock` (the locker's;
|
|
137
158
|
`to` = owner is a release, anyone else a seizure), `fPoolBankLien` (bank the locked dividend
|
package/dist/admin.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* registry and the policies; no router.
|
|
8
8
|
*
|
|
9
9
|
* The mint fee has no cut to set since C version 6 / F version 24 (decisions 058): the whole fee
|
|
10
|
-
* is the protocol's on both managers. A harvest has no cut (056); a pad's protocol share of the
|
|
10
|
+
* is the protocol's on both managers. A harvest has no cut (056); a pad's protocol share of the income
|
|
11
11
|
* is the policy's (`PadPolicy.setSchedule`), capped by the manager at `POT_CUT_MAX`.
|
|
12
12
|
*/
|
|
13
13
|
import type { Address, Hash, Hex } from "viem";
|
|
@@ -123,10 +123,10 @@ export declare function fPoolMigrate(c: LogswapClient, a: {
|
|
|
123
123
|
*/
|
|
124
124
|
export declare function registryKindOf(c: LogswapClient, policy: Address): Promise<FPoolKind | "">;
|
|
125
125
|
/**
|
|
126
|
-
* `PadPolicy.setSchedule` (decisions 056, 067, 070, 073): the rung's growth and the RANGE a creator chooses
|
|
127
|
-
*
|
|
128
|
-
* burnt since F version 28, and the protocol takes no cut of the
|
|
129
|
-
* {@link
|
|
126
|
+
* `PadPolicy.setSchedule` (decisions 056, 067, 070, 073): the rung's growth and the RANGE inside which a creator chooses their cut of the income
|
|
127
|
+
* at creation (its top ≤ the F manager's `PAYEE_CUT_MAX`). The rest of the income deepens the bid — nothing is bought or
|
|
128
|
+
* burnt since F version 28, and the protocol takes no cut of the income since F version 33 (its revenue is the income tax,
|
|
129
|
+
* {@link padSetIncomeTaxRate}). A change to the range applies to pads born after it; the growth moves every pad at its
|
|
130
130
|
* next rung. The rung is the pool's generation. `T(0)` is per quote since decision 070: {@link padSetThresholdBase}.
|
|
131
131
|
*/
|
|
132
132
|
export declare function padSetSchedule(c: LogswapClient, policy: Address, s: PadSchedule): Promise<Hash>;
|
|
@@ -145,9 +145,9 @@ export interface PadThresholdBase {
|
|
|
145
145
|
}
|
|
146
146
|
/** `PadPolicy.thresholdSet(quote)` and `thresholdBaseOf(quote)` for each quote asked (decision 070). */
|
|
147
147
|
export declare function padThresholdBases(c: LogswapClient, policy: Address, quotes: readonly Address[]): Promise<PadThresholdBase[]>;
|
|
148
|
-
/** `PadPolicy.thresholdOf(quote, rung)` (decision 070): the
|
|
148
|
+
/** `PadPolicy.thresholdOf(quote, rung)` (decision 070): the income a pad quoted in `quote` must bank to climb `rung` (0 reads `T(0)`). */
|
|
149
149
|
export declare function padThresholdOf(c: LogswapClient, policy: Address, quote: Address, rung?: bigint | number): Promise<bigint>;
|
|
150
|
-
/** `PadPolicy.threshold(poolId, rung)` (decision 070): the
|
|
150
|
+
/** `PadPolicy.threshold(poolId, rung)` (decision 070): the income pad `poolId` must bank to climb `rung`, in its own quote. */
|
|
151
151
|
export declare function padThreshold(c: LogswapClient, policy: Address, poolId: Hex, rung: bigint | number): Promise<bigint>;
|
|
152
152
|
/** A pad policy's schedule (decision 070: without `T(0)`, which is per quote — {@link padThresholdBases}). WAD numbers. */
|
|
153
153
|
export interface PadSchedule {
|
|
@@ -159,10 +159,10 @@ export interface PadSchedule {
|
|
|
159
159
|
export declare function padScheduleOf(c: LogswapClient, policy: Address): Promise<PadSchedule>;
|
|
160
160
|
/** `PolPolicy.setMinQuoteRatio` (decision 073): the reserve a harvest must leave in the bid (`may(Harvest)` refuses less) and a relaunch's seed must bring, a multiple of the pool's L in WAD (at most 100e18). The policy sponsor's. */
|
|
161
161
|
export declare function polSetMinQuoteRatio(c: LogswapClient, policy: Address, ratio: bigint): Promise<Hash>;
|
|
162
|
-
/** `PadPolicy.
|
|
163
|
-
export declare function
|
|
164
|
-
/** `PolPolicy.
|
|
165
|
-
export declare function
|
|
162
|
+
/** `PadPolicy.setIncomeTaxRate` (decision 073): the share of its new income dividend the dead shares pay LOG Treasury as income tax, WAD, at most 50%. The policy sponsor's. */
|
|
163
|
+
export declare function padSetIncomeTaxRate(c: LogswapClient, policy: Address, rate: bigint): Promise<Hash>;
|
|
164
|
+
/** `PolPolicy.setIncomeTaxRate` (decision 073): the share of its new income dividend the pool's authority pays LOG Treasury, WAD, at most 50%. Paid on the authority's own shares only: an authority that holds through another address pays nothing. The policy sponsor's. */
|
|
165
|
+
export declare function polSetIncomeTaxRate(c: LogswapClient, policy: Address, rate: bigint): Promise<Hash>;
|
|
166
166
|
/** `setQuoteListed` on any protocol policy: a quote a pool of that kind may be born against while it curates quotes. The LOG Authority's. */
|
|
167
167
|
export declare function policySetQuoteListed(c: LogswapClient, policy: Address, quote: Address, listed: boolean): Promise<Hash>;
|
|
168
168
|
/** `setQuoteCurated` on any protocol policy: on, a birth against an unlisted quote is refused. The LOG Authority's. */
|
|
@@ -187,19 +187,6 @@ export declare function policyFeeAllowed(c: LogswapClient, policy: Address, fee:
|
|
|
187
187
|
listed: boolean;
|
|
188
188
|
allowed: boolean;
|
|
189
189
|
}>;
|
|
190
|
-
/** `setMintFeeListed` on any protocol policy (065): an entry of its mint-fee menu. The LOG Authority's. */
|
|
191
|
-
export declare function policySetMintFeeListed(c: LogswapClient, policy: Address, mintFee: bigint, listed: boolean): Promise<Hash>;
|
|
192
|
-
/** `setMintFeeCurated` on any protocol policy: on, a birth proposing an unlisted mint fee is refused (`MintFeeNotListed`). */
|
|
193
|
-
export declare function policySetMintFeeCurated(c: LogswapClient, policy: Address, curated: boolean): Promise<Hash>;
|
|
194
|
-
/**
|
|
195
|
-
* A policy's mint-fee menu, for a create form (065): which of `candidates` it lists, and whether it
|
|
196
|
-
* curates at all (uncurated, any fee in the domain is accepted — the desk's policy never curates).
|
|
197
|
-
* The candidates are the app's — typically {@link presetMintFee} of each listed swap tier.
|
|
198
|
-
*/
|
|
199
|
-
export declare function policyMintFeeMenu(c: LogswapClient, policy: Address, candidates: readonly bigint[]): Promise<{
|
|
200
|
-
curated: boolean;
|
|
201
|
-
listed: bigint[];
|
|
202
|
-
}>;
|
|
203
190
|
/** `PolicyRegistry.CreationMode` (decision 073): who may create under a policy. Open = 0, Restricted = 1 (the initializer list), SponsorOnly = 2 (bound to a sponsor, permanent). */
|
|
204
191
|
export type CreationMode = "open" | "restricted" | "sponsorOnly";
|
|
205
192
|
/** `PolicyRegistry.setCreationMode(policy, mode)` (the LOG Authority): replaces the per-policy creator lists (064). A sponsor-bound policy cannot leave `sponsorOnly`. */
|
|
@@ -232,7 +219,7 @@ export interface CGateRules {
|
|
|
232
219
|
exists: boolean;
|
|
233
220
|
/** Whether `router` is a trusted forwarder on the registry — `createMarket` through it is then checked against `creator`. */
|
|
234
221
|
routerTrusted: boolean;
|
|
235
|
-
/** Every check passes: the policy would admit this market from this creator (the mint fee
|
|
222
|
+
/** Every check passes: the policy would admit this market from this creator (the mint fee is a key field, checked by the manager). */
|
|
236
223
|
admitted: boolean;
|
|
237
224
|
}
|
|
238
225
|
/**
|
|
@@ -464,10 +451,6 @@ export declare const gateErrorAbi: readonly ({
|
|
|
464
451
|
readonly name: "bases";
|
|
465
452
|
readonly internalType: "address[]";
|
|
466
453
|
readonly type: "address[]";
|
|
467
|
-
}, {
|
|
468
|
-
readonly name: "weights";
|
|
469
|
-
readonly internalType: "uint256[]";
|
|
470
|
-
readonly type: "uint256[]";
|
|
471
454
|
}, {
|
|
472
455
|
readonly name: "swapFee";
|
|
473
456
|
readonly internalType: "uint256";
|
|
@@ -485,9 +468,9 @@ export declare const gateErrorAbi: readonly ({
|
|
|
485
468
|
readonly internalType: "bytes32";
|
|
486
469
|
readonly type: "bytes32";
|
|
487
470
|
}, {
|
|
488
|
-
readonly name: "
|
|
489
|
-
readonly internalType: "
|
|
490
|
-
readonly type: "
|
|
471
|
+
readonly name: "mintFee";
|
|
472
|
+
readonly internalType: "uint256";
|
|
473
|
+
readonly type: "uint256";
|
|
491
474
|
}];
|
|
492
475
|
}, {
|
|
493
476
|
readonly name: "to";
|
|
@@ -515,10 +498,6 @@ export declare const gateErrorAbi: readonly ({
|
|
|
515
498
|
readonly name: "bases";
|
|
516
499
|
readonly internalType: "address[]";
|
|
517
500
|
readonly type: "address[]";
|
|
518
|
-
}, {
|
|
519
|
-
readonly name: "weights";
|
|
520
|
-
readonly internalType: "uint256[]";
|
|
521
|
-
readonly type: "uint256[]";
|
|
522
501
|
}, {
|
|
523
502
|
readonly name: "swapFee";
|
|
524
503
|
readonly internalType: "uint256";
|
|
@@ -536,9 +515,9 @@ export declare const gateErrorAbi: readonly ({
|
|
|
536
515
|
readonly internalType: "bytes32";
|
|
537
516
|
readonly type: "bytes32";
|
|
538
517
|
}, {
|
|
539
|
-
readonly name: "
|
|
540
|
-
readonly internalType: "
|
|
541
|
-
readonly type: "
|
|
518
|
+
readonly name: "mintFee";
|
|
519
|
+
readonly internalType: "uint256";
|
|
520
|
+
readonly type: "uint256";
|
|
542
521
|
}];
|
|
543
522
|
}, {
|
|
544
523
|
readonly name: "to";
|
|
@@ -975,14 +954,6 @@ export declare const gateErrorAbi: readonly ({
|
|
|
975
954
|
readonly type: "uint256";
|
|
976
955
|
}];
|
|
977
956
|
readonly name: "MarketExists";
|
|
978
|
-
} | {
|
|
979
|
-
readonly type: "error";
|
|
980
|
-
readonly inputs: readonly [{
|
|
981
|
-
readonly name: "mintFee";
|
|
982
|
-
readonly internalType: "uint256";
|
|
983
|
-
readonly type: "uint256";
|
|
984
|
-
}];
|
|
985
|
-
readonly name: "MintFeeNotListed";
|
|
986
957
|
} | {
|
|
987
958
|
readonly type: "error";
|
|
988
959
|
readonly inputs: readonly [];
|
package/dist/admin.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* registry and the policies; no router.
|
|
8
8
|
*
|
|
9
9
|
* The mint fee has no cut to set since C version 6 / F version 24 (decisions 058): the whole fee
|
|
10
|
-
* is the protocol's on both managers. A harvest has no cut (056); a pad's protocol share of the
|
|
10
|
+
* is the protocol's on both managers. A harvest has no cut (056); a pad's protocol share of the income
|
|
11
11
|
* is the policy's (`PadPolicy.setSchedule`), capped by the manager at `POT_CUT_MAX`.
|
|
12
12
|
*/
|
|
13
13
|
import { getPool } from "./pools.js";
|
|
@@ -178,10 +178,10 @@ export async function registryKindOf(c, policy) {
|
|
|
178
178
|
}
|
|
179
179
|
// ─── the policies' numbers (the LOG Authority's; each bounded where it reaches the manager) ─────
|
|
180
180
|
/**
|
|
181
|
-
* `PadPolicy.setSchedule` (decisions 056, 067, 070, 073): the rung's growth and the RANGE a creator chooses
|
|
182
|
-
*
|
|
183
|
-
* burnt since F version 28, and the protocol takes no cut of the
|
|
184
|
-
* {@link
|
|
181
|
+
* `PadPolicy.setSchedule` (decisions 056, 067, 070, 073): the rung's growth and the RANGE inside which a creator chooses their cut of the income
|
|
182
|
+
* at creation (its top ≤ the F manager's `PAYEE_CUT_MAX`). The rest of the income deepens the bid — nothing is bought or
|
|
183
|
+
* burnt since F version 28, and the protocol takes no cut of the income since F version 33 (its revenue is the income tax,
|
|
184
|
+
* {@link padSetIncomeTaxRate}). A change to the range applies to pads born after it; the growth moves every pad at its
|
|
185
185
|
* next rung. The rung is the pool's generation. `T(0)` is per quote since decision 070: {@link padSetThresholdBase}.
|
|
186
186
|
*/
|
|
187
187
|
export async function padSetSchedule(c, policy, s) {
|
|
@@ -205,11 +205,11 @@ export async function padThresholdBases(c, policy, quotes) {
|
|
|
205
205
|
return { quote, set, base };
|
|
206
206
|
}));
|
|
207
207
|
}
|
|
208
|
-
/** `PadPolicy.thresholdOf(quote, rung)` (decision 070): the
|
|
208
|
+
/** `PadPolicy.thresholdOf(quote, rung)` (decision 070): the income a pad quoted in `quote` must bank to climb `rung` (0 reads `T(0)`). */
|
|
209
209
|
export async function padThresholdOf(c, policy, quote, rung = 0n) {
|
|
210
210
|
return (await c.public.readContract({ address: policy, abi: padPolicyAbi, functionName: "thresholdOf", args: [quote, BigInt(rung)] }));
|
|
211
211
|
}
|
|
212
|
-
/** `PadPolicy.threshold(poolId, rung)` (decision 070): the
|
|
212
|
+
/** `PadPolicy.threshold(poolId, rung)` (decision 070): the income pad `poolId` must bank to climb `rung`, in its own quote. */
|
|
213
213
|
export async function padThreshold(c, policy, poolId, rung) {
|
|
214
214
|
return (await c.public.readContract({ address: policy, abi: padPolicyAbi, functionName: "threshold", args: [poolId, BigInt(rung)] }));
|
|
215
215
|
}
|
|
@@ -223,13 +223,13 @@ export async function padScheduleOf(c, policy) {
|
|
|
223
223
|
export async function polSetMinQuoteRatio(c, policy, ratio) {
|
|
224
224
|
return write(c, policy, polPolicyAbi, "setMinQuoteRatio", [ratio]);
|
|
225
225
|
}
|
|
226
|
-
/** `PadPolicy.
|
|
227
|
-
export async function
|
|
228
|
-
return write(c, policy, padPolicyAbi, "
|
|
226
|
+
/** `PadPolicy.setIncomeTaxRate` (decision 073): the share of its new income dividend the dead shares pay LOG Treasury as income tax, WAD, at most 50%. The policy sponsor's. */
|
|
227
|
+
export async function padSetIncomeTaxRate(c, policy, rate) {
|
|
228
|
+
return write(c, policy, padPolicyAbi, "setIncomeTaxRate", [rate]);
|
|
229
229
|
}
|
|
230
|
-
/** `PolPolicy.
|
|
231
|
-
export async function
|
|
232
|
-
return write(c, policy, polPolicyAbi, "
|
|
230
|
+
/** `PolPolicy.setIncomeTaxRate` (decision 073): the share of its new income dividend the pool's authority pays LOG Treasury, WAD, at most 50%. Paid on the authority's own shares only: an authority that holds through another address pays nothing. The policy sponsor's. */
|
|
231
|
+
export async function polSetIncomeTaxRate(c, policy, rate) {
|
|
232
|
+
return write(c, policy, polPolicyAbi, "setIncomeTaxRate", [rate]);
|
|
233
233
|
}
|
|
234
234
|
/** `setQuoteListed` on any protocol policy: a quote a pool of that kind may be born against while it curates quotes. The LOG Authority's. */
|
|
235
235
|
export async function policySetQuoteListed(c, policy, quote, listed) {
|
|
@@ -267,24 +267,6 @@ export async function policyFeeAllowed(c, policy, fee) {
|
|
|
267
267
|
]);
|
|
268
268
|
return { curated, listed, allowed: !curated || listed };
|
|
269
269
|
}
|
|
270
|
-
/** `setMintFeeListed` on any protocol policy (065): an entry of its mint-fee menu. The LOG Authority's. */
|
|
271
|
-
export async function policySetMintFeeListed(c, policy, mintFee, listed) {
|
|
272
|
-
return write(c, policy, fPolicyBaseAbi, "setMintFeeListed", [mintFee, listed]);
|
|
273
|
-
}
|
|
274
|
-
/** `setMintFeeCurated` on any protocol policy: on, a birth proposing an unlisted mint fee is refused (`MintFeeNotListed`). */
|
|
275
|
-
export async function policySetMintFeeCurated(c, policy, curated) {
|
|
276
|
-
return write(c, policy, fPolicyBaseAbi, "setMintFeeCurated", [curated]);
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* A policy's mint-fee menu, for a create form (065): which of `candidates` it lists, and whether it
|
|
280
|
-
* curates at all (uncurated, any fee in the domain is accepted — the desk's policy never curates).
|
|
281
|
-
* The candidates are the app's — typically {@link presetMintFee} of each listed swap tier.
|
|
282
|
-
*/
|
|
283
|
-
export async function policyMintFeeMenu(c, policy, candidates) {
|
|
284
|
-
const rd = (functionName, args = []) => c.public.readContract({ address: policy, abi: fPolicyBaseAbi, functionName, args });
|
|
285
|
-
const [curated, ...flags] = await Promise.all([rd("mintFeeCurated"), ...candidates.map((m) => rd("mintFeeListed", [m]))]);
|
|
286
|
-
return { curated, listed: candidates.filter((_, i) => flags[i]) };
|
|
287
|
-
}
|
|
288
270
|
const CREATION_MODES = ["open", "restricted", "sponsorOnly"];
|
|
289
271
|
/** `PolicyRegistry.setCreationMode(policy, mode)` (the LOG Authority): replaces the per-policy creator lists (064). A sponsor-bound policy cannot leave `sponsorOnly`. */
|
|
290
272
|
export async function registrySetCreationMode(c, policy, mode) {
|
package/dist/client.d.ts
CHANGED
|
@@ -119,7 +119,7 @@ export declare function clientChainId(c: LogswapClient): Promise<number>;
|
|
|
119
119
|
* takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
|
|
120
120
|
* `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
|
|
121
121
|
*/
|
|
122
|
-
export declare const EXPECTED_VERSION =
|
|
122
|
+
export declare const EXPECTED_VERSION = 12n;
|
|
123
123
|
/**
|
|
124
124
|
* The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
|
|
125
125
|
* 4 was the income-only harvest cut).
|
|
@@ -131,7 +131,7 @@ export declare const EXPECTED_VERSION = 10n;
|
|
|
131
131
|
* passes it; when one lands, raise this constant in the same change, which is the discipline
|
|
132
132
|
* `EXPECTED_VERSION` enforces mechanically and this one asks for.
|
|
133
133
|
*/
|
|
134
|
-
export declare const EXPECTED_F_VERSION =
|
|
134
|
+
export declare const EXPECTED_F_VERSION = 38n;
|
|
135
135
|
export declare function assertVersion(c: LogswapClient, expected?: bigint): Promise<void>;
|
|
136
136
|
/**
|
|
137
137
|
* The versions say the managers are the right code; this says the rest of the addresses belong
|
package/dist/client.js
CHANGED
|
@@ -113,7 +113,11 @@ function guardChain(wallet, pub) {
|
|
|
113
113
|
* takes `SwapParams` (the router's ABI does not move), object-word event names (`MarketCreated`,
|
|
114
114
|
* `PositionMinted`, ...), `MarketCreated` carries creator, mintFee and swapFeeTax. No pool id moved.
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
// 11 (decision 078): `mintFee` is a key field (the creator's pick, `2 * swapFee <= mintFee <= 2%`); `initialize(key, x0)`
|
|
117
|
+
// takes no separate mint fee, `createMarket` neither; `getPool` drops `mintFee` and the gates' mint-fee menus are gone.
|
|
118
|
+
// Every C pool id moved.
|
|
119
|
+
// 12 (decisions 079-081): `Action` ordinals, the key is `CPoolKey` (names only). No pool id moved.
|
|
120
|
+
export const EXPECTED_VERSION = 12n;
|
|
117
121
|
/**
|
|
118
122
|
* The F manager's own tag (5 — the key's salt, pool names, the sponsor registry;
|
|
119
123
|
* 4 was the income-only harvest cut).
|
|
@@ -207,8 +211,15 @@ export const EXPECTED_VERSION = 10n;
|
|
|
207
211
|
// No pool id moved.
|
|
208
212
|
// 31 (decision 072): `DividendClaimed` names the generation (`gen`, indexed, after `poolId`); `lock` / `unlock` emit
|
|
209
213
|
// `LienLocked` / `LienUnlocked`. No selector, storage layout or pool id moved.
|
|
214
|
+
// 33 (decisions 073, 074): sponsor-bound policies, the income fee, registry admission.
|
|
215
|
+
// 34-38 (decisions 075-085): one liquidity routine. `FPoolKey` holds no weights and no cap and gains `mintFee` (every pool
|
|
216
|
+
// id moved); `initialize(key)`; `seed` / `retire` / `setLegs` are gone for `deployLiquidity(poolId, baseAssets,
|
|
217
|
+
// quoteAmount, lnCapOverSeed, to)` (it SETS THE BOOK on an unfunded or a live pool), `close(poolId, to)` and
|
|
218
|
+
// `regenerate(poolId, to)`; asset membership is fixed by the key; `LiquidityDeployed` echoes the input,
|
|
219
|
+
// `GenerationSeeded` / `LegsSet` are gone; the lens `fPool` field is `baseLegs`, the cap `lnCapOverSeed`; the pot and the
|
|
220
|
+
// income fee are the income and the income tax (`IncomeReleased`, `incomeHeld`, `incomeTax`); a pad is uncapped.
|
|
210
221
|
// A breaking bump: raised in the same change.
|
|
211
|
-
export const EXPECTED_F_VERSION =
|
|
222
|
+
export const EXPECTED_F_VERSION = 38n;
|
|
212
223
|
export async function assertVersion(c, expected = EXPECTED_VERSION) {
|
|
213
224
|
const { cPoolManagerAbi, fPoolManagerAbi } = await import("./generated.js");
|
|
214
225
|
// three independent reads: one round trip, not three in a row
|