use alloy::primitives::Address;
use nautilus_core::UnixNanos;
use nautilus_model::{
defi::{PoolIdentifier, SharedChain, SharedDex, data::PoolFeeCollect},
identifiers::InstrumentId,
};
#[derive(Debug, Clone)]
pub struct CollectEvent {
pub dex: SharedDex,
pub pool_identifier: PoolIdentifier,
pub block_number: u64,
pub transaction_hash: String,
pub transaction_index: u32,
pub log_index: u32,
pub owner: Address,
pub recipient: Address,
pub tick_lower: i32,
pub tick_upper: i32,
pub amount0: u128,
pub amount1: u128,
}
impl CollectEvent {
#[must_use]
#[allow(clippy::too_many_arguments)]
pub fn new(
dex: SharedDex,
pool_identifier: PoolIdentifier,
block_number: u64,
transaction_hash: String,
transaction_index: u32,
log_index: u32,
owner: Address,
recipient: Address,
tick_lower: i32,
tick_upper: i32,
amount0: u128,
amount1: u128,
) -> Self {
Self {
dex,
pool_identifier,
block_number,
transaction_hash,
transaction_index,
log_index,
owner,
recipient,
tick_lower,
tick_upper,
amount0,
amount1,
}
}
#[allow(clippy::too_many_arguments)]
pub fn to_pool_fee_collect(
&self,
chain: SharedChain,
dex: SharedDex,
instrument_id: InstrumentId,
timestamp: Option<UnixNanos>,
) -> PoolFeeCollect {
PoolFeeCollect::new(
chain,
dex,
instrument_id,
self.pool_identifier,
self.block_number,
self.transaction_hash.clone(),
self.transaction_index,
self.log_index,
self.owner,
self.amount0,
self.amount1,
self.tick_lower,
self.tick_upper,
timestamp,
)
}
}