-
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
1 parent
dd34d06
commit 4712530
Showing
4 changed files
with
73 additions
and
1 deletion.
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
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,13 @@ | ||
{{ | ||
config( | ||
materialized="view", | ||
snowflake_warehouse="CELO", | ||
database="celo", | ||
schema="raw", | ||
alias="ez_transactions", | ||
) | ||
}} | ||
|
||
select | ||
* | ||
from {{ref("fact_celo_transactions")}} |
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 |
---|---|---|
@@ -1,3 +1,23 @@ | ||
{{ config(materialized="incremental", unique_key=["transaction_hash", "event_index"]) }} | ||
with | ||
prices as ({{get_multiple_coingecko_price_with_latest('celo')}}) | ||
, celo_token_transfers as ({{ token_transfer_events("celo") }}) | ||
select | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
event_index, | ||
origin_from_address, | ||
origin_to_address, | ||
celo_token_transfers.contract_address, | ||
from_address, | ||
to_address, | ||
amount, | ||
amount / pow(10, decimals) as amount_adjusted, | ||
amount_adjusted * price as amount_usd, | ||
tx_status | ||
from celo_token_transfers | ||
left join prices | ||
on block_timestamp::date = prices.date | ||
and lower(celo_token_transfers.contract_address) = lower(prices.contract_address) | ||
|
||
{{ token_transfer_events("celo") }} |
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,21 @@ | ||
{{config(materialized="view")}} | ||
with | ||
max_extraction as ( | ||
select max(extraction_date) as max_date | ||
from {{ source("PROD_LANDING", "raw_coingecko_token_metadata") }} | ||
) | ||
select | ||
parse_json(source_json) as json, | ||
json:id::string AS coingecko_token_id, | ||
json:symbol::string AS symbol, | ||
--TODO: Right now chains are coingecko chains, we need to map them to our chains | ||
f.key::string AS chain, | ||
f.value:contract_address::string AS contract_address, | ||
f.value:decimal_place::number AS decimals | ||
from {{ source("PROD_LANDING", "raw_coingecko_token_metadata") }}, | ||
lateral flatten(input => parse_json(source_json):detail_platforms) f | ||
where extraction_date = (select max_date from max_extraction) and ( | ||
chain <> '' and chain is not null | ||
and contract_address <> '' and chain is not null | ||
and decimals is not null | ||
) |