Enum spl_governance::instruction::GovernanceInstruction[][src]

#[repr(C)]
pub enum GovernanceInstruction {
Show variants CreateRealm { name: String, }, 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, },
}
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

  1. [writable] Governance Realm account. PDA seeds:[‘governance’,name]
  2. [] Community Token Mint
  3. [writable] Community Token Holding account. PDA seeds: [‘governance’,realm,community_mint] The account will be created with the Realm PDA as its owner
  4. [signer] Payer
  5. [] System
  6. [] SPL Token
  7. [] Sysvar Rent
  8. [] Council Token Mint - optional
  9. [writable] Council Token Holding account - optional. . PDA seeds: [‘governance’,realm,council_mint] The account will be created with the Realm PDA as its owner
Show fields

Fields of CreateRealm

name: String

UTF-8 encoded Governance Realm name

DepositGoverningTokens

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
Show fields

Fields of DepositGoverningTokens

WithdrawGoverningTokens

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
Show fields

Fields of WithdrawGoverningTokens

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

  1. [signer] Current Governance Delegate or Governing Token owner
  2. [writable] Token Owner Record
Show fields

Fields of SetGovernanceDelegate

new_governance_delegate: Option<Pubkey>

New Governance Delegate

CreateAccountGovernance

Creates Account Governance account which can be used to govern an arbitrary account

  1. [] Realm account the created Governance belongs to
  2. [writable] Account Governance account. PDA seeds: [‘account-governance’, realm, governed_account]
  3. [signer] Payer
  4. [] System program
  5. [] Sysvar Rent
Show fields

Fields of CreateAccountGovernance

config: GovernanceConfig

Governance config

CreateProgramGovernance

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. [writable] Program Data account of the Program governed by this Governance account
  4. [signer] Current Upgrade Authority account of the Program governed by this Governance account
  5. [signer] Payer
  6. [] bpf_upgradeable_loader program
  7. [] System program
  8. [] Sysvar Rent
Show fields

Fields of CreateProgramGovernance

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

CreateProposal

Creates Proposal account for Instructions that will be executed at some point in the future

  1. [writable] Proposal account. PDA seeds [‘governance’,governance, governing_token_mint, proposal_index]
  2. [writable] Governance account
  3. [] TokenOwnerRecord account for Proposal owner
  4. [signer] Governance Authority (Token Owner or Governance Delegate)
  5. [signer] Payer
  6. [] System program
  7. [] Rent sysvar
  8. [] Clock sysvar
Show fields

Fields of CreateProposal

name: String

UTF-8 encoded name of the proposal

description_link: String

Link to gist explaining proposal

governing_token_mint: Pubkey

Governing Token Mint the Proposal is created for

AddSignatory

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 for 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
Show fields

Fields of AddSignatory

signatory: Pubkey

Signatory to add to the Proposal

RemoveSignatory

Removes a Signatory from the Proposal

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

Fields of RemoveSignatory

signatory: Pubkey

Signatory to remove from the Proposal

InsertInstruction

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

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

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

RemoveInstruction

Removes instruction from the Proposal

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

Cancels Proposal by changing its state to Canceled

  1. [writable] Proposal account
  2. [] TokenOwnerRecord account for Proposal owner 2 [signer] Governance Authority (Token Owner or Governance Delegate)
  3. [] Clock sysvar
SignOffProposal

Signs off Proposal indicating the Signatory approves the Proposal When the last Signatory signs the Proposal state moves to Voting state

  1. [writable] Proposal account
  2. [writable] Signatory Record account
  3. [signer] Signatory account
  4. [] Clock sysvar
CastVote

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

  1. [] Governance account
  2. [writable] Proposal account
  3. [writable] Token Owner Record account. PDA seeds: [‘governance’,realm, governing_token_mint, governing_token_owner]
  4. [signer] Governance Authority (Token Owner or Governance Delegate)
  5. [writable] Proposal VoteRecord account. PDA seeds: [‘governance’,proposal,governing_token_owner_record]
  6. [] Governing Token Mint
  7. [signer] Payer
  8. [] System program
  9. [] Rent sysvar
  10. [] Clock sysvar
Show fields

Fields of CastVote

vote: Vote

Yes/No vote

FinalizeVote

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

  1. [] Governance account
  2. [writable] Proposal account
  3. [] Governing Token Mint
  4. [] Clock sysvar
Show fields

Fields of FinalizeVote

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
ExecuteInstruction

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

  1. [writable] Proposal account
  2. [writable] ProposalInstruction account you wish to execute
  3. [] Clock sysvar 3+ Any extra accounts that are part of the instruction, in order
CreateMintGovernance

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
  5. [signer] Payer
  6. [] SPL Token program
  7. [] System program
  8. [] Sysvar Rent
Show fields

Fields of CreateMintGovernance

config: GovernanceConfig

Governance config

transfer_mint_authority: bool

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

CreateTokenGovernance

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 owner
  5. [signer] Payer
  6. [] SPL Token program
  7. [] System program
  8. [] Sysvar Rent
Show fields

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

SetGovernanceConfig

Sets GovernanceConfig for a Governance

  1. [] Realm account the Governance account belongs to
  2. [writable, signer] The Governance account the config is for
Show fields

Fields of SetGovernanceConfig

config: GovernanceConfig

New governance config

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.

Whether Self is u8. NOTE: Vec<u8> is the most common use-case for serialization and deserialization, it’s worth handling it as a special case to improve performance. It’s a workaround for specific Vec<u8> implementation versus generic Vec<T> implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more

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.

Whether Self is u8. NOTE: Vec<u8> is the most common use-case for serialization and deserialization, it’s worth handling it as a special case to improve performance. It’s a workaround for specific Vec<u8> implementation versus generic Vec<T> implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more

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)

recently added

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.