0xHaM-dStablecoins
    Updated 2023-03-02
    SELECT
    date_trunc('{{Time_Interval}}', BLOCK_TIMESTAMP)::date as date,
    'MakerDAO' as Platform,
    COUNT(DISTINCT TX_HASH) as tx_cnt,
    COUNT(DISTINCT DEPOSITOR) as user_cnt,
    sum(AMOUNT_DEPOSITED) as deposit_amt,
    sum(tx_cnt) over (partition by Platform order by date) as cum_tx_cnt,
    sum(deposit_amt) over (partition by Platform order by date) as cum_deposit_amt
    FROM ethereum.maker.ez_deposits
    WHERE TX_STATUS = 'SUCCESS'
    AND SYMBOL ilike any ('%DAI', '%USDT', '%USDC', '%Stablecoin', '%GUSD', '%LUSD', 'PAX', 'TUSD')
    AND date >= CURRENT_DATE - INTERVAL '{{Past_Weeks}} WEEK'
    GROUP by 1,2

    UNION ALL
    SELECT
    date_trunc('{{Time_Interval}}', BLOCK_TIMESTAMP)::date as date,
    'AAVE' as Platform,
    COUNT(DISTINCT TX_HASH) as tx_cnt,
    COUNT(DISTINCT DEPOSITOR_ADDRESS) as user_cnt,
    sum(SUPPLIED_USD) as deposit_amt,
    sum(tx_cnt) over (partition by Platform order by date) as cum_tx_cnt,
    sum(deposit_amt) over (partition by Platform order by date) as cum_deposit_amt
    FROM ethereum.aave.ez_deposits
    WHERE SYMBOL ilike any ('DAI', 'USDT', 'USDC', '%Stablecoin', 'GUSD', 'LUSD', 'PAX', 'TUSD')
    AND date >= CURRENT_DATE - INTERVAL '{{Past_Weeks}} WEEK'
    GROUP by 1,2
    UNION ALL
    SELECT
    date_trunc('{{Time_Interval}}', BLOCK_TIMESTAMP)::date as date,
    'Compound' as Platform,
    COUNT(DISTINCT TX_HASH) as tx_cnt,
    COUNT(DISTINCT SUPPLIER) as user_cnt,
    Run a query to Download Data