pub enum Contract {
Offered(OfferedContract),
Accepted(AcceptedContract),
Signed(SignedContract),
Confirmed(SignedContract),
PreClosed(PreClosedContract),
Closed(ClosedContract),
Refunded(SignedContract),
FailedAccept(FailedAcceptContract),
FailedSign(FailedSignContract),
Rejected(OfferedContract),
}
Expand description
Enum representing the possible states of a DLC.
Variants§
Offered(OfferedContract)
Initial state where a contract is being proposed.
Accepted(AcceptedContract)
A contract that was accepted.
Signed(SignedContract)
A contract for which signatures have been produced.
Confirmed(SignedContract)
A contract whose funding transaction was included in the blockchain with sufficient confirmations.
PreClosed(PreClosedContract)
A contract for which a CET was broadcasted, but not fully confirmed to the blockchain.
Closed(ClosedContract)
A contract for which a CET was fully confirmed to blockchain
Refunded(SignedContract)
A contract whose refund transaction was broadcast.
FailedAccept(FailedAcceptContract)
A contract that failed when verifying information from an accept message.
FailedSign(FailedSignContract)
A contract that failed when verifying information from a sign message.
Rejected(OfferedContract)
A contract that was rejected by the party to whom it was offered.
Implementations§
Source§impl Contract
impl Contract
Sourcepub fn get_id(&self) -> ContractId
pub fn get_id(&self) -> ContractId
Get the id of a contract. Returns the temporary contract id for offered and failed accept contracts.
Sourcepub fn get_id_string(&self) -> String
pub fn get_id_string(&self) -> String
Get the string representation of the contract id.
Sourcepub fn get_temporary_id(&self) -> ContractId
pub fn get_temporary_id(&self) -> ContractId
Returns the temporary contract id of a contract.
Sourcepub fn get_counter_party_id(&self) -> PublicKey
pub fn get_counter_party_id(&self) -> PublicKey
Returns the public key of the counter party’s node.
Sourcepub fn is_offer_party(&self) -> bool
pub fn is_offer_party(&self) -> bool
Checks if the contract is the offer party.
Sourcepub fn get_collateral(&self) -> (Amount, Amount, Amount)
pub fn get_collateral(&self) -> (Amount, Amount, Amount)
Get the collateral for a contract.
Sourcepub fn get_cet_locktime(&self) -> u32
pub fn get_cet_locktime(&self) -> u32
Get the CET locktime for a contract.
Sourcepub fn get_refund_locktime(&self) -> u32
pub fn get_refund_locktime(&self) -> u32
Get the refund locktime for a contract.
Sourcepub fn get_pnl(&self) -> SignedAmount
pub fn get_pnl(&self) -> SignedAmount
Get the profit and loss for a contract.
Sourcepub fn get_funding_txid(&self) -> Option<Txid>
pub fn get_funding_txid(&self) -> Option<Txid>
Get the funding txid for a contract.
Sourcepub fn get_oracle_announcement(&self) -> Option<OracleAnnouncement>
pub fn get_oracle_announcement(&self) -> Option<OracleAnnouncement>
Get the oracle announcement for a contract.
Sourcepub fn get_cet_txid(&self) -> Option<Txid>
pub fn get_cet_txid(&self) -> Option<Txid>
Get the CET transaction id.