xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol
protocol/Fees.h
1
#pragma once
2
3
#include <xrpl/protocol/XRPAmount.h>
4
5
#include <
cstdint
>
6
7
namespace
xrpl
{
8
9
// Number of micro-drops in one drop.
10
inline
constexpr
std::uint32_t
microDropsPerDrop
{1'000'000};
11
18
inline
constexpr
std::uint32_t
kMaxGasLimit
{2'000'000};
19
inline
constexpr
std::uint32_t
kMaxBytecodeSizeLimit
{200'000};
20
inline
constexpr
std::uint32_t
kMinGasPrice
{1};
21
22
// The following default values of fee settings will seed into FeeSettings
23
// and write to the ledger on featureSmartEscrow activation.
24
inline
constexpr
std::uint32_t
kDefaultGasLimit
{1'000'000};
25
inline
constexpr
std::uint32_t
kDefaultBytecodeSizeLimit
{100'000};
26
inline
constexpr
std::uint32_t
kDefaultGasPrice
{1'000'000};
27
34
struct
Fees
35
{
39
XRPAmount
base
{0};
40
44
XRPAmount
reserve
{0};
45
49
XRPAmount
increment
{0};
50
57
std::uint32_t
gasLimit
{
kDefaultGasLimit
};
58
62
std::uint32_t
bytecodeSizeLimit
{
kDefaultBytecodeSizeLimit
};
63
67
std::uint32_t
gasPrice
{
kDefaultGasPrice
};
68
69
explicit
Fees
() =
default
;
70
Fees
(
Fees
const
&) =
default
;
71
Fees
&
72
operator=
(
Fees
const
&) =
default
;
73
74
Fees
(
XRPAmount
base
,
XRPAmount
reserve
,
XRPAmount
increment
)
75
:
base
{
base
},
reserve
{
reserve
},
increment
{
increment
}
76
{
77
}
78
79
Fees
(
80
XRPAmount
base
,
81
XRPAmount
reserve
,
82
XRPAmount
increment
,
83
std::uint32_t
gasLimit
,
84
std::uint32_t
bytecodeSizeLimit
,
85
std::uint32_t
gasPrice
)
86
:
base
{
base
}
87
,
reserve
{
reserve
}
88
,
increment
{
increment
}
89
,
gasLimit
{
gasLimit
}
90
,
bytecodeSizeLimit
{
bytecodeSizeLimit
}
91
,
gasPrice
{
gasPrice
}
92
{
93
}
94
101
[[nodiscard]]
XRPAmount
102
accountReserve
(
std::uint32_t
ownerCount
,
std::uint32_t
accountCount)
const
103
{
104
return
(
reserve
* accountCount) + (
increment
*
ownerCount
);
105
}
106
};
107
108
}
// namespace xrpl
xrpl::XRPAmount
Definition
XRPAmount.h:29
cstdint
std::uint32_t
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::microDropsPerDrop
constexpr std::uint32_t microDropsPerDrop
Definition
protocol/Fees.h:10
xrpl::kDefaultGasLimit
constexpr std::uint32_t kDefaultGasLimit
Definition
protocol/Fees.h:24
xrpl::ownerCount
std::uint32_t ownerCount(SLE::ConstRef sle, beast::Journal j, std::int32_t ownerCountAdj=0)
Return number of the objects which reserve is covered by the account(sle) (so called "ownercount").
Definition
AccountRootHelpers.cpp:228
xrpl::kMinGasPrice
constexpr std::uint32_t kMinGasPrice
Definition
protocol/Fees.h:20
xrpl::kDefaultGasPrice
constexpr std::uint32_t kDefaultGasPrice
Definition
protocol/Fees.h:26
xrpl::kDefaultBytecodeSizeLimit
constexpr std::uint32_t kDefaultBytecodeSizeLimit
Definition
protocol/Fees.h:25
xrpl::kMaxGasLimit
constexpr std::uint32_t kMaxGasLimit
Hard protocol bounds on the Feature Extension fee settings.
Definition
protocol/Fees.h:18
xrpl::kMaxBytecodeSizeLimit
constexpr std::uint32_t kMaxBytecodeSizeLimit
Definition
protocol/Fees.h:19
xrpl::Fees::Fees
Fees(Fees const &)=default
xrpl::Fees::gasLimit
std::uint32_t gasLimit
Gas limit for Feature Extensions (instructions).
Definition
protocol/Fees.h:57
xrpl::Fees::reserve
XRPAmount reserve
Minimum XRP an account must hold to exist on the ledger.
Definition
protocol/Fees.h:44
xrpl::Fees::bytecodeSizeLimit
std::uint32_t bytecodeSizeLimit
Bytecode size limit for Feature Extensions (bytes).
Definition
protocol/Fees.h:62
xrpl::Fees::Fees
Fees(XRPAmount base, XRPAmount reserve, XRPAmount increment)
Definition
protocol/Fees.h:74
xrpl::Fees::Fees
Fees()=default
xrpl::Fees::increment
XRPAmount increment
Additional XRP reserve required per owned ledger object.
Definition
protocol/Fees.h:49
xrpl::Fees::gasPrice
std::uint32_t gasPrice
Price of WASM gas (micro-drops).
Definition
protocol/Fees.h:67
xrpl::Fees::base
XRPAmount base
Cost of a reference transaction in drops.
Definition
protocol/Fees.h:39
xrpl::Fees::accountReserve
XRPAmount accountReserve(std::uint32_t ownerCount, std::uint32_t accountCount) const
Returns the account reserve given the owner count, in drops.
Definition
protocol/Fees.h:102
xrpl::Fees::operator=
Fees & operator=(Fees const &)=default
xrpl::Fees::Fees
Fees(XRPAmount base, XRPAmount reserve, XRPAmount increment, std::uint32_t gasLimit, std::uint32_t bytecodeSizeLimit, std::uint32_t gasPrice)
Definition
protocol/Fees.h:79
Generated by
1.17.0