Skip to content

add cbBTC to Base routing bases#44

Open
Siddharth2207 wants to merge 2 commits intorain-forkfrom
2026-04-01-add-cbbtc-base-routing
Open

add cbBTC to Base routing bases#44
Siddharth2207 wants to merge 2 commits intorain-forkfrom
2026-04-01-add-cbbtc-base-routing

Conversation

@Siddharth2207
Copy link
Copy Markdown

@Siddharth2207 Siddharth2207 commented Apr 1, 2026

Summary

  • Adds cbBTC (0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf, 8 decimals) to BASES_TO_CHECK_TRADES_AGAINST for Base chain

Why

getCurrencyCombinations() uses this list to generate the token pairs checked when discovering pools. Without cbBTC in the list, the pair wtMSTR/cbBTC was never generated, so the Hydrex Algebra pool (0x37077d100b369ab48c9e6b7b21c15eee4fdf9923) was never queried — even though the Hydrex provider is fully registered.

This caused inputToEthPrice: no-way for wtMSTR orders in the Rain solver, blocking all trade modes from executing.

With cbBTC added, the router can now find the wtMSTR/cbBTC Hydrex pool and route wtMSTR → cbBTC → WETH to derive the ETH price.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for Coinbase Wrapped BTC (cbBTC) as a base token on the Base chain, expanding tokens available for trade routing and liquidity paths.
  • Style

    • Minor code formatting cleanup to improve consistency and maintainability.

Enables routing through cbBTC on Base, allowing tokens like wtMSTR
that only have a Hydrex (Algebra) pool paired with cbBTC to be priced
in ETH terms via wtMSTR → cbBTC → WETH.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 1, 2026

Walkthrough

Added a cbBTC (Coinbase Wrapped BTC) token entry to the Base chain list used for trade-basis checks; also a minor punctuation-only change in RainDataFetcher.ts.

Changes

Cohort / File(s) Summary
Base Token Configuration
packages/sushi/src/config/bases-to-check-trades-against.ts
Inserted cbBTC (0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf) into BASES_TO_CHECK_TRADES_AGAINST[ChainId.BASE] with decimals: 8, symbol: 'cbBTC', and name: 'Coinbase Wrapped BTC'.
Rain data fetcher minor edit
packages/sushi/src/router/rain/RainDataFetcher.ts
Punctuation-only change in early-return (return false;return false) with no behavioral change.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding cbBTC token to Base chain routing bases configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-04-01-add-cbbtc-base-routing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Siddharth2207 added a commit to rainlanguage/rain.solver that referenced this pull request Apr 1, 2026
Picks up rainlanguage/sushiswap#44 so wtMSTR (and other tokens only
paired with cbBTC on Hydrex) can be priced in ETH terms by the solver.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/sushi/src/config/bases-to-check-trades-against.ts (1)

437-450: 🧹 Nitpick | 🔵 Trivial

Consider centralizing cbETH and cbBTC token definitions.

Both cbETH and cbBTC are defined inline here but not in the canonical token registry (token-addresses.ts / tokens.ts). This creates a risk of address/decimals divergence if these tokens are referenced elsewhere in the codebase. Per the relevant code snippets, other standard tokens like WBTC and USDC use the centralized addressMapToTokenMap pattern.

This is a pre-existing pattern and not blocking for this PR, but consider adding cbBTC_ADDRESS and cbETH_ADDRESS to token-addresses.ts in a follow-up to maintain consistency with other tokens.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/sushi/src/config/bases-to-check-trades-against.ts` around lines 437
- 450, The cbETH and cbBTC Token instances defined inline in
bases-to-check-trades-against.ts (symbols: cbETH, cbBTC, Token) should be
centralized: add cbETH and cbBTC address constants (e.g., cbETH_ADDRESS,
cbBTC_ADDRESS) to the token-addresses.ts registry and expose corresponding Token
entries in tokens.ts (following the existing addressMapToTokenMap pattern used
for WBTC/USDC), then replace the inline new Token(...) usages in
bases-to-check-trades-against.ts with references to the centralized tokens to
ensure consistent addresses/decimals across the codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/sushi/src/config/bases-to-check-trades-against.ts`:
- Around line 437-450: The cbETH and cbBTC Token instances defined inline in
bases-to-check-trades-against.ts (symbols: cbETH, cbBTC, Token) should be
centralized: add cbETH and cbBTC address constants (e.g., cbETH_ADDRESS,
cbBTC_ADDRESS) to the token-addresses.ts registry and expose corresponding Token
entries in tokens.ts (following the existing addressMapToTokenMap pattern used
for WBTC/USDC), then replace the inline new Token(...) usages in
bases-to-check-trades-against.ts with references to the centralized tokens to
ensure consistent addresses/decimals across the codebase.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d23fe2e1-3bb3-413d-a826-a376fb1f454e

📥 Commits

Reviewing files that changed from the base of the PR and between 925a210 and 1b2b675.

📒 Files selected for processing (1)
  • packages/sushi/src/config/bases-to-check-trades-against.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/sushi/src/router/rain/RainDataFetcher.ts`:
- Line 337: Restore the semicolon at the end of the lone return statement
(change the bare "return false" back to "return false;") in RainDataFetcher.ts
to match the file's semicolon style, and separately ensure the cbBTC token is
actually added to the BASES_TO_CHECK_TRADES_AGAINST constant (where that list is
defined) since the PR claims that change but it isn't present in this file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8aaf001c-7e8f-4c43-8a72-26737bf501d4

📥 Commits

Reviewing files that changed from the base of the PR and between 1b2b675 and 4187f7f.

📒 Files selected for processing (1)
  • packages/sushi/src/router/rain/RainDataFetcher.ts

// `requested block height: ${untilBlock}`,
// ].join(', ')
return false;
return false
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistency between PR objectives and code changes; style inconsistency.

The PR summary indicates that cbBTC is being added to the BASES_TO_CHECK_TRADES_AGAINST list for Base chain routing, but this file contains only a semicolon removal on line 337. The actual cbBTC token addition must be in a different file not included in this review.

Additionally, removing the semicolon here is inconsistent with the rest of the file, which uses semicolons throughout (e.g., lines 326, 327, 339, and numerous other return statements).

🔧 Restore semicolon for consistency
-      return false
+      return false;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return false
return false;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/sushi/src/router/rain/RainDataFetcher.ts` at line 337, Restore the
semicolon at the end of the lone return statement (change the bare "return
false" back to "return false;") in RainDataFetcher.ts to match the file's
semicolon style, and separately ensure the cbBTC token is actually added to the
BASES_TO_CHECK_TRADES_AGAINST constant (where that list is defined) since the PR
claims that change but it isn't present in this file.

@Siddharth2207 Siddharth2207 requested a review from hardyjosh April 2, 2026 16:45
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.

2 participants