SandeshxMetric top last week
    Updated 2022-10-11
    with sent_tokens as
    (select
    to_address as Participant,
    sum(raw_amount/pow(10,18)) as xMETRIC
    from
    polygon.core.fact_token_transfers
    where block_timestamp::date > CURRENT_DATE - interval ' 1 {{timeframe}}'
    and contract_address = lower('0x15848C9672e99be386807b9101f83A16EB017bb5')
    and to_address != lower('0x4b8923746a1D9943bbd408F477572762801efE4d')
    group by 1
    order by 2 desc),

    burnt_tokens as

    (select
    to_address as Participant,
    sum(raw_amount/pow(10,18)) as xMETRIC
    from
    polygon.core.fact_token_transfers
    where block_timestamp::date > CURRENT_DATE - interval ' 1 {{timeframe}}'
    and contract_address = lower('0x15848C9672e99be386807b9101f83A16EB017bb5')
    and to_address = lower('0x0000000000000000000000000000000000000000')
    group by 1
    order by 2 desc),
    results as (
    select
    sent_tokens.Participant as "Participant",
    coalesce(sent_tokens.xmetric,0) - coalesce(burnt_tokens.xMETRIC,0) as "xMETRIC Balance"
    from
    sent_tokens left join burnt_tokens on sent_tokens.Participant = burnt_tokens.Participant
    order by 2 desc
    )
    select
    concat(substr("Participant",0,3),'...',substr("Participant",36,8)) as "Participant",
    "xMETRIC Balance"
    Run a query to Download Data