-
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.
Merge branch 'main' into sm-frax-ez-metrics
- Loading branch information
Showing
56 changed files
with
906 additions
and
0 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
models/projects/pancakeswap/core/ez_pancakeswap_metrics_by_chain.sql
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,77 @@ | ||
{{ | ||
config( | ||
materialized="table", | ||
snowflake_warehouse="PANCAKESWAP_SM", | ||
database="pancakeswap", | ||
schema="core", | ||
alias="ez_metrics_by_chain", | ||
) | ||
}} | ||
|
||
with | ||
trading_volume_by_pool as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("fact_pancakeswap_v2_arbitrum_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v2_base_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v2_bsc_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v2_ethereum_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v3_arbitrum_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v3_base_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v3_bsc_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v3_ethereum_trading_vol_fees_traders_by_pool"), | ||
], | ||
) | ||
}} | ||
), | ||
trading_volume_by_chain as ( | ||
select | ||
trading_volume_by_pool.date, | ||
trading_volume_by_pool.chain, | ||
sum(trading_volume_by_pool.trading_volume) as trading_volume, | ||
sum(trading_volume_by_pool.trading_fees) as trading_fees, | ||
sum(trading_volume_by_pool.unique_traders) as unique_traders, | ||
sum(trading_volume_by_pool.gas_cost_native) as gas_cost_native, | ||
sum(trading_volume_by_pool.gas_cost_usd) as gas_cost_usd | ||
from trading_volume_by_pool | ||
group by trading_volume_by_pool.date, trading_volume_by_pool.chain | ||
), | ||
tvl_by_pool as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("fact_pancakeswap_v2_arbitrum_tvl_by_pool"), | ||
ref("fact_pancakeswap_v2_base_tvl_by_pool"), | ||
ref("fact_pancakeswap_v2_bsc_tvl_by_pool"), | ||
ref("fact_pancakeswap_v2_ethereum_tvl_by_pool"), | ||
ref("fact_pancakeswap_v3_arbitrum_tvl_by_pool"), | ||
ref("fact_pancakeswap_v3_base_tvl_by_pool"), | ||
ref("fact_pancakeswap_v3_bsc_tvl_by_pool"), | ||
ref("fact_pancakeswap_v3_ethereum_tvl_by_pool"), | ||
], | ||
) | ||
}} | ||
), | ||
tvl_by_chain as ( | ||
select | ||
tvl_by_pool.date, | ||
tvl_by_pool.chain, | ||
sum(tvl_by_pool.tvl) as tvl | ||
from tvl_by_pool | ||
group by tvl_by_pool.date, tvl_by_pool.chain | ||
) | ||
select | ||
tvl_by_chain.date, | ||
'pancakeswap' as app, | ||
'DeFi' as category, | ||
tvl_by_chain.chain, | ||
tvl_by_chain.tvl, | ||
trading_volume_by_chain.trading_volume, | ||
trading_volume_by_chain.trading_fees, | ||
trading_volume_by_chain.unique_traders, | ||
trading_volume_by_chain.gas_cost_native, | ||
trading_volume_by_chain.gas_cost_usd | ||
from tvl_by_chain | ||
left join trading_volume_by_chain using(date, chain) | ||
where tvl_by_chain.date < to_date(sysdate()) |
63 changes: 63 additions & 0 deletions
63
models/projects/pancakeswap/core/ez_pancakeswap_metrics_by_pool.sql
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,63 @@ | ||
{{ | ||
config( | ||
materialized="table", | ||
snowflake_warehouse="PANCAKESWAP_SM", | ||
database="pancakeswap", | ||
schema="core", | ||
alias="ez_metrics_by_pool", | ||
) | ||
}} | ||
|
||
with | ||
trading_volume_pool as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("fact_pancakeswap_v2_arbitrum_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v2_base_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v2_bsc_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v2_ethereum_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v3_arbitrum_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v3_base_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v3_bsc_trading_vol_fees_traders_by_pool"), | ||
ref("fact_pancakeswap_v3_ethereum_trading_vol_fees_traders_by_pool"), | ||
], | ||
) | ||
}} | ||
), | ||
tvl_by_pool as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("fact_pancakeswap_v2_arbitrum_tvl_by_pool"), | ||
ref("fact_pancakeswap_v2_base_tvl_by_pool"), | ||
ref("fact_pancakeswap_v2_bsc_tvl_by_pool"), | ||
ref("fact_pancakeswap_v2_ethereum_tvl_by_pool"), | ||
ref("fact_pancakeswap_v3_arbitrum_tvl_by_pool"), | ||
ref("fact_pancakeswap_v3_base_tvl_by_pool"), | ||
ref("fact_pancakeswap_v3_bsc_tvl_by_pool"), | ||
ref("fact_pancakeswap_v3_ethereum_tvl_by_pool"), | ||
], | ||
) | ||
}} | ||
) | ||
select | ||
tvl_by_pool.date, | ||
'pancakeswap' as app, | ||
'DeFi' as category, | ||
tvl_by_pool.chain, | ||
tvl_by_pool.version, | ||
tvl_by_pool.pool, | ||
tvl_by_pool.token_0, | ||
tvl_by_pool.token_0_symbol, | ||
tvl_by_pool.token_1, | ||
tvl_by_pool.token_1_symbol, | ||
tvl_by_pool.tvl, | ||
trading_volume_pool.trading_volume, | ||
trading_volume_pool.trading_fees, | ||
trading_volume_pool.unique_traders, | ||
trading_volume_pool.gas_cost_native, | ||
trading_volume_pool.gas_cost_usd | ||
from tvl_by_pool | ||
left join trading_volume_pool using(date, chain, version, pool) | ||
where tvl_by_pool.date < to_date(sysdate()) |
46 changes: 46 additions & 0 deletions
46
models/projects/pancakeswap/raw/ez_pancakeswap_dex_swaps.sql
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,46 @@ | ||
{{ | ||
config( | ||
materialized="table", | ||
snowflake_warehouse="PANCAKESWAP_SM", | ||
database="pancakeswap", | ||
schema="raw", | ||
alias="ez_dex_swaps", | ||
) | ||
}} | ||
|
||
with | ||
dex_swaps as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("fact_pancakeswap_v2_arbitrum_dex_swaps"), | ||
ref("fact_pancakeswap_v2_base_dex_swaps"), | ||
ref("fact_pancakeswap_v2_bsc_dex_swaps"), | ||
ref("fact_pancakeswap_v2_ethereum_dex_swaps"), | ||
ref("fact_pancakeswap_v3_arbitrum_dex_swaps"), | ||
ref("fact_pancakeswap_v3_base_dex_swaps"), | ||
ref("fact_pancakeswap_v3_bsc_dex_swaps"), | ||
ref("fact_pancakeswap_v3_ethereum_dex_swaps"), | ||
], | ||
) | ||
}} | ||
) | ||
select | ||
dex_swaps.block_timestamp, | ||
'pancakeswap' as app, | ||
'DeFi' as category, | ||
dex_swaps.chain, | ||
dex_swaps.version, | ||
dex_swaps.tx_hash, | ||
dex_swaps.sender, | ||
dex_swaps.recipient, | ||
dex_swaps.pool, | ||
dex_swaps.token_0, | ||
dex_swaps.token_0_symbol, | ||
dex_swaps.token_1, | ||
dex_swaps.token_1_symbol, | ||
dex_swaps.trading_volume, | ||
dex_swaps.trading_fees, | ||
dex_swaps.gas_cost_native, | ||
from dex_swaps | ||
where dex_swaps.block_timestamp::date < to_date(sysdate()) |
45 changes: 45 additions & 0 deletions
45
models/projects/quickswap/core/ez_quickswap_metrics_by_chain.sql
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,45 @@ | ||
{{ | ||
config( | ||
materialized="table", | ||
snowflake_warehouse="QUICKSWAP", | ||
database="quickswap", | ||
schema="core", | ||
alias="ez_metrics_by_chain", | ||
) | ||
}} | ||
|
||
with | ||
trading_volume_by_chain as ( | ||
select | ||
trading_volume_by_pool.date, | ||
trading_volume_by_pool.chain, | ||
sum(trading_volume_by_pool.trading_volume) as trading_volume, | ||
sum(trading_volume_by_pool.trading_fees) as trading_fees, | ||
sum(trading_volume_by_pool.unique_traders) as unique_traders, | ||
sum(trading_volume_by_pool.gas_cost_native) as gas_cost_native, | ||
sum(trading_volume_by_pool.gas_cost_usd) as gas_cost_usd | ||
from ref("fact_quickswap_polygon_trading_vol_fees_traders_by_pool") | ||
group by trading_volume_by_pool.date, trading_volume_by_pool.chain | ||
), | ||
tvl_by_chain as ( | ||
select | ||
tvl_by_pool.date, | ||
tvl_by_pool.chain, | ||
sum(tvl_by_pool.tvl) as tvl | ||
from ref("fact_quickswap_polygon_tvl_by_pool") | ||
group by tvl_by_pool.date, tvl_by_pool.chain | ||
) | ||
select | ||
tvl_by_chain.date, | ||
'quickswap' as app, | ||
'DeFi' as category, | ||
tvl_by_chain.chain, | ||
tvl_by_chain.tvl, | ||
trading_volume_by_chain.trading_volume, | ||
trading_volume_by_chain.trading_fees, | ||
trading_volume_by_chain.unique_traders, | ||
trading_volume_by_chain.gas_cost_native, | ||
trading_volume_by_chain.gas_cost_usd | ||
from tvl_by_chain | ||
left join trading_volume_by_chain using(date, chain) | ||
where tvl_by_chain.date < to_date(sysdate()) |
39 changes: 39 additions & 0 deletions
39
models/projects/quickswap/core/ez_quickswap_metrics_by_pool.sql
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="table", | ||
snowflake_warehouse="QUICKSWAP", | ||
database="quickswap", | ||
schema="core", | ||
alias="ez_metrics_by_pool", | ||
) | ||
}} | ||
|
||
with | ||
trading_volume_pool as ( | ||
select * | ||
from ref("fact_quickswap_polygon_trading_vol_fees_traders_by_pool") | ||
), | ||
tvl_by_pool as ( | ||
select * | ||
from ref("fact_quickswap_polygon_tvl_by_pool") | ||
) | ||
select | ||
tvl_by_pool.date, | ||
'quickswap' as app, | ||
'DeFi' as category, | ||
tvl_by_pool.chain, | ||
tvl_by_pool.version, | ||
tvl_by_pool.pool, | ||
tvl_by_pool.token_0, | ||
tvl_by_pool.token_0_symbol, | ||
tvl_by_pool.token_1, | ||
tvl_by_pool.token_1_symbol, | ||
tvl_by_pool.tvl, | ||
trading_volume_pool.trading_volume, | ||
trading_volume_pool.trading_fees, | ||
trading_volume_pool.unique_traders, | ||
trading_volume_pool.gas_cost_native, | ||
trading_volume_pool.gas_cost_usd | ||
from tvl_by_pool | ||
left join trading_volume_pool using(date, chain, version, pool) | ||
where tvl_by_pool.date < to_date(sysdate()) |
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,34 @@ | ||
{{ | ||
config( | ||
materialized="table", | ||
snowflake_warehouse="QUICKSWAP", | ||
database="quickswap", | ||
schema="raw", | ||
alias="ez_dex_swaps", | ||
) | ||
}} | ||
|
||
with | ||
dex_swaps as ( | ||
select * | ||
from {{ ref("fact_quickswap_polygon_dex_swaps") }} | ||
) | ||
select | ||
dex_swaps.block_timestamp, | ||
'quickswap' as app, | ||
'DeFi' as category, | ||
dex_swaps.chain, | ||
dex_swaps.version, | ||
dex_swaps.tx_hash, | ||
dex_swaps.sender, | ||
dex_swaps.recipient, | ||
dex_swaps.pool, | ||
dex_swaps.token_0, | ||
dex_swaps.token_0_symbol, | ||
dex_swaps.token_1, | ||
dex_swaps.token_1_symbol, | ||
dex_swaps.trading_volume, | ||
dex_swaps.trading_fees, | ||
dex_swaps.gas_cost_native, | ||
from dex_swaps | ||
where dex_swaps.block_timestamp::date < to_date(sysdate()) |
65 changes: 65 additions & 0 deletions
65
models/projects/trader_joe/core/ez_trader_joe_metrics_by_chain.sql
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,65 @@ | ||
{{ | ||
config( | ||
materialized="table", | ||
snowflake_warehouse="TRADER_JOE", | ||
database="trader_joe", | ||
schema="core", | ||
alias="ez_metrics_by_chain", | ||
) | ||
}} | ||
|
||
with | ||
trading_volume_by_pool as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("fact_trader_joe_arbitrum_trading_vol_fees_traders_by_pool"), | ||
ref("fact_trader_joe_avalanche_trading_vol_fees_traders_by_pool"), | ||
], | ||
) | ||
}} | ||
), | ||
trading_volume_by_chain as ( | ||
select | ||
trading_volume_by_pool.date, | ||
trading_volume_by_pool.chain, | ||
sum(trading_volume_by_pool.trading_volume) as trading_volume, | ||
sum(trading_volume_by_pool.trading_fees) as trading_fees, | ||
sum(trading_volume_by_pool.unique_traders) as unique_traders, | ||
sum(trading_volume_by_pool.gas_cost_native) as gas_cost_native, | ||
sum(trading_volume_by_pool.gas_cost_usd) as gas_cost_usd | ||
from trading_volume_by_pool | ||
group by trading_volume_by_pool.date, trading_volume_by_pool.chain | ||
), | ||
tvl_by_pool as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("fact_trader_joe_avalanche_tvl_by_pool"), | ||
ref("fact_trader_joe_arbitrum_tvl_by_pool"), | ||
], | ||
) | ||
}} | ||
), | ||
tvl_by_chain as ( | ||
select | ||
tvl_by_pool.date, | ||
tvl_by_pool.chain, | ||
sum(tvl_by_pool.tvl) as tvl | ||
from tvl_by_pool | ||
group by tvl_by_pool.date, tvl_by_pool.chain | ||
) | ||
select | ||
tvl_by_chain.date, | ||
'trader_joe' as app, | ||
'DeFi' as category, | ||
tvl_by_chain.chain, | ||
tvl_by_chain.tvl, | ||
trading_volume_by_chain.trading_volume, | ||
trading_volume_by_chain.trading_fees, | ||
trading_volume_by_chain.unique_traders, | ||
trading_volume_by_chain.gas_cost_native, | ||
trading_volume_by_chain.gas_cost_usd | ||
from tvl_by_chain | ||
left join trading_volume_by_chain using(date, chain) | ||
where tvl_by_chain.date < to_date(sysdate()) |
Oops, something went wrong.