Skip to content

Commit eff0c94

Browse files
author
Erwan Or
authored
dex: track outflows in position manager (#5030)
## 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
1 parent 943a9a8 commit eff0c94

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

crates/core/component/dex/src/component/position_manager.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::component::{
1818
dex::StateReadExt as _,
1919
position_manager::{
2020
base_liquidity_index::AssetByLiquidityIndex, inventory_index::PositionByInventoryIndex,
21-
price_index::PositionByPriceIndex,
21+
price_index::PositionByPriceIndex, volume_tracker::PositionVolumeTracker,
2222
},
2323
};
2424
use crate::lp::Reserves;
@@ -518,6 +518,7 @@ trait Inner: StateWrite {
518518
self.update_trading_pair_position_counter(&prev_state, &new_state)
519519
.await?;
520520
self.update_position_by_price_index(&id, &prev_state, &new_state)?;
521+
self.update_volume_index(&id, &prev_state, &new_state).await;
521522

522523
self.put(state_key::position_by_id(&id), new_state.clone());
523524
Ok(new_state)

crates/core/component/dex/src/component/position_manager/volume_tracker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use penumbra_sdk_sct::component::clock::EpochRead;
1616

1717
#[async_trait]
1818
pub(crate) trait PositionVolumeTracker: StateWrite {
19-
async fn increase_volume_index(
19+
async fn update_volume_index(
2020
&mut self,
2121
position_id: &position::Id,
2222
prev_state: &Option<Position>,

0 commit comments

Comments
 (0)