This commit is contained in:
Hardhat Chad
2025-09-25 15:16:11 -07:00
parent 8ba57ef554
commit 6912c264b7
2 changed files with 7 additions and 3 deletions

View File

@@ -244,6 +244,7 @@ async fn reset(
miners = square.miners[id as usize].to_vec();
};
let reset_ix = ore_api::sdk::reset(payer.pubkey(), config.fee_collector, miners);
// simulate_transaction(rpc, payer, &[reset_ix]).await;
submit_transaction(rpc, payer, &[reset_ix]).await?;
Ok(())
}

View File

@@ -52,7 +52,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
if square_deployed == 0 {
// Update board.
board.total_vaulted = board.total_deployed;
treasury.balance += board.total_deployed;
treasury.balance += board.total_deployed - fee;
// Emit event.
program_log(
@@ -84,7 +84,8 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
let mut winnings = 0;
for (i, deployed) in board.deployed.iter().enumerate() {
if i != winning_square {
winnings += deployed - (deployed / 100);
let fee = deployed / 100;
winnings += deployed - fee;
}
}
@@ -106,7 +107,9 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
.as_account_mut::<Miner>(&ore_api::ID)?
.assert_mut(|m| m.round_id == board.id)?;
let miner_deployed = miner.deployed[winning_square];
let rewards = miner_deployed + (winnings * miner_deployed / square_deployed); // Winners get their own prospect back plus their share of the winnings.
let fee = miner_deployed / 100;
let miner_winnings = winnings * miner_deployed / square_deployed;
let rewards = (miner_deployed - fee) + miner_winnings; // Winners get their own deployment back, minus fee, plus their share of the winnings.
checksum += miner_deployed;
miner.rewards_sol += rewards;
miner.lifetime_rewards_sol += rewards;