-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |