Struct cyclos_core::states::position::PositionState
source · [−]#[repr(packed)]pub struct PositionState {
pub bump: u8,
pub liquidity: u64,
pub fee_growth_inside_0_last_x32: u64,
pub fee_growth_inside_1_last_x32: u64,
pub tokens_owed_0: u64,
pub tokens_owed_1: u64,
}Expand description
Info stored for each user’s position
PDA of [POSITION_SEED, token_0, token_1, fee, owner, tick_lower, tick_upper]
Fields
bump: u8Bump to identify PDA
liquidity: u64The amount of liquidity owned by this position
fee_growth_inside_0_last_x32: u64The token_0 fee growth per unit of liquidity as of the last update to liquidity or fees owed
fee_growth_inside_1_last_x32: u64The token_1 fee growth per unit of liquidity as of the last update to liquidity or fees owed
tokens_owed_0: u64The fees owed to the position owner in token_0
tokens_owed_1: u64The fees owed to the position owner in token_1
Implementations
sourceimpl PositionState
impl PositionState
sourcepub fn update(
&mut self,
liquidity_delta: i64,
fee_growth_inside_0_x32: u64,
fee_growth_inside_1_x32: u64
) -> Result<()>
pub fn update(
&mut self,
liquidity_delta: i64,
fee_growth_inside_0_x32: u64,
fee_growth_inside_1_x32: u64
) -> Result<()>
Credits accumulated fees to a user’s position
Arguments
self- The individual position to updateliquidity_delta- The change in pool liquidity as a result of the position updatefee_growth_inside_0_x32- The all-time fee growth in token_0, per unit of liquidity, inside the position’s tick boundariesfee_growth_inside_1_x32- The all-time fee growth in token_1, per unit of liquidity, inside the position’s tick boundaries
Trait Implementations
sourceimpl AccountDeserialize for PositionState
impl AccountDeserialize for PositionState
sourcefn try_deserialize(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
Deserializes previously initialized account data. Should fail for all
uninitialized accounts, where the bytes are zeroed. Implementations
should be unique to a particular account type so that one can never
successfully deserialize the data of one account type into another.
For example, if the SPL token program were to implement this trait,
it should be impossible to deserialize a Mint account into a token
Account. Read more
sourceimpl Clone for PositionState
impl Clone for PositionState
sourcefn clone(&self) -> PositionState
fn clone(&self) -> PositionState
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Default for PositionState
impl Default for PositionState
sourcefn default() -> PositionState
fn default() -> PositionState
Returns the “default value” for a type. Read more
sourceimpl Discriminator for PositionState
impl Discriminator for PositionState
fn discriminator() -> [u8; 8]
sourceimpl Owner for PositionState
impl Owner for PositionState
sourceimpl Zeroable for PositionState
impl Zeroable for PositionState
impl Copy for PositionState
impl Pod for PositionState
impl ZeroCopy for PositionState
Auto Trait Implementations
impl RefUnwindSafe for PositionState
impl Send for PositionState
impl Sync for PositionState
impl Unpin for PositionState
impl UnwindSafe for PositionState
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> CheckedBitPattern for T where
T: AnyBitPattern,
impl<T> CheckedBitPattern for T where
T: AnyBitPattern,
type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during is_valid_bit_pattern. Read more
fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret bits as &Self.
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more