Skip to content

Commit

Permalink
add bet event
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoober committed Jul 9, 2024
1 parent 0242954 commit 092f213
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions programs/over_under/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ pub mod over_under {
pub fn place_bet(ctx: Context<BetC>, amount: u64, bet: u8, round: u64) -> Result<()> {
ctx.accounts.init(amount, bet, round, &ctx.bumps)?;
ctx.accounts.deposit(amount)?;

emit!(BetEvent {
address: ctx.accounts.player.key(),
bet: ctx.accounts.bet.bet,
amount: ctx.accounts.bet.amount
});
Ok(())
}

Expand Down Expand Up @@ -168,3 +174,10 @@ pub mod over_under {
Ok(())
}
}

#[event]
pub struct BetEvent {
pub address: Pubkey,
pub bet: u8,
pub amount: u64,
}

0 comments on commit 092f213

Please sign in to comment.