#[repr(C)]pub struct Well {Show 14 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 operator_total_oil_mined: u64,
pub buffer_c: u64,
pub total_contributed: u64,
pub pool_bid_cost: u64,
}Expand description
Well account (one per 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.)
current_bidder: PubkeyCurrent bidder/owner (Pubkey::default() if unowned)
init_price: u64Initial price for current epoch (in lamports)
mps: u64Mining per second (MPS) - current mining rate (OIL per second, in atomic units)
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)
operator_total_oil_mined: u64Total OIL mined by current operator (doesn’t reset when claimed, only when ownership changes)
buffer_c: u64Buffer field (for future use) - previously is_pool_owned
total_contributed: u64Total contributed FOGO for current epoch (tracks native SOL balance in Well PDA’s system account) Incremented on each contribution, decremented when pool bids Reset to 0 when epoch ends
pool_bid_cost: u64Pool bid cost - stores the bid_amount when pool bids Used to calculate original_total when pool gets outbid Reset to 0 when epoch ends
Implementations§
Source§impl Well
impl Well
pub fn pda(well_id: u64) -> (Pubkey, u8)
pub fn current_price(&self, auction: &Auction, clock: &Clock) -> u64
pub fn update_accumulated_oil(&mut self, auction: &Auction, clock: &Clock)
Sourcepub fn apply_existing_halvings(&mut self, auction: &Auction)
pub fn apply_existing_halvings(&mut self, auction: &Auction)
Apply all halvings that have already occurred (based on auction.halving_count) This is used when resetting well.mps to base rate in a new epoch
Safety: This function assumes well.mps has just been reset to base rate. It applies all halvings that have occurred according to auction.halving_count.
pub fn check_and_apply_halving(&mut self, auction: &mut Auction, clock: &Clock)
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