|
| 1 | +import fetchURL from "../../utils/fetchURL"; |
| 2 | +import { FetchOptions, FetchResult, SimpleAdapter } from "../../adapters/types"; |
| 3 | +import { CHAIN } from "../../helpers/chains"; |
| 4 | + |
| 5 | +const CASHMERE_API_URL = "https://kapi.cashmere.exchange/defillama/fees"; |
| 6 | + |
| 7 | +const getUrl = (startTime: number, endTime: number): string => { |
| 8 | + return `${CASHMERE_API_URL}?from_timestamp=${startTime}&to_timestamp=${endTime}`; |
| 9 | +}; |
| 10 | + |
| 11 | +const fetch = async (options: FetchOptions): Promise<FetchResult> => { |
| 12 | + const url = getUrl(options.startTimestamp, options.endTimestamp); |
| 13 | + const response = await fetchURL(url); |
| 14 | + |
| 15 | + return { |
| 16 | + dailyVolume: response.volumeUsd || 0, |
| 17 | + dailyFees: response.feesUsd || 0, |
| 18 | + dailyUserFees: response.feesUsd || 0, |
| 19 | + dailyRevenue: response.revenuesUsd || 0, |
| 20 | + dailyProtocolRevenue: response.protocolRevenueUsd || 0, |
| 21 | + dailyHoldersRevenue: 0, |
| 22 | + dailySupplySideRevenue:0, |
| 23 | + }; |
| 24 | +}; |
| 25 | + |
| 26 | +const methodology = { |
| 27 | + Volume: "Total cross-chain volume of the Cashmere", |
| 28 | + Fees: "Total amount of fees paid by users for cross-chain Cashmere relayers", |
| 29 | + UserFees: "Same as Fees - all fees are paid directly by end-users for Cashmere relayers", |
| 30 | + Revenue: "All relayer fees are retained as protocol revenue", |
| 31 | + ProtocolRevenue: "100% of fees go to protocol treasury", |
| 32 | + HoldersRevenue: "No token holders revenue distribution - Cashmere operates as a service protocol without governance tokens", |
| 33 | + SupplySideRevenue: "No liquidity providers - Cashmere operates bridge infrastructure, not AMM liquidity pools", |
| 34 | +}; |
| 35 | + |
| 36 | +const adapter: SimpleAdapter = { |
| 37 | + version: 2, |
| 38 | + fetch, |
| 39 | + chains: [CHAIN.ETHEREUM], // Aggregate data across all chains, represented under Ethereum |
| 40 | + start: "2025-09-08", |
| 41 | + methodology, |
| 42 | +}; |
| 43 | + |
| 44 | +export default adapter; |
0 commit comments