[codex] Extend Binance rebalancer routes for WETH#3160
Draft
nicholaspai wants to merge 7 commits intomasterfrom
Draft
[codex] Extend Binance rebalancer routes for WETH#3160nicholaspai wants to merge 7 commits intomasterfrom
nicholaspai wants to merge 7 commits intomasterfrom
Conversation
nicholaspai
commented
Apr 6, 2026
| return toBNWei(truncate(convertedAmount, outputDecimals), outputDecimals); | ||
| } | ||
|
|
||
| function resolveStepPrecision(stepSize: string): number { |
Member
Author
There was a problem hiding this comment.
this function should be better commented its unclear what's going on here and what its intended purpose is
nicholaspai
commented
Apr 6, 2026
| private spotMarketMetaPromiseByRoute = new Map<string, Promise<SPOT_MARKET_META>>(); | ||
|
|
||
| REDIS_PREFIX = "binance-stablecoin-swap:"; | ||
| private static readonly ORDER_BOOK_CACHE_TTL_MS = 30_000; |
Member
Author
There was a problem hiding this comment.
what does this hardcoded class variable do?
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.
What changed
src/rebalancer/buildRebalanceRoutes.tsBINANCE_NETWORKS_BY_SYMBOLandREBALANCE_CHAINS_BY_SYMBOLmaps so Binance venue support and rebalancer enablement are configured separatelyWETH <-> USDC,WETH <-> USDT, and directWETH <-> WETHtransfers on direct Binance ETH networksUSDC <-> USDCandUSDT <-> USDTso they can compete on estimated cost against CCTP and OFT routesWETHas BinanceETH, skip the swap leg for same-coin transfers, and avoid intermediate bridge legs for assets that cannot use themWhy
The existing rebalancer/Binance flow was effectively limited to USDC and USDT swap routes. These changes open the path for WETH support and also let Binance compete directly with CCTP/OFT when the source and destination asset are already the same, while still avoiding same-asset Binance routes on chains that would require intermediate bridge legs.
The token-keyed network maps also make it easier to distinguish between:
Impact
Rebalancer route construction now exposes WETH-capable Binance families plus same-asset Binance stablecoin routes on direct Binance networks, and the Binance adapter can process both swap-backed routes and same-coin withdrawals safely.
Validation
yarn buildyarn test test/BinanceAdapter.helpers.ts test/RebalancerClient.buildRebalanceRoutes.ts