mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Finish LoanBrokerSet
- Update changed field name. - Modify modifiable fields in an update. Note there are only two. - Add a node field to dirLink, defaulting sfOwnerNode, so other relationships can be updated.
This commit is contained in:
@@ -536,7 +536,7 @@ LEDGER_ENTRY(ltLOAN, 0x0085, Loan, loan, ({
|
|||||||
{sfPreviousPaymentDate, soeREQUIRED},
|
{sfPreviousPaymentDate, soeREQUIRED},
|
||||||
{sfNextPaymentDueDate, soeREQUIRED},
|
{sfNextPaymentDueDate, soeREQUIRED},
|
||||||
{sfPaymentRemaining, soeREQUIRED},
|
{sfPaymentRemaining, soeREQUIRED},
|
||||||
{sfAssetAvailable, soeREQUIRED},
|
{sfAssetsAvailable, soeREQUIRED},
|
||||||
{sfPrincipalOutstanding, soeREQUIRED},
|
{sfPrincipalOutstanding, soeREQUIRED},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
@@ -142,9 +142,14 @@ LoanBrokerSet::doApply()
|
|||||||
if (auto const brokerID = tx[~sfLoanBrokerID])
|
if (auto const brokerID = tx[~sfLoanBrokerID])
|
||||||
{
|
{
|
||||||
// Modify an existing LoanBroker
|
// Modify an existing LoanBroker
|
||||||
auto const sleBroker = view.read(keylet::loanbroker(*brokerID));
|
auto broker = view.peek(keylet::loanbroker(*brokerID));
|
||||||
|
|
||||||
assert(0);
|
if (auto const data = tx[~sfData])
|
||||||
|
broker->at(sfData) = *data;
|
||||||
|
if (auto const debtMax = tx[~sfDebtMaximum])
|
||||||
|
broker->at(sfDebtMaximum) = *debtMax;
|
||||||
|
|
||||||
|
view.update(broker);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -160,7 +165,7 @@ LoanBrokerSet::doApply()
|
|||||||
|
|
||||||
if (auto const ter = dirLink(view, account_, broker))
|
if (auto const ter = dirLink(view, account_, broker))
|
||||||
return ter;
|
return ter;
|
||||||
if (auto const ter = dirLink(view, vaultPseudoID, broker))
|
if (auto const ter = dirLink(view, vaultPseudoID, broker, sfVaultNode))
|
||||||
return ter;
|
return ter;
|
||||||
|
|
||||||
adjustOwnerCount(view, owner, 1, j_);
|
adjustOwnerCount(view, owner, 1, j_);
|
||||||
@@ -188,7 +193,7 @@ LoanBrokerSet::doApply()
|
|||||||
broker->at(sfData) = *data;
|
broker->at(sfData) = *data;
|
||||||
if (auto const rate = tx[~sfManagementFeeRate])
|
if (auto const rate = tx[~sfManagementFeeRate])
|
||||||
broker->at(sfManagementFeeRate) = *rate;
|
broker->at(sfManagementFeeRate) = *rate;
|
||||||
if (auto const debtMax = tx[~sfDebtMaximum]; debtMax)
|
if (auto const debtMax = tx[~sfDebtMaximum])
|
||||||
broker->at(sfDebtMaximum) = *debtMax;
|
broker->at(sfDebtMaximum) = *debtMax;
|
||||||
if (auto const coverMin = tx[~sfCoverRateMinimum])
|
if (auto const coverMin = tx[~sfCoverRateMinimum])
|
||||||
broker->at(sfCoverRateMinimum) = *coverMin;
|
broker->at(sfCoverRateMinimum) = *coverMin;
|
||||||
@@ -198,7 +203,7 @@ LoanBrokerSet::doApply()
|
|||||||
view.insert(broker);
|
view.insert(broker);
|
||||||
}
|
}
|
||||||
|
|
||||||
return temDISABLED;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -502,7 +502,11 @@ dirNext(
|
|||||||
describeOwnerDir(AccountID const& account);
|
describeOwnerDir(AccountID const& account);
|
||||||
|
|
||||||
[[nodiscard]] TER
|
[[nodiscard]] TER
|
||||||
dirLink(ApplyView& view, AccountID const& owner, std::shared_ptr<SLE>& object);
|
dirLink(
|
||||||
|
ApplyView& view,
|
||||||
|
AccountID const& owner,
|
||||||
|
std::shared_ptr<SLE>& object,
|
||||||
|
SF_UINT64 const& node = sfOwnerNode);
|
||||||
|
|
||||||
AccountID
|
AccountID
|
||||||
pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey);
|
pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey);
|
||||||
|
|||||||
@@ -1030,13 +1030,17 @@ describeOwnerDir(AccountID const& account)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TER
|
TER
|
||||||
dirLink(ApplyView& view, AccountID const& owner, std::shared_ptr<SLE>& object)
|
dirLink(
|
||||||
|
ApplyView& view,
|
||||||
|
AccountID const& owner,
|
||||||
|
std::shared_ptr<SLE>& object,
|
||||||
|
SF_UINT64 const& node)
|
||||||
{
|
{
|
||||||
auto const page = view.dirInsert(
|
auto const page = view.dirInsert(
|
||||||
keylet::ownerDir(owner), object->key(), describeOwnerDir(owner));
|
keylet::ownerDir(owner), object->key(), describeOwnerDir(owner));
|
||||||
if (!page)
|
if (!page)
|
||||||
return tecDIR_FULL; // LCOV_EXCL_LINE
|
return tecDIR_FULL; // LCOV_EXCL_LINE
|
||||||
object->setFieldU64(sfOwnerNode, *page);
|
object->setFieldU64(node, *page);
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user