pub struct ChannelEntry {
pub source: Address,
pub destination: Address,
pub balance: HoprBalance,
pub ticket_index: U256,
pub status: ChannelStatus,
pub channel_epoch: U256,
/* private fields */
}
Expand description
Overall description of a channel
Fields§
§source: Address
§destination: Address
§balance: HoprBalance
§ticket_index: U256
§status: ChannelStatus
§channel_epoch: U256
Implementations§
Source§impl ChannelEntry
impl ChannelEntry
Sourcepub const MAX_CHANNEL_BALANCE: u128 = 10_000_000_000_000_000_000_000_000u128
pub const MAX_CHANNEL_BALANCE: u128 = 10_000_000_000_000_000_000_000_000u128
Maximum possible balance of a channel: 10^25 wxHOPR
pub fn new( source: Address, destination: Address, balance: HoprBalance, ticket_index: U256, status: ChannelStatus, channel_epoch: U256, ) -> Self
Sourcepub fn get_id(&self) -> ChannelId
pub fn get_id(&self) -> ChannelId
Generates the channel ID using the source and destination address
Sourcepub fn closure_time_passed(&self, current_time: SystemTime) -> bool
pub fn closure_time_passed(&self, current_time: SystemTime) -> bool
Checks if the closure time of this channel has passed.
Also returns false
if the channel closure has not been initiated (it is in Open
state).
Returns also true
, if the channel is in Closed
state.
Sourcepub fn remaining_closure_time(
&self,
current_time: SystemTime,
) -> Option<Duration>
pub fn remaining_closure_time( &self, current_time: SystemTime, ) -> Option<Duration>
Calculates the remaining channel closure grace period.
Returns None
if the channel closure has not been initiated yet (channel is in Open
state).
Sourcepub fn closure_time_at(&self) -> Option<SystemTime>
pub fn closure_time_at(&self) -> Option<SystemTime>
Returns the earliest time the channel can transition from PendingToClose
into Closed
.
If the channel is not in PendingToClose
state, returns None
.
Sourcepub fn direction(&self, me: &Address) -> Option<ChannelDirection>
pub fn direction(&self, me: &Address) -> Option<ChannelDirection>
Determines the channel direction given the self address.
Returns None
if neither source nor destination are equal to me
.
Sourcepub fn orientation(&self, me: &Address) -> Option<(ChannelDirection, Address)>
pub fn orientation(&self, me: &Address) -> Option<(ChannelDirection, Address)>
Determines the channel’s direction and counterparty relative to me
.
Returns None
if neither source nor destination are equal to me
.
Trait Implementations§
Source§impl Clone for ChannelEntry
impl Clone for ChannelEntry
Source§fn clone(&self) -> ChannelEntry
fn clone(&self) -> ChannelEntry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ChannelEntry
impl Debug for ChannelEntry
Source§impl<'de> Deserialize<'de> for ChannelEntry
impl<'de> Deserialize<'de> for ChannelEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ChannelEntry
impl Display for ChannelEntry
Source§impl PartialEq for ChannelEntry
impl PartialEq for ChannelEntry
Source§impl Serialize for ChannelEntry
impl Serialize for ChannelEntry
impl Copy for ChannelEntry
impl StructuralPartialEq for ChannelEntry
Auto Trait Implementations§
impl Freeze for ChannelEntry
impl RefUnwindSafe for ChannelEntry
impl Send for ChannelEntry
impl Sync for ChannelEntry
impl Unpin for ChannelEntry
impl UnwindSafe for ChannelEntry
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.