df_hyperliquid_core/deploy/
auction.rs1use serde::Deserialize;
5
6use crate::utils::dec::Dec;
7
8#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
10#[serde(rename_all = "camelCase")]
11pub struct GasAuction {
12 pub start_time_seconds: u64,
13 pub duration_seconds: u64,
14 pub start_gas: Dec,
16 #[serde(default)]
18 pub current_gas: Option<Dec>,
19 #[serde(default)]
21 pub end_gas: Option<Dec>,
22}
23
24impl GasAuction {
25 #[must_use]
27 pub const fn ends_at(&self) -> u64 {
28 self.start_time_seconds.saturating_add(self.duration_seconds)
29 }
30
31 #[must_use]
33 pub const fn is_running(&self, now_seconds: u64) -> bool {
34 now_seconds >= self.start_time_seconds && now_seconds < self.ends_at()
35 }
36}
37
38#[cfg(test)]
39#[path = "tests/auction.rs"]
40mod tests;