rippled
Loading...
Searching...
No Matches
Protocol.h
1#pragma once
2
3#include <xrpl/basics/ByteUtilities.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/protocol/Units.h>
6
7#include <cstdint>
8
9namespace xrpl {
10
23
26
29
32
35
38
43std::uint64_t constexpr dirNodeMaxPages = 262144;
44
47
50
53
56
66std::uint16_t constexpr maxTransferFee = 50000;
67
84Bips32 constexpr bipsPerUnity(100 * 100);
85static_assert(bipsPerUnity == Bips32{10'000});
87static_assert(tenthBipsPerUnity == TenthBips32(100'000));
88
89constexpr Bips32
91{
92 return Bips32(percentage * bipsPerUnity.value() / 100);
93}
94constexpr TenthBips32
96{
97 return TenthBips32(percentage * tenthBipsPerUnity.value() / 100);
98}
99template <typename T, class TBips>
100constexpr T
102{
103 return value * bips.value() / bipsPerUnity.value();
104}
105template <typename T, class TBips>
106constexpr T
108{
109 return value * bips.value() / tenthBipsPerUnity.value();
110}
111
112namespace Lending {
118 unsafe_cast<std::uint16_t>(percentageToTenthBips(10).value()));
119static_assert(maxManagementFeeRate == TenthBips16(std::uint16_t(10'000u)));
120
126static_assert(maxCoverRate == TenthBips32(100'000u));
127
133static_assert(maxOverpaymentFee == TenthBips32(100'000u));
134
140static_assert(maxInterestRate == TenthBips32(100'000u));
141
148static_assert(maxLateInterestRate == TenthBips32(100'000u));
149
156static_assert(maxCloseInterestRate == TenthBips32(100'000u));
157
164static_assert(maxOverpaymentInterestRate == TenthBips32(100'000u));
165
175static constexpr int loanPaymentsPerFeeIncrement = 5;
176
199static constexpr int loanMaximumPaymentsPerTransaction = 100;
200} // namespace Lending
201
204
207
210
213
216
219
222
225
229
232
234std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
235static_assert(Number::maxRep >= maxMPTokenAmount);
236
239
242
249
253
256
258
260bool
262
264bool
266
271using TxID = uint256;
272
277
279std::size_t constexpr maxOracleURI = 256;
280
283
286
289
294
298
301std::size_t constexpr maxTrim = 25;
302
306
309
310} // namespace xrpl
static constexpr internalrep maxRep
Definition Number.h:220
constexpr value_type value() const
Returns the underlying value.
Definition Units.h:321
TenthBips32 constexpr maxCloseInterestRate
The maximum close interest rate charged for repaying a loan early in 1/10 bips.
Definition Protocol.h:155
TenthBips32 constexpr maxCoverRate
The maximum coverage rate required of a loan broker in 1/10 bips.
Definition Protocol.h:125
static constexpr int loanMaximumPaymentsPerTransaction
Maximum number of combined payments that a LoanPay transaction will process.
Definition Protocol.h:199
TenthBips32 constexpr maxOverpaymentInterestRate
The maximum overpayment interest rate charged on loan overpayments in 1/10 bips.
Definition Protocol.h:163
TenthBips32 constexpr maxLateInterestRate
The maximum premium added to the interest rate for late payments on a loan in 1/10 bips.
Definition Protocol.h:147
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:175
TenthBips32 constexpr maxOverpaymentFee
The maximum overpayment fee on a loan in 1/10 bips.
Definition Protocol.h:132
TenthBips32 constexpr maxInterestRate
Annualized interest rate of the Loan in 1/10 bips.
Definition Protocol.h:139
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::size_t constexpr dirMaxTokensPerPage
The maximum number of items in an NFT page.
Definition Protocol.h:46
std::size_t constexpr txMinSizeBytes
Protocol specific constants.
Definition Protocol.h:22
std::size_t constexpr maxLastUpdateTimeDelta
The maximum allowed time difference between lastUpdateTime and the time of the last closed ledger.
Definition Protocol.h:293
std::uint8_t constexpr vaultStrategyFirstComeFirstServe
Vault withdrawal policies.
Definition Protocol.h:241
bool isFlagLedger(LedgerIndex seq)
Returns true if the given ledgerIndex is a flag ledgerIndex.
Definition Protocol.cpp:11
std::size_t constexpr maxDeletableDirEntries
The maximum number of owner directory entries for account to be deletable.
Definition Protocol.h:49
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:285
std::size_t constexpr dirNodeMaxEntries
The maximum number of entries per directory page.
Definition Protocol.h:37
std::size_t constexpr maxCredentialURILength
The maximum length of a URI inside a Credential.
Definition Protocol.h:218
std::size_t constexpr expiredOfferRemoveLimit
The maximum number of expired offers to delete at once.
Definition Protocol.h:31
constexpr T bipsOfValue(T value, Bips< TBips > bips)
Definition Protocol.h:101
constexpr TenthBips32 percentageToTenthBips(std::uint32_t percentage)
Definition Protocol.h:95
std::size_t constexpr maxDIDDocumentLength
The maximum length of a Data element inside a DID.
Definition Protocol.h:206
constexpr T tenthBipsOfValue(T value, TenthBips< TBips > bips)
Definition Protocol.h:107
std::size_t constexpr maxDIDURILength
The maximum length of a URI inside a DID.
Definition Protocol.h:209
std::uint64_t constexpr maxMPTokenAmount
The maximum amount of MPTokenIssuance.
Definition Protocol.h:234
std::uint16_t constexpr maxDeletableAMMTrustLines
The maximum number of trustlines to delete as part of AMM account deletion cleanup.
Definition Protocol.h:276
std::size_t constexpr maxMPTokenMetadataLength
The maximum length of MPTokenMetadata.
Definition Protocol.h:231
std::size_t constexpr maxDataPayloadLength
The maximum length of Data payload.
Definition Protocol.h:238
TenthBips< std::uint32_t > TenthBips32
Definition Units.h:437
std::uint64_t constexpr dirNodeMaxPages
The maximum number of pages allowed in a directory.
Definition Protocol.h:43
std::size_t constexpr maxDeletableTokenOfferEntries
The maximum number of offers in an offer directory for NFT to be burnable.
Definition Protocol.h:55
base_uint< 256 > uint256
Definition base_uint.h:531
Bips< std::uint32_t > Bips32
Definition Units.h:433
std::size_t constexpr maxTokenURILength
The maximum length of a URI inside an NFT.
Definition Protocol.h:203
std::size_t constexpr oversizeMetaDataCap
The maximum number of metadata entries allowed in one transaction.
Definition Protocol.h:34
std::size_t constexpr maxDIDDataLength
The maximum length of an Attestation inside a DID.
Definition Protocol.h:212
bool isVotingLedger(LedgerIndex seq)
Returns true if the given ledgerIndex is a voting ledgerIndex.
Definition Protocol.cpp:5
constexpr auto megabytes(T value) noexcept
std::size_t constexpr txMaxSizeBytes
Largest legal byte size of a transaction.
Definition Protocol.h:25
std::size_t constexpr maxPriceScale
The maximum price scaling factor.
Definition Protocol.h:297
std::size_t constexpr maxTrim
The maximum percentage of outliers to trim.
Definition Protocol.h:301
std::size_t constexpr maxCredentialsArraySize
The maximum number of credentials can be passed in array.
Definition Protocol.h:224
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:308
constexpr Bips32 percentageToBips(std::uint32_t percentage)
Definition Protocol.h:90
std::size_t constexpr maxPermissionedDomainCredentialsArraySize
The maximum number of credentials can be passed in array for permissioned domain.
Definition Protocol.h:228
std::size_t constexpr maxDomainLength
The maximum length of a domain.
Definition Protocol.h:215
TenthBips< std::uint16_t > TenthBips16
Definition Units.h:436
std::size_t constexpr maxOracleSymbolClass
The maximum length of a SymbolClass inside an Oracle.
Definition Protocol.h:288
std::size_t constexpr unfundedOfferRemoveLimit
The maximum number of unfunded offers to delete at once.
Definition Protocol.h:28
std::uint16_t constexpr maxTransferFee
The maximum token transfer fee allowed.
Definition Protocol.h:66
std::size_t constexpr maxOracleProvider
The maximum length of a Provider inside an Oracle.
Definition Protocol.h:282
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:279
std::uint32_t constexpr FLAG_LEDGER_INTERVAL
Definition Protocol.h:257
std::size_t constexpr maxTokenOfferCancelCount
The maximum number of token offers that can be canceled at once.
Definition Protocol.h:52
std::size_t constexpr permissionMaxSize
The maximum number of delegate permissions an account can grant.
Definition Protocol.h:305
std::size_t constexpr maxCredentialTypeLength
The maximum length of a CredentialType inside a Credential.
Definition Protocol.h:221