Skip to content

feat(dex): add swap-quote and tick/price read helpers - #95

Open
devorun wants to merge 1 commit into
tempoxyz:mainfrom
devorun:feat/dex-quote-read-helpers
Open

devorun wants to merge 1 commit into
tempoxyz:mainfrom
devorun:feat/dex-quote-read-helpers

Conversation

@devorun

@devorun devorun commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

StablecoinDEX exposes call builders for swaps and orders (swap_exact_amount_in, place, cancel, ...) but no way to quote a swap or convert between order ticks and prices, so callers had to send a transaction to discover pricing.

Add four read helpers, mirroring the existing storage_credits helper:

  • quote_swap_exact_amount_in / quote_swap_exact_amount_out — quote a swap's output/input without executing it
  • tick_to_price / price_to_tick — convert between an order tick and its price (price_to_tick decodes the signed int16 result)

Each helper reuses the shipped IStablecoinDEX ABI and the existing decode helpers. Includes tests (encoded selector + decoded value for each, plus a negative-tick case for price_to_tick) and a changelog entry.

StablecoinDEX exposed swap and order call builders but no way to quote a swap or convert between order ticks and prices. Add quote_swap_exact_amount_in, quote_swap_exact_amount_out, tick_to_price, and price_to_tick read helpers (mirroring the existing storage_credits helper) so callers can price swaps and orders without sending a transaction.
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.

1 participant