mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
paid
This commit is contained in:
@@ -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.paid == 0)?;
|
||||
block_bets_info
|
||||
.is_writable()?
|
||||
.as_associated_token_account(block_info.key, &block.mint)?;
|
||||
|
||||
@@ -36,7 +36,7 @@ pub fn process_initialize(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Program
|
||||
block.ends_at = 0;
|
||||
block.mint = spl_token::native_mint::ID;
|
||||
block.noise = [0; 32];
|
||||
block.payed_out = 0;
|
||||
block.paid = 0;
|
||||
block.reward = 0;
|
||||
block.started_at = 0;
|
||||
block.total_wagers = 0;
|
||||
|
||||
@@ -16,7 +16,7 @@ pub fn process_payout(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResu
|
||||
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.paid == 0)?;
|
||||
treasury_info.has_address(&TREASURY_ADDRESS)?;
|
||||
treasury_tokens_info
|
||||
.has_address(&TREASURY_TOKENS_ADDRESS)?
|
||||
@@ -26,7 +26,7 @@ pub fn process_payout(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResu
|
||||
slot_hashes_sysvar.is_sysvar(&sysvar::slot_hashes::ID)?;
|
||||
|
||||
// Mark the block as paid out.
|
||||
block.payed_out = 1;
|
||||
block.paid = 1;
|
||||
|
||||
// Skip payout if no bets were placed.
|
||||
if block.cumulative_sum == 0 || block.reward == 0 {
|
||||
|
||||
@@ -16,7 +16,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
||||
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.paid != 0)?;
|
||||
let mint = mint_info
|
||||
.has_address(&MINT_ADDRESS)?
|
||||
.is_writable()?
|
||||
@@ -46,7 +46,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
|
||||
block.current_round += 1;
|
||||
block.ends_at = clock.slot + 150; // 60 seconds
|
||||
block.noise = [0; 32];
|
||||
block.payed_out = 0;
|
||||
block.paid = 0;
|
||||
block.reward = net_emissions - boost_reward;
|
||||
block.started_at = clock.slot;
|
||||
block.total_wagers = 0;
|
||||
|
||||
Reference in New Issue
Block a user