flyingfishBACKUP - OpenSea Polygon Fees By Payment Token
    Updated 2022-07-28
    /*
    Polygon
    Opensea Fees
    Q6. Find the wallet that collects Opensea fees.
    Make a dashboard showing how much Opensea has earned through Polygon transactions.
    */
    with cte as (
    SELECT
    contract_address as payment_token_address,
    --block_timestamp,
    --date_trunc('day', block_timestamp) as date,
    count(1) as trades,
    --tx_hash,
    --origin_function_signature,
    --origin_from_address,
    --origin_to_address,
    --contract_address,
    --event_inputs:to,
    --event_inputs:value,
    sum(event_inputs:value / pow(10,18)) as fees
    --event_inputs:value / pow(10,18) as fee,
    FROM polygon.core.fact_event_logs
    WHERE block_timestamp > '2022-01-01'
    AND event_name = 'Transfer'
    AND event_inputs:to = lower('0x8de9c5a032463c561423387a9648c5c7bcc5bc90')
    GROUP BY contract_address
    --order by contract_address
    --order by fee DESC
    --limit 10
    )
    SELECT
    CASE
    WHEN cte.payment_token_address = '0x70c006878a5a50ed185ac4c87d837633923de296' THEN 'REVV'
    WHEN cte.payment_token_address = '0xfae400bf04f88e47d899cfe7e7c16bf8c8ae919b' THEN 'Pikatic'
    WHEN cte.payment_token_address = '0xb6c3c00d730acca326db40e418353f04f7444e2b' THEN 'First Choice Coin'
    WHEN cte.payment_token_address = '0x0f1f17e4260515d9bfe805cff323374eb771eae6' THEN 'Rickogon'
    Run a query to Download Data