0x97a93E68f2f8d99A69a95e7a8b683561410a1ac3smart trader check (4.2) - Event Transfer table copy
    Updated 2023-02-11
    -- forked from b93916b3-9cc9-44e2-88e0-f49d0265c058

    with smart_trader as (select '{{address}}' as address),
    raw_evt_transfer as
    (select
    'deposit' as type,
    t.*,
    c.name,
    c.symbol,
    t.raw_amount/cast(concat('1e',c.decimals) as numeric) as amount
    from ethereum.core.fact_token_transfers t
    inner join smart_trader s
    on s.address = t.to_address
    -- and symbol = '{{symbol}}'
    and contract_address = '{{token_address}}'

    and block_timestamp::date between '{{start_date}}' and '{{end_date}}'
    inner join ethereum.core.dim_contracts c
    on t.contract_address = c.address
    union all
    select
    'withdraw' as type,
    t.*,
    c.name,
    c.symbol,
    t.raw_amount/cast(concat('1e',c.decimals) as numeric) as amount
    from ethereum.core.fact_token_transfers t
    inner join smart_trader s
    on s.address = t.from_address
    -- and symbol = '{{symbol}}'
    and contract_address = '{{token_address}}'
    and block_timestamp::date between '{{start_date}}' and '{{end_date}}'
    inner join ethereum.core.dim_contracts c
    on t.contract_address = c.address),

    Run a query to Download Data