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

source

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

source

pub fn assert_can_sign_off(&self) -> Result<(), ProgramError>

Checks if Proposal can be singed off

source

pub fn assert_is_final_state(&self) -> Result<(), ProgramError>

Checks the Proposal was finalized (no more state transition will happen)

source

pub fn assert_can_cast_vote( &self, config: &GovernanceConfig, vote: &Vote, current_unix_timestamp: UnixTimestamp ) -> Result<(), ProgramError>

Checks if Proposal can be voted on

source

pub fn assert_can_refund_proposal_deposit(&self) -> Result<(), ProgramError>

Checks if proposal has concluded so that security deposit is no longer needed

source

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

source

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

source

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

source

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

source

pub fn assert_can_finalize_vote( &self, config: &GovernanceConfig, current_unix_timestamp: UnixTimestamp ) -> Result<(), ProgramError>

Checks if Proposal can be finalized

source

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

source

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

source

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

source

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

source

pub fn assert_can_cancel( &self, config: &GovernanceConfig, current_unix_timestamp: UnixTimestamp ) -> Result<(), ProgramError>

Checks if Proposal can be canceled in the given state

source

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)

source

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

source

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

source

pub fn assert_can_complete(&self) -> Result<(), ProgramError>

Checks if Proposal with off-chain/manual actions can be transitioned to Completed

source

pub fn assert_valid_vote(&self, vote: &Vote) -> Result<(), ProgramError>

Asserts the given vote is valid for the proposal

source

pub fn serialize<W: Write>(self, writer: W) -> Result<(), ProgramError>

Serializes account into the target buffer

Trait Implementations§

source§

impl AccountMaxSize for ProposalV2

source§

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
source§

impl BorshDeserialize for ProposalV2

source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>

source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

source§

impl BorshSchema for ProposalV2

source§

fn declaration() -> Declaration

Get the name of the type without brackets.
source§

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.
source§

fn add_definition( declaration: String, definition: Definition, definitions: &mut HashMap<String, Definition> )

Helper method to add a single type definition to the map.
source§

fn schema_container() -> BorshSchemaContainer

source§

impl BorshSerialize for ProposalV2

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

source§

fn try_to_vec(&self) -> Result<Vec<u8>, Error>

Serialize this instance into a vector of bytes.
source§

impl Clone for ProposalV2

source§

fn clone(&self) -> ProposalV2

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ProposalV2

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl IsInitialized for ProposalV2

source§

fn is_initialized(&self) -> bool

Is initialized
source§

impl PartialEq for ProposalV2

source§

fn eq(&self, other: &ProposalV2) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for ProposalV2

source§

impl StructuralEq for ProposalV2

source§

impl StructuralPartialEq for ProposalV2

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V