fix(cli): correct OptionBook/RFQ math, enable WETH closes, cut 0.2.0 - #56
Merged
Merged
Conversation
- Raise the hex threshold to 68 so addresses (42), tx hashes (66) and compressed RFQ public keys (68) never collapse; only larger blobs do, and they keep a `(N chars)` length suffix so calldata size stays checkable. - Raise the string threshold to 140 so copy/paste next-step commands survive. - Wrap key/value tables to the terminal width instead of overflowing it.
…e orders - Scale prices by the protocol's fixed 8-decimal price scale and contract counts by the collateral scale; premiums rendered 100x high and contract counts 100x low. - Recompute the preview premium for the contracts actually filled, and approve its ceiling so a fill cannot revert on a one-unit rounding difference. - Show only cash-settled USDC maker asks, excluding physical implementations, maker bids, expired orders and zero-liquidity orders. - Re-resolve the exact EIP-712 signature before broadcast, since Odette reuses nonces, and allow the volatile `--order-index` only with `--dry-run`.
…adlines - Require explicit `--collateral-token WETH` for vanilla ETH calls and override the SDK's collateral-blind implementation choice; the old USDC pairing built requests no maker could fill. - Restamp `offerEndTimestamp` immediately before broadcast so approvals and confirmation prompts cannot consume the whole offer window. - Reject offers above the RFQ's fixed buyer reserve, which can never settle because a buyer cannot top up an existing request. - Denominate WETH inverse-call scenario payouts in ETH instead of dollars.
- Size the closing reserve with exact bigint math so 18-decimal amounts, which exceed Number.MAX_SAFE_INTEGER, are no longer rounded through a float; USDC results are unchanged. - Restamp the closing RFQ deadline before broadcast, and reject up front a close whose option expires inside the offer window. - Drop the signer requirement from `position payout` and propagate exit codes; r12 settles automatically and there is no user-callable claim. - Add a `structure` column to `position list`.
- Include the native balance in `wallet balance` and accept `--token ETH`. - Render the full wallet address in `wallet show`, the primary copy surface.
- Bump the CLI to 0.2.0: displayed numbers change and `book fill --order-index` no longer performs live fills, so this is not a patch. - Document the release in cli/CHANGELOG.md and refresh the README banner, orders table, keyless `rfq build` example and WETH close docs. - Wire the regression tests to `npm test`. - Sync the root lockfile to the published SDK version 0.3.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLI-only correctness release. Touches
cli/plus a one-line root lockfile version sync (0.2.5→0.3.0, catching up to the already-published SDK). No SDK source is modified.Why
Several OptionBook and RFQ paths were producing wrong numbers or unfillable requests:
book preview/book filldivided prices by the collateral token's decimals instead of the protocol's fixed 8-decimal price scale, and divided contract counts by 1e8 instead of the 6-decimal contract scale — premiums rendered 100x high, contract counts 100x low.INVERSE_CALLrequest that no maker could fill.offerEndTimestampis stamped at build time, and an ERC-20 approval plus two prompts routinely consumed the whole 45s window — RFQs were mined already expired.book fillre-resolved orders by(maker, nonce)before broadcast, but Odette reuses nonces across batches, so it could resolve the wrong order.What changed
bookrfq--collateral-token WETHand route toINVERSE_CALL; deadlines restamped at broadcast; offers above the fixed buyer reserve rejectedpositionpayoutis read-only inspection with correct exit codeswalletBreaking
book fill --order-indexno longer performs live fills — indices shift as orders fill/cancel, so it is accepted only with--dry-run. Live fills need the stable selector flags and exit 2 otherwise.position payoutdry-runactionrenamedpayout→inspect-automatic-payout.Hence
0.2.0, not a patch. Full detail incli/CHANGELOG.md.Verification
npm run typecheck,npm run build,npm testall pass (regression tests added for book eligibility and RFQ routing, now wired tonpm test).book orders,book preview,book fill --dry-run,book check,rfq buildfor both USDC and WETH paths,wallet balance,position list,keys show.quotations()reads confirm the buyer-reserve guard compares against the real escrowed value.Known gaps
position closestill fails at the broadcast restamp if the option expires within (offer window + approval/confirm time). Narrowed by an up-front guard but not eliminated;rfq requesthas the same residual by construction.renderArrayTablecan still overflow for wide tables likeposition listbeyond 5 rows — pre-existing, unchanged here.