multiversx_sc_meta_lib/contract/sc_config/
sc_config_serde.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
use serde::Deserialize;
use std::collections::HashMap;

use super::ProxyConfigSerde;

#[derive(Deserialize, Debug)]
#[serde(deny_unknown_fields)]
pub struct ScConfigSerde {
    #[serde(default)]
    pub settings: MultiContractGeneralSettingsSerde,
    #[serde(default)]
    pub contracts: HashMap<String, ContractVariantSerde>,
    #[serde(default)]
    pub proxy: Vec<ProxyConfigSerde>,
    #[serde(default)]
    #[serde(rename = "labels-for-contracts")]
    pub labels_for_contracts: HashMap<String, Vec<String>>,
}

#[derive(Deserialize, Debug)]
#[serde(deny_unknown_fields)]
pub struct ContractVariantSerde {
    pub name: Option<String>,

    #[serde(default)]
    #[serde(rename = "add-unlabelled")]
    pub add_unlabelled: Option<bool>,

    #[serde(default)]
    #[serde(rename = "add-labels")]
    pub add_labels: Vec<String>,

    #[serde(default)]
    #[serde(rename = "add-endpoints")]
    pub add_endpoints: Vec<String>,

    #[serde(default)]
    #[serde(rename = "external-view")]
    pub external_view: Option<bool>,

    #[serde(default)]
    #[serde(rename = "panic-message")]
    pub panic_message: Option<bool>,

    #[serde(default)]
    pub ei: Option<String>,

    #[serde(default)]
    pub allocator: Option<String>,

    #[serde(default)]
    #[serde(rename = "stack-size")]
    pub stack_size: Option<String>,

    #[serde(default)]
    pub features: Vec<String>,

    #[serde(default)]
    #[serde(rename = "default-features")]
    pub default_features: Option<bool>,

    #[serde(default)]
    pub kill_legacy_callback: bool,

    #[serde(default)]
    pub profile: Option<ContractVariantProfileSerde>,
}

#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
pub struct MultiContractGeneralSettingsSerde {
    pub main: Option<String>,
}

#[derive(Deserialize, Default, Debug, Clone, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub struct ContractVariantProfileSerde {
    #[serde(default)]
    #[serde(rename = "codegen-units")]
    pub codegen_units: Option<u8>,

    #[serde(default)]
    #[serde(rename = "opt-level")]
    pub opt_level: Option<String>,

    #[serde(default)]
    pub lto: Option<bool>,

    #[serde(default)]
    pub debug: Option<bool>,

    #[serde(default)]
    pub panic: Option<String>,

    #[serde(default)]
    #[serde(rename = "overflow-checks")]
    pub overflow_checks: Option<bool>,
}