diff --git a/utilities/src/fixed128.rs b/utilities/src/fixed128.rs index 85cb35af39f7e1e06bcdce8011a99d594a17ab92..1de4ab4a21b1887bc2eccbeea98fcc83ad5b48b0 100644 --- a/utilities/src/fixed128.rs +++ b/utilities/src/fixed128.rs @@ -6,9 +6,13 @@ use sp_runtime::{ Perbill, Percent, Permill, Perquintill, }; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; + /// An unsigned fixed point number. Can hold any value in the range [0, 340_282_366_920_938_463_464] /// with fixed point accuracy of 10 ** 18. #[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct FixedU128(u128); const DIV: u128 = 1_000_000_000_000_000_000;