Skip to content

Commit

Permalink
spectra-v2 fix symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
slasher125 committed Jan 7, 2025
1 parent 2b5f631 commit 7d57224
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/adaptors/spectra-v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ const lpApy = (p) => {
pool: poolId(p.address, p.chainId),
chain: utils.formatChain(chain.name),
project: 'spectra-v2',
symbol: utils.formatSymbol(`LP-${formatIbt(p.pt.ibt)}`),
symbol: utils.formatSymbol(`${p.pt.ibt.symbol}`),
tvlUsd: p.liquidity?.usd,
apyBase: p.lpApy.total - apw,
apyReward: apw,
rewardTokens: apw > 0 ? [chain.APW] : [],
underlyingTokens: [p.pt.address, p.pt.ibt.address],
poolMeta: `For LP | Maturity ${formatMaturity(p.pt.maturity)}`,
poolMeta: `For LP on ${p.pt.ibt.protocol} | Maturity ${formatMaturity(
p.pt.maturity
)}`,
url: `https://app.spectra.finance/pools?ref=defillama#${chain.slug}/${p.address}`,
};
};
Expand All @@ -69,11 +71,13 @@ const fixedRateApy = (p) => {
pool: poolId(p.pt.address, p.chainId),
chain: utils.formatChain(chain.name),
project: 'spectra-v2',
symbol: utils.formatSymbol(`PT-${formatIbt(p.pt.ibt)}`),
symbol: utils.formatSymbol(`${p.pt.ibt.symbol}`),
tvlUsd: p.liquidity?.usd,
apyBase: p.impliedApy,
underlyingTokens: [p.pt.underlying.address],
poolMeta: `For PT | Maturity ${formatMaturity(p.pt.maturity)}`,
poolMeta: `For PT on ${p.pt.ibt.protocol} | Maturity ${formatMaturity(
p.pt.maturity
)}`,
url: `https://app.spectra.finance/fixed-rate?ref=defillama#${chain.slug}/${p.address}`,
};
};
Expand All @@ -99,7 +103,7 @@ async function apy() {

const apys = [...pools.map(lpApy), ...pools.map(fixedRateApy)]
.flat()
.filter(({ tvlUsd }) => Number.isFinite(tvlUsd)) // skip pools with no TVL (e.g. missing price)
.filter((i) => utils.keepFinite(i)) // skip pools with no TVL (e.g. missing price)
.sort((a, b) => b.tvlUsd - a.tvlUsd);

return apys;
Expand Down

0 comments on commit 7d57224

Please sign in to comment.