orca_tx_sender/
fee_config.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum Percentile {
3    P25,
4    P50,
5    P75,
6    P95,
7    P99,
8}
9
10impl Percentile {
11    pub fn as_value(&self) -> u8 {
12        match self {
13            Self::P25 => 25,
14            Self::P50 => 50,
15            Self::P75 => 75,
16            Self::P95 => 95,
17            Self::P99 => 99,
18        }
19    }
20}
21
22#[derive(Debug, Clone, Copy, PartialEq, Eq)]
23pub enum JitoPercentile {
24    P25,
25    P50,
26    P50Ema, // 50th percentile exponential moving average
27    P75,
28    P95,
29    P99,
30}
31
32#[derive(Debug, Clone, PartialEq)]
33pub enum PriorityFeeStrategy {
34    Dynamic {
35        percentile: Percentile,
36        max_lamports: u64,
37    },
38    Exact(u64),
39    Disabled,
40}
41
42#[derive(Debug, Clone, PartialEq)]
43pub enum JitoFeeStrategy {
44    Dynamic {
45        percentile: JitoPercentile,
46        max_lamports: u64,
47    },
48    Exact(u64),
49    Disabled,
50}
51
52#[derive(Debug, Clone, PartialEq)]
53pub struct FeeConfig {
54    pub priority_fee: PriorityFeeStrategy,
55    pub jito: JitoFeeStrategy,
56    pub compute_unit_margin_multiplier: f64,
57    pub jito_block_engine_url: String,
58}
59
60impl Default for FeeConfig {
61    fn default() -> Self {
62        Self {
63            priority_fee: PriorityFeeStrategy::Disabled,
64            jito: JitoFeeStrategy::Disabled,
65            compute_unit_margin_multiplier: 1.1,
66            jito_block_engine_url: "https://bundles.jito.wtf".to_string(),
67        }
68    }
69}