mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-13 15:09:57 +00:00
comments
This commit is contained in:
@@ -2,11 +2,11 @@ use steel::*;
|
|||||||
|
|
||||||
use super::OreAccount;
|
use super::OreAccount;
|
||||||
|
|
||||||
/// Seeker is an account which prevents multiple Seeker genesis tokens from being claimed.
|
/// Seeker tracks which Seeker genesis tokens have been claimed.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||||
pub struct Seeker {
|
pub struct Seeker {
|
||||||
// The mint address of the Seeker token.
|
// The mint address of a Seeker genesis token.
|
||||||
pub mint: Pubkey,
|
pub mint: Pubkey,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use spl_token_2022::{
|
|||||||
pod::{PodCOption, PodMint},
|
pod::{PodCOption, PodMint},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Claims ORE for seeker device.
|
/// Claims a Seeker genesis token for a miner.
|
||||||
pub fn process_claim_seeker(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
|
pub fn process_claim_seeker(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
|
||||||
// Load accounts.
|
// Load accounts.
|
||||||
let [signer_info, miner_info, mint_info, seeker_info, token_account_info, system_program] =
|
let [signer_info, miner_info, mint_info, seeker_info, token_account_info, system_program] =
|
||||||
@@ -65,6 +65,7 @@ pub fn process_claim_seeker(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Progr
|
|||||||
miner_info
|
miner_info
|
||||||
.as_account_mut::<Miner>(&ore_api::ID)?
|
.as_account_mut::<Miner>(&ore_api::ID)?
|
||||||
.assert_mut(|m| m.authority == *signer_info.key)?
|
.assert_mut(|m| m.authority == *signer_info.key)?
|
||||||
|
.assert_mut(|m| m.is_seeker == 0)?
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load mint.
|
// Load mint.
|
||||||
@@ -89,7 +90,7 @@ pub fn process_claim_seeker(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Progr
|
|||||||
"metadata address mismatch"
|
"metadata address mismatch"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Give miner a Seeker designation.
|
// Flag the miner as a Seeker.
|
||||||
miner.is_seeker = 1;
|
miner.is_seeker = 1;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
|||||||
treasury.motherlode = 0;
|
treasury.motherlode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If activation is enabled, pay out 1 ORE to all Seeker miners, proportional to their deployment.
|
// If Seeker activation is enabled, pay out 1 ORE to all winning Seeker miners, proportional to their deployment.
|
||||||
let mint = mint_info.as_mint()?;
|
let mint = mint_info.as_mint()?;
|
||||||
let seeker_mint_amount = ONE_ORE.min(MAX_SUPPLY - mint.supply());
|
let seeker_mint_amount = ONE_ORE.min(MAX_SUPPLY - mint.supply());
|
||||||
if config.is_seeker_activation_enabled == 1
|
if config.is_seeker_activation_enabled == 1
|
||||||
|
|||||||
Reference in New Issue
Block a user