Struct spl_governance::state::proposal::ProposalV2
source · pub struct ProposalV2 {Show 28 fields
pub account_type: GovernanceAccountType,
pub governance: Pubkey,
pub governing_token_mint: Pubkey,
pub state: ProposalState,
pub token_owner_record: Pubkey,
pub signatories_count: u8,
pub signatories_signed_off_count: u8,
pub vote_type: VoteType,
pub options: Vec<ProposalOption>,
pub deny_vote_weight: Option<u64>,
pub reserved1: u8,
pub abstain_vote_weight: Option<u64>,
pub start_voting_at: Option<UnixTimestamp>,
pub draft_at: UnixTimestamp,
pub signing_off_at: Option<UnixTimestamp>,
pub voting_at: Option<UnixTimestamp>,
pub voting_at_slot: Option<Slot>,
pub voting_completed_at: Option<UnixTimestamp>,
pub executing_at: Option<UnixTimestamp>,
pub closed_at: Option<UnixTimestamp>,
pub execution_flags: InstructionExecutionFlags,
pub max_vote_weight: Option<u64>,
pub max_voting_time: Option<u32>,
pub vote_threshold: Option<VoteThreshold>,
pub reserved: [u8; 64],
pub name: String,
pub description_link: String,
pub veto_vote_weight: u64,
}
Expand description
Governance Proposal
Fields§
§account_type: GovernanceAccountType
Governance account type
governance: Pubkey
Governance account the Proposal belongs to
governing_token_mint: Pubkey
Indicates which Governing Token is used to vote on the Proposal Whether the general Community token owners or the Council tokens owners vote on this Proposal
state: ProposalState
Current proposal state
token_owner_record: Pubkey
The TokenOwnerRecord representing the user who created and owns this Proposal
signatories_count: u8
The number of signatories assigned to the Proposal
signatories_signed_off_count: u8
The number of signatories who already signed
vote_type: VoteType
Vote type
options: Vec<ProposalOption>
Proposal options
deny_vote_weight: Option<u64>
The total weight of the Proposal rejection votes If the proposal has no deny option then the weight is None
Only proposals with the deny option can have executable instructions attached to them Without the deny option a proposal is only non executable survey
The deny options is also used for off-chain and/or manually executable proposal to make them binding as opposed to survey only proposals
reserved1: u8
Reserved space for future versions
This field is a leftover from unused veto_vote_weight: Option
abstain_vote_weight: Option<u64>
The total weight of votes Note: Abstain is not supported in the current version
start_voting_at: Option<UnixTimestamp>
Optional start time if the Proposal should not enter voting state immediately after being signed off Note: start_at is not supported in the current version
draft_at: UnixTimestamp
When the Proposal was created and entered Draft state
signing_off_at: Option<UnixTimestamp>
When Signatories started signing off the Proposal
voting_at: Option<UnixTimestamp>
When the Proposal began voting as UnixTimestamp
voting_at_slot: Option<Slot>
When the Proposal began voting as Slot Note: The slot is not currently used but the exact slot is going to be required to support snapshot based vote weights
voting_completed_at: Option<UnixTimestamp>
When the Proposal ended voting and entered either Succeeded or Defeated
executing_at: Option<UnixTimestamp>
When the Proposal entered Executing state
closed_at: Option<UnixTimestamp>
When the Proposal entered final state Completed or Cancelled and was closed
execution_flags: InstructionExecutionFlags
Instruction execution flag for ordered and transactional instructions Note: This field is not used in the current version
max_vote_weight: Option<u64>
The max vote weight for the Governing Token mint at the time Proposal was decided. It’s used to show correct vote results for historical proposals in cases when the mint supply or max weight source changed after vote was completed.
max_voting_time: Option<u32>
Max voting time for the proposal if different from parent Governance (only higher value possible). Note: This field is not used in the current version
vote_threshold: Option<VoteThreshold>
The vote threshold at the time Proposal was decided It’s used to show correct vote results for historical proposals in cases when the threshold was changed for governance config after vote was completed. TODO: Use this field to override the threshold from parent Governance (only higher value possible)
reserved: [u8; 64]
Reserved space for future versions
name: String
Proposal name
description_link: String
Link to proposal’s description
veto_vote_weight: u64
The total weight of Veto votes
Implementations§
source§impl ProposalV2
impl ProposalV2
sourcepub fn assert_can_edit_signatories(&self) -> Result<(), ProgramError>
pub fn assert_can_edit_signatories(&self) -> Result<(), ProgramError>
Checks if Signatories can be edited (added or removed) for the Proposal in the given state
sourcepub fn assert_can_sign_off(&self) -> Result<(), ProgramError>
pub fn assert_can_sign_off(&self) -> Result<(), ProgramError>
Checks if Proposal can be singed off
sourcepub fn assert_is_final_state(&self) -> Result<(), ProgramError>
pub fn assert_is_final_state(&self) -> Result<(), ProgramError>
Checks the Proposal was finalized (no more state transition will happen)
sourcepub fn assert_can_cast_vote(
&self,
config: &GovernanceConfig,
vote: &Vote,
current_unix_timestamp: UnixTimestamp
) -> Result<(), ProgramError>
pub fn assert_can_cast_vote( &self, config: &GovernanceConfig, vote: &Vote, current_unix_timestamp: UnixTimestamp ) -> Result<(), ProgramError>
Checks if Proposal can be voted on
sourcepub fn assert_can_refund_proposal_deposit(&self) -> Result<(), ProgramError>
pub fn assert_can_refund_proposal_deposit(&self) -> Result<(), ProgramError>
Checks if proposal has concluded so that security deposit is no longer needed
sourcepub fn voting_base_time_end(&self, config: &GovernanceConfig) -> UnixTimestamp
pub fn voting_base_time_end(&self, config: &GovernanceConfig) -> UnixTimestamp
Expected base vote end time determined by the configured base_voting_time and actual voting start time
sourcepub fn has_voting_base_time_ended(
&self,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> bool
pub fn has_voting_base_time_ended( &self, config: &GovernanceConfig, current_unix_timestamp: UnixTimestamp ) -> bool
Checks whether the base voting time has ended for the proposal
sourcepub fn voting_max_time_end(&self, config: &GovernanceConfig) -> UnixTimestamp
pub fn voting_max_time_end(&self, config: &GovernanceConfig) -> UnixTimestamp
Expected max vote end time determined by the configured base_voting_time, optional voting_cool_off_time and actual voting start time
sourcepub fn has_voting_max_time_ended(
&self,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> bool
pub fn has_voting_max_time_ended( &self, config: &GovernanceConfig, current_unix_timestamp: UnixTimestamp ) -> bool
Checks whether the max voting time has ended for the proposal
sourcepub fn assert_can_finalize_vote(
&self,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> Result<(), ProgramError>
pub fn assert_can_finalize_vote( &self, config: &GovernanceConfig, current_unix_timestamp: UnixTimestamp ) -> Result<(), ProgramError>
Checks if Proposal can be finalized
sourcepub fn finalize_vote(
&mut self,
max_voter_weight: u64,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp,
vote_threshold: &VoteThreshold
) -> Result<(), ProgramError>
pub fn finalize_vote( &mut self, max_voter_weight: u64, config: &GovernanceConfig, current_unix_timestamp: UnixTimestamp, vote_threshold: &VoteThreshold ) -> Result<(), ProgramError>
Finalizes vote by moving it to final state Succeeded or Defeated if max_voting_time has passed If Proposal is still within max_voting_time period then error is returned
sourcepub fn resolve_max_voter_weight(
&mut self,
account_info_iter: &mut Iter<'_, AccountInfo<'_>>,
realm: &Pubkey,
realm_data: &RealmV2,
realm_config_data: &RealmConfigAccount,
vote_governing_token_mint_info: &AccountInfo<'_>,
vote_kind: &VoteKind
) -> Result<u64, ProgramError>
pub fn resolve_max_voter_weight( &mut self, account_info_iter: &mut Iter<'_, AccountInfo<'_>>, realm: &Pubkey, realm_data: &RealmV2, realm_config_data: &RealmConfigAccount, vote_governing_token_mint_info: &AccountInfo<'_>, vote_kind: &VoteKind ) -> Result<u64, ProgramError>
Resolves max voter weight using either 1) voting governing_token_mint supply or 2) max voter weight if configured for the token mint
sourcepub fn try_tip_vote(
&mut self,
max_voter_weight: u64,
vote_tipping: &VoteTipping,
current_unix_timestamp: UnixTimestamp,
vote_threshold: &VoteThreshold,
vote_kind: &VoteKind
) -> Result<bool, ProgramError>
pub fn try_tip_vote( &mut self, max_voter_weight: u64, vote_tipping: &VoteTipping, current_unix_timestamp: UnixTimestamp, vote_threshold: &VoteThreshold, vote_kind: &VoteKind ) -> Result<bool, ProgramError>
Checks if vote can be tipped and automatically transitioned to Succeeded or Defeated state If the conditions are met the state is updated accordingly
sourcepub fn try_get_tipped_vote_state(
&mut self,
max_voter_weight: u64,
vote_tipping: &VoteTipping,
vote_threshold: &VoteThreshold,
vote_kind: &VoteKind
) -> Option<ProposalState>
pub fn try_get_tipped_vote_state( &mut self, max_voter_weight: u64, vote_tipping: &VoteTipping, vote_threshold: &VoteThreshold, vote_kind: &VoteKind ) -> Option<ProposalState>
Checks if vote can be tipped and automatically transitioned to Succeeded, Defeated or Vetoed state. If yes then Some(ProposalState) is returned and None otherwise
sourcepub fn assert_can_cancel(
&self,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> Result<(), ProgramError>
pub fn assert_can_cancel( &self, config: &GovernanceConfig, current_unix_timestamp: UnixTimestamp ) -> Result<(), ProgramError>
Checks if Proposal can be canceled in the given state
sourcepub fn assert_can_edit_instructions(&self) -> Result<(), ProgramError>
pub fn assert_can_edit_instructions(&self) -> Result<(), ProgramError>
Checks if Instructions can be edited (inserted or removed) for the Proposal in the given state It also asserts whether the Proposal is executable (has the reject option)
sourcepub fn assert_can_execute_transaction(
&self,
proposal_transaction_data: &ProposalTransactionV2,
current_unix_timestamp: UnixTimestamp
) -> Result<(), ProgramError>
pub fn assert_can_execute_transaction( &self, proposal_transaction_data: &ProposalTransactionV2, current_unix_timestamp: UnixTimestamp ) -> Result<(), ProgramError>
Checks if Instructions can be executed for the Proposal in the given state
sourcepub fn assert_can_flag_transaction_error(
&self,
proposal_transaction_data: &ProposalTransactionV2,
current_unix_timestamp: UnixTimestamp
) -> Result<(), ProgramError>
pub fn assert_can_flag_transaction_error( &self, proposal_transaction_data: &ProposalTransactionV2, current_unix_timestamp: UnixTimestamp ) -> Result<(), ProgramError>
Checks if the instruction can be flagged with error for the Proposal in the given state
sourcepub fn assert_can_complete(&self) -> Result<(), ProgramError>
pub fn assert_can_complete(&self) -> Result<(), ProgramError>
Checks if Proposal with off-chain/manual actions can be transitioned to Completed
sourcepub fn assert_valid_vote(&self, vote: &Vote) -> Result<(), ProgramError>
pub fn assert_valid_vote(&self, vote: &Vote) -> Result<(), ProgramError>
Asserts the given vote is valid for the proposal
Trait Implementations§
source§impl AccountMaxSize for ProposalV2
impl AccountMaxSize for ProposalV2
source§fn get_max_size(&self) -> Option<usize>
fn get_max_size(&self) -> Option<usize>
source§impl BorshDeserialize for ProposalV2where
GovernanceAccountType: BorshDeserialize,
Pubkey: BorshDeserialize,
ProposalState: BorshDeserialize,
u8: BorshDeserialize,
VoteType: BorshDeserialize,
Vec<ProposalOption>: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
UnixTimestamp: BorshDeserialize,
Option<Slot>: BorshDeserialize,
InstructionExecutionFlags: BorshDeserialize,
Option<u32>: BorshDeserialize,
Option<VoteThreshold>: BorshDeserialize,
[u8; 64]: BorshDeserialize,
String: BorshDeserialize,
u64: BorshDeserialize,
impl BorshDeserialize for ProposalV2where
GovernanceAccountType: BorshDeserialize,
Pubkey: BorshDeserialize,
ProposalState: BorshDeserialize,
u8: BorshDeserialize,
VoteType: BorshDeserialize,
Vec<ProposalOption>: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
UnixTimestamp: BorshDeserialize,
Option<Slot>: BorshDeserialize,
InstructionExecutionFlags: BorshDeserialize,
Option<u32>: BorshDeserialize,
Option<VoteThreshold>: BorshDeserialize,
[u8; 64]: BorshDeserialize,
String: BorshDeserialize,
u64: BorshDeserialize,
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
source§impl BorshSchema for ProposalV2where
GovernanceAccountType: BorshSchema,
Pubkey: BorshSchema,
ProposalState: BorshSchema,
u8: BorshSchema,
VoteType: BorshSchema,
Vec<ProposalOption>: BorshSchema,
Option<u64>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
UnixTimestamp: BorshSchema,
Option<Slot>: BorshSchema,
InstructionExecutionFlags: BorshSchema,
Option<u32>: BorshSchema,
Option<VoteThreshold>: BorshSchema,
[u8; 64]: BorshSchema,
String: BorshSchema,
u64: BorshSchema,
impl BorshSchema for ProposalV2where
GovernanceAccountType: BorshSchema,
Pubkey: BorshSchema,
ProposalState: BorshSchema,
u8: BorshSchema,
VoteType: BorshSchema,
Vec<ProposalOption>: BorshSchema,
Option<u64>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
UnixTimestamp: BorshSchema,
Option<Slot>: BorshSchema,
InstructionExecutionFlags: BorshSchema,
Option<u32>: BorshSchema,
Option<VoteThreshold>: BorshSchema,
[u8; 64]: BorshSchema,
String: BorshSchema,
u64: BorshSchema,
source§fn declaration() -> Declaration
fn declaration() -> Declaration
source§fn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
fn add_definitions_recursively( definitions: &mut HashMap<Declaration, Definition> )
source§fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition>
)
fn add_definition( declaration: String, definition: Definition, definitions: &mut HashMap<String, Definition> )
fn schema_container() -> BorshSchemaContainer
source§impl BorshSerialize for ProposalV2where
GovernanceAccountType: BorshSerialize,
Pubkey: BorshSerialize,
ProposalState: BorshSerialize,
u8: BorshSerialize,
VoteType: BorshSerialize,
Vec<ProposalOption>: BorshSerialize,
Option<u64>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
UnixTimestamp: BorshSerialize,
Option<Slot>: BorshSerialize,
InstructionExecutionFlags: BorshSerialize,
Option<u32>: BorshSerialize,
Option<VoteThreshold>: BorshSerialize,
[u8; 64]: BorshSerialize,
String: BorshSerialize,
u64: BorshSerialize,
impl BorshSerialize for ProposalV2where
GovernanceAccountType: BorshSerialize,
Pubkey: BorshSerialize,
ProposalState: BorshSerialize,
u8: BorshSerialize,
VoteType: BorshSerialize,
Vec<ProposalOption>: BorshSerialize,
Option<u64>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
UnixTimestamp: BorshSerialize,
Option<Slot>: BorshSerialize,
InstructionExecutionFlags: BorshSerialize,
Option<u32>: BorshSerialize,
Option<VoteThreshold>: BorshSerialize,
[u8; 64]: BorshSerialize,
String: BorshSerialize,
u64: BorshSerialize,
source§impl Clone for ProposalV2
impl Clone for ProposalV2
source§fn clone(&self) -> ProposalV2
fn clone(&self) -> ProposalV2
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ProposalV2
impl Debug for ProposalV2
source§impl IsInitialized for ProposalV2
impl IsInitialized for ProposalV2
source§fn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
source§impl PartialEq for ProposalV2
impl PartialEq for ProposalV2
source§fn eq(&self, other: &ProposalV2) -> bool
fn eq(&self, other: &ProposalV2) -> bool
self
and other
values to be equal, and is used
by ==
.