Skip to content

Add GBLIN Yield Adapter (Base Network)#2641

Open
gblinproject wants to merge 3 commits into
DefiLlama:masterfrom
gblinproject:master
Open

Add GBLIN Yield Adapter (Base Network)#2641
gblinproject wants to merge 3 commits into
DefiLlama:masterfrom
gblinproject:master

Conversation

@gblinproject
Copy link
Copy Markdown

@gblinproject gblinproject commented May 1, 2026

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

  • New Features
    • Added GBLIN V5 support on Base with TVL integration and a displayed pool linking to gblin.digital.
    • Automated APY calculation using recent on-chain mint activity (30-day lookback) and a 0.05% stability-fee estimate, annualized and normalized by TVL.
    • Returns empty results when TVL is missing or below threshold and logs adapter errors for graceful failure handling.

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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

Warning

Rate limit exceeded

@gblinproject has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 24 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d5f2d370-78e6-4722-8625-5ac955fb4565

📥 Commits

Reviewing files that changed from the base of the PR and between a891a0d and 49bbdff.

📒 Files selected for processing (1)
  • src/adaptors/gblin/index.js
📝 Walkthrough

Walkthrough

Adds a new GBLIN V5 adaptor that fetches protocol TVL from DefiLlama, queries on-chain Minted logs on Base to compute annualized fees-derived APY, and exports a single pool descriptor with token addresses, chain, project metadata, and URL.

Changes

New GBLIN Adaptor

Layer / File(s) Summary
Constants & Data Shape
src/adaptors/gblin/index.js
Defines GBLIN V5 address, underlying token addresses (WETH, CBTC, USDC), Minted event topic, stability-fee parameters (5 bps), and 30-day lookback in blocks.
TVL Fetching & Validation
src/adaptors/gblin/index.js
Fetches protocol data from https://api.llama.fi/protocol/global-balanced-liquidity-index, selects latest totalLiquidityUSD, returns [] if missing or < $100.
Block Range & Log Querying
src/adaptors/gblin/index.js
Computes latest base block and 30-day lookback block number; queries Minted(address,uint256,uint256) logs for the GBLIN V5 contract via sdk.api.util.getLogs.
Log Parsing & Volume Summation
src/adaptors/gblin/index.js
Parses each log data to extract ethIn (first 32 bytes), sums values into totalVolumeWei using BigInt.
Price Fetch & APY Calculation
src/adaptors/gblin/index.js
Fetches ETH price from Llama (coins.llama.fi), converts ETH volume to USD, computes period fees as volumeUsd * 0.0005, annualizes by (365 / 30), and computes apyBase = (annualizedFeesUsd / tvlUsd) * 100.
Output & Exports
src/adaptors/gblin/index.js
Returns array with one pool object (pool: \${GBLIN_V5}-base`.toLowerCase()), chainformatted asbase, project: 'gblin', symbol: 'GBLIN', tvlUsd, apyBase, fixed underlyingTokens, metadata, and exports timetravel: false, apy: getApy, url: 'https://gblin.digital/'`.
Error Handling
src/adaptors/gblin/index.js
Catches errors, logs GBLIN adapter error: <message>, and returns [].

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble logs beneath the moonlit chain,
I count the ETH that trickles in like rain,
I fetch the price, I annualize with care,
One pool, one APY, a rabbit's tidy lair,
Hooray for hops and bytes — GBLIN's now there!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add GBLIN Yield Adapter (Base Network)' accurately and concisely describes the main change: adding a new yield adapter for the GBLIN protocol on Base Network.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Copy link
Copy Markdown
Contributor

@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 `@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

📥 Commits

Reviewing files that changed from the base of the PR and between 314ae1b and 436bf75.

📒 Files selected for processing (1)
  • src/adaptors/gblin/index.js

Comment thread src/adaptors/gblin/index.js Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Error while running gblin adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.277 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────┬────────┬─────────┬─────────┬────────┬─────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────┬──────────────────────────┐
│ (index) │ pool                                              │ chain  │ project │ symbol  │ tvlUsd │ apyBase │ underlyingTokens                                                                                                                             │ poolMeta                                                             │ url                      │
├─────────┼───────────────────────────────────────────────────┼────────┼─────────┼─────────┼────────┼─────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┼──────────────────────────┤
│ 0       │ '0x38dcdb3a381677239bbc652aed9811f2f8496345-base' │ 'Base' │ 'gblin' │ 'GBLIN' │ 502    │ 0       │ [ '0x4200000000000000000000000000000000000006', '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ 'NAV appreciation from protocol fees (0.05% stability fee per mint)' │ 'https://gblin.digital/' │
└─────────┴───────────────────────────────────────────────────┴────────┴─────────┴─────────┴────────┴─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────┴──────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@gblinproject
Copy link
Copy Markdown
Author

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.

Copy link
Copy Markdown
Contributor

@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: 3

🧹 Nitpick comments (1)
src/adaptors/gblin/index.js (1)

39-42: 💤 Low value

tvlUsd < 100 early-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 report tvlUsd: <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

📥 Commits

Reviewing files that changed from the base of the PR and between 436bf75 and a891a0d.

📒 Files selected for processing (1)
  • src/adaptors/gblin/index.js

Comment thread src/adaptors/gblin/index.js Outdated
Comment thread src/adaptors/gblin/index.js
Comment thread 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.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Error while running gblin adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.248 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────┬────────┬─────────┬─────────┬────────┬─────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────┬──────────────────────────┐
│ (index) │ pool                                              │ chain  │ project │ symbol  │ tvlUsd │ apyBase │ underlyingTokens                                                                                                                             │ poolMeta                                                             │ url                      │
├─────────┼───────────────────────────────────────────────────┼────────┼─────────┼─────────┼────────┼─────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┼──────────────────────────┤
│ 0       │ '0x38dcdb3a381677239bbc652aed9811f2f8496345-base' │ 'Base' │ 'gblin' │ 'GBLIN' │ 502    │ 0       │ [ '0x4200000000000000000000000000000000000006', '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ 'NAV appreciation from protocol fees (0.05% stability fee per mint)' │ 'https://gblin.digital/' │
└─────────┴───────────────────────────────────────────────────┴────────┴─────────┴─────────┴────────┴─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────┴──────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

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.

1 participant