Skip to content

Commit

Permalink
Merge branch 'master' into frax-amo1
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebruce0x authored Apr 3, 2024
2 parents f11d376 + 9303fab commit 6595a92
Show file tree
Hide file tree
Showing 80 changed files with 2,028 additions and 295 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/getFileList.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const ALLOWED_ROOTS = ['volumes', 'dexs', 'options', 'derivatives', 'incentives', 'fees', 'options', 'protocols']
const ALLOWED_ROOTS = ['volumes', 'dexs', 'options', 'derivatives', 'incentives', 'fees', 'options', 'protocols', 'aggregators']
const MODIFIED = parse(process.env.MODIFIED)
const ADDED = parse(process.env.ADDED)
const fileSet = new Set();
Expand All @@ -13,4 +13,4 @@ console.log(JSON.stringify([...fileSet]))

function parse(data) {
return data.replace('[', '').replace(']', '').split(',')
}
}
Empty file added aggregator-derivatives/.gitkeep
Empty file.
130 changes: 130 additions & 0 deletions aggregators/aperture-swap/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { httpGet } from "../../utils/fetchURL";
import { ChainBlocks, FetchOptions, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";

const chainToId: Record<string, number> = {
[CHAIN.ETHEREUM]: 1,
[CHAIN.ARBITRUM]: 42161,
[CHAIN.AVAX]: 43114,
[CHAIN.BSC]: 56,
[CHAIN.FANTOM]: 250,
[CHAIN.OPTIMISM]: 10,
[CHAIN.POLYGON]: 137,
[CHAIN.LINEA]: 59144,
[CHAIN.SCROLL]: 534352,
[CHAIN.ERA]: 324,
[CHAIN.CRONOS]: 25,
[CHAIN.MANTA]: 169,
};


const url = "https://api.aperture.finance/getMetricsBreakDownSinceInception"

interface VolumeInfo {
chainId: number;
tve: number;
txCount: number;
}

interface VolumeResponse {
dailyVolume: VolumeInfo[];
totalVolume: VolumeInfo[];
}

const fetch = async (timestamp: number, _: ChainBlocks, options: FetchOptions) => {
const chainId = chainToId[options.chain]
if (!chainId) {
return {
dailyVolume: 0,
totalVolume: 0,
timestamp: timestamp,
}
}
const fetchUrl = `${url}?chainid=${chainId}&timestamp=${timestamp}`
const data: VolumeResponse = (await httpGet(fetchUrl, { timeout: 100000 }));

if (data) {
let dailyVolume :number = 0
let totalVolume :number = 0
if (data.dailyVolume) {
data.dailyVolume.forEach(r => {
if (r.chainId == chainId) {
dailyVolume = r.tve
}
})
}

if (data.totalVolume) {
data.totalVolume.forEach(r => {
if (r.chainId == chainId) {
totalVolume = r.tve
}
})
}

return {
dailyVolume: dailyVolume,
totalVolume: totalVolume,
timestamp: timestamp
}
} else {
//console.log("no data")
return {
dailyVolume: 0,
totalVolume: 0,
timestamp: timestamp,
}
}
}

const adapter: SimpleAdapter = {
adapter: {
[CHAIN.ETHEREUM]: {
fetch: fetch,
runAtCurrTime: false,
start: 1689657695,
},
[CHAIN.ARBITRUM]: {
fetch: fetch,
runAtCurrTime: false,
start: 1689014691,
},
[CHAIN.AVAX]: {
fetch: fetch,
runAtCurrTime: false,
start: 1696671295,
},
[CHAIN.BASE]: {
fetch: fetch,
runAtCurrTime: false,
start: 1697229723,
},
[CHAIN.BSC]: {
fetch: fetch,
runAtCurrTime: false,
start: 1696963675,
},
[CHAIN.OPTIMISM]: {
fetch: fetch,
runAtCurrTime: false,
start: 1696888429,
},
[CHAIN.POLYGON]: {
fetch: fetch,
runAtCurrTime: false,
start: 1696888519,
},
[CHAIN.MANTA]: {
fetch: fetch,
runAtCurrTime: false,
start: 1695079629,
},
[CHAIN.SCROLL]: {
fetch: fetch,
runAtCurrTime: false,
start: 1702694992,
}
}
};

export default adapter
33 changes: 0 additions & 33 deletions aggregators/logx/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions aggregators/swapgpt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface IVolumeall {
amount: string;
}

const baseUrl = "https://stats.swapgpt.ai"
const endpoint = "stats/getDefiLamaStats"
const baseUrl = "https://stats.panora.exchange";
const endpoint = "stats/getDefiLamaStats";


const fetch = async (timestamp: number) => {
Expand Down
4 changes: 3 additions & 1 deletion aggregators/wowmax/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const chains = [
CHAIN.SCROLL,
CHAIN.CRONOS,
CHAIN.MANTA,
CHAIN.BLAST,
];

const chainToId: Record<string, number> = {
Expand All @@ -19,7 +20,8 @@ const chainToId: Record<string, number> = {
[CHAIN.LINEA]: 59144,
[CHAIN.SCROLL]: 534352,
[CHAIN.CRONOS]: 25,
[CHAIN.MANTA]: 169
[CHAIN.MANTA]: 169,
[CHAIN.BLAST]: 81457,
};

const fetch = (chain: string) => async (timestamp: number) => {
Expand Down
6 changes: 3 additions & 3 deletions dexs/DerpDEX/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const endpoints = {
"https://api.studio.thegraph.com/query/49147/derpdex-v3-amm/v0.0.10",
[CHAIN.BASE]:
"https://api.thegraph.com/subgraphs/name/geckocoding/derpdex-amm-base",
[CHAIN.OP_BNB]:
"https://opbnb.subgraph.derpdex.com/subgraphs/name/geckocoding/derpdex-opbnb",
// [CHAIN.OP_BNB]:
// "https://opbnb.subgraph.derpdex.com/subgraphs/name/geckocoding/derpdex-opbnb",
};
const v3StartTimes = {
[CHAIN.ERA]: 1688515200,
[CHAIN.BASE]: 1692296100,
[CHAIN.OP_BNB]: 1695275237,
// [CHAIN.OP_BNB]: 1695275237,
};

const v3Graphs = getGraphDimensions({
Expand Down
4 changes: 4 additions & 0 deletions dexs/apollox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const fetchV1Volume = async () => {
const adapter: SimpleAdapter = {
adapter: {
[CHAIN.BSC]: {
runAtCurrTime: true,
fetch: async (timestamp) => {
const [v1, v2] = await Promise.all([
fetchV2Volume(CHAIN.BSC),
Expand All @@ -72,6 +73,7 @@ const adapter: SimpleAdapter = {
start: 1682035200,
},
[CHAIN.ARBITRUM]: {
runAtCurrTime: true,
fetch: async (timestamp) => {
const dailyVolume = await fetchV2Volume(CHAIN.ARBITRUM);
return {
Expand All @@ -82,6 +84,7 @@ const adapter: SimpleAdapter = {
start: 1682035200,
},
[CHAIN.OP_BNB]: {
runAtCurrTime: true,
fetch: async (timestamp) => {
const dailyVolume = await fetchV2Volume('opbnb');
return {
Expand All @@ -92,6 +95,7 @@ const adapter: SimpleAdapter = {
start: 1682035200,
},
[CHAIN.BASE]: {
runAtCurrTime: true,
fetch: async (timestamp) => {
const dailyVolume = await fetchV2Volume(CHAIN.BASE);
return {
Expand Down
46 changes: 33 additions & 13 deletions dexs/archly-finance-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,81 @@ const FACTORY_ADDRESS = '0x12508dd9108Abab2c5fD8fC6E4984E46a3CF7824';
const adapter: SimpleAdapter = {
adapter: {
[CHAIN.ARBITRUM_NOVA]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.ARBITRUM_NOVA, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.ARBITRUM]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.ARBITRUM, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.AVAX]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.AVAX, factory: FACTORY_ADDRESS }),
start: 1708473600,
},
[CHAIN.BASE]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.BASE, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.BLAST]: {
fetch: getDexVolumeExports({ chain: CHAIN.BLAST, factory: FACTORY_ADDRESS }),
start: 1710720000,
},
[CHAIN.BSC]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.BSC, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.CRONOS]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.CRONOS, factory: FACTORY_ADDRESS }),
start: 1708473600,
},
[CHAIN.FANTOM]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.FILECOIN]: {
fetch: getDexVolumeExports({ chain: CHAIN.FILECOIN, factory: FACTORY_ADDRESS }),
start: 1710979200,
},
[CHAIN.FRAXTAL]: {
fetch: getDexVolumeExports({ chain: CHAIN.FRAXTAL, factory: FACTORY_ADDRESS }),
start: 1710720000,
},
[CHAIN.KAVA]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.KAVA, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.MANTLE]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.MANTLE, factory: FACTORY_ADDRESS }),
start: 1708473600,
},
[CHAIN.METIS]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.METIS, factory: FACTORY_ADDRESS }),
start: 1708473600,
},
[CHAIN.MODE]: {
fetch: getDexVolumeExports({ chain: CHAIN.MODE, factory: FACTORY_ADDRESS }),
start: 1711792800,
},
[CHAIN.NEON]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.NEON, factory: FACTORY_ADDRESS }),
start: 1708473600,
},
[CHAIN.OPTIMISM]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.OPTIMISM, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.POLYGON]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.POLYGON, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.TELOS]: {
fetch: getDexVolumeExports({ chain: CHAIN.FANTOM, factory: FACTORY_ADDRESS }),
fetch: getDexVolumeExports({ chain: CHAIN.TELOS, factory: FACTORY_ADDRESS }),
start: 1700784000,
},
[CHAIN.ZORA]: {
fetch: getDexVolumeExports({ chain: CHAIN.ZORA, factory: FACTORY_ADDRESS }),
start: 1711929600,
},
}
};

Expand Down
46 changes: 46 additions & 0 deletions dexs/ash-perp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { request } from "graphql-request";
import { SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume";

const API_URL = 'https://statistic-api.ashperp.trade/graphql';

interface IVolume {
volume: string;
timestamp: number;
}

const VolumeQuery = `
query GetAllPairStatisticsToday {
pairs {
getAllPairStatistics {
volume
timestamp
}
}
}
`

const fetch = async (timestamp: number) => {
const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000)) + 86400;
const results: IVolume[] = (await request(API_URL, VolumeQuery)).pairs.getAllPairStatistics;
let dailyVolume = results.filter((volumeInfo)=>{
return volumeInfo.timestamp === dayTimestamp;
})
return {
dailyVolume: dailyVolume ? `${dailyVolume[0].volume}` : undefined,
timestamp: dayTimestamp,
};
}

const adapter: SimpleAdapter = {
adapter: {
[CHAIN.ELROND]: {
fetch: fetch,
runAtCurrTime: true,
start: 1707782400
},
},
};

export default adapter;
Loading

0 comments on commit 6595a92

Please sign in to comment.