Skip to content

token-quote-coverage: quote one USDC on BNB Chain, not 1e-12 USDC - #3308

Merged
Flotapponnier merged 2 commits into
ChainBench:devfrom
hey-research-lab:fix/bsc-usdc-quote-amount
Oct 27, 2026
Merged

Flotapponnier merged 2 commits into
ChainBench:devfrom
hey-research-lab:fix/bsc-usdc-quote-amount

Conversation

@hey-research-lab

Copy link
Copy Markdown
Contributor

What was wrong

harnesses/token-quote-coverage probes every token with "1 USDC -> token" (README, step 3). On BNB Chain the input is USDC at 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d, whose decimals() is 18 (read on chain). Four adapters send a flat 1000000 base units on every chain:

  • cmd/monitor/kyberswap.go:53 amountIn=1000000
  • cmd/monitor/paraswap.go:52 amount=1000000, and :54 srcDecimals=6
  • cmd/monitor/odos.go:64 "amount": "1000000"
  • cmd/monitor/relay.go:62 "amount": "1000000"

That is 1 USDC on Base and Robinhood Chain (6 decimals) but 0.000000000001 USDC on BNB Chain, so the BNB cells measure whether a provider can route dust, not 1 USDC.

ParaSwap shows it directly. Live /prices on network 56, USDC to CAKE (0x0E09...cE82) and to a thin four.meme token (0xC3A9...5c68):

request CAKE four.meme token
as sent now: amount=1000000&srcDecimals=6 400 ESTIMATED_LOSS_GREATER_THAN_MAX_IMPACT 404 No routes found with enough liquidity
1 USDC: amount=1000000000000000000&srcDecimals=18 200, route returned 200, route returned

The adapter counts any non-200 as a miss, so ParaSwap's BNB coverage is understated even for CAKE. KyberSwap and Relay still answered the dust amount in the same check, so their cells are not obviously wrong today, but they are not quoting what the bench says.

How it was verified

  • Added cmd/monitor/quote_amount_test.go. It points each adapter at a recording http.RoundTripper (no network) and checks the amount sent for base, robinhood and bsc, plus ParaSwap's srcDecimals. Before the fix it fails on bsc for all four adapters (quoted "1000000" base units of the stable, want "1000000000000000000") and on srcDecimals="6", want "18". After the fix it passes.
  • go vet ./... and go test ./... in harnesses/token-quote-coverage pass. The changed files are gofmt clean.
  • No spec or site file changed, so pnpm validate/typecheck/build were not run.

What changed

  • helpers.go: stableDecimals(chain) (18 on bsc, 6 elsewhere) and oneStableUnit(chain).
  • KyberSwap, ParaSwap, Odos and Relay send oneStableUnit(token.Chain). Base, Robinhood Chain and Solana still send 1000000.
  • ParaSwap sends srcDecimals from stableDecimals.
  • Mobula (human amount 1) and Jupiter (Solana only) are unchanged.

Type

  • Other (harness fix)

USDC on BNB Chain (0x8AC76a51...580d) has 18 decimals. KyberSwap, ParaSwap,
Odos and Relay sent a flat 1000000 base units on every chain, which is one
USDC on Base and Robinhood Chain but 0.000000000001 USDC on BNB Chain, and
ParaSwap was told srcDecimals=6. The amount and ParaSwap's srcDecimals now
follow the chain's stablecoin.
ParaSwap answers "Destination Decimals Mismatch" when destDecimals does
not match the token, so every 6- or 9-decimal destination counted as a
miss. Left out, the API reads the token's own decimals.
@Flotapponnier

Flotapponnier commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks a lot for this one, and the timing is good. ParaSwap started validating srcDecimals against the token roughly 30 hours ago: from then on every BSC probe came back 400 "Source Decimals Mismatch" and ParaSwap's BSC coverage sat at 0 (it was around 60% the days before, while it was quoting 1e-12 USDC). With your change 1 USDC routes fine.

I pushed one small follow-up commit on top: ParaSwap now also rejects a wrong destDecimals ("Destination Decimals Mismatch"), and we were sending a flat 18 for every token, so I dropped the parameter (ParaSwap resolves it itself) and added a check to your test. Merged and deployed; the first cycle on the new build shows BSC ParaSwap quotes succeeding again.

@Flotapponnier
Flotapponnier merged commit 7f9b106 into ChainBench:dev Oct 27, 2026
Flotapponnier added a commit that referenced this pull request Oct 27, 2026
) (#3309)

* token-quote-coverage: quote one USDC on BNB Chain, not 1e-12 USDC

USDC on BNB Chain (0x8AC76a51...580d) has 18 decimals. KyberSwap, ParaSwap,
Odos and Relay sent a flat 1000000 base units on every chain, which is one
USDC on Base and Robinhood Chain but 0.000000000001 USDC on BNB Chain, and
ParaSwap was told srcDecimals=6. The amount and ParaSwap's srcDecimals now
follow the chain's stablecoin.

* paraswap: stop sending destDecimals=18

ParaSwap answers "Destination Decimals Mismatch" when destDecimals does
not match the token, so every 6- or 9-decimal destination counted as a
miss. Left out, the API reads the token's own decimals.

---------

Co-authored-by: Hey Research Lab <hi@heyresearch.xyz>
Co-authored-by: HEY Research Lab <327801004+hey-research-lab@users.noreply.github.com>
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.

2 participants