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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! Events for the [govern] program.

use crate::*;

/// Event called in [govern::create_governor].
#[event]
pub struct GovernorCreateEvent {
    /// The governor being created.
    #[index]
    pub governor: Pubkey,
    /// The electorate of the created [Governor].
    pub electorate: Pubkey,
    /// The [SmartWallet].
    pub smart_wallet: Pubkey,
    /// Governance parameters.
    pub parameters: GovernanceParameters,
}

/// Event called in [govern::create_proposal].
#[event]
pub struct ProposalCreateEvent {
    /// The governor.
    #[index]
    pub governor: Pubkey,
    /// The proposal being created.
    #[index]
    pub proposal: Pubkey,
    /// The index of the [Proposal].
    pub index: u64,
    /// Instructions in the proposal.
    pub instructions: Vec<ProposalInstruction>,
}

/// Event called in [govern::cancel_proposal].
#[event]
pub struct ProposalActivateEvent {
    /// The governor.
    #[index]
    pub governor: Pubkey,
    /// The proposal being activated.
    #[index]
    pub proposal: Pubkey,
    /// When voting ends for the [Proposal].
    pub voting_ends_at: i64,
}

/// Event called in [govern::cancel_proposal].
#[event]
pub struct ProposalCancelEvent {
    /// The governor.
    #[index]
    pub governor: Pubkey,
    /// The proposal being canceled.
    #[index]
    pub proposal: Pubkey,
}

/// Event called in [govern::queue_proposal].
#[event]
pub struct ProposalQueueEvent {
    /// The governor.
    #[index]
    pub governor: Pubkey,
    /// The proposal being queued.
    #[index]
    pub proposal: Pubkey,
    /// The transaction key.
    #[index]
    pub transaction: Pubkey,
}

/// Event called in [govern::set_vote].
#[event]
pub struct VoteSetEvent {
    /// The governor.
    #[index]
    pub governor: Pubkey,
    /// The proposal being voted on.
    #[index]
    pub proposal: Pubkey,
    /// The voter.
    #[index]
    pub voter: Pubkey,
    /// The vote.
    #[index]
    pub vote: Pubkey,
    /// The vote side.
    #[index]
    pub side: u8,
    /// The vote's weight.
    pub weight: u64,
}

/// Event called in [govern::create_proposal_meta].
#[event]
pub struct ProposalMetaCreateEvent {
    /// The governor.
    #[index]
    pub governor: Pubkey,
    /// The proposal being voted on.
    #[index]
    pub proposal: Pubkey,
    /// The title.
    pub title: String,
    /// The description.
    pub description_link: String,
}

/// Event called in [govern::set_governance_params].
#[event]
pub struct GovernorSetParamsEvent {
    /// The governor being created.
    #[index]
    pub governor: Pubkey,
    /// Previous [GovernanceParameters].
    pub prev_params: GovernanceParameters,
    /// New [GovernanceParameters].
    pub params: GovernanceParameters,
}

/// Event called in [govern::set_electorate].
#[event]
pub struct GovernorSetElectorateEvent {
    /// The governor being created.
    #[index]
    pub governor: Pubkey,
    /// Previous [Governor::electorate].
    pub prev_electorate: Pubkey,
    /// New [Governor::electorate].
    pub new_electorate: Pubkey,
}