alloy_node_bindings/
lib.rs

1#![doc = include_str!("../README.md")]
2#![doc(
3    html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
4    html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
5)]
6#![cfg_attr(not(test), warn(unused_crate_dependencies))]
7#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
8
9#[macro_use]
10extern crate tracing;
11
12use alloy_primitives::U256;
13
14pub mod nodes;
15pub use nodes::{
16    anvil::{self, Anvil, AnvilInstance},
17    geth::{self, Geth, GethInstance},
18    reth::{self, Reth, RethInstance},
19};
20
21mod node;
22pub use node::*;
23
24pub mod utils;
25
26/// 1 Ether = 1e18 Wei == 0x0de0b6b3a7640000 Wei
27pub const WEI_IN_ETHER: U256 = U256::from_limbs([0x0de0b6b3a7640000, 0x0, 0x0, 0x0]);
28
29/// The number of blocks from the past for which the fee rewards are fetched for fee estimation.
30pub const EIP1559_FEE_ESTIMATION_PAST_BLOCKS: u64 = 10;
31
32/// The default percentile of gas premiums that are fetched for fee estimation.
33pub const EIP1559_FEE_ESTIMATION_REWARD_PERCENTILE: f64 = 5.0;
34
35/// The default max priority fee per gas, used in case the base fee is within a threshold.
36pub const EIP1559_FEE_ESTIMATION_DEFAULT_PRIORITY_FEE: u64 = 3_000_000_000;
37
38/// The threshold for base fee below which we use the default priority fee, and beyond which we
39/// estimate an appropriate value for priority fee.
40pub const EIP1559_FEE_ESTIMATION_PRIORITY_FEE_TRIGGER: u64 = 100_000_000_000;
41
42/// The threshold max change/difference (in %) at which we will ignore the fee history values
43/// under it.
44pub const EIP1559_FEE_ESTIMATION_THRESHOLD_MAX_CHANGE: i64 = 200;