2020-08-14 14:13:35 -07:00
|
|
|
#![deny(missing_docs)]
|
2020-08-28 11:12:12 -07:00
|
|
|
#![forbid(unsafe_code)]
|
2020-08-14 14:13:35 -07:00
|
|
|
|
|
|
|
//! An ERC20-like Token program for the Solana blockchain
|
|
|
|
|
|
|
|
pub mod error;
|
|
|
|
pub mod instruction;
|
|
|
|
pub mod native_mint;
|
|
|
|
pub mod processor;
|
|
|
|
pub mod state;
|
|
|
|
|
2020-10-22 21:44:27 -07:00
|
|
|
#[cfg(not(feature = "exclude_entrypoint"))]
|
|
|
|
mod entrypoint;
|
|
|
|
|
|
|
|
// Export current sdk types for downstream users building with a different sdk version
|
|
|
|
pub use solana_program;
|
2020-08-14 14:13:35 -07:00
|
|
|
|
|
|
|
/// Convert the UI representation of a token amount (using the decimals field defined in its mint)
|
|
|
|
/// to the raw amount
|
|
|
|
pub fn ui_amount_to_amount(ui_amount: f64, decimals: u8) -> u64 {
|
|
|
|
(ui_amount * 10_usize.pow(decimals as u32) as f64) as u64
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Convert a raw amount to its UI representation (using the decimals field defined in its mint)
|
|
|
|
pub fn amount_to_ui_amount(amount: u64, decimals: u8) -> f64 {
|
|
|
|
amount as f64 / 10_usize.pow(decimals as u32) as f64
|
|
|
|
}
|
|
|
|
|
2020-10-22 21:44:27 -07:00
|
|
|
solana_program::declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|