From e80dc5c867501c47a8c22832d4bba7dd52f0f931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=BAc=C3=A1s=20Meier?= Date: Tue, 30 Jul 2024 21:18:11 -0700 Subject: [PATCH] events: record `EventPositionClose` when closing positions manually (#4779) 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. ## Checklist before requesting a review - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: > Only adds new events. (cherry picked from commit 6981aec13519d352be642f690350b5227657de4f) --- 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(()) }