fix merkl poolmeta and symbol#2284
Conversation
📝 WalkthroughWalkthroughThe Merkl adaptor is modified to derive pool symbols from the last token instead of concatenating all tokens, compute pool metadata from action and vault name, and introduce a new URL field to the pool data object based on chain, pool type, and address. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/adaptors/merkl/index.js (1)
68-79: Guard against empty trailing token symbols to avoid unnecessary fallbackWith the “last token” heuristic, a missing trailing symbol (but valid earlier symbols) makes
symbolempty and forces the ABI fallback. That can drop pools if the fallback target isn’t resolvable. Consider selecting the last non-empty symbol instead.🛠️ Suggested fix
- const tokenSymbols = pool.tokens.map((x) => x.symbol); - let symbol = tokenSymbols[tokenSymbols.length - 1] || ''; + const tokenSymbols = pool.tokens.map((x) => x.symbol); + let symbol = ''; + for (let i = tokenSymbols.length - 1; i >= 0 && !symbol; i--) { + symbol = tokenSymbols[i] || ''; + }
🧹 Nitpick comments (1)
src/adaptors/merkl/index.js (1)
95-108: Optional: URL‑encode dynamic segmentsIf
poolTypeorpoolAddressever includes non‑URL‑safe characters, the generated link can break. Encoding the segments makes it robust.🔧 Suggested tweak
- const poolUrl = `https://app.merkl.xyz/opportunities/${chain}/${poolType}/${poolAddress}`; + const poolUrl = `https://app.merkl.xyz/opportunities/${encodeURIComponent(chain)}/${encodeURIComponent(poolType)}/${encodeURIComponent(poolAddress)}`;
output now
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.