This commit is contained in:
Hardhat Chad
2025-05-23 19:24:12 -07:00
parent 1ab3b1f73c
commit b8cf9b0208
7 changed files with 40 additions and 1758 deletions

View File

@@ -20,7 +20,7 @@ pub fn process_bet(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
let block = block_info
.as_account_mut::<Block>(&ore_api::ID)?
.assert_mut(|b| b.ends_at > clock.slot)?
.assert_mut(|b| b.payed_out != 0)?;
.assert_mut(|b| b.payed_out == 0)?;
block_bets_info.as_associated_token_account(block_info.key, &block.mint)?;
sender_info.as_associated_token_account(signer_info.key, &block.mint)?;
wager_info.is_writable()?.is_empty()?.has_seeds(
@@ -46,14 +46,14 @@ pub fn process_bet(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult {
let wager = wager_info.as_account_mut::<Wager>(&ore_api::ID)?;
wager.amount = amount;
wager.authority = *signer_info.key;
wager.id = block.bet_count;
wager.round = block.current_round;
wager.timestamp = clock.unix_timestamp as u64;
wager.cumulative_bets = block.total_bets;
wager.round = block.current_round;
wager.seed = seed;
wager.timestamp = clock.unix_timestamp as u64;
// Update block stats.
block.total_bets += amount;
block.bet_count += 1;
block.total_bets += amount;
// Hash client seed into block noise for provably fair randomness.
block.noise = hashv(&[&block.noise, &seed]).to_bytes();

View File

@@ -15,7 +15,7 @@ pub fn process_payout(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResu
signer_info.is_signer()?;
let block = block_info
.as_account_mut::<Block>(&ore_api::ID)?
.assert_mut(|b| b.ends_at < clock.slot)?
.assert_mut(|b| b.ends_at <= clock.slot)?
.assert_mut(|b| b.payed_out == 0)?;
treasury_info.has_address(&TREASURY_ADDRESS)?;
treasury_tokens_info