feat(monad): enable kyber, openocean, lifi, relay aggregators - #7
Merged
Conversation
4 tasks
Hiksang
added a commit
that referenced
this pull request
May 6, 2026
PR #3 (feat/slippage-protection) closed 14 of the 15 sites that the 2026-05-05 baseline catalogued in qa/slippage.test.ts:KNOWN_INFINITE_SLIPPAGE. The line numbers also shifted when PR #4 (viem-chain anchor) refactored uniswap_v3.ts, so every entry in the original snapshot became stale on 2026-05-06 main and the test went red on every new PR (e.g. #7). This commit re-grounds the snapshot against current main: Adapter scan (regex unchanged): exactly 1 hit remains in the entire defi-protocols/src tree — dex/uniswap_v3.ts:262 amountOutMinimum: 0n (eth_call simulation inside quote() fallback; never broadcasts a tx) PR #3 hardened the other 14 sites: algebra_v3.ts:86,273,278,304 -> applyMinSlippage / explicit min args balancer_v3.ts:37 -> applyMinSlippage thena_cl.ts:78,165,190 -> applyMinSlippage / explicit min args uniswap_v3.ts:90,242,343,344, -> applyMinSlippage / explicit min args 363,364,403 In addition to refreshing the set, this commit fixes a self-trigger bug: uniswap_v3.ts:94 carries a documentation comment that warns against `amountOutMinimum: 0n`, and that comment matched the regex on its own — driving a false-positive "novel site" failure. Adding a `commentLinePattern` skip in both `it` blocks keeps the guard's intent (catch real broadcast paths) while letting docs reference the forbidden literal. Verified: - pnpm -C ts -r build — synced + dist rebuilt clean. - pnpm -C ts -r lint — 3 packages, tsc --noEmit clean. - pnpm -C ts -r test — 64/64 passing (was 62/64 before this fix). Refs: PR #7 CI failure (3x Build & Test red) was the smoke; root cause was the line-number drift, not anything Monad-related.
Monad mainnet (chain id 143) was wired into the registry without any
aggregator slugs, so `defi --chain monad swap` was returning
"unsupported chain" for every provider. Live API probes against each
aggregator on 2026-05-06 confirmed 4 of 5 already route Monad:
- KyberSwap — slug `monad`, docs explicitly list chain 143;
/monad/api/v1/routes accepts the chain segment
(HTTP 400 = token-level, not chain-level).
- OpenOcean — slug `monad`, present in the supported-chain list
alongside `monad_test` and `143`. /v4/monad/tokenList
returns mainnet tokens.
- LI.FI — chain 143 in /v1/chains as { key:"mon", coin:"MON" }.
- Relay — chain 143 in /chains, depositEnabled=true.
- LiquidSwap — HyperEVM-only by design; intentionally NOT enabled.
Smoke-tested all 4 against the dist build (MON -> USDC, --dry-run):
provider amount_in amount_out notes
----------- ------------ ------------------ ------------------------
kyber 1e18 EEEE 32301 (6dp USDC) real route + router
openocean 1e18 native 33218 real route + router
lifi 1e18 native 32220 real route + router
relay 100e18 native 3225554 real route + router
(1e18 was below
AMOUNT_TOO_LOW gate)
All four return real tx calldata, confirming the chain is fully
routable. The "simulation_failed" result in dry-run is the executor's
expected output when the placeholder wallet has no balance — orthogonal
to chain support.
LI.FI / Relay use chainId numerically inside swap.ts (the slug value is
"auto" by the chains.toml convention documented in chain.ts:6); the
entries are still required so chain.test.ts and the future
slug-parity-style guards see Monad as supported.
Verified:
- pnpm -C ts -r build — synced ts/config -> packages/defi-cli/config
cleanly, dist rebuilt without warnings.
- pnpm -C ts -r lint — 3 packages, tsc --noEmit clean.
- pnpm -C ts -r test — 62 passing; 2 pre-existing failures in
qa/slippage.test.ts:108 reproduce on
origin/main with `git stash` and are
unrelated to chains.toml.
- defi --chain monad status — 4 protocols listed (unchanged).
- 4 swap dry-runs above.
Refs: aggregator-discovery probes captured in conversation
2026-05-06; SSOT chains.toml now matches every other chain that has
LI.FI/Relay enabled.
Hiksang
force-pushed
the
feat/monad-aggregators
branch
from
May 6, 2026 10:42
6db359e to
e627e27
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Monad mainnet (chain id 143) was wired into the registry without any aggregator slugs, so
defi --chain monad swap --provider <X>returnedunsupported chainfor every provider. Live API probes on 2026-05-06 showed 4 of 5 aggregators already route Monad — only LiquidSwap is genuinely HyperEVM-only. This PR populates the missing[chain.monad.aggregators]block ints/config/chains.toml(SSOT, auto-synced topackages/defi-cli/config/byprebuild).Aggregator support matrix (verified live)
monad/monad/api/v1/routesreturns route, dry-run produces real router0x6131…7b5,amount_out=32301for 1 MON → USDCmonadmonad,monad_test,143;/v4/monad/tokenListHTTP 200 with mainnet tokens; dry-run returns router0x6352…e64,amount_out=33218auto/v1/chainsincludes{ id:143, key:"mon", name:"Monad", coin:"MON" }; dry-run returns router0x026F…C37,amount_out=32220auto/chainsincludes{ id:143, name:"Monad", depositEnabled:true }; dry-run with 100 MON returns router0xb92f…4f,amount_out=3225554What's changed
ts/config/chains.toml— single 5-line addition under[chain.monad.aggregators]:autofor LI.FI / Relay matches the convention documented inpackages/defi-core/src/registry/chain.ts:6— those providers route by numericchain_id, the slug value is advisory.Test plan
pnpm -C ts -r build—prebuildre-syncsts/config → packages/defi-cli/config; dist rebuild clean.pnpm -C ts -r lint— 3 packages,tsc --noEmitclean.pnpm -C ts -r test— 62 passing. 2 unrelated pre-existing failures inqa/slippage.test.ts:108(reproduces onorigin/mainviagit stash); flagged separately.defi --chain monad status— still lists 4 protocols (unchanged: traderjoe-monad, uniswap-v2-monad, uniswap-v3-monad, morpho-blue-monad).amount_out. The expectedsimulation_failedrevert is from the placeholder wallet's empty balance, orthogonal to chain support.Out of scope
qa/slippage.test.tsare pre-existing onmainand unrelated to chains.toml; flagging in conversation for a separate fix.🤖 Generated with Claude Code