@inversealtruism/cairnx-core 0.1.43 → 0.2.0
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/CHANGELOG.md +55 -0
- package/CONVENTION.md +11 -0
- package/MAKERS.md +399 -117
- package/README.md +2 -2
- package/dist/index.cjs +76 -41
- package/dist/index.d.cts +46 -16
- package/dist/index.d.ts +46 -16
- package/dist/index.js +55 -23
- package/dist/mm/index.cjs +2 -2
- package/dist/mm/index.d.cts +3 -2
- package/dist/mm/index.d.ts +3 -2
- package/dist/mm/index.js +3 -3
- package/package.json +3 -2
- package/test/vectors/replay-corpus.json +1 -1
- package/test/vectors/replay-hashes.json +4 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
Breaking for callers that hand-build `ProvenOfferTerms` or rely on the old two-argument verdict; see Migration.
|
|
6
|
+
|
|
7
|
+
- `bindOfferTerms` checks the give and wantType legs by default. A served offer whose `give` (ticker, amount
|
|
8
|
+
or name) or want type differs from the merkle-proven offer now counts as a mismatch with the two-argument
|
|
9
|
+
call too. To opt out, pass `{ give: false, wantType: false }`: that returns the 0.1.44 two-argument verdict
|
|
10
|
+
on every input. Opting out of one leg leaves the other on.
|
|
11
|
+
- Type change: with a leg on, the terms must come from `provenOfferTerms` or `bindProvenOffer` (the
|
|
12
|
+
`MintedProvenOfferTerms` brand). A hand-built `ProvenOfferTerms` compiles only with both legs off (the new
|
|
13
|
+
`LegacyBindOpts` type). At runtime, hand-built terms passed without the opt-out lack the give and wantType
|
|
14
|
+
fields and are refused (the predicate returns `true`).
|
|
15
|
+
- Callers that already pass `{ give: true, wantType: true }` with minted terms get the same verdicts as before.
|
|
16
|
+
- Depends on csd-codec 0.1.18 (reject-more input canon, see `CONSENSUS_CHANGES.md`); `records.ts` imports
|
|
17
|
+
the codec's well-formed UTF-16 predicate instead of its own copy, with the same verdicts.
|
|
18
|
+
- `resolve()` and canonical state are byte-identical to 0.1.44.
|
|
19
|
+
|
|
20
|
+
Migration. Callers that already pass `{ give: true, wantType: true }` with minted terms need no change (the
|
|
21
|
+
site's `swapguard.js`, the wallet's `wallet.ts` and cairn-sdk's `fillverify.ts` production path). These move
|
|
22
|
+
together with the 0.2.0 pin:
|
|
23
|
+
- cairn-sdk `test/fillverify.test.ts`: the two-argument assertions on hand-built terms expect the old default
|
|
24
|
+
(the inflated give passing); pass `{ give: false, wantType: false }` there or expect the refusal.
|
|
25
|
+
- cairn-sdk `src/fillverify.ts`: the result's `terms` field is typed `ProvenOfferTerms`, which drops the mint
|
|
26
|
+
brand, so a dApp passing it back to `bindOfferTerms` without the opt-out no longer compiles; type it
|
|
27
|
+
`MintedProvenOfferTerms`.
|
|
28
|
+
- cairn `test/b7a-flip.test.mjs`: its two-argument call asserts the give leg is off; it now refuses.
|
|
29
|
+
- cairn-wallet `src/vendor/cairnx-spv.js` and `cairnx-spv.d.ts`: the vendored bundle keeps the 0.1.x
|
|
30
|
+
contract (legs opt-in) until it is re-vendored from 0.2.0.
|
|
31
|
+
|
|
32
|
+
## 0.1.44
|
|
33
|
+
|
|
34
|
+
- `rfqFillAllIn(n, feeBps?)` (`cairnx-core/mm`) takes the offer's fee rate; omitted or null keeps
|
|
35
|
+
`FEE_BPS_V16`, so every existing one-argument call returns the same number.
|
|
36
|
+
- `epochOf` now lives in `csd-codec` next to `EPOCH_LEN` and is re-exported from the root unchanged.
|
|
37
|
+
- New root exports, none read by `resolve()`: `ptAmt` (the resolver's own paidTo amount reader),
|
|
38
|
+
`burnedPayment` (what a refused record paid to the treasury, and for a fill to the offer's seller and payto,
|
|
39
|
+
never counting the payer) and `myProvenFillClosedOffer` (whether a buyer's own merkle-proven full fill closed
|
|
40
|
+
the offer behind one of its fclaim holds, for the V29 cross-offer hold count).
|
|
41
|
+
- `resolve()` and canonical state are byte-identical to 0.1.43.
|
|
42
|
+
|
|
43
|
+
## 0.1.43
|
|
44
|
+
|
|
45
|
+
- New subpath `@inversealtruism/cairnx-core/mm` (ESM and CJS, built to `dist/mm/`). The root export, the
|
|
46
|
+
resolver and every consensus file are unchanged; `dist/index.*` is byte-identical to 0.1.42.
|
|
47
|
+
- `mm` holds the market maker's non-consensus math in one place for the maker service and the site:
|
|
48
|
+
`sizeBid`, `acceptBid`, `tierFor` (bid sizing against the indicative ladder), `tradeNotional` (contractual
|
|
49
|
+
volume of a fill), `expScaled`, `sunriseTimeMult` and `sunriseCurve` (the Sunrise spot curve), and the
|
|
50
|
+
RFQ all-in sums `rfqBuyAllIn` and `rfqFillAllIn`, and `priorBuyers` (the returning-buyer rule: buyers of fills
|
|
51
|
+
of offers the maker sold) (built from `tradeFee`, `makerRebate`, `FEE_BPS_V16` and the
|
|
52
|
+
codec's minimum fees).
|
|
53
|
+
- New Sunrise order pricing: `sunriseOrderCost` is the integral of the spot curve over an order, rounded up;
|
|
54
|
+
`sunriseAnswerPrice` adds a flat margin and a per-token floor; `sunriseTokensFor` inverts it for a budget.
|
|
55
|
+
`expm1Scaled` is the fixed-point e^z - 1 behind it (scale 1e18).
|
package/CONVENTION.md
CHANGED
|
@@ -1098,6 +1098,17 @@ mutates that offer object, so an inside-closure read sees the hold; a value snap
|
|
|
1098
1098
|
apply-time target scan would not.) The freeze is scoped to `claimTxid !== undefined`, so pre-V28 legacy holds
|
|
1099
1099
|
keep §16 behavior byte-for-byte.
|
|
1100
1100
|
|
|
1101
|
+
*Griefing note (Correction 2).* The freeze lets a buyer who holds a claim block the seller's cancel, and
|
|
1102
|
+
nothing in this version bounds how many holds follow one another. The claim cooldown binds only the address
|
|
1103
|
+
that held last (`claimedBy` is last-write-wins), so two addresses can alternate: each grant buys a hold of 61 to
|
|
1104
|
+
90 blocks for one Propose fee (0.25 CSD), and a grant that lands in the block where the previous hold lapses
|
|
1105
|
+
also freezes a cancel in that block. Sustained, that costs about 2 to 3 CSD a day at the 120-second block
|
|
1106
|
+
target. While the chain of holds lasts the seller cannot withdraw the offer, and the holder can fill it at its
|
|
1107
|
+
posted terms whenever they become favourable: a free option on a stale price, not a loss of funds already
|
|
1108
|
+
paid. The exposure ends at the offer's expiry, because a hold can never outlive it. A seller who may need to
|
|
1109
|
+
pull an offer should keep its expiry short or quote taker-bound (Lane B, below), which cannot be claimed.
|
|
1110
|
+
`packages/cairnx/test/fclaim-v28.test.ts` case 12 pins both halves (two holders freeze the cancel; one cannot).
|
|
1111
|
+
|
|
1101
1112
|
**Lane B (taker-bound offers become uncancellable at V28).** A taker-bound (RFQ) answer is a firm quote: at
|
|
1102
1113
|
`h >= V28`, both cancel paths reject a cancel when `o.taker !== undefined` and the offer was anchored at V28+.
|
|
1103
1114
|
The maker exits by letting the answer expire (one epoch, about an hour). This eliminates the cancel-reorder half
|