rippled
Loading...
Searching...
No Matches
Protocol.h
1#ifndef XRPL_PROTOCOL_PROTOCOL_H_INCLUDED
2#define XRPL_PROTOCOL_PROTOCOL_H_INCLUDED
3
4#include <xrpl/basics/ByteUtilities.h>
5#include <xrpl/basics/base_uint.h>
6#include <xrpl/protocol/Units.h>
7
8#include <cstdint>
9
10namespace xrpl {
11
24
27
30
33
36
39
44std::uint64_t constexpr dirNodeMaxPages = 262144;
45
48
51
54
57
67std::uint16_t constexpr maxTransferFee = 50000;
68
85Bips32 constexpr bipsPerUnity(100 * 100);
86static_assert(bipsPerUnity == Bips32{10'000});
88static_assert(tenthBipsPerUnity == TenthBips32(100'000));
89
90constexpr Bips32
92{
93 return Bips32(percentage * bipsPerUnity.value() / 100);
94}
95constexpr TenthBips32
97{
98 return TenthBips32(percentage * tenthBipsPerUnity.value() / 100);
99}
100template <typename T, class TBips>
101constexpr T
103{
104 return value * bips.value() / bipsPerUnity.value();
105}
106template <typename T, class TBips>
107constexpr T
109{
110 return value * bips.value() / tenthBipsPerUnity.value();
111}
112
113namespace Lending {
119 unsafe_cast<std::uint16_t>(percentageToTenthBips(10).value()));
120static_assert(maxManagementFeeRate == TenthBips16(std::uint16_t(10'000u)));
121
127static_assert(maxCoverRate == TenthBips32(100'000u));
128
134static_assert(maxOverpaymentFee == TenthBips32(100'000u));
135
141static_assert(maxInterestRate == TenthBips32(100'000u));
142
149static_assert(maxLateInterestRate == TenthBips32(100'000u));
150
157static_assert(maxCloseInterestRate == TenthBips32(100'000u));
158
165static_assert(maxOverpaymentInterestRate == TenthBips32(100'000u));
166
176static constexpr int loanPaymentsPerFeeIncrement = 5;
177
200static constexpr int loanMaximumPaymentsPerTransaction = 100;
201} // namespace Lending
202
205
208
211
214
217
220
223
226
230
233
235std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
236
239
242
249
253
256
261using TxID = uint256;
262
267
269std::size_t constexpr maxOracleURI = 256;
270
273
276
279
284
288
291std::size_t constexpr maxTrim = 25;
292
296
299
300} // namespace xrpl
301
302#endif
constexpr value_type value() const
Returns the underlying value.
Definition Units.h:325
TenthBips32 constexpr maxCloseInterestRate
The maximum close interest rate charged for repaying a loan early in 1/10 bips.
Definition Protocol.h:156
TenthBips32 constexpr maxCoverRate
The maximum coverage rate required of a loan broker in 1/10 bips.
Definition Protocol.h:126
static constexpr int loanMaximumPaymentsPerTransaction
Maximum number of combined payments that a LoanPay transaction will process.
Definition Protocol.h:200
TenthBips32 constexpr maxOverpaymentInterestRate
The maximum overpayment interest rate charged on loan overpayments in 1/10 bips.
Definition Protocol.h:164
TenthBips32 constexpr maxLateInterestRate
The maximum premium added to the interest rate for late payments on a loan in 1/10 bips.
Definition Protocol.h:148
TenthBips16 constexpr maxManagementFeeRate(unsafe_cast< std::uint16_t >(percentageToTenthBips(10).value()))
The maximum management fee rate allowed by a loan broker in 1/10 bips.
static constexpr int loanPaymentsPerFeeIncrement
LoanPay transaction cost will be one base fee per X combined payments.
Definition Protocol.h:176
TenthBips32 constexpr maxOverpaymentFee
The maximum overpayment fee on a loan in 1/10 bips.
Definition Protocol.h:133
TenthBips32 constexpr maxInterestRate
Annualized interest rate of the Loan in 1/10 bips.
Definition Protocol.h:140
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
std::size_t constexpr dirMaxTokensPerPage
The maximum number of items in an NFT page.
Definition Protocol.h:47
std::size_t constexpr txMinSizeBytes
Protocol specific constants.
Definition Protocol.h:23
std::size_t constexpr maxLastUpdateTimeDelta
The maximum allowed time difference between lastUpdateTime and the time of the last closed ledger.
Definition Protocol.h:283
std::uint8_t constexpr vaultStrategyFirstComeFirstServe
Vault withdrawal policies.
Definition Protocol.h:241
std::size_t constexpr maxDeletableDirEntries
The maximum number of owner directory entries for account to be deletable.
Definition Protocol.h:50
std::uint8_t constexpr maxAssetCheckDepth
Maximum recursion depth for vault shares being put as an asset inside another vault; counted from 0.
Definition Protocol.h:252
std::size_t constexpr maxOracleDataSeries
The maximum size of a data series array inside an Oracle.
Definition Protocol.h:275
std::size_t constexpr dirNodeMaxEntries
The maximum number of entries per directory page.
Definition Protocol.h:38
std::size_t constexpr maxCredentialURILength
The maximum length of a URI inside a Credential.
Definition Protocol.h:219
std::size_t constexpr expiredOfferRemoveLimit
The maximum number of expired offers to delete at once.
Definition Protocol.h:32
constexpr T bipsOfValue(T value, Bips< TBips > bips)
Definition Protocol.h:102
constexpr TenthBips32 percentageToTenthBips(std::uint32_t percentage)
Definition Protocol.h:96
std::size_t constexpr maxDIDDocumentLength
The maximum length of a Data element inside a DID.
Definition Protocol.h:207
constexpr T tenthBipsOfValue(T value, TenthBips< TBips > bips)
Definition Protocol.h:108
std::size_t constexpr maxDIDURILength
The maximum length of a URI inside a DID.
Definition Protocol.h:210
std::uint64_t constexpr maxMPTokenAmount
The maximum amount of MPTokenIssuance.
Definition Protocol.h:235
std::uint16_t constexpr maxDeletableAMMTrustLines
The maximum number of trustlines to delete as part of AMM account deletion cleanup.
Definition Protocol.h:266
std::size_t constexpr maxMPTokenMetadataLength
The maximum length of MPTokenMetadata.
Definition Protocol.h:232
std::size_t constexpr maxDataPayloadLength
The maximum length of Data payload.
Definition Protocol.h:238
TenthBips< std::uint32_t > TenthBips32
Definition Units.h:443
std::uint64_t constexpr dirNodeMaxPages
The maximum number of pages allowed in a directory.
Definition Protocol.h:44
std::size_t constexpr maxDeletableTokenOfferEntries
The maximum number of offers in an offer directory for NFT to be burnable.
Definition Protocol.h:56
base_uint< 256 > uint256
Definition base_uint.h:539
Bips< std::uint32_t > Bips32
Definition Units.h:439
std::size_t constexpr maxTokenURILength
The maximum length of a URI inside an NFT.
Definition Protocol.h:204
std::size_t constexpr oversizeMetaDataCap
The maximum number of metadata entries allowed in one transaction.
Definition Protocol.h:35
constexpr auto megabytes(T value) noexcept
std::size_t constexpr txMaxSizeBytes
Largest legal byte size of a transaction.
Definition Protocol.h:26
std::size_t constexpr maxPriceScale
The maximum price scaling factor.
Definition Protocol.h:287
std::size_t constexpr maxTrim
The maximum percentage of outliers to trim.
Definition Protocol.h:291
std::size_t constexpr maxCredentialsArraySize
The maximum number of credentials can be passed in array.
Definition Protocol.h:225
Bips32 constexpr bipsPerUnity(100 *100)
There are 10,000 basis points (bips) in 100%.
std::uint8_t constexpr vaultDefaultIOUScale
Default IOU scale factor for a Vault.
Definition Protocol.h:244
TenthBips32 constexpr tenthBipsPerUnity(bipsPerUnity.value() *10)
std::size_t constexpr maxBatchTxCount
The maximum number of transactions that can be in a batch.
Definition Protocol.h:298
constexpr Bips32 percentageToBips(std::uint32_t percentage)
Definition Protocol.h:91
std::size_t constexpr maxPermissionedDomainCredentialsArraySize
The maximum number of credentials can be passed in array for permissioned domain.
Definition Protocol.h:229
std::size_t constexpr maxDomainLength
The maximum length of a domain.
Definition Protocol.h:216
TenthBips< std::uint16_t > TenthBips16
Definition Units.h:442
std::size_t constexpr maxOracleSymbolClass
The maximum length of a SymbolClass inside an Oracle.
Definition Protocol.h:278
std::size_t constexpr unfundedOfferRemoveLimit
The maximum number of unfunded offers to delete at once.
Definition Protocol.h:29
std::uint16_t constexpr maxTransferFee
The maximum token transfer fee allowed.
Definition Protocol.h:67
std::size_t constexpr maxOracleProvider
The maximum length of a Provider inside an Oracle.
Definition Protocol.h:272
std::uint8_t constexpr vaultMaximumIOUScale
Maximum scale factor for a Vault.
Definition Protocol.h:248
std::size_t constexpr maxOracleURI
The maximum length of a URI inside an Oracle.
Definition Protocol.h:269
std::size_t constexpr maxDIDAttestationLength
The maximum length of an Attestation inside a DID.
Definition Protocol.h:213
std::size_t constexpr maxTokenOfferCancelCount
The maximum number of token offers that can be canceled at once.
Definition Protocol.h:53
std::size_t constexpr permissionMaxSize
The maximum number of delegate permissions an account can grant.
Definition Protocol.h:295
std::size_t constexpr maxCredentialTypeLength
The maximum length of a CredentialType inside a Credential.
Definition Protocol.h:222