@logswap/sdk 0.5.55 → 0.5.56
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 +2 -75
- package/dist/actions.d.ts +1 -1
- package/dist/actions.js +1 -1
- package/dist/admin.d.ts +7 -7
- package/dist/admin.js +7 -7
- package/dist/client.d.ts +6 -6
- package/dist/client.js +16 -16
- package/dist/fpool.d.ts +53 -53
- package/dist/fpool.js +49 -49
- package/dist/keys.d.ts +1 -1
- package/dist/liquidity.d.ts +7 -7
- package/dist/liquidity.js +6 -6
- package/dist/pools.d.ts +2 -2
- package/dist/pools.js +1 -1
- package/package.json +3 -2
- package/src/actions.ts +1 -1
- package/src/admin.ts +8 -8
- package/src/client.ts +18 -18
- package/src/fpool.ts +66 -66
- package/src/keys.ts +1 -1
- package/src/liquidity.ts +8 -8
- package/src/pools.ts +2 -2
package/src/liquidity.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* liquidity.ts — providing, editing and exiting a C position.
|
|
3
3
|
*
|
|
4
4
|
* A class is (ξ, μ, L): floor, cap, exposure. One primitive sets all three — `update` — and every
|
|
5
|
-
* edit is a constraint on it. The vocabulary follows the geometry
|
|
5
|
+
* edit is a constraint on it. The vocabulary follows the geometry: **the verb
|
|
6
6
|
* names the axis, the direction is a signed rung count**, and only two direction-words survive,
|
|
7
7
|
* because each names a wallet flow the user must see.
|
|
8
8
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* └─ reprice(ξ') R pinned: L' = L·e^{ξ' − ξ}, dormant only
|
|
16
16
|
* mint · burn · claim
|
|
17
17
|
*
|
|
18
|
-
* Every edit is ONE action of the router's batch (
|
|
18
|
+
* Every edit is ONE action of the router's batch (`actions.ts`), which is what
|
|
19
19
|
* lets it settle in kind, or in base, or in quote: `settleIn` appends the one swap that nets the
|
|
20
20
|
* other side, and the batch moves a single token. `previewEdit` is the lens's `previewUpdate` —
|
|
21
21
|
* the exact flows, mint fee and swept fees included — and is what an editor shows before its one
|
|
@@ -99,7 +99,7 @@ export async function mint(c: LogswapClient, a: MintArgs): Promise<Hash> {
|
|
|
99
99
|
|
|
100
100
|
export interface CreateMarketArgs extends WriteOptions {
|
|
101
101
|
key: PoolKey;
|
|
102
|
-
/** Launch log-price. Bounded by the manager to ±46 (the price domain
|
|
102
|
+
/** Launch log-price. Bounded by the manager to ±46 (the price domain). */
|
|
103
103
|
x0: bigint;
|
|
104
104
|
/** The backstop's floor — the first mint's rung, permanent for the pool's life. */
|
|
105
105
|
targetFloor: bigint;
|
|
@@ -112,7 +112,7 @@ export interface CreateMarketArgs extends WriteOptions {
|
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* Create a market ATOMICALLY: `initialize` at `x0` plus the backstop-establishing first mint in
|
|
115
|
-
* one transaction — the canonical creation path
|
|
115
|
+
* one transaction — the canonical creation path. The
|
|
116
116
|
* two-step path let an attacker seat the PERMANENT backstop at a hostile rung between an honest
|
|
117
117
|
* `initialize` and its first mint; here either both land or neither, and a front-run of the whole
|
|
118
118
|
* call reverts it without moving a wei. No cap: the first mint IS the backstop and must be
|
|
@@ -140,7 +140,7 @@ export interface ZapArgs extends WriteOptions {
|
|
|
140
140
|
/** Fund entirely from base (true) or entirely from quote (false). */
|
|
141
141
|
fundWithBase: boolean;
|
|
142
142
|
amountIn: bigint;
|
|
143
|
-
/** The least the swap leg may return
|
|
143
|
+
/** The least the swap leg may return: the zap's own slippage bound, as `swapExactIn`'s. Required. */
|
|
144
144
|
minSwapOut: bigint;
|
|
145
145
|
targetFloor: bigint;
|
|
146
146
|
cap?: bigint;
|
|
@@ -155,7 +155,7 @@ export interface ZapArgs extends WriteOptions {
|
|
|
155
155
|
*
|
|
156
156
|
* Routing the imbalanced part through the CURVE is the point, not an implementation detail. A
|
|
157
157
|
* pro-rata deposit of one asset would be a zero-slippage, zero-fee swap at stale spot — a subsidy
|
|
158
|
-
* paid by the incumbent LPs
|
|
158
|
+
* paid by the incumbent LPs. Paying the curve removes it.
|
|
159
159
|
*/
|
|
160
160
|
export async function zapIn(c: LogswapClient, a: ZapArgs): Promise<Hash> {
|
|
161
161
|
return sendRouterWriteWithPermits(c, {
|
|
@@ -226,7 +226,7 @@ export interface MoveArgs extends WriteOptions {
|
|
|
226
226
|
* Reposition at constant exposure — the L-pinned parent of `floor`, `cap` and `shift`; in kind.
|
|
227
227
|
*
|
|
228
228
|
* **Bound it.** The router used to settle this entry with no limit, which meant a reposition that
|
|
229
|
-
* priced differently by inclusion time could pull the whole allowance
|
|
229
|
+
* priced differently by inclusion time could pull the whole allowance.
|
|
230
230
|
* The bounds are required; {@link UNBOUNDED} is an explicit, visible opt-out.
|
|
231
231
|
*/
|
|
232
232
|
export async function move(c: LogswapClient, a: MoveArgs): Promise<Hash> {
|
|
@@ -325,7 +325,7 @@ export async function edit(c: LogswapClient, a: EditArgs & { toFloor: bigint; to
|
|
|
325
325
|
if (settleIn === "kind") {
|
|
326
326
|
settle = settleInKind(key, recipient, { ...boundsFromFlows(p.dBase, p.dQuote, a.slippageBps), ...defined(a) });
|
|
327
327
|
} else {
|
|
328
|
-
// the swept fees ride INSIDE dQuote (the manager burns by owner and nets them
|
|
328
|
+
// the swept fees ride INSIDE dQuote (the manager burns by owner and nets them),
|
|
329
329
|
// so quote's open delta after the update is dQuote itself — `fees` is reported for display only
|
|
330
330
|
const otherFlow = settleIn === "base" ? p.dQuote : p.dBase; // + = owed, − = released
|
|
331
331
|
const otherIsBase = settleIn === "quote";
|
package/src/pools.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface PoolState {
|
|
|
31
31
|
reserveQuote: bigint;
|
|
32
32
|
/** Fee-per-unit-L accumulator: $\phi \cdot \mathrm{TV}(\log p)$. */
|
|
33
33
|
F: bigint;
|
|
34
|
-
/** Quadratic variation of log-price, $\Sigma = \sum_{\text{swaps}} (\Delta x_{\text{swap}})^2$ — one term per swap
|
|
34
|
+
/** Quadratic variation of log-price, $\Sigma = \sum_{\text{swaps}} (\Delta x_{\text{swap}})^2$ — one term per swap. */
|
|
35
35
|
bigSigma: bigint;
|
|
36
36
|
currentK: bigint;
|
|
37
37
|
protocolOwed: bigint;
|
|
@@ -52,7 +52,7 @@ export async function getPool(c: LogswapClient, key: PoolKey): Promise<PoolState
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* The market's fee: the key's `phi` with `0n` resolved to `DEFAULT_FEE`. Constant for the market's
|
|
55
|
-
* life (C version 4,
|
|
55
|
+
* life (C version 4, — `phiEff` and the variance kernel before). Reverts for a key
|
|
56
56
|
* nobody initialized, which `discoverMarkets` relies on to drop a stale indexer's rows.
|
|
57
57
|
*/
|
|
58
58
|
export async function phiOf(c: LogswapClient, key: PoolKey): Promise<bigint> {
|