Skip to main content

stellar_xdr/generated/
config_setting_contract_ledger_cost_ext_v0.rs

1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4/// ConfigSettingContractLedgerCostExtV0 is an XDR Struct defined as:
5///
6/// ```text
7/// struct ConfigSettingContractLedgerCostExtV0
8/// {
9///     // Maximum number of RO+RW entries in the transaction footprint.
10///     uint32 txMaxFootprintEntries;
11///     // Fee per 1 KB of data written to the ledger.
12///     // Unlike the rent fee, this is a flat fee that is charged for any ledger
13///     // write, independent of the type of the entry being written.
14///     int64 feeWrite1KB;
15/// };
16/// ```
17///
18#[cfg_attr(feature = "alloc", derive(Default))]
19#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
20#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
21#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
22#[cfg_attr(
23    all(feature = "serde", feature = "alloc"),
24    serde_with::serde_as,
25    derive(serde::Serialize, serde::Deserialize),
26    serde(rename_all = "snake_case")
27)]
28#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
29pub struct ConfigSettingContractLedgerCostExtV0 {
30    pub tx_max_footprint_entries: u32,
31    #[cfg_attr(
32        all(feature = "serde", feature = "alloc"),
33        serde_as(as = "NumberOrString")
34    )]
35    pub fee_write1_kb: i64,
36}
37
38impl ReadXdr for ConfigSettingContractLedgerCostExtV0 {
39    #[cfg(feature = "std")]
40    fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
41        r.with_limited_depth(|r| {
42            Ok(Self {
43                tx_max_footprint_entries: u32::read_xdr(r)?,
44                fee_write1_kb: i64::read_xdr(r)?,
45            })
46        })
47    }
48}
49
50impl WriteXdr for ConfigSettingContractLedgerCostExtV0 {
51    #[cfg(feature = "std")]
52    fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
53        w.with_limited_depth(|w| {
54            self.tx_max_footprint_entries.write_xdr(w)?;
55            self.fee_write1_kb.write_xdr(w)?;
56            Ok(())
57        })
58    }
59}