mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
cleanup
This commit is contained in:
@@ -29,47 +29,6 @@ pub fn boost(signer: Pubkey) -> Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
// let [signer_info, authority_info, miner_info, miner_tokens_info, mint_info, recipient_info, system_program, token_program, associated_token_program] =
|
||||
|
||||
pub fn migrate_miner(signer: Pubkey, authority: Pubkey) -> Instruction {
|
||||
let miner_address = miner_pda(authority).0;
|
||||
let miner_tokens_address = get_associated_token_address(&miner_address, &MINT_ADDRESS);
|
||||
let recipient_address = get_associated_token_address(&authority, &MINT_ADDRESS);
|
||||
let mint_address = MINT_ADDRESS;
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(authority, false),
|
||||
AccountMeta::new(miner_address, false),
|
||||
AccountMeta::new(miner_tokens_address, false),
|
||||
AccountMeta::new(mint_address, false),
|
||||
AccountMeta::new(recipient_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
AccountMeta::new_readonly(spl_token::ID, false),
|
||||
AccountMeta::new_readonly(spl_associated_token_account::ID, false),
|
||||
],
|
||||
data: MigrateMiner {}.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
// let [signer_info, config_info, treasury_info, system_program] = accounts else {
|
||||
|
||||
pub fn migrate_treasury(signer: Pubkey) -> Instruction {
|
||||
let config_address = config_pda().0;
|
||||
let treasury_address = treasury_pda().0;
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(config_address, false),
|
||||
AccountMeta::new(treasury_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
],
|
||||
data: MigrateTreasury {}.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
// let [signer_info, board_info, config_info, mint_info, treasury_info, vault_info, system_program, token_program, associated_token_program] =
|
||||
|
||||
pub fn initialize(signer: Pubkey) -> Instruction {
|
||||
|
||||
@@ -66,15 +66,6 @@ async fn main() {
|
||||
"miner" => {
|
||||
log_miner(&rpc, &payer).await.unwrap();
|
||||
}
|
||||
"migrate_all_miners" => {
|
||||
migrate_all_miners(&rpc, &payer).await.unwrap();
|
||||
}
|
||||
"migrate_miner" => {
|
||||
migrate_miner(&rpc, &payer).await.unwrap();
|
||||
}
|
||||
"migrate_treasury" => {
|
||||
migrate_treasury(&rpc, &payer).await.unwrap();
|
||||
}
|
||||
"prospect" => {
|
||||
prospect(&rpc, &payer).await.unwrap();
|
||||
}
|
||||
@@ -190,43 +181,6 @@ async fn reset(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn migrate_miner(
|
||||
rpc: &RpcClient,
|
||||
payer: &solana_sdk::signer::keypair::Keypair,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
let address = pubkey!("pqspJ298ryBjazPAr95J9sULCVpZe3HbZTWkbC1zrkS");
|
||||
let ix = ore_api::sdk::migrate_miner(payer.pubkey(), address);
|
||||
submit_transaction(rpc, payer, &[ix]).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn migrate_all_miners(
|
||||
rpc: &RpcClient,
|
||||
payer: &solana_sdk::signer::keypair::Keypair,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
let miners_old = get_miners_old(rpc).await?;
|
||||
for (i, miner) in miners_old.iter().enumerate() {
|
||||
println!(
|
||||
"[{}/{}] Migrating miner: {}",
|
||||
i + 1,
|
||||
miners_old.len(),
|
||||
miner.1.authority
|
||||
);
|
||||
let ix = ore_api::sdk::migrate_miner(payer.pubkey(), miner.1.authority);
|
||||
submit_transaction(rpc, payer, &[ix]).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn migrate_treasury(
|
||||
rpc: &RpcClient,
|
||||
payer: &solana_sdk::signer::keypair::Keypair,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
let ix = ore_api::sdk::migrate_treasury(payer.pubkey());
|
||||
submit_transaction(rpc, payer, &[ix]).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn prospect(
|
||||
rpc: &RpcClient,
|
||||
payer: &solana_sdk::signer::keypair::Keypair,
|
||||
|
||||
Reference in New Issue
Block a user