@ -146,7 +146,7 @@ impl Order {
trading_pair : TradingPair ::BtcUsd ,
trading_pair : TradingPair ::BtcUsd ,
liquidation_price ,
liquidation_price ,
position : Position ::Short ,
position : Position ::Short ,
creation_timestamp : Timestamp ::now ( ) ? ,
creation_timestamp : Timestamp ::now ( ) ,
settlement_time_interval_hours ,
settlement_time_interval_hours ,
origin ,
origin ,
oracle_event_id ,
oracle_event_id ,
@ -173,7 +173,7 @@ pub struct CfdStateCommon {
impl Default for CfdStateCommon {
impl Default for CfdStateCommon {
fn default ( ) -> Self {
fn default ( ) -> Self {
Self {
Self {
transition_timestamp : Timestamp ::now ( ) . expect ( "Unable to get current time" ) ,
transition_timestamp : Timestamp ::now ( ) ,
}
}
}
}
}
}
@ -649,7 +649,7 @@ impl Cfd {
let settlement = SettlementProposal {
let settlement = SettlementProposal {
order_id : self . order . id ,
order_id : self . order . id ,
timestamp : Timestamp ::now ( ) ? ,
timestamp : Timestamp ::now ( ) ,
taker : * payout . taker_amount ( ) ,
taker : * payout . taker_amount ( ) ,
maker : * payout . maker_amount ( ) ,
maker : * payout . maker_amount ( ) ,
price : current_price ,
price : current_price ,
@ -718,7 +718,7 @@ impl Cfd {
if let PendingOpen { dlc , . . } = self . state . clone ( ) {
if let PendingOpen { dlc , . . } = self . state . clone ( ) {
CfdState ::Open {
CfdState ::Open {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
attestation : None ,
attestation : None ,
@ -733,7 +733,7 @@ impl Cfd {
{
{
CfdState ::Open {
CfdState ::Open {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
attestation ,
attestation ,
@ -770,7 +770,7 @@ impl Cfd {
OpenCommitted {
OpenCommitted {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
cet_status : if let Some ( attestation ) = attestation {
cet_status : if let Some ( attestation ) = attestation {
@ -794,7 +794,7 @@ impl Cfd {
. .
. .
} = > CfdState ::OpenCommitted {
} = > CfdState ::OpenCommitted {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
cet_status : CetStatus ::TimelockExpired ,
cet_status : CetStatus ::TimelockExpired ,
@ -805,7 +805,7 @@ impl Cfd {
. .
. .
} = > CfdState ::OpenCommitted {
} = > CfdState ::OpenCommitted {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
cet_status : CetStatus ::Ready ( attestation ) ,
cet_status : CetStatus ::Ready ( attestation ) ,
@ -822,7 +822,7 @@ impl Cfd {
tracing ::debug ! ( % order_id , "Was in unexpected state {}, jumping ahead to OpenCommitted" , self . state ) ;
tracing ::debug ! ( % order_id , "Was in unexpected state {}, jumping ahead to OpenCommitted" , self . state ) ;
CfdState ::OpenCommitted {
CfdState ::OpenCommitted {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
cet_status : match attestation {
cet_status : match attestation {
@ -904,7 +904,7 @@ impl Cfd {
self . state = PendingCommit {
self . state = PendingCommit {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
attestation ,
attestation ,
@ -931,14 +931,14 @@ impl Cfd {
let new_state = match self . state . clone ( ) {
let new_state = match self . state . clone ( ) {
CfdState ::PendingOpen { dlc , . . } = > CfdState ::PendingOpen {
CfdState ::PendingOpen { dlc , . . } = > CfdState ::PendingOpen {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
attestation : Some ( attestation ) ,
attestation : Some ( attestation ) ,
} ,
} ,
CfdState ::Open { dlc , . . } = > CfdState ::Open {
CfdState ::Open { dlc , . . } = > CfdState ::Open {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
attestation : Some ( attestation ) ,
attestation : Some ( attestation ) ,
@ -946,7 +946,7 @@ impl Cfd {
} ,
} ,
CfdState ::PendingCommit { dlc , . . } = > CfdState ::PendingCommit {
CfdState ::PendingCommit { dlc , . . } = > CfdState ::PendingCommit {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
attestation : Some ( attestation ) ,
attestation : Some ( attestation ) ,
@ -957,7 +957,7 @@ impl Cfd {
. .
. .
} = > CfdState ::OpenCommitted {
} = > CfdState ::OpenCommitted {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
cet_status : CetStatus ::OracleSigned ( attestation ) ,
cet_status : CetStatus ::OracleSigned ( attestation ) ,
@ -968,7 +968,7 @@ impl Cfd {
. .
. .
} = > CfdState ::OpenCommitted {
} = > CfdState ::OpenCommitted {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
cet_status : CetStatus ::Ready ( attestation ) ,
cet_status : CetStatus ::Ready ( attestation ) ,
@ -1003,7 +1003,7 @@ impl Cfd {
self . state = CfdState ::PendingCet {
self . state = CfdState ::PendingCet {
common : CfdStateCommon {
common : CfdStateCommon {
transition_timestamp : Timestamp ::now ( ) ? ,
transition_timestamp : Timestamp ::now ( ) ,
} ,
} ,
dlc ,
dlc ,
attestation ,
attestation ,
@ -1880,7 +1880,7 @@ impl CollaborativeSettlement {
Ok ( Self {
Ok ( Self {
tx ,
tx ,
timestamp : Timestamp ::now ( ) . context ( "Unable to get current time" ) ? ,
timestamp : Timestamp ::now ( ) ,
payout ,
payout ,
price ,
price ,
} )
} )