safe_token/native_mint.rs
1//! The Mint that represents the native token
2
3/// There are 10^9 lamports in one SAFE
4pub const DECIMALS: u8 = 9;
5
6// The Mint for native SAFE Token accounts
7solana_program::declare_id!("Safe111111111111111111111111111111111111111");
8
9#[cfg(test)]
10mod tests {
11 use super::*;
12 use solana_program::native_token::*;
13
14 #[test]
15 fn test_decimals() {
16 assert!(
17 (lamports_to_sol(42) - crate::amount_to_ui_amount(42, DECIMALS)).abs() < f64::EPSILON
18 );
19 assert_eq!(
20 sol_to_lamports(42.),
21 crate::ui_amount_to_amount(42., DECIMALS)
22 );
23 }
24}