diff --git a/dexVolumes/carthage/index.ts b/dexVolumes/carthage/index.ts new file mode 100644 index 0000000000..864e7214d5 --- /dev/null +++ b/dexVolumes/carthage/index.ts @@ -0,0 +1,50 @@ +import { DexBreakdownAdapter } from "../dexVolume.type"; + +const { + getChainVolume, + DEFAULT_DAILY_VOLUME_FACTORY, + DEFAULT_TOTAL_VOLUME_FIELD, +} = require("../helper/getUniSubgraphVolume"); + +const { CANDLE } = require("../helper/chains"); + +const { getStartTimestamp } = require("../helper/getStartTimestamp"); + + +const v3Endpoints = { + [CANDLE]: + "https://thegraph.cndlchain.com/subgraphs/name/ianlapham/uniswap-v3-test", +}; + +const VOLUME_USD = "volumeUSD"; + +const v3Graphs = getChainVolume({ + graphUrls: { + ...v3Endpoints, + }, + totalVolume: { + factory: "factories", + field: DEFAULT_TOTAL_VOLUME_FIELD, + }, + dailyVolume: { + factory: DEFAULT_DAILY_VOLUME_FACTORY, + field: VOLUME_USD, + }, +}); + +const adapter: DexBreakdownAdapter = { + breakdown: { + v3: { + [CANDLE]: { + fetch: v3Graphs(CANDLE), + start: getStartTimestamp({ + endpoints: v3Endpoints, + chain: CANDLE, + volumeField: VOLUME_USD, + }) + } + }, + }, +}; + +export default adapter; diff --git a/dexVolumes/index.ts b/dexVolumes/index.ts index 6a56c6eeab..21c81a70f3 100644 --- a/dexVolumes/index.ts +++ b/dexVolumes/index.ts @@ -1,6 +1,7 @@ import oneInch from "./1inch"; import balancer from "./balancer"; import bancor from "./bancor"; +import carthage from "./carthage"; import champagneswap from "./champagneswap"; import curve from "./curve"; import dodo from "./dodo"; @@ -25,6 +26,7 @@ export default { "1inch": oneInch, balancer, bancor, + carthage, champagneswap, curve, dodo, diff --git a/projects/carthage/index.js b/projects/carthage/index.js new file mode 100644 index 0000000000..0109691d86 --- /dev/null +++ b/projects/carthage/index.js @@ -0,0 +1,38 @@ +const { request, gql } = require("graphql-request"); +const { toUSDTBalances } = require('../helper/balances'); +const graphUrl = 'https://thegraph.cndlchain.com/subgraphs/name/ianlapham/uniswap-v3-test' + +const graphQuery = gql` +query get_tvl($block: Int, $number_gte: Int = 10) { + factory( + id: "0x5Bb7BAE25728e9e51c25466D2A15FaE97834FD95" + block: {number_gte: $number_gte} + ) { + totalValueLockedETHUntracked + totalValueLockedETH + totalValueLockedUSD + totalValueLockedUSDUntracked + } +} +`; + +async function tvl(timestamp, ethBlock, chainBlocks) { + const response = await request( + graphUrl, + graphQuery, + { + block:chainBlocks.cndl, + } + ); + + return toUSDTBalances(Number(response.factory.totalValueLockedUSD)); +} + +module.exports = { + misrepresentedTokens: true, + methodology: 'The Carthage subgraph and the Carthage factory contract address are used to obtain the balance held in every LP pair.', + candle:{ + tvl, + }, + start: 1612715300, // 7th-Feb-2021 +} diff --git a/speedTest.js b/speedTest.js index 568bef6ae8..e1bebf9ed2 100644 --- a/speedTest.js +++ b/speedTest.js @@ -8,7 +8,7 @@ function createProvider(name, url, chainId) { name.toUpperCase() + '_RPC', url ].join('=')); - + return new ethers.providers.JsonRpcProvider(url, { name: name, @@ -45,7 +45,7 @@ function createProvider(name, url, chainId) { const spend = Date.now() - start console.log(name, "spend", spend / 1000, "s", "block", lastBlockNumber); } - + console.log('.env') console.log(allNetworks.join("\n")) -})(); \ No newline at end of file +})(); diff --git a/volume.md b/volume.md index f560296a7f..03e6490bc4 100644 --- a/volume.md +++ b/volume.md @@ -7,6 +7,9 @@ https://api.thegraph.com/subgraphs/name/balancer-labs/balancer #### Bancor https://thegraph.com/explorer/subgraph/blocklytics/bancor +#### Carthage +https://thegraph.cndlchain.com/subgraphs/name/ianlapham/uniswap-v3-test + #### Curve https://www.curve.fi/raw-stats/ren-1440m.json //where ren is the pool name