This commit is contained in:
Hardhat Chad
2025-05-23 19:14:33 -07:00
parent 87c67f1ccb
commit 1ab3b1f73c
4 changed files with 45 additions and 5 deletions

View File

@@ -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);

View File

@@ -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(())
}

View File

@@ -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(())
}

View File

@@ -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(())
}