Skip to content

Commit 511d68d

Browse files
Update Strike Finance Fee & Volume Adapters (DefiLlama#3609)
* refactor and fix bugs --------- Co-authored-by: treeoflife2 <sol.analyzoor@gmail.com>
1 parent d5b4c3b commit 511d68d

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

dexs/strike-finance/index.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1-
import axios from "axios";
21
import { CHAIN } from "../../helpers/chains";
32
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
4-
3+
import fetchURL from "../../utils/fetchURL";
54

65
export async function fetch(options: FetchOptions) {
7-
const {
8-
data: { dailyVolume },
9-
} = await axios.get(
10-
`https://tidelabs.io:2121/defillama/strike-finance/fees?from=${options.startTimestamp}&to=${options.endTimestamp}`,
6+
const dailyVolume = options.createBalances();
7+
const { totalVolume } = await fetchURL(
8+
`https://beta.strikefinance.org/api/analytics/volume?from=${options.startTimestamp}&to=${options.endTimestamp}`
119
);
12-
const dailyVolumeUSD = options.createBalances();
13-
dailyVolumeUSD.addCGToken('cardano', Number(dailyVolume));
10+
dailyVolume.addCGToken("cardano", Number(totalVolume));
1411

1512
return {
16-
dailyVolume
13+
dailyVolume,
1714
};
1815
}
1916

20-
2117
const adapter: SimpleAdapter = {
2218
version: 2,
2319
adapter: {
2420
[CHAIN.CARDANO]: {
2521
fetch,
26-
start: '2025-05-16',
22+
start: "2025-05-16",
2723
},
2824
},
2925
};

fees/strike-finance/index.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
import axios from "axios";
21
import { Adapter, FetchOptions, FetchResult } from "../../adapters/types";
32
import { CHAIN } from "../../helpers/chains";
3+
import fetchURL from "../../utils/fetchURL";
44

55
const fetch = async (options: FetchOptions): Promise<FetchResult> => {
6-
const {
7-
data: { dailyRevenue },
8-
} = await axios.get(
9-
`https://tidelabs.io:2121/defillama/strike-finance/fees?from=${options.startTimestamp}&to=${options.endTimestamp}`,
6+
const dailyFees = options.createBalances();
7+
const dailyRevenue = options.createBalances();
8+
9+
const { totalFees, totalRevenue } = await fetchURL(
10+
`https://beta.strikefinance.org/api/analytics/fees?from=${options.startTimestamp}&to=${options.endTimestamp}`
1011
);
11-
const dailyRevenueUSD = options.createBalances();
12-
dailyRevenueUSD.addCGToken('cardano', Number(dailyRevenue));
13-
const dailyFeesUSD = dailyRevenueUSD.clone();
12+
13+
dailyFees.addCGToken("cardano", Number(totalFees));
14+
dailyRevenue.addCGToken("cardano", Number(totalRevenue));
15+
1416
return {
15-
timestamp: options.startOfDay,
16-
dailyFees: dailyFeesUSD,
17-
dailyRevenue: dailyRevenueUSD,
17+
dailyFees,
18+
dailyRevenue,
19+
dailyProtocolRevenue: dailyRevenue,
1820
};
1921
};
2022

@@ -23,11 +25,13 @@ const adapter: Adapter = {
2325
adapter: {
2426
[CHAIN.CARDANO]: {
2527
fetch,
26-
start: '2024-05-16',
28+
start: "2024-05-16",
29+
runAtCurrTime: true,
2730
meta: {
2831
methodology: {
2932
Fees: "All trading fees associated with opening a perpetual position.",
30-
Revenue: "All trading fees associated with opening a perpetual position.",
33+
Revenue: "All open fees plus liquidation and trading revenue",
34+
ProtocolRevenue: "All open fees plus liquidation and trading revenue",
3135
}
3236
}
3337
},

0 commit comments

Comments
 (0)