Struct Store

Source
#[repr(C)]
pub struct Store { pub authority: Pubkey, pub token_map: Pubkey, /* private fields */ }
Expand description

Data Store.

Fields§

§authority: Pubkey

Store authority.

§token_map: Pubkey

The token map to used.

Implementations§

Source§

impl Store

Source

pub const MAX_LEN: usize = 32usize

Maximum length of key.

Source

pub const WALLET_SEED: &'static [u8] = b"store_wallet"

Wallet Seed.

Source

pub fn init( &mut self, authority: Pubkey, key: &str, bump: u8, receiver: Pubkey, holding: Pubkey, ) -> Result<()>

Initialize.

Source

pub fn role(&self) -> &RoleStore

Get the role store.

Source

pub fn key(&self) -> Result<&str>

Get the key of the store.

Source

pub fn enable_role(&mut self, role: &str) -> Result<()>

Enable a role.

Source

pub fn disable_role(&mut self, role: &str) -> Result<()>

Disable a role.

Source

pub fn has_role(&self, authority: &Pubkey, role: &str) -> Result<bool>

Check if the roles has the given enabled role. Returns true only when the role is enabled and the roles has that role.

§Note
Source

pub fn grant(&mut self, authority: &Pubkey, role: &str) -> Result<()>

Grant a role.

Source

pub fn revoke(&mut self, authority: &Pubkey, role: &str) -> Result<()>

Revoke a role.

Source

pub fn is_authority(&self, authority: &Pubkey) -> bool

Check if the given pubkey is the authority of the store.

Source

pub fn has_admin_role(&self, authority: &Pubkey) -> Result<bool>

Check if the given authority has the ADMIN role.

§Note
Source

pub fn token_map(&self) -> Option<&Pubkey>

Get token map address.

Source

pub fn get_amount(&self, key: &str) -> Result<&Amount>

Get amount.

Source

pub fn get_amount_by_key(&self, key: AmountKey) -> &Amount

Get amount by key.

Source

pub fn get_amount_mut(&mut self, key: &str) -> Result<&mut Amount>

Get amount mutably

Source

pub fn get_factor(&self, key: &str) -> Result<&Factor>

Get factor.

Source

pub fn get_factor_by_key(&self, key: FactorKey) -> &Factor

Get factor by key.

Source

pub fn get_factor_mut(&mut self, key: &str) -> Result<&mut Factor>

Get factor mutably

Source

pub fn get_address(&self, key: &str) -> Result<&Pubkey>

Get address.

Source

pub fn get_address_by_key(&self, key: AddressKey) -> &Pubkey

Get address by key.

Source

pub fn get_address_mut(&mut self, key: &str) -> Result<&mut Pubkey>

Get address mutably

Source

pub fn request_expiration_at(&self, start: i64) -> CoreResult<i64>

Calculate the request expiration time.

Source

pub fn claimable_time_window(&self) -> Result<NonZeroU64>

Get claimable time window size.

Source

pub fn claimable_time_window_index(&self, timestamp: i64) -> Result<i64>

Get claimable time window index for the given timestamp.

Source

pub fn claimable_time_key(&self, timestamp: i64) -> Result<[u8; 8]>

Get claimable time key for the given timestamp.

Source

pub fn holding(&self) -> &Pubkey

Get holding address.

Source

pub fn validate_claim_fees_address(&self, address: &Pubkey) -> Result<()>

Validate whether fees can be claimed by this address.

Source

pub fn receiver(&self) -> Pubkey

Get the receiver address.

Source

pub fn next_receiver(&self) -> Pubkey

Get the next receiver address.

Source

pub fn gt(&self) -> &GtState

Get GT State.

Source

pub fn get_feature_disabled( &self, domain: DomainDisabledFlag, action: ActionDisabledFlag, ) -> Option<bool>

Get feature disabled.

Source

pub fn is_feature_disabled( &self, domain: DomainDisabledFlag, action: ActionDisabledFlag, ) -> bool

Is the given feature disabled.

Source

pub fn validate_feature_enabled( &self, domain: DomainDisabledFlag, action: ActionDisabledFlag, ) -> Result<()>

Validate whether the given features is enabled.

Source

pub fn has_restarted(&self) -> Result<bool>

Returns whether the cluster has restarted since last update.

Source

pub fn validate_not_restarted(&self) -> Result<&Self>

Validate the cluster has not restarted.

Source

pub fn validate_not_restarted_mut(&mut self) -> Result<&mut Self>

Validate the cluster has not restarted for mutable reference.

Source

pub fn order_fee_discount_factor( &self, rank: u8, is_referred: bool, ) -> Result<u128>

Get order fee discount factor.

Trait Implementations§

Source§

impl AccountDeserialize for Store

Source§

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.
Source§

fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>

Deserializes account data without checking the account discriminator. This should only be used on account initialization, when the bytes of the account are zeroed.
Source§

impl Clone for Store

Source§

fn clone(&self) -> Store

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
Source§

impl Debug for Store

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Discriminator for Store

Source§

impl Display for Store

Source§

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

Formats the value using the given formatter. Read more
Source§

impl InitSpace for Store

Source§

const INIT_SPACE: usize = 10_224usize

Init Space.
Source§

impl Owner for Store

Source§

fn owner() -> Pubkey

Source§

impl Seed for Store

Source§

const SEED: &'static [u8] = b"data_store"

The value of the seed is b"data_store"

Source§

impl<'a> TryFrom<&'a Store> for PriceValidator

Source§

type Error = Error

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

fn try_from(config: &'a Store) -> Result<Self>

Performs the conversion.
Source§

impl Zeroable for Store

§

fn zeroed() -> Self

Source§

impl Copy for Store

Source§

impl Pod for Store

Source§

impl ZeroCopy for Store

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnwindSafe for Store

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

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.
§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> AnyBitPattern for T
where T: Pod,

§

impl<T> NoUninit for T
where T: Pod,