mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-04-29 13:25:30 +08:00
27 lines
662 B
JavaScript
27 lines
662 B
JavaScript
const { request, gql } = require('graphql-request');
|
|
const { toUSDTBalances } = require('./helper/balances');
|
|
|
|
const graphUrl = 'https://api.thegraph.com/subgraphs/name/omegasyndicate/defiplaza';
|
|
const graphQuery = gql`
|
|
query get_tvl($timestamp: Int) {
|
|
hourlies(first: 1, orderBy: date, orderDirection: desc, where:{date_lte: $timestamp}) {
|
|
totalValueLockedUSD
|
|
}
|
|
}
|
|
`;
|
|
|
|
async function tvl(timestamp, block) {
|
|
const { hourlies } = await request(graphUrl, graphQuery, {
|
|
timestamp,
|
|
});
|
|
const usdTvl = Number(hourlies[0].totalValueLockedUSD);
|
|
|
|
return toUSDTBalances(usdTvl);
|
|
}
|
|
|
|
module.exports = {
|
|
ethereum: {
|
|
tvl,
|
|
},
|
|
};
|