Verify amounts with user

This commit is contained in:
Tobin C. Harding 2020-10-16 10:43:32 +11:00
parent 05766d3146
commit 3492c46e71
4 changed files with 55 additions and 28 deletions

View file

@ -1,4 +1,5 @@
use serde::{Deserialize, Serialize};
use std::fmt::{self, Display};
pub mod alice;
pub mod bob;
@ -9,13 +10,13 @@ pub const ONE_BTC: u64 = 100_000_000;
pub type Never = std::convert::Infallible;
/// Commands sent from Bob to the main task.
#[derive(Debug)]
#[derive(Clone, Copy, Debug)]
pub enum Cmd {
VerifyAmounts(SwapParams),
}
/// Responses send from the main task back to Bob.
#[derive(Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Rsp {
Verified,
Abort,
@ -30,6 +31,12 @@ pub struct SwapParams {
pub xmr: monero::Amount,
}
impl Display for SwapParams {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{} for {}", self.btc, self.xmr)
}
}
// FIXME: Amount modules are a quick hack so we can derive serde.
pub mod monero {