mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-13 15:09:57 +00:00
re-enabled mining
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -2384,6 +2384,7 @@ dependencies = [
|
||||
"spl-associated-token-account",
|
||||
"spl-token 4.0.2",
|
||||
"spl-token-2022 7.0.0",
|
||||
"spl-token-metadata-interface 0.6.0",
|
||||
"steel",
|
||||
]
|
||||
|
||||
|
||||
@@ -28,8 +28,10 @@ solana-nostd-keccak = "0.1.3"
|
||||
solana-program = "^2.1"
|
||||
solana-client = "^2.1"
|
||||
solana-sdk = "^2.1"
|
||||
spl-pod = "=0.5.1"
|
||||
spl-token = { version = "^4", features = ["no-entrypoint"] }
|
||||
spl-token-2022 = "^7"
|
||||
spl-token-metadata-interface = "^0.6"
|
||||
spl-associated-token-account = { version = "^6", features = [ "no-entrypoint" ] }
|
||||
steel = { features = ["spl"], version = "4.0.2" }
|
||||
thiserror = "1.0.57"
|
||||
|
||||
@@ -19,6 +19,9 @@ pub enum OreInstruction {
|
||||
SetFeeCollector = 10,
|
||||
SetFeeRate = 11,
|
||||
SetSniperFeeDuration = 12,
|
||||
|
||||
// Seeker
|
||||
ClaimSeeker = 13,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
@@ -100,6 +103,10 @@ pub struct SetSniperFeeDuration {
|
||||
pub sniper_fee_duration: [u8; 8],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct ClaimSeeker {}
|
||||
|
||||
instruction!(OreInstruction, Claim);
|
||||
instruction!(OreInstruction, Open);
|
||||
instruction!(OreInstruction, Close);
|
||||
@@ -113,3 +120,4 @@ instruction!(OreInstruction, SetBlockDuration);
|
||||
instruction!(OreInstruction, SetFeeCollector);
|
||||
instruction!(OreInstruction, SetFeeRate);
|
||||
instruction!(OreInstruction, SetSniperFeeDuration);
|
||||
instruction!(OreInstruction, ClaimSeeker);
|
||||
|
||||
@@ -287,3 +287,15 @@ pub fn set_sniper_fee_duration(signer: Pubkey, sniper_fee_duration: u64) -> Inst
|
||||
.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn claim_seeker(signer: Pubkey, mint: Pubkey) -> Instruction {
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new_readonly(mint, false),
|
||||
AccountMeta::new_readonly(spl_token::ID, false),
|
||||
],
|
||||
data: ClaimSeeker {}.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ use solana_client::{
|
||||
use solana_sdk::{
|
||||
compute_budget::ComputeBudgetInstruction,
|
||||
keccak::hash,
|
||||
pubkey,
|
||||
pubkey::Pubkey,
|
||||
signature::{read_keypair_file, Signer},
|
||||
transaction::Transaction,
|
||||
@@ -84,6 +85,9 @@ async fn main() {
|
||||
"benchmark" => {
|
||||
benchmark_keccak().await.unwrap();
|
||||
}
|
||||
"claim_seeker" => {
|
||||
claim_seeker(&rpc, &payer).await.unwrap();
|
||||
}
|
||||
_ => panic!("Invalid command"),
|
||||
};
|
||||
}
|
||||
@@ -221,6 +225,17 @@ async fn swap(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn claim_seeker(
|
||||
rpc: &RpcClient,
|
||||
payer: &solana_sdk::signer::keypair::Keypair,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
let seeker_mint = pubkey!("5mXbkqKz883aufhAsx3p5Z1NcvD2ppZbdTTznM6oUKLj");
|
||||
let ix = ore_api::sdk::claim_seeker(payer.pubkey(), seeker_mint);
|
||||
// submit_transaction(rpc, payer, &[ix]).await?;
|
||||
simulate_transaction(rpc, payer, &[ix]).await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn set_admin(
|
||||
rpc: &RpcClient,
|
||||
payer: &solana_sdk::signer::keypair::Keypair,
|
||||
|
||||
@@ -25,6 +25,7 @@ solana-nostd-keccak.workspace = true
|
||||
solana-program.workspace = true
|
||||
spl-token.workspace = true
|
||||
spl-token-2022.workspace = true
|
||||
spl-token-metadata-interface.workspace = true
|
||||
spl-associated-token-account.workspace = true
|
||||
steel.workspace = true
|
||||
|
||||
|
||||
44
program/src/claim_seeker.rs
Normal file
44
program/src/claim_seeker.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
use solana_program::pubkey;
|
||||
use steel::*;
|
||||
|
||||
use spl_token_2022::{
|
||||
extension::{
|
||||
metadata_pointer::MetadataPointer, BaseStateWithExtensions, PodStateWithExtensions,
|
||||
},
|
||||
pod::{PodCOption, PodMint},
|
||||
};
|
||||
|
||||
/// Claims ore for seeker device.
|
||||
pub fn process_claim_seeker(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
|
||||
// Load accounts.
|
||||
let [signer_info, mint_info, _token_info] = accounts else {
|
||||
return Err(ProgramError::NotEnoughAccountKeys);
|
||||
};
|
||||
signer_info.is_signer()?;
|
||||
mint_info.has_owner(&spl_token_2022::ID)?;
|
||||
// token_info.as_associated_token_account(&signer_info.key, &mint_info.key)?;
|
||||
|
||||
// Load mint.
|
||||
let mint_data = mint_info.try_borrow_data()?;
|
||||
let mint = PodStateWithExtensions::<PodMint>::unpack(&mint_data)?;
|
||||
|
||||
// Check mint authority.
|
||||
assert!(
|
||||
mint.base.mint_authority
|
||||
== PodCOption::some(pubkey!("GT2zuHVaZQYZSyQMgJPLzvkmyztfyXg2NJunqFp4p3A4")),
|
||||
"mint authority mismatch"
|
||||
);
|
||||
|
||||
// Check metadata pointer.
|
||||
let ext = mint.get_extension::<MetadataPointer>()?;
|
||||
assert!(
|
||||
ext.authority.0 == pubkey!("GT2zuHVaZQYZSyQMgJPLzvkmyztfyXg2NJunqFp4p3A4"),
|
||||
"metadata authority mismatch"
|
||||
);
|
||||
assert!(
|
||||
ext.metadata_address.0 == pubkey!("GT22s89nU4iWFkNXj1Bw6uYhJJWDRPpShHt4Bk8f99Te"),
|
||||
"metadata address mismatch"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
mod claim;
|
||||
mod claim_seeker;
|
||||
mod close;
|
||||
mod initialize;
|
||||
mod log;
|
||||
@@ -14,6 +15,7 @@ mod swap;
|
||||
mod whitelist;
|
||||
|
||||
use claim::*;
|
||||
use claim_seeker::*;
|
||||
use close::*;
|
||||
use initialize::*;
|
||||
use log::*;
|
||||
@@ -54,6 +56,9 @@ pub fn process_instruction(
|
||||
OreInstruction::SetFeeCollector => process_set_fee_collector(accounts, data)?,
|
||||
OreInstruction::SetFeeRate => process_set_fee_rate(accounts, data)?,
|
||||
OreInstruction::SetSniperFeeDuration => process_set_sniper_fee_duration(accounts, data)?,
|
||||
|
||||
// Seeker
|
||||
OreInstruction::ClaimSeeker => process_claim_seeker(accounts, data)?,
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use solana_program::pubkey;
|
||||
use steel::*;
|
||||
|
||||
pub const AUTHORIZED_ACCOUNTS: [Pubkey; 203] = [
|
||||
pub const AUTHORIZED_ACCOUNTS: [Pubkey; 235] = [
|
||||
pubkey!("pqspJ298ryBjazPAr95J9sULCVpZe3HbZTWkbC1zrkS"),
|
||||
pubkey!("6B9PjpHfbhPcSakS5UQ7ZctgbPujfsryVRpDecskGLiz"),
|
||||
pubkey!("J89R2jNKbfkFoJjvkjnwwepvJRE2M8VPQ67RhPeQfVY8"),
|
||||
@@ -180,7 +180,7 @@ pub const AUTHORIZED_ACCOUNTS: [Pubkey; 203] = [
|
||||
pubkey!("4DGxxu1fTbteKXm6USy3enW7S18iPFuJkqhKrSopGeBS"),
|
||||
pubkey!("AkmZXNFjEL6LgxGi1eM81iTXfwNJgeFG7iXUiFfmHni8"),
|
||||
pubkey!("297ogus15jvgePqXZCwT8nB1gvwgCJYdKcuXKiyH4TfS"),
|
||||
// pubkey!("3yKHWBKD5DeX7vG2ESJwWQWF4HgmgHumeXPhaZnqiore"),
|
||||
pubkey!("3yKHWBKD5DeX7vG2ESJwWQWF4HgmgHumeXPhaZnqiore"),
|
||||
pubkey!("4AQBsVmECmSBPh4JicNhGaT9waHETNxeNkaz72tezgSR"),
|
||||
pubkey!("6zWbGFC9WgPymyrTFM2MKAwLu8vKXwZJjFUcksikdabE"),
|
||||
pubkey!("Xp7Swytm55aTD8onDegFAVm4gC7zdCCkYMobRg5oHfr"),
|
||||
@@ -206,4 +206,35 @@ pub const AUTHORIZED_ACCOUNTS: [Pubkey; 203] = [
|
||||
pubkey!("G4WwpzfCXPzAJ2jfLXZRk7gNTEfaD8jNss5Xij33N21e"),
|
||||
pubkey!("Bo4nGugF3usS4N797H4LEm2r2d794kvht6HruwNCVe7Z"),
|
||||
pubkey!("2V1pTma3ZcctFvT1tALnoc2W2u5W1DmDqi3BjqerHrCN"),
|
||||
pubkey!("BX2X2QYU3twF4bRX2Pro4ARUNXi9cDd7cpRdZFW9JWC8"),
|
||||
pubkey!("DF4Ad2CRWyR5KMgGaqcfG258twr9LmsVc7hSCk8Pizfb"),
|
||||
pubkey!("AonibGzhwQ2MTtYNXiaEPnrfQ2c1eqJwp8SDfZL46TL3"),
|
||||
pubkey!("5o6PCwxNYpoa6wdtvaTiYyKrE9FoNE1bT542ZTuNgJpr"),
|
||||
pubkey!("AcVvuR5PoA1Mq5W9UY9x6fEAJthK9a1R4QHWQmETDb8h"),
|
||||
pubkey!("367Hqa8Q1DY1p5jKEmpCcJiyj5fH1dfbD7ZUBhCBbEa7"),
|
||||
pubkey!("GmRC6EhKtBEcKM1bjCBzamWDy3qmP5z2Kc9tYjQuc2Pn"),
|
||||
pubkey!("4iZPMVzyGGTnF3hA45vrSFP32tZ7yKiyQd7MiJHv8dyF"),
|
||||
pubkey!("3yxPRUpxUL2hLMLzDTWQpAFqY82MCphgy6iik3J8ZDLr"),
|
||||
pubkey!("31KPvwdWKK9FVPAER5fXLHfCCBQ5wGyUSqFMnpF9Xvyj"),
|
||||
pubkey!("4KVqRjx2Dyo53wANTGh5QKQQbatqUj3wfP9ZV7YinJTP"),
|
||||
pubkey!("EEPoEVgsabibKaAxs21JPBCMqKHmDcWkWzvXjS8vPf6L"),
|
||||
pubkey!("9xUqwnwaHnmXJifpJbu2dYu2PybVE2RDZhB7SHhLU2tL"),
|
||||
pubkey!("27R5t6DAWFnMXP3ZHA4aXabtxZ2nP4qH3BVQN1oEWSkj"),
|
||||
pubkey!("4hewNZbUaUziPGQ1yTmSX2yx9syzkc664RNjfFFS9sK4"),
|
||||
pubkey!("EpkrcNkBaK5eLwMKpV52H5MjPxcdWxnb1FcBr9FUEmMt"),
|
||||
pubkey!("6pKuMtqh56yaWT6ToYk3F7WcZnowAv2DPuptkYq9pPKc"),
|
||||
pubkey!("2icoVmEXH2q4zMmHChnFPS6iDt3hNTPrz3pdEEeK3Dqo"),
|
||||
pubkey!("gjwc2FafGF46Yn8aSnQu3a9S5MN1knwkc99yTzyqHnR"),
|
||||
pubkey!("A4ke6mJAL7muUJf4QfUV8yLMr2A3nH5Qnu1shV1DefvV"),
|
||||
pubkey!("CpF8aa81tZ6uAEoHHK5N79SREL49JyZxjMLPssY6qqU1"),
|
||||
pubkey!("8ujTq7pjihTBbebirvHohqykFLvNLa37MLTtFQcp9QHa"),
|
||||
pubkey!("3rXinbzxFTQ8uJTEDbU4XUD4gYBaRkfg6DDqpEZKwepf"),
|
||||
pubkey!("9zKXwnQU4F2yr2NdAAfzu6XGJQCWmgM5fMyn9qsRVyhj"),
|
||||
pubkey!("AVYG9UHetNHT1FEDPLv9pN2sCCH4CLsjvkzGjVXBfEiS"),
|
||||
pubkey!("82dYc4N5KJvMyAiSRC74D3uHyNGy8Wr4ghfer15YLQa6"),
|
||||
pubkey!("GEwUNpFEN4q4i8RBxmjQHtLC57tmQkUVDhFrDiLjxv5P"),
|
||||
pubkey!("B8esH7ZNMHVwm3gQuzeM3XEa8pUa1ELRCYTezwRsMcjA"),
|
||||
pubkey!("6Mn9Th41tmNqXyPS8y6hno2EB6wzHcYkfnh6br3NGNAy"),
|
||||
pubkey!("ECHb13JeXfPdj5Z3EEFQ1vcGEpagqHXrWGZF7NdaWF4z"),
|
||||
pubkey!("FBsBn9iScLsvSe9oUtQiXuyXGh2uJZfwAAzzD8gP84AU"),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user