Struct spl_governance::state::proposal::ProposalV2
source · [−]pub struct ProposalV2 {Show 27 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 veto_vote_weight: Option<u64>,
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_percentage: Option<VoteThresholdPercentage>,
pub reserved: [u8; 64],
pub name: String,
pub description_link: String,
}
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
veto_vote_weight: Option<u64>
The total weight of Veto votes Note: Veto is not supported in the current version
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_percentage: Option<VoteThresholdPercentage>
The vote threshold percentage 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 for 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
Implementations
sourceimpl 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_can_cast_vote(
&self,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> Result<(), ProgramError>
pub fn assert_can_cast_vote(
&self,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> Result<(), ProgramError>
Checks if Proposal can be voted on
sourcepub fn has_vote_time_ended(
&self,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> bool
pub fn has_vote_time_ended(
&self,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> bool
Checks whether the 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
) -> Result<(), ProgramError>
pub fn finalize_vote(
&mut self,
max_voter_weight: u64,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> 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,
program_id: &Pubkey,
realm_config_info: &AccountInfo<'_>,
governing_token_mint_info: &AccountInfo<'_>,
account_info_iter: &mut Iter<'_, AccountInfo<'_>>,
realm: &Pubkey,
realm_data: &RealmV2
) -> Result<u64, ProgramError>
pub fn resolve_max_voter_weight(
&mut self,
program_id: &Pubkey,
realm_config_info: &AccountInfo<'_>,
governing_token_mint_info: &AccountInfo<'_>,
account_info_iter: &mut Iter<'_, AccountInfo<'_>>,
realm: &Pubkey,
realm_data: &RealmV2
) -> Result<u64, ProgramError>
Resolves max voter weight
sourcepub fn try_tip_vote(
&mut self,
max_voter_weight: u64,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> Result<bool, ProgramError>
pub fn try_tip_vote(
&mut self,
max_voter_weight: u64,
config: &GovernanceConfig,
current_unix_timestamp: UnixTimestamp
) -> 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_vote_weight: u64,
config: &GovernanceConfig
) -> Option<ProposalState>
pub fn try_get_tipped_vote_state(
&mut self,
max_vote_weight: u64,
config: &GovernanceConfig
) -> Option<ProposalState>
Checks if vote can be tipped and automatically transitioned to Succeeded or Defeated 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_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
sourceimpl AccountMaxSize for ProposalV2
impl AccountMaxSize for ProposalV2
sourcefn get_max_size(&self) -> Option<usize>
fn get_max_size(&self) -> Option<usize>
Returns max account size or None if max size is not known and actual instance size should be used
sourceimpl BorshDeserialize for ProposalV2 where
GovernanceAccountType: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
ProposalState: BorshDeserialize,
Pubkey: BorshDeserialize,
u8: BorshDeserialize,
u8: BorshDeserialize,
VoteType: BorshDeserialize,
Vec<ProposalOption>: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
UnixTimestamp: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
Option<Slot>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
InstructionExecutionFlags: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<u32>: BorshDeserialize,
Option<VoteThresholdPercentage>: BorshDeserialize,
[u8; 64]: BorshDeserialize,
String: BorshDeserialize,
String: BorshDeserialize,
impl BorshDeserialize for ProposalV2 where
GovernanceAccountType: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
ProposalState: BorshDeserialize,
Pubkey: BorshDeserialize,
u8: BorshDeserialize,
u8: BorshDeserialize,
VoteType: BorshDeserialize,
Vec<ProposalOption>: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
UnixTimestamp: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
Option<Slot>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
Option<UnixTimestamp>: BorshDeserialize,
InstructionExecutionFlags: BorshDeserialize,
Option<u64>: BorshDeserialize,
Option<u32>: BorshDeserialize,
Option<VoteThresholdPercentage>: BorshDeserialize,
[u8; 64]: BorshDeserialize,
String: BorshDeserialize,
String: BorshDeserialize,
sourceimpl BorshSchema for ProposalV2 where
GovernanceAccountType: BorshSchema,
Pubkey: BorshSchema,
Pubkey: BorshSchema,
ProposalState: BorshSchema,
Pubkey: BorshSchema,
u8: BorshSchema,
u8: BorshSchema,
VoteType: BorshSchema,
Vec<ProposalOption>: BorshSchema,
Option<u64>: BorshSchema,
Option<u64>: BorshSchema,
Option<u64>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
UnixTimestamp: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
Option<Slot>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
InstructionExecutionFlags: BorshSchema,
Option<u64>: BorshSchema,
Option<u32>: BorshSchema,
Option<VoteThresholdPercentage>: BorshSchema,
[u8; 64]: BorshSchema,
String: BorshSchema,
String: BorshSchema,
impl BorshSchema for ProposalV2 where
GovernanceAccountType: BorshSchema,
Pubkey: BorshSchema,
Pubkey: BorshSchema,
ProposalState: BorshSchema,
Pubkey: BorshSchema,
u8: BorshSchema,
u8: BorshSchema,
VoteType: BorshSchema,
Vec<ProposalOption>: BorshSchema,
Option<u64>: BorshSchema,
Option<u64>: BorshSchema,
Option<u64>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
UnixTimestamp: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
Option<Slot>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
Option<UnixTimestamp>: BorshSchema,
InstructionExecutionFlags: BorshSchema,
Option<u64>: BorshSchema,
Option<u32>: BorshSchema,
Option<VoteThresholdPercentage>: BorshSchema,
[u8; 64]: BorshSchema,
String: BorshSchema,
String: BorshSchema,
sourcefn declaration() -> Declaration
fn declaration() -> Declaration
Get the name of the type without brackets.
sourcefn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
fn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type. Read more
sourcefn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
Helper method to add a single type definition to the map.
fn schema_container() -> BorshSchemaContainer
sourceimpl BorshSerialize for ProposalV2 where
GovernanceAccountType: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
ProposalState: BorshSerialize,
Pubkey: BorshSerialize,
u8: BorshSerialize,
u8: BorshSerialize,
VoteType: BorshSerialize,
Vec<ProposalOption>: BorshSerialize,
Option<u64>: BorshSerialize,
Option<u64>: BorshSerialize,
Option<u64>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
UnixTimestamp: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
Option<Slot>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
InstructionExecutionFlags: BorshSerialize,
Option<u64>: BorshSerialize,
Option<u32>: BorshSerialize,
Option<VoteThresholdPercentage>: BorshSerialize,
[u8; 64]: BorshSerialize,
String: BorshSerialize,
String: BorshSerialize,
impl BorshSerialize for ProposalV2 where
GovernanceAccountType: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
ProposalState: BorshSerialize,
Pubkey: BorshSerialize,
u8: BorshSerialize,
u8: BorshSerialize,
VoteType: BorshSerialize,
Vec<ProposalOption>: BorshSerialize,
Option<u64>: BorshSerialize,
Option<u64>: BorshSerialize,
Option<u64>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
UnixTimestamp: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
Option<Slot>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
Option<UnixTimestamp>: BorshSerialize,
InstructionExecutionFlags: BorshSerialize,
Option<u64>: BorshSerialize,
Option<u32>: BorshSerialize,
Option<VoteThresholdPercentage>: BorshSerialize,
[u8; 64]: BorshSerialize,
String: BorshSerialize,
String: BorshSerialize,
sourceimpl Clone for ProposalV2
impl Clone for ProposalV2
sourcefn clone(&self) -> ProposalV2
fn clone(&self) -> ProposalV2
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ProposalV2
impl Debug for ProposalV2
sourceimpl IsInitialized for ProposalV2
impl IsInitialized for ProposalV2
sourcefn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
Is initialized
sourceimpl PartialEq<ProposalV2> for ProposalV2
impl PartialEq<ProposalV2> for ProposalV2
sourcefn eq(&self, other: &ProposalV2) -> bool
fn eq(&self, other: &ProposalV2) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ProposalV2) -> bool
fn ne(&self, other: &ProposalV2) -> bool
This method tests for !=
.
impl StructuralPartialEq for ProposalV2
Auto Trait Implementations
impl RefUnwindSafe for ProposalV2
impl Send for ProposalV2
impl Sync for ProposalV2
impl Unpin for ProposalV2
impl UnwindSafe for ProposalV2
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
pub default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more