diff --git a/api/src/event.rs b/api/src/event.rs index dd527cf..896872c 100644 --- a/api/src/event.rs +++ b/api/src/event.rs @@ -2,11 +2,27 @@ use steel::*; #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] -pub struct BlockEvent { - pub score: u64, - pub block_reward: u64, - pub boost_reward: u64, +pub struct PayoutEvent { + pub authority: Pubkey, + pub amount: u64, pub ts: u64, } -event!(BlockEvent); +#[repr(C)] +#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] +pub struct BetEvent { + pub authority: Pubkey, + pub amount: u64, + pub ts: u64, +} + +#[repr(C)] +#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] +pub struct BuryEvent { + pub amount: u64, + pub ts: u64, +} + +event!(PayoutEvent); +event!(BetEvent); +event!(BuryEvent); diff --git a/program/src/bet.rs b/program/src/bet.rs index 0a21ab8..2490712 100644 --- a/program/src/bet.rs +++ b/program/src/bet.rs @@ -67,5 +67,13 @@ pub fn process_bet(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult { amount, )?; + // Emit an event. + BetEvent { + authority: *signer_info.key, + amount, + ts: clock.unix_timestamp as u64, + } + .log(); + Ok(()) } diff --git a/program/src/bury.rs b/program/src/bury.rs index 4684092..7c7ef65 100644 --- a/program/src/bury.rs +++ b/program/src/bury.rs @@ -5,6 +5,7 @@ use steel::*; /// Swaps bets into ORE and buries the ORE. pub fn process_bury(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult { // Load accounts. + let clock = Clock::get()?; let (required_accounts, meteora_accounts) = accounts.split_at(5); let [signer_info, block_info, block_bets_info, block_ore_info, bet_mint_info, ore_mint_info] = required_accounts @@ -67,5 +68,12 @@ pub fn process_bury(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult block_bump, )?; + // Emit an event. + BuryEvent { + amount: block_ore.amount(), + ts: clock.unix_timestamp as u64, + } + .log(); + Ok(()) } diff --git a/program/src/payout.rs b/program/src/payout.rs index fb24c3e..19767dc 100644 --- a/program/src/payout.rs +++ b/program/src/payout.rs @@ -63,5 +63,13 @@ pub fn process_payout(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResu &[TREASURY], )?; + // Emit an event. + PayoutEvent { + authority: wager.authority, + amount: block.reward, + ts: clock.unix_timestamp as u64, + } + .log(); + Ok(()) }