Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/adaptors/accumulated-finance-lending/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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.


const chainMap = {
96: 'Bitkub',
7000: 'ZetaChain',
2632500: 'Coti',
};
Comment on lines +3 to +7
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).


const main = async () => {
const data = await utils.getData('https://api.accumulated.finance/v1/lending');

return data.result
.filter((p) => !p.soon && !p.hidden && !p.sunset)
.map((pool) => {
const chain = chainMap[pool.chainId];
if (!chain) return null;

const price = pool.assetTokenDetails.price;
const decimals = pool.assetTokenDetails.decimals;

// availableAssets is in wei/raw units
const available = pool.availableAssets / (10 ** decimals);
const availableUsd = available * price;
const totalCollateralUsd = pool.collateralTVL;
const tvlUsd = availableUsd + totalCollateralUsd;

return {
pool: pool.address,
chain,
project: 'accumulated-finance-lending',
symbol: pool.assetTokenDetails.symbol,
tvlUsd: tvlUsd,
apyBase: pool.lendingRate / 100,
apyBaseBorrow: pool.borrowingRate / 100,
totalSupplyUsd: pool.assetTVL,
totalBorrowUsd: pool.assetTVL - availableUsd,
ltv: pool.ltv / 10000,
url: `https://accumulated.finance/lend/${pool.chainId}/${pool.address}`,
underlyingTokens: [pool.collateralToken],
};
})
.filter((p) => p && utils.keepFinite(p));
};

module.exports = {
timetravel: false,
apy: main,
url: 'https://accumulated.finance/lend',
};
Loading