binhachonAnchor Emissions (Hard Mode)
    Updated 2022-02-20
    with claim_transactions as (
    select
    distinct tx_id
    from terra.msgs
    where block_timestamp::date > getdate() - interval'6 months'
    -- where tx_id = 'CD3F21D5411823D3F75096C6B68F6143FE218841C6FD55DF0737740E8F3EB18A'
    and msg_value:contract::string = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s'
    and msg_value:execute_msg:claim_rewards is not null
    ),
    claim_amount as (
    select
    block_timestamp,
    event_attributes:to::string as receiver,
    event_attributes:claim_amount::float/1e6 as claim_amount
    from terra.msg_events
    where block_timestamp::date > getdate() - interval'6 months'
    and tx_id in (select tx_id from claim_transactions)
    and event_type = 'from_contract'
    and event_attributes:"2_contract_address"::string = 'terra14z56l0fp2lsf86zy3hty2z47ezkhnthtr9yq76' -- ANC token
    )
    select
    date_trunc('week', block_timestamp) as blocktime,
    count(distinct receiver),
    sum(claim_amount) as claimed_amount
    from claim_amount
    group by blocktime






    Run a query to Download Data