Skip to content

fix(deposit_handler): TokenMismatch error + exchange-router-api.md accuracy fixes (#661-664) - #674

Merged
abayomicornelius merged 2 commits into
SO4-Markets:mainfrom
circleboyslimited:docs/exchange-router-api-fixes
Aug 24, 2026
Merged

fix(deposit_handler): TokenMismatch error + exchange-router-api.md accuracy fixes (#661-664)#674
abayomicornelius merged 2 commits into
SO4-Markets:mainfrom
circleboyslimited:docs/exchange-router-api-fixes

Conversation

@circleboyslimited

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • cargo build -p deposit-handler — compiles clean
  • cargo test -p deposit-handler — 36 passed, 1 ignored (pre-existing, unrelated), 0 failed — including create_deposit_wrong_long_token_reverts / create_deposit_wrong_short_token_reverts
  • Doc changes verified against current source (env.events().publish(...) call sites in each handler, exchange_router's standalone entrypoint list)

Closes #661
Closes #662
Closes #663
Closes #664

… wrong-token config mismatch

Closes SO4-Markets#661

create_deposit's two wrong-token checks (initial_long_token/
initial_short_token not matching the market's configured tokens) were
reusing Error::Unauthorized, the same code raised for an actual
caller-permission failure elsewhere in the contract. A client
distinguishing failures by typed try_* error code couldn't tell "you
aren't allowed to do this" apart from "the tokens you specified don't
match this market's configuration".

docs/exchange-router-api.md's create_deposit error table already
documented TokenMismatch as if it existed; add that variant to
deposit_handler's Error enum and raise it at both sites instead.
…n-event payloads, and Overview example

Closes SO4-Markets#662
Closes SO4-Markets#663
Closes SO4-Markets#664

- SO4-Markets#662: §8 claim_funding_fees stated its event as fee_clm (FeeClaimed,
  emitted by claim_fees). It actually publishes fnd_clm
  (FundingFeeClaimed) — a different fee_handler event entirely. An
  indexer filtering on the documented topic would silently miss every
  claim_funding_fees call.
- SO4-Markets#663: §2/§4/§6's "Events emitted" lines for create_order/
  create_deposit/create_withdrawal still showed the pre-SO4-Markets#442
  (key, caller, market) shape. All three were enriched by SO4-Markets#442 to
  include size/collateral/amount fields specifically so indexers could
  read pending-order details off the creation event without an extra
  RPC round-trip; updated all three to the current payload.
- SO4-Markets#664: the Overview's "direct single-action helpers are also exposed"
  claim used create_order as its example — the one RouterAction
  variant (alongside send_tokens) that has no standalone entrypoint at
  all. Swapped in cancel_order/create_deposit as accurate examples and
  called out the exceptions explicitly.
@drips-wave

drips-wave Bot commented Aug 24, 2026

Copy link
Copy Markdown

@circleboyslimited Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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