Trait DecodeConstructorError

Source
pub trait DecodeConstructorError<Abi>: Sized {
    // Required method
    fn decode_error_output(buffer: &[u8]) -> ConstructorError<Self>;
}
Expand description

A trait for decoding constructor error data based on ABI.

§Note

This is necessary because constructors supporting different ABIs encode return data differently.

For example, ink! ABI encoded constructors return data encoded as ConstructorResult<Result<_, Error>, LangErr> where Error is either the user defined error for fallible constructors, or unit (i.e. ()) for infallible constructors. On the other hand, Solidity ABI encoded constructors always return the output data directly and the state of the revert flag determines whether its “normal” return data or error data.

This trait assumes the caller has already checked that the revert flag is set.

Required Methods§

Source

fn decode_error_output(buffer: &[u8]) -> ConstructorError<Self>

Decodes constructor error data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<E> DecodeConstructorError<Ink> for E
where E: Decode,

Source§

impl<E> DecodeConstructorError<Sol> for E
where E: SolErrorDecode,