-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autopilot refactor 2/3: Build Observation object (#2835)
# Description Ports building observation data which is supposed to be saved to the database. Equivalent to: https://github.com/cowprotocol/services/blob/main/crates/autopilot/src/on_settlement_event_updater.rs#L243-L260 ## How to test Added Observation object printing to `OnSettlementEventUpdater`
- Loading branch information
Showing
6 changed files
with
125 additions
and
18 deletions.
There are no files selected for viewing
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
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
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,25 @@ | ||
//! Aggregated type containing all important information about the mined | ||
//! settlement, including the surplus and fees. | ||
//! | ||
//! Observation is a snapshot of the settlement state, which purpose is to save | ||
//! the state of the settlement to the persistence layer. | ||
|
||
use { | ||
crate::domain::{self, eth}, | ||
std::collections::HashMap, | ||
}; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct Observation { | ||
/// The gas used by the settlement. | ||
pub gas: eth::Gas, | ||
/// The effective gas price at the time of settlement. | ||
pub gas_price: eth::EffectiveGasPrice, | ||
/// Total surplus expressed in native token. | ||
pub surplus: eth::Ether, | ||
/// Total fee expressed in native token. | ||
pub fee: eth::Ether, | ||
/// Per order fees denominated in sell token. Contains all orders from the | ||
/// settlement | ||
pub order_fees: HashMap<domain::OrderUid, Option<eth::SellTokenAmount>>, | ||
} |
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
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
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