Skip to content

feat(RingV2): add BSC support - #1220

Open
DreamXzxy wants to merge 1 commit into
VeloraDEX:masterfrom
RingProtocol:ringv2-bsc-support
Open

feat(RingV2): add BSC support#1220
DreamXzxy wants to merge 1 commit into
VeloraDEX:masterfrom
RingProtocol:ringv2-bsc-support

Conversation

@DreamXzxy

@DreamXzxy DreamXzxy commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • Add RingV2 deployment configuration for BSC.
  • Add the BSC FewWrappedToken factory configuration.
  • Add RingV2 BSC e2e coverage for BNB <-> ETH.

RingV2 already supports Ethereum. This PR only adds BSC configuration and tests.

BSC deployments

  • Ring Swap Factory: 0x4De602A30Ad7fEf8223dcf67A9fB704324C4dd9B
  • Few Factory: 0xEeE400Eabfba8F60f4e6B351D8577394BeB972CD
  • Ring Swap Router: 0x20504f37A95eF80e3FC7476c4801fb39AaE6bAd0
  • Ring Swap Pair Init Code: 0xa7ae6a5ec37f0c21bbdac560794258c4089b8ae3ffa6e3909b53c6091764a676
  • Few Wrapped Token Init Code: 0x2bdba5734ddf754fb149ef1faa937956c52cfd1f24d68163a95f42d08ec06d38

Tests

  • pnpm install --frozen-lockfile
  • pnpm exec prettier --check src/dex/uniswap-v2/ring-v2.ts src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts
  • pnpm run check:tsc
  • pnpm run check:es
  • pnpm run build
  • git diff --check
  • pnpm exec jest src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts --runInBand -t RingV2 --silent --forceExit

Notes

  • WBNB/ETH has liquidity on RingV2 BSC, quotes in both directions, and is covered by the e2e tests.
  • WBNB/USDT also 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, and DAI/WBNB were 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.

RingV2Config gains a [Network.BSC] entry with BSC factory and router addresses (same initCode, fee, and pool gas assumptions as mainnet). FewWrappedTokenConfig gets a matching BSC block so few-wrapped token CREATE2 addresses resolve with the BSC few-wrap factory. Because dexKeysWithNetwork is 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 via swapExactAmountIn / swapExactAmountOut for 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant