Skip to content

feat(pricing): enforce quote amount bounds#249

Open
changliuchang777 wants to merge 1 commit into
StableRoute-Org:mainfrom
changliuchang777:pricing/amount-bounds-02
Open

feat(pricing): enforce quote amount bounds#249
changliuchang777 wants to merge 1 commit into
StableRoute-Org:mainfrom
changliuchang777:pricing/amount-bounds-02

Conversation

@changliuchang777

Copy link
Copy Markdown

Summary

  • add BigInt-based quote bound checks for per-pair minAmount, maxAmount, and liquidity metadata
  • return canonical single-quote errors for below-min/above-max and insufficient liquidity
  • report bulk quote bound failures per item without failing the whole batch
  • document bound semantics and the zero-means-unset rule

Fixes #2

Validation

  • PASS: git diff --check
  • BLOCKED: npm test -- --runInBand src/tests/index.test.ts -t "quote amount bounds" fails before running tests because main currently has duplicate declarations in src/index.ts: WEBHOOK_MAX_EVENTS is already declared
  • BLOCKED: npx eslint src/index.ts --quiet fails on existing main unused variables: WebhookRecord, PORT, isKeyValid, requireScope, resolvePair, computeQuoteTimes

Precision strategy

All quote bound comparisons parse metadata strings and request amounts as BigInt. The implementation never coerces base-unit amounts through Number, and treats metadata value "0" as an unset bound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce min/max amount bounds and liquidity ceiling on quotes

1 participant