xrpld
Loading...
Searching...
No Matches
TxSettings.h
1#pragma once
2
3#include <xrpl/basics/base_uint.h>
4#include <xrpl/basics/safe_cast.h>
5
6#include <cstdint>
7#include <type_traits>
8
9namespace xrpl {
10
12
20 NoPriv = 0x0000, // The transaction can not do any of the enumerated operations
21 CreateAcct = 0x0001, // The transaction can create a new ACCOUNT_ROOT object.
22 CreatePseudoAcct = 0x0002, // The transaction can create a pseudo account,
23 // which implies createAcct
24 MustDeleteAcct = 0x0004, // The transaction must delete an ACCOUNT_ROOT object
25 MayDeleteAcct = 0x0008, // The transaction may delete an ACCOUNT_ROOT
26 // object, but does not have to
27 OverrideFreeze = 0x0010, // The transaction can override some freeze rules
28 ChangeNftCounts = 0x0020, // The transaction can mint or burn an NFT
29 CreateMptIssuance = 0x0040, // The transaction can create a new MPT issuance
30 DestroyMptIssuance = 0x0080, // The transaction can destroy an MPT issuance
31 MustAuthorizeMpt = 0x0100, // The transaction MUST create or delete an MPT
32 // object (except by issuer)
33 MayAuthorizeMpt = 0x0200, // The transaction MAY create or delete an MPT
34 // object (except by issuer)
35 MayDeleteMpt = 0x0400, // The transaction MAY delete an MPT object. May not create.
36 MustModifyVault = 0x0800, // The transaction must modify, delete or create, a vault
37 MayModifyVault = 0x1000, // The transaction MAY modify, delete or create, a vault
38 MayCreateMpt = 0x2000, // The transaction MAY create an MPT object, except for issuer.
39};
40
41// The inner static_cast is not redundant: the underlying type is narrower than
42// `int`, so the operands integer-promote and the result has to be narrowed back.
43// safeCast rejects that narrowing, but every input bit is a Privilege bit by
44// construction, so the result is always representable.
45constexpr Privilege
47{
48 using Underlying = std::underlying_type_t<Privilege>;
49 return static_cast<Privilege>(
50 static_cast<Underlying>(safeCast<Underlying>(lhs) | safeCast<Underlying>(rhs)));
51}
52
53constexpr Privilege
55{
56 using Underlying = std::underlying_type_t<Privilege>;
57 return static_cast<Privilege>(
58 static_cast<Underlying>(safeCast<Underlying>(lhs) & safeCast<Underlying>(rhs)));
59}
60
73{
78
82 // The `{}` looks redundant, because BaseUInt's default constructor already
83 // zeroes the value. It is not: without a default member initializer here,
84 // every partial designated initializer in transactions.macro trips the
85 // missing-designated-field-initializers warning, which the build treats as
86 // an error.
87 // NOLINTNEXTLINE(readability-redundant-member-init)
89
94};
95
96} // namespace xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
constexpr BaseUInt< Bits, Tag > operator&(BaseUInt< Bits, Tag > const &a, BaseUInt< Bits, Tag > const &b)
Definition base_uint.h:635
constexpr BaseUInt< Bits, Tag > operator|(BaseUInt< Bits, Tag > const &a, BaseUInt< Bits, Tag > const &b)
Definition base_uint.h:642
Privilege
Operations a transaction is permitted to perform, as a bitfield.
Definition TxSettings.h:19
constexpr Dest safeCast(Src s) noexcept
Definition safe_cast.h:21
BaseUInt< 256 > UInt256
Definition base_uint.h:580
Delegation
Definition TxSettings.h:11
Per-transaction metadata declared in transactions.macro.
Definition TxSettings.h:73
Privilege privileges
Operations this transaction is permitted to perform.
Definition TxSettings.h:93
UInt256 amendment
The amendment gating this transaction, or UInt256{} if always available.
Definition TxSettings.h:88
Delegation delegable
Whether an account may delegate this transaction to another account.
Definition TxSettings.h:77