theericstoneUSDT DeFi vs Other Balances
    Updated 2021-01-21
    select
    balance_date,
    CASE
    WHEN label_subtype IN('distributor_dex',
    'project_token_contract',
    'project_contract',
    'distributor_dex_balancer')
    OR (label = 'uniswap'
    AND label_subtype = 'project_other')
    OR (label = 'sushiswap'
    AND label_subtype = 'project_other')
    OR label IN ('curve','curve fi','aave','Compound','Compound USDT','compound',
    'yearn','yearn finance','yearn finance protocol','synthetic network token')
    THEN 'Defi'
    WHEN label_subtype IN ('distributor_cex','distributor_cex_satellite') THEN 'CEXes'
    ELSE 'Other/Users'
    END as defi,
    sum(balance) as total_value
    from gold.ethereum_erc20_balances
    where balance_date > getdate() - INTERVAL '1 month'
    and contract_address = '0xdac17f958d2ee523a2206206994597c13d831ec7'--USDT
    and user_address <> '0x0000000000000000000000000000000000000000'
    GROUP BY 1, 2
    ORDER BY 1 desc;
    Run a query to Download Data