Updated 2022-08-25
    with bets as
    (select ORIGIN_FROM_ADDRESS, sender, market, position, amount_redeem, wager, token_paid, token_names, block_timestamp, tx_hash
    from
    (SELECT origin_function_signature, origin_from_address,
    regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
    '0x'||substring(segmented_data[0]::STRING,25,40) sender,
    '0x'||substring(segmented_data[1]::STRING,25,40) market,
    ethereum.public.udf_hex_to_int(segmented_data [2]::STRING) AS position,
    ethereum.public.udf_hex_to_int(segmented_data [3]::STRING)::decimal/1e18 AS amount_redeem,
    ethereum.public.udf_hex_to_int(segmented_data [4]::STRING)::decimal/1e18 AS wager,
    '0x'||substring(segmented_data[5]::STRING,25,40) token_paid,
    '0x'||substring(segmented_data[6]::STRING,25,40) token_names,
    block_timestamp, tx_hash
    FROM optimism.core.fact_event_logs
    where contract_address = LOWER('0x170a5714112daEfF20E798B6e92e25B86Ea603C1')
    and block_timestamp >= current_date() - interval '2 weeks'
    and topics[0] = '0xf3bfbc0822d1ed667a2b298e71e0304f2c1f4685398189d7c39e412f733150f4'))

    select *
    from bets
    limit 100


    Run a query to Download Data