From 70983cd2fa1b7cca3cd5f2d8aca79c7ce477d0a6 Mon Sep 17 00:00:00 2001 From: treeoflife2 Date: Tue, 23 Sep 2025 14:33:29 +0530 Subject: [PATCH 1/3] Add JIP-24 DAO fees update and breakdownmethodology --- fees/jito/index.ts | 38 ++++++++++++++++++++++++-------------- helpers/queries/jito.sql | 35 ++++++++++++++++++++++++----------- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/fees/jito/index.ts b/fees/jito/index.ts index 5e5f8ea6ba..d267f0cb0b 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': 'a portion of MEV rewards directed to the DAO', + 'TIP_ROUTER': 'MEV tips explicitly routed to the DAO', + 'MEV_TIPS': 'jito-block-engine-fees and BAM Fees', } }, - 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..66c872e068 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; From 5bcd1a648cb93b4e5286602b9af3f09eec1c127d Mon Sep 17 00:00:00 2001 From: treeoflife2 Date: Wed, 24 Sep 2025 12:21:42 +0530 Subject: [PATCH 2/3] update breakdownmethodology --- fees/jito/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fees/jito/index.ts b/fees/jito/index.ts index d267f0cb0b..e7fe988a76 100644 --- a/fees/jito/index.ts +++ b/fees/jito/index.ts @@ -47,9 +47,9 @@ const adapter: SimpleAdapter = { breakdownMethodology: { Fees: { 'JITOSOL_FEES': 'Withdrawal Fees (0.1% on unstake) from the JitoSOL stake pool', - 'INTERCEPTOR_FEES': 'a portion of MEV rewards directed to the DAO', - 'TIP_ROUTER': 'MEV tips explicitly routed to the DAO', - 'MEV_TIPS': 'jito-block-engine-fees and BAM Fees', + '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', } }, methodology: { From b18ddecb7470dbeea09b0864364afe4db4f4f0e0 Mon Sep 17 00:00:00 2001 From: treeoflife2 Date: Wed, 24 Sep 2025 12:24:15 +0530 Subject: [PATCH 3/3] fix dune syntax --- helpers/queries/jito.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/queries/jito.sql b/helpers/queries/jito.sql index 66c872e068..87ebc26627 100644 --- a/helpers/queries/jito.sql +++ b/helpers/queries/jito.sql @@ -63,7 +63,7 @@ WITH AND a.block_date < FROM_UNIXTIME({{end}}) AND a.address = '5eosrve6LktMZgVNszYzebgmmC7BjLK8NoWyRQtcmGTF' AND any_match(account_keys, x -> x = 'T1pyyaTNZsKv2WcRAB8oVnk93mLJw2XzjtVYqCsaHqt') - ), + ) SELECT (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,