Use bs58 strings to declare IDs rather then raw bytes (#7082)

This commit is contained in:
Jack May
2019-11-21 16:34:40 -08:00
committed by GitHub
parent d9e7a5fcbe
commit d8ead57fbb
37 changed files with 81 additions and 252 deletions

View File

@ -10,12 +10,7 @@ use solana_sdk::{
};
// stake config ID
const ID: [u8; 32] = [
6, 161, 216, 23, 165, 2, 5, 11, 104, 7, 145, 230, 206, 109, 184, 142, 30, 91, 113, 80, 246, 31,
198, 121, 10, 78, 180, 209, 0, 0, 0, 0,
];
solana_sdk::solana_name_id!(ID, "StakeConfig11111111111111111111111111111111");
solana_sdk::declare_id!("StakeConfig11111111111111111111111111111111");
// means that no more than RATE of current effective stake may be added or subtracted per
// epoch

View File

@ -5,13 +5,7 @@ pub mod rewards_pools;
pub mod stake_instruction;
pub mod stake_state;
const STAKE_PROGRAM_ID: [u8; 32] = [
6, 161, 216, 23, 145, 55, 84, 42, 152, 52, 55, 189, 254, 42, 122, 178, 85, 127, 83, 92, 138,
120, 114, 43, 104, 164, 157, 192, 0, 0, 0, 0,
];
solana_sdk::declare_program!(
STAKE_PROGRAM_ID,
"Stake11111111111111111111111111111111111111",
solana_stake_program,
stake_instruction::process_instruction

View File

@ -11,18 +11,13 @@ use solana_sdk::{
};
// base rewards pool ID
const ID: [u8; 32] = [
6, 161, 216, 23, 186, 139, 91, 88, 83, 34, 32, 112, 237, 188, 184, 153, 69, 67, 238, 112, 93,
54, 133, 142, 145, 182, 214, 15, 0, 0, 0, 0,
];
solana_sdk::solana_name_id!(ID, "StakeRewards1111111111111111111111111111111");
solana_sdk::declare_id!("StakeRewards1111111111111111111111111111111");
// to cut down on collisions for redemptions, we make multiple accounts
pub const NUM_REWARDS_POOLS: usize = 256;
pub fn random_id() -> Pubkey {
let mut id = Hash::new(&ID);
let mut id = Hash::new(id().as_ref());
for _i in 0..thread_rng().gen_range(0, NUM_REWARDS_POOLS) {
id = hash(id.as_ref());