Skip to content

Commit ba3aeb7

Browse files
ftm1337treeoflife2
andauthored
Fix fees equalizer (DefiLlama#3714)
* fix-fees-equalizer * fix-fees-equalizer --------- Co-authored-by: treeoflife2 <sol.analyzoor@gmail.com>
1 parent c28f826 commit ba3aeb7

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

fees/Scale.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { SimpleAdapter } from "../adapters/types";
22
import { CHAIN } from "../helpers/chains";
3-
import { getFeesExport } from '../helpers/solidly';
3+
import { getFeesExportWithFilter } from '../helpers/solidly';
44

55
const VOTER_ADDRESS = '0x46ABb88Ae1F2a35eA559925D99Fdc5441b592687';
66
const FACTORY_ADDRESS = '0xEd8db60aCc29e14bC867a497D94ca6e3CeB5eC04';
77

88
const adapter: SimpleAdapter = {
99
adapter: {
1010
[CHAIN.BASE]: {
11-
fetch: getFeesExport({ FACTORY_ADDRESS, VOTER_ADDRESS, }),
11+
fetch: getFeesExportWithFilter({ FACTORY_ADDRESS, VOTER_ADDRESS, APPLY_FILTER_POOLS_2: false }),
1212
start: '2023-09-23',
1313
},
1414
},

fees/equalizer-exchange.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
import { SimpleAdapter } from "../adapters/types";
22
import { CHAIN } from "../helpers/chains";
3-
import { getFeesExport } from '../helpers/solidly';
4-
5-
const VOTER_ADDRESS = '0xE3D1A117dF7DCaC2eB0AC8219341bAd92f18dAC1';
6-
const FACTORY_ADDRESS = '0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a';
3+
import { getFeesExportWithFilter } from '../helpers/solidly';
74

85
const adapter: SimpleAdapter = {
96
version: 2,
107
adapter: {
118
[CHAIN.FANTOM]: {
12-
fetch: getFeesExport({ VOTER_ADDRESS, FACTORY_ADDRESS }),
9+
fetch: getFeesExportWithFilter({
10+
VOTER_ADDRESS: '0xE3D1A117dF7DCaC2eB0AC8219341bAd92f18dAC1',
11+
FACTORY_ADDRESS: '0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a',
12+
APPLY_FILTER_POOLS_2: false
13+
}),
1314
start: '2022-12-09',
1415
},
1516
[CHAIN.SONIC]: {
16-
fetch: getFeesExport({ VOTER_ADDRESS: '0x17fa9dA6e01aD59513707F92033a6eb03CcB10B4', FACTORY_ADDRESS: '0xDDD9845Ba0D8f38d3045f804f67A1a8B9A528FcC' }),
17+
fetch: getFeesExportWithFilter({
18+
VOTER_ADDRESS: '0x17fa9dA6e01aD59513707F92033a6eb03CcB10B4',
19+
FACTORY_ADDRESS: '0xDDD9845Ba0D8f38d3045f804f67A1a8B9A528FcC',
20+
APPLY_FILTER_POOLS_2: false
21+
}),
22+
start: '2024-12-11',
1723
},
1824
}
1925
};

helpers/solidly.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const VOTER_ABI: TABI = {
1919
"bribes": "function bribes(address) view returns (address)"
2020
}
2121

22-
export function getFeesExport({ VOTER_ADDRESS, FACTORY_ADDRESS, }: { VOTER_ADDRESS: string, FACTORY_ADDRESS: string }) {
22+
export function getFeesExportWithFilter({ VOTER_ADDRESS, FACTORY_ADDRESS, APPLY_FILTER_POOLS_2}: { VOTER_ADDRESS: string, FACTORY_ADDRESS: string, APPLY_FILTER_POOLS_2: boolean }) {
2323
return async (fetchOptions: FetchOptions) => {
2424
const { api, getLogs, createBalances, } = fetchOptions
2525

@@ -33,10 +33,12 @@ export function getFeesExport({ VOTER_ADDRESS, FACTORY_ADDRESS, }: { VOTER_ADDRE
3333
['address:token0', 'address:token1'].map((method) => api.multiCall({ abi: method, calls: lpTokens, }))
3434
);
3535

36-
const res = await filterPools2({ fetchOptions, pairs: lpTokens, token0s, token1s })
37-
lpTokens = res.pairs
38-
token0s = res.token0s
39-
token1s = res.token1s
36+
if(APPLY_FILTER_POOLS_2) {
37+
const res = await filterPools2({ fetchOptions, pairs: lpTokens, token0s, token1s })
38+
lpTokens = res.pairs
39+
token0s = res.token0s
40+
token1s = res.token1s
41+
}
4042

4143

4244
const poolsGauges = await api.multiCall({ abi: VOTER_ABI.gauges, target: VOTER_ADDRESS, calls: lpTokens, });
@@ -77,3 +79,7 @@ export function getFeesExport({ VOTER_ADDRESS, FACTORY_ADDRESS, }: { VOTER_ADDRE
7779
return { dailyFees, dailyRevenue, dailyHoldersRevenue: dailyRevenue, dailyBribesRevenue, };
7880
}
7981
}
82+
83+
export function getFeesExport({ VOTER_ADDRESS, FACTORY_ADDRESS, }: { VOTER_ADDRESS: string, FACTORY_ADDRESS: string }) {
84+
return getFeesExportWithFilter({ VOTER_ADDRESS, FACTORY_ADDRESS, APPLY_FILTER_POOLS_2:true})
85+
}

0 commit comments

Comments
 (0)