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")]
11#[non_exhaustive]
12pub struct GasAuction {
13 pub start_time_seconds: u64,
15 pub duration_seconds: u64,
17 pub start_gas: Dec,
19 #[serde(default)]
21 pub current_gas: Option<Dec>,
22 #[serde(default)]
24 pub end_gas: Option<Dec>,
25}
26
27impl GasAuction {
28 #[must_use]
30 pub const fn ends_at(&self) -> u64 {
31 self.start_time_seconds.saturating_add(self.duration_seconds)
32 }
33
34 #[must_use]
36 pub const fn is_running(&self, now_seconds: u64) -> bool {
37 now_seconds >= self.start_time_seconds && now_seconds < self.ends_at()
38 }
39}
40
41#[cfg(test)]
42#[path = "tests/auction.rs"]
43mod tests;