This commit is contained in:
Hardhat Chad
2025-09-17 10:14:05 -07:00
parent 4cee87860f
commit 959fd70c44
37 changed files with 1089 additions and 2947 deletions

View File

@@ -1,10 +1,7 @@
use steel::*;
use crate::state::SwapDirection;
pub enum OreEvent {
Reset = 0,
Swap = 1,
Mine = 2,
}
@@ -30,58 +27,6 @@ pub struct ResetEvent {
pub ts: i64,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct SwapEvent {
/// The event discriminator.
pub disc: u64,
/// The authority of the swap.
pub authority: Pubkey,
/// The block id.
pub block_id: u64,
/// Swap direction.
pub direction: u64,
/// Amount of base tokens to transfer.
pub base_to_transfer: u64,
/// Amount of quote tokens to transfer.
pub quote_to_transfer: u64,
/// Amount of base tokens swapped via virtual limit order.
pub base_via_order: u64,
/// Amount of quote tokens swapped via virtual limit order.
pub quote_via_order: u64,
/// Amount of base tokens swapped via curve.
pub base_via_curve: u64,
/// Amount of quote tokens swapped via curve.
pub quote_via_curve: u64,
/// Amount of quote tokens taken in fees.
pub quote_fee: u64,
/// Amount of base tokens in the market.
pub base_liquidity: u64,
/// Amount of quote tokens in the market.
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.
pub ts: i64,
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct MineEvent {
@@ -107,12 +52,5 @@ pub struct MineEvent {
pub ts: i64,
}
impl SwapEvent {
pub fn direction(&self) -> SwapDirection {
SwapDirection::try_from(self.direction as u8).unwrap()
}
}
event!(ResetEvent);
event!(SwapEvent);
event!(MineEvent);