git.delta.rocks / unique-network / refs/commits / 764552168e27

difftreelog

source

crates/evm-coder/src/events.rs688 Bsourcehistory
1use ethereum::Log;2use primitive_types::{H160, H256};34use crate::types::*;56pub trait ToLog {7	fn to_log(&self, contract: H160) -> Log;8}910pub trait ToTopic {11	fn to_topic(&self) -> H256;12}1314impl ToTopic for H256 {15	fn to_topic(&self) -> H256 {16		*self17	}18}1920impl ToTopic for uint256 {21	fn to_topic(&self) -> H256 {22		let mut out = [0u8; 32];23		self.to_big_endian(&mut out);24		H256(out)25	}26}2728impl ToTopic for address {29	fn to_topic(&self) -> H256 {30		let mut out = [0u8; 32];31		out[12..32].copy_from_slice(&self.0);32		H256(out)33	}34}3536impl ToTopic for uint32 {37	fn to_topic(&self) -> H256 {38		let mut out = [0u8; 32];39		out[28..32].copy_from_slice(&self.to_be_bytes());40		H256(out)41	}42}