diff --git a/fees/jito/index.ts b/fees/jito/index.ts index 5e5f8ea6ba..e7fe988a76 100644 --- a/fees/jito/index.ts +++ b/fees/jito/index.ts @@ -6,6 +6,8 @@ - Withdrawal Fees (0.1% on unstake) from the JitoSOL stake pool. - Interceptor Fees (a portion of MEV rewards directed to the DAO). - Tip Router Fees (MEV tips explicitly routed to the DAO). + - JIP-24 the Block Engine and future fees from the newly launched BAM (Block Assembly Marketplace) are combined and routed to the DAO treasury. + // https://forum.jito.network/t/jip-24-jito-dao-receives-all-jito-block-engine-fees-and-future-bam-fees/860 This is calculated via the SQL query which sums transfers to specific DAO fee accounts. Note: Staking rewards distributed to JitoSOL holders are not included in these metrics. */ @@ -14,7 +16,7 @@ import { FetchOptions, SimpleAdapter } from "../../adapters/types" import { CHAIN } from "../../helpers/chains" import { getSqlFromFile, queryDuneSql } from "../../helpers/dune" -const fetchFees = async (_a: any, _b: any, options: FetchOptions) => { +const fetch = async (_a: any, _b: any, options: FetchOptions) => { const sql = getSqlFromFile("helpers/queries/jito.sql", { start: options.startTimestamp, @@ -23,29 +25,37 @@ const fetchFees = async (_a: any, _b: any, options: FetchOptions) => { const fees: any[] = (await queryDuneSql(options, sql)); - const dailyProtocolRevenue = options.createBalances(); - dailyProtocolRevenue.addCGToken('usd', fees[0].total_usd_amt) + const dailyFees = options.createBalances(); + dailyFees.addCGToken('usd-coin', fees[0].jitostake_pool_fees, 'JITOSOL_FEES') + dailyFees.addCGToken('usd-coin', fees[0].interceptor_fees, 'INTERCEPTOR_FEES') + dailyFees.addCGToken('usd-coin', fees[0].tip_router_fees, 'TIP_ROUTER') + dailyFees.addCGToken('usd-coin', fees[0].bam_mev_tips, 'MEV_TIPS') return { - dailyFees: dailyProtocolRevenue, - dailyRevenue: dailyProtocolRevenue, - dailyProtocolRevenue, + dailyFees, + dailyRevenue: dailyFees, + dailyProtocolRevenue: dailyFees, dailyHoldersRevenue: "0", } } const adapter: SimpleAdapter = { - version: 1, - adapter: { - [CHAIN.SOLANA]: { - fetch: fetchFees, - start: '2022-11-21', + fetch, + chains: [CHAIN.SOLANA], + start: '2022-11-21', + isExpensiveAdapter: true, + breakdownMethodology: { + Fees: { + 'JITOSOL_FEES': 'Withdrawal Fees (0.1% on unstake) from the JitoSOL stake pool', + 'INTERCEPTOR_FEES': 'Fees generated from early unstake claims', + 'TIP_ROUTER': 'Fees generated from the TipRouter Node Consensus Network', + 'MEV_TIPS': 'Block engine fees routed directly to the DAO', } }, - isExpensiveAdapter: true, methodology: { - Fees: 'Fee accured to the jito DAO (Withdrawal Fees, Interceptor Fees, Tip Router Fees)', - Revenue: 'Fee accured to the jito DAO (Withdrawal Fees, Interceptor Fees, Tip Router Fees)', + Fees: 'Fee accured to the jito DAO (Withdrawal Fees, Interceptor Fees, Tip Router Fees, BAM Fees)', + Revenue: 'Fee accured to the jito DAO (Withdrawal Fees, Interceptor Fees, Tip Router Fees, BAM Fees)', + ProtocolRevenue: 'Fee accured to the jito DAO (Withdrawal Fees, Interceptor Fees, Tip Router Fees, BAM Fees)', HoldersRevenue: 'Fee paid to token holders', } } diff --git a/helpers/queries/jito.sql b/helpers/queries/jito.sql index 316a27f147..87ebc26627 100644 --- a/helpers/queries/jito.sql +++ b/helpers/queries/jito.sql @@ -44,15 +44,28 @@ WITH AND block_date >= FROM_UNIXTIME({{start}}) AND block_date < FROM_UNIXTIME({{end}}) ), - revenue AS ( - SELECT block_date, jitoSOL_amt, usd_amt FROM jitostake_pool_fees - UNION ALL - SELECT block_date, jitoSOL_amt, usd_amt FROM interceptor_fees - UNION ALL - SELECT block_date, jitoSOL_amt, usd_amt FROM tip_router_fees + bam_mev_tips AS ( + -- Mev Tips JIP24 (SOL) from query_5725652 logic + SELECT + a.block_date, + a.balance_change / 1e9 AS jitoSOL_amt, + p_sol.price * a.balance_change / 1e9 AS usd_amt + FROM solana.account_activity a + LEFT JOIN solana.transactions t + ON a.tx_id = t.id + AND a.block_date = t.block_date + LEFT JOIN prices.minute AS p_sol + ON DATE_TRUNC('minute', a.block_time) = p_sol.timestamp + AND p_sol.blockchain = 'solana' + AND p_sol.contract_address = FROM_BASE58('So11111111111111111111111111111111111111112') + WHERE a.block_date >= date('2025-08-01') + AND a.block_date >= FROM_UNIXTIME({{start}}) + AND a.block_date < FROM_UNIXTIME({{end}}) + AND a.address = '5eosrve6LktMZgVNszYzebgmmC7BjLK8NoWyRQtcmGTF' + AND any_match(account_keys, x -> x = 'T1pyyaTNZsKv2WcRAB8oVnk93mLJw2XzjtVYqCsaHqt') ) SELECT - COALESCE(SUM(jitoSOL_amt), 0) AS total_jitoSOL_amt, - COALESCE(SUM(usd_amt), 0) AS total_usd_amt -FROM - revenue; + (SELECT COALESCE(SUM(usd_amt), 0) FROM jitostake_pool_fees) AS jitostake_pool_fees, + (SELECT COALESCE(SUM(usd_amt), 0) FROM interceptor_fees) AS interceptor_fees, + (SELECT COALESCE(SUM(usd_amt), 0) FROM tip_router_fees) AS tip_router_fees, + (SELECT COALESCE(SUM(usd_amt), 0) FROM bam_mev_tips) AS bam_mev_tips;