From edd0ee537dfcbb9f8fcb14cd39b272b5eab85a0d Mon Sep 17 00:00:00 2001 From: Hui-Sang Kim <102507786+Hiksang@users.noreply.github.com> Date: Thu, 7 May 2026 15:20:39 +0900 Subject: [PATCH] fix(swap): raise default --slippage from 50 to 100 bps for thin-liquidity broadcasts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-fix behaviour: `defi --chain monad swap --from MON --to USDC --provider kyber --broadcast` reverted on-chain inside the KyberSwap MetaAggregator's minOut check, even though the dry-run simulation succeeded. Reproduced live on Monad on 2026-05-07 (tx 0x4fe39977eab47de942e7aefd540f12d4f9c56ae340813e6a46bd63c8f0a30e7f). Root cause: the default --slippage of 50 bps (0.5%) is too tight for thin-liquidity chains and high-volatility moments. The dry-run uses eth_call against the current block; the real broadcast lands one or more blocks later when the spot price has drifted past the 50 bps floor encoded in the kyber-built calldata. Fix: - Raise the default --slippage from 50 to 100 bps. 100 bps is the SSOT 7.3 ceiling for "safe default" defined by qa/slippage.test.ts: "user-facing slippage knobs default to <= 100 bps (1%)". This change keeps the default at the ceiling, which the slippage guard explicitly allows. - Users wanting tighter control still pass --slippage explicitly; the lower bound is unchanged. - Comment block above the option documents the rationale + the Monad failure tx for future archaeology. Live re-verification post-fix (same swap, same wallet, default slippage now 100 bps): pre : tx 0x4fe39977… status=failed, gas_used=69095 (revert) post : tx 0x35310bb3… status=confirmed, gas_used=427255 (success) Verified: - pnpm -C ts -r build — clean. - pnpm -C ts -r lint — 3 packages, tsc --noEmit clean. - pnpm -C ts -r test — defi-core 32/32, defi-protocols 43/43, defi-cli 102/102 (the existing qa/slippage.test.ts ceiling check still passes because 100 == ceiling). - Live on-chain kyber broadcast on Monad (above): success. --- ts/packages/defi-cli/src/commands/swap.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ts/packages/defi-cli/src/commands/swap.ts b/ts/packages/defi-cli/src/commands/swap.ts index 7c5c85e..e97ca9c 100644 --- a/ts/packages/defi-cli/src/commands/swap.ts +++ b/ts/packages/defi-cli/src/commands/swap.ts @@ -219,7 +219,14 @@ export function registerSwap( .requiredOption("--to ", "Output token symbol or address") .requiredOption("--amount ", "Amount of input token in wei") .option("--provider ", "Aggregator: kyber, openocean, liquid, lifi, relay", "kyber") - .option("--slippage ", "Slippage tolerance in bps", "50") + // Default 100 bps (1%) is the SSOT 7.3 ceiling for "safe default" and + // the sweet spot for thin-liquidity chains like Monad where the previous + // 50 bps default produced revert-on-broadcast even when the dry-run + // simulated successfully. Live re-verification on 2026-05-07 reproduced + // the issue: kyber dry-run succeeded but the actual on-chain tx reverted + // inside the router's minOut check (Monad tx 0x4fe39977…). Users wanting + // tighter control still pass --slippage explicitly. + .option("--slippage ", "Slippage tolerance in bps", "100") .action(async (opts) => { const executor = makeExecutor(); const chainName = requireChain(parent, getOpts);