remove some boilerplate (#4143)

This commit is contained in:
Rob Walker 2019-05-06 10:11:18 -07:00 committed by GitHub
parent 88fdba5aca
commit 694d28acf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 45 deletions

View File

@ -3,17 +3,9 @@ pub mod budget_instruction;
pub mod budget_processor;
pub mod budget_state;
use solana_sdk::pubkey::Pubkey;
const BUDGET_PROGRAM_ID: [u8; 32] = [
2, 203, 81, 223, 225, 24, 34, 35, 203, 214, 138, 130, 144, 208, 35, 77, 63, 16, 87, 51, 47,
198, 115, 123, 98, 188, 19, 160, 0, 0, 0, 0,
];
pub fn id() -> Pubkey {
Pubkey::new(&BUDGET_PROGRAM_ID)
}
pub fn check_id(program_id: &Pubkey) -> bool {
program_id.as_ref() == BUDGET_PROGRAM_ID
}
solana_sdk::solana_program_id!(BUDGET_PROGRAM_ID);

View File

@ -1,5 +1,4 @@
use serde::Serialize;
use solana_sdk::pubkey::Pubkey;
pub mod config_instruction;
pub mod config_processor;
@ -9,13 +8,7 @@ const CONFIG_PROGRAM_ID: [u8; 32] = [
64, 25, 163, 35, 239, 160, 0, 0, 0, 0,
];
pub fn check_id(program_id: &Pubkey) -> bool {
program_id.as_ref() == CONFIG_PROGRAM_ID
}
pub fn id() -> Pubkey {
Pubkey::new(&CONFIG_PROGRAM_ID)
}
solana_sdk::solana_program_id!(CONFIG_PROGRAM_ID);
pub trait ConfigState: Serialize {
/// Maximum space that the serialized representation will require

View File

@ -5,17 +5,9 @@ pub mod exchange_state;
#[macro_use]
extern crate solana_metrics;
use solana_sdk::pubkey::Pubkey;
pub const EXCHANGE_PROGRAM_ID: [u8; 32] = [
3, 147, 111, 103, 210, 47, 14, 213, 108, 116, 49, 115, 232, 171, 14, 111, 167, 140, 221, 234,
33, 70, 185, 192, 42, 31, 141, 152, 0, 0, 0, 0,
];
pub fn check_id(program_id: &Pubkey) -> bool {
program_id.as_ref() == EXCHANGE_PROGRAM_ID
}
pub fn id() -> Pubkey {
Pubkey::new(&EXCHANGE_PROGRAM_ID)
}
solana_sdk::solana_program_id!(EXCHANGE_PROGRAM_ID);

View File

@ -1,17 +1,9 @@
pub mod stake_instruction;
pub mod stake_state;
use solana_sdk::pubkey::Pubkey;
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,
];
pub fn check_id(program_id: &Pubkey) -> bool {
program_id.as_ref() == STAKE_PROGRAM_ID
}
pub fn id() -> Pubkey {
Pubkey::new(&STAKE_PROGRAM_ID)
}
solana_sdk::solana_program_id!(STAKE_PROGRAM_ID);

View File

@ -2,8 +2,6 @@ pub mod storage_contract;
pub mod storage_instruction;
pub mod storage_processor;
use solana_sdk::pubkey::Pubkey;
pub const SLOTS_PER_SEGMENT: u64 = 2;
pub fn get_segment_from_slot(slot: u64) -> usize {
@ -14,11 +12,4 @@ const STORAGE_PROGRAM_ID: [u8; 32] = [
6, 162, 25, 123, 127, 68, 233, 59, 131, 151, 21, 152, 162, 120, 90, 37, 154, 88, 86, 5, 156,
221, 182, 201, 142, 103, 151, 112, 0, 0, 0, 0,
];
pub fn check_id(program_id: &Pubkey) -> bool {
program_id.as_ref() == STORAGE_PROGRAM_ID
}
pub fn id() -> Pubkey {
Pubkey::new(&STORAGE_PROGRAM_ID)
}
solana_sdk::solana_program_id!(STORAGE_PROGRAM_ID);