#[repr(C)]
pub enum GovernanceInstruction {
Show 26 variants
CreateRealm {
name: String,
config_args: RealmConfigArgs,
},
DepositGoverningTokens {
amount: u64,
},
WithdrawGoverningTokens {},
SetGovernanceDelegate {
new_governance_delegate: Option<Pubkey>,
},
CreateGovernance {
config: GovernanceConfig,
},
CreateProgramGovernance {
config: GovernanceConfig,
transfer_upgrade_authority: bool,
},
CreateProposal {
name: String,
description_link: String,
vote_type: VoteType,
options: Vec<String>,
use_deny_option: bool,
},
AddSignatory {
signatory: Pubkey,
},
RemoveSignatory {
signatory: Pubkey,
},
InsertTransaction {
option_index: u8,
index: u16,
hold_up_time: u32,
instructions: Vec<InstructionData>,
},
RemoveTransaction,
CancelProposal,
SignOffProposal,
CastVote {
vote: Vote,
},
FinalizeVote {},
RelinquishVote,
ExecuteTransaction,
CreateMintGovernance {
config: GovernanceConfig,
transfer_mint_authorities: bool,
},
CreateTokenGovernance {
config: GovernanceConfig,
transfer_account_authorities: bool,
},
SetGovernanceConfig {
config: GovernanceConfig,
},
FlagTransactionError,
SetRealmAuthority {
action: SetRealmAuthorityAction,
},
SetRealmConfig {
config_args: RealmConfigArgs,
},
CreateTokenOwnerRecord {},
UpdateProgramMetadata {},
CreateNativeTreasury,
}
Expand description
Instructions supported by the Governance program
Variants
CreateRealm
Creates Governance Realm account which aggregates governances for given Community Mint and optional Council Mint
[writable]
Governance Realm account. PDA seeds:[‘governance’,name][]
Realm authority[]
Community Token Mint[writable]
Community Token Holding account. PDA seeds: [‘governance’,realm,community_mint] The account will be created with the Realm PDA as its owner[signer]
Payer[]
System[]
SPL Token[]
Sysvar Rent[]
Council Token Mint - optional[writable]
Council Token Holding account - optional unless council is used. PDA seeds: [‘governance’,realm,council_mint] The account will be created with the Realm PDA as its owner[]
Optional Community Voter Weight Addin Program Id[]
Optional Max Community Voter Weight Addin Program Id[writable]
Optional RealmConfig account. PDA seeds: [‘realm-config’, realm]
DepositGoverningTokens
Fields
amount: u64
The amount to deposit into the realm
Deposits governing tokens (Community or Council) to Governance Realm and establishes your voter weight to be used for voting within the Realm Note: If subsequent (top up) deposit is made and there are active votes for the Voter then the vote weights won’t be updated automatically It can be done by relinquishing votes on active Proposals and voting again with the new weight
[]
Governance Realm account[writable]
Governing Token Holding account. PDA seeds: [‘governance’,realm, governing_token_mint][writable]
Governing Token Source account. All tokens from the account will be transferred to the Holding account[signer]
Governing Token Owner account[signer]
Governing Token Transfer authority[writable]
Token Owner Record account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner][signer]
Payer[]
System[]
SPL Token[]
Sysvar Rent
WithdrawGoverningTokens
Fields
Withdraws governing tokens (Community or Council) from Governance Realm and downgrades your voter weight within the Realm Note: It’s only possible to withdraw tokens if the Voter doesn’t have any outstanding active votes If there are any outstanding votes then they must be relinquished before tokens could be withdrawn
[]
Governance Realm account[writable]
Governing Token Holding account. PDA seeds: [‘governance’,realm, governing_token_mint][writable]
Governing Token Destination account. All tokens will be transferred to this account[signer]
Governing Token Owner account[writable]
Token Owner Record account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner][]
SPL Token
SetGovernanceDelegate
Sets Governance Delegate for the given Realm and Governing Token Mint (Community or Council) The Delegate would have voting rights and could vote on behalf of the Governing Token Owner The Delegate would also be able to create Proposals on behalf of the Governing Token Owner Note: This doesn’t take voting rights from the Token Owner who still can vote and change governance_delegate
[signer]
Current Governance Delegate or Governing Token owner[writable]
Token Owner Record
CreateGovernance
Fields
config: GovernanceConfig
Governance config
Creates Governance account which can be used to govern any arbitrary Solana account or asset
[]
Realm account the created Governance belongs to[writable]
Account Governance account. PDA seeds: [‘account-governance’, realm, governed_account][]
Account governed by this Governance Note: The account doesn’t have to exist and can be only used as a unique identifier for the Governance account[]
Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)[signer]
Payer[]
System program[]
Sysvar Rent[signer]
Governance authority[]
Realm Config[]
Optional Voter Weight Record
CreateProgramGovernance
Fields
config: GovernanceConfig
Governance config
Indicates whether Program’s upgrade_authority should be transferred to the Governance PDA If it’s set to false then it can be done at a later time However the instruction would validate the current upgrade_authority signed the transaction nonetheless
Creates Program Governance account which governs an upgradable program
[]
Realm account the created Governance belongs to[writable]
Program Governance account. PDA seeds: [‘program-governance’, realm, governed_program][]
Program governed by this Governance account[writable]
Program Data account of the Program governed by this Governance account[signer]
Current Upgrade Authority account of the Program governed by this Governance account[]
Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)[signer]
Payer[]
bpf_upgradeable_loader program[]
System program[]
Sysvar Rent[signer]
Governance authority[]
Realm Config[]
Optional Voter Weight Record
CreateProposal
Fields
name: String
UTF-8 encoded name of the proposal
description_link: String
Link to a gist explaining the proposal
vote_type: VoteType
Proposal vote type
use_deny_option: bool
Indicates whether the proposal has the deny option A proposal without the rejecting option is a non binding survey Only proposals with the rejecting option can have executable transactions
Creates Proposal account for Transactions which will be executed at some point in the future
[]
Realm account the created Proposal belongs to[writable]
Proposal account. PDA seeds [‘governance’,governance, governing_token_mint, proposal_index][writable]
Governance account[writable]
TokenOwnerRecord account of the Proposal owner[]
Governing Token Mint the Proposal is created for[signer]
Governance Authority (Token Owner or Governance Delegate)[signer]
Payer[]
System program[]
Realm Config[]
Optional Voter Weight Record
AddSignatory
Fields
signatory: Pubkey
Signatory to add to the Proposal
Adds a signatory to the Proposal which means this Proposal can’t leave Draft state until yet another Signatory signs
[writable]
Proposal account[]
TokenOwnerRecord account of the Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
Signatory Record Account[signer]
Payer[]
System program[]
Rent sysvar
RemoveSignatory
Fields
signatory: Pubkey
Signatory to remove from the Proposal
Removes a Signatory from the Proposal
[writable]
Proposal account[]
TokenOwnerRecord account of the Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
Signatory Record Account[writable]
Beneficiary Account which would receive lamports from the disposed Signatory Record Account
InsertTransaction
Fields
option_index: u8
The index of the option the transaction is for
index: u16
Transaction index to be inserted at.
hold_up_time: u32
Waiting time (in seconds) between vote period ending and this being eligible for execution
instructions: Vec<InstructionData>
Instructions Data
Inserts Transaction with a set of instructions for the Proposal at the given index position
New Transaction must be inserted at the end of the range indicated by Proposal transactions_next_index
If a Transaction replaces an existing Transaction at a given index then the old one must be removed using RemoveTransaction first
0. []
Governance account
[writable]
Proposal account[]
TokenOwnerRecord account of the Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
ProposalTransaction, account. PDA seeds: [‘governance’,proposal,index][signer]
Payer[]
System program[]
Rent sysvar
RemoveTransaction
Removes Transaction from the Proposal
[writable]
Proposal account[]
TokenOwnerRecord account of the Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
ProposalTransaction, account[writable]
Beneficiary Account which would receive lamports from the disposed ProposalTransaction account
CancelProposal
Cancels Proposal by changing its state to Canceled
[writable]
Realm account[writable]
Governance account[writable]
Proposal account[writable]
TokenOwnerRecord account of the Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)
SignOffProposal
Signs off Proposal indicating the Signatory approves the Proposal When the last Signatory signs off the Proposal it enters Voting state Note: Adding signatories to a Proposal is a quality and not a security gate and it’s entirely at the discretion of the Proposal owner If Proposal owner doesn’t designate any signatories then can sign off the Proposal themself
[writable]
Realm account[writable]
Governance account[writable]
Proposal account[signer]
Signatory account signing off the Proposal Or Proposal owner if the owner hasn’t appointed any signatories[]
TokenOwnerRecord for the Proposal owner, required when the owner signs off the Proposal Or[writable]
SignatoryRecord account, required when non owner sings off the Proposal
CastVote
Fields
vote: Vote
User’s vote
Uses your voter weight (deposited Community or Council tokens) to cast a vote on a Proposal By doing so you indicate you approve or disapprove of running the Proposal set of transactions If you tip the consensus then the transactions can begin to be run after their hold up time
[writable]
Realm account[writable]
Governance account[writable]
Proposal account[writable]
TokenOwnerRecord of the Proposal owner[writable]
TokenOwnerRecord of the voter. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner][signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
Proposal VoteRecord account. PDA seeds: [‘governance’,proposal,governing_token_owner_record][]
Governing Token Mint[signer]
Payer[]
System program[]
Realm Config[]
Optional Voter Weight Record[]
Optional Max Voter Weight Record
FinalizeVote
Fields
Finalizes vote in case the Vote was not automatically tipped within max_voting_time period
[writable]
Realm account[writable]
Governance account[writable]
Proposal account[writable]
TokenOwnerRecord of the Proposal owner[]
Governing Token Mint[]
Realm Config[]
Optional Max Voter Weight Record
RelinquishVote
Relinquish Vote removes voter weight from a Proposal and removes it from voter’s active votes If the Proposal is still being voted on then the voter’s weight won’t count towards the vote outcome If the Proposal is already in decided state then the instruction has no impact on the Proposal and only allows voters to prune their outstanding votes in case they wanted to withdraw Governing tokens from the Realm
[]
Governance account[writable]
Proposal account[writable]
TokenOwnerRecord account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner][writable]
Proposal VoteRecord account. PDA seeds: [‘governance’,proposal,governing_token_owner_record][]
Governing Token Mint[signer]
Optional Governance Authority (Token Owner or Governance Delegate) It’s required only when Proposal is still being voted on[writable]
Optional Beneficiary account which would receive lamports when VoteRecord Account is disposed It’s required only when Proposal is still being voted on
ExecuteTransaction
Executes a Transaction in the Proposal Anybody can execute transaction once Proposal has been voted Yes and transaction_hold_up time has passed The actual transaction being executed will be signed by Governance PDA the Proposal belongs to For example to execute Program upgrade the ProgramGovernance PDA would be used as the singer
[writable]
Proposal account[writable]
ProposalTransaction account you wish to execute 2+ Any extra accounts that are part of the transaction, in order
CreateMintGovernance
Fields
config: GovernanceConfig
Governance config
Indicates whether Mint’s authorities (MintTokens, FreezeAccount) should be transferred to the Governance PDA If it’s set to false then it can be done at a later time However the instruction would validate the current mint authority signed the transaction nonetheless
Creates Mint Governance account which governs a mint
[]
Realm account the created Governance belongs to[writable]
Mint Governance account. PDA seeds: [‘mint-governance’, realm, governed_mint][writable]
Mint governed by this Governance account[signer]
Current Mint authority (MintTokens and optionally FreezeAccount)[]
Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)[signer]
Payer[]
SPL Token program[]
System program[]
Sysvar Rent[signer]
Governance authority[]
Realm Config[]
Optional Voter Weight Record
CreateTokenGovernance
Fields
config: GovernanceConfig
Governance config
Indicates whether the token account authorities (AccountOwner and optionally CloseAccount) should be transferred to the Governance PDA If it’s set to false then it can be done at a later time However the instruction would validate the current token owner signed the transaction nonetheless
Creates Token Governance account which governs a token account
[]
Realm account the created Governance belongs to[writable]
Token Governance account. PDA seeds: [‘token-governance’, realm, governed_token][writable]
Token account governed by this Governance account[signer]
Current token account authority (AccountOwner and optionally CloseAccount)[]
Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)[signer]
Payer[]
SPL Token program[]
System program[]
Sysvar Rent[signer]
Governance authority[]
Realm Config[]
Optional Voter Weight Record
SetGovernanceConfig
Fields
config: GovernanceConfig
New governance config
Sets GovernanceConfig for a Governance
[]
Realm account the Governance account belongs to[writable, signer]
The Governance account the config is for
FlagTransactionError
Flags a transaction and its parent Proposal with error status It can be used by Proposal owner in case the transaction is permanently broken and can’t be executed Note: This instruction is a workaround because currently it’s not possible to catch errors from CPI calls and the Governance program has no way to know when instruction failed and flag it automatically
[writable]
Proposal account[]
TokenOwnerRecord account of the Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
ProposalTransaction account to flag
SetRealmAuthority
Fields
action: SetRealmAuthorityAction
Set action ( SetUnchecked, SetChecked, Remove)
Sets new Realm authority
[writable]
Realm account[signer]
Current Realm authority[]
New realm authority. Must be one of the realm governances when set
SetRealmConfig
Fields
config_args: RealmConfigArgs
Realm config args
Sets realm config
0. [writable]
Realm account
[signer]
Realm authority[]
Council Token Mint - optional Note: In the current version it’s only possible to remove council mint (set it to None) After setting council to None it won’t be possible to withdraw the tokens from the Realm any longer If that’s required then it must be done before executing this instruction[writable]
Council Token Holding account - optional unless council is used. PDA seeds: [‘governance’,realm,council_mint] The account will be created with the Realm PDA as its owner[]
System[writable]
RealmConfig account. PDA seeds: [‘realm-config’, realm][]
Optional Community Voter Weight Addin Program Id[]
Optional Max Community Voter Weight Addin Program Id[signer]
Optional Payer
CreateTokenOwnerRecord
Fields
Creates TokenOwnerRecord with 0 deposit amount It’s used to register TokenOwner when voter weight addin is used and the Governance program doesn’t take deposits
[]
Realm account[]
Governing Token Owner account[writable]
TokenOwnerRecord account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner][]
Governing Token Mint[signer]
Payer[]
System
UpdateProgramMetadata
Fields
Updates ProgramMetadata account The instruction dumps information implied by the program’s code into a persistent account
[writable]
ProgramMetadata account. PDA seeds: [‘metadata’][signer]
Payer[]
System
CreateNativeTreasury
Creates native SOL treasury account for a Governance account The account has no data and can be used as a payer for instructions signed by Governance PDAs or as a native SOL treasury
[]
Governance account the treasury account is for[writable]
NativeTreasury account. PDA seeds: [‘treasury’, governance][signer]
Payer[]
System
Trait Implementations
sourceimpl BorshDeserialize for GovernanceInstruction where
String: BorshDeserialize,
RealmConfigArgs: BorshDeserialize,
u64: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
String: BorshDeserialize,
String: BorshDeserialize,
VoteType: BorshDeserialize,
Vec<String>: BorshDeserialize,
bool: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
u8: BorshDeserialize,
u16: BorshDeserialize,
u32: BorshDeserialize,
Vec<InstructionData>: BorshDeserialize,
Vote: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
SetRealmAuthorityAction: BorshDeserialize,
RealmConfigArgs: BorshDeserialize,
impl BorshDeserialize for GovernanceInstruction where
String: BorshDeserialize,
RealmConfigArgs: BorshDeserialize,
u64: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
String: BorshDeserialize,
String: BorshDeserialize,
VoteType: BorshDeserialize,
Vec<String>: BorshDeserialize,
bool: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
u8: BorshDeserialize,
u16: BorshDeserialize,
u32: BorshDeserialize,
Vec<InstructionData>: BorshDeserialize,
Vote: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
SetRealmAuthorityAction: BorshDeserialize,
RealmConfigArgs: BorshDeserialize,
sourceimpl BorshSchema for GovernanceInstruction
impl BorshSchema for GovernanceInstruction
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 GovernanceInstruction where
String: BorshSerialize,
RealmConfigArgs: BorshSerialize,
u64: BorshSerialize,
Option<Pubkey>: BorshSerialize,
GovernanceConfig: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
String: BorshSerialize,
String: BorshSerialize,
VoteType: BorshSerialize,
Vec<String>: BorshSerialize,
bool: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
u8: BorshSerialize,
u16: BorshSerialize,
u32: BorshSerialize,
Vec<InstructionData>: BorshSerialize,
Vote: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
GovernanceConfig: BorshSerialize,
SetRealmAuthorityAction: BorshSerialize,
RealmConfigArgs: BorshSerialize,
impl BorshSerialize for GovernanceInstruction where
String: BorshSerialize,
RealmConfigArgs: BorshSerialize,
u64: BorshSerialize,
Option<Pubkey>: BorshSerialize,
GovernanceConfig: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
String: BorshSerialize,
String: BorshSerialize,
VoteType: BorshSerialize,
Vec<String>: BorshSerialize,
bool: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
u8: BorshSerialize,
u16: BorshSerialize,
u32: BorshSerialize,
Vec<InstructionData>: BorshSerialize,
Vote: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
GovernanceConfig: BorshSerialize,
SetRealmAuthorityAction: BorshSerialize,
RealmConfigArgs: BorshSerialize,
sourceimpl Clone for GovernanceInstruction
impl Clone for GovernanceInstruction
sourcefn clone(&self) -> GovernanceInstruction
fn clone(&self) -> GovernanceInstruction
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 GovernanceInstruction
impl Debug for GovernanceInstruction
sourceimpl PartialEq<GovernanceInstruction> for GovernanceInstruction
impl PartialEq<GovernanceInstruction> for GovernanceInstruction
sourcefn eq(&self, other: &GovernanceInstruction) -> bool
fn eq(&self, other: &GovernanceInstruction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &GovernanceInstruction) -> bool
fn ne(&self, other: &GovernanceInstruction) -> bool
This method tests for !=
.
impl StructuralPartialEq for GovernanceInstruction
Auto Trait Implementations
impl RefUnwindSafe for GovernanceInstruction
impl Send for GovernanceInstruction
impl Sync for GovernanceInstruction
impl Unpin for GovernanceInstruction
impl UnwindSafe for GovernanceInstruction
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