From 37f1a9d55bef5c98cd59ac987d2a435e8a9aef26 Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Sat, 20 Sep 2025 11:53:27 -0700 Subject: [PATCH] deploy --- api/src/event.rs | 2 +- api/src/state/board.rs | 8 ++++---- api/src/state/miner.rs | 2 +- cli/src/main.rs | 6 +++--- program/src/deploy.rs | 18 +++++++++--------- program/src/initialize.rs | 4 ++-- program/src/reset.rs | 22 +++++++++++----------- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/api/src/event.rs b/api/src/event.rs index 8164428..0663281 100644 --- a/api/src/event.rs +++ b/api/src/event.rs @@ -29,7 +29,7 @@ pub struct ResetEvent { pub num_winners: u64, /// The total amount of SOL prospected in the round. - pub total_prospects: u64, + pub total_deployed: u64, /// The total amount of SOL put in the ORE vault. pub total_vaulted: u64, diff --git a/api/src/state/board.rs b/api/src/state/board.rs index 1a79f54..6a734cb 100644 --- a/api/src/state/board.rs +++ b/api/src/state/board.rs @@ -10,8 +10,8 @@ pub struct Board { /// The round number. pub id: u64, - /// The prospects for the round. - pub prospects: [u64; 25], + /// The deployed SOL for the round. + pub deployed: [u64; 25], /// The timestamp at which the block starts mining. pub start_at: i64, @@ -28,8 +28,8 @@ pub struct Board { /// The top miner of the round. pub top_miner: Pubkey, - /// The total amount of SOL prospected in the round. - pub total_prospects: u64, + /// The total amount of SOL deployed in the round. + pub total_deployed: u64, /// The total amount of SOL put in the ORE vault. pub total_vaulted: u64, diff --git a/api/src/state/miner.rs b/api/src/state/miner.rs index f1ba87f..ae0ceb2 100644 --- a/api/src/state/miner.rs +++ b/api/src/state/miner.rs @@ -11,7 +11,7 @@ pub struct Miner { pub authority: Pubkey, /// The miner's prospects in the current round. - pub prospects: [u64; 25], + pub deployed: [u64; 25], /// The amount of SOL this miner can claim. pub rewards_sol: u64, diff --git a/cli/src/main.rs b/cli/src/main.rs index 71890c5..c99ba4e 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -284,7 +284,7 @@ async fn log_miner( println!("Miner"); println!(" address: {}", miner_address); println!(" authority: {}", authority); - println!(" prospects: {:?}", miner.prospects); + println!(" deployed: {:?}", miner.deployed); println!(" rewards_sol: {}", miner.rewards_sol); println!(" rewards_ore: {}", miner.rewards_ore); println!(" round_id: {}", miner.round_id); @@ -328,9 +328,9 @@ fn print_board(board: Board, clock: &Clock) { println!(" Slot hash: {:?}", board.slot_hash); println!(" Start slot: {}", board.start_slot); println!(" End slot: {}", board.end_slot); - println!(" Prospects: {:?}", board.prospects); + println!(" deployed: {:?}", board.deployed); println!(" Top miner: {:?}", board.top_miner); - println!(" Total prospects: {}", board.total_prospects); + println!(" Total deployed: {}", board.total_deployed); println!(" Total vaulted: {}", board.total_vaulted); println!(" Total winnings: {}", board.total_winnings); if board.slot_hash != [0; 32] { diff --git a/program/src/deploy.rs b/program/src/deploy.rs index ce94e5b..c0cd3cc 100644 --- a/program/src/deploy.rs +++ b/program/src/deploy.rs @@ -53,7 +53,7 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul )?; let miner = miner_info.as_account_mut::(&ore_api::ID)?; miner.authority = *signer_info.key; - miner.prospects = [0; 25]; + miner.deployed = [0; 25]; miner.rewards_sol = 0; miner.rewards_ore = 0; miner.round_id = board.id; @@ -69,13 +69,13 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul // Reset board. if board.slot_hash != [0; 32] { // Reset board - board.prospects = [0; 25]; + board.deployed = [0; 25]; board.id += 1; board.slot_hash = [0; 32]; board.start_slot = clock.slot; board.end_slot = clock.slot + 150; // one minute board.top_miner = Pubkey::default(); - board.total_prospects = 0; + board.total_deployed = 0; board.total_vaulted = 0; board.total_winnings = 0; @@ -86,7 +86,7 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul // Reset miner if miner.round_id != board.id { - miner.prospects = [0; 25]; + miner.deployed = [0; 25]; miner.round_id = board.id; } @@ -95,8 +95,8 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul let amount = amount - fee; // Update miner - let is_first_move = miner.prospects[square_id] == 0; - miner.prospects[square_id] += amount; + let is_first_move = miner.deployed[square_id] == 0; + miner.deployed[square_id] += amount; // Update square if is_first_move { @@ -105,10 +105,10 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul } // Update board - board.prospects[square_id] += amount; - board.total_prospects += amount; + board.deployed[square_id] += amount; + board.total_deployed += amount; - // Transfer prospects. + // Transfer deployed. board_info.collect(amount, &signer_info)?; fee_collector_info.collect(fee, &signer_info)?; diff --git a/program/src/initialize.rs b/program/src/initialize.rs index a37983a..2898b83 100644 --- a/program/src/initialize.rs +++ b/program/src/initialize.rs @@ -29,14 +29,14 @@ pub fn process_initialize(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Program &[BOARD], )?; let board = board_info.as_account_mut::(&ore_api::ID)?; - board.prospects = [0; 25]; + board.deployed = [0; 25]; board.id = 0; board.start_at = 0; board.start_slot = 0; board.end_slot = 0; board.slot_hash = [0; 32]; board.top_miner = Pubkey::default(); - board.total_prospects = 0; + board.total_deployed = 0; board.total_vaulted = 0; board.total_winnings = 0; } else { diff --git a/program/src/reset.rs b/program/src/reset.rs index 8c8c3f8..ad8107c 100644 --- a/program/src/reset.rs +++ b/program/src/reset.rs @@ -32,7 +32,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul if let Ok(slot_hash) = get_slot_hash(board.end_slot, slot_hashes_sysvar) { board.slot_hash = slot_hash; let winning_square = get_winning_square(&slot_hash); - let square_prospects = board.prospects[winning_square]; + let square_prospects = board.deployed[winning_square]; (winning_square, square_prospects) } else { // Cannot get slot hash. No one wins. @@ -40,11 +40,11 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul (u64::MAX as usize, 0) }; - // No one won. Vault all prospects. + // No one won. Vault all deployed. if square_prospects == 0 { // Update board. - board.total_vaulted = board.total_prospects; - treasury.balance += board.total_prospects; + board.total_vaulted = board.total_deployed; + treasury.balance += board.total_deployed; // Emit event. program_log( @@ -57,7 +57,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul winning_square: winning_square as u64, top_miner: board.top_miner, num_winners: 0, - total_prospects: board.total_prospects, + total_deployed: board.total_deployed, total_vaulted: board.total_vaulted, total_winnings: board.total_winnings, total_minted: 0, @@ -67,16 +67,16 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul )?; // Do SOL transfers. - board_info.send(board.total_prospects, &treasury_info); + board_info.send(board.total_deployed, &treasury_info); return Ok(()); } - // Get winnings amount (prospects on all non-winning squares). + // Get winnings amount (deployed on all non-winning squares). let mut winnings = 0; - for (i, prospects) in board.prospects.iter().enumerate() { + for (i, deployed) in board.deployed.iter().enumerate() { if i != winning_square { - winnings += prospects; + winnings += deployed; } } @@ -95,7 +95,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul let miner = miner_info .as_account_mut::(&ore_api::ID)? .assert_mut(|m| m.round_id == board.id)?; - let miner_prospects = miner.prospects[winning_square]; + let miner_prospects = miner.deployed[winning_square]; let rewards = miner_prospects + (winnings * miner_prospects / square_prospects); // Winners get their own prospect back plus their share of the winnings. checksum += miner_prospects; miner.rewards_sol += rewards; @@ -172,7 +172,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul winning_square: winning_square as u64, top_miner: board.top_miner, num_winners: square.count[winning_square], - total_prospects: board.total_prospects, + total_deployed: board.total_deployed, total_vaulted: board.total_vaulted, total_winnings: board.total_winnings, total_minted: mint_amount,