mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-30 20:46:33 -05:00
Calculate amounts from BTC
This commit is contained in:
parent
e457130b6c
commit
1251681cfd
2 changed files with 36 additions and 11 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue