CatapultServer  v0.5.0.1 (Elephant)
ReceiptType.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "FacilityCode.h"
23 #include "catapult/utils/Casting.h"
24 #include <iosfwd>
25 #include <stdint.h>
26 
27 namespace catapult { namespace model {
28 
31  enum class BasicReceiptType : uint8_t {
33  Other = 0x0,
34 
36  BalanceTransfer = 0x1,
37 
39  BalanceCredit = 0x2,
40 
42  BalanceDebit = 0x3,
43 
45  ArtifactExpiry = 0x4,
46 
48  Inflation = 0x5,
49 
51  Aggregate = 0xE,
52 
54  AliasResolution = 0xF
55  };
56 
58  enum class ReceiptType : uint16_t {};
59 
61  constexpr ReceiptType MakeReceiptType(BasicReceiptType basicReceiptType, FacilityCode facilityCode, uint8_t code) {
62  return static_cast<ReceiptType>(
63  ((utils::to_underlying_type(basicReceiptType) & 0x0F) << 12) | // 01..04: basic type
64  ((code & 0xF) << 8) | // 05..08: code
65  (static_cast<uint8_t>(facilityCode) & 0xFF)); // 09..16: facility
66  }
67 
69 #define DEFINE_RECEIPT_TYPE(BASIC_TYPE, FACILITY, DESCRIPTION, CODE) \
70  constexpr auto Receipt_Type_##DESCRIPTION = model::MakeReceiptType( \
71  (model::BasicReceiptType::BASIC_TYPE), \
72  (model::FacilityCode::FACILITY), \
73  CODE)
74 
76  DEFINE_RECEIPT_TYPE(BalanceCredit, Core, Harvest_Fee, 1);
77 
79  DEFINE_RECEIPT_TYPE(Inflation, Core, Inflation, 1);
80 
82  DEFINE_RECEIPT_TYPE(Aggregate, Core, Transaction_Group, 1);
83 
85  DEFINE_RECEIPT_TYPE(AliasResolution, Core, Address_Alias_Resolution, 1);
86 
88  DEFINE_RECEIPT_TYPE(AliasResolution, Core, Mosaic_Alias_Resolution, 2);
89 
91  std::ostream& operator<<(std::ostream& out, ReceiptType receiptType);
92 }}
catapult::model::BasicReceiptType
BasicReceiptType
Definition: ReceiptType.h:31
catapult::utils::HexFormat
constexpr void HexFormat(const ByteArray< N, TTag > &)
NamespaceReceiptType.h
ReceiptType.h
catapult::utils::to_underlying_type
constexpr std::underlying_type_t< TEnum > to_underlying_type(TEnum value)
Converts a strongly typed enumeration value to its underlying integral value.
Definition: Casting.h:37
SecretLockReceiptType.h
catapult::model::FacilityCode
FacilityCode
Possible facility codes.
Definition: model/FacilityCode.h:27
catapult::model::ReceiptType
ReceiptType
Enumeration of receipt types.
Definition: ReceiptType.h:58
catapult::model::BasicReceiptType::Aggregate
Aggregate receipt.
MosaicReceiptType.h
catapult::model::DEFINE_RECEIPT_TYPE
DEFINE_RECEIPT_TYPE(BalanceDebit, LockHash, LockHash_Created, 1)
Hash lock creation.
catapult::model::MakeReceiptType
constexpr ReceiptType MakeReceiptType(BasicReceiptType basicReceiptType, FacilityCode facilityCode, uint8_t code)
Makes receipt type given basicReceiptType, facilityCode and code.
Definition: ReceiptType.h:61
MacroBasedEnumIncludes.h
catapult::model::BasicReceiptType::ArtifactExpiry
Artifact expiry receipt.
catapult::model::BasicEntityType::Other
Some other type.
HashLockReceiptType.h
catapult::model::operator<<
std::ostream & operator<<(std::ostream &out, const EmbeddedTransaction &transaction)
Insertion operator for outputting transaction to out.
Definition: EmbeddedTransaction.cpp:28
catapult::model::BasicReceiptType::BalanceCredit
Balance credit.
catapult::model::BasicReceiptType::BalanceDebit
Balance debit.
catapult::model::BasicReceiptType::AliasResolution
Alias resolution.
catapult::model::BasicReceiptType::Inflation
Inflation.
Casting.h
catapult
Definition: AddressExtractionExtension.cpp:28
CASE_WELL_KNOWN_RECEIPT_TYPE
#define CASE_WELL_KNOWN_RECEIPT_TYPE(NAME)
Definition: ReceiptType.cpp:28
FacilityCode.h
catapult::model::BasicReceiptType::BalanceTransfer
Balance transfer.