feat: add accumulated-finance adaptor#2319
feat: add accumulated-finance adaptor#2319erozanov wants to merge 4 commits intoDefiLlama:masterfrom
Conversation
📝 WalkthroughWalkthroughIntroduces a new adaptor for Accumulated Finance lending pools that fetches and transforms pool data from the protocol, filters inactive pools, computes USD-denominated TVL and APY metrics with chain resolution, and exports through a standardized interface. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
|
Error while running accumulated-finance adapter: Test Suites: 1 failed, 1 total |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/adaptors/accumulated-finance/index.js`:
- Line 1: The import of utils in accumulated-finance/index.js hardcodes an
external sibling repo path and causes MODULE_NOT_FOUND; replace the
require('../../../../yield-server/src/adaptors/utils') with the adapter-local
relative import that points to the sibling utils module (e.g.,
require('../utils') from src/adaptors/accumulated-finance/index.js) so the local
utils module is loaded correctly and update any related requires if present.
- Around line 3-8: Update the chainMap object so the entry for chainId 7000 uses
the canonical name: change the value for key 7000 from 'Zeta' to 'ZetaChain' in
the chainMap constant (located where chainMap is defined) to ensure returned
pool chain names match symbiosis/config.js and downstream expectations.
🧹 Nitpick comments (1)
src/adaptors/accumulated-finance/index.js (1)
19-35: Add defensive guards for missing token details.
Accessingpool.assetTokenDetails.*without checks can throw and fail the entire adapter if a single pool is malformed.🛡️ Suggested hardening
- const price = pool.assetTokenDetails.price; - const decimals = pool.assetTokenDetails.decimals; + const details = pool.assetTokenDetails; + if (!details || !Number.isFinite(details.price) || details.decimals == null) return null; + const price = details.price; + const decimals = Number(details.decimals); - const available = pool.availableAssets / (10 ** decimals); + const available = Number(pool.availableAssets) / (10 ** decimals); ... - symbol: pool.assetTokenDetails.symbol, + symbol: details.symbol,
| @@ -0,0 +1,53 @@ | |||
| const utils = require('../../../../yield-server/src/adaptors/utils'); | |||
There was a problem hiding this comment.
Fix utils import path to avoid MODULE_NOT_FOUND.
The current path hardcodes a sibling yield-server directory and is unlikely to resolve when running inside this repo. Use the adapter-local relative import instead.
🔧 Proposed fix
-const utils = require('../../../../yield-server/src/adaptors/utils');
+const utils = require('../utils');📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const utils = require('../../../../yield-server/src/adaptors/utils'); | |
| const utils = require('../utils'); |
🤖 Prompt for AI Agents
In `@src/adaptors/accumulated-finance/index.js` at line 1, The import of utils in
accumulated-finance/index.js hardcodes an external sibling repo path and causes
MODULE_NOT_FOUND; replace the
require('../../../../yield-server/src/adaptors/utils') with the adapter-local
relative import that points to the sibling utils module (e.g.,
require('../utils') from src/adaptors/accumulated-finance/index.js) so the local
utils module is loaded correctly and update any related requires if present.
|
Error while running accumulated-finance adapter: Test Suites: 1 failed, 1 total |
|
The accumulated-finance-lending adapter exports pools: Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/adaptors/accumulated-finance-lending/index.js`:
- Around line 14-25: The code accesses pool.assetTokenDetails.price and
.decimals inside the .map((pool) => { ... }) block without null-safety; add a
guard that checks pool.assetTokenDetails (e.g., if (!pool.assetTokenDetails)
return null or use optional chaining) before computing price, decimals,
available, availableUsd and tvlUsd so a missing assetTokenDetails won't throw;
ensure you handle the fallback consistently (skip the pool by returning null or
default price/decimals like 0/18) and keep the rest of the mapping logic that
uses chainMap and pool.collateralTVL unchanged.
- Around line 3-7: The chainMap constant in
src/adaptors/accumulated-finance-lending/index.js is missing the Velas entry
(chainId 106), causing pools from Velas to map to null and be filtered out;
update the chainMap object (symbol: chainMap) to include the key 106 with value
'Velas' so Velas pools are recognized and not dropped by the subsequent
filtering logic that uses chainMap (see usage around the pool mapping/filtering
code).
| const chainMap = { | ||
| 96: 'Bitkub', | ||
| 7000: 'ZetaChain', | ||
| 2632500: 'Coti', | ||
| }; |
There was a problem hiding this comment.
Missing chainId 106 for Velas.
The test output shows pools on Velas chain (chainId 106), but the chainMap doesn't include this chain. Pools from Velas will return null at line 16 and be filtered out, resulting in missing data.
🔧 Proposed fix
const chainMap = {
+ 106: 'Velas',
};🤖 Prompt for AI Agents
In `@src/adaptors/accumulated-finance-lending/index.js` around lines 3 - 7, The
chainMap constant in src/adaptors/accumulated-finance-lending/index.js is
missing the Velas entry (chainId 106), causing pools from Velas to map to null
and be filtered out; update the chainMap object (symbol: chainMap) to include
the key 106 with value 'Velas' so Velas pools are recognized and not dropped by
the subsequent filtering logic that uses chainMap (see usage around the pool
mapping/filtering code).
|
for lending protocols, we define tvlUsd as available liquidity, so: supply - borrow |
|
@
@slasher125, Understood. It sounds like your implementation differs from the main DefiLlama lending Regarding the $10k liquidity threshold: Should we exclude these smaller pools from the list entirely? If we keep them in, will the adapter automatically reflect them once their liquidity surpasses the limit, or is a manual update required? |
we apply the same on defillama tvl lending side (borrows are counted but need to be toggled on to be included in tvl)
no need to filter on the adapter side |
Feature:
Add accumulated-finance adaptor
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.