John_GaltAstro Claimed by Date and Address
    Updated 2022-04-19
    with table1 as (select
    date(block_timestamp) as date,
    case
    when event_attributes:from = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' then event_attributes:to
    when event_attributes:"0_from" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' then event_attributes:"0_to"
    when event_attributes:"1_from" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' then event_attributes:"1_to"
    when event_attributes:"2_from" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' then event_attributes:"2_to"
    when event_attributes:"3_from" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' then event_attributes:"3_to"
    when event_attributes:"4_from" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' then event_attributes:"4_to"
    end as address,
    event_attributes:available_amount / pow(10, 6) as remaining,
    event_attributes:claimed_amount / pow(10, 6) as claimed
    from terra.msg_events
    where date(block_timestamp) > '2021-12-01'
    and
    ((event_attributes:"0_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"0_action" = 'claim') or
    (event_attributes:"1_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"1_action" = 'claim') or
    (event_attributes:"2_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"2_action" = 'claim') or
    (event_attributes:"3_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"3_action" = 'claim') or
    (event_attributes:"4_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"4_action" = 'claim') or
    (event_attributes:"5_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"5_action" = 'claim') or
    (event_attributes:"6_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"6_action" = 'claim') or
    (event_attributes:"7_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"7_action" = 'claim') or
    (event_attributes:"8_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"8_action" = 'claim') or
    (event_attributes:"9_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"9_action" = 'claim') or
    (event_attributes:"10_contract_address" = 'terra1hncazf652xa0gpcwupxfj6k4kl4k4qg64yzjyf' and event_attributes:"10_action" = 'claim'))
    and event_index = 3
    order by date
    ),

    by_date as (select date, sum(claimed) as claimed
    from table1
    group by date
    ),

    by_address as (select address, sum(claimed) as claimed
    Run a query to Download Data