xrpld
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
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
343 [[nodiscard]]
346 {
347 if (hasDomainID())
348 return this->sle_->at(sfDomainID);
349 return std::nullopt;
350 }
351
356 [[nodiscard]]
357 bool
359 {
360 return this->sle_->isFieldPresent(sfDomainID);
361 }
362};
363
371class LoanBrokerBuilder : public LedgerEntryBuilderBase<LoanBrokerBuilder>
372{
373public:
399
406 {
407 if (sle->at(sfLedgerEntryType) != ltLOAN_BROKER)
408 {
409 throw std::runtime_error("Invalid ledger entry type for LoanBroker");
410 }
411 object_ = *sle;
412 }
413
417
424 {
425 object_[sfPreviousTxnID] = value;
426 return *this;
427 }
428
435 {
436 object_[sfPreviousTxnLgrSeq] = value;
437 return *this;
438 }
439
446 {
447 object_[sfSequence] = value;
448 return *this;
449 }
450
457 {
458 object_[sfOwnerNode] = value;
459 return *this;
460 }
461
468 {
469 object_[sfVaultNode] = value;
470 return *this;
471 }
472
479 {
480 object_[sfVaultID] = value;
481 return *this;
482 }
483
490 {
491 object_[sfAccount] = value;
492 return *this;
493 }
494
501 {
502 object_[sfOwner] = value;
503 return *this;
504 }
505
512 {
513 object_[sfLoanSequence] = value;
514 return *this;
515 }
516
523 {
524 object_[sfData] = value;
525 return *this;
526 }
527
534 {
535 object_[sfManagementFeeRate] = value;
536 return *this;
537 }
538
545 {
546 object_[sfOwnerCount] = value;
547 return *this;
548 }
549
556 {
557 object_[sfDebtTotal] = value;
558 return *this;
559 }
560
567 {
568 object_[sfDebtMaximum] = value;
569 return *this;
570 }
571
578 {
579 object_[sfCoverAvailable] = value;
580 return *this;
581 }
582
589 {
590 object_[sfCoverRateMinimum] = value;
591 return *this;
592 }
593
600 {
601 object_[sfCoverRateLiquidation] = value;
602 return *this;
603 }
604
611 {
612 object_[sfDomainID] = value;
613 return *this;
614 }
615
622 build(UInt256 const& index)
623 {
624 return LoanBroker{std::make_shared<SLE>(std::move(object_), index)};
625 }
626};
627
628} // namespace xrpl::ledger_entries
std::shared_ptr< STLedgerEntry const > const_pointer
LedgerEntryBase(SLE::const_pointer sle)
Construct a ledger entry wrapper from an existing SLE object.
SLE::const_pointer sle_
The underlying serialized ledger entry being wrapped.
Builder for LoanBroker ledger entries.
Definition LoanBroker.h:372
LoanBroker build(UInt256 const &index)
Build and return the completed LoanBroker wrapper.
Definition LoanBroker.h:622
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:386
LoanBrokerBuilder & setDomainID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfDomainID (SoeOptional).
Definition LoanBroker.h:610
LoanBrokerBuilder & setSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSequence (SoeRequired).
Definition LoanBroker.h:445
LoanBrokerBuilder & setCoverRateMinimum(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCoverRateMinimum (SoeDefault).
Definition LoanBroker.h:588
LoanBrokerBuilder & setOwner(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfOwner (SoeRequired).
Definition LoanBroker.h:500
LoanBrokerBuilder & setDebtTotal(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfDebtTotal (SoeDefault).
Definition LoanBroker.h:555
LoanBrokerBuilder & setDebtMaximum(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfDebtMaximum (SoeDefault).
Definition LoanBroker.h:566
LoanBrokerBuilder & setVaultNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfVaultNode (SoeRequired).
Definition LoanBroker.h:467
LoanBrokerBuilder & setLoanSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfLoanSequence (SoeRequired).
Definition LoanBroker.h:511
LoanBrokerBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeRequired).
Definition LoanBroker.h:434
LoanBrokerBuilder & setCoverAvailable(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfCoverAvailable (SoeDefault).
Definition LoanBroker.h:577
LoanBrokerBuilder & setVaultID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfVaultID (SoeRequired).
Definition LoanBroker.h:478
LoanBrokerBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Ledger entry-specific field setters.
Definition LoanBroker.h:423
LoanBrokerBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (SoeRequired).
Definition LoanBroker.h:456
LoanBrokerBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfAccount (SoeRequired).
Definition LoanBroker.h:489
LoanBrokerBuilder & setData(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfData (SoeDefault).
Definition LoanBroker.h:522
LoanBrokerBuilder(SLE::const_pointer sle)
Construct a LoanBrokerBuilder from an existing SLE object.
Definition LoanBroker.h:405
LoanBrokerBuilder & setCoverRateLiquidation(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCoverRateLiquidation (SoeDefault).
Definition LoanBroker.h:599
LoanBrokerBuilder & setManagementFeeRate(std::decay_t< typename SF_UINT16::type::value_type > const &value)
Set sfManagementFeeRate (SoeDefault).
Definition LoanBroker.h:533
LoanBrokerBuilder & setOwnerCount(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfOwnerCount (SoeDefault).
Definition LoanBroker.h:544
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
protocol_autogen::Optional< SF_UINT256::type::value_type > getDomainID() const
Get sfDomainID (SoeOptional).
Definition LoanBroker.h:345
bool hasManagementFeeRate() const
Check if sfManagementFeeRate is present.
Definition LoanBroker.h:190
LoanBroker(SLE::const_pointer sle)
Construct a LoanBroker ledger entry wrapper from an existing SLE object.
Definition LoanBroker.h:36
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
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 hasDomainID() const
Check if sfDomainID is present.
Definition LoanBroker.h:358
bool hasCoverRateMinimum() const
Check if sfCoverRateMinimum is present.
Definition LoanBroker.h:310
T make_shared(T... args)
STL namespace.
std::conditional_t< std::is_reference_v< ValueType >, std::optional< std::reference_wrapper< std::remove_reference_t< ValueType > > >, std::optional< ValueType > > Optional
Definition Utils.h:9
BaseUInt< 256 > UInt256
Definition base_uint.h:581
LedgerEntryType
Identifiers for on-ledger objects.