Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

CREATE MATERIALIZED VIEW book_nft_delta_time_bucket_7d
WITH (timescaledb.continuous) AS
SELECT
SELECT
nft_class_address || '_' || time_bucket(INTERVAL '7 day', datetime) as id,
nft_class_address as evm_address,
time_bucket(INTERVAL '7 day', datetime) AS bucket,
sum(staked_amount_added) as staked_amount,
max(datetime) as last_staked_at,
count(distinct nft_class_address) as number_of_stakers
count(distinct account_evm_address) as number_of_stakers
FROM staking_events_hyper_table
WHERE event_type = 'staked'
GROUP BY nft_class_address, bucket;
Expand All @@ -33,7 +33,7 @@ SELECT
time_bucket(INTERVAL '30 day', datetime) AS bucket,
sum(staked_amount_added) as staked_amount,
max(datetime) as last_staked_at,
count(distinct nft_class_address) as number_of_stakers
count(distinct account_evm_address) as number_of_stakers
FROM staking_events_hyper_table
WHERE event_type = 'staked'
GROUP BY nft_class_address, bucket;
Expand All @@ -58,7 +58,7 @@ SELECT
time_bucket(INTERVAL '1 year', datetime) AS bucket,
sum(staked_amount_added) as staked_amount,
max(datetime) as last_staked_at,
count(distinct nft_class_address) as number_of_stakers
count(distinct account_evm_address) as number_of_stakers
FROM staking_events_hyper_table
WHERE event_type = 'staked'
GROUP BY nft_class_address, bucket;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SELECT
time_bucket(INTERVAL '7 day', datetime) AS bucket,
sum(staked_amount_added) as staked_amount,
max(datetime) as last_staked_at,
count(distinct nft_class_address) as number_of_stakers
count(distinct account_evm_address) as number_of_stakers
FROM staking_events_hyper_table
WHERE event_type = 'staked'
GROUP BY nft_class_address, bucket;
Expand All @@ -33,7 +33,7 @@ SELECT
time_bucket(INTERVAL '30 day', datetime) AS bucket,
sum(staked_amount_added) as staked_amount,
max(datetime) as last_staked_at,
count(distinct nft_class_address) as number_of_stakers
count(distinct account_evm_address) as number_of_stakers
FROM staking_events_hyper_table
WHERE event_type = 'staked'
GROUP BY nft_class_address, bucket;
Expand All @@ -58,7 +58,7 @@ SELECT
time_bucket(INTERVAL '1 year', datetime) AS bucket,
sum(staked_amount_added) as staked_amount,
max(datetime) as last_staked_at,
count(distinct nft_class_address) as number_of_stakers
count(distinct account_evm_address) as number_of_stakers
FROM staking_events_hyper_table
WHERE event_type = 'staked'
GROUP BY nft_class_address, bucket;
Expand Down
Loading