forest/lotus_json/
bytecode_hash.rs

1// Copyright 2019-2025 ChainSafe Systems
2// SPDX-License-Identifier: Apache-2.0, MIT
3
4use super::*;
5use pastey::paste;
6
7#[derive(Debug, Serialize, Deserialize, JsonSchema)]
8#[serde(rename_all = "PascalCase")]
9#[schemars(rename = "BytecodeHash")]
10pub struct BytecodeHashLotusJson([u8; 32]);
11
12macro_rules! impl_bytecode_hash_lotus_json {
13    ($($version:literal),+) => {
14        $(
15        paste! {
16            impl HasLotusJson for fil_actor_evm_state::[<v $version>]::BytecodeHash {
17                type LotusJson = BytecodeHashLotusJson;
18
19                #[cfg(test)]
20                fn snapshots() -> Vec<(serde_json::Value, Self)> {
21                    vec![]
22                }
23
24                fn into_lotus_json(self) -> Self::LotusJson {
25                    BytecodeHashLotusJson(self.into())
26                }
27
28                fn from_lotus_json(lotus_json: Self::LotusJson) -> Self {
29                    Self::from(lotus_json.0)
30                }
31            }
32        }
33        )+
34    };
35}
36
37impl_bytecode_hash_lotus_json!(10, 11, 12, 13, 14, 15, 16, 17);