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
use crate::executive_observer::ExecutiveObserver;

/// Transaction execution options.
pub struct TransactOptions<O: ExecutiveObserver> {
    pub observer: O,
    pub settings: TransactSettings,
}

impl Default for TransactOptions<()> {
    fn default() -> Self {
        Self {
            observer: (),
            settings: TransactSettings::all_checks(),
        }
    }
}

#[derive(Debug, Clone, Copy)]
pub struct TransactSettings {
    pub charge_collateral: ChargeCollateral,
    pub charge_gas: bool,
    pub check_base_price: bool,
    pub check_epoch_bound: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum ChargeCollateral {
    Normal,
    EstimateSender,
    EstimateSponsor,
}

impl TransactSettings {
    pub fn all_checks() -> Self {
        Self {
            charge_collateral: ChargeCollateral::Normal,
            charge_gas: true,
            check_epoch_bound: true,
            check_base_price: true,
        }
    }
}