1use std::time::{SystemTime, UNIX_EPOCH};
3
4use crate::{
5 ARBITRUM_ONE_CHAIN_ID,
6 ARBITRUM_SEPOLIA_CHAIN_ID,
7 BASE_MAINNET_CHAIN_ID,
8 BASE_SEPOLIA_CHAIN_ID,
9 ETHEREUM_SEPOLIA_CHAIN_ID,
11};
12
13pub fn get_current_time_millis() -> u64 {
19 SystemTime::now().duration_since(UNIX_EPOCH).expect("negative timestamp").as_millis() as u64
20}
21
22pub fn get_env_agnostic_chain(chain_id: u64) -> String {
24 match chain_id {
25 ARBITRUM_ONE_CHAIN_ID | ARBITRUM_SEPOLIA_CHAIN_ID => "arbitrum".to_string(),
26 BASE_MAINNET_CHAIN_ID | BASE_SEPOLIA_CHAIN_ID => "base".to_string(),
27 ETHEREUM_SEPOLIA_CHAIN_ID => "ethereum".to_string(),
29 _ => panic!("Unsupported chain ID: {chain_id}"),
30 }
31}