pub struct Operator {
pub base: Pubkey,
pub admin: Pubkey,
pub ncn_admin: Pubkey,
pub vault_admin: Pubkey,
pub delegate_admin: Pubkey,
pub metadata_admin: Pubkey,
pub voter: Pubkey,
pub operator_fee_bps: PodU16,
pub bump: u8,
/* private fields */
}Expand description
The Operator account stores global information for a particular operator including the admin, voter, and the number of NCN and vault accounts.
Fields§
§base: PubkeyThe base pubkey used as a seed for the PDA
admin: PubkeyThe admin pubkey
ncn_admin: PubkeyThe NCN admin can add and remove support for NCNs in the restaking protocol
vault_admin: PubkeyThe vault admin can add and remove support for vaults in the restaking protocol
delegate_admin: PubkeyThe delegate admin can delegate assets from the operator
metadata_admin: Pubkey( For future use ) Authority to update the operators’s metadata
voter: PubkeyThe voter pubkey can be used as the voter for signing transactions for interacting with various NCN programs. NCNs can also opt for their own signing infrastructure.
operator_fee_bps: PodU16The operator fee in basis points
bump: u8The bump seed for the PDA
Implementations§
Source§impl Operator
impl Operator
Sourcepub fn new(
base: Pubkey,
admin: Pubkey,
index: u64,
operator_fee_bps: u16,
bump: u8,
) -> Self
pub fn new( base: Pubkey, admin: Pubkey, index: u64, operator_fee_bps: u16, bump: u8, ) -> Self
Create a new Operator account
§Arguments
base- The base account used as a PDA seedadmin- The admin of the Operatorindex- The index of the Operatorbump- The bump seed for the PDA
pub fn index(&self) -> u64
pub fn ncn_count(&self) -> u64
pub fn vault_count(&self) -> u64
pub fn increment_ncn_count(&mut self) -> Result<(), RestakingError>
pub fn increment_vault_count(&mut self) -> Result<(), RestakingError>
Sourcepub fn check_admin(&self, admin: &Pubkey) -> Result<(), RestakingError>
pub fn check_admin(&self, admin: &Pubkey) -> Result<(), RestakingError>
Validates the admin account and ensures it matches the expected admin.
§Arguments
admin- A reference to thePubkeyrepresenting the admin Pubkey that is attempting to authorize the operation.
§Returns
Result<(), RestakingError>- ReturnsOk(())if the admin account is valid.
§Errors
This function will return a jito_restaking_sdk::error::RestakingError::OperatorAdminInvalid error in the following case:
- The
admin_infoaccount’s public key does not match the expected admin public key stored inself.
Sourcepub fn check_delegate_admin(
&self,
delegate_admin: &Pubkey,
) -> Result<(), RestakingError>
pub fn check_delegate_admin( &self, delegate_admin: &Pubkey, ) -> Result<(), RestakingError>
Validates the delegate_admin account and ensures it matches the expected delegate_admin.
§Arguments
delegate_admin_info- A reference to thePubkeyrepresenting the delegate_admin Pubkey that is attempting to authorize the operation.
§Returns
Result<(), RestakingError>- ReturnsOk(())if the delegate_admin account is valid.
§Errors
This function will return a jito_restaking_sdk::error::RestakingError::OperatorDelegateAdminInvalid error in the following case:
- The
delegate_admin_infoaccount’s public key does not match the expected admin public key stored inself.
Sourcepub fn update_secondary_admin(&mut self, old_admin: &Pubkey, new_admin: &Pubkey)
pub fn update_secondary_admin(&mut self, old_admin: &Pubkey, new_admin: &Pubkey)
Replace all secondary admins that were equal to the old admin to the new admin
§Arguments
old_admin- The old admin Pubkeynew_admin- The new admin Pubkey
Sourcepub fn find_program_address(
program_id: &Pubkey,
base: &Pubkey,
) -> (Pubkey, u8, Vec<Vec<u8>>)
pub fn find_program_address( program_id: &Pubkey, base: &Pubkey, ) -> (Pubkey, u8, Vec<Vec<u8>>)
Sourcepub fn load(
program_id: &Pubkey,
account: &AccountInfo<'_>,
expect_writable: bool,
) -> Result<(), ProgramError>
pub fn load( program_id: &Pubkey, account: &AccountInfo<'_>, expect_writable: bool, ) -> Result<(), ProgramError>
Trait Implementations§
Source§impl AccountDeserialize for Operator
impl AccountDeserialize for Operator
Source§fn try_from_slice_unchecked(data: &[u8]) -> Result<&Self, ProgramError>
fn try_from_slice_unchecked(data: &[u8]) -> Result<&Self, ProgramError>
Source§fn try_from_slice_unchecked_mut(
data: &mut [u8],
) -> Result<&mut Self, ProgramError>
fn try_from_slice_unchecked_mut( data: &mut [u8], ) -> Result<&mut Self, ProgramError>
Source§impl Discriminator for Operator
impl Discriminator for Operator
const DISCRIMINATOR: u8
impl Copy for Operator
impl Eq for Operator
impl Pod for Operator
impl StructuralPartialEq for Operator
Auto Trait Implementations§
impl Freeze for Operator
impl RefUnwindSafe for Operator
impl Send for Operator
impl Sync for Operator
impl Unpin for Operator
impl UnsafeUnpin for Operator
impl UnwindSafe for Operator
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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§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.Source§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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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