Skip to content

Commit

Permalink
Merge pull request #2289 from DefiLlama/curve-base
Browse files Browse the repository at this point in the history
add curve base
  • Loading branch information
dtmkeng authored Jan 8, 2025
2 parents 306793f + 76ec7df commit c6fab3f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dexs/curve/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const endpoints: { [chain: string]: string } = {
[CHAIN.XDAI]: "https://api.curve.fi/api/getSubgraphData/xdai",
// [CHAIN.CELO]: "https://api.curve.fi/api/getSubgraphData/celo",
[CHAIN.FRAXTAL]: "https://api.curve.fi/api/getSubgraphData/fraxtal",
[CHAIN.BASE]: "https://api.curve.fi/api/getVolumes/base"
};

interface IAPIResponse {
Expand All @@ -20,13 +21,22 @@ interface IAPIResponse {
totalVolume: number,
cryptoShare: number,
generatedTimeMs: number
totalVolumes: {
totalVolume: number
}
}
}

const fetch = (chain: string) => async (timestamp: number) => {
try {
const response: IAPIResponse = (await fetchURL(endpoints[chain]));
const t = response.data.generatedTimeMs ? response.data.generatedTimeMs / 1000 : timestamp
if (chain === CHAIN.BASE) {
return {
dailyVolume: `${response.data.totalVolumes.totalVolume}`,
timestamp: t,
}
}
return {
dailyVolume: `${response.data.totalVolume}`,
timestamp: t,
Expand Down

0 comments on commit c6fab3f

Please sign in to comment.