add CryptoSwap intergration

This commit is contained in:
CryptoLover705
2022-05-08 16:56:19 +01:00
parent c0dbadbd36
commit 42dd44d393
2 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
const {
getChainVolume,
DEFAULT_TOTAL_VOLUME_FIELD,
DEFAULT_DAILY_VOLUME_FIELD,
} = require("../helper/getUniSubgraphVolume");
const { BSC } = require("../helper/chains");
const { getStartTimestamp } = require("../helper/getStartTimestamp");
import { DexVolumeAdapter } from "../dexVolume.type";
const endpoints = {
[BSC]: "https://api.thegraph.com/subgraphs/name/cr3k/cdsexchange",
};
const DAILY_VOLUME_FACTORY = "CSTDayData";
const graphs = getChainVolume({
graphUrls: {
[BSC]: endpoints[BSC],
},
totalVolume: {
factory: "CSTFactory",
field: DEFAULT_TOTAL_VOLUME_FIELD,
},
dailyVolume: {
factory: DAILY_VOLUME_FACTORY,
field: DEFAULT_DAILY_VOLUME_FIELD,
},
});
const adapter: DexVolumeAdapter = {
volume: {
[BSC]: {
fetch: graphs(BSC),
start: getStartTimestamp({
endpoints,
chain: BSC,
dailyDataField: `${DAILY_VOLUME_FACTORY}s`,
}),
},
},
};
export default adapter;

View File

@@ -0,0 +1,19 @@
const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl");
module.exports = {
misrepresentedTokens: true,
methodology: 'The CryptoSwap subgraph and the CryptoSwap factory contract address are used to obtain the balance held in every LP pair.',
bsc: {
tvl: calculateUsdUniTvl(
"0x4136A450861f5CFE7E860Ce93e678Ad12158695C",
'bsc',
"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
[
"0xe9e7cea3dedca5984780bafc599bd69add087d56",
"0xcC4b3EA1F25c8772D390dA1DB507832aBE4a9740"
],
'wbnb'
)
},
start: 1651494114, // Mon May 02 2022 12:21:54
};