Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rooooooooob committed Jul 23, 2024
1 parent 3336a3a commit f0a5456
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
14 changes: 0 additions & 14 deletions chain/rust/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,20 +621,6 @@ impl Deserialize for NetworkId {
}
}

impl SubCoin {
/// Converts base 10 floats to SubCoin.
/// This is the format used by blockfrost for ex units
/// Warning: If the passed in float was not meant to be base 10
/// this might result in a slightly inaccurate fraction.
pub fn from_base10_f32(f: f32) -> Self {
let mut denom = 1u64;
while (f * (denom as f32)).fract().abs() > f32::EPSILON {
denom *= 10;
}
Self::new((f * (denom as f32)).ceil() as u64, denom)
}
}

// Represents the cddl: #6.258([+ T]) / [* T]
// it DOES NOT and CAN NOT have any encoding detials per element!
// so you can NOT use it on any primitives so must be serializable directly
Expand Down
12 changes: 0 additions & 12 deletions chain/wasm/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ impl NetworkId {
}
}


#[wasm_bindgen]
impl SubCoin {
/// Converts base 10 floats to SubCoin.
Expand Down Expand Up @@ -164,14 +163,3 @@ impl_wasm_conversions_into!(
cml_chain::SetCommitteeColdCredential,
crate::CommitteeColdCredentialList
);

#[wasm_bindgen]
impl SubCoin {
/// Converts base 10 floats to SubCoin.
/// This is the format used by blockfrost for ex units
/// Warning: If the passed in float was not meant to be base 10
/// this might result in a slightly inaccurate fraction.
pub fn from_base10_f32(f: f32) -> Self {
cml_chain::SubCoin::from_base10_f32(f).into()
}
}

0 comments on commit f0a5456

Please sign in to comment.