mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 15:10:13 +00:00
remove unneeded arg
This commit is contained in:
@@ -2,7 +2,6 @@ use ore_api::{consts::*, error::OreError, instruction::ClaimArgs, loaders::*, st
|
||||
use ore_utils::spl::transfer_signed;
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
|
||||
pubkey::Pubkey,
|
||||
};
|
||||
|
||||
use crate::utils::AccountDeserialize;
|
||||
@@ -15,11 +14,7 @@ use crate::utils::AccountDeserialize;
|
||||
/// - Claim is a permissionless instruction and can be called by any user.
|
||||
/// - Can only succeed if the claimed amount is less than or equal to the miner's claimable rewards.
|
||||
/// - The provided beneficiary, token account, treasury, treasury token account, and token program must be valid.
|
||||
pub fn process_claim<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
data: &[u8],
|
||||
) -> ProgramResult {
|
||||
pub fn process_claim<'a, 'info>(accounts: &'a [AccountInfo<'info>], data: &[u8]) -> ProgramResult {
|
||||
// Parse args
|
||||
let args = ClaimArgs::try_from_bytes(data)?;
|
||||
let amount = u64::from_le_bytes(args.amount);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use ore_api::{loaders::*, state::Proof};
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
|
||||
pubkey::Pubkey, system_program,
|
||||
system_program,
|
||||
};
|
||||
|
||||
use crate::utils::AccountDeserialize;
|
||||
@@ -14,11 +14,7 @@ use crate::utils::AccountDeserialize;
|
||||
/// - Deregister is a permissionless instruction and can be invoked by any singer.
|
||||
/// - Can only succeed if the provided proof acount PDA is valid (associated with the signer).
|
||||
/// - The provided system program must be valid.
|
||||
pub fn process_close<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
_data: &[u8],
|
||||
) -> ProgramResult {
|
||||
pub fn process_close<'a, 'info>(accounts: &'a [AccountInfo<'info>], _data: &[u8]) -> ProgramResult {
|
||||
// Load accounts
|
||||
let [signer, proof_info, system_program] = accounts else {
|
||||
return Err(ProgramError::NotEnoughAccountKeys);
|
||||
|
||||
@@ -12,7 +12,6 @@ use solana_program::{
|
||||
entrypoint::ProgramResult,
|
||||
program_error::ProgramError,
|
||||
program_pack::Pack,
|
||||
pubkey::Pubkey,
|
||||
system_program, {self, sysvar},
|
||||
};
|
||||
use spl_token::state::Mint;
|
||||
@@ -38,7 +37,6 @@ use crate::utils::{create_pda, AccountDeserialize, Discriminator};
|
||||
/// - The signer of this instruction is set as the program admin and the
|
||||
/// upgrade authority of the mint metadata account.
|
||||
pub fn process_initialize<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
data: &[u8],
|
||||
) -> ProgramResult {
|
||||
|
||||
@@ -43,15 +43,15 @@ pub fn process_instruction(
|
||||
.ok_or(ProgramError::InvalidInstructionData)?;
|
||||
|
||||
match OreInstruction::try_from(*tag).or(Err(ProgramError::InvalidInstructionData))? {
|
||||
OreInstruction::Claim => process_claim(program_id, accounts, data)?,
|
||||
OreInstruction::Close => process_close(program_id, accounts, data)?,
|
||||
OreInstruction::Mine => process_mine(program_id, accounts, data)?,
|
||||
OreInstruction::Open => process_open(program_id, accounts, data)?,
|
||||
OreInstruction::Reset => process_reset(program_id, accounts, data)?,
|
||||
OreInstruction::Stake => process_stake(program_id, accounts, data)?,
|
||||
OreInstruction::Update => process_update(program_id, accounts, data)?,
|
||||
OreInstruction::Upgrade => process_upgrade(program_id, accounts, data)?,
|
||||
OreInstruction::Initialize => process_initialize(program_id, accounts, data)?,
|
||||
OreInstruction::Claim => process_claim(accounts, data)?,
|
||||
OreInstruction::Close => process_close(accounts, data)?,
|
||||
OreInstruction::Mine => process_mine(accounts, data)?,
|
||||
OreInstruction::Open => process_open(accounts, data)?,
|
||||
OreInstruction::Reset => process_reset(accounts, data)?,
|
||||
OreInstruction::Stake => process_stake(accounts, data)?,
|
||||
OreInstruction::Update => process_update(accounts, data)?,
|
||||
OreInstruction::Upgrade => process_upgrade(accounts, data)?,
|
||||
OreInstruction::Initialize => process_initialize(accounts, data)?,
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -18,7 +18,6 @@ use solana_program::{
|
||||
entrypoint::ProgramResult,
|
||||
log::sol_log,
|
||||
program_error::ProgramError,
|
||||
pubkey::Pubkey,
|
||||
sanitize::SanitizeError,
|
||||
serialize_utils::{read_pubkey, read_u16, read_u8},
|
||||
slot_hashes::SlotHash,
|
||||
@@ -40,11 +39,7 @@ use crate::utils::AccountDeserialize;
|
||||
/// - Can only succeed if the provided hash satisfies the minimum difficulty requirement.
|
||||
/// - The provided proof account must be associated with the signer.
|
||||
/// - The provided bus, config, noise, stake, and slot hash sysvar must be valid.
|
||||
pub fn process_mine<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
data: &[u8],
|
||||
) -> ProgramResult {
|
||||
pub fn process_mine<'a, 'info>(accounts: &'a [AccountInfo<'info>], data: &[u8]) -> ProgramResult {
|
||||
// Parse args
|
||||
let args = MineArgs::try_from_bytes(data)?;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ use solana_program::{
|
||||
clock::Clock,
|
||||
entrypoint::ProgramResult,
|
||||
program_error::ProgramError,
|
||||
pubkey::Pubkey,
|
||||
slot_hashes::SlotHash,
|
||||
system_program,
|
||||
sysvar::{self, Sysvar},
|
||||
@@ -24,11 +23,7 @@ use crate::utils::{create_pda, AccountDeserialize, Discriminator};
|
||||
/// - Can only succeed if the provided proof acount PDA is valid (associated with the signer).
|
||||
/// - Can only succeed if the user does not already have a proof account.
|
||||
/// - The provided system program must be valid.
|
||||
pub fn process_open<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
data: &[u8],
|
||||
) -> ProgramResult {
|
||||
pub fn process_open<'a, 'info>(accounts: &'a [AccountInfo<'info>], data: &[u8]) -> ProgramResult {
|
||||
// Parse args
|
||||
let args = OpenArgs::try_from_bytes(data)?;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use ore_api::{
|
||||
};
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult,
|
||||
program_error::ProgramError, program_pack::Pack, pubkey::Pubkey, sysvar::Sysvar,
|
||||
program_error::ProgramError, program_pack::Pack, sysvar::Sysvar,
|
||||
};
|
||||
use spl_token::state::Mint;
|
||||
|
||||
@@ -31,11 +31,7 @@ use crate::utils::AccountDeserialize;
|
||||
/// - The "theoretical" reward rate refers to the amount that would have been paid out if rewards were not capped by
|
||||
/// the bus limits. It's necessary to use this value to ensure the reward rate update calculation accurately
|
||||
/// accounts for the difficulty of submitted hashes.
|
||||
pub fn process_reset<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
_data: &[u8],
|
||||
) -> ProgramResult {
|
||||
pub fn process_reset<'a, 'info>(accounts: &'a [AccountInfo<'info>], _data: &[u8]) -> ProgramResult {
|
||||
// Load accounts
|
||||
let [signer, bus_0_info, bus_1_info, bus_2_info, bus_3_info, bus_4_info, bus_5_info, bus_6_info, bus_7_info, config_info, mint_info, treasury_info, treasury_tokens_info, token_program] =
|
||||
accounts
|
||||
|
||||
@@ -2,7 +2,7 @@ use ore_api::{consts::*, instruction::StakeArgs, loaders::*, state::Proof};
|
||||
use ore_utils::spl::transfer;
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult,
|
||||
program_error::ProgramError, pubkey::Pubkey, sysvar::Sysvar,
|
||||
program_error::ProgramError, sysvar::Sysvar,
|
||||
};
|
||||
|
||||
use crate::utils::AccountDeserialize;
|
||||
@@ -15,11 +15,7 @@ use crate::utils::AccountDeserialize;
|
||||
/// - Stake is a permissionless instruction and can be called by any user.
|
||||
/// - Can only succeed if the amount is less than or equal to the miner's transferable tokens.
|
||||
/// - The provided beneficiary, proof, sender, treasury token account, and token program must be valid.
|
||||
pub fn process_stake<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
data: &[u8],
|
||||
) -> ProgramResult {
|
||||
pub fn process_stake<'a, 'info>(accounts: &'a [AccountInfo<'info>], data: &[u8]) -> ProgramResult {
|
||||
// Parse args
|
||||
let args = StakeArgs::try_from_bytes(data)?;
|
||||
let amount = u64::from_le_bytes(args.amount);
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
use ore_api::{loaders::*, state::Proof};
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
|
||||
pubkey::Pubkey,
|
||||
};
|
||||
|
||||
use crate::utils::AccountDeserialize;
|
||||
|
||||
/// Update changes the miner authority on a proof account.
|
||||
pub fn process_update<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
_data: &[u8],
|
||||
) -> ProgramResult {
|
||||
|
||||
@@ -2,7 +2,7 @@ use ore_api::{consts::*, error::OreError, instruction::StakeArgs, loaders::*};
|
||||
use ore_utils::spl::mint_to_signed;
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
|
||||
program_pack::Pack, pubkey::Pubkey,
|
||||
program_pack::Pack,
|
||||
};
|
||||
use spl_token::state::Mint;
|
||||
|
||||
@@ -14,7 +14,6 @@ use spl_token::state::Mint;
|
||||
/// - Upgrade is a permissionless instruction and can be called by any user.
|
||||
/// - The provided beneficiary, mint, mint v1, sender, and token program must be valid.
|
||||
pub fn process_upgrade<'a, 'info>(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &'a [AccountInfo<'info>],
|
||||
data: &[u8],
|
||||
) -> ProgramResult {
|
||||
|
||||
Reference in New Issue
Block a user