rippled
Loading...
Searching...
No Matches
LoanBroker.h
1// This file is auto-generated. Do not edit.
2#pragma once
3
4#include <xrpl/protocol/STLedgerEntry.h>
5#include <xrpl/protocol/STParsedJSON.h>
6#include <xrpl/protocol/jss.h>
7#include <xrpl/protocol_autogen/LedgerEntryBase.h>
8#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
9#include <xrpl/json/json_value.h>
10
11#include <stdexcept>
12#include <optional>
13
14namespace xrpl::ledger_entries {
15
16class LoanBrokerBuilder;
17
28{
29public:
30 static constexpr LedgerEntryType entryType = ltLOAN_BROKER;
31
37 : LedgerEntryBase(std::move(sle))
38 {
39 // Verify ledger entry type
40 if (sle_->getType() != entryType)
41 {
42 throw std::runtime_error("Invalid ledger entry type for LoanBroker");
43 }
44 }
45
46 // Ledger entry-specific field getters
47
52 [[nodiscard]]
53 SF_UINT256::type::value_type
55 {
56 return this->sle_->at(sfPreviousTxnID);
57 }
58
63 [[nodiscard]]
64 SF_UINT32::type::value_type
66 {
67 return this->sle_->at(sfPreviousTxnLgrSeq);
68 }
69
74 [[nodiscard]]
75 SF_UINT32::type::value_type
77 {
78 return this->sle_->at(sfSequence);
79 }
80
85 [[nodiscard]]
86 SF_UINT64::type::value_type
88 {
89 return this->sle_->at(sfOwnerNode);
90 }
91
96 [[nodiscard]]
97 SF_UINT64::type::value_type
99 {
100 return this->sle_->at(sfVaultNode);
101 }
102
107 [[nodiscard]]
108 SF_UINT256::type::value_type
110 {
111 return this->sle_->at(sfVaultID);
112 }
113
118 [[nodiscard]]
119 SF_ACCOUNT::type::value_type
121 {
122 return this->sle_->at(sfAccount);
123 }
124
129 [[nodiscard]]
130 SF_ACCOUNT::type::value_type
131 getOwner() const
132 {
133 return this->sle_->at(sfOwner);
134 }
135
140 [[nodiscard]]
141 SF_UINT32::type::value_type
143 {
144 return this->sle_->at(sfLoanSequence);
145 }
146
151 [[nodiscard]]
153 getData() const
154 {
155 if (hasData())
156 return this->sle_->at(sfData);
157 return std::nullopt;
158 }
159
164 [[nodiscard]]
165 bool
166 hasData() const
167 {
168 return this->sle_->isFieldPresent(sfData);
169 }
170
175 [[nodiscard]]
178 {
180 return this->sle_->at(sfManagementFeeRate);
181 return std::nullopt;
182 }
183
188 [[nodiscard]]
189 bool
191 {
192 return this->sle_->isFieldPresent(sfManagementFeeRate);
193 }
194
199 [[nodiscard]]
202 {
203 if (hasOwnerCount())
204 return this->sle_->at(sfOwnerCount);
205 return std::nullopt;
206 }
207
212 [[nodiscard]]
213 bool
215 {
216 return this->sle_->isFieldPresent(sfOwnerCount);
217 }
218
223 [[nodiscard]]
226 {
227 if (hasDebtTotal())
228 return this->sle_->at(sfDebtTotal);
229 return std::nullopt;
230 }
231
236 [[nodiscard]]
237 bool
239 {
240 return this->sle_->isFieldPresent(sfDebtTotal);
241 }
242
247 [[nodiscard]]
250 {
251 if (hasDebtMaximum())
252 return this->sle_->at(sfDebtMaximum);
253 return std::nullopt;
254 }
255
260 [[nodiscard]]
261 bool
263 {
264 return this->sle_->isFieldPresent(sfDebtMaximum);
265 }
266
271 [[nodiscard]]
274 {
275 if (hasCoverAvailable())
276 return this->sle_->at(sfCoverAvailable);
277 return std::nullopt;
278 }
279
284 [[nodiscard]]
285 bool
287 {
288 return this->sle_->isFieldPresent(sfCoverAvailable);
289 }
290
295 [[nodiscard]]
298 {
300 return this->sle_->at(sfCoverRateMinimum);
301 return std::nullopt;
302 }
303
308 [[nodiscard]]
309 bool
311 {
312 return this->sle_->isFieldPresent(sfCoverRateMinimum);
313 }
314
319 [[nodiscard]]
322 {
324 return this->sle_->at(sfCoverRateLiquidation);
325 return std::nullopt;
326 }
327
332 [[nodiscard]]
333 bool
335 {
336 return this->sle_->isFieldPresent(sfCoverRateLiquidation);
337 }
338};
339
347class LoanBrokerBuilder : public LedgerEntryBuilderBase<LoanBrokerBuilder>
348{
349public:
375
382 {
383 if (sle->at(sfLedgerEntryType) != ltLOAN_BROKER)
384 {
385 throw std::runtime_error("Invalid ledger entry type for LoanBroker");
386 }
387 object_ = *sle;
388 }
389
398 {
399 object_[sfPreviousTxnID] = value;
400 return *this;
401 }
402
409 {
410 object_[sfPreviousTxnLgrSeq] = value;
411 return *this;
412 }
413
420 {
421 object_[sfSequence] = value;
422 return *this;
423 }
424
431 {
432 object_[sfOwnerNode] = value;
433 return *this;
434 }
435
442 {
443 object_[sfVaultNode] = value;
444 return *this;
445 }
446
453 {
454 object_[sfVaultID] = value;
455 return *this;
456 }
457
464 {
465 object_[sfAccount] = value;
466 return *this;
467 }
468
475 {
476 object_[sfOwner] = value;
477 return *this;
478 }
479
486 {
487 object_[sfLoanSequence] = value;
488 return *this;
489 }
490
497 {
498 object_[sfData] = value;
499 return *this;
500 }
501
508 {
509 object_[sfManagementFeeRate] = value;
510 return *this;
511 }
512
519 {
520 object_[sfOwnerCount] = value;
521 return *this;
522 }
523
530 {
531 object_[sfDebtTotal] = value;
532 return *this;
533 }
534
541 {
542 object_[sfDebtMaximum] = value;
543 return *this;
544 }
545
552 {
553 object_[sfCoverAvailable] = value;
554 return *this;
555 }
556
563 {
564 object_[sfCoverRateMinimum] = value;
565 return *this;
566 }
567
574 {
575 object_[sfCoverRateLiquidation] = value;
576 return *this;
577 }
578
585 build(uint256 const& index)
586 {
587 return LoanBroker{std::make_shared<SLE>(std::move(object_), index)};
588 }
589};
590
591} // namespace xrpl::ledger_entries
Base class for type-safe ledger entry wrappers.
std::shared_ptr< SLE const > sle_
The underlying serialized ledger entry being wrapped.
Base class for all ledger entry builders.
Builder for LoanBroker ledger entries.
Definition LoanBroker.h:348
LoanBrokerBuilder(std::decay_t< typename SF_UINT256::type::value_type > const &previousTxnID, std::decay_t< typename SF_UINT32::type::value_type > const &previousTxnLgrSeq, std::decay_t< typename SF_UINT32::type::value_type > const &sequence, std::decay_t< typename SF_UINT64::type::value_type > const &ownerNode, std::decay_t< typename SF_UINT64::type::value_type > const &vaultNode, std::decay_t< typename SF_UINT256::type::value_type > const &vaultID, std::decay_t< typename SF_ACCOUNT::type::value_type > const &account, std::decay_t< typename SF_ACCOUNT::type::value_type > const &owner, std::decay_t< typename SF_UINT32::type::value_type > const &loanSequence)
Construct a new LoanBrokerBuilder with required fields.
Definition LoanBroker.h:362
LoanBrokerBuilder & setSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSequence (soeREQUIRED)
Definition LoanBroker.h:419
LoanBrokerBuilder & setCoverRateMinimum(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCoverRateMinimum (soeDEFAULT)
Definition LoanBroker.h:562
LoanBroker build(uint256 const &index)
Build and return the completed LoanBroker wrapper.
Definition LoanBroker.h:585
LoanBrokerBuilder & setOwner(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfOwner (soeREQUIRED)
Definition LoanBroker.h:474
LoanBrokerBuilder & setDebtTotal(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfDebtTotal (soeDEFAULT)
Definition LoanBroker.h:529
LoanBrokerBuilder & setDebtMaximum(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfDebtMaximum (soeDEFAULT)
Definition LoanBroker.h:540
LoanBrokerBuilder & setVaultNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfVaultNode (soeREQUIRED)
Definition LoanBroker.h:441
LoanBrokerBuilder & setLoanSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfLoanSequence (soeREQUIRED)
Definition LoanBroker.h:485
LoanBrokerBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (soeREQUIRED)
Definition LoanBroker.h:408
LoanBrokerBuilder & setCoverAvailable(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfCoverAvailable (soeDEFAULT)
Definition LoanBroker.h:551
LoanBrokerBuilder & setVaultID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfVaultID (soeREQUIRED)
Definition LoanBroker.h:452
LoanBrokerBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Ledger entry-specific field setters.
Definition LoanBroker.h:397
LoanBrokerBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (soeREQUIRED)
Definition LoanBroker.h:430
LoanBrokerBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfAccount (soeREQUIRED)
Definition LoanBroker.h:463
LoanBrokerBuilder & setData(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfData (soeDEFAULT)
Definition LoanBroker.h:496
LoanBrokerBuilder & setCoverRateLiquidation(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCoverRateLiquidation (soeDEFAULT)
Definition LoanBroker.h:573
LoanBrokerBuilder & setManagementFeeRate(std::decay_t< typename SF_UINT16::type::value_type > const &value)
Set sfManagementFeeRate (soeDEFAULT)
Definition LoanBroker.h:507
LoanBrokerBuilder & setOwnerCount(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfOwnerCount (soeDEFAULT)
Definition LoanBroker.h:518
LoanBrokerBuilder(std::shared_ptr< SLE const > sle)
Construct a LoanBrokerBuilder from an existing SLE object.
Definition LoanBroker.h:381
Ledger Entry: LoanBroker.
Definition LoanBroker.h:28
bool hasDebtMaximum() const
Check if sfDebtMaximum is present.
Definition LoanBroker.h:262
bool hasOwnerCount() const
Check if sfOwnerCount is present.
Definition LoanBroker.h:214
bool hasManagementFeeRate() const
Check if sfManagementFeeRate is present.
Definition LoanBroker.h:190
protocol_autogen::Optional< SF_UINT32::type::value_type > getCoverRateMinimum() const
Get sfCoverRateMinimum (soeDEFAULT)
Definition LoanBroker.h:297
SF_UINT64::type::value_type getOwnerNode() const
Get sfOwnerNode (soeREQUIRED)
Definition LoanBroker.h:87
SF_UINT64::type::value_type getVaultNode() const
Get sfVaultNode (soeREQUIRED)
Definition LoanBroker.h:98
protocol_autogen::Optional< SF_UINT32::type::value_type > getCoverRateLiquidation() const
Get sfCoverRateLiquidation (soeDEFAULT)
Definition LoanBroker.h:321
SF_UINT32::type::value_type getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (soeREQUIRED)
Definition LoanBroker.h:65
LoanBroker(std::shared_ptr< SLE const > sle)
Construct a LoanBroker ledger entry wrapper from an existing SLE object.
Definition LoanBroker.h:36
protocol_autogen::Optional< SF_NUMBER::type::value_type > getDebtTotal() const
Get sfDebtTotal (soeDEFAULT)
Definition LoanBroker.h:225
SF_UINT32::type::value_type getLoanSequence() const
Get sfLoanSequence (soeREQUIRED)
Definition LoanBroker.h:142
bool hasCoverAvailable() const
Check if sfCoverAvailable is present.
Definition LoanBroker.h:286
bool hasDebtTotal() const
Check if sfDebtTotal is present.
Definition LoanBroker.h:238
protocol_autogen::Optional< SF_VL::type::value_type > getData() const
Get sfData (soeDEFAULT)
Definition LoanBroker.h:153
static constexpr LedgerEntryType entryType
Definition LoanBroker.h:30
SF_UINT256::type::value_type getPreviousTxnID() const
Get sfPreviousTxnID (soeREQUIRED)
Definition LoanBroker.h:54
SF_ACCOUNT::type::value_type getOwner() const
Get sfOwner (soeREQUIRED)
Definition LoanBroker.h:131
protocol_autogen::Optional< SF_NUMBER::type::value_type > getCoverAvailable() const
Get sfCoverAvailable (soeDEFAULT)
Definition LoanBroker.h:273
SF_UINT256::type::value_type getVaultID() const
Get sfVaultID (soeREQUIRED)
Definition LoanBroker.h:109
protocol_autogen::Optional< SF_UINT32::type::value_type > getOwnerCount() const
Get sfOwnerCount (soeDEFAULT)
Definition LoanBroker.h:201
protocol_autogen::Optional< SF_UINT16::type::value_type > getManagementFeeRate() const
Get sfManagementFeeRate (soeDEFAULT)
Definition LoanBroker.h:177
bool hasCoverRateLiquidation() const
Check if sfCoverRateLiquidation is present.
Definition LoanBroker.h:334
bool hasData() const
Check if sfData is present.
Definition LoanBroker.h:166
SF_UINT32::type::value_type getSequence() const
Get sfSequence (soeREQUIRED)
Definition LoanBroker.h:76
protocol_autogen::Optional< SF_NUMBER::type::value_type > getDebtMaximum() const
Get sfDebtMaximum (soeDEFAULT)
Definition LoanBroker.h:249
SF_ACCOUNT::type::value_type getAccount() const
Get sfAccount (soeREQUIRED)
Definition LoanBroker.h:120
bool hasCoverRateMinimum() const
Check if sfCoverRateMinimum is present.
Definition LoanBroker.h:310
T is_same_v
STL namespace.
LedgerEntryType
Identifiers for on-ledger objects.