rajsThakes Sell Ranged Markets
    Updated 2022-09-06
    SELECT
    date_trunc('day', block_timestamp) as date,
    sum(susd_paid) as volume
    from
    (
    SELECT
    '0x' || substr(data,27,40) as seller,
    '0x' || substr(data,91,40) as market,
    tokenflow_eth.hextoint(substr(data,131,64)) as position,
    tokenflow_eth.hextoint(substr(data,195,64)) / pow(10,18) as amount,
    tokenflow_eth.hextoint(substr(data,259,64)) / pow(10,18) as susd_paid,
    '0x' || substr(data,347,40) as susd,
    '0x' || substr(data,347+64,40) as asset,
    contract_address,
    tx_hash,
    block_timestamp
    -- *
    from optimism.core.fact_event_logs
    where topics[0] = '0x1d6ff70c632edb1e6aba7fbc0148db68c8392e30f9dfaadae2543a2543757cf6' -- Sell To AMM
    -- and origin_to_address = '0x2d356b114cbca8deff2d8783eac2a5a5324fe1df'
    and contract_address = '0x2d356b114cbca8deff2d8783eac2a5a5324fe1df'
    -- and tx_hash = '0x8134a811d59fdaf60d359ce558c45801daf6cbee21a98c7a15b5de78b54f106e'
    order by block_timestamp desc
    -- limit 10
    )
    group by 1
    order by 1 desc
    Run a query to Download Data