Skip to content

Commit

Permalink
slashing updates
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay111meher committed Nov 1, 2024
1 parent 9e64219 commit d20a69a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions matching_engine/src/generator_lib/generator_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub struct GeneratorStore {
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd)]
pub struct SlashingRecord {
pub ask_id: U256,
pub slashing_timestamp: U64,
pub market_id: U256,
pub slashing_tx: String,
pub price_offered: U256,
Expand Down Expand Up @@ -482,6 +483,7 @@ impl GeneratorStore {
slashing_tx: String,
price_offered: &U256,
deadline: &U256,
slashing_timestamp: &U64,
) {
if let Some(generator_market) = self
.generator_markets
Expand Down Expand Up @@ -521,6 +523,7 @@ impl GeneratorStore {
price_offered: price_offered.clone(),
expected_time: deadline.clone(),
slashing_penalty: (token_address.clone(), slashing.clone()),
slashing_timestamp: slashing_timestamp.clone(),
});
}

Expand Down
1 change: 1 addition & 0 deletions matching_engine/src/log_processor/pm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ pub async fn process_proof_market_place_logs(
tx_to_string(&log.transaction_hash.unwrap()),
&ask.reward,
&ask.deadline,
&log.block_number.unwrap_or_default(),
);
}
}
Expand Down
4 changes: 1 addition & 3 deletions matching_engine/src/routes/ui_routes/single_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ struct Slash {
market: MarketInfo,
request: String, // Transaction Hash
price_offered: String,
expected_time: String,
slashing_penalty: TokenAmount,
}

Expand Down Expand Up @@ -432,7 +431,7 @@ async fn recompute_single_generator_response<'a>(
.get_slashing_records(&generator_id)
.into_iter()
.map(|record| Slash {
timestamp: record.expected_time.to_string(),
timestamp: record.slashing_timestamp.to_string(),
market: MarketInfo {
name: None,
id: record.market_id.to_string(),
Expand All @@ -443,7 +442,6 @@ async fn recompute_single_generator_response<'a>(
},
request: record.slashing_tx,
price_offered: record.price_offered.to_string(),
expected_time: record.expected_time.to_string(),
slashing_penalty: address_token_pair_to_token_amount(record.slashing_penalty),
})
.collect(),
Expand Down

0 comments on commit d20a69a

Please sign in to comment.