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 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 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.
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.