use ink_env::Environment;
#[cfg(feature = "std")]
use std::fmt::Debug;
use subxt::{
events::StaticEvent,
ext::{
scale_decode,
scale_encode,
},
};
#[derive(
Debug,
scale::Decode,
scale::Encode,
scale_decode::DecodeAsType,
scale_encode::EncodeAsType,
)]
#[decode_as_type(trait_bounds = "", crate_path = "subxt::ext::scale_decode")]
#[encode_as_type(crate_path = "subxt::ext::scale_encode")]
pub struct ContractInstantiatedEvent<E: Environment> {
pub deployer: E::AccountId,
pub contract: E::AccountId,
}
impl<E> StaticEvent for ContractInstantiatedEvent<E>
where
E: Environment,
{
const PALLET: &'static str = "Contracts";
const EVENT: &'static str = "Instantiated";
}
#[derive(
Debug,
scale::Decode,
scale::Encode,
scale_decode::DecodeAsType,
scale_encode::EncodeAsType,
)]
#[decode_as_type(trait_bounds = "", crate_path = "subxt::ext::scale_decode")]
#[encode_as_type(crate_path = "subxt::ext::scale_encode")]
pub struct CodeStoredEvent<E: Environment> {
pub code_hash: E::Hash,
}
impl<E> StaticEvent for CodeStoredEvent<E>
where
E: Environment,
{
const PALLET: &'static str = "Contracts";
const EVENT: &'static str = "CodeStored";
}
#[derive(
scale::Decode,
scale::Encode,
scale_decode::DecodeAsType,
scale_encode::EncodeAsType,
Debug,
)]
#[decode_as_type(trait_bounds = "", crate_path = "subxt::ext::scale_decode")]
#[encode_as_type(crate_path = "subxt::ext::scale_encode")]
pub struct ContractEmitted<E: Environment> {
pub contract: E::AccountId,
pub data: Vec<u8>,
}
impl<E> StaticEvent for ContractEmitted<E>
where
E: Environment,
{
const PALLET: &'static str = "Contracts";
const EVENT: &'static str = "ContractEmitted";
}
pub struct EventWithTopics<T> {
pub topics: Vec<sp_core::H256>,
pub event: T,
}