#[repr(C)]pub struct Plot {Show 15 fields
pub authority: Pubkey,
pub plot_level: u64,
pub fuel_capacity: u64,
pub current_fuel: u64,
pub max_rig_slots: u64,
pub total_mining_power: u64,
pub last_claim_block: u64,
pub last_fuel_update_block: u64,
pub last_upgrade_timestamp: i64,
pub total_fuel_requirement: u64,
pub num_rigs_staked: u64,
pub last_refinery_rewards_factor: Numeric,
pub buffer_a: u64,
pub buffer_b: u64,
pub buffer_c: u64,
}Expand description
Plot account (one per wallet/authority)
Fields§
The authority (owner) of this plot account.
plot_level: u64Plot level (0-9: Basic to Master)
fuel_capacity: u64Maximum fuel capacity (tank size)
current_fuel: u64Current fuel remaining in tank
max_rig_slots: u64Maximum number of rig slots (1-5)
total_mining_power: u64Total mining power from all staked rigs
last_claim_block: u64Last block when rewards were claimed
last_fuel_update_block: u64Last block when fuel was updated (for consumption calculation)
last_upgrade_timestamp: i64Timestamp of last upgrade (for 24h cooldown)
total_fuel_requirement: u64Sum of fuel_requirement of all rigs currently placed on this plot (placement constraint)
num_rigs_staked: u64Number of rigs currently placed on this plot (≤ max_rig_slots)
last_refinery_rewards_factor: NumericRefinery rewards factor at this plot’s last claim (for claimable = power * (current - this))
buffer_a: u64Sum of fuel_consumption_rate of all staked rigs (used for fuel consumption on claim). Stored in buffer_a. buffer_a: total_fuel_consumption_rate
buffer_b: u64Buffer for future extensions
buffer_c: u64Buffer for future extensions
Implementations§
Source§impl Plot
impl Plot
pub fn pda(&self) -> (Pubkey, u8)
pub fn initialize(&mut self, authority: Pubkey, clock: &Clock)
Sourcepub fn can_upgrade(&self, clock: &Clock) -> bool
pub fn can_upgrade(&self, clock: &Clock) -> bool
Check if plot can be upgraded (24h cooldown)
Sourcepub fn get_upgrade_cost(&self) -> Option<u64>
pub fn get_upgrade_cost(&self) -> Option<u64>
Get upgrade cost for the next level (in atomic units, 11 decimals) Returns None if already at max level (9)
Sourcepub fn upgrade_cost_for_level(level: u64) -> u64
pub fn upgrade_cost_for_level(level: u64) -> u64
Get upgrade cost for a specific level (in atomic units, 11 decimals)
Sourcepub fn level_stats(level: u64) -> (u64, u64)
pub fn level_stats(level: u64) -> (u64, u64)
Get level stats (slots, fuel_capacity) for a specific level
Sourcepub fn upgrade(&mut self, clock: &Clock) -> Option<u64>
pub fn upgrade(&mut self, clock: &Clock) -> Option<u64>
Upgrade plot to next level Returns the upgrade cost if successful, None if already at max level
Sourcepub fn apply_fuel_consumption(&mut self, clock: &Clock) -> u64
pub fn apply_fuel_consumption(&mut self, clock: &Clock) -> u64
Apply fuel consumption since last_fuel_update_block using buffer_a (total_fuel_consumption_rate). Returns effective mining power (0 if fuel depleted). Call on claim before computing claimable.
Sourcepub fn update_fuel_consumption(
&mut self,
staked_rig_consumption_rates: &[u64],
clock: &Clock,
) -> u64
pub fn update_fuel_consumption( &mut self, staked_rig_consumption_rates: &[u64], clock: &Clock, ) -> u64
Update fuel consumption based on staked rig consumption rates (alternative when rig list available)
Trait Implementations§
Source§impl AccountValidation for Plot
impl AccountValidation for Plot
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 Plot
impl<'de> Deserialize<'de> for Plot
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 Plot
impl Discriminator for Plot
fn discriminator() -> u8
impl Copy for Plot
impl Pod for Plot
impl StructuralPartialEq for Plot
Auto Trait Implementations§
impl Freeze for Plot
impl RefUnwindSafe for Plot
impl Send for Plot
impl Sync for Plot
impl Unpin for Plot
impl UnsafeUnpin for Plot
impl UnwindSafe for Plot
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