Skip to content

Commit

Permalink
Wormhole: EZ metrics + Txns (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwes authored Sep 6, 2024
1 parent d803096 commit 9e15f71
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
29 changes: 29 additions & 0 deletions models/projects/wormhole/core/ez_wormhole_metrics.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{ config(
materialized="table",
warehouse="WORMHOLE",
database="WORMHOLE",
schema="CORE",
alias="ez_metrics"
) }}

with txns as (
select
date,
txns
from {{ ref("fact_wormhole_txns") }}
)
, daa as (
select
date,
bridge_daa
from {{ ref("fact_wormhole_bridge_daa_gold") }}
)

select
coalesce(txns.date, daa.date) as date,
coalesce(txns.txns, 0) as txns,
coalesce(daa.bridge_daa, 0) as bridge_daa,
0 as fees
from txns
left join daa on txns.date = daa.date
where coalesce(txns.date, daa.date) < to_date(sysdate())
12 changes: 12 additions & 0 deletions models/staging/wormhole/fact_wormhole_txns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{ config(materialized="table") }}


select
date(timestamp) as date,
count(distinct(id)) as txns
from
{{ ref("fact_wormhole_transfers") }}
group by
1
order by
1 desc

0 comments on commit 9e15f71

Please sign in to comment.