alloy_eip7928/
code_change.rs1use crate::BlockAccessIndex;
4use alloy_primitives::Bytes;
5
6#[derive(Debug, Clone, Default, PartialEq, Eq)]
8#[cfg_attr(feature = "rlp", derive(alloy_rlp::RlpEncodable, alloy_rlp::RlpDecodable))]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
11#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
12#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
13pub struct CodeChange {
14 #[cfg_attr(feature = "serde", serde(alias = "txIndex", with = "crate::quantity"))]
16 pub block_access_index: BlockAccessIndex,
17 pub new_code: Bytes,
19}
20impl CodeChange {
21 pub const fn new(block_access_index: BlockAccessIndex, new_code: Bytes) -> Self {
23 Self { block_access_index, new_code }
24 }
25
26 #[inline]
28 pub const fn block_access_index(&self) -> BlockAccessIndex {
29 self.block_access_index
30 }
31
32 #[inline]
34 pub const fn new_code(&self) -> &Bytes {
35 &self.new_code
36 }
37}