Class: Solace::SquadsSmartAccounts::Instructions::ActivateProposalInstruction

Inherits:
Object
  • Object
show all
Defined in:
lib/solace/squads_smart_accounts/instructions/activate_proposal_instruction.rb

Overview

Encodes the ‘activateProposal` instruction for the Squads Smart Account program.

Moves a proposal from Draft to Active so it can be voted on. Only needed for proposals created with ‘draft: true`; proposals created with `draft: false` start Active. The signer must be a smart-account member with the Initiate permission.

Accounts (in order):

0. settings — readonly, non-signer
1. signer   — writable, signer (must have the Initiate permission)
2. proposal — writable, non-signer

NOTE: unlike the other proposal-lifecycle instructions, activateProposal takes NO trailing ‘program` account (confirmed against the deployed program’s activate_proposal.rs) — the program is only the invoked program.

Constant Summary collapse

DISCRIMINATOR =

8-byte Anchor discriminator: SHA256(“global:activate_proposal”)

[90, 186, 203, 234, 70, 185, 191, 21].freeze

Class Method Summary collapse

Class Method Details

.build(settings_index:, signer_index:, proposal_index:, program_index:) ⇒ Solace::Instruction

Builds a Instruction for activateProposal.

Parameters:

  • settings_index (Integer)

    Account index of the settings account.

  • signer_index (Integer)

    Account index of the activating signer.

  • proposal_index (Integer)

    Account index of the proposal.

  • program_index (Integer)

    Account index of the Squads program (the invoked program).

Returns:

  • (Solace::Instruction)


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/solace/squads_smart_accounts/instructions/activate_proposal_instruction.rb', line 32

def self.build(
  settings_index:,
  signer_index:,
  proposal_index:,
  program_index:
)
  Solace::Instruction.new.tap do |ix|
    ix.program_index = program_index
    ix.accounts      = [
      settings_index,
      signer_index,
      proposal_index
    ]

    ix.data = data
  end
end

.dataArray<Integer>

Encodes the instruction data — the discriminator only; activateProposal takes no arguments.

Returns:

  • (Array<Integer>)

    Byte array of the encoded instruction data.



54
55
56
# File 'lib/solace/squads_smart_accounts/instructions/activate_proposal_instruction.rb', line 54

def self.data
  DISCRIMINATOR
end