1use std::time::Duration;
23use fedimint_core::Amount;
4use fedimint_core::core::ModuleKind;
5use fedimint_eventlog::{Event, EventKind};
6use fedimint_mint_common::{KIND, Nonce};
7use serde::{Deserialize, Serialize};
89/// Event that is emitted when a note is created.
10#[derive(Clone, Copy, Serialize, Deserialize)]
11pub struct NoteCreated {
12/// The nonce of the note
13pub nonce: Nonce,
14}
1516impl Event for NoteCreated {
17const MODULE: Option<ModuleKind> = Some(KIND);
1819const KIND: EventKind = EventKind::from_static("note-created");
20}
2122/// Event that is emitted when a note is spent.
23#[derive(Clone, Copy, Serialize, Deserialize)]
24pub struct NoteSpent {
25/// The nonce of the note
26pub nonce: Nonce,
27}
2829impl Event for NoteSpent {
30const MODULE: Option<ModuleKind> = Some(KIND);
3132const KIND: EventKind = EventKind::from_static("note-spent");
33}
3435/// Event that is emitted when ecash is spent out of band
36#[derive(Serialize, Deserialize)]
37pub struct OOBNotesSpent {
38/// The requested amount to spend out of band
39pub requested_amount: Amount,
4041/// The actual amount of ecash spent
42pub spent_amount: Amount,
4344/// The timeout before attempting to refund
45pub timeout: Duration,
4647/// Boolean that indicates if the invite code was included in the note
48 /// serialization
49pub include_invite: bool,
50}
5152impl Event for OOBNotesSpent {
53const MODULE: Option<ModuleKind> = Some(KIND);
5455const KIND: EventKind = EventKind::from_static("oob-notes-spent");
56}
5758/// Event that is emitted when out of band ecash is reissued
59#[derive(Serialize, Deserialize)]
60pub struct OOBNotesReissued {
61/// The amount of out of band ecash being reissued
62pub amount: Amount,
63}
6465impl Event for OOBNotesReissued {
66const MODULE: Option<ModuleKind> = Some(KIND);
6768const KIND: EventKind = EventKind::from_static("oob-notes-reissued");
69}