diff --git a/api/src/consts.rs b/api/src/consts.rs index 663ba4b..ebf1115 100644 --- a/api/src/consts.rs +++ b/api/src/consts.rs @@ -85,8 +85,5 @@ pub const ORE_LIQUIDITY: u64 = ONE_ORE * 100; /// The minimum difficulty required for payout. pub const NUGGET_DIFFICULTY: u64 = 10; -// The difficulty threshold for the motherlode payout. -// pub const MOTHERLOAD_DIFFICULTY: u64 = 35; - -// The fee to open a block. -// pub const OPEN_FEE: u64 = ONE_ORE / 100; +/// The address of the boost reserve token account. +pub const BOOST_RESERVE_TOKEN: Pubkey = pubkey!("11111111111111111111111111111111"); // TODO: change this diff --git a/program/src/reset.rs b/program/src/reset.rs index d4ac554..3485070 100644 --- a/program/src/reset.rs +++ b/program/src/reset.rs @@ -8,7 +8,7 @@ use steel::*; pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult { // Load accounts. 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 else { return Err(ProgramError::NotEnoughAccountKeys); @@ -20,6 +20,10 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul .as_account_mut::(&ore_api::ID)? .assert_mut(|m| m.block_id == block_next.id - 1)?; 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::(&ore_api::ID)?; treasury_tokens_info .is_writable()? @@ -107,6 +111,16 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul block_next.start_slot = clock.slot; 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. program_log( &[market_info.clone(), ore_program.clone()],