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