#[repr(C)]pub struct Store {
pub authority: Pubkey,
pub token_map: Pubkey,
/* private fields */
}
Expand description
Data Store.
Fields§
Store authority.
token_map: Pubkey
The token map to used.
Implementations§
Source§impl Store
impl Store
Sourcepub const WALLET_SEED: &'static [u8] = b"store_wallet"
pub const WALLET_SEED: &'static [u8] = b"store_wallet"
Wallet Seed.
Sourcepub fn init(
&mut self,
authority: Pubkey,
key: &str,
bump: u8,
receiver: Pubkey,
holding: Pubkey,
) -> Result<()>
pub fn init( &mut self, authority: Pubkey, key: &str, bump: u8, receiver: Pubkey, holding: Pubkey, ) -> Result<()>
Initialize.
Sourcepub fn enable_role(&mut self, role: &str) -> Result<()>
pub fn enable_role(&mut self, role: &str) -> Result<()>
Enable a role.
Sourcepub fn disable_role(&mut self, role: &str) -> Result<()>
pub fn disable_role(&mut self, role: &str) -> Result<()>
Disable a role.
Sourcepub fn has_role(&self, authority: &Pubkey, role: &str) -> Result<bool>
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
- If the cluster has restarted, this function returns
true
if and only if theauthority
has theRESTART_ADMIN
role.
Check if the given pubkey is the authority of the store.
Sourcepub fn has_admin_role(&self, authority: &Pubkey) -> Result<bool>
pub fn has_admin_role(&self, authority: &Pubkey) -> Result<bool>
Check if the given authority has the ADMIN role.
§Note
- If the cluster has restarted, addresses with the
RESTART_ADMIN
role also have the ADMIN role.
Sourcepub fn get_amount(&self, key: &str) -> Result<&Amount>
pub fn get_amount(&self, key: &str) -> Result<&Amount>
Get amount.
Sourcepub fn get_amount_by_key(&self, key: AmountKey) -> &Amount
pub fn get_amount_by_key(&self, key: AmountKey) -> &Amount
Get amount by key.
Sourcepub fn get_amount_mut(&mut self, key: &str) -> Result<&mut Amount>
pub fn get_amount_mut(&mut self, key: &str) -> Result<&mut Amount>
Get amount mutably
Sourcepub fn get_factor(&self, key: &str) -> Result<&Factor>
pub fn get_factor(&self, key: &str) -> Result<&Factor>
Get factor.
Sourcepub fn get_factor_by_key(&self, key: FactorKey) -> &Factor
pub fn get_factor_by_key(&self, key: FactorKey) -> &Factor
Get factor by key.
Sourcepub fn get_factor_mut(&mut self, key: &str) -> Result<&mut Factor>
pub fn get_factor_mut(&mut self, key: &str) -> Result<&mut Factor>
Get factor mutably
Sourcepub fn get_address(&self, key: &str) -> Result<&Pubkey>
pub fn get_address(&self, key: &str) -> Result<&Pubkey>
Get address.
Sourcepub fn get_address_by_key(&self, key: AddressKey) -> &Pubkey
pub fn get_address_by_key(&self, key: AddressKey) -> &Pubkey
Get address by key.
Sourcepub fn get_address_mut(&mut self, key: &str) -> Result<&mut Pubkey>
pub fn get_address_mut(&mut self, key: &str) -> Result<&mut Pubkey>
Get address mutably
Sourcepub fn request_expiration_at(&self, start: i64) -> CoreResult<i64>
pub fn request_expiration_at(&self, start: i64) -> CoreResult<i64>
Calculate the request expiration time.
Sourcepub fn claimable_time_window(&self) -> Result<NonZeroU64>
pub fn claimable_time_window(&self) -> Result<NonZeroU64>
Get claimable time window size.
Sourcepub fn claimable_time_window_index(&self, timestamp: i64) -> Result<i64>
pub fn claimable_time_window_index(&self, timestamp: i64) -> Result<i64>
Get claimable time window index for the given timestamp.
Sourcepub fn claimable_time_key(&self, timestamp: i64) -> Result<[u8; 8]>
pub fn claimable_time_key(&self, timestamp: i64) -> Result<[u8; 8]>
Get claimable time key for the given timestamp.
Sourcepub fn validate_claim_fees_address(&self, address: &Pubkey) -> Result<()>
pub fn validate_claim_fees_address(&self, address: &Pubkey) -> Result<()>
Validate whether fees can be claimed by this address.
Sourcepub fn next_receiver(&self) -> Pubkey
pub fn next_receiver(&self) -> Pubkey
Get the next receiver address.
Sourcepub fn get_feature_disabled(
&self,
domain: DomainDisabledFlag,
action: ActionDisabledFlag,
) -> Option<bool>
pub fn get_feature_disabled( &self, domain: DomainDisabledFlag, action: ActionDisabledFlag, ) -> Option<bool>
Get feature disabled.
Sourcepub fn is_feature_disabled(
&self,
domain: DomainDisabledFlag,
action: ActionDisabledFlag,
) -> bool
pub fn is_feature_disabled( &self, domain: DomainDisabledFlag, action: ActionDisabledFlag, ) -> bool
Is the given feature disabled.
Sourcepub fn validate_feature_enabled(
&self,
domain: DomainDisabledFlag,
action: ActionDisabledFlag,
) -> Result<()>
pub fn validate_feature_enabled( &self, domain: DomainDisabledFlag, action: ActionDisabledFlag, ) -> Result<()>
Validate whether the given features is enabled.
Sourcepub fn has_restarted(&self) -> Result<bool>
pub fn has_restarted(&self) -> Result<bool>
Returns whether the cluster has restarted since last update.
Sourcepub fn validate_not_restarted(&self) -> Result<&Self>
pub fn validate_not_restarted(&self) -> Result<&Self>
Validate the cluster has not restarted.
Sourcepub fn validate_not_restarted_mut(&mut self) -> Result<&mut Self>
pub fn validate_not_restarted_mut(&mut self) -> Result<&mut Self>
Validate the cluster has not restarted for mutable reference.
Sourcepub fn order_fee_discount_factor(
&self,
rank: u8,
is_referred: bool,
) -> Result<u128>
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
impl AccountDeserialize for Store
Source§fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
Mint
account into a token
Account
.Source§fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
Source§impl Discriminator for Store
impl Discriminator for Store
const DISCRIMINATOR: [u8; 8]
fn discriminator() -> [u8; 8]
Source§impl<'a> TryFrom<&'a Store> for PriceValidator
impl<'a> TryFrom<&'a Store> for PriceValidator
impl Copy for Store
impl Pod for Store
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> 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
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
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
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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