-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Update HarborFi TVL adapter #17782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update HarborFi TVL adapter #17782
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughHarborFi 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 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 |
|
The adapter at projects/harborfi exports TVL: |
There was a problem hiding this 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
|
The adapter at projects/harborfi exports TVL: |
|
thanks for the PR |
|
The adapter at projects/harborfi exports TVL: |
franciscoarturorivera371-cyber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submit the change.
Update TVL adapter:
Summary by CodeRabbit
New Features
Bug Fixes / Reliability
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.