Skip to content

Commit

Permalink
Governance: Adding weighted choice for the VoteType
Browse files Browse the repository at this point in the history
  • Loading branch information
ochaloup committed Oct 17, 2022
1 parent a7f6f88 commit 14aa59f
Show file tree
Hide file tree
Showing 4 changed files with 1,064 additions and 6 deletions.
23 changes: 23 additions & 0 deletions governance/program/src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mod process_update_program_metadata;
mod process_withdraw_governing_tokens;

use crate::instruction::GovernanceInstruction;
use crate::state::vote_record::Vote;

use process_add_signatory::*;
use process_cancel_proposal::*;
Expand Down Expand Up @@ -88,6 +89,28 @@ pub fn process_instruction(
index,
hold_up_time
);
} else if let GovernanceInstruction::CreateProposal {
name,
description_link,
vote_type,
options,
use_deny_option,
} = &instruction
{
// Do not iterate through options
msg!("GOVERNANCE-INSTRUCTION: CreateProposal {{name: {:?}, description_link: {:?}, vote_type: {:?}, use_deny_option: {:?}, number of options: {} }}",
name,
description_link,
vote_type,
use_deny_option,
options.len()
);
} else if let GovernanceInstruction::CastVote {
vote: Vote::Approve(v),
} = &instruction
{
// Do not iterate through options
msg!("GOVERNANCE-INSTRUCTION: CastVote {{Vote::Approve (number of options: {:?}) }}", v.len());
} else {
msg!("GOVERNANCE-INSTRUCTION: {:?}", instruction);
}
Expand Down
Loading

0 comments on commit 14aa59f

Please sign in to comment.