add cbBTC to Base routing bases#44
Conversation
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>
WalkthroughAdded a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
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>
There was a problem hiding this comment.
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 | 🔵 TrivialConsider centralizing cbETH and cbBTC token definitions.
Both
cbETHandcbBTCare 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 likeWBTCandUSDCuse the centralizedaddressMapToTokenMappattern.This is a pre-existing pattern and not blocking for this PR, but consider adding
cbBTC_ADDRESSandcbETH_ADDRESStotoken-addresses.tsin 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
📒 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>
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
packages/sushi/src/router/rain/RainDataFetcher.ts
| // `requested block height: ${untilBlock}`, | ||
| // ].join(', ') | ||
| return false; | ||
| return false |
There was a problem hiding this comment.
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.
| 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.
Summary
0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf, 8 decimals) toBASES_TO_CHECK_TRADES_AGAINSTfor Base chainWhy
getCurrencyCombinations()uses this list to generate the token pairs checked when discovering pools. Without cbBTC in the list, the pairwtMSTR/cbBTCwas never generated, so the Hydrex Algebra pool (0x37077d100b369ab48c9e6b7b21c15eee4fdf9923) was never queried — even though the Hydrex provider is fully registered.This caused
inputToEthPrice: no-wayfor wtMSTR orders in the Rain solver, blocking all trade modes from executing.With cbBTC added, the router can now find the
wtMSTR/cbBTCHydrex pool and routewtMSTR → cbBTC → WETHto derive the ETH price.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Style