pub struct Precompile {
pub program_id: Pubkey,
pub feature: Option<Pubkey>,
pub verify_fn: Verify,
}
Expand description
Information on a precompiled program
Fields§
§program_id: Pubkey
Program id
feature: Option<Pubkey>
Feature to enable on, None
indicates always enabled
verify_fn: Verify
Verification function
Implementations§
source§impl Precompile
impl Precompile
sourcepub fn new(
program_id: Pubkey,
feature: Option<Pubkey>,
verify_fn: Verify,
) -> Self
pub fn new( program_id: Pubkey, feature: Option<Pubkey>, verify_fn: Verify, ) -> Self
Creates a new Precompile
sourcepub fn check_id<F>(&self, program_id: &Pubkey, is_enabled: F) -> bool
pub fn check_id<F>(&self, program_id: &Pubkey, is_enabled: F) -> bool
Check if a program id is this precompiled program
sourcepub fn verify(
&self,
data: &[u8],
instruction_datas: &[&[u8]],
feature_set: &FeatureSet,
) -> Result<(), PrecompileError>
pub fn verify( &self, data: &[u8], instruction_datas: &[&[u8]], feature_set: &FeatureSet, ) -> Result<(), PrecompileError>
Verify this precompiled program
Auto Trait Implementations§
impl Freeze for Precompile
impl RefUnwindSafe for Precompile
impl Send for Precompile
impl Sync for Precompile
impl Unpin for Precompile
impl UnwindSafe for Precompile
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
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>
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 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>
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