xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol
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
9
namespace
xrpl
{
10
11
enum class
Delegation
{
Delegable
,
NotDelegable
};
12
19
enum class
Privilege
:
std::uint16_t
{
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.
45
constexpr
Privilege
46
operator|
(
Privilege
lhs,
Privilege
rhs)
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
53
constexpr
Privilege
54
operator&
(
Privilege
lhs,
Privilege
rhs)
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
72
struct
TxSettings
73
{
77
Delegation
delegable
{
Delegation::NotDelegable
};
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)
88
UInt256
amendment
{};
89
93
Privilege
privileges
{
Privilege::NoPriv
};
94
};
95
96
}
// namespace xrpl
cstdint
std::uint16_t
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::operator&
constexpr BaseUInt< Bits, Tag > operator&(BaseUInt< Bits, Tag > const &a, BaseUInt< Bits, Tag > const &b)
Definition
base_uint.h:635
xrpl::operator|
constexpr BaseUInt< Bits, Tag > operator|(BaseUInt< Bits, Tag > const &a, BaseUInt< Bits, Tag > const &b)
Definition
base_uint.h:642
xrpl::Privilege
Privilege
Operations a transaction is permitted to perform, as a bitfield.
Definition
TxSettings.h:19
xrpl::Privilege::MayDeleteAcct
@ MayDeleteAcct
Definition
TxSettings.h:25
xrpl::Privilege::CreatePseudoAcct
@ CreatePseudoAcct
Definition
TxSettings.h:22
xrpl::Privilege::MayCreateMpt
@ MayCreateMpt
Definition
TxSettings.h:38
xrpl::Privilege::CreateAcct
@ CreateAcct
Definition
TxSettings.h:21
xrpl::Privilege::MustDeleteAcct
@ MustDeleteAcct
Definition
TxSettings.h:24
xrpl::Privilege::NoPriv
@ NoPriv
Definition
TxSettings.h:20
xrpl::Privilege::OverrideFreeze
@ OverrideFreeze
Definition
TxSettings.h:27
xrpl::Privilege::DestroyMptIssuance
@ DestroyMptIssuance
Definition
TxSettings.h:30
xrpl::Privilege::MayModifyVault
@ MayModifyVault
Definition
TxSettings.h:37
xrpl::Privilege::MayAuthorizeMpt
@ MayAuthorizeMpt
Definition
TxSettings.h:33
xrpl::Privilege::ChangeNftCounts
@ ChangeNftCounts
Definition
TxSettings.h:28
xrpl::Privilege::MayDeleteMpt
@ MayDeleteMpt
Definition
TxSettings.h:35
xrpl::Privilege::MustModifyVault
@ MustModifyVault
Definition
TxSettings.h:36
xrpl::Privilege::MustAuthorizeMpt
@ MustAuthorizeMpt
Definition
TxSettings.h:31
xrpl::Privilege::CreateMptIssuance
@ CreateMptIssuance
Definition
TxSettings.h:29
xrpl::safeCast
constexpr Dest safeCast(Src s) noexcept
Definition
safe_cast.h:21
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
xrpl::Delegation
Delegation
Definition
TxSettings.h:11
xrpl::Delegation::NotDelegable
@ NotDelegable
Definition
TxSettings.h:11
xrpl::Delegation::Delegable
@ Delegable
Definition
TxSettings.h:11
xrpl::TxSettings
Per-transaction metadata declared in transactions.macro.
Definition
TxSettings.h:73
xrpl::TxSettings::privileges
Privilege privileges
Operations this transaction is permitted to perform.
Definition
TxSettings.h:93
xrpl::TxSettings::amendment
UInt256 amendment
The amendment gating this transaction, or UInt256{} if always available.
Definition
TxSettings.h:88
xrpl::TxSettings::delegable
Delegation delegable
Whether an account may delegate this transaction to another account.
Definition
TxSettings.h:77
type_traits
std::underlying_type_t
Generated by
1.17.0