stellar_xdr/generated/
liquidity_pool_deposit_op.rs1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4#[cfg_attr(feature = "alloc", derive(Default))]
18#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
19#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
20#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
21#[cfg_attr(
22 all(feature = "serde", feature = "alloc"),
23 serde_with::serde_as,
24 derive(serde::Serialize, serde::Deserialize),
25 serde(rename_all = "snake_case")
26)]
27#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28pub struct LiquidityPoolDepositOp {
29 pub liquidity_pool_id: PoolId,
30 #[cfg_attr(
31 all(feature = "serde", feature = "alloc"),
32 serde_as(as = "NumberOrString")
33 )]
34 pub max_amount_a: i64,
35 #[cfg_attr(
36 all(feature = "serde", feature = "alloc"),
37 serde_as(as = "NumberOrString")
38 )]
39 pub max_amount_b: i64,
40 pub min_price: Price,
41 pub max_price: Price,
42}
43
44impl ReadXdr for LiquidityPoolDepositOp {
45 #[cfg(feature = "std")]
46 fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
47 r.with_limited_depth(|r| {
48 Ok(Self {
49 liquidity_pool_id: PoolId::read_xdr(r)?,
50 max_amount_a: i64::read_xdr(r)?,
51 max_amount_b: i64::read_xdr(r)?,
52 min_price: Price::read_xdr(r)?,
53 max_price: Price::read_xdr(r)?,
54 })
55 })
56 }
57}
58
59impl WriteXdr for LiquidityPoolDepositOp {
60 #[cfg(feature = "std")]
61 fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
62 w.with_limited_depth(|w| {
63 self.liquidity_pool_id.write_xdr(w)?;
64 self.max_amount_a.write_xdr(w)?;
65 self.max_amount_b.write_xdr(w)?;
66 self.min_price.write_xdr(w)?;
67 self.max_price.write_xdr(w)?;
68 Ok(())
69 })
70 }
71}