Skip to content

Conversation

@fabiaz84
Copy link
Contributor

@fabiaz84 fabiaz84 commented Jan 23, 2026

Update TVL adapter:

  • Added new and pending minters and genesis pool for TVL tracking.

Summary by CodeRabbit

  • New Features

    • Expanded discovery to include genesis contracts alongside minters, yielding more complete TVL and token-owner coverage and dynamic collateral resolution.
  • Bug Fixes / Reliability

    • Consolidated collateral token queries and improved handling/filtering of failed or invalid responses for more accurate totals.
  • Documentation

    • Updated methodology to reflect dynamic querying across contract types and revised TVL calculation.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

HarborFi adapter now discovers both minter and genesis contracts from factory events, builds a unified contract list to resolve collateral tokens dynamically, performs multicall queries with permissive failures, filters invalid collateral addresses, and sums token balances to compute TVL.

Changes

Cohort / File(s) Summary
HarborFi TVL logic
projects/harborfi/index.js
Added GENESIS_CONTRACTS and expanded KNOWN_MINTERS; discovery now parses factory events for minter and genesis contracts, constructs allContracts, multicall queries WRAPPED_COLLATERAL_TOKEN for all contracts (permitFailure: true), derives tokensAndOwners dynamically, filters invalid collateral addresses, and updated methodology/comments.

Sequence Diagram(s)

sequenceDiagram
    participant Adapter as Adapter
    participant Factory as Factory (events)
    participant Contracts as Minter/Genesis Contracts
    participant Multicall as Multicall
    participant TokenLookup as Collateral Token Lookup

    Adapter->>Factory: fetch factory events (minter + genesis)
    Factory-->>Adapter: return discovered contract addresses
    Adapter->>Contracts: assemble allContracts list
    Adapter->>Multicall: multicall WRAPPED_COLLATERAL_TOKEN + owners (permitFailure: true)
    Multicall-->>Adapter: return tokens and owners (some nulls)
    Adapter->>TokenLookup: resolve valid collateral token addresses
    TokenLookup-->>Adapter: confirmed collateral tokens
    Adapter->>Adapter: filter invalid tokens and sum balances => TVL
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Update HarborFi TVL adapter #17782 — Implements the same HarborFi adapter changes: expanded discovery to minter + genesis, added GENESIS_CONTRACTS/expanded KNOWN_MINTERS, and updated TVL token-owner resolution and multicall logic.

Poem

🐰 I hopped through factory logs at dawn,

Found minters and genesis seeds all drawn,
I gathered tokens, filtered the small,
Tallied balances, one ledger for all,
A tiny hop—TVL now sings at dawn 🌿

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The pull request description is minimal and lacks required details. It does not specify which minters/genesis contracts were added or provide methodology updates matching the significant code changes. Expand the description to include specific contract addresses added, explain the change from minter-only to minter+genesis approach, and document how TVL computation changed.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: updating the HarborFi TVL adapter with new addresses and contracts.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@llamabutler
Copy link

The adapter at projects/harborfi exports TVL:

ethereum                  268.01 k

total                    268.01 k 

Copy link
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

🤖 Fix all issues with AI agents
In `@projects/harborfi/index.js`:
- Around line 62-77: In tvl, guard the multiCall against undeployed/pending
contracts by passing permitFailure: true to the api.multiCall that fetches
WRAPPED_COLLATERAL_TOKEN(), then handle its results by filtering out
failed/empty entries before building tokensAndOwners: map over allContracts and
collateralTokens together, only include pairs where the returned collateral
token is a non-zero/non-undefined address (skip null/zero addresses) so
KNOWN_MINTERS/GENESIS_CONTRACTS entries that reverted won't break the adapter.

- Add permitFailure: true to multiCall for WRAPPED_COLLATERAL_TOKEN queries
- Filter out failed/empty/null/zero address results
- Prevents adapter failures from undeployed or pending contracts
@llamabutler
Copy link

The adapter at projects/harborfi exports TVL:

ethereum                  267.92 k

total                    267.92 k 

@g1nt0ki
Copy link
Member

g1nt0ki commented Jan 24, 2026

thanks for the PR

@g1nt0ki g1nt0ki merged commit 63f3665 into DefiLlama:main Jan 24, 2026
1 of 2 checks passed
@llamabutler
Copy link

The adapter at projects/harborfi exports TVL:

ethereum                  272.57 k

total                    272.57 k 

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submit the change.

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.

4 participants