-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Describe the bug
While running examples/exchange locally (WSL + Vite), Buy swaps succeed (receipt link appears), but Sell often reverts on tempo testnet with:
Stablecoin DEX error: InsufficientOutput(InsufficientOutput)
In the default example UI this can look like a no-op (“nothing happens”) because the error isn’t surfaced.
Debugging notes / workaround
1) Surface the error in the UI
Adding basic error handling (e.g. rendering sellSendCalls.error / sellSendCalls.isError, or catching and displaying TransactionExecutionError) makes the revert reason visible instead of looking like nothing happened.
2) Adjust slippage tolerance on testnet
The default slippage tolerance is 0.5% (0.005). On current testnet liquidity this was too strict and caused InsufficientOutput. Increasing it to ~50% made Sell succeed reliably:
// default
const slippageTolerance = 0.005
// workaround (testnet)
const slippageTolerance = 0.5Suggestion: expose slippage as a UI input (or use a higher default on testnet) and surface errors by default.
Example successful sell tx (after workaround): https://explore.tempo.xyz/tx/0x3e35dfaa6110be7269425e1556706bb8a59dac94e8b5d6f509ee671287b4552b
Steps to reproduce
- Clone the example:
pnpx gitpick tempoxyz/examples/tree/main/examples/exchange exchange cd exchange pnpm install pnpm dev --host 0.0.0.0 --port 5173 - Open http://localhost:5173
- Sign up / Sign in
- Click Fund Account
- (Optional) Click Place Order
- Click Sell 10 AlphaUSD for BetaUSD
- Observe revert: \InsufficientOutput
Logs
TransactionExecutionError: Execution reverted with reason:
Stablecoin DEX error: InsufficientOutput(InsufficientOutput)
viem@2.46.2
Platform(s)
Windows (x86)
Container Type
Other, Not running in a container
What version/commit are you on?
Main branch (pulled from tempoxyz/examples via gitpick from examples/exchange).
No container (running locally on Windows 11 + WSL (Ubuntu)).
If you've built from source, provide the full command you used
pnpx gitpick tempoxyz/examples/tree/main/examples/exchange exchange && cd exchange && pnpm install && pnpm dev --host 0.0.0.0 --port 5173
Code of Conduct
- I agree to follow the Code of Conduct