solana/sdk/src/native_loader.rs

25 lines
631 B
Rust
Raw Normal View History

2019-02-13 19:43:56 -08:00
use crate::account::Account;
2018-12-14 20:39:10 -08:00
use crate::pubkey::Pubkey;
2018-12-03 13:31:11 -08:00
2019-03-02 17:17:17 -08:00
const NATIVE_LOADER_PROGRAM_ID: [u8; 32] = [
2018-12-03 13:31:11 -08:00
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
];
pub fn id() -> Pubkey {
Pubkey::new(&NATIVE_LOADER_PROGRAM_ID)
}
pub fn check_id(program_id: &Pubkey) -> bool {
program_id.as_ref() == NATIVE_LOADER_PROGRAM_ID
}
2019-02-13 19:43:56 -08:00
/// Create an executable account with the given shared object name.
pub fn create_program_account(name: &str) -> Account {
2019-02-13 19:43:56 -08:00
Account {
2019-03-05 16:28:14 -08:00
lamports: 1,
owner: id(),
data: name.as_bytes().to_vec(),
2019-02-13 19:43:56 -08:00
executable: true,
}
}