Skip to content

Commit 133dd1c

Browse files
committed
update balancer-v2
1 parent 0c373bd commit 133dd1c

File tree

3 files changed

+57
-35
lines changed

3 files changed

+57
-35
lines changed

dexs/balancer-v2.ts

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,78 @@
1-
2-
// import adapter from './balancer'
3-
// const { breakdown, ...rest } = adapter
4-
5-
// export default {
6-
// ...rest,
7-
// adapter: breakdown['v2'],
8-
// }
9-
101
import { FetchOptions } from '../adapters/types'
112
import { getFeesExport } from '../helpers/balancer'
123
import { CHAIN } from '../helpers/chains'
134

14-
const WhitehatActivitiesChains: Array<string> = [
15-
CHAIN.ETHEREUM,
16-
CHAIN.OPTIMISM,
17-
CHAIN.ARBITRUM,
18-
]
5+
const ESTIMATED_NON_CORE_SHARE = 0.7;
6+
const ESTIMATED_CORE_SHARE = 0.3;
7+
const HOLDERS_SHARE_NON_CORE = 0.825; // 82.5% for non-core pools
8+
const HOLDERS_SHARE_CORE = 0.125; // 12.5% for core pools
9+
10+
const weightedHoldersShare = ESTIMATED_NON_CORE_SHARE * HOLDERS_SHARE_NON_CORE + ESTIMATED_CORE_SHARE * HOLDERS_SHARE_CORE;
11+
12+
const revenueRatio = 0.5;
13+
const holderRevenueRatio = revenueRatio * weightedHoldersShare;
14+
const protocolRevenueRatio = revenueRatio - holderRevenueRatio;
1915

2016
async function fetch(options: FetchOptions) {
2117
// https://x.com/Balancer/status/1988685056982835470
18+
const WhitehatActivitiesChains: Array<string> = [
19+
CHAIN.ETHEREUM,
20+
CHAIN.OPTIMISM,
21+
CHAIN.ARBITRUM,
22+
]
2223
if ((options.startOfDay === 1762992000 || options.startOfDay === 1762905600) && WhitehatActivitiesChains.includes(options.chain)) {
2324
return {
2425
dailyVolume: 0,
25-
dailyFees:0,
26-
dailyRevenue:0,
27-
dailyProtocolRevenue:0,
28-
dailySupplySideRevenue:0,
26+
dailyFees: 0,
27+
dailyRevenue: 0,
28+
dailyProtocolRevenue: 0,
29+
dailySupplySideRevenue: 0,
30+
dailyHoldersRevenue: 0,
2931
}
3032
} else {
31-
const fetchFunction = getFeesExport('0xBA12222222228d8Ba445958a75a0704d566BF2C8', { revenueRatio: 0.5, protocolRevenueRatio: 0.5 });
33+
const fetchFunction = getFeesExport('0xBA12222222228d8Ba445958a75a0704d566BF2C8', { revenueRatio, protocolRevenueRatio, holderRevenueRatio, });
3234
return await fetchFunction(options);
3335
}
3436
}
3537

3638
export default {
3739
version: 2,
3840
fetch: fetch,
39-
chains: [
40-
CHAIN.ETHEREUM,
41-
CHAIN.ARBITRUM,
42-
CHAIN.AVAX,
43-
CHAIN.BASE,
44-
CHAIN.FRAXTAL,
45-
CHAIN.XDAI,
46-
CHAIN.MODE,
47-
CHAIN.OPTIMISM,
48-
CHAIN.POLYGON,
49-
]
41+
methodology: {
42+
Fees: "All trading fees collected (includes swap and yield fee)",
43+
UserFees: "Trading fees paid by users, ranging from 0.0001% to 10%",
44+
Revenue: "Protocol revenue from all fees collected",
45+
ProtocolRevenue: "Balancer V2 protocol fees are set to 50%",
46+
SupplySideRevenue: "A small percentage of the trade paid by traders to pool LPs",
47+
},
48+
adapter: {
49+
[CHAIN.ETHEREUM]: {
50+
start: '2021-04-23',
51+
},
52+
[CHAIN.POLYGON]: {
53+
start: '2021-06-24',
54+
},
55+
[CHAIN.ARBITRUM]: {
56+
start: '2021-08-31',
57+
},
58+
[CHAIN.AVAX]: {
59+
start: '2023-02-25',
60+
},
61+
[CHAIN.XDAI]: {
62+
start: '2023-01-10',
63+
},
64+
[CHAIN.BASE]: {
65+
start: '2023-07-26',
66+
},
67+
[CHAIN.MODE]: {
68+
start: '2024-05-22',
69+
},
70+
[CHAIN.FRAXTAL]: {
71+
start: '2024-05-20',
72+
},
73+
[CHAIN.OPTIMISM]: {
74+
start: '2022-05-04',
75+
},
76+
},
5077
}
5178

fees/balancer-v2.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

fees/balancer-v3.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)