ex3_node_types/transaction/market/
spot_market.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
99
100
101
102
103
104
use serde::{Deserialize, Serialize};

use crate::market::MarketIdentifier;
use crate::market::{SpotMarketRoyalty, SpotMarketTradingFee, SpotMarketTradingSettings};
use crate::{AssetAmount, SpotMarketId, WalletRegisterId};

/// Represents the registration of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct SpotMarketRegistration {
    /// Identifier for the spot market
    pub identifier: MarketIdentifier,

    /// Quantity of the base asset
    pub base_asset_quantity: AssetAmount,

    /// Quantity of the quote asset
    pub quote_asset_quantity: AssetAmount,

    /// Trading settings for the market
    pub trading_settings: SpotMarketTradingSettings,
}

/// Represents an update to the trading settings of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct UpdateSpotMarketTradingSettings {
    /// Identifier for the spot market
    pub market_id: SpotMarketId,

    /// New trading settings for the market
    pub trading_settings: SpotMarketTradingSettings,
}

/// Represents an update to the initial trading fee of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct UpdateSpotMarketInitialTradingFee {
    /// New trading fee
    pub fee: SpotMarketTradingFee,
}

/// Represents an update to the royalty of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct UpdateSpotMarketRoyalty {
    /// Identifier for the spot market
    pub market_id: SpotMarketId,

    /// New royalty settings
    pub royalty: SpotMarketRoyalty,
}

/// Represents a claim for the trading fee of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct ClaimSpotMarketTradingFee {
    /// Identifier for the spot market
    pub market_id: SpotMarketId,

    /// Amount of the base asset fee
    pub base: AssetAmount,

    /// Amount of the quote asset fee
    pub quote: AssetAmount,
}

/// Represents a claim for the royalty of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct ClaimSpotMarketRoyalty {
    /// Identifier for the spot market
    pub market_id: SpotMarketId,

    /// Amount of the base asset royalty
    pub base: AssetAmount,

    /// Amount of the quote asset royalty
    pub quote: AssetAmount,
}

/// Represents an update to the initial fee recipient of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct UpdateSpotMarketInitialFeeTo {
    /// New fee recipient
    pub fee_to: WalletRegisterId,
}

/// Represents an update to the fee recipient of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct UpdateSpotMarketFeeTo {
    /// Identifier for the spot market
    pub market_id: SpotMarketId,

    /// New fee recipient
    pub fee_to: WalletRegisterId,
}

/// Represents an update to the trading fee of a spot market
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct UpdateSpotMarketTradingFee {
    /// Identifier for the spot market
    pub market_id: SpotMarketId,

    /// New trading fee
    pub fee: SpotMarketTradingFee,
}

#[cfg(test)]
mod tests;