Skip to content

Commit

Permalink
dex: track outflows in position manager
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Jan 30, 2025
1 parent 943a9a8 commit c111dd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 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,8 @@ 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 c111dd3

Please sign in to comment.