Struct mpl_candy_guard::guards::TokenGate
source · pub struct TokenGate {
pub amount: u64,
pub mint: Pubkey,
}Expand description
Guard that restricts access to addresses that hold the specified spl-token.
List of accounts required:
[]Token account holding the required amount.
Fields§
§amount: u64§mint: PubkeyTrait Implementations§
source§impl BorshDeserialize for TokenGate
impl BorshDeserialize for TokenGate
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
source§impl BorshSerialize for TokenGate
impl BorshSerialize for TokenGate
source§impl Condition for TokenGate
impl Condition for TokenGate
source§fn validate<'info>(
&self,
ctx: &mut EvaluationContext<'_, '_, '_>,
_guard_set: &GuardSet,
_mint_args: &[u8]
) -> Result<()>
fn validate<'info>( &self, ctx: &mut EvaluationContext<'_, '_, '_>, _guard_set: &GuardSet, _mint_args: &[u8] ) -> Result<()>
Validate the condition of the guard. When the guard condition is
not satisfied, it will return an error. Read more
source§fn pre_actions(
&self,
_ctx: &mut EvaluationContext<'_, '_, '_>,
_guard_set: &GuardSet,
_mint_args: &[u8]
) -> Result<()>
fn pre_actions( &self, _ctx: &mut EvaluationContext<'_, '_, '_>, _guard_set: &GuardSet, _mint_args: &[u8] ) -> Result<()>
Perform the action associated with the guard before the CPI
mint instruction. Read moresource§fn post_actions(
&self,
_ctx: &mut EvaluationContext<'_, '_, '_>,
_guard_set: &GuardSet,
_mint_args: &[u8]
) -> Result<()>
fn post_actions( &self, _ctx: &mut EvaluationContext<'_, '_, '_>, _guard_set: &GuardSet, _mint_args: &[u8] ) -> Result<()>
Perform the action associated with the guard after the CPI
mint instruction. Read moresource§impl Guard for TokenGate
impl Guard for TokenGate
source§fn instruction<'info>(
_ctx: &Context<'_, '_, '_, 'info, Route<'info>>,
_route_context: RouteContext<'info>,
_data: Vec<u8>
) -> Result<()>
fn instruction<'info>( _ctx: &Context<'_, '_, '_, 'info, Route<'info>>, _route_context: RouteContext<'info>, _data: Vec<u8> ) -> Result<()>
Executes an instruction. This function is called from the
route instruction
handler.source§fn is_enabled(features: u64) -> bool
fn is_enabled(features: u64) -> bool
Returns whether the guards is enabled or not on the specified features.
source§fn save(&self, data: &mut [u8], offset: usize) -> Result<()>
fn save(&self, data: &mut [u8], offset: usize) -> Result<()>
Serializes the guard into the specified data array.
Auto Trait Implementations§
impl RefUnwindSafe for TokenGate
impl Send for TokenGate
impl Sync for TokenGate
impl Unpin for TokenGate
impl UnwindSafe for TokenGate
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
Mutably borrows from an owned value. Read more