op_alloy_consensus/hardforks/
fjord.rsuse crate::{OpTxEnvelope, TxDeposit};
use alloc::{string::String, vec, vec::Vec};
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{address, Address, Bytes, TxKind, U256};
use spin::Lazy;
use crate::UpgradeDepositSource;
pub const L1_INFO_DEPOSITER_ADDRESS: Address = address!("deaddeaddeaddeaddeaddeaddeaddeaddead0001");
pub const GAS_PRICE_ORACLE_FJORD_DEPLOYER_ADDRESS: Address =
address!("4210000000000000000000000000000000000002");
pub const GAS_PRICE_ORACLE_ADDRESS: Address = address!("b528d11cc114e026f138fe568744c6d45ce6da7a");
static DEPLOY_FJORD_GAS_PRICE_ORACLE_SOURCE: Lazy<UpgradeDepositSource> = Lazy::new(|| {
UpgradeDepositSource { intent: String::from("Fjord: Gas Price Oracle Deployment") }
});
static UPDATE_FJORD_GAS_PRICE_ORACLE_SOURCE: Lazy<UpgradeDepositSource> = Lazy::new(|| {
UpgradeDepositSource { intent: String::from("Fjord: Gas Price Oracle Proxy Update") }
});
pub const FJORD_GAS_PRICE_ORACLE_ADDRESS: Address =
address!("a919894851548179a0750865e7974da599c0fac7");
static ENABLE_FJORD_SOURCE: Lazy<UpgradeDepositSource> = Lazy::new(|| UpgradeDepositSource {
intent: String::from("Fjord: Gas Price Oracle Set Fjord"),
});
pub const ENABLE_FJORD_FUNC_SIGNATURE: &str = "setFjord()";
pub const SET_FJORD_METHOD_SIGNATURE: &[u8] = &[0x8e, 0x98, 0xb1, 0x06];
impl super::Hardforks {
pub(crate) fn gas_price_oracle_deployment_bytecode() -> alloy_primitives::Bytes {
include_bytes!("./gas_price_oracle_bytecode.hex").into()
}
pub fn fjord_txs() -> Vec<Bytes> {
let mut txs = vec![];
let mut buffer = Vec::new();
OpTxEnvelope::Deposit(TxDeposit {
source_hash: DEPLOY_FJORD_GAS_PRICE_ORACLE_SOURCE.source_hash(),
from: GAS_PRICE_ORACLE_FJORD_DEPLOYER_ADDRESS,
to: TxKind::Create,
mint: 0.into(),
value: U256::ZERO,
gas_limit: 1_450_000,
is_system_transaction: false,
input: Self::gas_price_oracle_deployment_bytecode(),
})
.encode_2718(&mut buffer);
txs.push(Bytes::from(buffer));
buffer = Vec::new();
OpTxEnvelope::Deposit(TxDeposit {
source_hash: UPDATE_FJORD_GAS_PRICE_ORACLE_SOURCE.source_hash(),
from: Address::ZERO,
to: TxKind::Call(GAS_PRICE_ORACLE_ADDRESS),
mint: 0.into(),
value: U256::ZERO,
gas_limit: 50_000,
is_system_transaction: false,
input: Self::upgrade_to_calldata(FJORD_GAS_PRICE_ORACLE_ADDRESS),
})
.encode_2718(&mut buffer);
txs.push(Bytes::from(buffer));
buffer = Vec::new();
OpTxEnvelope::Deposit(TxDeposit {
source_hash: ENABLE_FJORD_SOURCE.source_hash(),
from: L1_INFO_DEPOSITER_ADDRESS,
to: TxKind::Call(GAS_PRICE_ORACLE_ADDRESS),
mint: 0.into(),
value: U256::ZERO,
gas_limit: 90_000,
is_system_transaction: false,
input: SET_FJORD_METHOD_SIGNATURE.into(),
})
.encode_2718(&mut buffer);
txs.push(Bytes::from(buffer));
txs
}
}