SELECT
date_trunc('day',BLOCK_TIMESTAMP) AS DAY,
SUM(INNER_INSTRUCTION:instructions[0]:parsed:info:amount::INT)/1e6 AS USDH_AMOUNT
FROM solana.fact_events
WHERE PROGRAM_ID = 'MERLuDFBMmsHnsBPZw2sDQZHvXFMwp8EdjudcU2HKky'
AND INDEX = 4
AND INSTRUCTION:accounts[4]::string='3bFWy2hz9yGxvbgoRmzjUqkoYbCTWUDu7sZPHUYV39Pf' --USDH wallet address for mercurial
AND INNER_INSTRUCTION:instructions[0]:parsed:info:amount::INT <> 0
GROUP BY 1
ORDER BY 1 ASC