Skip to content

Commit ca2c08e

Browse files
Add MegaVault and dYdX TVL Reporting to Gauntlet Adapter (#15526)
Co-authored-by: waynebruce0x <waynebruce0x@gmail.com>
1 parent 205d3b3 commit ca2c08e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

projects/gauntlet/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { getCuratorExport } = require("../helper/curators");
2+
const axios = require('axios');
23

34
const configs = {
45
methodology: 'Counts all assets that are deposited in all vaults curated by Gauntlet.',
@@ -227,9 +228,34 @@ async function tvl(api) {
227228
}
228229
}
229230

231+
async function megavaultTvl(api) {
232+
const url = "https://indexer.dydx.trade/v4/vault/v1/megavault/historicalPnl?resolution=hour";
233+
const { data } = await axios.get(url, { headers: { 'Accept': 'application/json' } });
234+
const pnlArr = data.megavaultPnl;
235+
if (!pnlArr || !pnlArr.length) return;
236+
const currentTvl = Number(pnlArr[pnlArr.length - 1].equity);
237+
238+
// Report as USD Coin using coingecko identifier
239+
api.add('coingecko:usd-coin', (currentTvl * 1e6).toFixed(0));
240+
}
241+
242+
async function combinedEthereumTvl(api) {
243+
// First, get the existing curator TVL
244+
const curatorExport = getCuratorExport(configs);
245+
if (curatorExport.ethereum && curatorExport.ethereum.tvl) {
246+
await curatorExport.ethereum.tvl(api);
247+
}
248+
249+
// Then add MegaVault TVL
250+
console.log("Adding MegaVault TVL to ethereum...");
251+
await megavaultTvl(api);
252+
console.log("MegaVault TVL added to ethereum");
253+
}
254+
230255
module.exports = {
231256
...getCuratorExport(configs),
232257
solana: { tvl },
258+
ethereum: { tvl: combinedEthereumTvl },
233259
timetravel: false,
234260
methodology: configs.methodology,
235261
}

0 commit comments

Comments
 (0)