Skip to content

Commit ea1ba89

Browse files
committed
Track Pistachio Fee/Revenue
1 parent 140411a commit ea1ba89

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

fees/pistachio.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { FetchOptions, SimpleAdapter } from "../adapters/types";
2+
import { CHAIN } from "../helpers/chains";
3+
import { METRIC } from "../helpers/metrics";
4+
5+
const FEE_RATE = 0.0045; // 0.45% - On swaps we take 45 bps (0.45%) - https://www.pistachio.fi/#faq
6+
7+
const chainConfig: Record<string, { address: string, start: string }> = {
8+
[CHAIN.BASE]: { address:'0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', start: '2025-12-27' },
9+
[CHAIN.ETHEREUM]: { address: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', start: '2025-12-27' },
10+
[CHAIN.ARBITRUM]: { address: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', start: '2025-12-27' },
11+
[CHAIN.BSC]: { address: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', start: '2025-12-27' },
12+
[CHAIN.OPTIMISM]: { address: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', start: '2025-12-27' },
13+
[CHAIN.SCROLL]: { address: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', start: '2025-12-27' },
14+
[CHAIN.MANTLE]: { address: '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae', start: '2025-12-27' },
15+
}
16+
17+
const fetch = async ({ chain, getLogs, createBalances, }: FetchOptions) => {
18+
const volume = createBalances();
19+
20+
const data: any[] = await getLogs({
21+
target: chainConfig[chain].address,
22+
eventAbi: 'event LiFiGenericSwapCompleted(bytes32 indexed transactionId, string integrator, string referrer, address receiver, address fromAssetId, address toAssetId, uint256 fromAmount, uint256 toAmount)'
23+
});
24+
25+
data.forEach((e: any) => {
26+
if (e.integrator === 'pistachio') {
27+
volume.add(e.toAssetId, e.toAmount);
28+
}
29+
});
30+
31+
const dailyFees = volume.clone(FEE_RATE, METRIC.SERVICE_FEES);
32+
33+
return {
34+
dailyFees,
35+
dailyRevenue: dailyFees,
36+
dailyProtocolRevenue: dailyFees,
37+
};
38+
};
39+
40+
const adapter: SimpleAdapter = {
41+
version: 2,
42+
fetch,
43+
adapter: chainConfig,
44+
doublecounted: true,
45+
methodology: {
46+
Fees: "0.45% on cross-chain/same-chain swaps via LiFi",
47+
Revenue: "0.45% on cross-chain/same-chain swaps via LiFi",
48+
},
49+
breakdownMethodology: {
50+
Fees: {
51+
[METRIC.SERVICE_FEES]: "0.45% on cross-chain/same-chain swaps via LiFi",
52+
},
53+
}
54+
};
55+
56+
export default adapter;

0 commit comments

Comments
 (0)