Query editor
WITH params AS (SELECT0x8707f238936c12c309bfc2b9959c35828acfc512 AS lock_contract,0x4c9edd5852cd905f086c759e8383e09bff1e68b3 AS usde_contract,TIMESTAMP '2024-02-19 00:00:00' AS start_time_utc,TIMESTAMP '2024-04-01 23:59:59' AS end_time_utc),-- Find txs where the decoded event name is StakeParametersUpdatedcandidate_updates AS (SELECTld.block_time,ld.tx_hashFROM ethereum.logs_decoded ldCROSS JOIN params pWHERE ld.contract_address = p.lock_contractAND ld.event_name = 'StakeParametersUpdated'AND ld.block_time >= p.start_time_utcAND ld.block_time <= p.end_time_utc),-- Pull the raw log for those txs so we can decode token / epoch / stakeLimit / cooldowndecoded_updates AS (SELECTl.block_time,l.tx_hash,bytearray_substring(l.topic1, 13) AS token,bytearray_to_uint256(l.topic2) AS epoch,bytearray_to_uint256(bytearray_substring(l.data, 1, 32)) / 1e18 AS stake_limit_usde,bytearray_to_uint256(bytearray_substring(l.data, 33, 32)) AS cooldown_secondsFROM ethereum.logs lJOIN candidate_updates cuON l.tx_hash = cu.tx_hashAND l.block_time = cu.block_timeCROSS JOIN params pWHERE l.contract_address = p.lock_contractAND bytearray_substring(l.topic1, 13) = p.usde_contract)SELECTblock_time,tx_hash,token,epoch,stake_limit_usde,cooldown_secondsFROM decoded_updatesORDER BY block_time;