nautilus_blockchain/events/
burn.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 burn event that occurs when liquidity is removed from a position in a liquidity pool.
19#[derive(Debug, Clone)]
20pub struct BurnEvent {
21    /// The block number when the burn 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 owner of the position.
30    pub owner: Address,
31    /// The lower tick boundary of the position.
32    pub tick_lower: i32,
33    /// The upper tick boundary of the position.
34    pub tick_upper: i32,
35    /// The amount of liquidity burned to the position range.
36    pub amount: u128,
37    /// The amount of token0 withdrawn.
38    pub amount0: U256,
39    /// The amount of token1 withdrawn.
40    pub amount1: U256,
41}
42
43impl BurnEvent {
44    /// Creates a new [`BurnEvent`] instance with the specified parameters.
45    #[must_use]
46    #[allow(clippy::too_many_arguments)]
47    pub const fn new(
48        block_number: u64,
49        transaction_hash: String,
50        transaction_index: u32,
51        log_index: u32,
52        owner: Address,
53        tick_lower: i32,
54        tick_upper: i32,
55        amount: u128,
56        amount0: U256,
57        amount1: U256,
58    ) -> Self {
59        Self {
60            block_number,
61            transaction_hash,
62            transaction_index,
63            log_index,
64            owner,
65            tick_lower,
66            tick_upper,
67            amount,
68            amount0,
69            amount1,
70        }
71    }
72}