Add GBLIN Yield Adapter (Base Network)#2641
Conversation
GBLIN is a wealth preservation protocol on Base. APY is generated via an "Appreciation Model" where 0.05% of every buy transaction is routed to the treasury (WETH, cbBTC, USDC) without minting new tokens, mathematically increasing the NAV for all holders.
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ 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)
📝 WalkthroughWalkthroughAdds a new GBLIN V5 adaptor that fetches protocol TVL from DefiLlama, queries on-chain ChangesNew GBLIN Adaptor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
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 `@src/adaptors/gblin/index.js`:
- Around line 8-19: Validate protocolData.tvl before indexing to avoid runtime
errors: guard with optional chaining/length check on protocolData.tvl (the
result of utils.getData('https://api.llama.fi/protocol/gblin')) and return early
or skip the pool if empty/null; when present compute tvlUsd from the last
element safely (current tvl variable). Replace the hardcoded apyBase: 0.05 by
deriving an annualized APY from available protocol metrics (fee inflows or yield
fields in protocolData) or omit/export no apyBase until a proper calculation is
implemented; apply the same try/catch/error-log pattern used in other adaptors
and reference symbols GBLIN_V5, protocolData, tvl, apyBase, and utils.getData to
locate where to add these checks and computation.
🪄 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: 58b389eb-8566-4b2c-b489-f3ca360b3281
📒 Files selected for processing (1)
src/adaptors/gblin/index.js
|
Error while running gblin adapter: Test Suites: 1 failed, 1 total |
|
Note: the test fails only on the $10k minimum TVL gate. Will request re-review once TVL crosses the $10k threshold. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/adaptors/gblin/index.js (1)
39-42: 💤 Low value
tvlUsd < 100early-return drops a legitimately tiny pool silently.For a brand-new protocol on Base, dipping below $100 of TVL is plausible during early hours/incidents. Returning
[]here will cause the pool to disappear entirely from the yields feed (rather than reporttvlUsd: <small>, apyBase: <number>), which can be confusing. Consider either lowering the threshold (e.g. > 0) or making the threshold reflect a real "noise floor" you've validated, and add a brief comment on the rationale. Non-blocking.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/adaptors/gblin/index.js` around lines 39 - 42, The early-return that checks tvlUsd in the GBLIN adaptor (the conditional using tvlUsd and returning [] when tvlUsd < 100) should be removed or relaxed so tiny-but-valid pools are not dropped; update the conditional in the block where tvlUsd is computed to either require tvlUsd > 0 (or another validated noise-floor) instead of < 100, or remove the return entirely and allow the pool through with its small tvlUsd and computed apyBase, add a brief inline comment explaining the chosen threshold/rationale, and replace the silent return with a console.warn that notes the small TVL but still returns the pool entry so it remains visible in the yields feed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/adaptors/gblin/index.js`:
- Around line 71-90: The APY calculation uses a single current ETH price
(priceResp from utils.getData) to convert totalVolumeWei to USD, which biases
apyBase; modify the logic in the block referencing totalVolumeWei, ethUsd,
totalVolumeEth, totalVolumeUsd and apyBase so that you either: (a) fetch
historical ETH prices per mint timestamp using the DefiLlama historical endpoint
(coins.llama.fi/prices/historical/<ts>/coingecko:ethereum) and sum each mint's
USD value before computing periodFeesUsd and annualizedFeesUsd, or (b) compute
fees in ETH first (periodFeesEth = totalVolumeWei * STABILITY_FEE_BPS /
BPS_DENOMINATOR / 1e18), annualize that ETH fee, then convert the single
annualized ETH fee to USD using a single price lookup (or convert tvlUsd to ETH)
before calculating apyBase; update the call site using utils.getData and ensure
variables totalVolumeUsd/periodFeesUsd/annualizedFeesUsd or their ETH
equivalents are adjusted accordingly.
- Around line 60-67: The loop that parses logs (iterating over logs?.output and
accumulating totalVolumeWei) assumes log.data is a string and calls
log.data.startsWith and .length; add a guard to skip entries where log.data is
missing or not a string (e.g., if (!log.data || typeof log.data !== 'string')
continue) before using startsWith/substring logic so a single malformed log
won't throw and cause the adapter to fall back to [].
- Around line 21-22: The getLogs query currently computes a huge block range
using LOOKBACK_DAYS and BLOCKS_PER_DAY_BASE (constants) which can exceed
RPC/indexer limits and also silently returns [] on failures; change getLogs to
(1) compute fromBlock via a timestamp-to-block lookup or explorer helper instead
of multiplying BLOCKS_PER_DAY_BASE by LOOKBACK_DAYS, (2) implement
paginated/chunked eth_getLogs calls (e.g., 7k–10k block windows) and aggregate
events, and (3) replace the broad try/catch that returns [] with explicit error
handling/logging that distinguishes empty results from transient RPC errors and
surfaces a retryable error signal to the caller; update any uses of
LOOKBACK_DAYS/BLOCKS_PER_DAY_BASE to either reduce default lookback or make
cadence configurable.
---
Nitpick comments:
In `@src/adaptors/gblin/index.js`:
- Around line 39-42: The early-return that checks tvlUsd in the GBLIN adaptor
(the conditional using tvlUsd and returning [] when tvlUsd < 100) should be
removed or relaxed so tiny-but-valid pools are not dropped; update the
conditional in the block where tvlUsd is computed to either require tvlUsd > 0
(or another validated noise-floor) instead of < 100, or remove the return
entirely and allow the pool through with its small tvlUsd and computed apyBase,
add a brief inline comment explaining the chosen threshold/rationale, and
replace the silent return with a console.warn that notes the small TVL but still
returns the pool entry so it remains visible in the yields feed.
🪄 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: 2e3df8b6-6488-43d3-95c4-076e76ba6ba4
📒 Files selected for processing (1)
src/adaptors/gblin/index.js
Note: the test fails only on the $10k minimum TVL gate. Adapter logic works correctly (output validated above: TVL $502, apyBase 0, correct underlying tokens, no errors). Will request re-review once TVL crosses the $10k threshold. Keeping PR open as a checkpoint — happy to refactor in the meantime if maintainers prefer.
|
Error while running gblin adapter: Test Suites: 1 failed, 1 total |
Project Description:
GBLIN is a wealth preservation protocol on Base. APY is generated via an "Appreciation Model" where 0.05% of every buy transaction is routed to the treasury (WETH, cbBTC, USDC) without minting new tokens, mathematically increasing the NAV for all holders.
Methodology:
APY is calculated based on the internal appreciation fee routed to the treasury assets.
Summary by CodeRabbit