Skip to main content

thruput_xdr/
genesis.rs

1// -*-Rust-*-
2// Generated Code: DO NOT CHECK IN
3
4// Generated from xdrc commit: 6ab835b07c234abb4b0b50b61d687904727a4f32
5
6#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8#![allow(non_upper_case_globals)]
9#![allow(unused_imports)]
10#![allow(dead_code)]
11#![allow(unused_variables)]
12#![allow(clippy::unnecessary_cast)]
13
14use crate::*;
15use core::option::Option;
16use core::ops::{Deref, DerefMut};
17
18#[cfg(feature = "std")]
19use std::io::{Read, Write};
20#[cfg(feature = "xdrs")]
21use xdrs::*;
22
23
24#[cfg(feature = "serde")]
25use ::serde::{{Serialize, Deserialize}};
26
27
28
29// clang-format on
30
31#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
32#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
33#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
34#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35#[repr(C)]
36pub struct GenesisConfiguration {
37    pub network_hash: NetworkHash,
38    pub storage_cost_model: StorageCostModelXdr,
39    /// The execution parameters block 0 runs under, in canonical form. Carried
40    /// into the DbTip at genesis load and forward by every later commit.
41    pub network_config: NetworkConfig,
42    pub root_contract: Contract,
43    /// The contract resolved for root invocations of undeployed addresses.
44    /// Committed to by `ProposalHeader::config_hash` through
45    /// `ConfigHashPreimage`, so a node cannot run under a different one than
46    /// the chain agreed.
47    pub default_wallet: DeployedContractHash,
48}
49
50// These translated into the contract addresses that are initialized
51// at the start of the chain.
52//
53// The addresses (32 bytes) are all zeros, with the last 4 bytes equal
54// to the enum value.
55#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
56#[cfg_attr(feature = "serde", serde(transparent))]
57#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
58#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
59#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
60#[derive(Copy)]
61#[repr(transparent)]
62pub struct GenesisContractAddresses(pub i32);
63
64impl GenesisContractAddresses {
65    // Null address (reserved)
66    pub const kAddressNull: Self = Self(0);
67
68    // Precompiled native-token contract
69    pub const kAddressNativeToken: Self = Self(1);
70
71    // Genesis root contract
72    pub const kAddressGenesisRoot: Self = Self(2);
73}
74impl From<i32> for GenesisContractAddresses {
75    fn from(v: i32) -> Self {
76        Self(v)
77    }
78}
79#[cfg(feature = "std")]
80impl core::fmt::Display for GenesisContractAddresses {
81    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
82        match self.0 {
83            x if x == Self::kAddressNull.0 => {
84                write!(f, "GenesisContractAddresses::kAddressNull")
85            },
86            x if x == Self::kAddressNativeToken.0 => {
87                write!(f, "GenesisContractAddresses::kAddressNativeToken")
88            },
89            x if x == Self::kAddressGenesisRoot.0 => {
90                write!(f, "GenesisContractAddresses::kAddressGenesisRoot")
91            },
92            _ => {
93                write!(f, "GenesisContractAddresses({})", self.0)
94            }
95        }
96    }
97}
98
99
100
101//
102// XDR internals below this point
103//
104
105