-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add yld yields adapter #2282
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
Open
michaeldim
wants to merge
14
commits into
DefiLlama:master
Choose a base branch
from
yldfi:add-yldfi
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add yld yields adapter #2282
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c68bcd4
Add yldfi yields adapter
4416a57
Rename yldfi to yld, dynamic vault discovery
michaeldim e6b33d1
fix: show all vaults (wrapper + strategy) on yields page
michaeldim b372474
fix: use weeklyNet APY to match yldfi.co display
michaeldim f9c6016
fix: remove unused utils import, clarify vault filter comment
michaeldim e2990d9
fix: use vault symbol (yscvxCRV) instead of asset symbol (cvxCRV)
michaeldim 20a552f
fix: address CodeRabbit review comments
michaeldim c6cfbe6
fix: use actual prefixes (ys, y) not full vault names
michaeldim 73a963d
fix: use 30-day net APY instead of 7-day weekly
michaeldim b5a40aa
fix: use utils.formatSymbol and formatChain, add poolMeta
michaeldim 608d46b
refactor: use getERC4626Info for on-chain APY calculation
michaeldim 2612b48
fix: use vault symbols (ycvxCRV, yscvxCRV) instead of underlying
michaeldim 31ecd1f
fix: use utils.getPrices for correct USD TVL calculation
michaeldim 7ab4e58
trigger CI: yld slug now registered on DefiLlama
michaeldim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| const utils = require('../utils'); | ||
|
|
||
| const VAULTS = { | ||
| ycvxcrv: { | ||
| address: '0x95f19B19aff698169a1A0BBC28a2e47B14CB9a86', | ||
| symbol: 'ycvxCRV', | ||
| underlying: '0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7', | ||
| }, | ||
| yscvxcrv: { | ||
| address: '0xCa960E6DF1150100586c51382f619efCCcF72706', | ||
| symbol: 'yscvxCRV', | ||
| underlying: '0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7', | ||
| }, | ||
| yscvgcvx: { | ||
| address: '0x8ED5AB1BA2b2E434361858cBD3CA9f374e8b0359', | ||
| symbol: 'yscvgCVX', | ||
| underlying: '0x2191DF768ad71140F9F3E96c1e4407A4aA31d082', | ||
| }, | ||
| }; | ||
|
|
||
| const getApy = async () => { | ||
| // Fetch underlying token prices | ||
| const underlyingAddresses = [...new Set(Object.values(VAULTS).map((v) => v.underlying))]; | ||
| const priceData = await utils.getPrices(underlyingAddresses, 'ethereum'); | ||
| const prices = priceData.pricesByAddress; | ||
|
|
||
| const pools = await Promise.all( | ||
| Object.entries(VAULTS).map(async ([key, vault]) => { | ||
| try { | ||
| const info = await utils.getERC4626Info(vault.address, 'ethereum'); | ||
| const tokenPrice = prices[vault.underlying.toLowerCase()] || 0; | ||
| return { | ||
| pool: `${vault.address}-ethereum`.toLowerCase(), | ||
| chain: utils.formatChain('ethereum'), | ||
| project: 'yld', | ||
| symbol: utils.formatSymbol(vault.symbol), | ||
| tvlUsd: (info.tvl / 1e18) * tokenPrice, | ||
| apyBase: info.apyBase, | ||
| underlyingTokens: [vault.underlying], | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| url: `https://yldfi.co/vaults/${key}`, | ||
| }; | ||
| } catch (e) { | ||
| console.error(`yld: failed to fetch ${key}:`, e.message); | ||
| return null; | ||
| } | ||
| }) | ||
| ); | ||
|
|
||
| return pools.filter(Boolean); | ||
| }; | ||
|
|
||
| module.exports = { | ||
| timetravel: false, | ||
| apy: getApy, | ||
| url: 'https://yldfi.co', | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 48
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 341
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 95
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 1108
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 105
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 2229
Protocol slug 'yld' is not registered in the public protocol config.
Line 29 uses
project: 'yld', but verification confirms the slug is absent from the public yields protocol configuration. This will cause validation failures and CI blockers. The protocol slug must be registered in the protocol config before this PR can be merged.🤖 Prompt for AI Agents