Repository navigation
dexalot: add omnivault yields #3140
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
jaimi-io
wants to merge
4
commits into
DefiLlama:master
Choose a base branch
from
jaimi-io:dexalot-omnivault-yields
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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,41 @@ | ||
| const axios = require('axios'); | ||
| const utils = require('../utils'); | ||
|
|
||
| const VAULT_YIELDS_URL = 'https://api.dexalot.com/api/stats/vaultyields'; | ||
|
|
||
| const vaultPools = async () => { | ||
| const { data } = await axios.get(VAULT_YIELDS_URL); | ||
| return data.vaults.map((v) => { | ||
| // token lists are coingecko ids, empty when a vault has no rewards | ||
| const hasRewards = v.reward_tokens.length > 0; | ||
| return { | ||
| pool: `${v.address}-dexalot`.toLowerCase(), | ||
| // the vault's share token on the Dexalot chain | ||
| token: v.address.toLowerCase(), | ||
| chain: utils.formatChain('dexalot'), | ||
| project: 'dexalot-omnivaults', | ||
| symbol: v.pair.replace('/', '-'), | ||
| tvlUsd: v.tvl_usd, | ||
| // fee apy is the vault's share of taker fees (last full UTC day, with a 7d average), trading pnl isn't included. | ||
| // Reward apr is the incentive program on top, Dexalot's headline vault APY is the sum of the two | ||
| apyBase: v.fee_apy_1d, | ||
| apyBase7d: v.fee_apy_7d, | ||
| apyReward: hasRewards ? v.reward_apr || null : null, | ||
| rewardTokens: hasRewards ? v.reward_tokens : null, | ||
| underlyingTokens: v.underlying_tokens, | ||
| volumeUsd1d: v.volume_usd_1d, | ||
| volumeUsd7d: v.volume_usd_7d, | ||
| poolMeta: v.name, | ||
| url: `https://app.dexalot.com/omnivault/${v.id}`, | ||
| }; | ||
| }); | ||
| }; | ||
|
|
||
| const apy = async () => (await vaultPools()).filter((p) => p.tvlUsd > 0); | ||
|
|
||
| module.exports = { | ||
| protocolId: '9337', | ||
| timetravel: false, | ||
| apy, | ||
| url: 'https://app.dexalot.com/vaults', | ||
| }; | ||
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.
Remove
underlyingTokensfor Dexalot vaults.The API returns
underlying_tokensas CoinGecko IDs, such ascoingecko:ethereum. The README definesunderlyingTokensas an array of token addresses. Line 25 passes the IDs through, andtriggerAdaptor.jskeeps them. Stored pools then contain IDs in an address field. Consumers that expect addresses can fail to match these values.The API response contains no token addresses. The PR description also states that these vaults have no
underlyingTokens. Remove the field. When the field is absent,triggerAdaptor.jsstoresnull.Suggested fix
symbol: v.pair.replace('/', '-'), tvlUsd: v.tvl_usd, - underlyingTokens: v.underlying_tokens, volumeUsd1d: v.volume_usd_1d,Committable suggestion