pub enum VtxoPolicy {
Pubkey(PubkeyVtxoPolicy),
Checkpoint(CheckpointVtxoPolicy),
ServerHtlcSend(ServerHtlcSendVtxoPolicy),
ServerHtlcRecv(ServerHtlcRecvVtxoPolicy),
}Expand description
The output policy of the VTXO.
Variants§
Pubkey(PubkeyVtxoPolicy)
Standard VTXO output protected with a public key.
This can be the result of either:
- a board
- a round
- an arkoor tx
- change from a LN payment
Checkpoint(CheckpointVtxoPolicy)
A policy which returns all funds to the server after expiry
ServerHtlcSend(ServerHtlcSendVtxoPolicy)
A VTXO that represents an HTLC with the Ark server to send money.
ServerHtlcRecv(ServerHtlcRecvVtxoPolicy)
A VTXO that represents an HTLC with the Ark server to receive money.
Implementations§
Source§impl VtxoPolicy
impl VtxoPolicy
pub fn new_pubkey(user_pubkey: PublicKey) -> Self
pub fn new_checkpoint(user_pubkey: PublicKey) -> Self
pub fn new_server_htlc_send( user_pubkey: PublicKey, payment_hash: PaymentHash, htlc_expiry: BlockHeight, ) -> Self
Sourcepub fn new_server_htlc_recv(
user_pubkey: PublicKey,
payment_hash: PaymentHash,
htlc_expiry: BlockHeight,
htlc_expiry_delta: BlockDelta,
) -> Self
pub fn new_server_htlc_recv( user_pubkey: PublicKey, payment_hash: PaymentHash, htlc_expiry: BlockHeight, htlc_expiry_delta: BlockDelta, ) -> Self
Creates a new htlc from server to client
- user_pubkey: A public key owned by the client
- payment_hash: The payment hash, the client can claim the HTLC by revealing the corresponding pre-image
- htlc_expiry: An absolute blockheight at which the HTLC expires
- htlc_expiry_delta: A safety margin for the server. If the user
tries to exit after time-out the server will have at-least
htlc_expiry_deltablocks to claim the payment
pub fn as_pubkey(&self) -> Option<&PubkeyVtxoPolicy>
pub fn as_server_htlc_send(&self) -> Option<&ServerHtlcSendVtxoPolicy>
pub fn as_server_htlc_recv(&self) -> Option<&ServerHtlcRecvVtxoPolicy>
Sourcepub fn policy_type(&self) -> VtxoPolicyKind
pub fn policy_type(&self) -> VtxoPolicyKind
The policy type id.
Sourcepub fn is_arkoor_compatible(&self) -> bool
pub fn is_arkoor_compatible(&self) -> bool
Whether a Vtxo with this output can be spend in an arkoor tx.
Sourcepub fn arkoor_pubkey(&self) -> Option<PublicKey>
pub fn arkoor_pubkey(&self) -> Option<PublicKey>
The public key used to cosign arkoor txs spending a Vtxo with this output. This will return None if VtxoPolicy::is_arkoor_compatible returns false.
Sourcepub fn user_pubkey(&self) -> PublicKey
pub fn user_pubkey(&self) -> PublicKey
Returns the user pubkey associated with a Vtxo with this output.
Sourcepub fn user_exit_clause(&self, exit_delta: BlockDelta) -> ScriptBuf
pub fn user_exit_clause(&self, exit_delta: BlockDelta) -> ScriptBuf
Generates a script based on the exit conditions for a given policy type.
Depending on the specific policy variant, this function produces an appropriate script
that implements the user exit clause. The exit clause enforces specific rules for exiting
the contract or completing a transaction based on the provided exit_delta parameter.
Trait Implementations§
Source§impl Clone for VtxoPolicy
impl Clone for VtxoPolicy
Source§fn clone(&self) -> VtxoPolicy
fn clone(&self) -> VtxoPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VtxoPolicy
impl Debug for VtxoPolicy
Source§impl From<CheckpointVtxoPolicy> for VtxoPolicy
impl From<CheckpointVtxoPolicy> for VtxoPolicy
Source§fn from(policy: CheckpointVtxoPolicy) -> Self
fn from(policy: CheckpointVtxoPolicy) -> Self
Source§impl From<PubkeyVtxoPolicy> for VtxoPolicy
impl From<PubkeyVtxoPolicy> for VtxoPolicy
Source§fn from(policy: PubkeyVtxoPolicy) -> Self
fn from(policy: PubkeyVtxoPolicy) -> Self
Source§impl From<ServerHtlcRecvVtxoPolicy> for VtxoPolicy
impl From<ServerHtlcRecvVtxoPolicy> for VtxoPolicy
Source§fn from(policy: ServerHtlcRecvVtxoPolicy) -> Self
fn from(policy: ServerHtlcRecvVtxoPolicy) -> Self
Source§impl From<ServerHtlcSendVtxoPolicy> for VtxoPolicy
impl From<ServerHtlcSendVtxoPolicy> for VtxoPolicy
Source§fn from(policy: ServerHtlcSendVtxoPolicy) -> Self
fn from(policy: ServerHtlcSendVtxoPolicy) -> Self
Source§impl Hash for VtxoPolicy
impl Hash for VtxoPolicy
Source§impl Ord for VtxoPolicy
impl Ord for VtxoPolicy
Source§fn cmp(&self, other: &VtxoPolicy) -> Ordering
fn cmp(&self, other: &VtxoPolicy) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for VtxoPolicy
impl PartialEq for VtxoPolicy
Source§impl PartialOrd for VtxoPolicy
impl PartialOrd for VtxoPolicy
Source§impl ProtocolEncoding for VtxoPolicy
impl ProtocolEncoding for VtxoPolicy
Source§fn encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<(), Error>
fn encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<(), Error>
Source§fn decode<R: Read + ?Sized>(r: &mut R) -> Result<Self, ProtocolDecodingError>
fn decode<R: Read + ?Sized>(r: &mut R) -> Result<Self, ProtocolDecodingError>
Source§fn deserialize(byte_slice: &[u8]) -> Result<Self, ProtocolDecodingError>
fn deserialize(byte_slice: &[u8]) -> Result<Self, ProtocolDecodingError>
Source§fn serialize_hex(&self) -> String
fn serialize_hex(&self) -> String
Source§fn deserialize_hex(hex_str: &str) -> Result<Self, ProtocolDecodingError>
fn deserialize_hex(hex_str: &str) -> Result<Self, ProtocolDecodingError>
impl Eq for VtxoPolicy
impl StructuralPartialEq for VtxoPolicy
Auto Trait Implementations§
impl Freeze for VtxoPolicy
impl RefUnwindSafe for VtxoPolicy
impl Send for VtxoPolicy
impl Sync for VtxoPolicy
impl Unpin for VtxoPolicy
impl UnwindSafe for VtxoPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.