#[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

Fields

name: String

UTF-8 encoded Governance Realm name

config_args: RealmConfigArgs

Realm config args

Creates Governance Realm account which aggregates governances for given Community Mint and optional Council Mint

  1. [writable] Governance Realm account. PDA seeds:[‘governance’,name]
  2. [] Realm authority
  3. [] Community Token Mint
  4. [writable] Community Token Holding account. PDA seeds: [‘governance’,realm,community_mint] The account will be created with the Realm PDA as its owner
  5. [signer] Payer
  6. [] System
  7. [] SPL Token
  8. [] Sysvar Rent
  9. [] Council Token Mint - optional
  10. [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
  11. [] Optional Community Voter Weight Addin Program Id
  12. [] Optional Max Community Voter Weight Addin Program Id
  13. [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

  1. [] Governance Realm account
  2. [writable] Governing Token Holding account. PDA seeds: [‘governance’,realm, governing_token_mint]
  3. [writable] Governing Token Source account. All tokens from the account will be transferred to the Holding account
  4. [signer] Governing Token Owner account
  5. [signer] Governing Token Transfer authority
  6. [writable] Token Owner Record account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner]
  7. [signer] Payer
  8. [] System
  9. [] SPL Token
  10. [] 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

  1. [] Governance Realm account
  2. [writable] Governing Token Holding account. PDA seeds: [‘governance’,realm, governing_token_mint]
  3. [writable] Governing Token Destination account. All tokens will be transferred to this account
  4. [signer] Governing Token Owner account
  5. [writable] Token Owner Record account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner]
  6. [] SPL Token

SetGovernanceDelegate

Fields

new_governance_delegate: Option<Pubkey>

New Governance Delegate

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

  1. [signer] Current Governance Delegate or Governing Token owner
  2. [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

  1. [] Realm account the created Governance belongs to
  2. [writable] Account Governance account. PDA seeds: [‘account-governance’, realm, governed_account]
  3. [] 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
  4. [] Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)
  5. [signer] Payer
  6. [] System program
  7. [] Sysvar Rent
  8. [signer] Governance authority
  9. [] Realm Config
  10. [] Optional Voter Weight Record

CreateProgramGovernance

Fields

config: GovernanceConfig

Governance config

transfer_upgrade_authority: bool

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

  1. [] Realm account the created Governance belongs to
  2. [writable] Program Governance account. PDA seeds: [‘program-governance’, realm, governed_program]
  3. [] Program governed by this Governance account
  4. [writable] Program Data account of the Program governed by this Governance account
  5. [signer] Current Upgrade Authority account of the Program governed by this Governance account
  6. [] Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)
  7. [signer] Payer
  8. [] bpf_upgradeable_loader program
  9. [] System program
  10. [] Sysvar Rent
  11. [signer] Governance authority
  12. [] Realm Config
  13. [] 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

options: Vec<String>

Proposal options

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

  1. [] Realm account the created Proposal belongs to
  2. [writable] Proposal account. PDA seeds [‘governance’,governance, governing_token_mint, proposal_index]
  3. [writable] Governance account
  4. [writable] TokenOwnerRecord account of the Proposal owner
  5. [] Governing Token Mint the Proposal is created for
  6. [signer] Governance Authority (Token Owner or Governance Delegate)
  7. [signer] Payer
  8. [] System program
  9. [] Realm Config
  10. [] 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

  1. [writable] Proposal account
  2. [] TokenOwnerRecord account of the Proposal owner
  3. [signer] Governance Authority (Token Owner or Governance Delegate)
  4. [writable] Signatory Record Account
  5. [signer] Payer
  6. [] System program
  7. [] Rent sysvar

RemoveSignatory

Fields

signatory: Pubkey

Signatory to remove from the Proposal

Removes a Signatory from the Proposal

  1. [writable] Proposal account
  2. [] TokenOwnerRecord account of the Proposal owner
  3. [signer] Governance Authority (Token Owner or Governance Delegate)
  4. [writable] Signatory Record Account
  5. [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

  1. [writable] Proposal account
  2. [] TokenOwnerRecord account of the Proposal owner
  3. [signer] Governance Authority (Token Owner or Governance Delegate)
  4. [writable] ProposalTransaction, account. PDA seeds: [‘governance’,proposal,index]
  5. [signer] Payer
  6. [] System program
  7. [] Rent sysvar

RemoveTransaction

Removes Transaction from the Proposal

  1. [writable] Proposal account
  2. [] TokenOwnerRecord account of the Proposal owner
  3. [signer] Governance Authority (Token Owner or Governance Delegate)
  4. [writable] ProposalTransaction, account
  5. [writable] Beneficiary Account which would receive lamports from the disposed ProposalTransaction account

CancelProposal

Cancels Proposal by changing its state to Canceled

  1. [writable] Realm account
  2. [writable] Governance account
  3. [writable] Proposal account
  4. [writable] TokenOwnerRecord account of the Proposal owner
  5. [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

  1. [writable] Realm account
  2. [writable] Governance account
  3. [writable] Proposal account
  4. [signer] Signatory account signing off the Proposal Or Proposal owner if the owner hasn’t appointed any signatories
  5. [] 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

  1. [writable] Realm account
  2. [writable] Governance account
  3. [writable] Proposal account
  4. [writable] TokenOwnerRecord of the Proposal owner
  5. [writable] TokenOwnerRecord of the voter. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner]
  6. [signer] Governance Authority (Token Owner or Governance Delegate)
  7. [writable] Proposal VoteRecord account. PDA seeds: [‘governance’,proposal,governing_token_owner_record]
  8. [] Governing Token Mint
  9. [signer] Payer
  10. [] System program
  11. [] Realm Config
  12. [] Optional Voter Weight Record
  13. [] Optional Max Voter Weight Record

FinalizeVote

Fields

Finalizes vote in case the Vote was not automatically tipped within max_voting_time period

  1. [writable] Realm account
  2. [writable] Governance account
  3. [writable] Proposal account
  4. [writable] TokenOwnerRecord of the Proposal owner
  5. [] Governing Token Mint
  6. [] Realm Config
  7. [] 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

  1. [] Governance account
  2. [writable] Proposal account
  3. [writable] TokenOwnerRecord account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner]
  4. [writable] Proposal VoteRecord account. PDA seeds: [‘governance’,proposal,governing_token_owner_record]
  5. [] Governing Token Mint
  6. [signer] Optional Governance Authority (Token Owner or Governance Delegate) It’s required only when Proposal is still being voted on
  7. [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

  1. [writable] Proposal account
  2. [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

transfer_mint_authorities: bool

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

  1. [] Realm account the created Governance belongs to
  2. [writable] Mint Governance account. PDA seeds: [‘mint-governance’, realm, governed_mint]
  3. [writable] Mint governed by this Governance account
  4. [signer] Current Mint authority (MintTokens and optionally FreezeAccount)
  5. [] Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)
  6. [signer] Payer
  7. [] SPL Token program
  8. [] System program
  9. [] Sysvar Rent
  10. [signer] Governance authority
  11. [] Realm Config
  12. [] Optional Voter Weight Record

CreateTokenGovernance

Fields

config: GovernanceConfig

Governance config

transfer_account_authorities: bool

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

  1. [] Realm account the created Governance belongs to
  2. [writable] Token Governance account. PDA seeds: [‘token-governance’, realm, governed_token]
  3. [writable] Token account governed by this Governance account
  4. [signer] Current token account authority (AccountOwner and optionally CloseAccount)
  5. [] Governing TokenOwnerRecord account (Used only if not signed by RealmAuthority)
  6. [signer] Payer
  7. [] SPL Token program
  8. [] System program
  9. [] Sysvar Rent
  10. [signer] Governance authority
  11. [] Realm Config
  12. [] Optional Voter Weight Record

SetGovernanceConfig

Fields

config: GovernanceConfig

New governance config

Sets GovernanceConfig for a Governance

  1. [] Realm account the Governance account belongs to
  2. [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

  1. [writable] Proposal account
  2. [] TokenOwnerRecord account of the Proposal owner
  3. [signer] Governance Authority (Token Owner or Governance Delegate)
  4. [writable] ProposalTransaction account to flag

SetRealmAuthority

Fields

action: SetRealmAuthorityAction

Set action ( SetUnchecked, SetChecked, Remove)

Sets new Realm authority

  1. [writable] Realm account
  2. [signer] Current Realm authority
  3. [] 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

  1. [signer] Realm authority
  2. [] 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
  3. [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
  4. [] System
  5. [writable] RealmConfig account. PDA seeds: [‘realm-config’, realm]
  6. [] Optional Community Voter Weight Addin Program Id
  7. [] Optional Max Community Voter Weight Addin Program Id
  8. [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

  1. [] Realm account
  2. [] Governing Token Owner account
  3. [writable] TokenOwnerRecord account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner]
  4. [] Governing Token Mint
  5. [signer] Payer
  6. [] System

UpdateProgramMetadata

Fields

Updates ProgramMetadata account The instruction dumps information implied by the program’s code into a persistent account

  1. [writable] ProgramMetadata account. PDA seeds: [‘metadata’]
  2. [signer] Payer
  3. [] 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

  1. [] Governance account the treasury account is for
  2. [writable] NativeTreasury account. PDA seeds: [‘treasury’, governance]
  3. [signer] Payer
  4. [] System

Trait Implementations

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

Deserialize this instance from a slice of bytes.

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

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

Serialize this instance into a vector of bytes.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.