multiversx_sc_scenario/scenario/model/
new_address.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
use crate::scenario_format::{
    interpret_trait::{InterpretableFrom, InterpreterContext, IntoRaw},
    serde_raw::NewAddressRaw,
};

use super::{AddressValue, U64Value};

#[derive(Debug, Clone, Default)]
pub struct NewAddress {
    pub creator_address: AddressValue,
    pub creator_nonce: U64Value,
    pub new_address: AddressValue,
}

impl InterpretableFrom<NewAddressRaw> for NewAddress {
    fn interpret_from(from: NewAddressRaw, context: &InterpreterContext) -> Self {
        NewAddress {
            creator_address: AddressValue::interpret_from(from.creator_address, context),
            creator_nonce: U64Value::interpret_from(from.creator_nonce, context),
            new_address: AddressValue::interpret_from(from.new_address, context),
        }
    }
}

impl IntoRaw<NewAddressRaw> for NewAddress {
    fn into_raw(self) -> NewAddressRaw {
        NewAddressRaw {
            creator_address: self.creator_address.original,
            creator_nonce: self.creator_nonce.original,
            new_address: self.new_address.original,
        }
    }
}