--darvishi
SELECT
date_trunc('day', block_timestamp) as day,
CASE WHEN block_timestamp > '2022-08-04' THEN 'post hack' ELSE 'pre_hack' END as time_period,
count(DISTINCT tx_hash) as transactions,
count(DISTINCT origin_from_address) as users,
sum(CASE WHEN lp_action LIKE 'deposit' THEN LP_TOKEN_AMOUNT_USD WHEN lp_action LIKE 'withdraw' THEN -1 * LP_TOKEN_AMOUNT_USD END) as volume
FROM
optimism.velodrome.ez_lp_actions
GROUP BY 1,2