Derive Macro ethers_contract_derive::EthAbiType
source · #[derive(EthAbiType)]
Expand description
Derives the AbiType
and all Tokenizable
traits for the labeled type.
This derive macro adds a type bound field: Tokenizable
for each field type.
§Examples
use ethers_contract_derive::EthAbiType;
use ethers_core::types::*;
use ethers_core::abi::{AbiType, ParamType};
#[derive(Clone, EthAbiType)]
struct MyStruct {
a: U256,
b: Address,
c: Bytes,
d: String,
e: H256,
}
assert_eq!(
MyStruct::param_type(),
ParamType::Tuple(vec![
ParamType::Uint(256),
ParamType::Address,
ParamType::Bytes,
ParamType::String,
ParamType::FixedBytes(32),
]),
);