Skip to content

feat: add accumulated-finance adaptor#2319

Open
erozanov wants to merge 4 commits intoDefiLlama:masterfrom
AccumulatedFinance:feat/accumulated-finance
Open

feat: add accumulated-finance adaptor#2319
erozanov wants to merge 4 commits intoDefiLlama:masterfrom
AccumulatedFinance:feat/accumulated-finance

Conversation

@erozanov
Copy link

@erozanov erozanov commented Jan 29, 2026

Feature:
Add accumulated-finance adaptor

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for Accumulated Finance lending pools, enabling access to key metrics including TVL, APY base and borrow rates, total supply and borrow amounts, LTV ratios, and underlying token data across multiple blockchain networks.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Introduces 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

Cohort / File(s) Summary
Accumulated Finance Lending Adaptor
src/adaptors/accumulated-finance-lending/index.js
New adaptor module that fetches lending pools, filters by status (excludes soon/hidden/sunset), maps to standardized format with TVL, APY, borrow metrics, and USD conversions via chainMap.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A lending pool adaptor hops into place,
From Accumulated Finance's lending space,
TVL and APY metrics calculated right,
Chain conversions glowing bright,
New pools mapped for all to sight! 📊

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add accumulated-finance adaptor' accurately and concisely describes the main change—adding a new adaptor for accumulated-finance to the repository.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

@llamatester
Copy link

Error while running accumulated-finance adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 39 passed, 40 total
Snapshots: 0 total
Time: 0.268 s
Ran all test suites.

Nb of pools: 4
 

Sample pools:
┌─────────┬──────────────────────────────────────────────┬──────────┬───────────────────────┬────────┬────────────────────┬─────────┬───────────────┬────────────────┬────────────────────┬──────┬───────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────┐
│ (index) │ pool                                         │ chain    │ project               │ symbol │ tvlUsd             │ apyBase │ apyBaseBorrow │ totalSupplyUsd │ totalBorrowUsd     │ ltv  │ url                                                                                   │ underlyingTokens                                 │
├─────────┼──────────────────────────────────────────────┼──────────┼───────────────────────┼────────┼────────────────────┼─────────┼───────────────┼────────────────┼────────────────────┼──────┼───────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤
│ 0       │ '0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc' │ 'Bitkub' │ 'accumulated-finance' │ 'KUB'  │ 15622.499269061524 │ 0.34    │ 0.72          │ 119014         │ 103391.50073093848 │ 0.98 │ 'https://accumulated.finance/lend/96/0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc'      │ [ '0x7ac168c81f4f3820fa3f22603ce5864d6ab3c547' ] │
│ 1       │ '0x540095363a3642bc6dde623825261851b71d1b71' │ 'Zeta'   │ 'accumulated-finance' │ 'ZETA' │ 7416.302423311154  │ 1.45    │ 2.97          │ 68860          │ 61443.69757668885  │ 0.98 │ 'https://accumulated.finance/lend/7000/0x540095363a3642bc6dde623825261851b71d1b71'    │ [ '0x7ac168c81f4f3820fa3f22603ce5864d6ab3c547' ] │
│ 2       │ '0x0acbfff708c9d30684f620b2be23930284af12c5' │ 'Velas'  │ 'accumulated-finance' │ 'VLX'  │ 748.2387050124306  │ 2.82    │ 5.99          │ 8018           │ 7269.761294987569  │ 0.98 │ 'https://accumulated.finance/lend/106/0x0acbfff708c9d30684f620b2be23930284af12c5'     │ [ '0x8f0ecda9679ad16e30be3d83d183c482821f5325' ] │
│ 3       │ '0xc1641194a8a7ea9c19db00cd568f428f3e331740' │ 'Coti'   │ 'accumulated-finance' │ 'COTI' │ 708.642438742918   │ 1.23    │ 3.36          │ 32052          │ 31343.357561257082 │ 0.98 │ 'https://accumulated.finance/lend/2632500/0xc1641194a8a7ea9c19db00cd568f428f3e331740' │ [ '0x4781f0c82dc3ab55d79bd3956689d1b65fbd23ad' ] │
└─────────┴──────────────────────────────────────────────┴──────────┴───────────────────────┴────────┴────────────────────┴─────────┴───────────────┴────────────────┴────────────────────┴──────┴───────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama
}

Copy link

@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: 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.
Accessing pool.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');
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
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.

@llamatester
Copy link

Error while running accumulated-finance adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 30 passed, 31 total
Snapshots: 0 total
Time: 0.264 s
Ran all test suites.

Nb of pools: 3
 

Sample pools:
┌─────────┬──────────────────────────────────────────────┬─────────────┬───────────────────────┬────────┬────────────────────┬─────────┬───────────────┬────────────────┬────────────────────┬──────┬───────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────┐
│ (index) │ pool                                         │ chain       │ project               │ symbol │ tvlUsd             │ apyBase │ apyBaseBorrow │ totalSupplyUsd │ totalBorrowUsd     │ ltv  │ url                                                                                   │ underlyingTokens                                 │
├─────────┼──────────────────────────────────────────────┼─────────────┼───────────────────────┼────────┼────────────────────┼─────────┼───────────────┼────────────────┼────────────────────┼──────┼───────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤
│ 0       │ '0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc' │ 'Bitkub'    │ 'accumulated-finance' │ 'KUB'  │ 131418.49926906152 │ 0.34    │ 0.72          │ 119014         │ 103391.50073093848 │ 0.98 │ 'https://accumulated.finance/lend/96/0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc'      │ [ '0x7ac168c81f4f3820fa3f22603ce5864d6ab3c547' ] │
│ 1       │ '0x540095363a3642bc6dde623825261851b71d1b71' │ 'ZetaChain' │ 'accumulated-finance' │ 'ZETA' │ 70680.89266805997  │ 1.45    │ 2.97          │ 68884          │ 61465.10733194003  │ 0.98 │ 'https://accumulated.finance/lend/7000/0x540095363a3642bc6dde623825261851b71d1b71'    │ [ '0x7ac168c81f4f3820fa3f22603ce5864d6ab3c547' ] │
│ 2       │ '0xc1641194a8a7ea9c19db00cd568f428f3e331740' │ 'Coti'      │ 'accumulated-finance' │ 'COTI' │ 55631.81987755838  │ 1.23    │ 3.36          │ 32286          │ 31572.180122441616 │ 0.98 │ 'https://accumulated.finance/lend/2632500/0xc1641194a8a7ea9c19db00cd568f428f3e331740' │ [ '0x4781f0c82dc3ab55d79bd3956689d1b65fbd23ad' ] │
└─────────┴──────────────────────────────────────────────┴─────────────┴───────────────────────┴────────┴────────────────────┴─────────┴───────────────┴────────────────┴────────────────────┴──────┴───────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────┘
}

@llamatester
Copy link

The accumulated-finance-lending adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 31 passed, 31 total
Snapshots: 0 total
Time: 0.231 s
Ran all test suites.

Nb of pools: 3
 

Sample pools:
┌─────────┬──────────────────────────────────────────────┬─────────────┬───────────────────────────────┬────────┬────────────────────┬─────────┬───────────────┬────────────────┬────────────────────┬──────┬───────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────┐
│ (index) │ pool                                         │ chain       │ project                       │ symbol │ tvlUsd             │ apyBase │ apyBaseBorrow │ totalSupplyUsd │ totalBorrowUsd     │ ltv  │ url                                                                                   │ underlyingTokens                                 │
├─────────┼──────────────────────────────────────────────┼─────────────┼───────────────────────────────┼────────┼────────────────────┼─────────┼───────────────┼────────────────┼────────────────────┼──────┼───────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────┤
│ 0       │ '0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc' │ 'Bitkub'    │ 'accumulated-finance-lending' │ 'KUB'  │ 132522.78077552424 │ 0.34    │ 0.72          │ 120014         │ 104260.21922447578 │ 0.98 │ 'https://accumulated.finance/lend/96/0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc'      │ [ '0x7ac168c81f4f3820fa3f22603ce5864d6ab3c547' ] │
│ 1       │ '0x540095363a3642bc6dde623825261851b71d1b71' │ 'ZetaChain' │ 'accumulated-finance-lending' │ 'ZETA' │ 70746.79998739014  │ 1.45    │ 2.97          │ 68948          │ 61522.200012609865 │ 0.98 │ 'https://accumulated.finance/lend/7000/0x540095363a3642bc6dde623825261851b71d1b71'    │ [ '0x7ac168c81f4f3820fa3f22603ce5864d6ab3c547' ] │
│ 2       │ '0xc1641194a8a7ea9c19db00cd568f428f3e331740' │ 'Coti'      │ 'accumulated-finance-lending' │ 'COTI' │ 55654.107587972714 │ 1.23    │ 3.36          │ 32299          │ 31584.892412027282 │ 0.98 │ 'https://accumulated.finance/lend/2632500/0xc1641194a8a7ea9c19db00cd568f428f3e331740' │ [ '0x4781f0c82dc3ab55d79bd3956689d1b65fbd23ad' ] │
└─────────┴──────────────────────────────────────────────┴─────────────┴───────────────────────────────┴────────┴────────────────────┴─────────┴───────────────┴────────────────┴────────────────────┴──────┴───────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────┘

Copy link

@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: 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).

Comment on lines +3 to +7
const chainMap = {
96: 'Bitkub',
7000: 'ZetaChain',
2632500: 'Coti',
};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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).

@slasher125
Copy link
Collaborator

for lending protocols, we define tvlUsd as available liquidity, so: supply - borrow

@erozanov
Copy link
Author

erozanov commented Jan 30, 2026

@

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?

@slasher125
Copy link
Collaborator

slasher125 commented Jan 30, 2026

It sounds like your implementation differs from the main DefiLlama lending

we apply the same on defillama tvl lending side (borrows are counted but need to be toggled on to be included in tvl)

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?

no need to filter on the adapter side

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