Skip to content

Commit 8068a2b

Browse files
authored
update graph links and rev calc (DefiLlama#3939)
1 parent c403ea7 commit 8068a2b

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

dexs/gliquid/index.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { SimpleAdapter } from "../../adapters/types";
22
import { CHAIN } from "../../helpers/chains";
33
import { gql, request } from "graphql-request";
44

5-
const endpoint = "https://api.goldsky.com/api/public/project_cmb20ryy424yb01wy7zwd7xd1/subgraphs/analytics/v1.0.0/gn";
5+
const endpoint =
6+
"https://api.goldsky.com/api/public/project_cmb20ryy424yb01wy7zwd7xd1/subgraphs/analytics/1.2.3/gn";
67

78
// GraphQL query to fetch total volume
89
const totalVolumeQuery = gql`
@@ -47,9 +48,11 @@ const fetchDailyData = async (date: number) => {
4748

4849
let totalRevenue = 0;
4950

50-
pools.forEach(pool => {
51+
pools.forEach((pool) => {
5152
const poolFees = parseFloat(pool.feesUSD) || 0;
52-
const communityFee = pool.communityFee ? parseFloat(pool.communityFee) / 10000 : 0;
53+
const communityFee = pool.communityFee
54+
? parseFloat(pool.communityFee) / 10000
55+
: 0;
5356

5457
const poolRevenue = poolFees * communityFee;
5558

@@ -69,7 +72,9 @@ const adapter: SimpleAdapter = {
6972
fetch: async (timestamp: number) => {
7073
const dayTimestamp = Math.floor(timestamp / 86400) * 86400;
7174
const totalVolume = await fetchTotalVolume();
72-
const { volumeUSD, feesUSD, revenueUSD } = await fetchDailyData(dayTimestamp);
75+
const { volumeUSD, feesUSD, revenueUSD } = await fetchDailyData(
76+
dayTimestamp
77+
);
7378

7479
return {
7580
totalVolume: parseFloat(totalVolume),
@@ -80,17 +85,17 @@ const adapter: SimpleAdapter = {
8085
timestamp: dayTimestamp,
8186
};
8287
},
83-
start: '2025-02-06',
88+
start: "2025-02-06",
8489
meta: {
8590
methodology: {
8691
Volume: "Total users swap volume.",
8792
Fees: "Swap fees paid by users.",
8893
Revenue: "Protocol and community shared from fees.",
89-
SupplySideRevenue: "Fees shared to liquidity providers."
90-
}
91-
}
94+
SupplySideRevenue: "Fees shared to liquidity providers.",
95+
},
96+
},
9297
},
9398
},
9499
};
95100

96-
export default adapter;
101+
export default adapter;

fees/gliquid/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import request, { gql } from "graphql-request";
44
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
55
import { CHAIN } from "../../helpers/chains";
66

7-
const endpoint = "https://api.goldsky.com/api/public/project_cmb20ryy424yb01wy7zwd7xd1/subgraphs/analytics/v1.0.0/gn"
7+
const endpoint = "https://api.goldsky.com/api/public/project_cmb20ryy424yb01wy7zwd7xd1/subgraphs/analytics/1.2.3/gn"
88

99

1010
const fetch = async ({ startOfDay }: FetchOptions) => {
@@ -20,8 +20,8 @@ const fetch = async ({ startOfDay }: FetchOptions) => {
2020
});
2121

2222
const dailyFees = feesRes.algebraDayDatas[0].feesUSD;
23-
const dailyProtocolRevenue = dailyFees * 0.05;
24-
const dailySupplySideRevenue = dailyFees * 0.95;
23+
const dailyProtocolRevenue = dailyFees * 0.13;
24+
const dailySupplySideRevenue = dailyFees * 0.87;
2525

2626
return {
2727
dailyFees,

0 commit comments

Comments
 (0)