Skip to content

Commit

Permalink
fix ui_amount_to_amount mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
HardhatChad committed Jan 26, 2025
1 parent bd40431 commit 73142ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wasm/utils/solana-extra/src/program/spl_token/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use solana_sdk::{
// 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
(ui_amount * 10f64.powf(decimals as f64)) as u64
}

/// Convert a raw amount to its UI representation (using the decimals field defined in its mint)
Expand Down

0 comments on commit 73142ed

Please sign in to comment.