nautilus_blockchain/events/
mint.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2025 Posei Systems Pty Ltd. All rights reserved.
3//  https://poseitrader.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16use alloy::primitives::{Address, U256};
17
18/// Represents a mint event that occurs when liquidity is added to a position in a liquidity pool.
19#[derive(Debug, Clone)]
20pub struct MintEvent {
21    /// The block number when the mint occurred.
22    pub block_number: u64,
23    /// The unique hash identifier of the transaction containing this event.
24    pub transaction_hash: String,
25    /// The position of this transaction within the block.
26    pub transaction_index: u32,
27    /// The position of this event log within the transaction.
28    pub log_index: u32,
29    /// The address that sent the transaction.
30    pub sender: Address,
31    /// The owner of the position.
32    pub owner: Address,
33    /// The lower tick boundary of the position.
34    pub tick_lower: i32,
35    /// The upper tick boundary of the position.
36    pub tick_upper: i32,
37    /// The amount of liquidity minted.
38    pub amount: u128,
39    /// The amount of token0 deposited.
40    pub amount0: U256,
41    /// The amount of token1 deposited.
42    pub amount1: U256,
43}
44
45impl MintEvent {
46    /// Creates a new [`MintEvent`] instance with the specified parameters.
47    #[must_use]
48    #[allow(clippy::too_many_arguments)]
49    pub const fn new(
50        block_number: u64,
51        transaction_hash: String,
52        transaction_index: u32,
53        log_index: u32,
54        sender: Address,
55        owner: Address,
56        tick_lower: i32,
57        tick_upper: i32,
58        amount: u128,
59        amount0: U256,
60        amount1: U256,
61    ) -> Self {
62        Self {
63            block_number,
64            transaction_hash,
65            transaction_index,
66            log_index,
67            sender,
68            owner,
69            tick_lower,
70            tick_upper,
71            amount,
72            amount0,
73            amount1,
74        }
75    }
76}