solana/src/token_program.rs

25 lines
586 B
Rust
Raw Normal View History

2018-10-08 20:41:31 -07:00
//! ERC20-like Token program
use native_loader;
use solana_sdk::account::Account;
use solana_sdk::pubkey::Pubkey;
2018-10-08 20:41:31 -07:00
const ERC20_NAME: &str = "solana_erc20";
const ERC20_PROGRAM_ID: [u8; 32] = [
131, 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,
2018-10-08 20:41:31 -07:00
];
pub fn id() -> Pubkey {
Pubkey::new(&ERC20_PROGRAM_ID)
2018-10-08 20:41:31 -07:00
}
pub fn account() -> Account {
Account {
tokens: 0,
program_id: id(),
userdata: ERC20_NAME.as_bytes().to_vec(),
executable: true,
loader_program_id: native_loader::id(),
}
2018-10-08 20:41:31 -07:00
}