1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
use ethers_contract::EthEvent;
use ethers_core::types::{
H160,
H256,
};
use fuel_core_interfaces::model::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,
}
}
}