Trait alloy_sol_types::SolEvent
source · 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 13 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 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 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_log<I, D>(topics: I, data: &[u8], validate: bool) -> Result<Self>
where I: IntoIterator<Item = D>,
D: Into<WordToken> { ... }
fn decode_log_object(log: &Log, validate: bool) -> Result<Self> { ... }
}
Expand description
Solidity event.
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§
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 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.
sourcefn tokenize_body(&self) -> Self::DataToken<'_>
fn tokenize_body(&self) -> Self::DataToken<'_>
Tokenize the event’s non-indexed parameters.
Provided Methods§
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.
Panics
This method will panic if LEN
is not equal to
Self::TopicList::COUNT
.
sourcefn decode_topics<I, D>(
topics: I
) -> Result<<Self::TopicList as SolType>::RustType>where
I: IntoIterator<Item = D>,
D: Into<WordToken>,
fn decode_topics<I, D>( topics: I ) -> Result<<Self::TopicList as SolType>::RustType>where I: IntoIterator<Item = D>, D: Into<WordToken>,
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_log<I, D>(topics: I, data: &[u8], validate: bool) -> Result<Self>where
I: IntoIterator<Item = D>,
D: Into<WordToken>,
fn decode_log<I, D>(topics: I, data: &[u8], validate: bool) -> Result<Self>where I: IntoIterator<Item = D>, D: Into<WordToken>,
Decode the event from the given log info.
sourcefn decode_log_object(log: &Log, validate: bool) -> Result<Self>
fn decode_log_object(log: &Log, validate: bool) -> Result<Self>
Decode the event from the given log object.