Skip to content

Commit

Permalink
v2 unis
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebruce0x committed Mar 5, 2024
1 parent 48d2e6f commit 70a7a68
Show file tree
Hide file tree
Showing 42 changed files with 190 additions and 179 deletions.
1 change: 1 addition & 0 deletions dexs/ArbitrumExchange/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const startTimeV3:TStartTime = {
[CHAIN.ARBITRUM]: 1683590400,
}
const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
v2: {
[CHAIN.ARBITRUM]: {
Expand Down
40 changes: 16 additions & 24 deletions dexs/SmarDex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ const graphRequestHeaders:IMap = {
[CHAIN.POLYGON]: defaultHeaders,
};

const startTimes = {
[CHAIN.ARBITRUM]: 1689582249,
[CHAIN.BASE]: 1691491872,
[CHAIN.BSC]: 1689581494,
[CHAIN.ETHEREUM]: 1678404995,
[CHAIN.POLYGON]: 1689582144,
}

/**
* @note We are using this method that allow us to use http headers
* The method `getGraphDimensions` try returns daily fees and total fees
Expand All @@ -58,29 +66,13 @@ const graphs = getGraphDimensions({
},
});

const adapter: SimpleAdapter = {
adapter: {
[CHAIN.ETHEREUM]: {
fetch: graphs(CHAIN.ETHEREUM),
start: 1678404995, // birthBlock timestamp
},
[CHAIN.BSC]: {
fetch: graphs(CHAIN.BSC),
start: 1689581494,
},
[CHAIN.POLYGON]: {
fetch: graphs(CHAIN.POLYGON),
start: 1689582144,
},
[CHAIN.ARBITRUM]: {
fetch: graphs(CHAIN.ARBITRUM),
start: 1689582249,
},
[CHAIN.BASE]: {
fetch: graphs(CHAIN.BASE),
start: 1691491872,
},
},
};
const adapter: SimpleAdapter = { adapter: {}, version: 2 }

Object.keys(graphUrls).map((chain: string) => {
adapter.adapter[chain] = {
fetch: graphs(chain),
start: startTimes[chain]
}
})

export default adapter;
1 change: 1 addition & 0 deletions dexs/archly-finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const graphFetch = getGraphDimensions({
});

const adapter: Adapter = {
version: 2,
adapter: {
[CHAIN.TELOS]: {
fetch: graphFetch(CHAIN.TELOS),
Expand Down
1 change: 1 addition & 0 deletions dexs/butterxyz/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const dimensions = getGraphDimensions({
});

export default {
version: 2,
adapter: {
[CHAIN.MANTLE]: {
fetch: dimensions(CHAIN.MANTLE),
Expand Down
1 change: 1 addition & 0 deletions dexs/doveswap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const startTimeV3:TStartTime = {

}
const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
v3: Object.keys(v3Endpoints).reduce((acc, chain) => {
acc[chain] = {
Expand Down
10 changes: 2 additions & 8 deletions dexs/dragonswap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const v3Graph = getGraphDimensions({
});

const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
v2: Object.keys(endpoints).reduce((acc, chain) => {
acc[chain] = {
Expand All @@ -86,14 +87,7 @@ const adapter: BreakdownAdapter = {
}, {} as BaseAdapter),
v3: Object.keys(v3Endpoint).reduce((acc, chain) => {
acc[chain] = {
fetch: async (timestamp: number) => {
const v3stats = await v3Graph(chain)(timestamp, {})
return {
...v3stats,
timestamp
}

},
fetch: v3Graph(chain),
start: v3StartTimes[chain],
}
return acc
Expand Down
1 change: 1 addition & 0 deletions dexs/fusionx-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const v2Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.MANTLE]: {
fetch: v2Graphs(CHAIN.MANTLE),
Expand Down
1 change: 1 addition & 0 deletions dexs/fusionx-v3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const v3Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.MANTLE]: {
fetch: v3Graphs(CHAIN.MANTLE),
Expand Down
1 change: 1 addition & 0 deletions dexs/horiza/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const v3Graphs = getGraphDimensions({
});

const adapters: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.ARBITRUM]: {
fetch: v3Graphs(CHAIN.ARBITRUM),
Expand Down
1 change: 1 addition & 0 deletions dexs/hydradex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const methodology = {
};

const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
v2: {
[DISABLED_ADAPTER_KEY]: disabledAdapter,
Expand Down
1 change: 1 addition & 0 deletions dexs/jswap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[DISABLED_ADAPTER_KEY]: disabledAdapter,
[CHAIN.OKEXCHAIN]: {
Expand Down
1 change: 1 addition & 0 deletions dexs/kinetix-v3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const v3 = Object.keys(endpointsV3).reduce(
);

const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
v3: v3,
},
Expand Down
1 change: 1 addition & 0 deletions dexs/maia-v3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const methodology = {
}

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.METIS]: {
fetch: v3Graphs(CHAIN.METIS),
Expand Down
1 change: 1 addition & 0 deletions dexs/metavault-v3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const v3 = Object.keys(endpointsV3).reduce(
);

const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
v3: v3,
},
Expand Down
1 change: 1 addition & 0 deletions dexs/miaswap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const v3Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.ONUS]: {
fetch: v3Graphs(CHAIN.ONUS),
Expand Down
1 change: 1 addition & 0 deletions dexs/monocerus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const v3Graphs = getGraphDimensions({
});

const adapter: Adapter = {
version: 2,
adapter: {
[DISABLED_ADAPTER_KEY]: disabledAdapter,
[CHAIN.MANTA]: {
Expand Down
7 changes: 4 additions & 3 deletions dexs/nomiswap/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { univ2Adapter } from "../../helpers/getUniSubgraphVolume";
import { CHAIN } from "../../helpers/chains";
import { getGraphDimensions } from "../../helpers/getUniSubgraph";
import { SimpleAdapter } from "../../adapters/types";
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { time } from "console";

const endpoints = {
Expand All @@ -28,10 +28,11 @@ const graphsClassic = getGraphDimensions({
});

const adapters: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.BSC]: {
fetch: async (timestamp: number) => {
const data = await graphsClassic(CHAIN.BSC)(timestamp, {});
fetch: async (options: FetchOptions) => {
const data = await graphsClassic(CHAIN.BSC)(options);
const removeSpike = Number(data.totalVolume) - 2035654137.527446631277942307129497;
data.totalVolume = removeSpike > 0 ? removeSpike : data.totalVolume;
return {
Expand Down
1 change: 1 addition & 0 deletions dexs/quickswap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const fetchLiquidityHub = async (timestamp: number) => {


const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
v2: {
[CHAIN.POLYGON]: {
Expand Down
1 change: 1 addition & 0 deletions dexs/retro/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const v3Graphs = getGraphDimensions({
});

const adapters: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.POLYGON]: {
fetch: v3Graphs(CHAIN.POLYGON),
Expand Down
1 change: 1 addition & 0 deletions dexs/shimmersea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const v3Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: Object.keys(v3Endpoints).reduce((acc, chain) => {
return {
...acc,
Expand Down
1 change: 1 addition & 0 deletions dexs/squadswap-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const v2Graph = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.BSC]: {
fetch: v2Graph(CHAIN.BSC),
Expand Down
1 change: 1 addition & 0 deletions dexs/squadswap-v3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const v3Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.BSC]: {
fetch: v3Graphs(CHAIN.BSC),
Expand Down
1 change: 1 addition & 0 deletions dexs/supswap-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const v2Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.MODE]: {
fetch: v2Graphs(CHAIN.MODE),
Expand Down
1 change: 1 addition & 0 deletions dexs/supswap-v3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const v3Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.MODE]: {
fetch: v3Graphs(CHAIN.MODE),
Expand Down
1 change: 1 addition & 0 deletions dexs/surfswap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const v1graphs = getGraphDimensions({
});

const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
classic: {
[CHAIN.KAVA]: {
Expand Down
2 changes: 2 additions & 0 deletions dexs/sushiswap/classic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,6 @@ classic[CHAIN.FANTOM] = {
start: 0
}

classic.version = 2

export default classic
37 changes: 18 additions & 19 deletions dexs/sushiswap/v3.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Chain } from "@defillama/sdk/build/general";
import { CHAIN } from "../../helpers/chains";
import { getGraphDimensions } from "../../helpers/getUniSubgraph";
import { Adapter, SimpleAdapter } from "../../adapters/types";

const endpointsV3 = {
[CHAIN.ARBITRUM_NOVA]: 'https://subgraphs.sushi.com/subgraphs/name/sushi-v3/v3-arbitrum-nova',
Expand Down Expand Up @@ -58,25 +59,23 @@ const startTimeV3: {[key: string]: number} = {
[CHAIN.BASE]: 1691020800,
}

const v3 = Object.keys(endpointsV3).reduce(
(acc, chain) => ({
...acc,
[chain]: {
fetch: v3Graphs(chain as Chain),
start: startTimeV3[chain],
meta: {
methodology: {
Fees: "Each pool charge between 0.01% to 1% fee",
UserFees: "Users pay between 0.01% to 1% fee",
Revenue: "0 to 1/4 of the fee goes to treasury",
HoldersRevenue: "None",
ProtocolRevenue: "Treasury receives a share of the fees",
SupplySideRevenue: "Liquidity providers get most of the fees of all trades in their pools"
}
const v3: SimpleAdapter = { adapter: {}, version: 2 }

Object.keys(endpointsV3).map((chain: string) => {
v3.adapter[chain] = {
fetch: v3Graphs(chain as Chain),
start: startTimeV3[chain],
meta: {
methodology: {
Fees: "Each pool charge between 0.01% to 1% fee",
UserFees: "Users pay between 0.01% to 1% fee",
Revenue: "0 to 1/4 of the fee goes to treasury",
HoldersRevenue: "None",
ProtocolRevenue: "Treasury receives a share of the fees",
SupplySideRevenue: "Liquidity providers get most of the fees of all trades in their pools"
}
},
}),
{}
);
}
}
})

export default v3
1 change: 1 addition & 0 deletions dexs/tangleswap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const v3Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: Object.keys(v3Endpoints).reduce((acc, chain) => {
return {
...acc,
Expand Down
1 change: 1 addition & 0 deletions dexs/throne-v3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const v3StartTimes = {
} as IJSON<number>;

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.BASE]: {
fetch: v3Graph(CHAIN.BASE),
Expand Down
2 changes: 1 addition & 1 deletion dexs/vapordex/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const v2 = Object.keys(endpointsV2).reduce(
start: startTimeV2[chain],
},
}),
{}
{ version: 2 }
);

export default v2;
1 change: 1 addition & 0 deletions dexs/xswap-protocol/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const graphs = getGraphDimensions({
});

const adapters: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.XDC]: {
fetch: graphs(CHAIN.XDC),
Expand Down
7 changes: 4 additions & 3 deletions dexs/zkswap/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { time } from "console";
import { SimpleAdapter } from "../../adapters/types";
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { getGraphDimensions } from "../../helpers/getUniSubgraph";

Expand Down Expand Up @@ -27,10 +27,11 @@ const graph = getGraphDimensions({
});

const adapters: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.ERA]: {
fetch: async (timestamp: number) => {
const data = await graph(CHAIN.ERA)(timestamp, {});
fetch: async (options: FetchOptions) => {
const data = await graph(CHAIN.ERA)(options);
data.totalVolume = undefined;
return {
...data
Expand Down
1 change: 1 addition & 0 deletions fees/ascent-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const v3Graphs = getGraphDimensions({
});

const adapter: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.EON]: {
fetch: v3Graphs(CHAIN.EON),
Expand Down
Loading

0 comments on commit 70a7a68

Please sign in to comment.