Skip to content

Commit 844b0c6

Browse files
authored
Gmx v1 Exclude hack volume on arbitrum chain (DefiLlama#3651)
* fix bug * gmx v1 exclude hack volume
1 parent e6f65dd commit 844b0c6

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

dexs/gmx/index.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const endpoints: { [key: string]: string } = {
88
[CHAIN.AVAX]: "https://subgraph.satsuma-prod.com/3b2ced13c8d9/gmx/gmx-avalanche-stats/api",
99
}
1010

11+
const HACK_TIMESTAMP = 1752019200;
12+
1113
const historicalDataSwap = gql`
1214
query get_volume($period: String!, $id: String!) {
1315
volumeStats(where: {period: $period, id: $id}) {
@@ -78,21 +80,20 @@ const getFetch = (query: string)=> (chain: string): Fetch => async (timestamp: n
7880
dailyLongOpenInterest = Number(tradingStats.tradingStats[0].longOpenInterest);
7981
dailyShortOpenInterest = Number(tradingStats.tradingStats[0].shortOpenInterest);
8082
}
83+
if (dayTimestamp == HACK_TIMESTAMP && chain == CHAIN.ARBITRUM){
84+
return {
85+
dailyLongOpenInterest: dailyLongOpenInterest ? String(dailyLongOpenInterest * 10 ** -30) : undefined,
86+
dailyShortOpenInterest: dailyShortOpenInterest ? String(dailyShortOpenInterest * 10 ** -30) : undefined,
87+
dailyOpenInterest: dailyOpenInterest ? String(dailyOpenInterest * 10 ** -30) : undefined,
88+
dailyVolume: '0',
89+
}
90+
}
8191

8292
return {
83-
timestamp: dayTimestamp,
8493
dailyLongOpenInterest: dailyLongOpenInterest ? String(dailyLongOpenInterest * 10 ** -30) : undefined,
8594
dailyShortOpenInterest: dailyShortOpenInterest ? String(dailyShortOpenInterest * 10 ** -30) : undefined,
8695
dailyOpenInterest: dailyOpenInterest ? String(dailyOpenInterest * 10 ** -30) : undefined,
87-
dailyVolume:
88-
dailyData.volumeStats.length == 1
89-
? String(Number(Object.values(dailyData.volumeStats[0]).reduce((sum, element) => String(Number(sum) + Number(element)))) * 10 ** -30)
90-
: undefined,
91-
totalVolume:
92-
totalData.volumeStats.length == 1
93-
? String(Number(Object.values(totalData.volumeStats[0]).reduce((sum, element) => String(Number(sum) + Number(element)))) * 10 ** -30)
94-
: undefined,
95-
96+
dailyVolume: dailyData.volumeStats.length == 1 ? String(Number(Object.values(dailyData.volumeStats[0]).reduce((sum, element) => String(Number(sum) + Number(element)))) * 10 ** -30) : undefined
9697
}
9798
}
9899

@@ -101,6 +102,7 @@ const startTimestamps: { [chain: string]: number } = {
101102
[CHAIN.ARBITRUM]: 1630368000,
102103
[CHAIN.AVAX]: 1640131200,
103104
}
105+
104106
const adapter: BreakdownAdapter = {
105107
breakdown: {
106108
"swap": Object.keys(endpoints).reduce((acc, chain) => {

0 commit comments

Comments
 (0)