fix(term-structure): track StableERC4626ForCustomize vaults and fix Gnosis Safe TVL#18713
fix(term-structure): track StableERC4626ForCustomize vaults and fix Gnosis Safe TVL#18713tkspring-henry wants to merge 2 commits intoDefiLlama:mainfrom
Conversation
…6 factory - Track new TermMax4626Factory 0x3Cc88...on Ethereum (fromBlock 24790495) - Add StableERC4626ForCustomizeCreated event to capture customize vaults (e.g. XAUt) - Fix TVL for vaults where thirdPool is a Gnosis Safe (not ERC20) by adding [underlying, thirdPool] fallback with permitFailure Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded event parsing for Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant API as API
participant EthNode as Ethereum Node
participant Factory as TermMax4626Factory (events)
participant Vault as StableERC4626 Vaults
participant TVL as sumTokens2
rect rgba(0,128,0,0.5)
API->>EthNode: fetch TermMax4626Factory logs (StableERC4626ForCustomizeCreated)
EthNode-->>API: logs with stableERC4626ForCustomize addresses
end
rect rgba(0,0,255,0.5)
API->>Vault: read underlying & thirdPool for each stable vault
Vault-->>API: returns stableUnderlyings[], thirdPools[]
end
rect rgba(255,165,0,0.5)
API->>EthNode: batch call thirdPool.totalSupply (permitFailure: true)
EthNode-->>API: thirdPoolSupplies[] (some null if non-ERC20)
end
rect rgba(128,0,128,0.5)
API->>TVL: call sumTokens2 with stableTokensAndOwners (primary)
API->>TVL: call sumTokens2 with stableFallbackTokensAndOwners (fallback for null supplies)
TVL-->>API: aggregated TVL
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 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🧪 Generate unit tests (beta)
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 `@projects/term-structure/index.js`:
- Around line 629-640: The current code always adds both [thirdPool, vault] and
the fallback [underlying, thirdPool], which double-counts when thirdPool is a
normal ERC20; instead, split the primary and fallback paths: build and sum the
primary tokensAndOwners array (push [stableUnderlyings[i], vault] and
[thirdPools[i], vault]) and call sumTokens2({ api, tokensAndOwners }) for that;
then probe each thirdPool for ERC20 compliance (e.g., try an ERC20 call such as
'erc20:decimals' or another small ERC20 ABI call using api.call/api.multiCall)
and only for those thirdPools where the ERC20 probe fails push
[stableUnderlyings[i], thirdPools[i]] into a separate fallback array and call
sumTokens2({ api, tokensAndOwners: fallbackArray, permitFailure: true }). Ensure
you reference stableERC4626For4626Vaults, stableUnderlyings, thirdPools,
stableTokensAndOwners, and sumTokens2 when making these changes.
🪄 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: 06cb0a53-2568-41be-9951-fdf097e93323
📒 Files selected for processing (1)
projects/term-structure/index.js
…oid double counting Use totalSupply probe to distinguish ERC20 thirdPools from Gnosis Safes, so normal stable vaults don't run under permitFailure and fallback path only applies to non-ERC20 thirdPools. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
0x3Cc88...) on Ethereum (fromBlock 24790495)StableERC4626ForCustomizeCreatedevent to capture customize vaults (e.g. XAUt vault)thirdPoolis a Gnosis Safe instead of an ERC20 token, by adding[underlying, thirdPool]fallback withpermitFailureTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements