Remove lingering references to base-2 SOLs (#6629)

automerge
This commit is contained in:
Justin Starry 2019-10-30 17:59:44 -04:00 committed by Grimes
parent 6d403f2d85
commit d2d78a073f
4 changed files with 8 additions and 8 deletions

View File

@ -34,4 +34,4 @@ A cluster is a set of computers that work together and can be viewed from the ou
## What are SOLs? ## What are SOLs?
A SOL is the name of Solana's native token, which can be passed to nodes in a Solana cluster in exchange for running an on-chain program or validating its output. The system may perform micropayments of fractional SOLs and a SOL may be split as many as 34 times. The fractional sol is called a _lamport_. It is named in honor of Solana's biggest technical influence, [Leslie Lamport](https://en.wikipedia.org/wiki/Leslie_Lamport). A lamport has a value of 0.000000001 sol. A SOL is the name of Solana's native token, which can be passed to nodes in a Solana cluster in exchange for running an on-chain program or validating its output. The system may perform micropayments of fractional SOLs, which are called _lamports_. They are named in honor of Solana's biggest technical influence, [Leslie Lamport](https://en.wikipedia.org/wiki/Leslie_Lamport). A lamport has a value of 0.000000001 SOL.

View File

@ -306,7 +306,7 @@ mod tests {
let rent_calculator = solana_sdk::rent_calculator::RentCalculator::default(); let rent_calculator = solana_sdk::rent_calculator::RentCalculator::default();
let minimum_balance = rent_calculator.minimum_balance(VoteState::size_of()); let minimum_balance = rent_calculator.minimum_balance(VoteState::size_of());
// vote state cheaper than "my $0.02" ;) // vote state cheaper than "my $0.02" ;)
assert!(minimum_balance as f64 / 2f64.powf(34.0) < 0.02) assert!(minimum_balance as f64 / 10f64.powf(9.0) < 0.02)
} }
#[test] #[test]

View File

@ -1,12 +1,12 @@
/// There are 2^34 lamports in one sol /// There are 10^9 lamports in one SOL
pub const SOL_LAMPORTS: u64 = 1_000_000_000; pub const SOL_LAMPORTS: u64 = 1_000_000_000;
/// Approximately convert fractional native tokens (lamports) into native tokens (sol) /// Approximately convert fractional native tokens (lamports) into native tokens (SOL)
pub fn lamports_to_sol(lamports: u64) -> f64 { pub fn lamports_to_sol(lamports: u64) -> f64 {
lamports as f64 / SOL_LAMPORTS as f64 lamports as f64 / SOL_LAMPORTS as f64
} }
/// Approximately convert native tokens (sol) into fractional native tokens (lamports) /// Approximately convert native tokens (SOL) into fractional native tokens (lamports)
pub fn sol_to_lamports(sol: f64) -> u64 { pub fn sol_to_lamports(sol: f64) -> u64 {
(sol * SOL_LAMPORTS as f64) as u64 (sol * SOL_LAMPORTS as f64) as u64
} }

View File

@ -13,11 +13,11 @@ pub struct RentCalculator {
} }
/// default rental rate in lamports/byte-year, based on: /// default rental rate in lamports/byte-year, based on:
/// 2^^34 lamports per Sol /// 10^9 lamports per SOL
/// $1 per Sol /// $1 per SOL
/// $0.01 per megabyte day /// $0.01 per megabyte day
/// $3.65 per megabyte year /// $3.65 per megabyte year
pub const DEFAULT_LAMPORTS_PER_BYTE_YEAR: u64 = 0; //17_179_869_184 / 100 * 365 / (1024 * 1024); pub const DEFAULT_LAMPORTS_PER_BYTE_YEAR: u64 = 0; //1_000_000_000 / 100 * 365 / (1024 * 1024);
/// default amount of time (in years) the balance has to include rent for /// default amount of time (in years) the balance has to include rent for
pub const DEFAULT_EXEMPTION_THRESHOLD: f64 = 2.0; pub const DEFAULT_EXEMPTION_THRESHOLD: f64 = 2.0;