Skip to content
Snippets Groups Projects
Unverified Commit 96a679c5 authored by Shaopeng Wang's avatar Shaopeng Wang Committed by GitHub
Browse files

Add serialize and deserialze for FixedU128. (#59)

parent 4c914772
No related branches found
No related tags found
No related merge requests found
...@@ -6,9 +6,13 @@ use sp_runtime::{ ...@@ -6,9 +6,13 @@ use sp_runtime::{
Perbill, Percent, Permill, Perquintill, 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] /// 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. /// with fixed point accuracy of 10 ** 18.
#[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] #[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct FixedU128(u128); pub struct FixedU128(u128);
const DIV: u128 = 1_000_000_000_000_000_000; const DIV: u128 = 1_000_000_000_000_000_000;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment