@logswap/sdk 0.5.79 → 0.5.81
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 +697 -75
- package/dist/admin.js +54 -65
- package/dist/client.d.ts +2 -2
- package/dist/client.js +13 -2
- package/dist/fpool.d.ts +309 -339
- package/dist/fpool.js +225 -210
- package/dist/generated.d.ts +1542 -1182
- package/dist/generated.js +938 -847
- package/dist/history.d.ts +1 -2
- package/dist/history.js +3 -5
- package/dist/indexer.d.ts +1 -1
- package/dist/indexer.js +4 -2
- package/dist/keys.d.ts +23 -1
- package/dist/keys.js +18 -0
- package/dist/liquidity.d.ts +0 -5
- package/dist/liquidity.js +1 -2
- package/dist/pools.d.ts +8 -11
- package/dist/pools.js +9 -8
- 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 +62 -74
- package/src/client.ts +13 -2
- package/src/fpool.ts +315 -289
- package/src/generated.ts +938 -847
- package/src/history.ts +3 -4
- package/src/indexer.ts +5 -3
- package/src/keys.ts +34 -1
- package/src/liquidity.ts +1 -7
- package/src/pools.ts +14 -15
- 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
|