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
56 changes: 56 additions & 0 deletions src/adaptors/yld/index.js
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',
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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify whether `yld` is present in the public yields protocol config
curl -s 'https://api.llama.fi/config/yields?a=1' \
  | jq -r '.protocols[]?.slug' \
  | rg -n '^yld$' || true

Repository: DefiLlama/yield-server

Length of output: 48


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# First, check if API is returning valid data at all
echo "=== API Response Preview ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq '.protocols | length' 2>/dev/null || echo "API query failed or invalid JSON"

# Try extracting all protocol slugs to see what's there
echo -e "\n=== Sample of Protocol Slugs ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq -r '.protocols[]?.slug' 2>/dev/null | head -20 || echo "Failed to extract slugs"

# Count total protocols
echo -e "\n=== Total Protocols ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq -r '.protocols[]?.slug' 2>/dev/null | wc -l

# Specifically check for yld
echo -e "\n=== Check for 'yld' specifically ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq -r '.protocols[]?.slug' 2>/dev/null | grep -c '^yld$' || echo "yld not found"

Repository: DefiLlama/yield-server

Length of output: 341


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check the actual JSON structure
echo "=== First protocol object ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq '.protocols[0]' 2>/dev/null | head -30

# Also check if there's a root-level field that contains protocol info
echo -e "\n=== Top-level keys ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq 'keys' 2>/dev/null

# Search local repo for yld protocol definition
echo -e "\n=== Local yld references ===" 
find . -type f -name "*.js" -o -name "*.json" | xargs grep -l "yld" | grep -E "(config|protocol|adaptor)" | head -10

Repository: DefiLlama/yield-server

Length of output: 95


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Get raw API response (first 1000 chars to see structure)
echo "=== Raw API Response (first portion) ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | head -c 1000

# Try to understand the actual structure
echo -e "\n\n=== API response first 100 lines ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | head -100

# Search local repo for yld-related files
echo -e "\n\n=== YLD files in repo ===" 
find . -type f \( -name "*yld*" -o -path "*/yld/*" \) | head -20

# Check the yld adaptor file itself
echo -e "\n\n=== Content of src/adaptors/yld/index.js ===" 
if [ -f "src/adaptors/yld/index.js" ]; then
  cat -n "src/adaptors/yld/index.js"
fi

Repository: DefiLlama/yield-server

Length of output: 1108


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check if 'yld' exists as a protocol key
echo "=== Checking for 'yld' in protocols ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq 'has("protocols") and .protocols | has("yld")' 2>/dev/null

# List sample protocol keys to see the pattern
echo -e "\n=== Sample protocol keys ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq '.protocols | keys[:20]' 2>/dev/null

# Count all protocol keys
echo -e "\n=== Total protocol count ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | jq '.protocols | keys | length' 2>/dev/null

# Check the yld adaptor file
echo -e "\n=== src/adaptors/yld/index.js ===" 
if [ -f "src/adaptors/yld/index.js" ]; then
  head -50 "src/adaptors/yld/index.js"
fi

Repository: DefiLlama/yield-server

Length of output: 105


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Search for 'yld' directly in the API response using grep
echo "=== Searching for 'yld' in API response ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | grep -o '"yld"' || echo "yld not found in API response"

# Count occurrences
echo -e "\n=== Count of 'yld' in API ===" 
curl -s 'https://api.llama.fi/config/yields?a=1' | grep -c '"yld"' || echo "0"

# Check the yld adaptor file
echo -e "\n=== src/adaptors/yld/index.js (first 60 lines) ===" 
if [ -f "src/adaptors/yld/index.js" ]; then
  head -60 "src/adaptors/yld/index.js"
else
  echo "File not found"
fi

# Look for protocol config files in repo
echo -e "\n=== Protocol config files ===" 
find . -type f -name "*.json" | grep -i protocol | head -10

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
Verify each finding against the current code and only fix it if needed.

In `@src/adaptors/yld/index.js` at line 29, The PR uses an unregistered protocol
slug by setting project: 'yld' in the adaptor (the 'project' key/value pair),
which will fail validation; either register the 'yld' slug in the public yields
protocol configuration (add the slug and its metadata to the public protocol
config) or update the adaptor to reference an existing registered slug instead
of 'yld' so the value used by the adaptor matches an entry in the public
protocol config.

symbol: utils.formatSymbol(vault.symbol),
tvlUsd: (info.tvl / 1e18) * tokenPrice,
apyBase: info.apyBase,
underlyingTokens: [vault.underlying],
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',
};
Loading