cfx_executor/executive/
transact_options.rs

1use crate::executive_observer::ExecutiveObserver;
2
3/// Transaction execution options.
4pub struct TransactOptions<O: ExecutiveObserver> {
5    pub observer: O,
6    pub settings: TransactSettings,
7}
8
9impl Default for TransactOptions<()> {
10    fn default() -> Self {
11        Self {
12            observer: (),
13            settings: TransactSettings::all_checks(),
14        }
15    }
16}
17
18#[derive(Debug, Clone, Copy)]
19pub struct TransactSettings {
20    pub charge_collateral: ChargeCollateral,
21    pub charge_gas: bool,
22    pub check_base_price: bool,
23    pub check_epoch_bound: bool,
24    pub forbid_eoa_with_code: bool,
25}
26
27#[derive(Debug, Clone, Copy)]
28pub enum ChargeCollateral {
29    Normal,
30    EstimateSender,
31    EstimateSponsor,
32}
33
34impl TransactSettings {
35    pub fn all_checks() -> Self {
36        Self {
37            charge_collateral: ChargeCollateral::Normal,
38            charge_gas: true,
39            check_epoch_bound: true,
40            check_base_price: true,
41            forbid_eoa_with_code: true,
42        }
43    }
44}