Remove token_program.rs

This commit is contained in:
Michael Vines 2018-12-03 13:56:46 -08:00
parent 63a758508a
commit d010cac8a5
5 changed files with 28 additions and 31 deletions

View File

@ -16,5 +16,5 @@ solana-sdk = { path = "../../../sdk", version = "0.11.0" }
[lib] [lib]
name = "solana_erc20" name = "solana_erc20"
crate-type = ["cdylib"] crate-type = ["lib", "cdylib"]

View File

@ -10,12 +10,33 @@ extern crate serde_derive;
#[macro_use] #[macro_use]
extern crate solana_sdk; extern crate solana_sdk;
use solana_sdk::account::KeyedAccount; use solana_sdk::account::{Account, KeyedAccount};
use solana_sdk::native_loader;
use solana_sdk::pubkey::Pubkey; use solana_sdk::pubkey::Pubkey;
use std::sync::{Once, ONCE_INIT}; use std::sync::{Once, ONCE_INIT};
mod token_program; mod token_program;
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,
];
pub fn id() -> Pubkey {
Pubkey::new(&ERC20_PROGRAM_ID)
}
pub fn account() -> Account {
Account {
tokens: 1,
owner: id(),
userdata: ERC20_NAME.as_bytes().to_vec(),
executable: true,
loader: native_loader::id(),
}
}
solana_entrypoint!(entrypoint); solana_entrypoint!(entrypoint);
fn entrypoint( fn entrypoint(
program_id: &Pubkey, program_id: &Pubkey,

View File

@ -22,6 +22,7 @@ use poh_service::NUM_TICKS_PER_SECOND;
use rayon::prelude::*; use rayon::prelude::*;
use rpc::RpcSignatureStatus; use rpc::RpcSignatureStatus;
use runtime::{self, RuntimeError}; use runtime::{self, RuntimeError};
use solana_erc20;
use solana_sdk::account::Account; use solana_sdk::account::Account;
use solana_sdk::hash::{hash, Hash}; use solana_sdk::hash::{hash, Hash};
use solana_sdk::native_program::ProgramError; use solana_sdk::native_program::ProgramError;
@ -39,7 +40,6 @@ use std::sync::{Arc, Mutex, RwLock};
use std::time::Instant; use std::time::Instant;
use system_program; use system_program;
use system_transaction::SystemTransaction; use system_transaction::SystemTransaction;
use token_program;
use tokio::prelude::Future; use tokio::prelude::Future;
/// The number of most recent `last_id` values that the bank will track the signatures /// The number of most recent `last_id` values that the bank will track the signatures
@ -405,7 +405,7 @@ impl Bank {
accounts.store(&bpf_loader::id(), &bpf_loader::account()); accounts.store(&bpf_loader::id(), &bpf_loader::account());
// Preload Erc20 token program // Preload Erc20 token program
accounts.store(&token_program::id(), &token_program::account()); accounts.store(&solana_erc20::id(), &solana_erc20::account());
} }
/// Return the last entry ID registered. /// Return the last entry ID registered.
@ -2142,7 +2142,7 @@ mod tests {
assert_eq!(bpf_loader::id(), bpf); assert_eq!(bpf_loader::id(), bpf);
assert_eq!(budget_program::id(), budget); assert_eq!(budget_program::id(), budget);
assert_eq!(storage_program::id(), storage); assert_eq!(storage_program::id(), storage);
assert_eq!(token_program::id(), token); assert_eq!(solana_erc20::id(), token);
assert_eq!(vote_program::id(), vote); assert_eq!(vote_program::id(), vote);
} }
@ -2155,7 +2155,7 @@ mod tests {
bpf_loader::id(), bpf_loader::id(),
budget_program::id(), budget_program::id(),
storage_program::id(), storage_program::id(),
token_program::id(), solana_erc20::id(),
vote_program::id(), vote_program::id(),
]; ];
assert!(ids.into_iter().all(move |id| unique.insert(id))); assert!(ids.into_iter().all(move |id| unique.insert(id)));

View File

@ -77,7 +77,6 @@ pub mod streamer;
pub mod system_program; pub mod system_program;
pub mod system_transaction; pub mod system_transaction;
pub mod thin_client; pub mod thin_client;
pub mod token_program;
pub mod tpu; pub mod tpu;
pub mod tpu_forwarder; pub mod tpu_forwarder;
pub mod tvu; pub mod tvu;
@ -127,6 +126,7 @@ extern crate solana_jsonrpc_core as jsonrpc_core;
extern crate solana_jsonrpc_http_server as jsonrpc_http_server; extern crate solana_jsonrpc_http_server as jsonrpc_http_server;
#[macro_use] #[macro_use]
extern crate solana_jsonrpc_macros as jsonrpc_macros; extern crate solana_jsonrpc_macros as jsonrpc_macros;
extern crate solana_erc20;
extern crate solana_jsonrpc_pubsub as jsonrpc_pubsub; extern crate solana_jsonrpc_pubsub as jsonrpc_pubsub;
extern crate solana_jsonrpc_ws_server as jsonrpc_ws_server; extern crate solana_jsonrpc_ws_server as jsonrpc_ws_server;
extern crate solana_metrics; extern crate solana_metrics;

View File

@ -1,24 +0,0 @@
//! ERC20-like Token program
use solana_sdk::account::Account;
use solana_sdk::native_loader;
use solana_sdk::pubkey::Pubkey;
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,
];
pub fn id() -> Pubkey {
Pubkey::new(&ERC20_PROGRAM_ID)
}
pub fn account() -> Account {
Account {
tokens: 1,
owner: id(),
userdata: ERC20_NAME.as_bytes().to_vec(),
executable: true,
loader: native_loader::id(),
}
}