CryptoLionMIR staking rewards grouped by whale
    Updated 2021-08-17
    SELECT
    -- date_trunc('day',m.block_timestamp) as day,
    -- m.tx_id,
    m.msg_value:sender::string as u_address,
    sum(event_attributes:"1_amount"::float/POW(10,6)) as amount
    -- event_attributes:"0_action"::string as action
    FROM terra.msgs m
    INNER JOIN terra.msg_events me on m.tx_id = me.tx_id
    WHERE
    -- m.tx_id = '1DB3395685CF54199E299AF306A06B89578D422BF1E3657002DFFD7BFE3DC4A4' --reward claim tx
    msg_value:contract::string = 'terra17f7zu97865jmknk7p2glqvxzhduk78772ezac5' --MIR staking address
    AND msg_value:execute_msg:withdraw = '{}' --claim
    AND event_attributes:"0_action" LIKE 'withdra%'
    AND event_index = 1
    AND m.block_timestamp >= getdate() - interval '1 month'
    AND event_attributes:"1_amount"::float/POW(10,6) <> 0
    GROUP BY 1
    HAVING amount > 50000
    ORDER BY 2 DESC

    Run a query to Download Data