Add a configurable spread to the ASB

Fixes #381.
This commit is contained in:
Thomas Eizinger 2021-04-01 13:00:15 +11:00
parent 3e0301a9d4
commit a99d12b9df
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
6 changed files with 109 additions and 20 deletions

View file

@ -96,6 +96,10 @@ impl Amount {
Self::from_decimal(decimal)
}
pub fn as_piconero_decimal(&self) -> Decimal {
Decimal::from(self.as_piconero())
}
fn from_decimal(amount: Decimal) -> Result<Self> {
let piconeros_dec =
amount.mul(Decimal::from_u64(PICONERO_OFFSET).expect("constant to fit into u64"));