From 38a9b639644f8e9d2c629d7c5f7eba160efb5411 Mon Sep 17 00:00:00 2001 From: SebMelendez01 <78228475+SebMelendez01@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:45:23 -0600 Subject: [PATCH] Stablecoins: Add Token Holders (#567) --- macros/stablecoins/stablecoin_breakdown.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macros/stablecoins/stablecoin_breakdown.sql b/macros/stablecoins/stablecoin_breakdown.sql index bc06a578..c57a2d11 100644 --- a/macros/stablecoins/stablecoin_breakdown.sql +++ b/macros/stablecoins/stablecoin_breakdown.sql @@ -29,6 +29,10 @@ select when sum(p2p_stablecoin_daily_txns) > 0 then sum(p2p_stablecoin_transfer_volume) / sum(p2p_stablecoin_daily_txns) else 0 end as p2p_stablecoin_avg_txn_value + {% if granularity == 'day' and (breakdown == ['symbol'] or breakdown == ['chain']) %} + , count(distinct case when stablecoin_supply > 0 then from_address end) as stablecoin_token_holder_count + , count(distinct case when is_wallet::number = 1 and stablecoin_supply > 0 then from_address end) as p2p_stablecoin_token_holder_count + {% endif %} {% if granularity == 'day' %} , sum(stablecoin_supply) as stablecoin_supply , sum(case when is_wallet::number = 1 then stablecoin_supply else 0 end) as p2p_stablecoin_supply