Enum spl_governance::instruction::GovernanceInstruction [−][src]
#[repr(C)] pub enum GovernanceInstruction {}Show 23 variants
CreateRealm { name: String, config_args: RealmConfigArgs, }, DepositGoverningTokens {}, WithdrawGoverningTokens {}, SetGovernanceDelegate { new_governance_delegate: Option<Pubkey>, }, CreateAccountGovernance { config: GovernanceConfig, }, CreateProgramGovernance { config: GovernanceConfig, transfer_upgrade_authority: bool, }, CreateProposal { name: String, description_link: String, governing_token_mint: Pubkey, }, AddSignatory { signatory: Pubkey, }, RemoveSignatory { signatory: Pubkey, }, InsertInstruction { index: u16, hold_up_time: u32, instruction: InstructionData, }, RemoveInstruction, CancelProposal, SignOffProposal, CastVote { vote: Vote, }, FinalizeVote {}, RelinquishVote, ExecuteInstruction, CreateMintGovernance { config: GovernanceConfig, transfer_mint_authority: bool, }, CreateTokenGovernance { config: GovernanceConfig, transfer_token_owner: bool, }, SetGovernanceConfig { config: GovernanceConfig, }, FlagInstructionError, SetRealmAuthority { new_realm_authority: Option<Pubkey>, }, SetRealmConfig { config_args: RealmConfigArgs, },
Expand description
Instructions supported by the Governance program
Variants
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[]
Realm custodian - optional[]
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
Fields of CreateRealm
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
Fields of DepositGoverningTokens
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
Fields of WithdrawGoverningTokens
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
Creates Account Governance account which can be used to govern an arbitrary account
[]
Realm account the created Governance belongs to[writable]
Account Governance account. PDA seeds: [‘account-governance’, realm, governed_account][]
Account governed by this Governance account[signer]
Payer[]
System program[]
Sysvar Rent
Fields of CreateAccountGovernance
config: GovernanceConfig
Governance config
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[signer]
Payer[]
bpf_upgradeable_loader program[]
System program[]
Sysvar Rent
Fields of CreateProgramGovernance
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 Proposal account for Instructions that 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[]
TokenOwnerRecord account for Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[signer]
Payer[]
System program[]
Rent sysvar[]
Clock sysvar
Fields of CreateProposal
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 for Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
Signatory Record Account[signer]
Payer[]
System program[]
Rent sysvar
Fields of AddSignatory
signatory: Pubkey
Signatory to add to the Proposal
Removes a Signatory from the Proposal
[writable]
Proposal account[]
TokenOwnerRecord account for 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
Fields of RemoveSignatory
signatory: Pubkey
Signatory to remove from the Proposal
Inserts an instruction for the Proposal at the given index position
New Instructions must be inserted at the end of the range indicated by Proposal instructions_next_index
If an Instruction replaces an existing Instruction at a given index then the old one must be removed using RemoveInstruction first
0. []
Governance account
[writable]
Proposal account[]
TokenOwnerRecord account for Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
ProposalInstruction account. PDA seeds: [‘governance’,proposal,index][signer]
Payer[]
System program[]
Clock sysvar
Fields of InsertInstruction
index: u16
Instruction index to be inserted at.
hold_up_time: u32
Waiting time (in seconds) between vote period ending and this being eligible for execution
instruction: InstructionData
Instruction Data
Removes instruction from the Proposal
[writable]
Proposal account[]
TokenOwnerRecord account for Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
ProposalInstruction account[writable]
Beneficiary Account which would receive lamports from the disposed ProposalInstruction account
Cancels Proposal by changing its state to Canceled
[writable]
Proposal account[]
TokenOwnerRecord account for Proposal owner 2[signer]
Governance Authority (Token Owner or Governance Delegate)[]
Clock sysvar
Signs off Proposal indicating the Signatory approves the Proposal When the last Signatory signs the Proposal state moves to Voting state
[writable]
Proposal account[writable]
Signatory Record account[signer]
Signatory account[]
Clock sysvar
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 instructions If you tip the consensus then the instructions can begin to be run after their hold up time
[]
Realm account[]
Governance account[writable]
Proposal account[writable]
Token Owner Record account. 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[]
Rent sysvar[]
Clock sysvar
Fields of CastVote
vote: Vote
Yes/No vote
Finalizes vote in case the Vote was not automatically tipped within max_voting_time period
[]
Realm account[]
Governance account[writable]
Proposal account[]
Governing Token Mint[]
Clock sysvar
Fields of FinalizeVote
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
Executes an instruction in the Proposal Anybody can execute transaction once Proposal has been voted Yes and transaction_hold_up time has passed The actual instruction 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]
ProposalInstruction account you wish to execute[]
Clock sysvar 3+ Any extra accounts that are part of the instruction, in order
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[signer]
Payer[]
SPL Token program[]
System program[]
Sysvar Rent
Fields of CreateMintGovernance
config: GovernanceConfig
Governance config
Indicates whether Mint’s 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 mint authority 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 owner[signer]
Payer[]
SPL Token program[]
System program[]
Sysvar Rent
Fields of CreateTokenGovernance
config: GovernanceConfig
Governance config
transfer_token_owner: bool
Indicates whether token owner 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
Sets GovernanceConfig for a Governance
[]
Realm account the Governance account belongs to[writable, signer]
The Governance account the config is for
Fields of SetGovernanceConfig
config: GovernanceConfig
New governance config
Flags an instruction and its parent Proposal with error status It can be used by Proposal owner in case the instruction 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 for Proposal owner[signer]
Governance Authority (Token Owner or Governance Delegate)[writable]
ProposalInstruction account to flag[]
Clock sysvar
Sets new Realm authority
[writable]
Realm account[signer]
Current Realm authority
Fields of SetRealmAuthority
New realm authority or None to remove authority
Sets realm config
0. [writable]
Realm account
[signer]
Realm authority[]
Realm custodian - optional[]
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
Fields of SetRealmConfig
config_args: RealmConfigArgs
Realm config args
Trait Implementations
impl BorshDeserialize for GovernanceInstruction where
String: BorshDeserialize,
RealmConfigArgs: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
String: BorshDeserialize,
String: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
u16: BorshDeserialize,
u32: BorshDeserialize,
InstructionData: BorshDeserialize,
Vote: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
RealmConfigArgs: BorshDeserialize,
impl BorshDeserialize for GovernanceInstruction where
String: BorshDeserialize,
RealmConfigArgs: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
String: BorshDeserialize,
String: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
u16: BorshDeserialize,
u32: BorshDeserialize,
InstructionData: BorshDeserialize,
Vote: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
bool: BorshDeserialize,
GovernanceConfig: BorshDeserialize,
Option<Pubkey>: BorshDeserialize,
RealmConfigArgs: BorshDeserialize,
Get the name of the type without brackets.
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
fn 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.
impl BorshSerialize for GovernanceInstruction where
String: BorshSerialize,
RealmConfigArgs: BorshSerialize,
Option<Pubkey>: BorshSerialize,
GovernanceConfig: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
String: BorshSerialize,
String: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
u16: BorshSerialize,
u32: BorshSerialize,
InstructionData: BorshSerialize,
Vote: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
GovernanceConfig: BorshSerialize,
Option<Pubkey>: BorshSerialize,
RealmConfigArgs: BorshSerialize,
impl BorshSerialize for GovernanceInstruction where
String: BorshSerialize,
RealmConfigArgs: BorshSerialize,
Option<Pubkey>: BorshSerialize,
GovernanceConfig: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
String: BorshSerialize,
String: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
u16: BorshSerialize,
u32: BorshSerialize,
InstructionData: BorshSerialize,
Vote: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
GovernanceConfig: BorshSerialize,
bool: BorshSerialize,
GovernanceConfig: BorshSerialize,
Option<Pubkey>: BorshSerialize,
RealmConfigArgs: BorshSerialize,
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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
pub default fn example() -> T
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self