Skip to content

Commit

Permalink
fix start tine and catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Sep 22, 2024
1 parent 4acc5b8 commit 35d3a7d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dexs/sushiswap/classic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const classic = Object.keys(endpointsClassic).reduce(
...acc,
[chain]: {
fetch: chain == "boba" ? graphsClassicBoba(chain as Chain) : graphsClassic(chain as Chain),
start: chain == "boba" ? getStartTimestamp({ ...startTimeQueryClassic, dailyDataField: "factoryDaySnapshots", chain }) : getStartTimestamp({ ...startTimeQueryClassic, chain }),
start: 1711982400,
meta: {
methodology: {
Fees: "SushiSwap charges a flat 0.3% fee",
Expand Down
4 changes: 2 additions & 2 deletions dexs/sushiswap/trident.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const startTimeQueryTrident = {

const tridentQuery = gql`
query trident($number: Int) {
factory(
factory(
id: "ALL"
block: { number: $number }
) {
Expand Down Expand Up @@ -60,7 +60,7 @@ const trident = Object.keys(endpointsTrident).reduce(
dailyUserFees: afterRes.factory.feesUSD - beforeRes.factory.feesUSD
}
},
start: getStartTimestamp({ ...startTimeQueryTrident, chain }),
start: 1711982400,
},
}),
{}
Expand Down
24 changes: 23 additions & 1 deletion dexs/sushiswap/v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as sdk from "@defillama/sdk";
import { Chain } from "@defillama/sdk/build/general";
import { CHAIN } from "../../helpers/chains";
import { getGraphDimensions2 } from "../../helpers/getUniSubgraph";
import { FetchOptions } from "../../adapters/types";

const endpointsV3 = {
[CHAIN.ARBITRUM_NOVA]: "https://api.goldsky.com/api/public/project_clslspm3c0knv01wvgfb2fqyq/subgraphs/sushi-v3/v3-arbitrum-nova/gn",
Expand Down Expand Up @@ -83,7 +84,28 @@ const v3 = Object.keys(endpointsV3).reduce(
(acc, chain) => ({
...acc,
[chain]: {
fetch: v3Graphs(chain as Chain),
fetch: async (options: FetchOptions) => {
try {
const res = (await v3Graphs(chain as Chain)(options))
return {
totalVolume: res?.totalVolume || 0,
dailyVolume: res?.dailyVolume || 0,
totalFees: res?.totalFees || 0,
totalUserFees: res?.totalUserFees || 0,
dailyFees: res?.dailyFees,
dailyUserFees: res?.dailyUserFees || 0
}
} catch {
return {
totalVolume: 0,
dailyVolume: 0,
totalFees: 0,
totalUserFees: 0,
dailyFees: 0,
dailyUserFees: 0
}
}
},
start: startTimeV3[chain],
meta: {
methodology: {
Expand Down

0 comments on commit 35d3a7d

Please sign in to comment.