mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
bury
This commit is contained in:
@@ -177,7 +177,7 @@ async fn bury_ore_sol(
|
||||
b_vault_lp_mint: pubkey!("FZN7QZ8ZUUAxMPfxYEYkH3cXUASzH8EqA6B4tyCL8f1j"),
|
||||
a_vault_lp: pubkey!("2k7V1NtM1krwh1sdt5wWqBRcvNQ5jzxj3J2rV78zdTsL"),
|
||||
b_vault_lp: pubkey!("CFATQFgkKXJyU3MdCNvQqN79qorNSMJFF8jrF66a7r6i"),
|
||||
protocol_token_fee: pubkey!("3WYz5TC8X4FLvwWQ2QvSfXuZHXjqvsdymKwmMFkgCgVs"),
|
||||
protocol_token_fee: pubkey!("6kzYo2LMo2q2bkLAD8ienoG5NC1MkNXNTfm8sdyHuX3h"),
|
||||
user: payer.pubkey(),
|
||||
vault_program: pubkey!("24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi"),
|
||||
token_program: spl_token::ID,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use meteora_pools_sdk::instructions::{SwapCpi, SwapCpiAccounts, SwapInstructionArgs};
|
||||
use ore_api::prelude::*;
|
||||
use solana_program::log::sol_log;
|
||||
use steel::*;
|
||||
|
||||
/// Swaps bets into ORE and buries the ORE.
|
||||
@@ -8,7 +7,6 @@ pub fn process_bury(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult
|
||||
// Load accounts.
|
||||
let clock = Clock::get()?;
|
||||
let (required_accounts, meteora_accounts) = accounts.split_at(6);
|
||||
sol_log(format!("Loading {} required accounts", meteora_accounts.len()).as_str());
|
||||
let [signer_info, block_info, block_bets_info, block_ore_info, bet_mint_info, ore_mint_info] =
|
||||
required_accounts
|
||||
else {
|
||||
@@ -25,7 +23,6 @@ pub fn process_bury(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult
|
||||
bet_mint_info.as_mint()?;
|
||||
ore_mint_info.has_address(&MINT_ADDRESS)?.as_mint()?;
|
||||
|
||||
sol_log(format!("Loading {} meteora accounts", meteora_accounts.len()).as_str());
|
||||
// Load meteora accounts.
|
||||
let [pool_info, a_vault_info, b_vault_info, a_token_vault_info, b_token_vault_info, a_vault_lp_mint_info, b_vault_lp_mint_info, a_vault_lp_info, b_vault_lp_info, protocol_token_fee_info, vault_program_info, token_program_info, meteora_pools_program] =
|
||||
meteora_accounts
|
||||
|
||||
@@ -31,15 +31,15 @@ pub fn process_initialize(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Program
|
||||
&[BLOCK],
|
||||
)?;
|
||||
let block = block_info.as_account_mut::<Block>(&ore_api::ID)?;
|
||||
block.current_round = 0;
|
||||
block.total_bets = 0;
|
||||
block.bet_count = 0;
|
||||
block.started_at = 0;
|
||||
block.current_round = 0;
|
||||
block.ends_at = 0;
|
||||
block.payed_out = 0;
|
||||
block.mint = spl_token::native_mint::ID;
|
||||
block.reward = 0;
|
||||
block.noise = [0; 32];
|
||||
block.payed_out = 0;
|
||||
block.reward = 0;
|
||||
block.started_at = 0;
|
||||
block.total_bets = 0;
|
||||
|
||||
// Initialize block token accounts.
|
||||
create_associated_token_account(
|
||||
@@ -51,15 +51,15 @@ pub fn process_initialize(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Program
|
||||
token_program,
|
||||
associated_token_program,
|
||||
)?;
|
||||
// create_associated_token_account(
|
||||
// signer_info,
|
||||
// block_info,
|
||||
// block_ore_info,
|
||||
// ore_mint_info,
|
||||
// system_program,
|
||||
// token_program,
|
||||
// associated_token_program,
|
||||
// )?;
|
||||
create_associated_token_account(
|
||||
signer_info,
|
||||
block_info,
|
||||
block_ore_info,
|
||||
ore_mint_info,
|
||||
system_program,
|
||||
token_program,
|
||||
associated_token_program,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -23,12 +23,15 @@ pub fn process_instruction(
|
||||
let (ix, data) = parse_instruction(&ore_api::ID, program_id, data)?;
|
||||
|
||||
match ix {
|
||||
// User
|
||||
OreInstruction::Bet => process_bet(accounts, data)?,
|
||||
OreInstruction::Bury => process_bury(accounts, data)?,
|
||||
OreInstruction::Close => process_close(accounts, data)?,
|
||||
OreInstruction::Reset => process_reset(accounts, data)?,
|
||||
OreInstruction::Initialize => process_initialize(accounts, data)?,
|
||||
OreInstruction::Payout => process_payout(accounts, data)?,
|
||||
OreInstruction::Reset => process_reset(accounts, data)?,
|
||||
|
||||
// Admin
|
||||
OreInstruction::Bury => process_bury(accounts, data)?,
|
||||
OreInstruction::Initialize => process_initialize(accounts, data)?,
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -42,14 +42,14 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
||||
boost_proof.total_rewards += boost_reward;
|
||||
|
||||
// Reset the block.
|
||||
block.bet_count = 0;
|
||||
block.current_round += 1;
|
||||
block.ends_at = clock.slot + 150; // 60 seconds
|
||||
block.noise = [0; 32];
|
||||
block.payed_out = 0;
|
||||
block.reward = net_emissions - boost_reward;
|
||||
block.started_at = clock.slot;
|
||||
block.ends_at = clock.slot + 150; // 60 seconds
|
||||
block.payed_out = 0;
|
||||
block.total_bets = 0;
|
||||
block.bet_count = 0;
|
||||
block.noise = [0; 32];
|
||||
block.current_round += 1;
|
||||
|
||||
// Fund the treasury.
|
||||
mint_to_signed(
|
||||
|
||||
Reference in New Issue
Block a user