-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Create index.js #2778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Create index.js #2778
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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, | ||
| apyBase: 35.5, | ||
| apyReward: 85.0, | ||
|
Comment on lines
+18
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
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 |
||
| 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' }; | ||
There was a problem hiding this comment.
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.outputis0or the call fails/returns unexpected data,tvlUsdsilently defaults to a fake50000instead of surfacing an error or reporting the true (possibly zero) TVL. This misrepresents the protocol's actual TVL to consumers.Suggested fix
If the call can legitimately fail, throw/log instead of substituting a fabricated value.
📝 Committable suggestion
🤖 Prompt for AI Agents