pub trait SolEvent: Sized {
type DataTuple<'a>: SolType<Token<'a> = Self::DataToken<'a>>;
type DataToken<'a>: TokenSeq<'a>;
type TopicList: TopicList;
const SIGNATURE: &'static str;
const SIGNATURE_HASH: FixedBytes<32>;
const ANONYMOUS: bool;
Show 22 methods
// Required methods
fn new(
topics: <Self::TopicList as SolType>::RustType,
data: <Self::DataTuple<'_> as SolType>::RustType,
) -> Self;
fn tokenize_body(&self) -> Self::DataToken<'_>;
fn topics(&self) -> <Self::TopicList as SolType>::RustType;
fn encode_topics_raw(&self, out: &mut [WordToken]) -> Result<(), Error>;
// Provided methods
fn new_checked(
topics: <Self::TopicList as SolType>::RustType,
data: <Self::DataTuple<'_> as SolType>::RustType,
) -> Result<Self, Error> { ... }
fn check_signature(
topics: &<Self::TopicList as SolType>::RustType,
) -> Result<(), Error> { ... }
fn abi_encoded_size(&self) -> usize { ... }
fn encode_data_to(&self, out: &mut Vec<u8>) { ... }
fn encode_data(&self) -> Vec<u8> ⓘ { ... }
fn encode_topics(&self) -> Vec<WordToken> { ... }
fn encode_topics_array<const LEN: usize>(&self) -> [WordToken; LEN] { ... }
fn encode_log_data(&self) -> LogData { ... }
fn encode_log(log: &Log<Self>) -> Log { ... }
fn decode_topics<I, D>(
topics: I,
) -> Result<<Self::TopicList as SolType>::RustType, Error>
where I: IntoIterator<Item = D>,
D: Into<WordToken> { ... }
fn abi_decode_data<'a>(
data: &'a [u8],
) -> Result<<Self::DataTuple<'a> as SolType>::RustType, Error> { ... }
fn abi_decode_data_validate<'a>(
data: &'a [u8],
) -> Result<<Self::DataTuple<'a> as SolType>::RustType, Error> { ... }
fn decode_raw_log<I, D>(topics: I, data: &[u8]) -> Result<Self, Error>
where I: IntoIterator<Item = D>,
D: Into<WordToken> { ... }
fn decode_raw_log_validate<I, D>(
topics: I,
data: &[u8],
) -> Result<Self, Error>
where I: IntoIterator<Item = D>,
D: Into<WordToken> { ... }
fn decode_log_data(log: &LogData) -> Result<Self, Error> { ... }
fn decode_log_data_validate(log: &LogData) -> Result<Self, Error> { ... }
fn decode_log(log: &Log) -> Result<Log<Self>, Error> { ... }
fn decode_log_validate(log: &Log) -> Result<Log<Self>, Error> { ... }
}Expand description
Required Associated Constants§
Sourceconst SIGNATURE: &'static str
const SIGNATURE: &'static str
The event’s ABI signature.
For anonymous events, this is unused, but is still present.
Sourceconst SIGNATURE_HASH: FixedBytes<32>
const SIGNATURE_HASH: FixedBytes<32>
The event’s ABI signature hash, or selector: keccak256(SIGNATURE)
For non-anonymous events, this will be the first topic (topic0).
For anonymous events, this is unused, but is still present.
Required Associated Types§
Required Methods§
Sourcefn new(
topics: <Self::TopicList as SolType>::RustType,
data: <Self::DataTuple<'_> as SolType>::RustType,
) -> Self
fn new( topics: <Self::TopicList as SolType>::RustType, data: <Self::DataTuple<'_> as SolType>::RustType, ) -> Self
Convert decoded rust data to the event type.
Does not check that topics[0] is the correct hash.
Use new_checked instead.
Sourcefn tokenize_body(&self) -> Self::DataToken<'_>
fn tokenize_body(&self) -> Self::DataToken<'_>
Tokenize the event’s non-indexed parameters.
Provided Methods§
Sourcefn new_checked(
topics: <Self::TopicList as SolType>::RustType,
data: <Self::DataTuple<'_> as SolType>::RustType,
) -> Result<Self, Error>
fn new_checked( topics: <Self::TopicList as SolType>::RustType, data: <Self::DataTuple<'_> as SolType>::RustType, ) -> Result<Self, Error>
Convert decoded rust data to the event type.
Checks that topics[0] is the correct hash.
Sourcefn check_signature(
topics: &<Self::TopicList as SolType>::RustType,
) -> Result<(), Error>
fn check_signature( topics: &<Self::TopicList as SolType>::RustType, ) -> Result<(), Error>
Check that the event’s signature matches the given topics.
Sourcefn abi_encoded_size(&self) -> usize
fn abi_encoded_size(&self) -> usize
The size of the ABI-encoded dynamic data in bytes.
Sourcefn encode_data_to(&self, out: &mut Vec<u8>)
fn encode_data_to(&self, out: &mut Vec<u8>)
ABI-encode the dynamic data of this event into the given buffer.
Sourcefn encode_data(&self) -> Vec<u8> ⓘ
fn encode_data(&self) -> Vec<u8> ⓘ
ABI-encode the dynamic data of this event.
Sourcefn encode_topics(&self) -> Vec<WordToken>
fn encode_topics(&self) -> Vec<WordToken>
Encode the topics of this event.
The returned vector will have length Self::TopicList::COUNT.
Sourcefn encode_topics_array<const LEN: usize>(&self) -> [WordToken; LEN]
fn encode_topics_array<const LEN: usize>(&self) -> [WordToken; LEN]
Encode the topics of this event into a fixed-size array.
This method will not compile if LEN is not equal to Self::TopicList::COUNT.
Sourcefn encode_log_data(&self) -> LogData
fn encode_log_data(&self) -> LogData
Encode this event to a LogData.
Sourcefn encode_log(log: &Log<Self>) -> Log
fn encode_log(log: &Log<Self>) -> Log
Sourcefn decode_topics<I, D>(
topics: I,
) -> Result<<Self::TopicList as SolType>::RustType, Error>
fn decode_topics<I, D>( topics: I, ) -> Result<<Self::TopicList as SolType>::RustType, Error>
Decode the topics of this event from the given data.
Sourcefn abi_decode_data<'a>(
data: &'a [u8],
) -> Result<<Self::DataTuple<'a> as SolType>::RustType, Error>
fn abi_decode_data<'a>( data: &'a [u8], ) -> Result<<Self::DataTuple<'a> as SolType>::RustType, Error>
ABI-decodes the dynamic data of this event from the given buffer.
Sourcefn abi_decode_data_validate<'a>(
data: &'a [u8],
) -> Result<<Self::DataTuple<'a> as SolType>::RustType, Error>
fn abi_decode_data_validate<'a>( data: &'a [u8], ) -> Result<<Self::DataTuple<'a> as SolType>::RustType, Error>
ABI-decodes the dynamic data of this event from the given buffer, with validation.
This is the same as abi_decode_data, but performs
validation checks on the decoded data tuple.
Sourcefn decode_raw_log<I, D>(topics: I, data: &[u8]) -> Result<Self, Error>
fn decode_raw_log<I, D>(topics: I, data: &[u8]) -> Result<Self, Error>
Decode the event from the given log info.
Sourcefn decode_raw_log_validate<I, D>(topics: I, data: &[u8]) -> Result<Self, Error>
fn decode_raw_log_validate<I, D>(topics: I, data: &[u8]) -> Result<Self, Error>
Decode the event from the given log info, with validation.
This is the same as decode_raw_log, but performs
validation checks on the decoded topics and data.
Sourcefn decode_log_data(log: &LogData) -> Result<Self, Error>
fn decode_log_data(log: &LogData) -> Result<Self, Error>
Decode the event from the given log object.
Sourcefn decode_log_data_validate(log: &LogData) -> Result<Self, Error>
fn decode_log_data_validate(log: &LogData) -> Result<Self, Error>
Decode the event from the given log object with validation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".