add start to pancakeswap

This commit is contained in:
shinitakunai
2022-01-07 17:40:38 -08:00
parent e4c7a80eed
commit 7f7b197295
2 changed files with 27 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
const { getCurrentBlocks } = require("@defillama/sdk/build/computeTVL/blocks");
const { volume } = require("../pancakeswap");
const test = async () => {
const { timestamp, chainBlocks } = await getCurrentBlocks();
console.log(chainBlocks, "chainBlocks");
volume.bsc.fetch(timestamp).then((res) => {
console.log(res);
});
};
test();

View File

@@ -3,27 +3,37 @@ const {
DEFAULT_TOTAL_VOLUME_FIELD,
DEFAULT_DAILY_VOLUME_FIELD,
} = require("../helper/getUniSubgraphVolume");
const { BSC } = require("../helper/chains");
const { getStartTimestamp } = require("../helper/getStartTimestamp");
const endpoints = {
bsc: "https://bsc.streamingfast.io/subgraphs/name/pancakeswap/exchange-v2",
[BSC]: "https://bsc.streamingfast.io/subgraphs/name/pancakeswap/exchange-v2",
};
const DAILY_VOLUME_FACTORY = "pancakeDayData";
const graphs = getChainVolume({
graphUrls: {
bsc: endpoints.bsc,
[BSC]: endpoints[BSC],
},
totalVolume: {
factory: "pancakeFactories",
field: DEFAULT_TOTAL_VOLUME_FIELD,
},
dailyVolume: {
factory: "pancakeDayData",
factory: DAILY_VOLUME_FACTORY,
field: DEFAULT_DAILY_VOLUME_FIELD,
},
});
module.exports = {
volume: {
bsc: graphs("bsc"),
[BSC]: {
fetch: graphs(BSC),
start: getStartTimestamp({
endpoints,
chain: BSC,
dailyDataField: `${DAILY_VOLUME_FACTORY}s`,
}),
},
},
};