diff --git a/api/src/state/proof.rs b/api/src/state/proof.rs index 17f58ed..6db3c3a 100644 --- a/api/src/state/proof.rs +++ b/api/src/state/proof.rs @@ -19,11 +19,11 @@ pub struct Proof { /// The last hash the miner provided. pub last_hash: [u8; 32], - /// The last time this account provided a hash. + /// Timestamp of the last time this account provided a hash. pub last_hash_at: i64, - /// Buffer for possible future use. - pub _buffer: [u8; 8], + /// Timestamp of the last claim. + pub last_claim_at: i64, /// The keypair which has permission to submit hashes for mining. pub miner: Pubkey, diff --git a/program/src/claim.rs b/program/src/claim.rs index b98a970..29965f8 100644 --- a/program/src/claim.rs +++ b/program/src/claim.rs @@ -8,6 +8,7 @@ pub fn process_claim(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult let amount = u64::from_le_bytes(args.amount); // Load accounts. + let clock = Clock::get()?; let [signer_info, beneficiary_info, proof_info, treasury_info, treasury_tokens_info, token_program] = accounts else { @@ -34,6 +35,9 @@ pub fn process_claim(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult .checked_sub(amount) .ok_or(OreError::ClaimTooLarge)?; + // Update last claim timestamp. + proof.last_claim_at = clock.unix_timestamp; + // Transfer tokens from treasury to beneficiary. transfer_signed( treasury_info,