loom_strategy_backrun/
backrun_config.rs

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
use alloy_primitives::Address;
use loom_types_entities::config::StrategyConfig;
use serde::Deserialize;

#[derive(Clone, Deserialize, Debug)]
pub struct BackrunConfigSection {
    pub backrun_strategy: BackrunConfig,
}

#[derive(Clone, Deserialize, Debug)]
pub struct BackrunConfig {
    eoa: Option<Address>,
    smart: bool,
}

impl StrategyConfig for BackrunConfig {
    fn eoa(&self) -> Option<Address> {
        self.eoa
    }
}

impl BackrunConfig {
    pub fn smart(&self) -> bool {
        self.smart
    }

    pub fn new_dumb() -> Self {
        Self { eoa: None, smart: false }
    }
}

impl Default for BackrunConfig {
    fn default() -> Self {
        Self { eoa: None, smart: true }
    }
}