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,
14 pub duration_seconds: u64,
16 pub start_gas: Dec,
18 #[serde(default)]
20 pub current_gas: Option<Dec>,
21 #[serde(default)]
23 pub end_gas: Option<Dec>,
24}
25
26impl GasAuction {
27 #[must_use]
29 pub const fn ends_at(&self) -> u64 {
30 self.start_time_seconds.saturating_add(self.duration_seconds)
31 }
32
33 #[must_use]
35 pub const fn is_running(&self, now_seconds: u64) -> bool {
36 now_seconds >= self.start_time_seconds && now_seconds < self.ends_at()
37 }
38}
39
40#[cfg(test)]
41#[path = "tests/auction.rs"]
42mod tests;