CatapultServer  v0.5.0.1 (Elephant)
Receipt.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ReceiptType.h"
23 #include "SizePrefixedEntity.h"
24 #include "catapult/types.h"
25 
26 namespace catapult { namespace model {
27 
28 #pragma pack(push, 1)
29 
31  struct Receipt : public SizePrefixedEntity {
33  uint16_t Version;
34 
37  };
38 
40  struct BalanceTransferReceipt : public Receipt {
41  public:
44  ReceiptType receiptType,
45  const Key& sender,
46  const Address& recipient,
47  catapult::MosaicId mosaicId,
48  catapult::Amount amount)
49  : Sender(sender)
50  , Recipient(recipient)
51  , MosaicId(mosaicId)
52  , Amount(amount) {
53  Size = sizeof(BalanceTransferReceipt);
54  Version = 1;
55  Type = receiptType;
56  }
57 
58  public:
61 
64 
67 
70  };
71 
73  struct BalanceChangeReceipt : public Receipt {
74  public:
76  BalanceChangeReceipt(ReceiptType receiptType, const Key& account, catapult::MosaicId mosaicId, catapult::Amount amount)
77  : Account(account)
78  , MosaicId(mosaicId)
79  , Amount(amount) {
80  Size = sizeof(BalanceChangeReceipt);
81  Version = 1;
82  Type = receiptType;
83  }
84 
85  public:
88 
91 
94  };
95 
97  struct InflationReceipt : public Receipt {
98  public:
101  : MosaicId(mosaicId)
102  , Amount(amount) {
103  Size = sizeof(InflationReceipt);
104  Version = 1;
105  Type = receiptType;
106  }
107 
108  public:
111 
114  };
115 
117  template<typename TArtifactId>
118  struct ArtifactExpiryReceipt : public Receipt {
119  public:
121  ArtifactExpiryReceipt(ReceiptType receiptType, TArtifactId artifactId) : ArtifactId(artifactId) {
122  Size = sizeof(ArtifactExpiryReceipt);
123  Version = 1;
124  Type = receiptType;
125  }
126 
127  public:
129  TArtifactId ArtifactId;
130  };
131 
132 #pragma pack(pop)
133 
135 #define DEFINE_RECEIPT_CONSTANTS(TYPE, VERSION) \
136  /* Receipt format version. */ \
137  static constexpr uint8_t Current_Version = VERSION; \
138  /* Receipt type. */ \
139  static constexpr ReceiptType Receipt_Type = TYPE;
140 }}
catapult::model::BalanceChangeReceipt::Amount
catapult::Amount Amount
Amount.
Definition: Receipt.h:93
catapult::observers::calculator
uint8_t const model::InflationCalculator & calculator
Definition: HarvestFeeObserver.cpp:65
catapult::observers::DECLARE_OBSERVER
DECLARE_OBSERVER(HarvestFee, Notification)(MosaicId currencyMosaicId
catapult::model::Receipt
Binary layout for a receipt entity.
Definition: Receipt.h:31
catapult::model::BalanceTransferReceipt::Amount
catapult::Amount Amount
Amount.
Definition: Receipt.h:69
catapult::model::BalanceTransferReceipt::MosaicId
catapult::MosaicId MosaicId
Mosaic id.
Definition: Receipt.h:66
catapult::model::BalanceTransferReceipt::Sender
Key Sender
Mosaic sender public key.
Definition: Receipt.h:60
catapult::model::InflationReceipt
Binary layout for an inflation receipt.
Definition: Receipt.h:97
catapult::Height
utils::BaseValue< uint64_t, Height_tag > Height
Definition: src/catapult/types.h:85
catapult::model::BalanceChangeReceipt
Binary layout for a balance change receipt.
Definition: Receipt.h:73
catapult::model::InflationReceipt::InflationReceipt
InflationReceipt(ReceiptType receiptType, catapult::MosaicId mosaicId, catapult::Amount amount)
Creates a receipt around receiptType, mosaicId and amount.
Definition: Receipt.h:100
catapult::model::BalanceChangeReceipt::Account
Key Account
Account public key.
Definition: Receipt.h:87
catapult::model::BalanceChangeReceipt::MosaicId
catapult::MosaicId MosaicId
Mosaic id.
Definition: Receipt.h:90
ImportanceCalculator.h
ReceiptType.h
catapult::model::ArtifactExpiryReceipt::ArtifactId
TArtifactId ArtifactId
Artifact id.
Definition: Receipt.h:129
catapult::model::Receipt::Version
uint16_t Version
Receipt version.
Definition: Receipt.h:33
catapult::model::BalanceTransferReceipt::Recipient
Address Recipient
Mosaic recipient address.
Definition: Receipt.h:63
catapult::model::Receipt::Type
ReceiptType Type
Receipt type.
Definition: Receipt.h:36
catapult::utils::BaseValue< uint64_t, MosaicId_tag >
catapult::model::ArtifactExpiryReceipt::ArtifactExpiryReceipt
ArtifactExpiryReceipt(ReceiptType receiptType, TArtifactId artifactId)
Creates a receipt around receiptType and artifactId.
Definition: Receipt.h:121
catapult::model::ReceiptType
ReceiptType
Enumeration of receipt types.
Definition: ReceiptType.h:58
Observers.h
catapult::model::SizePrefixedEntity
Binary layout for a size prefixed entity.
Definition: SizePrefixedEntity.h:30
catapult::model::InflationReceipt::Amount
catapult::Amount Amount
Amount.
Definition: Receipt.h:113
m_pCommitCalculator
std::unique_ptr< importance::ImportanceCalculator > m_pCommitCalculator
Definition: RecalculateImportancesObserver.cpp:80
SizePrefixedEntity.h
catapult::model::InflationReceipt::MosaicId
catapult::MosaicId MosaicId
Mosaic id.
Definition: Receipt.h:110
AccountStateCache.h
catapult::model::BalanceChangeReceipt::BalanceChangeReceipt
BalanceChangeReceipt(ReceiptType receiptType, const Key &account, catapult::MosaicId mosaicId, catapult::Amount amount)
Creates a receipt around receiptType, account, mosaicId and amount.
Definition: Receipt.h:76
catapult::model::BalanceTransferReceipt::BalanceTransferReceipt
BalanceTransferReceipt(ReceiptType receiptType, const Key &sender, const Address &recipient, catapult::MosaicId mosaicId, catapult::Amount amount)
Creates a receipt around receiptType, sender, recipient, mosaicId and amount.
Definition: Receipt.h:43
catapult::model::BlockNotification
Notifies the arrival of a block.
Definition: Notifications.h:190
catapult::model::BalanceTransferReceipt
Binary layout for a balance transfer receipt.
Definition: Receipt.h:40
m_pRollbackCalculator
std::unique_ptr< importance::ImportanceCalculator > m_pRollbackCalculator
Definition: RecalculateImportancesObserver.cpp:81
types.h
catapult::model::ArtifactExpiryReceipt
Binary layout for an artifact expiry receipt.
Definition: Receipt.h:118
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::model::ConvertToImportanceHeight
ImportanceHeight ConvertToImportanceHeight(Height height, Height::ValueType grouping)
Definition: ImportanceHeight.cpp:33
catapult::model::SizePrefixedEntity::Size
uint32_t Size
Entity size.
Definition: SizePrefixedEntity.h:33
m_name
std::string m_name
Definition: RecalculateImportancesObserver.cpp:82