xrpld
Loading...
Searching...
No Matches
MPT.h
1#pragma once
2
3#include <xrpl/protocol/AccountID.h>
4#include <xrpl/protocol/MPTIssue.h>
5#include <xrpl/protocol/UintTypes.h>
6
7namespace xrpl {
8
9class PathFindMPT final
10{
11private:
13 // If true then holder's balance is 0, always false for issuer
14 bool const zeroBalance_;
15 // OutstandingAmount is equal to MaximumAmount
16 bool const maxedOut_;
17
18public:
19 PathFindMPT(MPTID const& mptID) : mptID_(mptID), zeroBalance_(false), maxedOut_(false)
20 {
21 }
22 PathFindMPT(MPTID const& mptID, bool zeroBalance, bool maxedOut)
23 : mptID_(mptID), zeroBalance_(zeroBalance), maxedOut_(maxedOut)
24 {
25 }
26 operator MPTID const&() const
27 {
28 return mptID_;
29 }
30 [[nodiscard]] MPTID const&
31 getMptID() const
32 {
33 return mptID_;
34 }
35 [[nodiscard]] bool
36 canSend(AccountID const& account) const
37 {
38 // A maxed-out issuance only prevents the issuer from creating more
39 // MPT. Holders can still send existing balances.
40 return account == getMPTIssuer(mptID_) ? !maxedOut_ : !zeroBalance_;
41 }
42};
43
44} // namespace xrpl
bool const maxedOut_
Definition MPT.h:16
PathFindMPT(MPTID const &mptID)
Definition MPT.h:19
bool canSend(AccountID const &account) const
Definition MPT.h:36
MPTID const mptID_
Definition MPT.h:12
MPTID const & getMptID() const
Definition MPT.h:31
PathFindMPT(MPTID const &mptID, bool zeroBalance, bool maxedOut)
Definition MPT.h:22
bool const zeroBalance_
Definition MPT.h:14
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
AccountID getMPTIssuer(MPTID const &mptid)
Definition MPTIssue.h:95
BaseUInt< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
Definition UintTypes.h:54
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:34