-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add ForgeYields yield adaptor #2534
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?
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,51 @@ | ||||||
| const utils = require('../utils'); | ||||||
|
|
||||||
| const API_URL = 'https://api.forgeyields.com/strategies'; | ||||||
|
|
||||||
| const underlyingTokens = { | ||||||
| ethereum: { | ||||||
| ETH: ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'], | ||||||
| USDC: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'], | ||||||
| WBTC: ['0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'], | ||||||
| }, | ||||||
| starknet: { | ||||||
| ETH: ['0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7'], | ||||||
| USDC: ['0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8'], | ||||||
| WBTC: ['0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac'], | ||||||
| }, | ||||||
| }; | ||||||
|
|
||||||
| const apy = async () => { | ||||||
| const strategies = await utils.getData(API_URL); | ||||||
|
|
||||||
| const pools = []; | ||||||
| for (const s of strategies) { | ||||||
| for (const gw of s.token_gateway_per_domain) { | ||||||
| const chain = gw.domain; | ||||||
| const tokens = underlyingTokens[chain]?.[s.underlyingSymbol]; | ||||||
| if (!tokens) continue; | ||||||
|
|
||||||
| pools.push({ | ||||||
| pool: `${gw.token_gateway}-${chain}`.toLowerCase(), | ||||||
| chain: utils.formatChain(chain), | ||||||
| project: 'forgeyields', | ||||||
| symbol: s.underlyingSymbol, | ||||||
| tvlUsd: Number(s.tvlUSD), | ||||||
| apyBase: Number(s.integrationInfo.overallApy), | ||||||
|
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. Missing null check on If Proposed fix using optional chaining- apyBase: Number(s.integrationInfo.overallApy),
+ apyBase: Number(s.integrationInfo?.overallApy),This will produce 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| poolMeta: s.symbol, | ||||||
| url: `https://app.forgeyields.com/opportunities/${s.symbol}`, | ||||||
| token: gw.token_gateway, | ||||||
| underlyingTokens: tokens, | ||||||
| searchTokenOverride: gw.token_gateway, | ||||||
| }); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| return pools.filter((p) => utils.keepFinite(p)); | ||||||
| }; | ||||||
|
|
||||||
| module.exports = { | ||||||
| timetravel: false, | ||||||
| apy, | ||||||
| url: 'https://app.forgeyields.com', | ||||||
| }; | ||||||
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: 1967
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 468
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 2029
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 206
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 50567
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 8091
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 236
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 243
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 1337
🏁 Script executed:
Repository: DefiLlama/yield-server
Length of output: 168
Divide TVL across gateways and add null check for
integrationInfo.The strategy-level
s.tvlUSDis assigned to every pool created per gateway, causing TVL to be counted multiple times. Additionally,s.integrationInfo.overallApyis accessed without a null guard, which will throw a TypeError ifintegrationInfois undefined.Proposed fixes
Consider whether the API provides per-gateway TVL; if so, use
gw.tvlUSDinstead of dividing.🤖 Prompt for AI Agents