CatapultServer  v0.5.0.1 (Elephant)
LockInfo.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/types.h"
23 
24 namespace catapult { namespace state {
25 
27  enum class LockStatus : uint8_t {
29  Unused,
30 
32  Used
33  };
34 
36  struct LockInfo {
37  protected:
40  {}
41 
43  explicit LockInfo(const Key& account, catapult::MosaicId mosaicId, catapult::Amount amount, catapult::Height height)
44  : Account(account)
45  , MosaicId(mosaicId)
46  , Amount(amount)
47  , Height(height)
49  {}
50 
51  public:
54 
57 
60 
63 
66 
67  public:
69  constexpr bool isActive(catapult::Height height) const {
70  return height < Height && LockStatus::Unused == Status;
71  }
72  };
73 }}
catapult::state::LockInfo
A lock info.
Definition: LockInfo.h:36
catapult::state::LockStatus::Unused
Lock is unused.
catapult::state::LockInfo::MosaicId
catapult::MosaicId MosaicId
Mosaic id.
Definition: LockInfo.h:56
catapult::state::LockStatus
LockStatus
A lock status.
Definition: LockInfo.h:27
catapult::utils::BaseValue< uint64_t, MosaicId_tag >
catapult::state::LockInfo::LockInfo
LockInfo()
Creates a default lock info.
Definition: LockInfo.h:39
catapult::state::LockStatus::Used
Lock was already used.
catapult::state::LockInfo::Amount
catapult::Amount Amount
Amount.
Definition: LockInfo.h:59
catapult::state::LockInfo::Height
catapult::Height Height
Height at which the lock expires.
Definition: LockInfo.h:62
catapult::state::LockInfo::Status
LockStatus Status
Flag indicating whether or not the lock was already used.
Definition: LockInfo.h:65
catapult::state::LockInfo::LockInfo
LockInfo(const Key &account, catapult::MosaicId mosaicId, catapult::Amount amount, catapult::Height height)
Creates a lock info around account, mosaicId, amount and height.
Definition: LockInfo.h:43
types.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::state::LockInfo::Account
Key Account
Account.
Definition: LockInfo.h:53
catapult::state::LockInfo::isActive
constexpr bool isActive(catapult::Height height) const
Returns true if lock info is active at height.
Definition: LockInfo.h:69