mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-20 15:10:32 +00:00
account discriminator macro
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use ore_utils::{account, Discriminator};
|
||||
use ore_utils::*;
|
||||
use solana_program::pubkey::Pubkey;
|
||||
|
||||
use crate::consts::PROOF;
|
||||
|
||||
use super::AccountDiscriminator;
|
||||
|
||||
/// Proof accounts track a miner's current hash, claimable rewards, and lifetime stats.
|
||||
@@ -37,10 +39,9 @@ pub struct Proof {
|
||||
pub total_rewards: u64,
|
||||
}
|
||||
|
||||
impl Discriminator for Proof {
|
||||
fn discriminator() -> u8 {
|
||||
AccountDiscriminator::Proof.into()
|
||||
}
|
||||
/// Derive the PDA of a proof account.
|
||||
pub fn proof_pda(authority: Pubkey) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[PROOF, authority.as_ref()], &crate::id())
|
||||
}
|
||||
|
||||
account!(Proof);
|
||||
account!(AccountDiscriminator, Proof);
|
||||
|
||||
Reference in New Issue
Block a user