-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dex(volume_tracker): stub out cumvol tracking
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
crates/core/component/dex/src/component/position_manager/volume_tracker.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use anyhow::Result; | ||
use cnidarium::StateWrite; | ||
use penumbra_sdk_num::Amount; | ||
use position::State::*; | ||
use tracing::instrument; | ||
|
||
use crate::lp::position::{self, Position}; | ||
use crate::state_key::engine; | ||
use crate::DirectedTradingPair; | ||
use async_trait::async_trait; | ||
use penumbra_sdk_proto::{StateReadProto, StateWriteProto}; | ||
|
||
#[async_trait] | ||
pub(crate) trait PositionVolumeTracker: StateWrite { | ||
async fn increase_volume_index( | ||
&mut self, | ||
id: &position::Id, | ||
prev_state: &Option<Position>, | ||
new_state: &Position, | ||
) -> Result<()> { | ||
unimplemented!("increase_volume_index") | ||
} | ||
} | ||
|
||
impl<T: StateWrite + ?Sized> PositionVolumeTracker for T {} | ||
|
||
trait Inner: StateWrite { | ||
#[instrument(skip(self))] | ||
async fn update_volume( | ||
&mut self, | ||
id: &position::Id, | ||
pair: DirectedTradingPair, | ||
old_volume: Amount, | ||
new_volume: Amount, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl<T: StateWrite + ?Sized> Inner for T {} |