mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-02 00:45:58 +00:00
Compare commits
23 Commits
ximinez/le
...
ximinez/le
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3eaddcc2bc | ||
|
|
da9a483b79 | ||
|
|
f447827474 | ||
|
|
ff39388b93 | ||
|
|
d9a44dbbbc | ||
|
|
07497322de | ||
|
|
86e71daa86 | ||
|
|
d5d6b0c7cb | ||
|
|
f665463050 | ||
|
|
c7d73fb938 | ||
|
|
c6ff9882f8 | ||
|
|
f9027bb88f | ||
|
|
992a62a95a | ||
|
|
1484ec6640 | ||
|
|
0d119161cf | ||
|
|
a224e089e6 | ||
|
|
295c8bddae | ||
|
|
c2b3cd4069 | ||
|
|
ef3fa22144 | ||
|
|
e961d85819 | ||
|
|
12ceb8bc86 | ||
|
|
078afb51d9 | ||
|
|
bfac68e308 |
@@ -3176,6 +3176,24 @@ requireAuth(
|
||||
!isTesSuccess(err))
|
||||
return err;
|
||||
}
|
||||
|
||||
// requireAuth is also recursive if the _account_ is a vault
|
||||
auto const sleAccount = view.read(keylet::account(account));
|
||||
if (!sleAccount)
|
||||
return tefINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
if (sleAccount->isFieldPresent(sfVaultID))
|
||||
{
|
||||
auto const sleVault =
|
||||
view.read(keylet::vault(sleAccount->getFieldH256(sfVaultID)));
|
||||
if (!sleVault)
|
||||
return tefINTERNAL; // LCOV_EXCL_LINE
|
||||
auto const ownerAcct = sleVault->getAccountID(sfOwner);
|
||||
if (auto const err =
|
||||
requireAuth(view, mptIssue, ownerAcct, authType, depth + 1);
|
||||
!isTesSuccess(err))
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
auto const mptokenID = keylet::mptoken(mptID.key, account);
|
||||
|
||||
@@ -2358,6 +2358,18 @@ class Vault_test : public beast::unit_test::suite
|
||||
.amount = asset(100)});
|
||||
env(tx, ter(tecNO_AUTH));
|
||||
|
||||
// Withdrawal to other (authorized) accounts doesn't work.
|
||||
// Issuer would have to VaultClawback
|
||||
tx[sfDestination] = issuer.human();
|
||||
env(tx, ter(tecNO_AUTH));
|
||||
tx[sfDestination] = owner.human();
|
||||
env(tx, ter(tecNO_AUTH));
|
||||
env.close();
|
||||
|
||||
// Issuer reauthorizes
|
||||
mptt.authorize({.account = issuer, .holder = depositor});
|
||||
env.close();
|
||||
|
||||
// Withdrawal to other (authorized) accounts works
|
||||
tx[sfDestination] = issuer.human();
|
||||
env(tx);
|
||||
@@ -2368,6 +2380,13 @@ class Vault_test : public beast::unit_test::suite
|
||||
env.close();
|
||||
}
|
||||
|
||||
// Re-unauthorize
|
||||
mptt.authorize(
|
||||
{.account = issuer,
|
||||
.holder = depositor,
|
||||
.flags = tfMPTUnauthorize});
|
||||
env.close();
|
||||
|
||||
{
|
||||
// Cannot deposit some more
|
||||
auto tx = vault.deposit(
|
||||
|
||||
@@ -187,9 +187,9 @@ class Feature_test : public beast::unit_test::suite
|
||||
BEAST_EXPECTS(jrr[jss::status] == jss::success, "status");
|
||||
jrr.removeMember(jss::status);
|
||||
BEAST_EXPECT(jrr.size() == 1);
|
||||
BEAST_EXPECT(
|
||||
jrr.isMember("12523DF04B553A0B1AD74F42DDB741DE8DC06A03FC089A0EF197E"
|
||||
"2A87F1D8107"));
|
||||
BEAST_EXPECT(jrr.isMember(
|
||||
"740352F2412A9909880C23A559FCECEDA3BE2126FED62FC7660D6"
|
||||
"28A06927F11"));
|
||||
auto feature = *(jrr.begin());
|
||||
|
||||
BEAST_EXPECTS(feature[jss::name] == "fixAMMOverflowOffer", "name");
|
||||
|
||||
@@ -547,6 +547,14 @@ tryOverpayment(
|
||||
|
||||
auto const deltas = rounded - newRounded;
|
||||
|
||||
// The change in loan management fee is equal to the change between the old
|
||||
// and the new outstanding management fees
|
||||
XRPL_ASSERT_PARTS(
|
||||
deltas.managementFee ==
|
||||
rounded.managementFeeDue - managementFeeOutstanding,
|
||||
"ripple::detail::tryOverpayment",
|
||||
"no fee change");
|
||||
|
||||
auto const hypotheticalValueOutstanding =
|
||||
rounded.valueOutstanding - deltas.principal;
|
||||
|
||||
@@ -561,7 +569,6 @@ tryOverpayment(
|
||||
"the loan. Ignore the overpayment";
|
||||
return Unexpected(tesSUCCESS);
|
||||
}
|
||||
|
||||
return LoanPaymentParts{
|
||||
// Principal paid is the reduction in principal outstanding
|
||||
.principalPaid = deltas.principal,
|
||||
@@ -676,12 +683,6 @@ doOverpayment(
|
||||
"ripple::detail::doOverpayment",
|
||||
"principal change agrees");
|
||||
|
||||
XRPL_ASSERT_PARTS(
|
||||
overpaymentComponents.trackedManagementFeeDelta ==
|
||||
managementFeeOutstandingProxy - managementFeeOutstanding,
|
||||
"ripple::detail::doOverpayment",
|
||||
"no fee change");
|
||||
|
||||
// I'm not 100% sure the following asserts are correct. If in doubt, and
|
||||
// everything else works, remove any that cause trouble.
|
||||
|
||||
@@ -712,13 +713,6 @@ doOverpayment(
|
||||
"ripple::detail::doOverpayment",
|
||||
"principal payment matches");
|
||||
|
||||
XRPL_ASSERT_PARTS(
|
||||
loanPaymentParts.feePaid ==
|
||||
overpaymentComponents.untrackedManagementFee +
|
||||
overpaymentComponents.trackedManagementFeeDelta,
|
||||
"ripple::detail::doOverpayment",
|
||||
"fee payment matches");
|
||||
|
||||
// All validations passed, so update the proxy objects (which will
|
||||
// modify the actual Loan ledger object)
|
||||
totalValueOutstandingProxy = totalValueOutstanding;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <xrpld/app/tx/detail/VaultWithdraw.h>
|
||||
//
|
||||
#include <xrpld/app/tx/detail/Payment.h>
|
||||
|
||||
#include <xrpl/ledger/CredentialHelpers.h>
|
||||
#include <xrpl/ledger/View.h>
|
||||
@@ -197,7 +199,7 @@ VaultWithdraw::doApply()
|
||||
assetsAvailable -= assetsWithdrawn;
|
||||
view().update(vault);
|
||||
|
||||
auto const& vaultAccount = vault->at(sfAccount);
|
||||
AccountID const& vaultAccount = vault->at(sfAccount);
|
||||
// Transfer shares from depositor to vault.
|
||||
if (auto const ter = accountSend(
|
||||
view(),
|
||||
|
||||
Reference in New Issue
Block a user