1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
//! Events emitted.
#![deny(missing_docs)]

use crate::*;

/// Emitted when a [SmartWallet] is created.
#[event]
pub struct WalletCreateEvent {
    /// The [SmartWallet].
    #[index]
    pub smart_wallet: Pubkey,
    /// The owners of the created [SmartWallet].
    pub owners: Vec<Pubkey>,
    /// The [SmartWallet::threshold] at the time of creation.
    pub threshold: u64,
    /// The [SmartWallet::minimum_delay] at the time of creation.
    pub minimum_delay: i64,
    /// The Unix timestamp when the event was emitted.
    pub timestamp: i64,
}

/// Emitted when the owners of a [SmartWallet] are changed.
#[event]
pub struct WalletSetOwnersEvent {
    /// The [SmartWallet].
    #[index]
    pub smart_wallet: Pubkey,
    /// The new owners of the [SmartWallet].
    pub owners: Vec<Pubkey>,
    /// The Unix timestamp when the event was emitted.
    pub timestamp: i64,
}

/// Emitted when the threshold of a [SmartWallet] is changed.
#[event]
pub struct WalletChangeThresholdEvent {
    /// The [SmartWallet].
    #[index]
    pub smart_wallet: Pubkey,
    /// The new [SmartWallet::threshold].
    pub threshold: u64,
    /// The Unix timestamp when the event was emitted.
    pub timestamp: i64,
}

/// Emitted when a [Transaction] is proposed.
#[event]
pub struct TransactionCreateEvent {
    /// The [SmartWallet].
    #[index]
    pub smart_wallet: Pubkey,
    /// The [Transaction].
    #[index]
    pub transaction: Pubkey,
    /// The owner which proposed the transaction.
    pub proposer: Pubkey,
    /// Instructions associated with the [Transaction].
    pub instructions: Vec<TXInstruction>,
    /// The [Transaction::eta].
    pub eta: i64,
    /// The Unix timestamp when the event was emitted.
    pub timestamp: i64,
}

/// Emitted when a [Transaction] is approved.
#[event]
pub struct TransactionApproveEvent {
    /// The [SmartWallet].
    #[index]
    pub smart_wallet: Pubkey,
    /// The [Transaction].
    #[index]
    pub transaction: Pubkey,
    /// The owner which approved the transaction.
    pub owner: Pubkey,
    /// The Unix timestamp when the event was emitted.
    pub timestamp: i64,
}

/// Emitted when a [Transaction] is unapproved.
#[event]
pub struct TransactionUnapproveEvent {
    /// The [SmartWallet].
    #[index]
    pub smart_wallet: Pubkey,
    /// The [Transaction].
    #[index]
    pub transaction: Pubkey,
    /// The owner that unapproved the transaction.
    pub owner: Pubkey,
    /// The Unix timestamp when the event was emitted.
    pub timestamp: i64,
}

/// Emitted when a [Transaction] is executed.
#[event]
pub struct TransactionExecuteEvent {
    /// The [SmartWallet].
    #[index]
    pub smart_wallet: Pubkey,
    /// The [Transaction] executed.
    #[index]
    pub transaction: Pubkey,
    /// The owner that executed the transaction.
    pub executor: Pubkey,
    /// The Unix timestamp when the event was emitted.
    pub timestamp: i64,
}