use ethers_contract::EthEvent;
use ethers_core::types::{
H160,
H256,
};
use fuel_core_types::blockchain::primitives::DaBlockHeight;
use once_cell::sync::Lazy;
use std::{
str::FromStr,
time::Duration,
};
pub(crate) static ETH_LOG_MESSAGE: Lazy<H256> =
Lazy::new(crate::abi::bridge::message::SentMessageFilter::signature);
#[derive(Clone, Debug)]
pub struct Config {
pub da_deploy_height: DaBlockHeight,
pub da_finalization: DaBlockHeight,
pub eth_client: Option<url::Url>,
pub eth_v2_listening_contracts: Vec<H160>,
pub log_page_size: u64,
pub sync_minimum_duration: Duration,
pub syncing_call_frequency: Duration,
pub syncing_log_frequency: Duration,
pub metrics: bool,
}
#[allow(missing_docs)]
impl Config {
pub const DEFAULT_LOG_PAGE_SIZE: u64 = 5;
pub const DEFAULT_DA_FINALIZATION: u64 = 100;
pub const DEFAULT_DA_DEPLOY_HEIGHT: u64 = 0;
pub const DEFAULT_SYNC_MINIMUM_DURATION: Duration = Duration::from_secs(5);
pub const DEFAULT_SYNCING_CALL_FREQ: Duration = Duration::from_secs(5);
pub const DEFAULT_SYNCING_LOG_FREQ: Duration = Duration::from_secs(60);
}
impl Default for Config {
fn default() -> Self {
Self {
da_deploy_height: DaBlockHeight::from(Self::DEFAULT_DA_DEPLOY_HEIGHT),
da_finalization: DaBlockHeight::from(Self::DEFAULT_DA_FINALIZATION),
eth_client: None,
eth_v2_listening_contracts: vec![H160::from_str(
"0x03E4538018285e1c03CCce2F92C9538c87606911",
)
.unwrap()],
log_page_size: Self::DEFAULT_LOG_PAGE_SIZE,
sync_minimum_duration: Self::DEFAULT_SYNC_MINIMUM_DURATION,
syncing_call_frequency: Self::DEFAULT_SYNCING_CALL_FREQ,
syncing_log_frequency: Self::DEFAULT_SYNCING_LOG_FREQ,
metrics: false,
}
}
}