multiversx_sc_meta_lib/tools/wasm_extractor/
report.rs

1use std::collections::{BTreeMap, BTreeSet};
2
3use super::{code_report::CodeReport, EndpointName};
4
5#[derive(Default, PartialEq, Eq, Debug, Clone)]
6pub struct WasmReport {
7    pub imports: Vec<String>,
8    pub memory_grow_flag: bool,
9    pub ei_check: bool,
10    pub code: CodeReport,
11    pub forbidden_opcodes: BTreeMap<EndpointName, BTreeSet<String>>,
12}
13
14impl WasmReport {
15    pub fn add_forbidden_opcode_accessible_from_endpoint(
16        &mut self,
17        endpoint_name: EndpointName,
18        opcode_name: String,
19    ) {
20        self.forbidden_opcodes
21            .entry(endpoint_name)
22            .or_default()
23            .insert(opcode_name);
24    }
25}