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 18 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<()>;
// Provided methods
fn new_checked(
topics: <Self::TopicList as SolType>::RustType,
data: <Self::DataTuple<'_> as SolType>::RustType,
) -> Result<Self> { ... }
fn check_signature(
topics: &<Self::TopicList as SolType>::RustType,
) -> Result<()> { ... }
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<LogData> { ... }
fn decode_topics<I, D>(
topics: I,
) -> Result<<Self::TopicList as SolType>::RustType>
where I: IntoIterator<Item = D>,
D: Into<WordToken> { ... }
fn abi_decode_data<'a>(
data: &'a [u8],
validate: bool,
) -> Result<<Self::DataTuple<'a> as SolType>::RustType> { ... }
fn decode_raw_log<I, D>(
topics: I,
data: &[u8],
validate: bool,
) -> Result<Self>
where I: IntoIterator<Item = D>,
D: Into<WordToken> { ... }
fn decode_log_data(log: &LogData, validate: bool) -> Result<Self> { ... }
fn decode_log(log: &Log, validate: bool) -> Result<Log<Self>> { ... }
}
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>
fn new_checked( topics: <Self::TopicList as SolType>::RustType, data: <Self::DataTuple<'_> as SolType>::RustType, ) -> Result<Self>
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<()>
fn check_signature( topics: &<Self::TopicList as SolType>::RustType, ) -> Result<()>
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<LogData>
fn encode_log(log: &Log<Self>) -> Log<LogData>
Sourcefn decode_topics<I, D>(
topics: I,
) -> Result<<Self::TopicList as SolType>::RustType>
fn decode_topics<I, D>( topics: I, ) -> Result<<Self::TopicList as SolType>::RustType>
Decode the topics of this event from the given data.
Sourcefn abi_decode_data<'a>(
data: &'a [u8],
validate: bool,
) -> Result<<Self::DataTuple<'a> as SolType>::RustType>
fn abi_decode_data<'a>( data: &'a [u8], validate: bool, ) -> Result<<Self::DataTuple<'a> as SolType>::RustType>
ABI-decodes the dynamic data of this event from the given buffer.
Sourcefn decode_raw_log<I, D>(topics: I, data: &[u8], validate: bool) -> Result<Self>
fn decode_raw_log<I, D>(topics: I, data: &[u8], validate: bool) -> Result<Self>
Decode the event from the given log info.
Sourcefn decode_log_data(log: &LogData, validate: bool) -> Result<Self>
fn decode_log_data(log: &LogData, validate: bool) -> Result<Self>
Decode the event from the given log object.
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.