Query editor
/* Success! If you're still running into issues, check out https://dune.com/docs/query/syntax-differences/ or reach out in the #dune-sql Discord channel. */WITHMint AS (SELECTDATE_TRUNC('day', block_time) AS day,SUM(MintAmt) AS MintAmtFROM(SELECT*,bytearray_to_int256(bytearray_substring(data, 33,32))/1e18 AS MintAmtFROMbnb.logsWHEREcontract_address = 0x1b6F2d3844C6ae7D56ceb3C3643b9060ba28FEb0AND topic0 = 0x0bbf7f655caf5ea43b545960e1290a320e5bafffd6036b4afa424f84c266bd19ORDER BYMintAmt) AS tWHEREMintAmt > -1GROUP BY1),Burn AS (SELECTDATE_TRUNC('day', block_time) AS day,SUM(bytearray_to_int256(bytearray_substring(data, 1,32))/1e18) AS BurnAmtFROMbnb.logsWHEREcontract_address = 0x1b6F2d3844C6ae7D56ceb3C3643b9060ba28FEb0AND topic0 = 0x81826951fa1e84c412ecde63e7fa200ad8b39dafd7c8bedf5c5faa5a0f77166bGROUP BY1ORDER BYday DESC NULLS FIRST)SELECT*,SUM(net_increasement) OVER (ORDER BYday) AS accFROM(SELECTa.*,COALESCE(b.BurnAmt, 0) AS BurnAmt,MintAmt - COALESCE(b.BurnAmt, 0) AS net_increasementFROMMint AS aLEFT JOIN Burn AS b ON a.day = b.day) AS tORDER BYday DESC NULLS FIRST