--- a/crates/evm-coder/procedural/src/solidity_interface.rs +++ b/crates/evm-coder/procedural/src/solidity_interface.rs @@ -610,7 +610,7 @@ let custom_signature = self.expand_custom_signature(); quote! { const #screaming_name_signature: ::evm_coder::custom_signature::SignatureUnit = #custom_signature; - const #screaming_name: ::evm_coder::types::bytes4 = { + const #screaming_name: ::evm_coder::types::Bytes4 = { let mut sum = ::evm_coder::sha3_const::Keccak256::new(); let mut pos = 0; while pos < Self::#screaming_name_signature.len { @@ -974,7 +974,7 @@ #consts )* /// Return this call ERC165 selector - pub const fn interface_id() -> ::evm_coder::types::bytes4 { + pub const fn interface_id() -> ::evm_coder::types::Bytes4 { let mut interface_id = 0; #(#interface_id)* #(#inline_interface_id)* @@ -1019,7 +1019,7 @@ } } impl #gen_ref ::evm_coder::Call for #call_name #gen_ref { - fn parse(method_id: ::evm_coder::types::bytes4, reader: &mut ::evm_coder::abi::AbiReader) -> ::evm_coder::execution::Result> { + fn parse(method_id: ::evm_coder::types::Bytes4, reader: &mut ::evm_coder::abi::AbiReader) -> ::evm_coder::execution::Result> { use ::evm_coder::abi::AbiRead; match method_id { ::evm_coder::ERC165Call::INTERFACE_ID => return Ok( @@ -1041,7 +1041,7 @@ #gen_where { /// Is this contract implements specified ERC165 selector - pub fn supports_interface(this: &#name, interface_id: ::evm_coder::types::bytes4) -> bool { + pub fn supports_interface(this: &#name, interface_id: ::evm_coder::types::Bytes4) -> bool { interface_id != u32::to_be_bytes(0xffffff) && ( interface_id == ::evm_coder::ERC165Call::INTERFACE_ID || interface_id == Self::interface_id() --- a/crates/evm-coder/src/abi/impls.rs +++ b/crates/evm-coder/src/abi/impls.rs @@ -81,9 +81,9 @@ } } -impl_abi_type!(bytes4, bytes4, false); -impl AbiRead for bytes4 { - fn abi_read(reader: &mut AbiReader) -> Result { +impl_abi_type!(Bytes4, bytes4, false); +impl AbiRead for Bytes4 { + fn abi_read(reader: &mut AbiReader) -> Result { reader.bytes4() } } --- a/crates/evm-coder/src/abi/mod.rs +++ b/crates/evm-coder/src/abi/mod.rs @@ -54,7 +54,7 @@ } } /// Start reading RLP buffer, parsing first 4 bytes as selector - pub fn new_call(buf: &'i [u8]) -> Result<(bytes4, Self)> { + pub fn new_call(buf: &'i [u8]) -> Result<(Bytes4, Self)> { if buf.len() < 4 { return Err(Error::Error(ExitError::OutOfOffset)); } --- a/crates/evm-coder/src/lib.rs +++ b/crates/evm-coder/src/lib.rs @@ -132,7 +132,7 @@ use primitive_types::{U256, H160, H256}; pub type Address = H160; - pub type bytes4 = [u8; 4]; + pub type Bytes4 = [u8; 4]; pub type topic = H256; #[cfg(not(feature = "std"))] @@ -191,7 +191,7 @@ /// Parseable EVM call, this trait should be implemented with [`solidity_interface`] macro pub trait Call: Sized { /// Parse call buffer into typed call enum - fn parse(selector: types::bytes4, input: &mut AbiReader) -> execution::Result>; + fn parse(selector: types::Bytes4, input: &mut AbiReader) -> execution::Result>; } /// Intended to be used as `#[weight]` output type @@ -227,22 +227,22 @@ /// implements specified interface SupportsInterface { /// Requested interface - interface_id: types::bytes4, + interface_id: types::Bytes4, }, } impl ERC165Call { /// ERC165 selector is provided by standard - pub const INTERFACE_ID: types::bytes4 = u32::to_be_bytes(0x01ffc9a7); + pub const INTERFACE_ID: types::Bytes4 = u32::to_be_bytes(0x01ffc9a7); } impl Call for ERC165Call { - fn parse(selector: types::bytes4, input: &mut AbiReader) -> execution::Result> { + fn parse(selector: types::Bytes4, input: &mut AbiReader) -> execution::Result> { if selector != Self::INTERFACE_ID { return Ok(None); } Ok(Some(Self::SupportsInterface { - interface_id: types::bytes4::abi_read(input)?, + interface_id: types::Bytes4::abi_read(input)?, })) } } --- a/crates/evm-coder/src/solidity/impls.rs +++ b/crates/evm-coder/src/solidity/impls.rs @@ -27,7 +27,7 @@ u64 => "uint64" true = "0", u128 => "uint128" true = "0", U256 => "uint256" true = "0", - bytes4 => "bytes4" true = "bytes4(0)", + Bytes4 => "bytes4" true = "bytes4(0)", H160 => "address" true = "0x0000000000000000000000000000000000000000", string => "string" false = "\"\"", bytes => "bytes" false = "hex\"\"", --- a/crates/evm-coder/src/solidity/mod.rs +++ b/crates/evm-coder/src/solidity/mod.rs @@ -360,7 +360,7 @@ pub struct SolidityInterface { pub docs: &'static [&'static str], - pub selector: bytes4, + pub selector: Bytes4, pub name: &'static str, pub is: &'static [&'static str], pub functions: F,