Query editor
WITH main AS(SELECTL1.block_time,varbinary_to_uint256(substr(L2.data, 33, 32)) AS epoch,varbinary_to_uint256(varbinary_ltrim(l1.topic1)) AS val_id,CONCAT('0x', to_hex(varbinary_ltrim(l1.topic2))) as auth_address,varbinary_to_uint256(substr(L2.data, 1, 32)) / CAST(1000000000000000000 AS DECIMAL(38,0)) AS stake_amount,varbinary_to_uint256(varbinary_substring(l1.data, 1, 32)) / 1000000000000000000 * 100 AS commission,L1.tx_hashFROM monad.logs l1LEFT JOIN monad.logs l2ON l1.tx_hash = l2.tx_hashAND l1.topic0 <> l2.topic0WHEREl1.contract_address = 0x0000000000000000000000000000000000001000AND l1.topic0 = 0x6f8045cd38e512b8f12f6f02947c632e5f25af03aad132890ecf50015d97c1b2 -- validatorCreated eventAND l2.topic0 = 0xe4d4df1e1827dd28252fd5c3cd7ebccd3da6e0aa31f74c828f3c8542af49d840 --initial Delegate event),latest AS (SELECT val_id, newCommissionFROM (SELECT row_number() over (partition by varbinary_to_uint256(varbinary_ltrim(topic1))order by block_time desc) as rn,varbinary_to_uint256(varbinary_ltrim(topic1)) AS val_id,cast(varbinary_to_uint256(substr(data, 33, 32)) as double) / 1e18 * 100 AS newCommissionFROM monad.logsWHERE contract_address = 0x0000000000000000000000000000000000001000AND topic0 = 0xd1698d3454c5b5384b70aaae33f1704af7c7e055f0c75503ba3146dc28995920)WHERE rn = 1)SELECT block_time AS createdTime, epoch AS createdEpoch, m.val_id, auth_address, stake_amount AS initialStake, COALESCE(newCommission, commission) AS current_commissionFROM main mLEFT JOIN latest lON m.val_id = l.val_idorder by 1/* map the topic0 to their event_nametopic1,topic2, topic3, and data for respective purposes:Like a documentation0x3a420a01486b6b28d6ae89c51f5c3bde3e0e74eecbb646a0c481ccba3aae3754 ValidatorRewarded0x6f8045cd38e512b8f12f6f02947c632e5f25af03aad132890ecf50015d97c1b2 ValidatorCreated0xe4d4df1e1827dd28252fd5c3cd7ebccd3da6e0aa31f74c828f3c8542af49d840 Delegate0xc95966754e882e03faffaf164883d98986dda088d09471a35f9e55363daf0c53 ValidatorChanged0x4fae4dbe0ed659e8ce6637e3c273cd8e4d3bf029b9379a9e8b3f3f27dbef809b EpochChanged0x3e53c8b91747e1b72a44894db10f2a45fa632b161fdcdd3a17bd6be5482bac62 Undelegate0x63030e4238e1146c63f38f4ac81b2b23c8be28882e68b03f0887e50d0e9bb18f Withdraw0xcb607e6b63c89c95f6ae24ece9fe0e38a7971aa5ed956254f1df47490921727b ClaimRewards0xd1698d3454c5b5384b70aaae33f1704af7c7e055f0c75503ba3146dc28995920 CommissionChanged */