Abbas_ra21cosmos #1
    Updated 2022-12-14
    SELECT
    date_trunc("month",BLOCK_TIMESTAMP) AS month,
    sum(case when MSG_TYPE='redelegate' and ATTRIBUTE_KEY='amount' then
    split(attribute_value,'uatom')[0]::numeric / pow(10,6) end) AS "Redelegate Amount",
    sum(case when MSG_TYPE='unbond' and ATTRIBUTE_KEY='amount' then
    split(attribute_value,'uatom')[0]::numeric / pow(10,6) end) AS "Undelegate Amount",
    sum(case when MSG_TYPE='delegate' and ATTRIBUTE_KEY='amount' then
    split(attribute_value,'uatom')[0]::numeric / pow(10,6) end) AS "delegate Amount"
    FROM
    cosmos.core.fact_msg_attributes
    group by 1
    Run a query to Download Data