Skip to content

Commit

Permalink
events: record EventPositionClose when closing positions manually (#…
Browse files Browse the repository at this point in the history
…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 6981aec)
  • Loading branch information
cronokirby authored and conorsch committed Aug 28, 2024
1 parent 5115818 commit d8cbea1
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down

0 comments on commit d8cbea1

Please sign in to comment.