Skip to content

Commit

Permalink
yieldfields typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
shinitakunai committed Mar 2, 2022
1 parent d4ea020 commit 7db6e14
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions dexVolumes/yieldfields/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const {
getChainVolume,
DEFAULT_TOTAL_VOLUME_FIELD,
DEFAULT_DAILY_VOLUME_FIELD,
} = require("../helper/getUniSubgraphVolume");
const { BSC } = require("../helper/chains");
const { getStartTimestamp } = require("../helper/getStartTimestamp");

import { DexVolumeAdapter } from "../dexVolume.type";

const endpoints = {
[BSC]: "https://api.thegraph.com/subgraphs/name/sotblad/yieldfieldsexchange",
};

const DAILY_VOLUME_FACTORY = "YieldFieldsDayData";

const graphs = getChainVolume({
graphUrls: {
[BSC]: endpoints[BSC],
},
totalVolume: {
factory: "YieldFieldsFactory",
field: DEFAULT_TOTAL_VOLUME_FIELD,
},
dailyVolume: {
factory: DAILY_VOLUME_FACTORY,
field: DEFAULT_DAILY_VOLUME_FIELD,
},
});

const adapter: DexVolumeAdapter = {
volume: {
[BSC]: {
fetch: graphs(BSC),
start: getStartTimestamp({
endpoints,
chain: BSC,
dailyDataField: `${DAILY_VOLUME_FACTORY}s`,
}),
},
},
};

export default adapter;

0 comments on commit 7db6e14

Please sign in to comment.