Have the coins pallet emit events via serai_core_pallet

`serai_core_pallet` solely defines an accumulator for the events. We use the
traditional `frame_system::Events` to store them for now and enable retrieval.
This commit is contained in:
Luke Parker
2025-09-19 22:12:45 -04:00
parent 3f5150b3fa
commit 3cb9432daa
12 changed files with 188 additions and 129 deletions

View File

@@ -44,6 +44,15 @@ pub enum Event {
/// The coins minted.
coins: Balance,
},
/// The specified coins were transferred.
Transfer {
/// The address transferred from.
from: SeraiAddress,
/// The address transferred to.
to: SeraiAddress,
/// The coins transferred.
coins: Balance,
},
/// The specified coins were burnt.
Burn {
/// The address burnt from.
@@ -58,13 +67,4 @@ pub enum Event {
/// The `OutInstruction` specified, and the coins burnt.
instruction: OutInstructionWithBalance,
},
/// The specified coins were transferred.
Transfer {
/// The address transferred from.
from: SeraiAddress,
/// The address transferred to.
to: SeraiAddress,
/// The coins transferred.
coins: Balance,
},
}

View File

@@ -96,3 +96,44 @@ pub enum Event {
/// The event for `InInstruction`s.
InInstructions(in_instructions::Event) = 7,
}
impl From<system::Event> for Event {
fn from(event: system::Event) -> Self {
Self::System(event)
}
}
impl From<coins::Event> for Event {
fn from(event: coins::Event) -> Self {
Self::Coins(event)
}
}
impl From<validator_sets::Event> for Event {
fn from(event: validator_sets::Event) -> Self {
Self::ValidatorSets(event)
}
}
impl From<signals::Event> for Event {
fn from(event: signals::Event) -> Self {
Self::Signals(event)
}
}
impl From<dex::Event> for Event {
fn from(event: dex::Event) -> Self {
Self::Dex(event)
}
}
impl From<genesis_liquidity::Event> for Event {
fn from(event: genesis_liquidity::Event) -> Self {
Self::GenesisLiquidity(event)
}
}
impl From<economic_security::Event> for Event {
fn from(event: economic_security::Event) -> Self {
Self::EconomicSecurity(event)
}
}
impl From<in_instructions::Event> for Event {
fn from(event: in_instructions::Event) -> Self {
Self::InInstructions(event)
}
}