op_alloy_genesis/
params.rsuse alloy_eips::eip1559::BaseFeeParams;
pub const OP_MAINNET_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR: u128 = 50;
pub const OP_MAINNET_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON: u128 = 250;
pub const OP_MAINNET_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER: u128 = 6;
pub const OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR: u128 = 50;
pub const OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON: u128 = 250;
pub const OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER: u128 = 6;
pub const BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER: u128 = 10;
pub const OP_SEPOLIA_BASE_FEE_PARAMS: OpBaseFeeParams = OpBaseFeeParams {
eip1559_elasticity: OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER,
eip1559_denominator: OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR,
eip1559_denominator_canyon: OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON,
};
pub const BASE_SEPOLIA_BASE_FEE_PARAMS: OpBaseFeeParams = OpBaseFeeParams {
eip1559_elasticity: BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER,
eip1559_denominator: OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR,
eip1559_denominator_canyon: OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON,
};
pub const OP_MAINNET_BASE_FEE_PARAMS: OpBaseFeeParams = OpBaseFeeParams {
eip1559_elasticity: OP_MAINNET_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER,
eip1559_denominator: OP_MAINNET_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR,
eip1559_denominator_canyon: OP_MAINNET_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON,
};
pub const fn base_fee_params(chain_id: u64) -> OpBaseFeeParams {
match chain_id {
10 => OP_MAINNET_BASE_FEE_PARAMS,
11155420 => OP_SEPOLIA_BASE_FEE_PARAMS,
8453 => OP_MAINNET_BASE_FEE_PARAMS,
84532 => BASE_SEPOLIA_BASE_FEE_PARAMS,
_ => OP_MAINNET_BASE_FEE_PARAMS,
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct OpBaseFeeParams {
#[cfg_attr(
feature = "serde",
serde(rename = "eip1559Elasticity", alias = "eip1559_elasticity")
)]
pub eip1559_elasticity: u128,
#[cfg_attr(
feature = "serde",
serde(rename = "eip1559Denominator", alias = "eip1559_denominator")
)]
pub eip1559_denominator: u128,
#[cfg_attr(
feature = "serde",
serde(rename = "eip1559DenominatorCanyon", alias = "eip1559_denominator_canyon")
)]
pub eip1559_denominator_canyon: u128,
}
impl OpBaseFeeParams {
pub const fn as_base_fee_params(&self) -> BaseFeeParams {
BaseFeeParams {
max_change_denominator: self.eip1559_denominator,
elasticity_multiplier: self.eip1559_elasticity,
}
}
pub const fn as_canyon_base_fee_params(&self) -> BaseFeeParams {
BaseFeeParams {
max_change_denominator: self.eip1559_denominator_canyon,
elasticity_multiplier: self.eip1559_elasticity,
}
}
}