Skip to content

Commit

Permalink
Jito Fundamental metrics (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwes authored Oct 24, 2024
1 parent f1432f8 commit 127f48e
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
18 changes: 18 additions & 0 deletions models/projects/jito/ez_jito_metrics.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{
config(
materialized='view',
snowflake_warehouse='jito',
database='jito',
schema='core',
alias='ez_metrics'
)
}}

SELECT
day as date
, fees
, revenue
, supply_side_fees
, txns
, dau
FROM {{ ref('fact_jito_dau_txns_fees') }}
6 changes: 6 additions & 0 deletions models/staging/jito/__jito__sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sources:
- name: SOLANA_FLIPSIDE
schema: core
database: solana_flipside
tables:
- name: fact_transfers
39 changes: 39 additions & 0 deletions models/staging/jito/fact_jito_dau_txns_fees.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{
config(
materialized='incremental',
unique_key='day',
snowflake_warehouse='jito'
)
}}
with prices as (
SELECT
date(hour) as date
, avg(price) as price
FROM solana_flipside.price.ez_prices_hourly
where is_native = 'True'
GROUP BY 1
)

SELECT
date_trunc('day', t.block_timestamp) as day
, sum(t.amount * p.price) as fees
, sum(t.amount * p.price) * 0.05 as revenue
, sum(t.amount * p.price) * 0.95 as supply_side_fees
, count(*) as txns
, count(distinct t.tx_from) as dau
FROM {{ source('SOLANA_FLIPSIDE', 'fact_transfers') }} t
LEFT JOIN prices p on p.date = date_trunc('day',t.block_timestamp)
WHERE tx_to IN ('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5' -- all the tip payment accounts from: https://jito-foundation.gitbook.io/mev/mev-payment-and-distribution/on-chain-addresses#mainnet
,'HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe'
,'Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY'
,'ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49'
,'DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh'
,'ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt'
,'DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL'
,'3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT')
and t.mint = 'So11111111111111111111111111111111111111111'
{% if is_incremental() %}
AND block_timestamp > (select dateadd('day', -1, max(day)) from {{ this }})
{% endif %}
group by 1
order by 1 desc

0 comments on commit 127f48e

Please sign in to comment.