mirror of
https://github.com/d0zingcat/ore.git
synced 2026-06-02 15:11:17 +00:00
sol
This commit is contained in:
@@ -2,7 +2,7 @@ use spl_associated_token_account::get_associated_token_address;
|
||||
use steel::*;
|
||||
|
||||
use crate::{
|
||||
consts::{BOOST_RESERVE_TOKEN, MARKET, MINT_ADDRESS, TREASURY_ADDRESS},
|
||||
consts::{BOOST_RESERVE_TOKEN, MINT_ADDRESS, TREASURY_ADDRESS},
|
||||
instruction::*,
|
||||
state::*,
|
||||
};
|
||||
@@ -14,7 +14,7 @@ pub fn initialize(signer: Pubkey) -> Instruction {
|
||||
let board_address = board_pda().0;
|
||||
let mint_address = MINT_ADDRESS;
|
||||
let treasury_address = TREASURY_ADDRESS;
|
||||
let vault_address = vault_address();
|
||||
let treasury_tokens_address = treasury_tokens_address();
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
@@ -23,7 +23,7 @@ pub fn initialize(signer: Pubkey) -> Instruction {
|
||||
AccountMeta::new(config_address, false),
|
||||
AccountMeta::new(mint_address, false),
|
||||
AccountMeta::new(treasury_address, false),
|
||||
AccountMeta::new(vault_address, false),
|
||||
AccountMeta::new(treasury_tokens_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),
|
||||
@@ -66,27 +66,47 @@ pub fn initialize_squares(signer: Pubkey) -> Instruction {
|
||||
AccountMeta::new(square_pda(23).0, false),
|
||||
AccountMeta::new(square_pda(24).0, false),
|
||||
],
|
||||
data: InitializeSquare {}.to_bytes(),
|
||||
data: InitializeSquares {}.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn claim(signer: Pubkey, amount: u64) -> Instruction {
|
||||
pub fn claim_sol(signer: Pubkey, amount: u64) -> Instruction {
|
||||
let miner_address = miner_pda(signer).0;
|
||||
let miner_tokens_address = get_associated_token_address(&miner_address, &MINT_ADDRESS);
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(miner_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
],
|
||||
data: ClaimSOL {
|
||||
amount: amount.to_le_bytes(),
|
||||
}
|
||||
.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
// let [signer_info, miner_info, mint_info, recipient_info, treasury_info, treasury_tokens_info, system_program, token_program, associated_token_program] =
|
||||
|
||||
pub fn claim_ore(signer: Pubkey, amount: u64) -> Instruction {
|
||||
let miner_address = miner_pda(signer).0;
|
||||
let treasury_address = treasury_pda().0;
|
||||
let treasury_tokens_address = get_associated_token_address(&treasury_address, &MINT_ADDRESS);
|
||||
let recipient_address = get_associated_token_address(&signer, &MINT_ADDRESS);
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(miner_address, false),
|
||||
AccountMeta::new(miner_tokens_address, false),
|
||||
AccountMeta::new(recipient_address, false),
|
||||
AccountMeta::new(MINT_ADDRESS, false),
|
||||
AccountMeta::new(recipient_address, false),
|
||||
AccountMeta::new(treasury_address, false),
|
||||
AccountMeta::new(treasury_tokens_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: Claim {
|
||||
data: ClaimORE {
|
||||
amount: amount.to_le_bytes(),
|
||||
}
|
||||
.to_bytes(),
|
||||
@@ -100,14 +120,14 @@ pub fn reset(signer: Pubkey, miners: Vec<Pubkey>) -> Instruction {
|
||||
let mint_address = MINT_ADDRESS;
|
||||
let treasury_address = TREASURY_ADDRESS;
|
||||
let reserve_tokens_address = BOOST_RESERVE_TOKEN;
|
||||
let vault_address = vault_address();
|
||||
let treasury_tokens_address = treasury_tokens_address();
|
||||
let mut accounts = vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(board_address, false),
|
||||
AccountMeta::new(mint_address, false),
|
||||
AccountMeta::new(treasury_address, false),
|
||||
AccountMeta::new(reserve_tokens_address, false),
|
||||
AccountMeta::new(vault_address, false),
|
||||
AccountMeta::new(treasury_address, false),
|
||||
AccountMeta::new(treasury_tokens_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
AccountMeta::new_readonly(spl_token::ID, false),
|
||||
AccountMeta::new_readonly(sysvar::slot_hashes::ID, false),
|
||||
@@ -124,15 +144,13 @@ pub fn reset(signer: Pubkey, miners: Vec<Pubkey>) -> Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
// let [signer_info, board_info, config_info, fee_collector_info, miner_info, mint_info, sender_info, square_info, vault_info, system_program, token_program, associated_token_program] =
|
||||
// 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 sender_address = get_associated_token_address(&signer, &MINT_ADDRESS);
|
||||
let square_address = square_pda(square_id).0;
|
||||
let vault_address = vault_address();
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
@@ -141,11 +159,8 @@ pub fn prospect(signer: Pubkey, fee_collector: Pubkey, amount: u64, square_id: u
|
||||
AccountMeta::new(config_address, false),
|
||||
AccountMeta::new(fee_collector, false),
|
||||
AccountMeta::new(miner_address, false),
|
||||
AccountMeta::new(sender_address, false),
|
||||
AccountMeta::new(square_address, false),
|
||||
AccountMeta::new(vault_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
AccountMeta::new_readonly(spl_token::ID, false),
|
||||
],
|
||||
data: Prospect {
|
||||
amount: amount.to_le_bytes(),
|
||||
|
||||
Reference in New Issue
Block a user