Skip to content

Commit 62314a2

Browse files
authored
feat: add the vault liquid staking adapter (#2396)
* feat: add the vault liquid staking adapter * add total supply guard
1 parent e16e1f4 commit 62314a2

File tree

1 file changed

+47
-0
lines changed
  • src/adaptors/the-vault-liquid-staking

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const axios = require('axios');
2+
const { getTotalSupply } = require('../utils');
3+
4+
const VSOL_MINT = 'vSoLxydx6akxyMD9XEcPvGYNGq6Nn66oqVb3UkGkei7';
5+
const priceKey = `solana:${VSOL_MINT}`;
6+
const SOL = 'So11111111111111111111111111111111111111112';
7+
8+
const apy = async () => {
9+
const [totalSupply, priceRes, apyRes] = await Promise.all([
10+
getTotalSupply(VSOL_MINT),
11+
axios.get(`https://coins.llama.fi/prices/current/${priceKey}`),
12+
axios.get(
13+
`https://extra-api.sanctum.so/v1/apy/latest?lst=${VSOL_MINT}`
14+
),
15+
]);
16+
17+
if (!Number.isFinite(totalSupply))
18+
throw new Error(`Unable to fetch total supply for ${VSOL_MINT}`);
19+
20+
const currentPrice = priceRes.data.coins[priceKey]?.price;
21+
if (!currentPrice) throw new Error('Unable to fetch vSOL price');
22+
23+
const apyRaw = apyRes?.data?.apys?.[VSOL_MINT];
24+
if (!Number.isFinite(apyRaw))
25+
throw new Error(`Unable to fetch APY for ${VSOL_MINT}`);
26+
const apyBase = apyRaw * 100;
27+
28+
return [
29+
{
30+
pool: VSOL_MINT,
31+
chain: 'Solana',
32+
project: 'the-vault-liquid-staking',
33+
symbol: 'vSOL',
34+
tvlUsd: totalSupply * currentPrice,
35+
apyBase,
36+
underlyingTokens: [SOL],
37+
token: VSOL_MINT,
38+
poolMeta: '5% rewards fee',
39+
},
40+
];
41+
};
42+
43+
module.exports = {
44+
timetravel: false,
45+
apy,
46+
url: 'https://thevault.finance/stake',
47+
};

0 commit comments

Comments
 (0)