mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
25 lines
638 B
JavaScript
25 lines
638 B
JavaScript
const retry = require('./helper/retry')
|
|
const axios = require("axios");
|
|
const { GraphQLClient, gql } = require('graphql-request')
|
|
|
|
async function fetch() {
|
|
|
|
var endpoint = 'https://api.thegraph.com/subgraphs/name/1inch-exchange/oneinch-liquidity-protocol-v2'
|
|
var graphQLClient = new GraphQLClient(endpoint)
|
|
|
|
var query = gql`
|
|
{
|
|
mooniswapFactories(first: 1) {
|
|
totalLiquidityUSD
|
|
totalLiquidityETH
|
|
}
|
|
}
|
|
`;
|
|
|
|
const results = await retry(async bail => await graphQLClient.request(query))
|
|
return parseFloat(results.mooniswapFactories[0].totalLiquidityUSD)
|
|
}
|
|
|
|
module.exports = {
|
|
fetch
|
|
} |