Skip to main content

Operator

Struct Operator 

Source
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: Pubkey

The base pubkey used as a seed for the PDA

§admin: Pubkey

The admin pubkey

§ncn_admin: Pubkey

The NCN admin can add and remove support for NCNs in the restaking protocol

§vault_admin: Pubkey

The vault admin can add and remove support for vaults in the restaking protocol

§delegate_admin: Pubkey

The delegate admin can delegate assets from the operator

§metadata_admin: Pubkey

( For future use ) Authority to update the operators’s metadata

§voter: Pubkey

The 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: PodU16

The operator fee in basis points

§bump: u8

The bump seed for the PDA

Implementations§

Source§

impl Operator

Source

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 seed
  • admin - The admin of the Operator
  • index - The index of the Operator
  • bump - The bump seed for the PDA
Source

pub fn index(&self) -> u64

Source

pub fn ncn_count(&self) -> u64

Source

pub fn vault_count(&self) -> u64

Source

pub fn increment_ncn_count(&mut self) -> Result<(), RestakingError>

Source

pub fn increment_vault_count(&mut self) -> Result<(), RestakingError>

Source

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 the Pubkey representing the admin Pubkey that is attempting to authorize the operation.
§Returns
  • Result<(), RestakingError> - Returns Ok(()) 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_info account’s public key does not match the expected admin public key stored in self.
Source

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 the Pubkey representing the delegate_admin Pubkey that is attempting to authorize the operation.
§Returns
  • Result<(), RestakingError> - Returns Ok(()) 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_info account’s public key does not match the expected admin public key stored in self.
Source

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 Pubkey
  • new_admin - The new admin Pubkey
Source

pub fn seeds(base: &Pubkey) -> Vec<Vec<u8>>

Returns the seeds for the PDA

§Arguments
  • base - The base account used as a PDA seed
§Returns
  • Vec<Vec<u8>> - The seeds used to generate the PDA
Source

pub fn find_program_address( program_id: &Pubkey, base: &Pubkey, ) -> (Pubkey, u8, Vec<Vec<u8>>)

Find the program address for the Operator account

§Arguments
  • program_id - The program ID
  • base - The base account used as a PDA seed
§Returns
  • Pubkey - The program address
  • u8 - The bump seed
  • Vec<Vec<u8>> - The seeds used to generate the PDA
Source

pub fn load( program_id: &Pubkey, account: &AccountInfo<'_>, expect_writable: bool, ) -> Result<(), ProgramError>

Attempts to load the account as Operator, returning an error if it’s not valid.

§Arguments
  • program_id - The program ID
  • account - The account to load the operator from
  • expect_writable - Whether the account should be writable
§Returns
  • Result<(), ProgramError> - The result of the operation

Trait Implementations§

Source§

impl AccountDeserialize for Operator

Source§

fn try_from_slice_unchecked(data: &[u8]) -> Result<&Self, ProgramError>

Deserialize the account data into a struct. It assumes the first byte is the discriminator and the next seven bytes are reserved. The rest of the data is deserialized into the struct. Read more
Source§

fn try_from_slice_unchecked_mut( data: &mut [u8], ) -> Result<&mut Self, ProgramError>

Deserialize the account data into a mutable struct. It assumes the first byte is the discriminator and the next seven bytes are reserved. The rest of the data is deserialized into the struct. Read more
Source§

impl Clone for Operator

Source§

fn clone(&self) -> Operator

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Operator

Source§

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

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

impl Discriminator for Operator

Source§

impl PartialEq for Operator

Source§

fn eq(&self, other: &Operator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Zeroable for Operator

Source§

fn zeroed() -> Self

Source§

impl Copy for Operator

Source§

impl Eq for Operator

Source§

impl Pod for Operator

Source§

impl StructuralPartialEq for Operator

Auto Trait Implementations§

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

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

Source§

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

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, dest: *mut u8)

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,