Query editor
--topic 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef -> StakingWITHSTAKEOOR AS(SELECTbytearray_substring(topic1,13,20) AS stakeoor,CAST(bytearray_to_uint256(bytearray_substring(topic2, 2, 31)) AS DOUBLE) / POW(10, 18) as amount,*FROM arbitrum.logsWHERE contract_address = 0xb46eb17840aa098c9d1895e761e934269fb92f8aAND topic0 = 0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d--AND bytearray_substring(topic2,13,20) = 0x39fc5f5ec06bdd63a065f585c81e33f20b98cfc3),UNSTAKEOOR AS(SELECTbytearray_substring(topic1,13,20) AS stakeoor,CAST(bytearray_to_uint256(bytearray_substring(topic2, 2, 31)) AS DOUBLE) / POW(10, 18) as amount,*FROM arbitrum.logsWHERE contract_address = 0xb46eb17840aa098c9d1895e761e934269fb92f8aAND topic0 = 0x0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75--AND bytearray_substring(topic1,13,20) = 0x39fc5f5ec06bdd63a065f585c81e33f20b98cfc3),COMBINED AS(SELECT stakeoor,block_time,amountFROM STAKEOORUNION ALLSELECT stakeoor,block_time,amount * (-1)FROM UNSTAKEOOR)SELECT sum(amount) AS total_staked_pegFROM COMBINED