CatapultServer  v0.5.0.1 (Elephant)
MosaicNotifications.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "MosaicConstants.h"
23 #include "MosaicProperties.h"
24 #include "MosaicTypes.h"
26 
27 namespace catapult { namespace model {
28 
29  // region mosaic notification types
30 
32 #define DEFINE_MOSAIC_NOTIFICATION(DESCRIPTION, CODE, CHANNEL) DEFINE_NOTIFICATION_TYPE(CHANNEL, Mosaic, DESCRIPTION, CODE)
33 
35  DEFINE_MOSAIC_NOTIFICATION(Properties, 0x0012, Validator);
36 
38  DEFINE_MOSAIC_NOTIFICATION(Definition, 0x0013, All);
39 
41  DEFINE_MOSAIC_NOTIFICATION(Nonce, 0x0014, Validator);
42 
44  DEFINE_MOSAIC_NOTIFICATION(Supply_Change, 0x0022, All);
45 
47  DEFINE_MOSAIC_NOTIFICATION(Rental_Fee, 0x0030, Observer);
48 
49 #undef DEFINE_MOSAIC_NOTIFICATION
50 
51  // endregion
52 
53  // region MosaicPropertiesNotification
54 
58  public:
60  static constexpr auto Notification_Type = Mosaic_Properties_Notification;
61 
62  public:
64  MosaicPropertiesNotification(const MosaicPropertiesHeader& propertiesHeader, const MosaicProperty* pProperties)
66  , PropertiesHeader(propertiesHeader)
67  , PropertiesPtr(pProperties)
68  {}
69 
70  public:
73 
76  };
77 
78  // endregion
79 
80  // region MosaicDefinitionNotification
81 
84  public:
86  static constexpr auto Notification_Type = Mosaic_Definition_Notification;
87 
88  public:
90  MosaicDefinitionNotification(const Key& signer, MosaicId mosaicId, const MosaicProperties& properties)
92  , Signer(signer)
93  , MosaicId(mosaicId)
94  , Properties(properties)
95  {}
96 
97  public:
99  const Key& Signer;
100 
103 
106  };
107 
108  // endregion
109 
110  // region MosaicNonceNotification
111 
114  public:
116  static constexpr auto Notification_Type = Mosaic_Nonce_Notification;
117 
118  public:
120  MosaicNonceNotification(const Key& signer, MosaicNonce mosaicNonce, catapult::MosaicId mosaicId)
122  , Signer(signer)
123  , MosaicNonce(mosaicNonce)
124  , MosaicId(mosaicId)
125  {}
126 
127  public:
129  const Key& Signer;
130 
133 
136  };
137 
138  // endregion
139 
140  // region MosaicSupplyChangeNotification
141 
144  public:
146  static constexpr auto Notification_Type = Mosaic_Supply_Change_Notification;
147 
148  public:
152  , Signer(signer)
153  , MosaicId(mosaicId)
154  , Direction(direction)
155  , Delta(delta)
156  {}
157 
158  public:
160  const Key& Signer;
161 
164 
167 
170  };
171 
172  // endregion
173 
174  // region rental MosaicRentalFeeNotification
175 
177  struct MosaicRentalFeeNotification : public BasicBalanceNotification<MosaicRentalFeeNotification> {
178  public:
180  static constexpr auto Notification_Type = Mosaic_Rental_Fee_Notification;
181 
182  public:
185  const Key& sender,
186  const UnresolvedAddress& recipient,
187  UnresolvedMosaicId mosaicId,
188  catapult::Amount amount)
189  : BasicBalanceNotification(sender, mosaicId, amount)
190  , Recipient(recipient)
191  {}
192 
193  public:
196  };
197 
198  // endregion
199 }}
catapult::model::MosaicPropertiesNotification::PropertiesHeader
const MosaicPropertiesHeader & PropertiesHeader
Mosaic properties header.
Definition: MosaicNotifications.h:72
catapult::model::GenerateMosaicId
MosaicId GenerateMosaicId(const Key &owner, MosaicNonce nonce) noexcept
Generates a mosaic id given owner and nonce.
Definition: MosaicIdGenerator.cpp:26
catapult::model::MosaicSupplyChangeDirection
MosaicSupplyChangeDirection
Supply change directions.
Definition: MosaicTypes.h:27
catapult::model::MosaicRentalFeeNotification::Recipient
UnresolvedAddress Recipient
Recipient.
Definition: MosaicNotifications.h:195
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
catapult::model::MosaicNonceNotification
Notification of a mosaic nonce and id.
Definition: MosaicNotifications.h:113
catapult::model::MosaicDefinitionNotification
Notification of a mosaic definition.
Definition: MosaicNotifications.h:83
catapult::model::MosaicRentalFeeNotification::Notification_Type
static constexpr auto Notification_Type
Matching notification type.
Definition: MosaicNotifications.h:180
catapult::model::MosaicSupplyChangeNotification::Direction
MosaicSupplyChangeDirection Direction
Supply change direction.
Definition: MosaicNotifications.h:166
catapult::model::MosaicSupplyChangeNotification::Delta
Amount Delta
Amount of the change.
Definition: MosaicNotifications.h:169
catapult::MosaicId
utils::BaseValue< uint64_t, MosaicId_tag > MosaicId
Definition: src/catapult/types.h:79
catapult::model::MosaicSupplyChangeNotification::MosaicSupplyChangeNotification
MosaicSupplyChangeNotification(const Key &signer, UnresolvedMosaicId mosaicId, MosaicSupplyChangeDirection direction, Amount delta)
Creates a notification around signer, mosaicId, direction and delta.
Definition: MosaicNotifications.h:150
catapult::model::BasicBalanceNotification
A basic balance notification.
Definition: Notifications.h:98
catapult::model::MosaicSupplyChangeNotification
Notification of a mosaic supply change.
Definition: MosaicNotifications.h:143
catapult::utils::BaseValue< uint64_t, MosaicId_tag >
catapult::model::MosaicProperty
Mosaic property composed of an id and a value.
Definition: MosaicProperty.h:69
catapult::model::MosaicNonceNotification::MosaicNonce
catapult::MosaicNonce MosaicNonce
Mosaic nonce.
Definition: MosaicNotifications.h:132
catapult::model::MosaicDefinitionNotification::Properties
MosaicProperties Properties
Mosaic properties.
Definition: MosaicNotifications.h:105
MosaicTypes.h
catapult::model::MosaicNonceNotification::Notification_Type
static constexpr auto Notification_Type
Matching notification type.
Definition: MosaicNotifications.h:116
catapult::model::MosaicDefinitionNotification::MosaicDefinitionNotification
MosaicDefinitionNotification(const Key &signer, MosaicId mosaicId, const MosaicProperties &properties)
Creates a notification around signer, mosaicId and properties.
Definition: MosaicNotifications.h:90
catapult::model::MosaicRentalFeeNotification::MosaicRentalFeeNotification
MosaicRentalFeeNotification(const Key &sender, const UnresolvedAddress &recipient, UnresolvedMosaicId mosaicId, catapult::Amount amount)
Creates a notification around sender, recipient, mosaicId and amount.
Definition: MosaicNotifications.h:184
catapult::model::MosaicSupplyChangeNotification::Notification_Type
static constexpr auto Notification_Type
Matching notification type.
Definition: MosaicNotifications.h:146
catapult::model::MosaicPropertiesNotification::MosaicPropertiesNotification
MosaicPropertiesNotification(const MosaicPropertiesHeader &propertiesHeader, const MosaicProperty *pProperties)
Creates a notification around propertiesHeader and pProperties.
Definition: MosaicNotifications.h:64
catapult::model::MosaicDefinitionNotification::Signer
const Key & Signer
Signer.
Definition: MosaicNotifications.h:99
MosaicProperties.h
catapult::model::MosaicNonceNotification::MosaicId
catapult::MosaicId MosaicId
Mosaic id.
Definition: MosaicNotifications.h:135
catapult::model::MosaicPropertiesNotification::Notification_Type
static constexpr auto Notification_Type
Matching notification type.
Definition: MosaicNotifications.h:60
Notifications.h
catapult::model::DEFINE_MOSAIC_NOTIFICATION
DEFINE_MOSAIC_NOTIFICATION(Properties, 0x0012, Validator)
Mosaic properties were provided.
catapult::model::MosaicPropertiesHeader
Mosaic properties header.
Definition: MosaicProperties.h:32
catapult::model::MosaicDefinitionNotification::Notification_Type
static constexpr auto Notification_Type
Matching notification type.
Definition: MosaicNotifications.h:86
catapult::model::MosaicSupplyChangeNotification::Signer
const Key & Signer
Signer.
Definition: MosaicNotifications.h:160
catapult::model::MosaicRentalFeeNotification
Notification of a mosaic rental fee.
Definition: MosaicNotifications.h:177
catapult::model::Notification
A basic notification.
Definition: Notifications.h:36
MosaicIdGenerator.h
catapult::model::MosaicNonceNotification::Signer
const Key & Signer
Signer.
Definition: MosaicNotifications.h:129
catapult::model::MosaicDefinitionNotification::MosaicId
catapult::MosaicId MosaicId
Id of the mosaic.
Definition: MosaicNotifications.h:102
catapult::validators::ValidationResult::Success
Validation succeeded.
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::MosaicPropertiesNotification::PropertiesPtr
const MosaicProperty * PropertiesPtr
Const pointer to the optional properties.
Definition: MosaicNotifications.h:75
catapult::validators::DEFINE_STATELESS_VALIDATOR
DEFINE_STATELESS_VALIDATOR(TransactionFee, [](const auto &notification) { if(notification.Fee > notification.MaxFee) return Failure_Core_Invalid_Transaction_Fee;constexpr auto Max_Raw_Block_Fee_Multiplier=static_cast< uint64_t >(std::numeric_limits< BlockFeeMultiplier::ValueType >::max());return notification.MaxFee.unwrap() > Max_Raw_Block_Fee_Multiplier *notification.TransactionSize ? Failure_Core_Invalid_Transaction_Fee :ValidationResult::Success;})
MosaicConstants.h
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::model::MosaicPropertiesNotification
Definition: MosaicNotifications.h:57
catapult::model::MosaicProperties
Container for mosaic properties.
Definition: MosaicProperties.h:46
catapult::model::MosaicSupplyChangeNotification::MosaicId
UnresolvedMosaicId MosaicId
Id of the affected mosaic.
Definition: MosaicNotifications.h:163
catapult::model::MosaicNonceNotification::MosaicNonceNotification
MosaicNonceNotification(const Key &signer, MosaicNonce mosaicNonce, catapult::MosaicId mosaicId)
Creates a notification around signer, mosaicNonce and mosaicId.
Definition: MosaicNotifications.h:120
Validators.h