Skip to content

Commit

Permalink
dex: track outflows in position manager (#5030)
Browse files Browse the repository at this point in the history
## Describe your changes

Close #5028.

## Checklist before requesting a review

- [x] I have added guiding text to explain how a reviewer should test
these changes.

- [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:

  > Consensus and state breaking
  • Loading branch information
erwanor authored and conorsch committed Jan 31, 2025
1 parent 61de222 commit 8b17428
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/core/component/dex/src/component/position_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::component::{
dex::StateReadExt as _,
position_manager::{
base_liquidity_index::AssetByLiquidityIndex, inventory_index::PositionByInventoryIndex,
price_index::PositionByPriceIndex,
price_index::PositionByPriceIndex, volume_tracker::PositionVolumeTracker,
},
};
use crate::lp::Reserves;
Expand Down Expand Up @@ -518,6 +518,7 @@ trait Inner: StateWrite {
self.update_trading_pair_position_counter(&prev_state, &new_state)
.await?;
self.update_position_by_price_index(&id, &prev_state, &new_state)?;
self.update_volume_index(&id, &prev_state, &new_state).await;

self.put(state_key::position_by_id(&id), new_state.clone());
Ok(new_state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use penumbra_sdk_sct::component::clock::EpochRead;

#[async_trait]
pub(crate) trait PositionVolumeTracker: StateWrite {
async fn increase_volume_index(
async fn update_volume_index(
&mut self,
position_id: &position::Id,
prev_state: &Option<Position>,
Expand Down

0 comments on commit 8b17428

Please sign in to comment.