pub enum STXBalance {
    Unlocked {
        amount: u128,
    },
    LockedPoxOne {
        amount_unlocked: u128,
        amount_locked: u128,
        unlock_height: u64,
    },
    LockedPoxTwo {
        amount_unlocked: u128,
        amount_locked: u128,
        unlock_height: u64,
    },
    LockedPoxThree {
        amount_unlocked: u128,
        amount_locked: u128,
        unlock_height: u64,
    },
}

Variants§

§

Unlocked

Fields

§amount: u128
§

LockedPoxOne

Fields

§amount_unlocked: u128
§amount_locked: u128
§unlock_height: u64
§

LockedPoxTwo

Fields

§amount_unlocked: u128
§amount_locked: u128
§unlock_height: u64
§

LockedPoxThree

Fields

§amount_unlocked: u128
§amount_locked: u128
§unlock_height: u64

Implementations§

§

impl STXBalance

pub const unlocked_and_v1_size: usize = 40usize

pub const v2_and_v3_size: usize = 41usize

pub const pox_2_version: u8 = 0u8

pub const pox_3_version: u8 = 1u8

pub fn zero() -> STXBalance

pub fn initial(amount: u128) -> STXBalance

pub fn unlock_height(&self) -> u64

This method returns the datastructure’s lazy view of the unlock_height: this may be updated by a canonicalized view of the account

pub fn effective_unlock_height( &self, v1_unlock_height: u32, v2_unlock_height: u32 ) -> u64

This method returns the datastructure’s lazy view of the unlock_height while factoring in the PoX 2 early unlock for PoX 1 and PoX 3 early unlock for PoX 2. This value is still lazy: this unlock height may be less than the current burn block height, if so it will be updated in a canonicalized view.

pub fn amount_locked(&self) -> u128

This method returns the datastructure’s lazy view of the amount locked: this may be updated by a canonicalized view of the account

pub fn amount_unlocked(&self) -> u128

This method returns the datastructure’s lazy view of the amount unlocked: this may be updated by a canonicalized view of the account

pub fn canonical_repr_at_block( &self, burn_block_height: u64, v1_unlock_height: u32, v2_unlock_height: u32 ) -> (STXBalance, u128)

Returns a canonicalized STXBalance at a given burn_block_height (i.e., if burn_block_height >= unlock_height, then return struct where amount_unlocked = 0, unlock_height = 0), and the amount of tokens which are “unlocked” by the canonicalization

pub fn get_available_balance_at_burn_block( &self, burn_block_height: u64, v1_unlock_height: u32, v2_unlock_height: u32 ) -> u128

pub fn get_locked_balance_at_burn_block( &self, burn_block_height: u64, v1_unlock_height: u32, v2_unlock_height: u32 ) -> (u128, u64)

pub fn get_total_balance(&self) -> u128

pub fn was_locked_by_v1(&self) -> bool

pub fn was_locked_by_v2(&self) -> bool

pub fn was_locked_by_v3(&self) -> bool

pub fn has_locked_tokens_at_burn_block( &self, burn_block_height: u64, v1_unlock_height: u32, v2_unlock_height: u32 ) -> bool

pub fn has_unlockable_tokens_at_burn_block( &self, burn_block_height: u64, v1_unlock_height: u32, v2_unlock_height: u32 ) -> bool

pub fn can_transfer_at_burn_block( &self, amount: u128, burn_block_height: u64, v1_unlock_height: u32, v2_unlock_height: u32 ) -> bool

Trait Implementations§

§

impl ClarityDeserializable<STXBalance> for STXBalance

§

impl ClaritySerializable for STXBalance

§

fn serialize(&self) -> String

§

impl Clone for STXBalance

§

fn clone(&self) -> STXBalance

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for STXBalance

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for STXBalance

§

fn deserialize<__D>( __deserializer: __D ) -> Result<STXBalance, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl PartialEq for STXBalance

§

fn eq(&self, other: &STXBalance) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for STXBalance

§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl StructuralPartialEq for STXBalance

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,