connorhPolygon ERC20 Bridge
    Updated 2021-10-07
    -- Bridged Amounts to Polygon
    select DATE(block_timestamp) AS balance_date,
    CASE
    WHEN from_address = '0x40ec5b33f54e0e8a33a975908c5ba1c14e5bbbdf' THEN 'LeavingPolygon'
    ELSE 'EnteringPolygon'
    END AS direction,
    --LOWER(COALESCE(event_inputs:depositReceiver,event_inputs:exitor)) AS user_address,
    SUM(CASE
    WHEN from_address = '0x40ec5b33f54e0e8a33a975908c5ba1c14e5bbbdf' THEN amount_usd*-1
    ELSE amount_usd
    END) AS amount_usd
    from ethereum.udm_events
    where
    --event_name IN ('Transfer') AND
    (to_address = '0x40ec5b33f54e0e8a33a975908c5ba1c14e5bbbdf' OR from_address = '0x40ec5b33f54e0e8a33a975908c5ba1c14e5bbbdf') AND
    block_timestamp >= CURRENT_DATE - 360
    GROUP BY 1,2

    Run a query to Download Data