-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from Artemis-xyz/sm-rolling-active-addresses
Adding MAU and WAU
- Loading branch information
Showing
39 changed files
with
757 additions
and
46 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,38 @@ | ||
{% macro cctp_transfers(chain, contract_address, source_domain_id) %} | ||
{% if chain == 'solana' %} | ||
select | ||
block_timestamp, | ||
block_id as block_number, | ||
tx_id as tx_hash, | ||
program_id as contract_address, | ||
PC_DBT_DB.PROD.BASE58_TO_HEX(f.value:data) as hex_data, | ||
PC_DBT_DB.PROD.hex_to_base58(SUBSTRING(hex_data,129,64)) as sender, -- Need to figure out which one is the sender | ||
PC_DBT_DB.PROD.BIG_ENDIAN_HEX_TO_DECIMAL(SUBSTRING(hex_data,33,16)) as nonce, | ||
'0x' || SUBSTRING(hex_data,193,64) as reciepient, | ||
PC_DBT_DB.PROD.BIG_ENDIAN_HEX_TO_DECIMAL(SUBSTRING(hex_data,113,16)) as amount, | ||
PC_DBT_DB.PROD.hex_to_base58(SUBSTRING(hex_data,49,64)) as burn_token, | ||
5 as source_domain_id, | ||
PC_DBT_DB.PROD.BIG_ENDIAN_HEX_TO_DECIMAL(SUBSTRING(hex_data,257,8)) as destination_domain_id | ||
succeeded as status | ||
FROM solana_flipside.core.fact_events, | ||
lateral flatten(input => get_path(inner_instruction, 'instructions')) AS f | ||
where program_id = 'CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3' | ||
and SUBSTRING(hex_data,17,16) = '90fc9192064aa7eb' | ||
{% else %} | ||
select | ||
block_timestamp, | ||
block_number, | ||
tx_hash, | ||
contract_address, | ||
decoded_log:depositor::string as sender, | ||
decoded_log:amount::number as nonce, | ||
decoded_log:mintRecipient::string as reciepient, | ||
decoded_log:amount::number as amount, | ||
decoded_log:burnToken::string as burn_token, | ||
{{ source_domain_id }} as source_domain_id, | ||
decoded_log:destinationDomain::number as destination_domain_id , | ||
tx_status as status | ||
from {{ chain }}_flipside.core.ez_decoded_event_logs | ||
where lower(contract_address) = lower('{{ contract_address }}') and event_name in ('DepositForBurn') | ||
{% endif %} | ||
{% endmacro %} |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
{% macro get_rolling_active_address_metrics(chain) %} | ||
select | ||
date, | ||
mau, | ||
wau | ||
from {{ref("fact_" ~ chain ~ "_rolling_active_addresses")}} | ||
{% endmacro %} |
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 @@ | ||
{% macro rolling_active_addresses(chain) %} | ||
with | ||
{% if chain == 'solana' %} | ||
distinct_dates as ( | ||
select distinct | ||
raw_date | ||
from {{ chain }}.prod_raw.ez_transactions | ||
where succeeded = 'TRUE' | ||
{% if is_incremental() %} | ||
and raw_date > (select dateadd('day', -1, max(date)) from {{ this }}) | ||
{% endif %} | ||
), | ||
distinct_dates_for_rolling_active_address as ( | ||
select distinct | ||
raw_date, | ||
value as from_address | ||
from {{ chain }}.prod_raw.ez_transactions, lateral flatten(input => signers) | ||
where succeeded = 'TRUE' | ||
), | ||
{% else %} | ||
distinct_dates as ( | ||
select distinct | ||
raw_date | ||
from {{ chain }}.prod_raw.ez_transactions | ||
{% if is_incremental() %} | ||
where raw_date > (select dateadd('day', -1, max(date)) from {{ this }}) | ||
{% endif %} | ||
), | ||
distinct_dates_for_rolling_active_address as ( | ||
select distinct | ||
raw_date, | ||
from_address | ||
from {{ chain }}.prod_raw.ez_transactions | ||
), | ||
{% endif %} | ||
|
||
|
||
rolling_mau as ( | ||
select | ||
t1.raw_date, | ||
count(distinct t2.from_address) as mau | ||
from distinct_dates t1 | ||
join distinct_dates_for_rolling_active_address t2 on t2.raw_date between dateadd(DAY, -29, t1.raw_date) and t1.raw_date | ||
group by t1.raw_date | ||
), | ||
rolling_wau as ( | ||
select | ||
t1.raw_date, | ||
count(distinct t2.from_address) as wau | ||
from distinct_dates t1 | ||
join distinct_dates_for_rolling_active_address t2 on t2.raw_date between dateadd(DAY, -6, t1.raw_date) and t1.raw_date | ||
group by t1.raw_date | ||
) | ||
select | ||
rolling_mau.raw_date as date, | ||
'{{ chain }}' as chain, | ||
mau, | ||
wau | ||
from rolling_mau | ||
left join rolling_wau using(raw_date) | ||
where rolling_mau.raw_date < to_date(sysdate()) | ||
order by date | ||
{% endmacro %} |
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
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
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
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
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
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
Oops, something went wrong.