Trait alloy_sol_types::SolError
source · pub trait SolError: Sized {
type Parameters<'a>: SolType<Token<'a> = Self::Token<'a>>;
type Token<'a>: TokenSeq<'a>;
const SIGNATURE: &'static str;
const SELECTOR: [u8; 4];
// Required methods
fn new(tuple: <Self::Parameters<'_> as SolType>::RustType) -> Self;
fn tokenize(&self) -> Self::Token<'_>;
// Provided methods
fn abi_encoded_size(&self) -> usize { ... }
fn abi_decode_raw(data: &[u8], validate: bool) -> Result<Self> { ... }
fn abi_decode(data: &[u8], validate: bool) -> Result<Self> { ... }
fn abi_encode_raw(&self, out: &mut Vec<u8>) { ... }
fn abi_encode(&self) -> Vec<u8> ⓘ { ... }
}
Expand description
A Solidity custom error.
Implementer’s Guide
It should not be necessary to implement this trait manually. Instead, use
the sol!
procedural macro to parse Solidity syntax into
types that implement this trait.
Required Associated Types§
sourcetype Parameters<'a>: SolType<Token<'a> = Self::Token<'a>>
type Parameters<'a>: SolType<Token<'a> = Self::Token<'a>>
The underlying tuple type which represents the error’s members.
If the error has no arguments, this will be the unit type ()
Required Associated Constants§
Required Methods§
sourcefn new(tuple: <Self::Parameters<'_> as SolType>::RustType) -> Self
fn new(tuple: <Self::Parameters<'_> as SolType>::RustType) -> Self
Convert from the tuple type used for ABI encoding and decoding.
Provided Methods§
sourcefn abi_encoded_size(&self) -> usize
fn abi_encoded_size(&self) -> usize
The size of the error params when encoded in bytes, without the selector.
sourcefn abi_decode_raw(data: &[u8], validate: bool) -> Result<Self>
fn abi_decode_raw(data: &[u8], validate: bool) -> Result<Self>
ABI decode this call’s arguments from the given slice, without its selector.
sourcefn abi_decode(data: &[u8], validate: bool) -> Result<Self>
fn abi_decode(data: &[u8], validate: bool) -> Result<Self>
ABI decode this error’s arguments from the given slice, with the selector.
sourcefn abi_encode_raw(&self, out: &mut Vec<u8>)
fn abi_encode_raw(&self, out: &mut Vec<u8>)
ABI encode the error to the given buffer without its selector.
sourcefn abi_encode(&self) -> Vec<u8> ⓘ
fn abi_encode(&self) -> Vec<u8> ⓘ
ABI encode the error to the given buffer with its selector.