jackguyTERRA apollo 6
    Updated 2023-03-22
    with tab1 as (
    SELECT --*,
    attributes:instantiate['_contract_address'] as multisig
    -- date_trunc('week', block_timestamp) as week,
    -- CASE WHEN message_value:msg:voters[1] is NULL THEN 'Multisig of 1'
    -- WHEN message_value:msg:voters[2] is NULL then 'Multisig of 2'
    -- WHEN message_value:msg:voters[3] is NULL then 'Multisig of 3'
    -- WHEN message_value:msg:voters[4] is NULL then 'Multisig of 4'
    -- WHEN message_value:msg:voters[5] is NULL then 'Multisig of 5'
    -- WHEN message_value:msg:voters[6] is NULL then 'Multisig of 6'
    -- WHEN message_value:msg:voters[7] is NULL then 'Multisig of 7'
    -- WHEN message_value:msg:voters[8] is NULL then 'Multisig of 8'
    -- ELSE 'Multisig of 9+' END as ms_type,
    -- attributes:message:sender
    FROM terra.core.fact_messages
    WHERE not message_value:msg:max_voting_period is NULL
    )

    SELECT
    -- date_trunc('day', block_timestamp) as day,
    -- currency,
    sum(amount/power(10,6)),
    avg(amount/power(10,6)),
    count(*)
    from terra.core.ez_transfers
    WHERE (SENDER in (SELECT multisig FROM tab1)
    OR RECEIVER in (SELECT multisig FROM tab1))
    and currency LIKE 'uluna'
    --GROUP BY 1,2
    --LIMIT 100

    Run a query to Download Data