From 96a679c5b38cbce8447cb743e8eefd03993f20eb Mon Sep 17 00:00:00 2001 From: Shaopeng Wang <spxwang@gmail.com> Date: Wed, 4 Dec 2019 14:58:07 +1300 Subject: [PATCH] Add serialize and deserialze for FixedU128. (#59) --- utilities/src/fixed128.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utilities/src/fixed128.rs b/utilities/src/fixed128.rs index 85cb35a..1de4ab4 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; -- GitLab