Skip to content

Commit b38bfbc

Browse files
committed
Update sushiswap dex subgraph endpoints
1 parent d8dac9c commit b38bfbc

File tree

3 files changed

+28
-38
lines changed

3 files changed

+28
-38
lines changed

dexVolumes/helper/chains.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const POLYGON = "polygon";
1313
const RONIN = "ronin";
1414
const XDAI = "xdai";
1515
const AURORA = "aurora";
16+
const MOONRIVER = "moonriver"
1617

1718
export {
1819
ARBITRUM,
@@ -30,4 +31,5 @@ export {
3031
RONIN,
3132
XDAI,
3233
AURORA,
34+
MOONRIVER
3335
};

dexVolumes/helper/getUniSubgraphVolume.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,34 +62,34 @@ function getChainVolume({
6262
const totalVolumeQuery = gql`
6363
${totalVolume.factory}(
6464
block: { number: $block }
65-
) {
66-
${totalVolume.field}
67-
}
68-
`;
69-
70-
const dailyVolumeQuery =
65+
) {
66+
${totalVolume.field}
67+
}
68+
`;
69+
70+
const dailyVolumeQuery =
7171
customDailyVolume ||
7272
gql`
73-
${dailyVolume.factory} (
74-
id: $id
75-
) {
76-
${dailyVolume.field}
77-
}
78-
`;
79-
const graphQueryTotalVolume = gql`
73+
${dailyVolume.factory} (
74+
id: $id
75+
) {
76+
${dailyVolume.field}
77+
}
78+
`;
79+
const graphQueryTotalVolume = gql`
8080
${hasTotalVolume ? `query get_total_volume($block: Int) { ${totalVolumeQuery} }` : ""}`
8181
const graphQueryDailyVolume = gql`
8282
${hasDailyVolume ? `query get_daily_volume($id: Int) { ${dailyVolumeQuery} }` : ""}`;
83-
83+
8484
return (chain: Chain) => {
8585
return async (timestamp: number, chainBlocks: ChainBlocks) => {
8686
const block =
8787
getCustomBlock ?
8888
await getCustomBlock(timestamp) :
8989
await getBlock(timestamp, chain, chainBlocks);
9090
const id = getUniswapDateId(new Date(timestamp * 1000));
91-
const graphResTotal = await request(graphUrls[chain], graphQueryTotalVolume, { block }).catch(e => console.log(e));
92-
const graphResDaily = await request(graphUrls[chain], graphQueryDailyVolume, { id }).catch(e => console.log(e));
91+
const graphResTotal = await request(graphUrls[chain], graphQueryTotalVolume, { block }).catch(e => console.error(`Failed to get total volume${e.message}`));
92+
const graphResDaily = await request(graphUrls[chain], graphQueryDailyVolume, { id }).catch(e => console.error(`Failed to get daily volume${e.message}`));
9393
return {
9494
timestamp,
9595
block,

dexVolumes/sushiswap/index.ts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,31 @@ import {
1111
HECO,
1212
POLYGON,
1313
XDAI,
14+
MOONRIVER
1415
} from "../helper/chains";
1516
import { DexVolumeAdapter } from "../dexVolume.type";
1617
import { Chain } from "@defillama/sdk/build/general";
1718

1819
const endpoints = {
19-
[ARBITRUM]:
20-
"https://api.thegraph.com/subgraphs/name/sushiswap/arbitrum-exchange",
21-
[AVAX]:
22-
"https://api.thegraph.com/subgraphs/name/sushiswap/avalanche-exchange",
23-
[BSC]: "https://api.thegraph.com/subgraphs/name/sushiswap/bsc-exchange",
24-
// [CELO]: "https://api.thegraph.com/subgraphs/name/sushiswap/celo-exchange",
2520
[ETHEREUM]: "https://api.thegraph.com/subgraphs/name/sushiswap/exchange",
21+
[BSC]: "https://api.thegraph.com/subgraphs/name/sushiswap/bsc-exchange",
22+
[POLYGON]: "https://api.thegraph.com/subgraphs/name/sushiswap/matic-exchange",
2623
[FANTOM]: "https://api.thegraph.com/subgraphs/name/sushiswap/fantom-exchange",
27-
[HARMONY]:
28-
"https://sushi.graph.t.hmny.io/subgraphs/name/sushiswap/harmony-exchange",
24+
[ARBITRUM]: "https://api.thegraph.com/subgraphs/name/sushiswap/arbitrum-exchange",
25+
[CELO]: "https://api.thegraph.com/subgraphs/name/sushiswap/celo-exchange",
26+
[AVAX]: "https://api.thegraph.com/subgraphs/name/sushiswap/avalanche-exchange",
27+
[HARMONY]: "https://sushi.graph.t.hmny.io/subgraphs/name/sushiswap/harmony-exchange",
28+
[MOONRIVER]: "https://api.thegraph.com/subgraphs/name/sushiswap/moonriver-exchange",
29+
[XDAI]: "https://api.thegraph.com/subgraphs/name/sushiswap/xdai-exchange",
2930
// [HECO]: "https://q.hg.network/subgraphs/name/heco-exchange/heco",
3031
//'okexchain': 'https://q.hg.network/subgraphs/name/okex-exchange/oec',
3132
//'okexchain': 'https://q.hg.network/subgraphs/name/sushiswap/okex-exchange',
32-
[POLYGON]: "https://api.thegraph.com/subgraphs/name/sushiswap/matic-exchange",
33-
[XDAI]: "https://api.thegraph.com/subgraphs/name/sushiswap/xdai-exchange",
3433
};
3534

3635
const VOLUME_FIELD = "volumeUSD";
3736

3837
const graphs = getChainVolume({
39-
graphUrls: {
40-
[ARBITRUM]: endpoints[ARBITRUM],
41-
[AVAX]: endpoints[AVAX],
42-
[BSC]: endpoints[BSC],
43-
// [CELO]: endpoints[CELO],
44-
[ETHEREUM]: endpoints[ETHEREUM],
45-
[FANTOM]: endpoints[FANTOM],
46-
[HARMONY]: endpoints[HARMONY],
47-
// [HECO]: endpoints[HECO],
48-
[POLYGON]: endpoints[POLYGON],
49-
[XDAI]: endpoints[XDAI],
50-
},
38+
graphUrls: endpoints,
5139
totalVolume: {
5240
factory: "factories",
5341
field: VOLUME_FIELD,

0 commit comments

Comments
 (0)