#[repr(C)]pub struct Well {Show 16 fields
pub well_id: u64,
pub epoch_id: u64,
pub current_bidder: Pubkey,
pub init_price: u64,
pub mps: u64,
pub epoch_start_time: u64,
pub accumulated_oil: u64,
pub last_update_time: u64,
pub halving_count: u64,
pub lifetime_oil_mined: u64,
pub is_pool_owned: u64,
pub operator_total_oil_mined: u64,
pub last_synced_epoch_id: u64,
pub buffer_c: u64,
pub buffer_d: u64,
pub buffer_e: u64,
}Expand description
Well account (one per well) PDA: [WELL, well_id] Tracks current auction state for a well
Fields§
§well_id: u64Well ID (0-3) - which well this is for
epoch_id: u64Current epoch ID (increments each auction: 0, 1, 2, 3, etc.) Starts at 0, increments when bid happens
current_bidder: PubkeyCurrent bidder/owner (Pubkey::default() if unowned)
init_price: u64Initial price for current epoch (in lamports) Doubles from current price when bid happens
mps: u64Mining per second (MPS) - current mining rate (OIL per second, in atomic units) This is the base rate adjusted for halvings
epoch_start_time: u64Epoch start time (timestamp when current epoch started)
accumulated_oil: u64Accumulated OIL mined by current owner (not yet claimed)
last_update_time: u64Last time accumulated_oil was updated
halving_count: u64Number of halvings that have occurred (for rate calculation)
lifetime_oil_mined: u64Total OIL ever mined from this well (lifetime)
is_pool_owned: u64Flag indicating if owned by pool (1) or solo owner (0) When pool wins (pool_total >= current_price), this is set to 1
operator_total_oil_mined: u64Total OIL mined by current operator (doesn’t reset when claimed, only when ownership changes) Repurposed from buffer_a
last_synced_epoch_id: u64Last epoch ID that was synced (similar to checkpoint_id in Driller) Used to enforce sync_auction_state before set_bid (like checkpoint before deploy) Repurposed from buffer_b
buffer_c: u64Buffer field (for future use)
buffer_d: u64Buffer field (for future use)
buffer_e: u64Buffer field (for future use)
Implementations§
Source§impl Well
impl Well
pub fn pda(well_id: u64) -> (Pubkey, u8)
Sourcepub fn current_price(&self, auction: &Auction, clock: &Clock) -> u64
pub fn current_price(&self, auction: &Auction, clock: &Clock) -> u64
Calculate current price for this epoch (Dutch auction - price decreases over time)
Sourcepub fn update_accumulated_oil(&mut self, clock: &Clock)
pub fn update_accumulated_oil(&mut self, clock: &Clock)
Update accumulated OIL for this epoch state
Sourcepub fn check_and_apply_halving(&mut self, auction: &mut Auction, clock: &Clock)
pub fn check_and_apply_halving(&mut self, auction: &mut Auction, clock: &Clock)
Check and apply halving if needed, updating mining rate Time-based halving: halvings occur every 28 days (halving_period_seconds) Uses 50% reduction (multiply by 0.5) per halving, matching Macaron’s model
Trait Implementations§
Source§impl AccountValidation for Well
impl AccountValidation for Well
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 Well
impl<'de> Deserialize<'de> for Well
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 Well
impl Discriminator for Well
fn discriminator() -> u8
impl Copy for Well
impl Pod for Well
impl StructuralPartialEq for Well
Auto Trait Implementations§
impl Freeze for Well
impl RefUnwindSafe for Well
impl Send for Well
impl Sync for Well
impl Unpin for Well
impl UnwindSafe for Well
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