Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions fees/jito/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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,
Expand All @@ -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',
}
}
Expand Down
33 changes: 23 additions & 10 deletions helpers/queries/jito.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Loading