nitsTracer and TokeMak stats
    Updated 2022-02-26
    with tracer_users as (SELECT count(DISTINCT address) as tracer_users
    from (SELECT origin_address as address from
    (SELECT * from ethereum.udm_events
    where contract_address = '0x9c4a4204b79dd291d6b6571c5be8bbcd0622f050' and symbol = 'TCR' and amount_usd is not NULL))),
    tracer_and_tokemak as --
    (SELECT count(DISTINCT addresses ) as unique_addr_tracer_and_tokemak, sum(amt_net)/pow(10,18) as net_deposits_tracer_and_tokemak,
    avg(amt_net)/pow(10,18) as avg_net_deposits_tracer_and_tokemak, median(amt_net)/pow(10,18) as median_net_deposits_tracer_and_tokemak
    from
    (SELECT *, case when origin_function_name = 'withdraw' then amount*(-1) else amount end as amt_net ,
    case when origin_function_name = 'withdraw' then from_address else to_address end as addresses
    from ethereum.udm_events
    where contract_address ilike '0x15A629f0665A3Eb97D7aE9A7ce7ABF73AeB79415' and (origin_function_name = 'deposit' or origin_function_name = 'withdraw')
    and addresses in
    (SELECT origin_address from
    (SELECT * from ethereum.udm_events
    where contract_address = '0x9c4a4204b79dd291d6b6571c5be8bbcd0622f050' and symbol = 'TCR' and amount_usd is not NULL))) ),

    tokemak_only as (SELECT count(DISTINCT addresses ) as unique_addr_tokemak_only, sum(amt_net)/pow(10,18) as net_deposits_tokemak_only,
    avg(amt_net)/pow(10,18) as avg_net_deposits_tokemak_only, median(amt_net)/pow(10,18) as median_net_deposits_tokemak_only
    from
    (SELECT *, case when origin_function_name = 'withdraw' then amount*(-1) else amount end as amt_net ,
    case when origin_function_name = 'withdraw' then from_address else to_address end as addresses
    from ethereum.udm_events
    where contract_address ilike '0x15A629f0665A3Eb97D7aE9A7ce7ABF73AeB79415' and (origin_function_name = 'deposit' or origin_function_name = 'withdraw')))


    SELECT * from tokemak_only, tracer_and_tokemak, tracer_users
    Run a query to Download Data