Calculate amounts from BTC

This commit is contained in:
Tobin C. Harding 2020-10-16 12:42:47 +11:00
parent e457130b6c
commit 1251681cfd
2 changed files with 36 additions and 11 deletions

View file

@ -43,7 +43,7 @@ pub mod monero {
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Amount(u64);
impl Amount {
@ -76,7 +76,7 @@ pub mod bitcoin {
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Amount(u64);
impl Amount {
@ -92,6 +92,10 @@ pub mod bitcoin {
pub fn from_sat(satoshi: u64) -> Amount {
Amount(satoshi)
}
pub fn as_sat(&self) -> u64 {
self.0
}
}
impl fmt::Display for Amount {