Skip to content

Commit

Permalink
Place VoterWeightRecord and MaxVoterWeightRecord by default address #31
Browse files Browse the repository at this point in the history
… (#32)

Co-authored-by: Semen Medvedev <sm@neonlabs.org>
  • Loading branch information
s-medvedev and Semen Medvedev authored May 11, 2022
1 parent cbe766a commit 6552b24
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions addin-fixed-weights/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ pub enum VoterWeightAddinInstruction {

/// Get VoterVeightRecord account address and bump seed
pub fn get_voter_weight_address(program_id: &Pubkey, realm: &Pubkey, governing_token_mint: &Pubkey, governing_token_owner: &Pubkey) -> (Pubkey, u8) {
let seeds: &[&[u8]] = &[b"voter_weight", &realm.to_bytes(), &governing_token_mint.to_bytes(), &governing_token_owner.to_bytes()];
let seeds: &[&[u8]] = &[b"voter-weight-record", &realm.to_bytes(), &governing_token_mint.to_bytes(), &governing_token_owner.to_bytes()];
Pubkey::find_program_address(seeds, program_id)
}

/// Get MaxVoterVeightRecord account address and bump seed
pub fn get_max_voter_weight_address(program_id: &Pubkey, realm: &Pubkey, governing_token_mint: &Pubkey) -> (Pubkey, u8) {
let seeds: &[&[u8]] = &[b"max_voter_weight", &realm.to_bytes(), &governing_token_mint.to_bytes()];
let seeds: &[&[u8]] = &[b"max-voter-weight-record", &realm.to_bytes(), &governing_token_mint.to_bytes()];
Pubkey::find_program_address(seeds, program_id)
}

Expand Down
4 changes: 2 additions & 2 deletions addin-fixed-weights/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn process_setup_voter_weight_record(
reserved: [0; 8],
};

let seeds: &[&[u8]] = &[b"voter_weight", &realm_info.key.to_bytes(), &governing_token_mint_info.key.to_bytes(), &governing_token_owner_info.key.to_bytes()];
let seeds: &[&[u8]] = &[b"voter-weight-record", &realm_info.key.to_bytes(), &governing_token_mint_info.key.to_bytes(), &governing_token_owner_info.key.to_bytes()];
let rent = Rent::get()?;

create_and_serialize_account_signed(
Expand Down Expand Up @@ -180,7 +180,7 @@ pub fn process_setup_max_voter_weight_record(
reserved: [0; 8],
};

let seeds: &[&[u8]] = &[b"max_voter_weight", &realm_info.key.to_bytes(), &governing_token_mint_info.key.to_bytes()];
let seeds: &[&[u8]] = &[b"max-voter-weight-record", &realm_info.key.to_bytes(), &governing_token_mint_info.key.to_bytes()];
let rent = Rent::get()?;

create_and_serialize_account_signed(
Expand Down
2 changes: 1 addition & 1 deletion addin-vesting/program/src/max_voter_weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn get_max_voter_weight_record_seeds<'a>(
realm: &'a Pubkey,
mint: &'a Pubkey,
) -> [&'a [u8]; 3] {
[b"max_voter_weight", realm.as_ref(), mint.as_ref()]
[b"max-voter-weight-record", realm.as_ref(), mint.as_ref()]
}

/// Returns MaxVoterWeightRecord PDA address
Expand Down
2 changes: 1 addition & 1 deletion addin-vesting/program/src/voter_weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn get_voter_weight_record_seeds<'a>(
mint: &'a Pubkey,
owner: &'a Pubkey,
) -> [&'a [u8]; 4] {
[b"voter_weight", realm.as_ref(), mint.as_ref(), owner.as_ref()]
[b"voter-weight-record", realm.as_ref(), mint.as_ref(), owner.as_ref()]
}

/// Returns ExtendedVoterWeightRecord PDA address
Expand Down

0 comments on commit 6552b24

Please sign in to comment.