feat(RingV2): add BSC support - #1220
Open
DreamXzxy wants to merge 1 commit into
Open
Conversation
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
RingV2 already supports Ethereum. This PR only adds BSC configuration and tests.
BSC deployments
0x4De602A30Ad7fEf8223dcf67A9fB704324C4dd9B0xEeE400Eabfba8F60f4e6B351D8577394BeB972CD0x20504f37A95eF80e3FC7476c4801fb39AaE6bAd00xa7ae6a5ec37f0c21bbdac560794258c4089b8ae3ffa6e3909b53c6091764a6760x2bdba5734ddf754fb149ef1faa937956c52cfd1f24d68163a95f42d08ec06d38Tests
pnpm install --frozen-lockfilepnpm exec prettier --check src/dex/uniswap-v2/ring-v2.ts src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.tspnpm run check:tscpnpm run check:espnpm run buildgit diff --checkpnpm exec jest src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts --runInBand -t RingV2 --silent --forceExitNotes
WBNB/ETHhas liquidity on RingV2 BSC, quotes in both directions, and is covered by the e2e tests.WBNB/USDTalso quotes on-chain, but local e2e runs intermittently hit dex-lib's internal 3-second pricing timeout, so it is not included in the test coverage.USDC/WBNB,bBTC/WBNB, andDAI/WBNBwere checked but do not currently have RingV2 pairs.Note
Medium Risk
New on-chain addresses on a live chain; misconfiguration would break routing or few-wrap resolution, but changes are additive config and tests mirroring mainnet.
Overview
RingV2 is extended to BSC by adding network-specific DEX config alongside the existing mainnet setup.
RingV2Configgains a[Network.BSC]entry with BSC factory and router addresses (sameinitCode, fee, and pool gas assumptions as mainnet).FewWrappedTokenConfiggets a matching BSC block so few-wrapped token CREATE2 addresses resolve with the BSC few-wrap factory. BecausedexKeysWithNetworkis built from these maps, BSC is picked up without other wiring changes.BSC e2e coverage is added in
uniswap-v2-e2e-bsc.test.ts: RingV2 SELL/BUY viaswapExactAmountIn/swapExactAmountOutfor BNB ↔ ETH in both directions.Reviewed by Cursor Bugbot for commit 104cb14. Bugbot is set up for automated code reviews on this repo. Configure here.