|
@ -4,7 +4,9 @@ use crate::db::{ |
|
|
load_cfd_by_order_id, load_order_by_id, |
|
|
load_cfd_by_order_id, load_order_by_id, |
|
|
}; |
|
|
}; |
|
|
use crate::maker_inc_connections::TakerCommand; |
|
|
use crate::maker_inc_connections::TakerCommand; |
|
|
use crate::model::cfd::{Cfd, CfdState, CfdStateChangeEvent, CfdStateCommon, Dlc, Order, OrderId}; |
|
|
use crate::model::cfd::{ |
|
|
|
|
|
Cfd, CfdState, CfdStateChangeEvent, CfdStateCommon, Dlc, Order, OrderId, SettlementProposal, |
|
|
|
|
|
}; |
|
|
use crate::model::{TakerId, Usd}; |
|
|
use crate::model::{TakerId, Usd}; |
|
|
use crate::monitor::MonitorParams; |
|
|
use crate::monitor::MonitorParams; |
|
|
use crate::wallet::Wallet; |
|
|
use crate::wallet::Wallet; |
|
@ -142,6 +144,15 @@ impl Actor { |
|
|
Ok(()) |
|
|
Ok(()) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async fn handle_propose_settlement(&mut self, proposal: SettlementProposal) -> Result<()> { |
|
|
|
|
|
tracing::info!( |
|
|
|
|
|
"Received settlement proposal from the taker: {:?}", |
|
|
|
|
|
proposal |
|
|
|
|
|
); |
|
|
|
|
|
// TODO: Handle the proposal
|
|
|
|
|
|
Ok(()) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async fn handle_inc_protocol_msg( |
|
|
async fn handle_inc_protocol_msg( |
|
|
&mut self, |
|
|
&mut self, |
|
|
taker_id: TakerId, |
|
|
taker_id: TakerId, |
|
@ -484,6 +495,19 @@ impl Handler<TakerStreamMessage> for Actor { |
|
|
wire::TakerToMaker::TakeOrder { order_id, quantity } => { |
|
|
wire::TakerToMaker::TakeOrder { order_id, quantity } => { |
|
|
log_error!(self.handle_take_order(taker, order_id, quantity)) |
|
|
log_error!(self.handle_take_order(taker, order_id, quantity)) |
|
|
} |
|
|
} |
|
|
|
|
|
wire::TakerToMaker::ProposeSettlement { |
|
|
|
|
|
order_id, |
|
|
|
|
|
timestamp, |
|
|
|
|
|
taker, |
|
|
|
|
|
maker, |
|
|
|
|
|
} => { |
|
|
|
|
|
log_error!(self.handle_propose_settlement(SettlementProposal { |
|
|
|
|
|
order_id, |
|
|
|
|
|
timestamp, |
|
|
|
|
|
taker, |
|
|
|
|
|
maker |
|
|
|
|
|
})) |
|
|
|
|
|
} |
|
|
wire::TakerToMaker::Protocol(msg) => { |
|
|
wire::TakerToMaker::Protocol(msg) => { |
|
|
log_error!(self.handle_inc_protocol_msg(taker, msg)) |
|
|
log_error!(self.handle_inc_protocol_msg(taker, msg)) |
|
|
} |
|
|
} |
|
|