multiversx_sc_scenario/scenario/model/
new_address.rs1use crate::scenario_format::{
2 interpret_trait::{InterpretableFrom, InterpreterContext, IntoRaw},
3 serde_raw::NewAddressRaw,
4};
5
6use super::{AddressValue, U64Value};
7
8#[derive(Debug, Clone, Default)]
9pub struct NewAddress {
10 pub creator_address: AddressValue,
11 pub creator_nonce: U64Value,
12 pub new_address: AddressValue,
13}
14
15impl InterpretableFrom<NewAddressRaw> for NewAddress {
16 fn interpret_from(from: NewAddressRaw, context: &InterpreterContext) -> Self {
17 NewAddress {
18 creator_address: AddressValue::interpret_from(from.creator_address, context),
19 creator_nonce: U64Value::interpret_from(from.creator_nonce, context),
20 new_address: AddressValue::interpret_from(from.new_address, context),
21 }
22 }
23}
24
25impl IntoRaw<NewAddressRaw> for NewAddress {
26 fn into_raw(self) -> NewAddressRaw {
27 NewAddressRaw {
28 creator_address: self.creator_address.original,
29 creator_nonce: self.creator_nonce.original,
30 new_address: self.new_address.original,
31 }
32 }
33}