This commit is contained in:
Hardhat Chad
2025-07-18 13:32:21 -07:00
parent cdb3963662
commit e1fb3fcaf3
6 changed files with 18 additions and 0 deletions

View File

@@ -71,6 +71,12 @@ pub struct SwapEvent {
/// Amount of quote tokens in the market. /// Amount of quote tokens in the market.
pub quote_liquidity: u64, pub quote_liquidity: u64,
/// Amount of hashpower the miner now has.
pub miner_hashpower: u64,
/// Amount of hashpower the block now has.
pub block_hashpower: u64,
/// The timestamp of the event. /// The timestamp of the event.
pub ts: i64, pub ts: i64,
} }

View File

@@ -67,6 +67,8 @@ impl Market {
quote_fee: quote_fee as u64, quote_fee: quote_fee as u64,
base_liquidity: self.base.liquidity() as u64, base_liquidity: self.base.liquidity() as u64,
quote_liquidity: self.quote.liquidity() as u64, quote_liquidity: self.quote.liquidity() as u64,
miner_hashpower: 0,
block_hashpower: 0,
ts: 0, ts: 0,
}; };

View File

@@ -72,6 +72,8 @@ impl Market {
quote_fee: quote_fee as u64, quote_fee: quote_fee as u64,
base_liquidity: self.base.liquidity() as u64, base_liquidity: self.base.liquidity() as u64,
quote_liquidity: self.quote.liquidity() as u64, quote_liquidity: self.quote.liquidity() as u64,
miner_hashpower: 0,
block_hashpower: 0,
ts: 0, ts: 0,
}; };

View File

@@ -76,6 +76,8 @@ impl Market {
quote_fee: quote_fee as u64, quote_fee: quote_fee as u64,
base_liquidity: self.base.liquidity() as u64, base_liquidity: self.base.liquidity() as u64,
quote_liquidity: self.quote.liquidity() as u64, quote_liquidity: self.quote.liquidity() as u64,
miner_hashpower: 0,
block_hashpower: 0,
ts: 0, ts: 0,
}; };

View File

@@ -74,6 +74,8 @@ impl Market {
quote_fee: quote_fee as u64, quote_fee: quote_fee as u64,
base_liquidity: self.base.liquidity() as u64, base_liquidity: self.base.liquidity() as u64,
quote_liquidity: self.quote.liquidity() as u64, quote_liquidity: self.quote.liquidity() as u64,
miner_hashpower: 0,
block_hashpower: 0,
ts: 0, ts: 0,
}; };

View File

@@ -122,6 +122,10 @@ pub fn process_swap(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
let vault = vault_info.as_token_account()?; let vault = vault_info.as_token_account()?;
market.check_quote_vault(&vault)?; market.check_quote_vault(&vault)?;
// Update swap event hashpower.
swap_event.miner_hashpower = miner.hashpower;
swap_event.block_hashpower = block.total_hashpower;
// Emit event. // Emit event.
program_log( program_log(
&[market_info.clone(), ore_program.clone()], &[market_info.clone(), ore_program.clone()],