#[repr(C)]pub struct Proof {
pub claimed_epochs: [u64; 8],
pub authority: Pubkey,
pub last_claim_at: i64,
pub last_claim_epoch: u64,
pub total_claimed_rewards: u64,
pub claim_count: u32,
pub _padding: [u8; 4],
}
Expand description
Proof accounts track a member’s basic claim information. Every member is allowed one proof account which is required by the program to claim rewards. A member is usually mapped to a public wallet address.
Note: Double-spending prevention is handled by a bitmap-based epoch tracking system combined with the Dual Merkle Tree system for unlimited claim history.
Fields§
§claimed_epochs: [u64; 8]
Bitmap tracking claimed epochs (512 bits = 8 u64s, covers ~1.4 years) Each bit represents whether an epoch has been claimed Circulation: epoch % 512 determines the bit position
The signer authorized to use this proof, usually member pubkey
last_claim_at: i64
Timestamp of the last claim (Unix timestamp)
last_claim_epoch: u64
Epoch of the last claim (project-specific epoch number)
total_claimed_rewards: u64
Sum of all successful claims (lifetime total)
claim_count: u32
Number of successful claims
_padding: [u8; 4]
Padding to ensure 8-byte alignment
Implementations§
Source§impl Proof
impl Proof
Sourcepub fn is_epoch_claimed(&self, epoch: u64) -> bool
pub fn is_epoch_claimed(&self, epoch: u64) -> bool
Check if a specific epoch has been claimed using bitmap tracking
§Parameters
epoch
: The epoch number to check
§Returns
true
if the epoch has been claimed,false
otherwise
§Circulation Logic
Uses modulo 512 to circulate the bitmap: epoch % 512 determines the bit position This provides a rolling 512-day window (~1.4 years) for claim tracking
Sourcepub fn mark_epoch_claimed(&mut self, epoch: u64)
pub fn mark_epoch_claimed(&mut self, epoch: u64)
Sourcepub fn clear_epoch_claimed(&mut self, epoch: u64)
pub fn clear_epoch_claimed(&mut self, epoch: u64)
Sourcepub fn claimed_epoch_count(&self) -> u32
pub fn claimed_epoch_count(&self) -> u32
Get the number of claimed epochs in the bitmap
§Returns
- The total number of claimed epochs tracked in the bitmap
Trait Implementations§
Source§impl AccountValidation for Proof
impl AccountValidation for Proof
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 Discriminator for Proof
impl Discriminator for Proof
fn discriminator() -> u8
impl Copy for Proof
impl Pod for Proof
impl StructuralPartialEq for Proof
Auto Trait Implementations§
impl Freeze for Proof
impl RefUnwindSafe for Proof
impl Send for Proof
impl Sync for Proof
impl Unpin for Proof
impl UnwindSafe for Proof
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