From 8f2173779b29126b39cb3f607021432a0799c00c Mon Sep 17 00:00:00 2001 From: Lucas Meier Date: Tue, 30 Jul 2024 11:18:18 -0700 Subject: [PATCH] events: record `EventPositionClose` when closing positions manually There are currently two ways for a position to get closed: 1. automatically by the DEX, for an auto-close position, 2. at the end of the block, after being *queued* for closure in the in the action handler. For 2., we weren't emitting the event. This commit changes things so that we do, in fact, emit the event in this case, for a position that has not yet been closed. --- crates/core/component/dex/src/component/position_manager.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/core/component/dex/src/component/position_manager.rs b/crates/core/component/dex/src/component/position_manager.rs index faff6f6275..0a1c9bcf29 100644 --- a/crates/core/component/dex/src/component/position_manager.rs +++ b/crates/core/component/dex/src/component/position_manager.rs @@ -205,6 +205,7 @@ pub trait PositionManager: StateWrite + PositionRead { self.update_position(id, Some(prev_state), new_state) .await?; + self.record_proto(event::position_close_by_id(*id)); Ok(()) }