sunslingerxMETRIC Leaderboard (v2) copy
    Updated 2023-02-23
    -- forked from c5bc6986-297b-4524-be14-a9a9c3d313b5

    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 > '2022-07-10'::date
    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 > '2022-07-10'::date
    and contract_address = lower('0x15848C9672e99be386807b9101f83A16EB017bb5')
    and to_address = lower('0x0000000000000000000000000000000000000000')
    group by 1
    order by 2 desc)


    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


    Run a query to Download Data