feat(metrom-adapter): add support for megaeth and pool meta information#2512
feat(metrom-adapter): add support for megaeth and pool meta information#2512luzzif wants to merge 6 commits into
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded MegaETH chain mapping, required ChangesMetrom Adaptor Enhancement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
|
The metrom adapter exports pools: Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/adaptors/metrom/index.ts (1)
218-237: Consider extracting duplicated single-collateral branch mapping.
aave-v3-supply,aave-v3-borrow, andaave-v3-net-supplydiffer only by action string. A shared helper would reduce drift risk.Refactor sketch
+function fromSingleCollateralTarget( + collateral: Token, + action: string, + protocol: string +): ProcessedCampaign { + return { + symbol: formatSymbol(collateral.symbol), + underlyingTokens: [collateral.address], + poolMeta: humanizeTargetProtocol(action, protocol), + }; +} ... - case 'aave-v3-supply': { - return { - symbol: formatSymbol(campaign.target.collateral.symbol), - underlyingTokens: [campaign.target.collateral.address], - poolMeta: humanizeTargetProtocol('Lend on', campaign.target.brand), - }; - } + case 'aave-v3-supply': + return fromSingleCollateralTarget( + campaign.target.collateral, + 'Lend on', + campaign.target.brand + );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/adaptors/metrom/index.ts` around lines 218 - 237, The three case branches ('aave-v3-supply', 'aave-v3-borrow', 'aave-v3-net-supply') duplicate the same mapping except for the action string; extract a helper (e.g., buildSingleCollateralMapping or mapAaveV3SingleCollateral) that accepts the action label ("Lend on"/"Borrow on"/"Net lend on") and returns { symbol: formatSymbol(campaign.target.collateral.symbol), underlyingTokens: [campaign.target.collateral.address], poolMeta: humanizeTargetProtocol(actionLabel, campaign.target.brand) }, then replace each case to call that helper with the appropriate label to eliminate duplication while keeping formatSymbol and humanizeTargetProtocol usage intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/adaptors/metrom/index.ts`:
- Around line 245-249: humanizeTargetProtocol can throw when protocolSlug is
undefined; update it to safely handle missing/empty values by defaulting
protocolSlug to an empty string (or a sentinel like "Unknown") before splitting
and by guarding word access in the mapper. Concretely, change
humanizeTargetProtocol to use (protocolSlug ?? '') or String(protocolSlug) and
.split('-').filter(Boolean) and map each word with safe access (e.g.,
word.charAt(0)?.toUpperCase() + word.slice(1)) so the function returns a
sensible string (like just the action or "action Unknown") instead of throwing.
---
Nitpick comments:
In `@src/adaptors/metrom/index.ts`:
- Around line 218-237: The three case branches ('aave-v3-supply',
'aave-v3-borrow', 'aave-v3-net-supply') duplicate the same mapping except for
the action string; extract a helper (e.g., buildSingleCollateralMapping or
mapAaveV3SingleCollateral) that accepts the action label ("Lend on"/"Borrow
on"/"Net lend on") and returns { symbol:
formatSymbol(campaign.target.collateral.symbol), underlyingTokens:
[campaign.target.collateral.address], poolMeta:
humanizeTargetProtocol(actionLabel, campaign.target.brand) }, then replace each
case to call that helper with the appropriate label to eliminate duplication
while keeping formatSymbol and humanizeTargetProtocol usage intact.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: b6ef77a3-503e-4265-9b39-586f932404fa
📒 Files selected for processing (1)
src/adaptors/metrom/index.ts
| symbol: formatSymbol(campaign.target.collateral.symbol), | ||
| underlyingTokens: [campaign.target.collateral.address], | ||
| poolMeta: humanizeTargetProtocol( | ||
| 'Deposit to stability pool on', |
There was a problem hiding this comment.
please reduce the text too long and wont easily be seen
There was a problem hiding this comment.
Sheesh, seeing the comments just now sorry. Addressed in 789b242. I also added a couple other minor commits, would be awesome if you could check those out, thanks.
|
The metrom adapter exports pools: Test Suites: 1 passed, 1 total |
|
The metrom adapter exports pools: Test Suites: 1 passed, 1 total |
|
The metrom adapter exports pools: Test Suites: 1 passed, 1 total |
|
The metrom adapter exports pools: Test Suites: 1 passed, 1 total |
|
The metrom adapter exports pools: Test Suites: 1 passed, 1 total |
Summary by CodeRabbit