|
| 1 | +import { FetchOptions, SimpleAdapter } from "../../adapters/types"; |
| 2 | +import { CHAIN } from "../../helpers/chains"; |
| 3 | + |
| 4 | +const TransformedERC20Event = "event TransformedERC20(address indexed taker, address inputToken, address outputToken, uint256 inputTokenAmount, uint256 outputTokenAmount)"; |
| 5 | + |
| 6 | +const SHROOMY_AGGREGATOR_ADDRESS = "0x6cAcD722b95C1a5D055a3A45932C42246060132e" |
| 7 | + |
| 8 | +const fetch = async (options: FetchOptions) => { |
| 9 | + const dailyVolume = options.createBalances(); |
| 10 | + const dailyFees = options.createBalances(); |
| 11 | + |
| 12 | + const logs: any[] = await options.getLogs({ |
| 13 | + targets: [SHROOMY_AGGREGATOR_ADDRESS], |
| 14 | + eventAbi: TransformedERC20Event, |
| 15 | + flatten: true, |
| 16 | + }); |
| 17 | + |
| 18 | + for (const log of logs) { |
| 19 | + dailyVolume.add(log.inputToken, log.inputTokenAmount); |
| 20 | + dailyFees.add(log.inputToken, Number(log.inputTokenAmount) * 0.0005); // 0.05% |
| 21 | + } |
| 22 | + |
| 23 | + return { |
| 24 | + dailyVolume, |
| 25 | + dailyFees, |
| 26 | + dailyRevenue: dailyFees, |
| 27 | + dailyProtocolRevenue: dailyFees, |
| 28 | + }; |
| 29 | +}; |
| 30 | + |
| 31 | +const adapter: SimpleAdapter = { |
| 32 | + version: 2, |
| 33 | + fetch, |
| 34 | + start: "2025-09-15", |
| 35 | + methodology: { |
| 36 | + Volume: "Total trading swap volume via Shroomy Protocol.", |
| 37 | + Fees: "Flat 0.05% amount of trading swap fees on all trades.", |
| 38 | + Revenue: "Flat 0.05% amount of trading swap fees on all trades are revenue.", |
| 39 | + ProtocolRevenue: "Flat 0.05% amount of trading swap fees on all trades are revenue.", |
| 40 | + }, |
| 41 | + chains: [CHAIN.INK], |
| 42 | +}; |
| 43 | + |
| 44 | +export default adapter; |
0 commit comments