scaffolding boosts

This commit is contained in:
Hardhat Chad
2024-08-24 13:57:00 +00:00
parent e8f0721fca
commit fde50aae8a
4 changed files with 33 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ default = []
drillx.workspace = true
mpl-token-metadata.workspace = true
ore-api.workspace = true
ore-boost-api.workspace = true
ore-utils.workspace = true
solana-program.workspace = true
spl-token.workspace = true

View File

@@ -9,6 +9,7 @@ use ore_api::{
loaders::*,
state::{Bus, Config, Proof},
};
use ore_boost_api::state::{Boost, Stake};
use ore_utils::*;
use solana_program::program::set_return_data;
#[allow(deprecated)]
@@ -31,8 +32,9 @@ pub fn process_mine(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
let args = Mine::try_from_bytes(data)?;
// Load accounts.
let (required_accounts, optional_accounts) = accounts.split_at(6);
let [signer, bus_info, config_info, proof_info, instructions_sysvar, slot_hashes_sysvar] =
accounts
required_accounts
else {
return Err(ProgramError::NotEnoughAccountKeys);
};
@@ -129,6 +131,18 @@ pub fn process_mine(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
}
}
if !optional_accounts.is_empty() {
let [boost_info, stake_info] = optional_accounts else {
return Err(ProgramError::NotEnoughAccountKeys);
};
let boost_data = boost_info.data.borrow();
let boost = Boost::try_from_bytes(&boost_data)?;
let stake_data = stake_info.data.borrow();
let stake = Stake::try_from_bytes(&stake_data)?;
}
// Apply liveness penalty.
//
// The liveness penalty exists to ensure there is no "invisible" hashpower on the network. It