#[repr(C)]pub struct Rig {}Expand description
Rig account (one per NFT mint, links NFT to on-chain stats)
Fields§
The authority (owner) of this rig (matches NFT owner)
mint: PubkeyNFT mint address (used for PDA derivation)
rig_type: u64Rig type ID (0-14)
rig_id: u64Unique rig ID (can be NFT edition number)
mining_power: u64Mining power (snapshotted at mint, immutable)
fuel_requirement: u64Fuel requirement for placement (snapshotted at mint, immutable)
fuel_consumption_rate: u64Fuel consumption rate per block (snapshotted at mint, immutable, in atomic units with 11 decimals)
purchase_price: u64Purchase price in OIL (minting cost)
purchased_at: i64Timestamp when rig was purchased/minted
plot_slot: u64Plot slot (0 = not placed, 1-5 = slot number)
buffer_a: u64Buffer field (for future extensions)
buffer_b: u64Buffer field (for future extensions)
buffer_c: u64Buffer field (for future extensions)
Implementations§
Source§impl Rig
impl Rig
pub fn pda(&self) -> (Pubkey, u8)
Sourcepub fn get_purchase_cost(rig_type: u64) -> Option<u64>
pub fn get_purchase_cost(rig_type: u64) -> Option<u64>
Get rig purchase cost in atomic units (11 decimals) Returns None for rig_type 0 (Basic Rig - special starter pack)
Sourcepub fn get_rig_name(rig_type: u64, rig_id: u64) -> String
pub fn get_rig_name(rig_type: u64, rig_id: u64) -> String
Display name for metadata; model rig_1..rig_15 plus edition e.g. “rig_2 #47”
Sourcepub fn get_rig_metadata_uri(rig_type: u64) -> String
pub fn get_rig_metadata_uri(rig_type: u64) -> String
Metadata URI by type (rig_1.json .. rig_15.json)
Sourcepub fn model_name(rig_type: u64) -> &'static str
pub fn model_name(rig_type: u64) -> &'static str
Model slug for display/traits (rig_1 .. rig_15). Use for UI or off-chain metadata attributes.
pub fn initialize( &mut self, authority: Pubkey, mint: Pubkey, rig_type: u64, rig_id: u64, mining_power: u64, fuel_requirement: u64, fuel_consumption_rate: u64, purchase_price: u64, clock: &Clock, )
Trait Implementations§
Source§impl AccountValidation for Rig
impl AccountValidation for Rig
fn assert<F>(&self, condition: F) -> Result<&Self, ProgramError>
fn assert_err<F>( &self, condition: F, err: ProgramError, ) -> Result<&Self, ProgramError>
fn assert_msg<F>(&self, condition: F, msg: &str) -> Result<&Self, ProgramError>
fn assert_mut<F>(&mut self, condition: F) -> Result<&mut Self, ProgramError>
fn assert_mut_err<F>( &mut self, condition: F, err: ProgramError, ) -> Result<&mut Self, ProgramError>
fn assert_mut_msg<F>( &mut self, condition: F, msg: &str, ) -> Result<&mut Self, ProgramError>
Source§impl<'de> Deserialize<'de> for Rig
impl<'de> Deserialize<'de> for Rig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Discriminator for Rig
impl Discriminator for Rig
fn discriminator() -> u8
impl Copy for Rig
impl Pod for Rig
impl StructuralPartialEq for Rig
Auto Trait Implementations§
impl Freeze for Rig
impl RefUnwindSafe for Rig
impl Send for Rig
impl Sync for Rig
impl Unpin for Rig
impl UnwindSafe for Rig
Blanket Implementations§
Source§impl<T> AccountDeserialize for Twhere
T: Discriminator + Pod,
impl<T> AccountDeserialize for Twhere
T: Discriminator + Pod,
fn try_from_bytes(data: &[u8]) -> Result<&T, ProgramError>
fn try_from_bytes_mut(data: &mut [u8]) -> Result<&mut T, ProgramError>
Source§impl<T> AccountHeaderDeserialize for Twhere
T: Discriminator + Pod,
impl<T> AccountHeaderDeserialize for Twhere
T: Discriminator + Pod,
fn try_header_from_bytes(data: &[u8]) -> Result<(&T, &[u8]), ProgramError>
fn try_header_from_bytes_mut( data: &mut [u8], ) -> Result<(&mut T, &mut [u8]), ProgramError>
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
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<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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