freemartianTotal bettors
    Updated 2022-08-23
    with a as (
    select
    distinct tx_hash as tx,
    regexp_substr_all(SUBSTR(input_data, 11, len(input_data)), '.{64}') AS segmented_data,
    concat('0x', substr(segmented_data[0], 25, 40)) as game,
    ethereum.public.udf_hex_to_int(segmented_data[3] :: STRING) :: FLOAT as paid_bet,
    from_address
    from optimism.core.fact_transactions
    where tx in (
    select tx_hash
    from optimism.core.fact_token_transfers
    where to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
    and from_address != '0x0000000000000000000000000000000000000000'
    and from_address != '0x061b87122ed14b9526a813209c8a59a633257bab'
    and origin_function_signature in ('0x6cc5a6ff', '0x8875eb84')
    and block_timestamp >= CURRENT_DATE - 14)
    group by 1, 2, 3, 4, 5)

    select
    sum(paid_bet) as volume,
    count(distinct from_address) as total_bettors
    from a
    Run a query to Download Data