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 8afc7d1
Show file tree
Hide file tree
Showing 4 changed files with 1,067 additions and 6 deletions.
26 changes: 26 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,31 @@ 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 8afc7d1

Please sign in to comment.