CatapultServer  v0.5.0.1 (Elephant)
AliasNotifications.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "NamespaceConstants.h"
23 #include "NamespaceTypes.h"
25 
26 namespace catapult { namespace model {
27 
28  // region alias notification types
29 
32 #define DEFINE_NAMESPACE_NOTIFICATION(DESCRIPTION, CODE, CHANNEL) DEFINE_NOTIFICATION_TYPE(CHANNEL, Namespace, DESCRIPTION, CODE)
33 
35  DEFINE_NAMESPACE_NOTIFICATION(Alias_Owner, 0x0081, Validator);
36 
38  DEFINE_NAMESPACE_NOTIFICATION(Aliased_Address, 0x0091, All);
39 
41  DEFINE_NAMESPACE_NOTIFICATION(Aliased_MosaicId, 0x0092, All);
42 
43 #undef DEFINE_NAMESPACE_NOTIFICATION
44 
45  // endregion
46 
47  // region BaseAliasNotification
48 
51  public:
54  NotificationType notificationType,
55  size_t notificationSize,
56  catapult::NamespaceId namespaceId,
57  model::AliasAction aliasAction)
58  : Notification(notificationType, notificationSize)
59  , NamespaceId(namespaceId)
60  , AliasAction(aliasAction)
61  {}
62 
63  public:
66 
69  };
70 
71  // endregion
72 
73  // region AliasOwnerNotification
74 
77  public:
79  static constexpr auto Notification_Type = Namespace_Alias_Owner_Notification;
80 
81  public:
83  AliasOwnerNotification(const Key& owner, catapult::NamespaceId namespaceId, model::AliasAction aliasAction)
84  : BaseAliasNotification(Notification_Type, sizeof(AliasOwnerNotification), namespaceId, aliasAction)
85  , Owner(owner)
86  {}
87 
88  public:
90  const Key& Owner;
91  };
92 
93  // endregion
94 
95  // region AliasedDataNotification
96 
98  template<typename TAliasedData, NotificationType Aliased_Notification_Type>
100  private:
102 
103  public:
104  static constexpr auto Notification_Type = Aliased_Notification_Type;
105 
106  public:
108  AliasedDataNotification(catapult::NamespaceId namespaceId, model::AliasAction aliasAction, const TAliasedData& aliasedData)
109  : BaseAliasNotification(Notification_Type, sizeof(AliasedNotification), namespaceId, aliasAction)
110  , AliasedData(aliasedData)
111  {}
112 
113  public:
115  TAliasedData AliasedData;
116  };
117 
120 
123 
124  // endregion
125 }}
Observers.h
catapult::model::AliasOwnerNotification::Owner
const Key & Owner
Alias owner.
Definition: AliasNotifications.h:90
catapult::validators::DEFINE_STATEFUL_VALIDATOR
DEFINE_STATEFUL_VALIDATOR(EligibleHarvester, [](const auto &notification, const auto &context) { cache::ImportanceView view(context.Cache.template sub< cache::AccountStateCache >());return view.canHarvest(notification.Signer, context.Height) ? ValidationResult::Success :Failure_Core_Block_Harvester_Ineligible;})
NamespaceConstants.h
NamespaceCache.h
catapult::model::AliasedDataNotification
Notification of aliased data.
Definition: AliasNotifications.h:99
ValidatorContext.h
catapult::model::AccountLinkAction::Unlink
Unlink account.
catapult::validators::Notification
model::AccountAddressNotification Notification
Definition: AddressValidator.cpp:27
catapult::model::AliasOwnerNotification::Notification_Type
static constexpr auto Notification_Type
Matching notification type.
Definition: AliasNotifications.h:79
ValidatorUtils.h
catapult::model::BaseAliasNotification
Base alias notification.
Definition: AliasNotifications.h:50
catapult::state::AliasType::None
No alias.
catapult::model::AliasedDataNotification::AliasedData
TAliasedData AliasedData
Aliased data.
Definition: AliasNotifications.h:115
ObserverUtils.h
catapult::utils::BaseValue< uint64_t, NamespaceId_tag >
catapult::validators::ValidateLessThanOrEqual
constexpr ValidationResult ValidateLessThanOrEqual(TValue value, TValue maxValue, ValidationResult failureResult)
Validates that value is less than or equal to maxValue and returns failureResult on failure.
Definition: ValidatorUtils.h:28
catapult::model::AliasOwnerNotification::AliasOwnerNotification
AliasOwnerNotification(const Key &owner, catapult::NamespaceId namespaceId, model::AliasAction aliasAction)
Creates a notification around owner, namespaceId and aliasAction.
Definition: AliasNotifications.h:83
catapult::model::AliasedMosaicIdNotification
AliasedDataNotification< MosaicId, Namespace_Aliased_MosaicId_Notification > AliasedMosaicIdNotification
Notification of an aliased mosaic id.
Definition: AliasNotifications.h:122
catapult::model::BaseAliasNotification::BaseAliasNotification
BaseAliasNotification(NotificationType notificationType, size_t notificationSize, catapult::NamespaceId namespaceId, model::AliasAction aliasAction)
Creates a base alias notification around namespaceId and aliasAction using notificationType and notif...
Definition: AliasNotifications.h:53
catapult::model::NotificationType
NotificationType
Enumeration of all possible notification types.
Definition: NotificationType.h:43
NamespaceTypes.h
DEFINE_ALIASED_DATA_OBSERVER
#define DEFINE_ALIASED_DATA_OBSERVER(OBSERVER_NAME, NOTIFICATION)
Definition: AliasedDataObservers.cpp:39
Validators.h
Notifications.h
catapult::model::AccountLinkAction::Link
Link account.
catapult::model::AliasedAddressNotification
AliasedDataNotification< Address, Namespace_Aliased_Address_Notification > AliasedAddressNotification
Notification of an aliased address.
Definition: AliasNotifications.h:119
catapult::model::BaseAliasNotification::AliasAction
model::AliasAction AliasAction
Alias action.
Definition: AliasNotifications.h:68
catapult::model::AliasedDataNotification::Notification_Type
static constexpr auto Notification_Type
Definition: AliasNotifications.h:104
catapult::model::AliasOwnerNotification
Notification of alias owner.
Definition: AliasNotifications.h:76
catapult::model::Notification
A basic notification.
Definition: Notifications.h:36
catapult::validators::ValidationResult::Success
Validation succeeded.
catapult::model::DEFINE_NAMESPACE_NOTIFICATION
DEFINE_NAMESPACE_NOTIFICATION(Alias_Owner, 0x0081, Validator)
Alias owner was provided.
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::AliasAction
AliasAction
Alias transaction action.
Definition: NamespaceTypes.h:36
catapult::model::AliasedDataNotification::AliasedDataNotification
AliasedDataNotification(catapult::NamespaceId namespaceId, model::AliasAction aliasAction, const TAliasedData &aliasedData)
Creates a notification around namespaceId, aliasAction and aliasedData.
Definition: AliasNotifications.h:108
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;})
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::model::BaseAliasNotification::NamespaceId
catapult::NamespaceId NamespaceId
Namespace id.
Definition: AliasNotifications.h:65
catapult::observers::ShouldLink
constexpr bool ShouldLink(TAction action, NotifyMode notifyMode)
Returns true if action and notifyMode indicate that a link should be made.
Definition: ObserverUtils.h:34