Skip to content

fix(tools): simulate swaps of tokens backed by the native balance - #726

Merged
louise-poole merged 2 commits into
mainfrom
tl/arc-usdc-simulation
Nov 9, 2026
Merged

louise-poole merged 2 commits into
mainfrom
tl/arc-usdc-simulation

Conversation

@tamaralipows

Copy link
Copy Markdown
Contributor

Problem

  • The quote verifier checks served routes by simulating them with EthCallRunner.
  • To fund the simulated sender, the runner overwrites the token's balance and allowance storage.
  • On Arc, the node refuses to overwrite USDC's storage (Blocked address). So no route that sells USDC on Arc can be simulated.

Fix

  • On Arc, a USDC balance is the account's native balance. A caller can now mark a token like this on the runner.
  • Selling the token: the runner funds it through the native balance, then sends a real approve before the swap, in the same eth_simulateV1 bundle.
  • Buying the token: the runner starts the sender at a zero native balance, so the balance read measures only what the swap delivered.
  • Without eth_simulateV1, selling the token fails with a clear error.

Tested

  • On 16 live Arc routes, through the verifier: 13 simulate within 1 bps of the quote. The other 3 sell EURC, which the verifier will skip.

Follow-up to ENG-6395.

🤖 Generated with Claude Code

WHY:
We would like the quote verifier to simulate USDC routes on Arc. Arc's
node refuses state overrides of USDC's storage, so every such
simulation fails today.

HOW:
- A caller marks a token whose balanceOf reads the native balance
- Selling it: fund it with the native balance override, and approve
  the spender with a call before the swap in eth_simulateV1
- Buying it: zero the sender's native balance so the balance read
  measures only the swap output

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@louise-poole louise-poole left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Good find!

@louise-poole
louise-poole merged commit 50e60b5 into main Nov 9, 2026
14 checks passed
@louise-poole
louise-poole deleted the tl/arc-usdc-simulation branch November 9, 2026 10:26
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