Query editor
/* ===================================================EXHIBIT: sample and stablecoin use by country (paper Table 1 and theattrition appendix), from dune.boc.result_wallet_master.The same numbers can be computed in Python from the downloadedwallet_master CSV (group by country).=================================================== */SELECTcountry,COUNT(*) AS linked,COUNT_IF(dropped_at = 'institutional') AS drop_institutional,COUNT_IF(dropped_at IN ('activity', 'size', 'contract')) AS drop_activity_size_contract,COUNT_IF(dropped_at IS NULL OR dropped_at IN ('never_held', 'velocity', 'transfers')) AS pass_screens,COUNT_IF(stablecoin_user) AS holders,COUNT_IF(pass_through) AS pass_through,COUNT_IF(dropped_at = 'velocity') AS drop_velocity,COUNT_IF(dropped_at = 'transfers') AS drop_transfers,COUNT_IF(in_sample) AS main_sample,COUNT_IF(persistent_gdp) AS persistent,-- shares of wallets passing the screensROUND(100.0 * (COUNT_IF(stablecoin_user) + COUNT_IF(pass_through))/ COUNT_IF(dropped_at IS NULL OR dropped_at IN ('never_held', 'velocity', 'transfers')), 1) AS pct_ever_touched,ROUND(100.0 * COUNT_IF(stablecoin_user)/ COUNT_IF(dropped_at IS NULL OR dropped_at IN ('never_held', 'velocity', 'transfers')), 1) AS pct_holders,ROUND(100.0 * COUNT_IF(pass_through)/ COUNT_IF(dropped_at IS NULL OR dropped_at IN ('never_held', 'velocity', 'transfers')), 1) AS pct_pass_through,-- share of the main sampleROUND(100.0 * COUNT_IF(persistent_gdp) / NULLIF(COUNT_IF(in_sample), 0), 1) AS pct_persistent,ROUND(100.0 * COUNT_IF(in_sample AND NOT is_direct) / NULLIF(COUNT_IF(in_sample), 0), 1) AS pct_two_hop_only,ROUND(100.0 * COUNT_IF(in_sample AND n_countries > 1) / NULLIF(COUNT_IF(in_sample), 0), 1) AS pct_multi_country,MAX(threshold_usd) AS holding_threshold_usdFROM dune.boc.result_wallet_masterGROUP BY countryORDER BY main_sample DESC