mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-30 15:11:11 +00:00
deploy
This commit is contained in:
@@ -111,6 +111,32 @@ pub fn claim_ore(signer: Pubkey, amount: u64) -> Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
// let [signer_info, board_info, config_info, fee_collector_info, miner_info, sender_info, square_info, system_program] =
|
||||
|
||||
pub fn deploy(signer: Pubkey, fee_collector: Pubkey, amount: u64, square_id: u64) -> Instruction {
|
||||
let board_address = board_pda().0;
|
||||
let config_address = config_pda().0;
|
||||
let miner_address = miner_pda(signer).0;
|
||||
let square_address = square_pda().0;
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(board_address, false),
|
||||
AccountMeta::new(config_address, false),
|
||||
AccountMeta::new(fee_collector, false),
|
||||
AccountMeta::new(miner_address, false),
|
||||
AccountMeta::new(square_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
],
|
||||
data: Deploy {
|
||||
amount: amount.to_le_bytes(),
|
||||
square_id: square_id.to_le_bytes(),
|
||||
}
|
||||
.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn redeem(signer: Pubkey, amount: u64) -> Instruction {
|
||||
let mint_address = MINT_ADDRESS;
|
||||
let sender_address = get_associated_token_address(&signer, &MINT_ADDRESS);
|
||||
@@ -166,32 +192,6 @@ pub fn reset(signer: Pubkey, miners: Vec<Pubkey>) -> Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
// let [signer_info, board_info, config_info, fee_collector_info, miner_info, sender_info, square_info, system_program] =
|
||||
|
||||
pub fn prospect(signer: Pubkey, fee_collector: Pubkey, amount: u64, square_id: u64) -> Instruction {
|
||||
let board_address = board_pda().0;
|
||||
let config_address = config_pda().0;
|
||||
let miner_address = miner_pda(signer).0;
|
||||
let square_address = square_pda().0;
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(board_address, false),
|
||||
AccountMeta::new(config_address, false),
|
||||
AccountMeta::new(fee_collector, false),
|
||||
AccountMeta::new(miner_address, false),
|
||||
AccountMeta::new(square_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
],
|
||||
data: Prospect {
|
||||
amount: amount.to_le_bytes(),
|
||||
square_id: square_id.to_le_bytes(),
|
||||
}
|
||||
.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_admin(signer: Pubkey, admin: Pubkey) -> Instruction {
|
||||
let config_address = config_pda().0;
|
||||
Instruction {
|
||||
|
||||
Reference in New Issue
Block a user