mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-13 15:09:57 +00:00
release
This commit is contained in:
@@ -90,7 +90,7 @@ impl Round {
|
||||
let r3 = u16::from_le_bytes(rng[4..6].try_into().unwrap());
|
||||
let r4 = u16::from_le_bytes(rng[6..8].try_into().unwrap());
|
||||
let r = r1 ^ r2 ^ r3 ^ r4;
|
||||
r % 4 == 0
|
||||
r % 3 == 0
|
||||
}
|
||||
|
||||
pub fn did_hit_motherlode(&self, rng: u64) -> bool {
|
||||
|
||||
@@ -737,7 +737,7 @@ async fn get_miners_participating(
|
||||
rpc: &RpcClient,
|
||||
round_id: u64,
|
||||
) -> Result<Vec<(Pubkey, Miner)>, anyhow::Error> {
|
||||
let filter = RpcFilterType::Memcmp(Memcmp::new_base58_encoded(472, &round_id.to_le_bytes()));
|
||||
let filter = RpcFilterType::Memcmp(Memcmp::new_base58_encoded(512, &round_id.to_le_bytes()));
|
||||
let miners = get_program_accounts::<Miner>(rpc, ore_api::ID, vec![filter]).await?;
|
||||
Ok(miners)
|
||||
}
|
||||
|
||||
@@ -111,6 +111,9 @@ pub fn process_checkpoint(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Program
|
||||
rewards_sol = miner.deployed.iter().sum::<u64>();
|
||||
}
|
||||
|
||||
// Checkpoint rewards.
|
||||
miner.update_rewards(treasury);
|
||||
|
||||
// Checkpoint miner.
|
||||
miner.checkpoint_id = round.id;
|
||||
miner.rewards_ore += rewards_ore;
|
||||
|
||||
@@ -23,8 +23,7 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul
|
||||
.has_seeds(&[AUTOMATION, &authority_info.key.to_bytes()], &ore_api::ID)?;
|
||||
let board = board_info
|
||||
.as_account_mut::<Board>(&ore_api::ID)?
|
||||
.assert_mut(|b| clock.slot >= b.start_slot && clock.slot < b.end_slot)?
|
||||
.assert_mut(|b| b.round_id < 15115)?;
|
||||
.assert_mut(|b| clock.slot >= b.start_slot && clock.slot < b.end_slot)?;
|
||||
let round = round_info
|
||||
.as_account_mut::<Round>(&ore_api::ID)?
|
||||
.assert_mut(|r| r.id == board.round_id)?;
|
||||
|
||||
@@ -3,8 +3,6 @@ use solana_program::log::sol_log;
|
||||
use spl_token::amount_to_ui_amount;
|
||||
use steel::*;
|
||||
|
||||
use crate::AUTHORIZED_ACCOUNTS;
|
||||
|
||||
/// Deposits ORE into the staking contract.
|
||||
pub fn process_deposit(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
|
||||
// Parse data.
|
||||
@@ -30,11 +28,6 @@ pub fn process_deposit(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResu
|
||||
system_program.is_program(&system_program::ID)?;
|
||||
token_program.is_program(&spl_token::ID)?;
|
||||
|
||||
// Check whitelist
|
||||
if !AUTHORIZED_ACCOUNTS.contains(&signer_info.key) {
|
||||
return Err(trace("Not authorized", OreError::NotAuthorized.into()));
|
||||
}
|
||||
|
||||
// Open stake account.
|
||||
let stake = if stake_info.data_is_empty() {
|
||||
create_program_account::<Stake>(
|
||||
|
||||
@@ -10,8 +10,8 @@ mod close;
|
||||
mod deploy;
|
||||
mod deposit;
|
||||
mod log;
|
||||
mod migrate_miner;
|
||||
mod migrate_treasury;
|
||||
// mod migrate_miner;
|
||||
// mod migrate_treasury;
|
||||
mod reset;
|
||||
mod set_admin;
|
||||
mod set_fee_collector;
|
||||
@@ -31,8 +31,8 @@ use close::*;
|
||||
use deploy::*;
|
||||
use deposit::*;
|
||||
use log::*;
|
||||
use migrate_miner::*;
|
||||
use migrate_treasury::*;
|
||||
// use migrate_miner::*;
|
||||
// use migrate_treasury::*;
|
||||
use reset::*;
|
||||
use set_admin::*;
|
||||
use set_fee_collector::*;
|
||||
@@ -63,9 +63,9 @@ pub fn process_instruction(
|
||||
OreInstruction::Reset => process_reset(accounts, data)?,
|
||||
|
||||
// Staker
|
||||
// OreInstruction::Deposit => process_deposit(accounts, data)?,
|
||||
// OreInstruction::Withdraw => process_withdraw(accounts, data)?,
|
||||
// OreInstruction::ClaimYield => process_claim_yield(accounts, data)?,
|
||||
OreInstruction::Deposit => process_deposit(accounts, data)?,
|
||||
OreInstruction::Withdraw => process_withdraw(accounts, data)?,
|
||||
OreInstruction::ClaimYield => process_claim_yield(accounts, data)?,
|
||||
|
||||
// Admin
|
||||
OreInstruction::Bury => process_bury(accounts, data)?,
|
||||
@@ -75,8 +75,6 @@ pub fn process_instruction(
|
||||
|
||||
// Seeker
|
||||
OreInstruction::ClaimSeeker => process_claim_seeker(accounts, data)?,
|
||||
OreInstruction::MigrateTreasury => process_migrate_treasury(accounts, data)?,
|
||||
OreInstruction::MigrateMiner => process_migrate_miner(accounts, data)?,
|
||||
_ => return Err(ProgramError::InvalidInstructionData),
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ pub fn process_migrate_treasury(accounts: &[AccountInfo<'_>], data: &[u8]) -> Pr
|
||||
treasury.total_staked = total_staked;
|
||||
treasury.total_unclaimed = total_unclaimed;
|
||||
treasury.miner_rewards_factor = miner_rewards_factor;
|
||||
treasury.total_refined = 0;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use solana_program::pubkey;
|
||||
use steel::*;
|
||||
|
||||
#[allow(unused)]
|
||||
pub const AUTHORIZED_ACCOUNTS: [Pubkey; 1] = [
|
||||
pubkey!("pqspJ298ryBjazPAr95J9sULCVpZe3HbZTWkbC1zrkS"),
|
||||
// pubkey!("By5JFFueXCqeqLk5MzR8ZSwFxASz3SKWX2TVfT1LTFbX"),
|
||||
|
||||
@@ -3,8 +3,6 @@ use solana_program::log::sol_log;
|
||||
use spl_token::amount_to_ui_amount;
|
||||
use steel::*;
|
||||
|
||||
use crate::AUTHORIZED_ACCOUNTS;
|
||||
|
||||
/// Withdraws ORE from the staking contract.
|
||||
pub fn process_withdraw(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
|
||||
// Parse data.
|
||||
@@ -34,11 +32,6 @@ pub fn process_withdraw(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramRes
|
||||
token_program.is_program(&spl_token::ID)?;
|
||||
associated_token_program.is_program(&spl_associated_token_account::ID)?;
|
||||
|
||||
// Check whitelist
|
||||
if !AUTHORIZED_ACCOUNTS.contains(&signer_info.key) {
|
||||
return Err(trace("Not authorized", OreError::NotAuthorized.into()));
|
||||
}
|
||||
|
||||
// Open recipient token account.
|
||||
if recipient_info.data_is_empty() {
|
||||
create_associated_token_account(
|
||||
|
||||
Reference in New Issue
Block a user