mirror of
https://github.com/d0zingcat/ore.git
synced 2026-06-01 15:11:16 +00:00
mint boost tokens
This commit is contained in:
@@ -85,8 +85,5 @@ pub const ORE_LIQUIDITY: u64 = ONE_ORE * 100;
|
|||||||
/// The minimum difficulty required for payout.
|
/// The minimum difficulty required for payout.
|
||||||
pub const NUGGET_DIFFICULTY: u64 = 10;
|
pub const NUGGET_DIFFICULTY: u64 = 10;
|
||||||
|
|
||||||
// The difficulty threshold for the motherlode payout.
|
/// The address of the boost reserve token account.
|
||||||
// pub const MOTHERLOAD_DIFFICULTY: u64 = 35;
|
pub const BOOST_RESERVE_TOKEN: Pubkey = pubkey!("11111111111111111111111111111111"); // TODO: change this
|
||||||
|
|
||||||
// The fee to open a block.
|
|
||||||
// pub const OPEN_FEE: u64 = ONE_ORE / 100;
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use steel::*;
|
|||||||
pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
|
pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult {
|
||||||
// Load accounts.
|
// Load accounts.
|
||||||
let clock = Clock::get()?;
|
let clock = Clock::get()?;
|
||||||
let [signer_info, block_prev_info, block_next_info, config_info, market_info, mint_info, treasury_info, treasury_tokens_info, vault_info, system_program, token_program, ore_program, slot_hashes_sysvar] =
|
let [signer_info, block_prev_info, block_next_info, config_info, market_info, mint_info, reserve_tokens_info, treasury_info, treasury_tokens_info, vault_info, system_program, token_program, ore_program, slot_hashes_sysvar] =
|
||||||
accounts
|
accounts
|
||||||
else {
|
else {
|
||||||
return Err(ProgramError::NotEnoughAccountKeys);
|
return Err(ProgramError::NotEnoughAccountKeys);
|
||||||
@@ -20,6 +20,10 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
|||||||
.as_account_mut::<Market>(&ore_api::ID)?
|
.as_account_mut::<Market>(&ore_api::ID)?
|
||||||
.assert_mut(|m| m.block_id == block_next.id - 1)?;
|
.assert_mut(|m| m.block_id == block_next.id - 1)?;
|
||||||
let ore_mint = mint_info.has_address(&MINT_ADDRESS)?.as_mint()?;
|
let ore_mint = mint_info.has_address(&MINT_ADDRESS)?.as_mint()?;
|
||||||
|
reserve_tokens_info
|
||||||
|
.has_address(&BOOST_RESERVE_TOKEN)?
|
||||||
|
.as_token_account()?
|
||||||
|
.assert(|t| t.mint() == MINT_ADDRESS)?;
|
||||||
treasury_info.as_account::<Treasury>(&ore_api::ID)?;
|
treasury_info.as_account::<Treasury>(&ore_api::ID)?;
|
||||||
treasury_tokens_info
|
treasury_tokens_info
|
||||||
.is_writable()?
|
.is_writable()?
|
||||||
@@ -107,6 +111,16 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
|||||||
block_next.start_slot = clock.slot;
|
block_next.start_slot = clock.slot;
|
||||||
block_next.end_slot = clock.slot + config.block_duration;
|
block_next.end_slot = clock.slot + config.block_duration;
|
||||||
|
|
||||||
|
// Mint tokens to the boost reserve.
|
||||||
|
mint_to_signed(
|
||||||
|
mint_info,
|
||||||
|
reserve_tokens_info,
|
||||||
|
treasury_info,
|
||||||
|
token_program,
|
||||||
|
ONE_ORE / 2,
|
||||||
|
&[TREASURY],
|
||||||
|
)?;
|
||||||
|
|
||||||
// Emit event.
|
// Emit event.
|
||||||
program_log(
|
program_log(
|
||||||
&[market_info.clone(), ore_program.clone()],
|
&[market_info.clone(), ore_program.clone()],
|
||||||
|
|||||||
Reference in New Issue
Block a user