Files
DefiLlama-Adapters/dexVolumes/soulswap/index.ts
0xtawa 22d1d42cc7 Small cleanup dexVolumes folder (#3443)
* Add .vscode folder to .gitignore

* Add v0 test script

* Fix types

* Fix chain blocks type

* Change dex volumes readme

* Fix ts errors

* Remove workbench.colorCustomizations

* Finally fix ts errors

* Chore test script

* Revert "Remove workbench.colorCustomizations"

This reverts commit 8e8721096f2d148495511442e6d822f30e576f42.

* Revert back since it doesn't solve the issue

* Upgrade trilom/file-changes-action from 1.2.3 -> 1.2.4
2022-08-04 09:41:30 +02:00

51 lines
1.1 KiB
TypeScript

import { getChainVolume } from "../helper/getUniSubgraphVolume";
import { getStartTimestamp } from "../helper/getStartTimestamp";
import { FANTOM } from "../helper/chains";
import { DexVolumeAdapter } from "../dexVolume.type";
import { Chain } from "@defillama/sdk/build/general";
const endpoints = {
// [AVAX]: "https://api.thegraph.com/subgraphs/name/soulswapfinance/avalanche-exchange
[FANTOM]: "https://api.thegraph.com/subgraphs/name/soulswapfinance/fantom-exchange",
};
const VOLUME_FIELD = "volumeUSD";
const graphs = getChainVolume({
graphUrls: {
// [AVAX]: endpoints[AVAX],
[FANTOM]: endpoints[FANTOM]
},
totalVolume: {
factory: "factories",
field: VOLUME_FIELD,
},
dailyVolume: {
factory: "dayData",
field: VOLUME_FIELD,
},
});
const startTimeQuery = {
endpoints,
dailyDataField: "dayDatas",
volumeField: VOLUME_FIELD,
};
const volume = Object.keys(endpoints).reduce(
(acc, chain) => ({
...acc,
[chain]: {
fetch: graphs(chain as Chain),
start: getStartTimestamp({ ...startTimeQuery, chain }),
},
}),
{}
);
const adapter: DexVolumeAdapter = {
volume,
};
export default adapter;