multiversx_sc_scenario/scenario/model/transaction/
log_check.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::{
    scenario::model::{BytesValue, CheckValue, CheckValueList},
    scenario_format::{
        interpret_trait::{InterpretableFrom, InterpreterContext, IntoRaw},
        serde_raw::CheckLogRaw,
    },
};

#[derive(Debug, Clone)]
pub struct CheckLog {
    pub address: CheckValue<BytesValue>,
    pub endpoint: CheckValue<BytesValue>,
    pub topics: CheckValueList,
    pub data: CheckValueList,
}

impl InterpretableFrom<CheckLogRaw> for CheckLog {
    fn interpret_from(from: CheckLogRaw, context: &InterpreterContext) -> Self {
        CheckLog {
            address: CheckValue::<BytesValue>::interpret_from(from.address, context),
            endpoint: CheckValue::<BytesValue>::interpret_from(from.endpoint, context),
            topics: CheckValueList::interpret_from(from.topics, context),
            data: CheckValueList::interpret_from(from.data, context),
        }
    }
}

impl IntoRaw<CheckLogRaw> for CheckLog {
    fn into_raw(self) -> CheckLogRaw {
        CheckLogRaw {
            address: self.address.into_raw(),
            endpoint: self.endpoint.into_raw(),
            topics: self.topics.into_raw(),
            data: self.data.into_raw(),
        }
    }
}