diff --git a/AMMBid_8cpp_source.html b/AMMBid_8cpp_source.html
index a07e443a13..e83d485ae5 100644
--- a/AMMBid_8cpp_source.html
+++ b/AMMBid_8cpp_source.html
@@ -519,11 +519,11 @@ $(document).ready(function() { init_codefold(0); });
std::uint32_t constexpr TOTAL_TIME_SLOT_SECS
std::uint16_t constexpr AUCTION_SLOT_TIME_INTERVALS
std::optional< std::uint8_t > ammAuctionTimeSlot(std::uint64_t current, STObject const &auctionSlot)
Get time slot of the auction slot.
-TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
+TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
bool ammEnabled(Rules const &)
Return true if required AMM amendments are enabled.
@ current
This was a new validation and was added.
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
std::uint32_t constexpr AUCTION_SLOT_MIN_FEE_FRACTION
STAmount adjustLPTokens(STAmount const &lptAMMBalance, STAmount const &lpTokens, IsDeposit isDeposit)
Adjust LP tokens to deposit/withdraw.
STAmount ammLPHolds(ReadView const &view, Currency const &cur1, Currency const &cur2, AccountID const &ammAccount, AccountID const &lpAccount, beast::Journal const j)
Get the balance of LP tokens.
diff --git a/AMMClawback_8cpp_source.html b/AMMClawback_8cpp_source.html
index 51f4335b7c..72e2a45d9e 100644
--- a/AMMClawback_8cpp_source.html
+++ b/AMMClawback_8cpp_source.html
@@ -492,7 +492,7 @@ $(document).ready(function() { init_codefold(0); });
-TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
+TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
Expected< std::tuple< STAmount, STAmount, STAmount >, TER > ammHolds(ReadView const &view, SLE const &ammSle, std::optional< Issue > const &optIssue1, std::optional< Issue > const &optIssue2, FreezeHandling freezeHandling, beast::Journal const j)
Get AMM pool and LP token balances.
diff --git a/AMMCreate_8cpp_source.html b/AMMCreate_8cpp_source.html
index 32dc8ebe06..b4a90defef 100644
--- a/AMMCreate_8cpp_source.html
+++ b/AMMCreate_8cpp_source.html
@@ -503,10 +503,10 @@ $(document).ready(function() { init_codefold(0); });
bool ammEnabled(Rules const &)
Return true if required AMM amendments are enabled.
Issue ammLPTIssue(Currency const &cur1, Currency const &cur2, AccountID const &ammAccountID)
Calculate LPT Issue from AMM asset pair.
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)
-TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
void initializeFeeAuctionVote(ApplyView &view, std::shared_ptr< SLE > &ammSle, AccountID const &account, Issue const &lptIssue, std::uint16_t tfee)
Initialize Auction and Voting slots and set the trading/discounted fee.
static std::pair< TER, bool > applyCreate(ApplyContext &ctx_, Sandbox &sb, AccountID const &account_, beast::Journal j_)
Expected< std::shared_ptr< SLE >, TER > createPseudoAccount(ApplyView &view, uint256 const &pseudoOwnerKey, SField const &ownerField)
Create pseudo-account, storing pseudoOwnerKey into ownerField.
diff --git a/AMMDeposit_8cpp_source.html b/AMMDeposit_8cpp_source.html
index 24b4c61ec6..9a5c137402 100644
--- a/AMMDeposit_8cpp_source.html
+++ b/AMMDeposit_8cpp_source.html
@@ -1129,10 +1129,10 @@ $(document).ready(function() { init_codefold(0); });
STAmount ammAssetIn(STAmount const &asset1Balance, STAmount const &lptAMMBalance, STAmount const &lpTokens, std::uint16_t tfee)
Calculate asset deposit given LP Tokens.
bool ammEnabled(Rules const &)
Return true if required AMM amendments are enabled.
constexpr std::uint32_t tfOneAssetLPToken
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
STAmount getRoundedLPTokens(Rules const &rules, STAmount const &balance, Number const &frac, IsDeposit isDeposit)
Round AMM deposit/withdrawal LPToken amount.
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
-TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
STAmount adjustLPTokens(STAmount const &lptAMMBalance, STAmount const &lpTokens, IsDeposit isDeposit)
Adjust LP tokens to deposit/withdraw.
Number feeMult(std::uint16_t tfee)
Get fee multiplier (1 - tfee) @tfee trading fee in basis points.
void initializeFeeAuctionVote(ApplyView &view, std::shared_ptr< SLE > &ammSle, AccountID const &account, Issue const &lptIssue, std::uint16_t tfee)
Initialize Auction and Voting slots and set the trading/discounted fee.
diff --git a/AMMExtended__test_8cpp_source.html b/AMMExtended__test_8cpp_source.html
index ca153909fd..782886b727 100644
--- a/AMMExtended__test_8cpp_source.html
+++ b/AMMExtended__test_8cpp_source.html
@@ -4239,7 +4239,7 @@ $(document).ready(function() { init_codefold(0); });
Seed generateSeed(std::string const &passPhrase)
Generate a seed deterministically.
constexpr std::uint32_t tfSetFreeze
constexpr std::uint32_t tfSetNoRipple
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
bool to_currency(Currency &, std::string const &)
Tries to convert a string to a Currency, returns true on success.
diff --git a/AMMOffer_8h_source.html b/AMMOffer_8h_source.html
index 157380e812..b5310f28fb 100644
--- a/AMMOffer_8h_source.html
+++ b/AMMOffer_8h_source.html
@@ -259,7 +259,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
diff --git a/AMMUtils_8cpp_source.html b/AMMUtils_8cpp_source.html
index 6233c4967a..5f1404ed2b 100644
--- a/AMMUtils_8cpp_source.html
+++ b/AMMUtils_8cpp_source.html
@@ -683,7 +683,7 @@ $(document).ready(function() { init_codefold(0); });
LedgerEntryType
Identifiers for on-ledger objects.
STAmount ammAccountHolds(ReadView const &view, AccountID const &ammAccountID, Issue const &issue)
Returns total amount held by AMM for the given token.
Number root(Number f, unsigned d)
-TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
+TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
std::uint16_t constexpr maxDeletableAMMTrustLines
The maximum number of trustlines to delete as part of AMM account deletion cleanup.
TERSubset< CanCvtToTER > TER
bool withinRelativeDistance(Quality const &calcQuality, Quality const &reqQuality, Number const &dist)
Check if the relative distance between the qualities is within the requested distance.
diff --git a/AMMWithdraw_8cpp_source.html b/AMMWithdraw_8cpp_source.html
index 86d863c462..a24a02f5d9 100644
--- a/AMMWithdraw_8cpp_source.html
+++ b/AMMWithdraw_8cpp_source.html
@@ -1236,16 +1236,16 @@ $(document).ready(function() { init_codefold(0); });
constexpr std::uint32_t tfWithdrawMask
TER deleteAMMAccount(Sandbox &view, Issue const &asset, Issue const &asset2, beast::Journal j)
Delete trustlines to AMM.
std::pair< STAmount, STAmount > adjustAssetOutByTokens(Rules const &rules, STAmount const &balance, STAmount const &amount, STAmount const &lptAMMBalance, STAmount const &tokens, std::uint16_t tfee)
-TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
+TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
constexpr std::uint32_t tfLimitLPToken
bool ammEnabled(Rules const &)
Return true if required AMM amendments are enabled.
constexpr std::uint32_t tfOneAssetLPToken
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
STAmount getRoundedLPTokens(Rules const &rules, STAmount const &balance, Number const &frac, IsDeposit isDeposit)
Round AMM deposit/withdrawal LPToken amount.
static std::optional< STAmount > tokensWithdraw(STAmount const &lpTokens, std::optional< STAmount > const &tokensIn, std::uint32_t flags)
Expected< bool, TER > verifyAndAdjustLPTokenBalance(Sandbox &sb, STAmount const &lpTokens, std::shared_ptr< SLE > &ammSle, AccountID const &account)
Due to rounding, the LPTokenBalance of the last LP might not match the LP's trustline balance.
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
-TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
STAmount adjustLPTokens(STAmount const &lptAMMBalance, STAmount const &lpTokens, IsDeposit isDeposit)
Adjust LP tokens to deposit/withdraw.
constexpr std::uint32_t tfTwoAsset
STAmount ammLPHolds(ReadView const &view, Currency const &cur1, Currency const &cur2, AccountID const &ammAccount, AccountID const &lpAccount, beast::Journal const j)
Get the balance of LP tokens.
diff --git a/ApplyContext_8cpp_source.html b/ApplyContext_8cpp_source.html
index 3d01b4925f..4ca6f368a9 100644
--- a/ApplyContext_8cpp_source.html
+++ b/ApplyContext_8cpp_source.html
@@ -294,7 +294,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
std::string to_string(base_uint< Bits, Tag > const &a)
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
diff --git a/ApplyContext_8h_source.html b/ApplyContext_8h_source.html
index cd3d078281..a3ade3373e 100644
--- a/ApplyContext_8h_source.html
+++ b/ApplyContext_8h_source.html
@@ -287,7 +287,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
diff --git a/ApplyStateTable_8cpp_source.html b/ApplyStateTable_8cpp_source.html
index 3da770ad81..a7a6024746 100644
--- a/ApplyStateTable_8cpp_source.html
+++ b/ApplyStateTable_8cpp_source.html
@@ -896,7 +896,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
LedgerEntryType
Identifiers for on-ledger objects.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
diff --git a/ApplyStateTable_8h_source.html b/ApplyStateTable_8h_source.html
index cf6c3589dd..e7e542022b 100644
--- a/ApplyStateTable_8h_source.html
+++ b/ApplyStateTable_8h_source.html
@@ -293,7 +293,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
diff --git a/ApplyViewImpl_8cpp_source.html b/ApplyViewImpl_8cpp_source.html
index c3254db754..dca947c921 100644
--- a/ApplyViewImpl_8cpp_source.html
+++ b/ApplyViewImpl_8cpp_source.html
@@ -165,7 +165,7 @@ $(document).ready(function() { init_codefold(0); });
detail::ApplyStateTable items_
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
diff --git a/ApplyViewImpl_8h_source.html b/ApplyViewImpl_8h_source.html
index a6f183d318..58c0ccd8f7 100644
--- a/ApplyViewImpl_8h_source.html
+++ b/ApplyViewImpl_8h_source.html
@@ -183,7 +183,7 @@ $(document).ready(function() { init_codefold(0); });
ApplyFlags flags() const override
Returns the tx apply flags.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
diff --git a/BookTip_8cpp_source.html b/BookTip_8cpp_source.html
index fc60200568..b0795ad360 100644
--- a/BookTip_8cpp_source.html
+++ b/BookTip_8cpp_source.html
@@ -188,7 +188,7 @@ $(document).ready(function() { init_codefold(0); });
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
uint256 getQualityNext(uint256 const &uBase)
uint256 getBookBase(Book const &book)
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
diff --git a/CancelOffer_8cpp_source.html b/CancelOffer_8cpp_source.html
index ab38d9cca7..8c359d5d9d 100644
--- a/CancelOffer_8cpp_source.html
+++ b/CancelOffer_8cpp_source.html
@@ -190,7 +190,7 @@ $(document).ready(function() { init_codefold(0); });
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
TERSubset< CanCvtToNotTEC > NotTEC
State information when determining if a tx is likely to claim a fee.
diff --git a/CanonicalTXSet_8cpp_source.html b/CanonicalTXSet_8cpp_source.html
index 9e852867e9..fa462dc9c3 100644
--- a/CanonicalTXSet_8cpp_source.html
+++ b/CanonicalTXSet_8cpp_source.html
@@ -196,7 +196,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool operator<(Slice const &lhs, Slice const &rhs) noexcept
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
diff --git a/CashCheck_8cpp_source.html b/CashCheck_8cpp_source.html
index 72fd4c8c51..ea6166fd8b 100644
--- a/CashCheck_8cpp_source.html
+++ b/CashCheck_8cpp_source.html
@@ -670,7 +670,7 @@ $(document).ready(function() { init_codefold(0); });
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
-TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
+TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
StrandResult< TInAmt, TOutAmt > flow(PaymentSandbox const &baseView, Strand const &strand, std::optional< TInAmt > const &maxIn, TOutAmt const &out, beast::Journal j)
Request out amount from a strand.
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
@@ -692,7 +692,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
std::string to_string(base_uint< Bits, Tag > const &a)
-TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
+TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
TERSubset< CanCvtToNotTEC > NotTEC
XRPAmount xrpLiquid(ReadView const &view, AccountID const &id, std::int32_t ownerCountAdj, beast::Journal j)
diff --git a/Clawback_8cpp_source.html b/Clawback_8cpp_source.html
index eacd36b6aa..0c5d1074b0 100644
--- a/Clawback_8cpp_source.html
+++ b/Clawback_8cpp_source.html
@@ -448,7 +448,7 @@ $(document).ready(function() { init_codefold(0); });
-TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
+TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
static TER applyHelper(ApplyContext &ctx)
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
diff --git a/CreateOffer_8cpp_source.html b/CreateOffer_8cpp_source.html
index 100bfa7dc5..0b07d0224d 100644
--- a/CreateOffer_8cpp_source.html
+++ b/CreateOffer_8cpp_source.html
@@ -1211,7 +1211,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTecClaim(TER x) noexcept
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
bool isGlobalFrozen(ReadView const &view, AccountID const &issuer)
diff --git a/DeleteAccount_8cpp_source.html b/DeleteAccount_8cpp_source.html
index f53dc29350..e1f72a0bda 100644
--- a/DeleteAccount_8cpp_source.html
+++ b/DeleteAccount_8cpp_source.html
@@ -618,7 +618,7 @@ $(document).ready(function() { init_codefold(0); });
bool cdirNext(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the next entry in the directory, advancing the index.
TERSubset< CanCvtToTER > TER
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
diff --git a/DirectStep_8cpp_source.html b/DirectStep_8cpp_source.html
index 6c44e05934..551c82fd19 100644
--- a/DirectStep_8cpp_source.html
+++ b/DirectStep_8cpp_source.html
@@ -1307,7 +1307,7 @@ $(document).ready(function() { init_codefold(0); });
bool checkNear(IOUAmount const &expected, IOUAmount const &actual)
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
-TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
+TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
IOUAmount mulRatio(IOUAmount const &amt, std::uint32_t num, std::uint32_t den, bool roundUp)
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
diff --git a/Escrow_8cpp_source.html b/Escrow_8cpp_source.html
index dc7cf8f950..c7a3ceb995 100644
--- a/Escrow_8cpp_source.html
+++ b/Escrow_8cpp_source.html
@@ -1682,7 +1682,7 @@ $(document).ready(function() { init_codefold(0); });
TER escrowCreatePreclaimHelper< MPTIssue >(PreclaimContext const &ctx, AccountID const &account, AccountID const &dest, STAmount const &amount)
bool isXRP(AccountID const &c)
-TER rippleLockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, STAmount const &saAmount, beast::Journal j)
+TER rippleLockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, STAmount const &saAmount, beast::Journal j)
static TER escrowFinishPreclaimHelper(PreclaimContext const &ctx, AccountID const &dest, STAmount const &amount)
bool canAdd(STAmount const &amt1, STAmount const &amt2)
Safely checks if two STAmount values can be added without overflow, underflow, or precision loss.
TER escrowLockApplyHelper< Issue >(ApplyView &view, AccountID const &issuer, AccountID const &sender, STAmount const &amount, beast::Journal journal)
@@ -1701,8 +1701,8 @@ $(document).ready(function() { init_codefold(0); });
STAmount divideRound(STAmount const &amount, Rate const &rate, bool roundUp)
TER verifyDepositPreauth(STTx const &tx, ApplyView &view, AccountID const &src, AccountID const &dst, std::shared_ptr< SLE > const &sleDst, beast::Journal j)
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
-TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, AccountID const &uGranteeID, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
-TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, AccountID const &uGranteeID, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
+TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
constexpr HashRouterFlags SF_CF_VALID
@@ -1710,7 +1710,7 @@ $(document).ready(function() { init_codefold(0); });
TER escrowCreatePreclaimHelper< Issue >(PreclaimContext const &ctx, AccountID const &account, AccountID const &dest, STAmount const &amount)
-TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
+TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
static bool checkCondition(Slice f, Slice c)
TER escrowUnlockApplyHelper< MPTIssue >(ApplyView &view, Rate lockedRate, std::shared_ptr< SLE > const &sleDest, STAmount const &xrpBalance, STAmount const &amount, AccountID const &issuer, AccountID const &sender, AccountID const &receiver, bool createAsset, beast::Journal journal)
static NotTEC escrowCreatePreflightHelper(PreflightContext const &ctx)
@@ -1734,7 +1734,7 @@ $(document).ready(function() { init_codefold(0); });
@ tecINSUFFICIENT_RESERVE
-TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
+TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
constexpr HashRouterFlags SF_CF_INVALID
@@ -1742,8 +1742,8 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
TER escrowFinishPreclaimHelper< MPTIssue >(PreclaimContext const &ctx, AccountID const &dest, STAmount const &amount)
NotTEC escrowCreatePreflightHelper< Issue >(PreflightContext const &ctx)
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
-TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
constexpr std::uint32_t tfUniversalMask
TER escrowCancelPreclaimHelper< Issue >(PreclaimContext const &ctx, AccountID const &account, STAmount const &amount)
TER escrowLockApplyHelper< MPTIssue >(ApplyView &view, AccountID const &issuer, AccountID const &sender, STAmount const &amount, beast::Journal journal)
diff --git a/Flow__test_8cpp_source.html b/Flow__test_8cpp_source.html
index 8a00a97de2..38549c1fb3 100644
--- a/Flow__test_8cpp_source.html
+++ b/Flow__test_8cpp_source.html
@@ -1584,7 +1584,7 @@ $(document).ready(function() { init_codefold(0); });
TERSubset< CanCvtToTER > TER
constexpr std::uint32_t tfSetNoRipple
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
diff --git a/InvariantCheck_8cpp_source.html b/InvariantCheck_8cpp_source.html
index 599700205f..d33be013b6 100644
--- a/InvariantCheck_8cpp_source.html
+++ b/InvariantCheck_8cpp_source.html
@@ -3551,7 +3551,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
STAmount ammLPTokens(STAmount const &asset1, STAmount const &asset2, Issue const &lptIssue)
Calculate LP Tokens given AMM pool reserves.
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
@ transactionID
transaction plus signature to give transaction ID
MPTID makeMptID(std::uint32_t sequence, AccountID const &account)
std::vector< SField const * > const & getPseudoAccountFields()
diff --git a/InvariantCheck_8h_source.html b/InvariantCheck_8h_source.html
index 90d2cef3cc..a83085b89c 100644
--- a/InvariantCheck_8h_source.html
+++ b/InvariantCheck_8h_source.html
@@ -953,7 +953,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
diff --git a/Invariants__test_8cpp_source.html b/Invariants__test_8cpp_source.html
index eaa65b1e9e..21f5e9ddc2 100644
--- a/Invariants__test_8cpp_source.html
+++ b/Invariants__test_8cpp_source.html
@@ -3684,7 +3684,7 @@ $(document).ready(function() { init_codefold(0); });
std::array< keyletDesc< AccountID const & >, 6 > const directAccountKeylets
base_uint< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
-TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
+TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
AccountID pseudoAccountAddress(ReadView const &view, uint256 const &pseudoOwnerKey)
diff --git a/Livecache__test_8cpp_source.html b/Livecache__test_8cpp_source.html
index 12a549674f..cd08168473 100644
--- a/Livecache__test_8cpp_source.html
+++ b/Livecache__test_8cpp_source.html
@@ -387,7 +387,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static auto sum(TCollection const &col)
std::enable_if_t< std::is_integral< Integral >::value, Integral > rand_int()
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Describes a connectible peer address along with some metadata.
beast::IP::Endpoint address
diff --git a/MPTokenAuthorize_8cpp_source.html b/MPTokenAuthorize_8cpp_source.html
index 91fabc1007..2a7e4b8004 100644
--- a/MPTokenAuthorize_8cpp_source.html
+++ b/MPTokenAuthorize_8cpp_source.html
@@ -323,7 +323,7 @@ $(document).ready(function() { init_codefold(0); });
-TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
+TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
State information when determining if a tx is likely to claim a fee.
diff --git a/NFTokenAcceptOffer_8cpp_source.html b/NFTokenAcceptOffer_8cpp_source.html
index f51252b780..474f07ca3d 100644
--- a/NFTokenAcceptOffer_8cpp_source.html
+++ b/NFTokenAcceptOffer_8cpp_source.html
@@ -751,7 +751,7 @@ $(document).ready(function() { init_codefold(0); });
STAmount multiply(STAmount const &amount, Rate const &rate)
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
@ tecNFTOKEN_OFFER_TYPE_MISMATCH
diff --git a/OfferStream_8cpp_source.html b/OfferStream_8cpp_source.html
index 41245fcea8..9e6a0bafaa 100644
--- a/OfferStream_8cpp_source.html
+++ b/OfferStream_8cpp_source.html
@@ -586,7 +586,7 @@ $(document).ready(function() { init_codefold(0); });
void erase(STObject &st, TypedField< U > const &f)
Remove a field in an STObject.
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
XRPAmount toAmount< XRPAmount >(STAmount const &amt)
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
diff --git a/Offer_8h_source.html b/Offer_8h_source.html
index 0bcebc7603..e317bd9af9 100644
--- a/Offer_8h_source.html
+++ b/Offer_8h_source.html
@@ -525,7 +525,7 @@ $(document).ready(function() { init_codefold(0); });
bool isFeatureEnabled(uint256 const &feature)
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
std::ostream & operator<<(std::ostream &out, base_uint< Bits, Tag > const &u)
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
std::string to_string(base_uint< Bits, Tag > const &a)
std::optional< Rules > const & getCurrentTransactionRules()
diff --git a/PayChan_8cpp_source.html b/PayChan_8cpp_source.html
index 686e670196..d85a664c50 100644
--- a/PayChan_8cpp_source.html
+++ b/PayChan_8cpp_source.html
@@ -810,7 +810,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
constexpr std::uint32_t tfClose
constexpr std::uint32_t tfPayChanClaimMask
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
constexpr std::uint32_t tfUniversalMask
TERSubset< CanCvtToTER > TER
diff --git a/PaymentSandbox_8cpp_source.html b/PaymentSandbox_8cpp_source.html
index eaf93703bf..53e4f4ae58 100644
--- a/PaymentSandbox_8cpp_source.html
+++ b/PaymentSandbox_8cpp_source.html
@@ -551,7 +551,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool isXRP(AccountID const &c)
AccountID const & xrpAccount()
Compute AccountID from public key.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
diff --git a/PaymentSandbox__test_8cpp_source.html b/PaymentSandbox__test_8cpp_source.html
index e07439a249..87e7907c35 100644
--- a/PaymentSandbox__test_8cpp_source.html
+++ b/PaymentSandbox__test_8cpp_source.html
@@ -579,14 +579,14 @@ $(document).ready(function() { init_codefold(0); });
AccountID const & xrpAccount()
Compute AccountID from public key.
-TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
+TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
constexpr std::uint32_t tfPassive
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
constexpr std::uint32_t tfPartialPayment
Currency const & xrpCurrency()
XRP currency.
-TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
+TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
Issue const & noIssue()
Returns an asset specifier that represents no account and currency.
-TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
+TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
constexpr std::uint32_t tfNoRippleDirect
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
diff --git a/Payment_8cpp_source.html b/Payment_8cpp_source.html
index f92de59f0b..8eca3c8abe 100644
--- a/Payment_8cpp_source.html
+++ b/Payment_8cpp_source.html
@@ -908,14 +908,14 @@ $(document).ready(function() { init_codefold(0); });
STAmount multiply(STAmount const &amount, Rate const &rate)
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
TER verifyDepositPreauth(STTx const &tx, ApplyView &view, AccountID const &src, AccountID const &dst, std::shared_ptr< SLE > const &sleDst, beast::Journal j)
-TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
constexpr std::uint32_t tfPartialPayment
void loadGranularPermission(std::shared_ptr< SLE const > const &delegate, TxType const &type, std::unordered_set< GranularPermissionType > &granularPermissions)
Load the granular permissions granted to the delegate account for the specified transaction type.
-TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
+TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
TER checkTxPermission(std::shared_ptr< SLE const > const &delegate, STTx const &tx)
Check if the delegate account has permission to execute the transaction.
@ tecNO_DELEGATE_PERMISSION
diff --git a/RCLConsensus_8cpp_source.html b/RCLConsensus_8cpp_source.html
index b0e9b02c9b..7e38165566 100644
--- a/RCLConsensus_8cpp_source.html
+++ b/RCLConsensus_8cpp_source.html
@@ -1438,7 +1438,7 @@ $(document).ready(function() { init_codefold(0); });
boost::intrusive_ptr< SHAMapItem > make_shamapitem(uint256 const &tag, Slice data)
Rules makeRulesGivenLedger(DigestAwareReadView const &ledger, Rules const ¤t)
std::string to_string(base_uint< Bits, Tag > const &a)
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
@ ledgerMaster
ledger master data for signing
@ proposal
proposal for signing
diff --git a/RCLConsensus_8h_source.html b/RCLConsensus_8h_source.html
index 13155a77e5..8c6f8eb510 100644
--- a/RCLConsensus_8h_source.html
+++ b/RCLConsensus_8h_source.html
@@ -613,7 +613,7 @@ $(document).ready(function() { init_codefold(0); });
base_uint< 160, detail::NodeIDTag > NodeID
NodeID is a 160-bit hash representing one node.
boost::outcome_v2::result< T, std::error_code > Result
ConsensusPhase
Phases of consensus for a single ledger round.
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
@ ledgerMaster
ledger master data for signing
@ proposal
proposal for signing
diff --git a/STNumber__test_8cpp_source.html b/STNumber__test_8cpp_source.html
index c6722beb95..42258734d4 100644
--- a/STNumber__test_8cpp_source.html
+++ b/STNumber__test_8cpp_source.html
@@ -405,7 +405,7 @@ $(document).ready(function() { init_codefold(0); });
Issue const & noIssue()
Returns an asset specifier that represents no account and currency.
STNumber numberFromJson(SField const &field, Json::Value const &value)
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
diff --git a/SetTrust_8cpp_source.html b/SetTrust_8cpp_source.html
index f0755f0085..daafa8c240 100644
--- a/SetTrust_8cpp_source.html
+++ b/SetTrust_8cpp_source.html
@@ -911,7 +911,7 @@ $(document).ready(function() { init_codefold(0); });
constexpr std::uint32_t tfSetfAuth
constexpr std::uint32_t tfClearFreeze
TER checkTxPermission(std::shared_ptr< SLE const > const &delegate, STTx const &tx)
Check if the delegate account has permission to execute the transaction.
-TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
+TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
@ tecNO_DELEGATE_PERMISSION
@@ -925,7 +925,7 @@ $(document).ready(function() { init_codefold(0); });
constexpr std::uint32_t tfClearDeepFreeze
constexpr std::uint32_t tfTrustSetMask
std::string to_string(base_uint< Bits, Tag > const &a)
-TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
+TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
constexpr std::uint32_t tfSetFreeze
constexpr std::uint32_t tfSetNoRipple
diff --git a/StrandFlow_8h_source.html b/StrandFlow_8h_source.html
index 4a2b112253..24f581efc7 100644
--- a/StrandFlow_8h_source.html
+++ b/StrandFlow_8h_source.html
@@ -1003,7 +1003,7 @@ $(document).ready(function() { init_codefold(0); });
std::string to_string(base_uint< Bits, Tag > const &a)
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
bool withinRelativeDistance(Quality const &calcQuality, Quality const &reqQuality, Number const &dist)
Check if the relative distance between the qualities is within the requested distance.
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
diff --git a/Transactor_8cpp_source.html b/Transactor_8cpp_source.html
index 31ad58b35c..2b185ce21b 100644
--- a/Transactor_8cpp_source.html
+++ b/Transactor_8cpp_source.html
@@ -1694,10 +1694,10 @@ $(document).ready(function() { init_codefold(0); });
@ SigBad
Signature is bad. Didn't do local checks.
std::string to_string(base_uint< Bits, Tag > const &a)
static void removeDeletedTrustLines(ApplyView &view, std::vector< uint256 > const &trustLines, beast::Journal viewJ)
-bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
constexpr std::uint32_t tfUniversalMask
XRPAmount scaleFeeLoad(XRPAmount fee, LoadFeeTrack const &feeTrack, Fees const &fees, bool bUnlimited)
-TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
+TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
@@ -1711,7 +1711,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTecClaim(TER x) noexcept
NotTEC preflight0(PreflightContext const &ctx, std::uint32_t flagMask)
Performs early sanity checks on the txid.
-TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
TERSubset< CanCvtToNotTEC > NotTEC
constexpr std::uint32_t tfInnerBatchTxn
diff --git a/VaultClawback_8cpp_source.html b/VaultClawback_8cpp_source.html
index 6b1c6b4eb1..fcd4c63266 100644
--- a/VaultClawback_8cpp_source.html
+++ b/VaultClawback_8cpp_source.html
@@ -457,10 +457,10 @@ $(document).ready(function() { init_codefold(0); });
-std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
-std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
+std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
std::string transToken(TER code)
@@ -476,7 +476,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
std::string to_string(base_uint< Bits, Tag > const &a)
-TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
+TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
TERSubset< CanCvtToNotTEC > NotTEC
diff --git a/VaultCreate_8cpp_source.html b/VaultCreate_8cpp_source.html
index 5f2107a098..468f4ba11b 100644
--- a/VaultCreate_8cpp_source.html
+++ b/VaultCreate_8cpp_source.html
@@ -414,7 +414,7 @@ $(document).ready(function() { init_codefold(0); });
std::uint8_t constexpr vaultStrategyFirstComeFirstServe
Vault withdrawal policies.
TER canAddHolding(ReadView const &view, Asset const &asset)
-TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
+TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
constexpr std::uint32_t const tfVaultCreateMask
std::uint8_t constexpr vaultDefaultIOUScale
Default IOU scale factor for a Vault.
bool isPseudoAccount(std::shared_ptr< SLE const > sleAcct)
diff --git a/VaultDelete_8cpp_source.html b/VaultDelete_8cpp_source.html
index 8f074ab1c3..750cdc0a3a 100644
--- a/VaultDelete_8cpp_source.html
+++ b/VaultDelete_8cpp_source.html
@@ -320,7 +320,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
std::string to_string(base_uint< Bits, Tag > const &a)
-TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
+TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
TERSubset< CanCvtToNotTEC > NotTEC
diff --git a/VaultDeposit_8cpp_source.html b/VaultDeposit_8cpp_source.html
index dddc6b517a..173a1f7a5d 100644
--- a/VaultDeposit_8cpp_source.html
+++ b/VaultDeposit_8cpp_source.html
@@ -290,135 +290,134 @@ $(document).ready(function() { init_codefold(0); });
-
-
-
-
-
-
- 211 mptIssuanceID->
value(),
-
-
-
-
-
-
-
-
-
-
-
-
- 224 "ripple::VaultDeposit::doApply : account is owner");
-
-
-
- 228 mptIssuanceID->
value(),
- 229 sleIssuance->at(sfIssuer),
-
-
-
-
-
-
-
-
-
- 239 STAmount sharesCreated = {vault->at(sfShareMPTID)}, assetsDeposited;
-
-
-
-
- 244 auto const maybeShares =
-
-
-
- 248 sharesCreated = *maybeShares;
-
- 250 if (sharesCreated == beast::zero)
-
-
- 253 auto const maybeAssets =
-
-
-
- 257 else if (*maybeAssets > amount)
-
-
- 260 JLOG(
j_.
error()) <<
"VaultDeposit: would take more than offered.";
-
-
-
- 264 assetsDeposited = *maybeAssets;
-
-
-
-
-
-
- 271 <<
"VaultDeposit: overflow error with"
- 272 <<
" scale=" << (int)vault->at(sfScale).value()
- 273 <<
", assetsTotal=" << vault->at(sfAssetsTotal).value()
- 274 <<
", sharesTotal=" << sleIssuance->at(sfOutstandingAmount)
- 275 <<
", amount=" << amount;
-
-
-
-
- 280 sharesCreated.
asset() != assetsDeposited.asset(),
- 281 "ripple::VaultDeposit::doApply : assets are not shares");
-
- 283 vault->at(sfAssetsTotal) += assetsDeposited;
- 284 vault->at(sfAssetsAvailable) += assetsDeposited;
-
-
-
- 288 auto const maximum = *vault->at(sfAssetsMaximum);
- 289 if (maximum != 0 && *vault->at(sfAssetsTotal) > maximum)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 307 assetsDeposited.asset(),
-
-
-
-
-
- 313 JLOG(
j_.
error()) <<
"VaultDeposit: negative balance of account assets.";
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ 210 mptIssuanceID->
value(),
+
+
+
+
+
+
+
+
+
+
+
+
+ 223 "ripple::VaultDeposit::doApply : account is owner");
+
+
+
+ 227 mptIssuanceID->
value(),
+ 228 sleIssuance->at(sfIssuer),
+
+
+
+
+
+
+
+
+
+ 238 STAmount sharesCreated = {vault->at(sfShareMPTID)}, assetsDeposited;
+
+
+
+
+ 243 auto const maybeShares =
+
+
+
+ 247 sharesCreated = *maybeShares;
+
+ 249 if (sharesCreated == beast::zero)
+
+
+ 252 auto const maybeAssets =
+
+
+
+ 256 else if (*maybeAssets > amount)
+
+
+ 259 JLOG(
j_.
error()) <<
"VaultDeposit: would take more than offered.";
+
+
+
+ 263 assetsDeposited = *maybeAssets;
+
+
+
+
+
+
+ 270 <<
"VaultDeposit: overflow error with"
+ 271 <<
" scale=" << (int)vault->at(sfScale).value()
+ 272 <<
", assetsTotal=" << vault->at(sfAssetsTotal).value()
+ 273 <<
", sharesTotal=" << sleIssuance->at(sfOutstandingAmount)
+ 274 <<
", amount=" << amount;
+
+
+
+
+ 279 sharesCreated.
asset() != assetsDeposited.asset(),
+ 280 "ripple::VaultDeposit::doApply : assets are not shares");
+
+ 282 vault->at(sfAssetsTotal) += assetsDeposited;
+ 283 vault->at(sfAssetsAvailable) += assetsDeposited;
+
+
+
+ 287 auto const maximum = *vault->at(sfAssetsMaximum);
+ 288 if (maximum != 0 && *vault->at(sfAssetsTotal) > maximum)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 306 assetsDeposited.asset(),
+
+
+
+
+
+ 312 JLOG(
j_.
error()) <<
"VaultDeposit: negative balance of account assets.";
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -429,6 +428,7 @@ $(document).ready(function() { init_codefold(0); });
A currency issued by an account.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
+virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
Asset const & asset() const
@@ -449,16 +449,16 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
-std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
+std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
-std::optional< STAmount > assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
+std::optional< STAmount > assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
-TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
-TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
@@ -476,8 +476,8 @@ $(document).ready(function() { init_codefold(0); });
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
bool isTesSuccess(TER x) noexcept
-TER enforceMPTokenAuthorization(ApplyView &view, MPTID const &mptIssuanceID, AccountID const &account, XRPAmount const &priorBalance, beast::Journal j)
Enforce account has MPToken to match its authorization.
-TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
+TER enforceMPTokenAuthorization(ApplyView &view, MPTID const &mptIssuanceID, AccountID const &account, XRPAmount const &priorBalance, beast::Journal j)
Enforce account has MPToken to match its authorization.
+TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
TERSubset< CanCvtToNotTEC > NotTEC
diff --git a/VaultWithdraw_8cpp_source.html b/VaultWithdraw_8cpp_source.html
index 7ac6774ee5..6336c635a0 100644
--- a/VaultWithdraw_8cpp_source.html
+++ b/VaultWithdraw_8cpp_source.html
@@ -136,325 +136,316 @@ $(document).ready(function() { init_codefold(0); });
-
-
- 57 JLOG(ctx.
j.
debug()) <<
"VaultWithdraw: sfDestinationTag is set but "
- 58 "sfDestination is not";
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
66 auto const assets = ctx.
tx[sfAmount];
+
67 auto const vaultAsset = vault->at(sfAsset);
+
68 auto const vaultShare = vault->at(sfShareMPTID);
+
69 if (assets.asset() != vaultAsset && assets.asset() != vaultShare)
+
-
72 auto const assets = ctx.
tx[sfAmount];
-
73 auto const vaultAsset = vault->at(sfAsset);
-
74 auto const vaultShare = vault->at(sfShareMPTID);
-
75 if (assets.asset() != vaultAsset && assets.asset() != vaultShare)
-
-
-
78 if (vaultAsset.native())
-
-
80 else if (vaultAsset.holds<
MPTIssue>())
-
-
82 auto mptID = vaultAsset.get<
MPTIssue>().getMptID();
-
-
-
-
-
-
-
-
90 <<
"VaultWithdraw: vault assets are non-transferable.";
-
-
-
-
-
95 else if (vaultAsset.holds<
Issue>())
-
-
-
-
-
-
-
-
103 <<
"VaultWithdraw: missing issuer of vault assets.";
-
-
-
-
-
-
-
-
-
-
113 JLOG(ctx.
j.
error()) <<
"VaultWithdraw: invalid withdrawal policy.";
-
-
-
+
72 if (vaultAsset.native())
+
+
74 else if (vaultAsset.holds<
MPTIssue>())
+
+
76 auto mptID = vaultAsset.get<
MPTIssue>().getMptID();
+
+
+
+
+
+
+
+
84 <<
"VaultWithdraw: vault assets are non-transferable.";
+
+
+
+
+
89 else if (vaultAsset.holds<
Issue>())
+
+
+
+
+
+
+
+
97 <<
"VaultWithdraw: missing issuer of vault assets.";
+
+
+
+
+
+
+
+
+
+
107 JLOG(ctx.
j.
error()) <<
"VaultWithdraw: invalid withdrawal policy.";
+
+
+
+
+
112 auto const account = ctx.
tx[sfAccount];
+
113 auto const dstAcct = ctx.
tx[~sfDestination].value_or(account);
+
+
115 if (sleDst ==
nullptr)
+
-
118 auto const account = ctx.
tx[sfAccount];
-
119 auto const dstAcct = [&]() ->
AccountID {
-
-
-
-
-
-
-
-
-
128 if (account != dstAcct)
-
-
-
131 if (sleDst ==
nullptr)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
150 if (
auto const ter =
requireAuth(ctx.
view, vaultAsset, dstAcct, authType);
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
135 if (
auto const ter =
requireAuth(ctx.
view, vaultAsset, dstAcct, authType);
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
156 auto const mptIssuanceID = *((*vault)[sfShareMPTID]);
+
+
+
+
+
161 JLOG(
j_.
error()) <<
"VaultWithdraw: missing issuance of vault shares.";
+
+
+
+
+
+
+
+
-
171 auto const mptIssuanceID = *((*vault)[sfShareMPTID]);
-
-
-
-
-
176 JLOG(
j_.
error()) <<
"VaultWithdraw: missing issuance of vault shares.";
-
-
-
-
-
-
-
-
-
-
186 auto const amount =
ctx_.
tx[sfAmount];
-
187 Asset const vaultAsset = vault->at(sfAsset);
-
188 MPTIssue const share{mptIssuanceID};
-
-
-
-
-
193 if (amount.asset() == vaultAsset)
-
-
-
-
197 auto const maybeShares =
-
-
-
-
201 sharesRedeemed = *maybeShares;
-
-
-
204 if (sharesRedeemed == beast::zero)
-
-
206 auto const maybeAssets =
-
-
-
-
210 assetsWithdrawn = *maybeAssets;
-
-
212 else if (amount.asset() == share)
-
-
-
215 sharesRedeemed = amount;
-
216 auto const maybeAssets =
-
-
-
-
220 assetsWithdrawn = *maybeAssets;
-
-
-
-
-
-
-
-
-
-
230 <<
"VaultWithdraw: overflow error with"
-
231 <<
" scale=" << (int)vault->at(sfScale).value()
-
232 <<
", assetsTotal=" << vault->at(sfAssetsTotal).value()
-
233 <<
", sharesTotal=" << sleIssuance->at(sfOutstandingAmount)
-
234 <<
", amount=" << amount.value();
-
-
-
-
-
-
-
-
-
-
244 j_) < sharesRedeemed)
-
-
246 JLOG(
j_.
debug()) <<
"VaultWithdraw: account doesn't hold enough shares";
-
-
-
-
250 auto assetsAvailable = vault->at(sfAssetsAvailable);
-
251 auto assetsTotal = vault->at(sfAssetsTotal);
-
252 [[maybe_unused]]
auto const lossUnrealized = vault->at(sfLossUnrealized);
-
-
254 lossUnrealized <= (assetsTotal - assetsAvailable),
-
255 "ripple::VaultWithdraw::doApply : loss and assets do balance");
-
-
-
-
-
260 if (*assetsAvailable < assetsWithdrawn)
-
-
262 JLOG(
j_.
debug()) <<
"VaultWithdraw: vault doesn't hold enough assets";
-
-
-
-
266 assetsTotal -= assetsWithdrawn;
-
267 assetsAvailable -= assetsWithdrawn;
-
-
-
270 auto const& vaultAccount = vault->at(sfAccount);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
292 <<
"VaultWithdraw: removed empty MPToken for vault shares"
-
-
-
-
-
-
-
-
300 <<
"VaultWithdraw: failed to remove MPToken for vault shares"
-
-
-
-
-
-
-
-
-
-
310 auto const dstAcct = [&]() ->
AccountID {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
331 assetsWithdrawn.
asset(),
-
-
-
-
-
-
337 JLOG(
j_.
error()) <<
"VaultWithdraw: negative balance of vault assets.";
-
-
-
-
-
-
+
171 auto const amount =
ctx_.
tx[sfAmount];
+
172 Asset const vaultAsset = vault->at(sfAsset);
+
173 MPTIssue const share{mptIssuanceID};
+
+
+
+
+
178 if (amount.asset() == vaultAsset)
+
+
+
+
182 auto const maybeShares =
+
+
+
+
186 sharesRedeemed = *maybeShares;
+
+
+
189 if (sharesRedeemed == beast::zero)
+
+
191 auto const maybeAssets =
+
+
+
+
195 assetsWithdrawn = *maybeAssets;
+
+
197 else if (amount.asset() == share)
+
+
+
200 sharesRedeemed = amount;
+
201 auto const maybeAssets =
+
+
+
+
205 assetsWithdrawn = *maybeAssets;
+
+
+
+
+
+
+
+
+
+
215 <<
"VaultWithdraw: overflow error with"
+
216 <<
" scale=" << (int)vault->at(sfScale).value()
+
217 <<
", assetsTotal=" << vault->at(sfAssetsTotal).value()
+
218 <<
", sharesTotal=" << sleIssuance->at(sfOutstandingAmount)
+
219 <<
", amount=" << amount.value();
+
+
+
+
+
+
+
+
+
+
229 j_) < sharesRedeemed)
+
+
231 JLOG(
j_.
debug()) <<
"VaultWithdraw: account doesn't hold enough shares";
+
+
+
+
235 auto assetsAvailable = vault->at(sfAssetsAvailable);
+
236 auto assetsTotal = vault->at(sfAssetsTotal);
+
237 [[maybe_unused]]
auto const lossUnrealized = vault->at(sfLossUnrealized);
+
+
239 lossUnrealized <= (assetsTotal - assetsAvailable),
+
240 "ripple::VaultWithdraw::doApply : loss and assets do balance");
+
+
+
+
+
245 if (*assetsAvailable < assetsWithdrawn)
+
+
247 JLOG(
j_.
debug()) <<
"VaultWithdraw: vault doesn't hold enough assets";
+
+
+
+
251 assetsTotal -= assetsWithdrawn;
+
252 assetsAvailable -= assetsWithdrawn;
+
+
+
255 auto const& vaultAccount = vault->at(sfAccount);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
277 <<
"VaultWithdraw: removed empty MPToken for vault shares"
+
+
+
+
+
+
+
+
285 <<
"VaultWithdraw: failed to remove MPToken for vault shares"
+
+
+
+
+
+
+
+
+
+
+
296 if (!vaultAsset.
native() &&
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
321 assetsWithdrawn.
asset(),
+
+
+
+
+
+
327 JLOG(
j_.
error()) <<
"VaultWithdraw: negative balance of vault assets.";
+
+
+
+
+
+
-
-
+
+
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
+
+
AccountID const & getIssuer() const
A currency issued by an account.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
Asset const & asset() const
-
AccountID getAccountID(SField const &field) const
bool isFieldPresent(SField const &field) const
+
-
static TER preclaim(PreclaimContext const &ctx)
+
static TER preclaim(PreclaimContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
-
-
+
Keylet mptIssuance(std::uint32_t seq, AccountID const &issuer) noexcept
Keylet vault(AccountID const &owner, std::uint32_t seq) noexcept
Keylet account(AccountID const &id) noexcept
AccountID root.
@@ -468,19 +459,20 @@ $(document).ready(function() { init_codefold(0); });
-
+
-
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
-
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
-
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
+
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
-
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
+
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
std::string transToken(TER code)
+
@@ -491,11 +483,12 @@ $(document).ready(function() { init_codefold(0); });
+
TER addEmptyHolding(ApplyView &view, AccountID const &accountID, XRPAmount priorBalance, Issue const &issue, beast::Journal journal)
Any transactors that call addEmptyHolding() in doApply must call canAddHolding() in preflight with th...
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
bool isTesSuccess(TER x) noexcept
std::string to_string(base_uint< Bits, Tag > const &a)
std::uint8_t constexpr vaultStrategyFirstComeFirstServe
Vault withdrawal policies.
-
TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
+
TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
TERSubset< CanCvtToNotTEC > NotTEC
diff --git a/VaultWithdraw_8h_source.html b/VaultWithdraw_8h_source.html
index 4d7dca1270..f47476fad3 100644
--- a/VaultWithdraw_8h_source.html
+++ b/VaultWithdraw_8h_source.html
@@ -139,9 +139,9 @@ $(document).ready(function() { init_codefold(0); });
-
static TER preclaim(PreclaimContext const &ctx)
+
static TER preclaim(PreclaimContext const &ctx)
static NotTEC preflight(PreflightContext const &ctx)
-
+
static constexpr ConsequencesFactoryType ConsequencesFactory
VaultWithdraw(ApplyContext &ctx)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
diff --git a/Vault__test_8cpp_source.html b/Vault__test_8cpp_source.html
index 80839edb9b..f87b1a7628 100644
--- a/Vault__test_8cpp_source.html
+++ b/Vault__test_8cpp_source.html
@@ -146,1631 +146,1631 @@ $(document).ready(function() { init_codefold(0); });
61 using namespace test::jtx;
-
-
63 auto const testSequence = [
this](
-
-
-
66 Account
const& issuer,
-
-
68 Account
const& depositor,
-
69 Account
const& charlie,
-
-
-
72 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
73 tx[sfData] =
"AFEED00E";
-
74 tx[sfAssetsMaximum] = asset(100).number();
-
-
-
77 BEAST_EXPECT(env.le(keylet));
-
-
-
80 auto const [share, vaultAccount] =
-
-
-
-
-
85 auto const vault = env.le(keylet);
-
86 BEAST_EXPECT(vault !=
nullptr);
-
87 if (asset.raw().holds<
Issue>() && !asset.raw().
native())
-
88 BEAST_EXPECT(vault->at(sfScale) == 6);
-
-
90 BEAST_EXPECT(vault->at(sfScale) == 0);
-
-
-
93 BEAST_EXPECT(shares !=
nullptr);
-
94 if (asset.raw().holds<
Issue>() && !asset.raw().
native())
-
95 BEAST_EXPECT(shares->at(sfAssetScale) == 6);
-
-
97 BEAST_EXPECT(shares->at(sfAssetScale) == 0);
-
-
-
100 Account(
"vault", vault->at(sfAccount))};
-
-
102 auto const shares = share.raw().get<
MPTIssue>();
-
103 env.memoize(vaultAccount);
-
-
-
106 Account alice{
"alice"};
-
107 Account dave{
"dave"};
+
62 Account issuer{
"issuer"};
+
63 Account owner{
"owner"};
+
64 Account depositor{
"depositor"};
+
65 Account charlie{
"charlie"};
+
+
+
68 auto const testSequence = [&,
this](
+
+
+
+
+
73 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
74 tx[sfData] =
"AFEED00E";
+
75 tx[sfAssetsMaximum] = asset(100).number();
+
+
+
78 BEAST_EXPECT(env.le(keylet));
+
+
+
81 auto const [share, vaultAccount] =
+
+
+
+
+
86 auto const vault = env.le(keylet);
+
87 BEAST_EXPECT(vault !=
nullptr);
+
88 if (asset.raw().holds<
Issue>() && !asset.raw().
native())
+
89 BEAST_EXPECT(vault->at(sfScale) == 6);
+
+
91 BEAST_EXPECT(vault->at(sfScale) == 0);
+
+
+
94 BEAST_EXPECT(shares !=
nullptr);
+
95 if (asset.raw().holds<
Issue>() && !asset.raw().
native())
+
96 BEAST_EXPECT(shares->at(sfAssetScale) == 6);
+
+
98 BEAST_EXPECT(shares->at(sfAssetScale) == 0);
+
+
+
101 Account(
"vault", vault->at(sfAccount))};
+
+
103 auto const shares = share.raw().get<
MPTIssue>();
+
104 env.memoize(vaultAccount);
+
+
+
107 Account alice{
"alice"};
108 Account erin{
"erin"};
-
109 env.fund(XRP(1000), alice, dave, erin);
+
109 env.fund(XRP(1000), alice, erin);
-
-
-
-
-
115 testcase(prefix +
" fail to deposit more than assets held");
-
116 auto tx = vault.deposit(
-
117 {.depositor = depositor,
-
-
119 .amount = asset(10000)});
-
-
-
-
-
-
125 testcase(prefix +
" deposit non-zero amount");
-
126 auto tx = vault.deposit(
-
127 {.depositor = depositor,
-
-
129 .amount = asset(50)});
-
-
-
-
133 env.balance(depositor, shares) == share(50 * scale));
-
-
-
-
137 testcase(prefix +
" deposit non-zero amount again");
-
138 auto tx = vault.deposit(
-
139 {.depositor = depositor,
-
-
141 .amount = asset(50)});
-
-
-
-
145 env.balance(depositor, shares) == share(100 * scale));
-
-
-
-
149 testcase(prefix +
" fail to delete non-empty vault");
-
150 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
156 testcase(prefix +
" fail to update because wrong owner");
-
157 auto tx = vault.set({.owner = issuer, .id = keylet.
key});
-
158 tx[sfAssetsMaximum] = asset(50).number();
-
-
-
-
-
-
-
165 prefix +
" fail to set maximum lower than current amount");
-
166 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
167 tx[sfAssetsMaximum] = asset(50).number();
-
-
-
-
-
-
173 testcase(prefix +
" set maximum higher than current amount");
-
174 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
175 tx[sfAssetsMaximum] = asset(150).number();
-
-
-
-
-
-
181 testcase(prefix +
" set maximum is idempotent, set it again");
-
182 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
183 tx[sfAssetsMaximum] = asset(150).number();
-
-
-
-
-
-
-
190 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
-
197 testcase(prefix +
" fail to set domain on public vault");
-
198 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
-
205 testcase(prefix +
" fail to deposit more than maximum");
-
206 auto tx = vault.deposit(
-
207 {.depositor = depositor,
-
-
209 .amount = asset(100)});
-
-
-
-
-
-
215 testcase(prefix +
" reset maximum to zero i.e. not enforced");
-
216 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
217 tx[sfAssetsMaximum] = asset(0).number();
-
-
-
-
-
-
223 testcase(prefix +
" fail to withdraw more than assets held");
-
224 auto tx = vault.withdraw(
-
225 {.depositor = depositor,
-
-
227 .amount = asset(1000)});
-
-
-
-
-
-
233 testcase(prefix +
" deposit some more");
-
234 auto tx = vault.deposit(
-
235 {.depositor = depositor,
-
-
237 .amount = asset(100)});
-
-
-
-
241 env.balance(depositor, shares) == share(200 * scale));
-
-
-
-
245 testcase(prefix +
" clawback some");
-
-
-
248 auto tx = vault.clawback(
-
-
-
-
252 .amount = asset(10)});
-
-
-
255 if (!asset.raw().native())
-
-
-
258 env.balance(depositor, shares) == share(190 * scale));
-
-
-
-
-
-
-
-
266 auto tx = vault.clawback(
-
267 {.issuer = issuer, .id = keylet.
key, .holder = depositor});
-
-
-
270 if (!asset.raw().native())
-
-
272 BEAST_EXPECT(env.balance(depositor, shares) == share(0));
-
-
-
275 auto tx = vault.clawback(
-
-
-
-
279 .amount = asset(10)});
-
-
-
-
-
-
285 auto tx = vault.withdraw(
-
286 {.depositor = depositor,
-
-
288 .amount = asset(10)});
-
-
-
-
-
-
-
295 if (!asset.raw().native())
-
-
297 testcase(prefix +
" deposit again");
-
298 auto tx = vault.deposit(
-
299 {.depositor = depositor,
-
-
301 .amount = asset(200)});
-
-
-
-
305 env.balance(depositor, shares) == share(200 * scale));
-
-
-
-
-
310 prefix +
" fail to withdraw to 3rd party lsfDepositAuth");
-
311 auto tx = vault.withdraw(
-
312 {.depositor = depositor,
-
-
314 .amount = asset(100)});
-
315 tx[sfDestination] = alice.human();
-
-
-
-
-
-
321 testcase(prefix +
" fail to withdraw to zero destination");
-
322 auto tx = vault.withdraw(
-
323 {.depositor = depositor,
-
-
325 .amount = asset(1000)});
-
326 tx[sfDestination] =
"0";
-
-
-
-
+
+
+
+
114 testcase(prefix +
" fail to deposit more than assets held");
+
115 auto tx = vault.deposit(
+
116 {.depositor = depositor,
+
+
118 .amount = asset(10000)});
+
+
+
+
+
+
124 testcase(prefix +
" deposit non-zero amount");
+
125 auto tx = vault.deposit(
+
126 {.depositor = depositor,
+
+
128 .amount = asset(50)});
+
+
+
+
132 env.balance(depositor, shares) == share(50 * scale));
+
+
+
+
136 testcase(prefix +
" deposit non-zero amount again");
+
137 auto tx = vault.deposit(
+
138 {.depositor = depositor,
+
+
140 .amount = asset(50)});
+
+
+
+
144 env.balance(depositor, shares) == share(100 * scale));
+
+
+
+
148 testcase(prefix +
" fail to delete non-empty vault");
+
149 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
155 testcase(prefix +
" fail to update because wrong owner");
+
156 auto tx = vault.set({.owner = issuer, .id = keylet.
key});
+
157 tx[sfAssetsMaximum] = asset(50).number();
+
+
+
+
+
+
+
164 prefix +
" fail to set maximum lower than current amount");
+
165 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
166 tx[sfAssetsMaximum] = asset(50).number();
+
+
+
+
+
+
172 testcase(prefix +
" set maximum higher than current amount");
+
173 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
174 tx[sfAssetsMaximum] = asset(150).number();
+
+
+
+
+
+
180 testcase(prefix +
" set maximum is idempotent, set it again");
+
181 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
182 tx[sfAssetsMaximum] = asset(150).number();
+
+
+
+
+
+
+
189 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
196 testcase(prefix +
" fail to set domain on public vault");
+
197 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
204 testcase(prefix +
" fail to deposit more than maximum");
+
205 auto tx = vault.deposit(
+
206 {.depositor = depositor,
+
+
208 .amount = asset(100)});
+
+
+
+
+
+
214 testcase(prefix +
" reset maximum to zero i.e. not enforced");
+
215 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
216 tx[sfAssetsMaximum] = asset(0).number();
+
+
+
+
+
+
222 testcase(prefix +
" fail to withdraw more than assets held");
+
223 auto tx = vault.withdraw(
+
224 {.depositor = depositor,
+
+
226 .amount = asset(1000)});
+
+
+
+
+
+
232 testcase(prefix +
" deposit some more");
+
233 auto tx = vault.deposit(
+
234 {.depositor = depositor,
+
+
236 .amount = asset(100)});
+
+
+
+
240 env.balance(depositor, shares) == share(200 * scale));
+
+
+
+
244 testcase(prefix +
" clawback some");
+
+
+
247 auto tx = vault.clawback(
+
+
+
+
251 .amount = asset(10)});
+
+
+
254 if (!asset.raw().native())
+
+
+
257 env.balance(depositor, shares) == share(190 * scale));
+
+
+
+
+
+
+
+
265 auto tx = vault.clawback(
+
266 {.issuer = issuer, .id = keylet.
key, .holder = depositor});
+
+
+
269 if (!asset.raw().native())
+
+
271 BEAST_EXPECT(env.balance(depositor, shares) == share(0));
+
+
+
274 auto tx = vault.clawback(
+
+
+
+
278 .amount = asset(10)});
+
+
+
+
+
+
284 auto tx = vault.withdraw(
+
285 {.depositor = depositor,
+
+
287 .amount = asset(10)});
+
+
+
+
+
+
+
294 if (!asset.raw().native())
+
+
296 testcase(prefix +
" deposit again");
+
297 auto tx = vault.deposit(
+
298 {.depositor = depositor,
+
+
300 .amount = asset(200)});
+
+
+
+
304 env.balance(depositor, shares) == share(200 * scale));
+
+
+
+
+
309 prefix +
" fail to withdraw to 3rd party lsfDepositAuth");
+
310 auto tx = vault.withdraw(
+
311 {.depositor = depositor,
+
+
313 .amount = asset(100)});
+
314 tx[sfDestination] = alice.human();
+
+
+
+
+
+
320 testcase(prefix +
" fail to withdraw to zero destination");
+
321 auto tx = vault.withdraw(
+
322 {.depositor = depositor,
+
+
324 .amount = asset(1000)});
+
325 tx[sfDestination] =
"0";
+
+
+
+
+
330 if (!asset.raw().native())
-
-
334 " fail to withdraw with tag but without destination");
-
335 auto tx = vault.withdraw(
-
336 {.depositor = depositor,
-
-
338 .amount = asset(1000)});
-
339 tx[sfDestinationTag] =
"0";
-
+
333 prefix +
" fail to withdraw to 3rd party no authorization");
+
334 auto tx = vault.withdraw(
+
335 {.depositor = depositor,
+
+
337 .amount = asset(100)});
+
338 tx[sfDestination] = erin.human();
+
+
-
344 if (!asset.raw().native())
-
-
-
347 prefix +
" fail to withdraw to 3rd party no authorization");
+
+
+
+
347 " fail to withdraw to 3rd party lsfRequireDestTag");
348 auto tx = vault.withdraw(
349 {.depositor = depositor,
351 .amount = asset(100)});
-
352 tx[sfDestination] = erin.human();
-
-
-
-
-
-
-
-
-
361 " fail to withdraw to 3rd party lsfRequireDestTag");
-
362 auto tx = vault.withdraw(
-
363 {.depositor = depositor,
-
-
365 .amount = asset(100)});
-
366 tx[sfDestination] = dave.human();
-
-
-
-
-
-
372 testcase(prefix +
" withdraw to authorized 3rd party");
-
373 auto tx = vault.withdraw(
-
374 {.depositor = depositor,
-
-
376 .amount = asset(100)});
-
377 tx[sfDestination] = charlie.human();
-
-
-
-
381 env.balance(depositor, shares) == share(100 * scale));
-
-
-
-
385 testcase(prefix +
" withdraw to issuer");
-
386 auto tx = vault.withdraw(
-
387 {.depositor = depositor,
-
-
389 .amount = asset(50)});
-
390 tx[sfDestination] = issuer.human();
-
-
-
-
394 env.balance(depositor, shares) == share(50 * scale));
-
-
-
397 if (!asset.raw().native())
-
-
399 testcase(prefix +
" issuer deposits");
-
400 auto tx = vault.deposit(
-
401 {.depositor = issuer,
-
-
403 .amount = asset(10)});
-
-
-
406 BEAST_EXPECT(env.balance(issuer, shares) == share(10 * scale));
-
-
408 testcase(prefix +
" issuer withdraws");
-
-
410 {.depositor = issuer,
+
352 tx[sfDestination] = dave.human();
+
+
+
+
+
+
358 testcase(prefix +
" withdraw to 3rd party lsfRequireDestTag");
+
359 auto tx = vault.withdraw(
+
360 {.depositor = depositor,
+
+
362 .amount = asset(50)});
+
363 tx[sfDestination] = dave.human();
+
364 tx[sfDestinationTag] =
"0";
+
+
+
+
+
+
370 testcase(prefix +
" deposit again");
+
371 auto tx = vault.deposit(
+
372 {.depositor = dave, .id = keylet.
key, .amount = asset(50)});
+
+
+
+
+
+
378 testcase(prefix +
" fail to withdraw lsfRequireDestTag");
+
379 auto tx = vault.withdraw(
+
380 {.depositor = dave, .id = keylet.
key, .amount = asset(50)});
+
+
+
+
+
+
386 testcase(prefix +
" withdraw with tag");
+
387 auto tx = vault.withdraw(
+
388 {.depositor = dave, .id = keylet.
key, .amount = asset(50)});
+
389 tx[sfDestinationTag] =
"0";
+
+
+
+
+
+
395 testcase(prefix +
" withdraw to authorized 3rd party");
+
396 auto tx = vault.withdraw(
+
397 {.depositor = depositor,
+
+
399 .amount = asset(50)});
+
400 tx[sfDestination] = charlie.human();
+
+
+
+
404 env.balance(depositor, shares) == share(100 * scale));
+
+
+
+
408 testcase(prefix +
" withdraw to issuer");
+
409 auto tx = vault.withdraw(
+
410 {.depositor = depositor,
-
412 .amount = share(10 * scale)});
-
-
-
415 BEAST_EXPECT(env.balance(issuer, shares) == share(0 * scale));
-
-
-
-
419 testcase(prefix +
" withdraw remaining assets");
-
420 auto tx = vault.withdraw(
-
421 {.depositor = depositor,
-
-
423 .amount = asset(50)});
-
-
-
426 BEAST_EXPECT(env.balance(depositor, shares) == share(0));
-
-
428 if (!asset.raw().native())
-
-
430 auto tx = vault.clawback(
-
-
-
-
434 .amount = asset(0)});
-
-
-
-
-
-
440 auto tx = vault.withdraw(
-
441 {.depositor = depositor,
-
-
443 .amount = share(10)});
-
-
-
-
-
-
449 if (!asset.raw().native() && asset.raw().holds<
Issue>())
-
-
451 testcase(prefix +
" temporary authorization for 3rd party");
-
452 env(trust(erin, asset(1000)));
-
453 env(trust(issuer, asset(0), erin,
tfSetfAuth));
-
454 env(pay(issuer, erin, asset(10)));
-
-
-
457 auto tx = vault.deposit(
-
458 {.depositor = erin, .id = keylet.
key, .amount = asset(10)});
-
-
-
-
462 auto tx = pay(erin, depositor, share(10 * scale));
-
-
-
-
-
-
-
-
470 {.depositor = depositor,
-
-
472 .amount = asset(1)}));
-
-
-
-
-
+
412 .amount = asset(50)});
+
413 tx[sfDestination] = issuer.human();
+
+
+
+
417 env.balance(depositor, shares) == share(50 * scale));
+
+
+
420 if (!asset.raw().native())
+
+
422 testcase(prefix +
" issuer deposits");
+
423 auto tx = vault.deposit(
+
424 {.depositor = issuer,
+
+
426 .amount = asset(10)});
+
+
+
429 BEAST_EXPECT(env.balance(issuer, shares) == share(10 * scale));
+
+
431 testcase(prefix +
" issuer withdraws");
+
+
433 {.depositor = issuer,
+
+
435 .amount = share(10 * scale)});
+
+
+
438 BEAST_EXPECT(env.balance(issuer, shares) == share(0 * scale));
+
+
+
+
442 testcase(prefix +
" withdraw remaining assets");
+
443 auto tx = vault.withdraw(
+
444 {.depositor = depositor,
+
+
446 .amount = asset(50)});
+
+
+
449 BEAST_EXPECT(env.balance(depositor, shares) == share(0));
+
+
451 if (!asset.raw().native())
+
+
453 auto tx = vault.clawback(
+
+
+
+
457 .amount = asset(0)});
+
+
+
+
+
+
463 auto tx = vault.withdraw(
+
464 {.depositor = depositor,
+
+
466 .amount = share(10)});
+
+
+
+
+
+
472 if (!asset.raw().native() && asset.raw().holds<
Issue>())
+
+
474 testcase(prefix +
" temporary authorization for 3rd party");
+
475 env(trust(erin, asset(1000)));
+
476 env(trust(issuer, asset(0), erin,
tfSetfAuth));
+
477 env(pay(issuer, erin, asset(10)));
-
479 testcase(prefix +
" withdraw to authorized 3rd party");
-
-
-
482 {.depositor = depositor,
-
-
484 .amount = asset(10)});
-
485 tx[sfDestination] = erin.human();
-
-
-
-
-
490 env(pay(erin, issuer, asset(10)));
-
-
-
493 testcase(prefix +
" fail to pay to unauthorized 3rd party");
-
494 env(trust(erin, asset(0)));
-
-
-
-
498 env(pay(depositor, erin, share(1)), ter{
tecNO_LINE});
-
-
-
-
-
503 {.depositor = depositor,
-
-
505 .amount = asset(1)});
-
-
-
-
-
-
511 testcase(prefix +
" fail to delete because wrong owner");
-
512 auto tx = vault.del({.owner = issuer, .id = keylet.
key});
-
+
+
480 auto tx = vault.deposit(
+
481 {.depositor = erin, .id = keylet.
key, .amount = asset(10)});
+
+
+
+
485 auto tx = pay(erin, depositor, share(10 * scale));
+
+
+
+
+
+
+
+
493 {.depositor = depositor,
+
+
495 .amount = asset(1)}));
+
+
+
+
+
+
+
502 testcase(prefix +
" withdraw to authorized 3rd party");
+
+
+
505 {.depositor = depositor,
+
+
507 .amount = asset(10)});
+
508 tx[sfDestination] = erin.human();
+
+
+
+
+
513 env(pay(erin, issuer, asset(10)));
-
-
-
-
518 testcase(prefix +
" delete empty vault");
-
519 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
522 BEAST_EXPECT(!env.le(keylet));
-
-
-
-
526 auto testCases = [
this, &testSequence](
-
-
-
-
530 Account
const& issuer,
-
531 Account
const& owner,
-
532 Account
const& depositor,
-
533 Account
const& charlie)> setup) {
-
534 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
535 Account issuer{
"issuer"};
-
536 Account owner{
"owner"};
-
537 Account depositor{
"depositor"};
-
538 Account charlie{
"charlie"};
-
-
540 env.fund(XRP(1000), issuer, owner, depositor, charlie);
-
-
-
-
-
-
-
-
548 PrettyAsset asset = setup(env, issuer, owner, depositor, charlie);
-
-
550 prefix, env, issuer, owner, depositor, charlie, vault, asset);
-
-
-
-
-
-
556 Account
const& issuer,
-
557 Account
const& owner,
-
558 Account
const& depositor,
-
-
-
-
-
-
-
-
566 Account
const& issuer,
-
567 Account
const& owner,
-
568 Account
const& depositor,
-
569 Account
const& charlie) ->
Asset {
-
-
571 env(trust(owner, asset(1000)));
-
572 env(trust(depositor, asset(1000)));
-
573 env(trust(charlie, asset(1000)));
-
574 env(trust(issuer, asset(0), owner,
tfSetfAuth));
-
575 env(trust(issuer, asset(0), depositor,
tfSetfAuth));
-
576 env(trust(issuer, asset(0), charlie,
tfSetfAuth));
-
577 env(pay(issuer, depositor, asset(1000)));
-
-
-
-
-
-
-
-
585 Account
const& issuer,
-
586 Account
const& owner,
-
587 Account
const& depositor,
-
588 Account
const& charlie) ->
Asset {
-
589 MPTTester mptt{env, issuer, mptInitNoFund};
-
-
-
-
-
594 mptt.authorize({.account = depositor});
-
595 mptt.authorize({.account = charlie});
-
596 env(pay(issuer, depositor, asset(1000)));
-
-
-
-
+
+
516 testcase(prefix +
" fail to pay to unauthorized 3rd party");
+
517 env(trust(erin, asset(0)));
+
+
+
+
521 env(pay(depositor, erin, share(1)), ter{
tecNO_LINE});
+
+
+
+
+
526 {.depositor = depositor,
+
+
528 .amount = asset(1)});
+
+
+
+
+
+
534 testcase(prefix +
" fail to delete because wrong owner");
+
535 auto tx = vault.del({.owner = issuer, .id = keylet.
key});
+
+
+
+
+
+
541 testcase(prefix +
" delete empty vault");
+
542 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
545 BEAST_EXPECT(!env.le(keylet));
+
+
+
+
549 auto testCases = [&,
this](
+
+
+
552 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
+
+
555 env.fund(XRP(1000), issuer, owner, depositor, charlie, dave);
+
+
+
+
+
+
+
+
+
+
565 testSequence(prefix, env, vault, asset);
+
+
+
+
+
+
+
572 testCases(
"IOU", [&](Env& env) ->
Asset {
+
+
574 env(trust(owner, asset(1000)));
+
575 env(trust(depositor, asset(1000)));
+
576 env(trust(charlie, asset(1000)));
+
577 env(trust(dave, asset(1000)));
+
578 env(trust(issuer, asset(0), owner,
tfSetfAuth));
+
579 env(trust(issuer, asset(0), depositor,
tfSetfAuth));
+
580 env(trust(issuer, asset(0), charlie,
tfSetfAuth));
+
581 env(trust(issuer, asset(0), dave,
tfSetfAuth));
+
582 env(pay(issuer, depositor, asset(1000)));
+
+
+
+
+
587 testCases(
"MPT", [&](Env& env) ->
Asset {
+
588 MPTTester mptt{env, issuer, mptInitNoFund};
+
+
+
+
592 mptt.authorize({.account = depositor});
+
593 mptt.authorize({.account = charlie});
+
594 mptt.authorize({.account = dave});
+
595 env(pay(issuer, depositor, asset(1000)));
+
+
+
+
-
-
-
-
-
-
605 using namespace test::jtx;
-
-
-
-
-
610 testable_amendments() | featureSingleAssetVault;
-
-
-
613 auto testCase = [&,
this](
-
-
-
616 Account
const& issuer,
-
617 Account
const& owner,
-
-
-
620 CaseArgs args = {}) {
-
621 Env env{*
this, args.features};
-
622 Account issuer{
"issuer"};
-
623 Account owner{
"owner"};
-
-
625 env.fund(XRP(1000), issuer, owner);
-
-
-
-
-
-
-
-
633 env(trust(owner, asset(1000)));
-
634 env(trust(issuer, asset(0), owner,
tfSetfAuth));
-
635 env(pay(issuer, owner, asset(1000)));
-
-
-
638 test(env, issuer, owner, asset, vault);
-
-
-
-
-
643 Account
const& issuer,
-
644 Account
const& owner,
-
-
-
647 testcase(
"disabled single asset vault");
-
-
-
650 vault.create({.owner = owner, .asset = asset});
-
-
-
-
654 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
659 auto tx = vault.deposit(
-
-
-
662 .amount = asset(10)});
-
-
-
-
-
667 auto tx = vault.withdraw(
-
-
-
670 .amount = asset(10)});
-
-
-
-
-
675 auto tx = vault.clawback(
-
-
-
-
679 .amount = asset(10)});
-
-
-
-
-
684 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
688 {.features = testable_amendments() - featureSingleAssetVault});
-
-
690 testCase([&](Env& env,
-
691 Account
const& issuer,
-
692 Account
const& owner,
-
-
-
-
-
697 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
702 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
708 auto tx = vault.deposit(
-
-
-
711 .amount = asset(10)});
-
-
-
-
-
-
717 auto tx = vault.withdraw(
-
-
-
720 .amount = asset(10)});
-
-
-
-
-
-
726 auto tx = vault.clawback(
-
-
-
-
730 .amount = asset(10)});
-
-
-
-
-
-
736 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
742 testCase([&](Env& env,
-
743 Account
const& issuer,
-
744 Account
const& owner,
-
-
-
-
-
749 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
754 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
760 auto tx = vault.deposit(
-
-
-
763 .amount = asset(10)});
-
-
-
-
-
-
769 auto tx = vault.withdraw(
-
-
-
772 .amount = asset(10)});
-
-
-
-
-
-
778 auto tx = vault.clawback(
-
-
-
-
782 .amount = asset(10)});
-
-
-
-
-
-
788 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
-
-
-
797 Account
const& owner,
-
-
-
800 testcase(
"disabled permissioned domain");
-
-
-
803 vault.create({.owner = owner, .asset =
xrpIssue()});
-
-
-
-
-
808 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
814 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
815 tx[sfDomainID] =
"0";
-
-
-
-
819 {.features = (testable_amendments() | featureSingleAssetVault) -
-
820 featurePermissionedDomains});
-
-
822 testCase([&](Env& env,
-
823 Account
const& issuer,
-
824 Account
const& owner,
-
-
-
-
-
-
830 vault.create({.owner = owner, .asset =
xrpIssue()});
-
-
-
833 auto tx = vault.set({
-
-
-
-
-
-
-
-
841 auto tx = vault.deposit(
-
-
-
844 .amount = asset(10)});
-
-
-
-
-
849 auto tx = vault.withdraw(
-
-
-
852 .amount = asset(10)});
-
-
-
-
-
857 auto tx = vault.clawback(
-
-
-
-
861 .amount = asset(10)});
-
-
-
-
-
866 auto tx = vault.del({
-
-
-
-
-
-
-
-
874 testCase([&](Env& env,
-
875 Account
const& issuer,
-
876 Account
const& owner,
-
-
-
-
-
881 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
884 auto tx = vault.clawback(
-
-
-
-
888 .amount = asset(10)});
-
-
-
-
-
893 testCase([&](Env& env,
-
-
895 Account
const& owner,
-
-
-
898 testcase(
"withdraw to bad destination");
-
-
900 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
903 auto tx = vault.withdraw(
-
-
-
906 .amount = asset(10)});
-
907 tx[jss::Destination] =
"0";
-
-
-
-
-
912 testCase([&](Env& env,
-
-
914 Account
const& owner,
-
-
-
-
-
-
-
921 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
928 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
-
936 vault.create({.owner = owner, .asset = asset});
-
-
-
-
940 auto const sleVault = env.le(keylet);
-
941 BEAST_EXPECT(sleVault);
-
942 BEAST_EXPECT((*sleVault)[sfScale] == 18);
-
-
-
-
-
947 vault.create({.owner = owner, .asset = asset});
-
-
-
-
951 auto const sleVault = env.le(keylet);
-
952 BEAST_EXPECT(sleVault);
-
953 BEAST_EXPECT((*sleVault)[sfScale] == 0);
-
-
-
-
-
958 vault.create({.owner = owner, .asset = asset});
-
-
-
961 auto const sleVault = env.le(keylet);
-
962 BEAST_EXPECT(sleVault);
-
963 BEAST_EXPECT((*sleVault)[sfScale] == 6);
-
-
-
-
967 testCase([&](Env& env,
-
-
969 Account
const& owner,
-
-
-
972 testcase(
"create or set invalid data");
-
-
974 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
990 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
996 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
-
1003 testCase([&](Env& env,
-
-
1005 Account
const& owner,
-
-
-
-
-
1010 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
1013 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
1018 testCase([&](Env& env,
-
-
1020 Account
const& owner,
-
-
-
1023 testcase(
"create with invalid metadata");
-
-
1025 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
1029 tx[sfMPTokenMetadata] =
"";
-
-
-
-
-
-
-
-
-
-
-
-
-
1042 testCase([&](Env& env,
-
-
1044 Account
const& owner,
-
-
-
-
-
1049 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
1052 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
1058 testCase([&](Env& env,
-
-
1060 Account
const& owner,
-
-
-
1063 testcase(
"invalid deposit amount");
-
-
1065 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
1068 auto tx = vault.deposit(
-
1069 {.depositor = owner,
-
-
-
-
-
-
-
1076 auto tx = vault.deposit(
-
1077 {.depositor = owner, .id = keylet.
key, .amount = asset(0)});
-
-
-
-
-
1082 testCase([&](Env& env,
-
-
1084 Account
const& owner,
-
-
-
1087 testcase(
"invalid set immutable flag");
-
-
1089 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
1092 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
1098 testCase([&](Env& env,
-
-
1100 Account
const& owner,
-
-
-
1103 testcase(
"invalid withdraw amount");
-
-
1105 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
1108 auto tx = vault.withdraw(
-
1109 {.depositor = owner,
-
-
-
-
-
-
-
1116 auto tx = vault.withdraw(
-
1117 {.depositor = owner, .id = keylet.
key, .amount = asset(0)});
-
-
-
-
-
1122 testCase([&](Env& env,
-
1123 Account
const& issuer,
-
1124 Account
const& owner,
-
-
-
-
-
1129 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
1132 auto tx = vault.clawback(
-
-
-
-
1136 .amount = asset(50)});
-
-
-
-
-
1141 auto tx = vault.clawback(
-
-
-
-
-
-
-
-
-
1150 testCase([&](Env& env,
-
-
1152 Account
const& owner,
-
-
-
-
-
1157 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
1161 tx[sfWithdrawalPolicy] = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
1180 tx[sfDomainID] =
"0";
-
-
-
-
+
+
+
+
+
+
604 using namespace test::jtx;
+
+
+
+
+
609 testable_amendments() | featureSingleAssetVault;
+
+
+
612 auto testCase = [&,
this](
+
+
+
615 Account
const& issuer,
+
616 Account
const& owner,
+
+
+
619 CaseArgs args = {}) {
+
620 Env env{*
this, args.features};
+
621 Account issuer{
"issuer"};
+
622 Account owner{
"owner"};
+
+
624 env.fund(XRP(1000), issuer, owner);
+
+
+
+
+
+
+
+
632 env(trust(owner, asset(1000)));
+
633 env(trust(issuer, asset(0), owner,
tfSetfAuth));
+
634 env(pay(issuer, owner, asset(1000)));
+
+
+
637 test(env, issuer, owner, asset, vault);
+
+
+
+
+
642 Account
const& issuer,
+
643 Account
const& owner,
+
+
+
646 testcase(
"disabled single asset vault");
+
+
+
649 vault.create({.owner = owner, .asset = asset});
+
+
+
+
653 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
658 auto tx = vault.deposit(
+
+
+
661 .amount = asset(10)});
+
+
+
+
+
666 auto tx = vault.withdraw(
+
+
+
669 .amount = asset(10)});
+
+
+
+
+
674 auto tx = vault.clawback(
+
+
+
+
678 .amount = asset(10)});
+
+
+
+
+
683 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
687 {.features = testable_amendments() - featureSingleAssetVault});
+
+
689 testCase([&](Env& env,
+
690 Account
const& issuer,
+
691 Account
const& owner,
+
+
+
+
+
696 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
701 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
707 auto tx = vault.deposit(
+
+
+
710 .amount = asset(10)});
+
+
+
+
+
+
716 auto tx = vault.withdraw(
+
+
+
719 .amount = asset(10)});
+
+
+
+
+
+
725 auto tx = vault.clawback(
+
+
+
+
729 .amount = asset(10)});
+
+
+
+
+
+
735 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
741 testCase([&](Env& env,
+
742 Account
const& issuer,
+
743 Account
const& owner,
+
+
+
+
+
748 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
753 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
759 auto tx = vault.deposit(
+
+
+
762 .amount = asset(10)});
+
+
+
+
+
+
768 auto tx = vault.withdraw(
+
+
+
771 .amount = asset(10)});
+
+
+
+
+
+
777 auto tx = vault.clawback(
+
+
+
+
781 .amount = asset(10)});
+
+
+
+
+
+
787 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
+
+
796 Account
const& owner,
+
+
+
799 testcase(
"disabled permissioned domain");
+
+
+
802 vault.create({.owner = owner, .asset =
xrpIssue()});
+
+
+
+
+
807 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
813 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
814 tx[sfDomainID] =
"0";
+
+
+
+
818 {.features = (testable_amendments() | featureSingleAssetVault) -
+
819 featurePermissionedDomains});
+
+
821 testCase([&](Env& env,
+
822 Account
const& issuer,
+
823 Account
const& owner,
+
+
+
+
+
+
829 vault.create({.owner = owner, .asset =
xrpIssue()});
+
+
+
832 auto tx = vault.set({
+
+
+
+
+
+
+
+
840 auto tx = vault.deposit(
+
+
+
843 .amount = asset(10)});
+
+
+
+
+
848 auto tx = vault.withdraw(
+
+
+
851 .amount = asset(10)});
+
+
+
+
+
856 auto tx = vault.clawback(
+
+
+
+
860 .amount = asset(10)});
+
+
+
+
+
865 auto tx = vault.del({
+
+
+
+
+
+
+
+
873 testCase([&](Env& env,
+
874 Account
const& issuer,
+
875 Account
const& owner,
+
+
+
+
+
880 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
883 auto tx = vault.clawback(
+
+
+
+
887 .amount = asset(10)});
+
+
+
+
+
892 testCase([&](Env& env,
+
+
894 Account
const& owner,
+
+
+
897 testcase(
"withdraw to bad destination");
+
+
899 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
902 auto tx = vault.withdraw(
+
+
+
905 .amount = asset(10)});
+
906 tx[jss::Destination] =
"0";
+
+
+
+
+
911 testCase([&](Env& env,
+
+
913 Account
const& owner,
+
+
+
+
+
+
+
920 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
927 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
+
935 vault.create({.owner = owner, .asset = asset});
+
+
+
+
939 auto const sleVault = env.le(keylet);
+
940 BEAST_EXPECT(sleVault);
+
941 BEAST_EXPECT((*sleVault)[sfScale] == 18);
+
+
+
+
+
946 vault.create({.owner = owner, .asset = asset});
+
+
+
+
950 auto const sleVault = env.le(keylet);
+
951 BEAST_EXPECT(sleVault);
+
952 BEAST_EXPECT((*sleVault)[sfScale] == 0);
+
+
+
+
+
957 vault.create({.owner = owner, .asset = asset});
+
+
+
960 auto const sleVault = env.le(keylet);
+
961 BEAST_EXPECT(sleVault);
+
962 BEAST_EXPECT((*sleVault)[sfScale] == 6);
+
+
+
+
966 testCase([&](Env& env,
+
+
968 Account
const& owner,
+
+
+
971 testcase(
"create or set invalid data");
+
+
973 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
989 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
995 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
1002 testCase([&](Env& env,
+
+
1004 Account
const& owner,
+
+
+
+
+
1009 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
1012 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
1017 testCase([&](Env& env,
+
+
1019 Account
const& owner,
+
+
+
1022 testcase(
"create with invalid metadata");
+
+
1024 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
1028 tx[sfMPTokenMetadata] =
"";
+
+
+
+
+
+
+
+
+
+
+
+
+
1041 testCase([&](Env& env,
+
+
1043 Account
const& owner,
+
+
+
+
+
1048 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
1051 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
1057 testCase([&](Env& env,
+
+
1059 Account
const& owner,
+
+
+
1062 testcase(
"invalid deposit amount");
+
+
1064 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
1067 auto tx = vault.deposit(
+
1068 {.depositor = owner,
+
+
+
+
+
+
+
1075 auto tx = vault.deposit(
+
1076 {.depositor = owner, .id = keylet.
key, .amount = asset(0)});
+
+
+
+
+
1081 testCase([&](Env& env,
+
+
1083 Account
const& owner,
+
+
+
1086 testcase(
"invalid set immutable flag");
+
+
1088 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
1091 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
1097 testCase([&](Env& env,
+
+
1099 Account
const& owner,
+
+
+
1102 testcase(
"invalid withdraw amount");
+
+
1104 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
1107 auto tx = vault.withdraw(
+
1108 {.depositor = owner,
+
+
+
+
+
+
+
1115 auto tx = vault.withdraw(
+
1116 {.depositor = owner, .id = keylet.
key, .amount = asset(0)});
+
+
+
+
+
1121 testCase([&](Env& env,
+
1122 Account
const& issuer,
+
1123 Account
const& owner,
+
+
+
+
+
1128 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
1131 auto tx = vault.clawback(
+
+
+
+
1135 .amount = asset(50)});
+
+
+
+
+
1140 auto tx = vault.clawback(
+
+
+
+
+
+
+
+
+
1149 testCase([&](Env& env,
+
+
1151 Account
const& owner,
+
+
+
+
+
1156 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
1160 tx[sfWithdrawalPolicy] = 0;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1179 tx[sfDomainID] =
"0";
+
+
+
+
-
-
-
-
-
-
-
1190 using namespace test::jtx;
-
-
-
-
1194 Account
const& issuer,
-
1195 Account
const& owner,
-
1196 Account
const& depositor,
-
-
1198 Vault& vault)> test) {
-
1199 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
1200 Account issuer{
"issuer"};
-
1201 Account owner{
"owner"};
-
1202 Account depositor{
"depositor"};
-
1203 env.fund(XRP(1000), issuer, owner, depositor);
-
-
-
-
-
1208 test(env, issuer, owner, depositor, asset, vault);
-
-
-
-
-
1213 Account
const& issuer,
-
1214 Account
const& owner,
-
1215 Account
const& depositor,
-
-
-
-
-
1220 tx[sfAssetsMaximum] = asset(0).number();
-
-
-
-
-
-
1226 Account
const& issuer,
-
1227 Account
const& owner,
-
1228 Account
const& depositor,
-
-
-
-
1232 auto tx = vault.deposit(
-
1233 {.depositor = depositor,
-
-
1235 .amount = asset(10)});
-
-
-
-
-
-
1241 Account
const& issuer,
-
1242 Account
const& owner,
-
1243 Account
const& depositor,
-
-
-
1246 testcase(
"nothing to withdraw from");
-
1247 auto tx = vault.withdraw(
-
1248 {.depositor = depositor,
-
-
1250 .amount = asset(10)});
-
-
-
-
-
-
1256 Account
const& issuer,
-
1257 Account
const& owner,
-
1258 Account
const& depositor,
-
-
-
-
-
-
-
-
-
-
1268 Account
const& issuer,
-
1269 Account
const& owner,
-
1270 Account
const& depositor,
-
-
-
1273 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
1280 Account
const& issuer,
-
1281 Account
const& owner,
-
1282 Account
const& depositor,
-
-
-
1285 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
1286 tx[sfWithdrawalPolicy] = 1;
-
1287 testcase(
"explicitly select withdrawal policy");
-
-
-
-
-
-
1293 Account
const& issuer,
-
1294 Account
const& owner,
-
1295 Account
const& depositor,
-
-
-
1298 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
1305 Account
const& issuer,
-
1306 Account
const& owner,
-
1307 Account
const& depositor,
-
-
-
1310 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
1314 env(pay(owner, issuer, XRP(775)));
-
-
-
-
-
-
-
1321 Account
const& issuer,
-
1322 Account
const& owner,
-
1323 Account
const& depositor,
-
-
-
1326 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
-
-
1335 Account
const& issuer,
-
1336 Account
const& owner,
-
1337 Account
const& depositor,
-
-
-
-
1341 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
1348 Account
const& issuer,
-
1349 Account
const& owner,
-
1350 Account
const& depositor,
-
-
-
-
1354 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
+
+
+
+
+
+
+
1189 using namespace test::jtx;
+
+
+
+
1193 Account
const& issuer,
+
1194 Account
const& owner,
+
1195 Account
const& depositor,
+
+
1197 Vault& vault)> test) {
+
1198 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
1199 Account issuer{
"issuer"};
+
1200 Account owner{
"owner"};
+
1201 Account depositor{
"depositor"};
+
1202 env.fund(XRP(1000), issuer, owner, depositor);
+
+
+
+
+
1207 test(env, issuer, owner, depositor, asset, vault);
+
+
+
+
+
1212 Account
const& issuer,
+
1213 Account
const& owner,
+
1214 Account
const& depositor,
+
+
+
+
+
1219 tx[sfAssetsMaximum] = asset(0).number();
+
+
+
+
+
+
1225 Account
const& issuer,
+
1226 Account
const& owner,
+
1227 Account
const& depositor,
+
+
+
+
1231 auto tx = vault.deposit(
+
1232 {.depositor = depositor,
+
+
1234 .amount = asset(10)});
+
+
+
+
+
+
1240 Account
const& issuer,
+
1241 Account
const& owner,
+
1242 Account
const& depositor,
+
+
+
1245 testcase(
"nothing to withdraw from");
+
1246 auto tx = vault.withdraw(
+
1247 {.depositor = depositor,
+
+
1249 .amount = asset(10)});
+
+
+
+
+
+
1255 Account
const& issuer,
+
1256 Account
const& owner,
+
1257 Account
const& depositor,
+
+
+
+
+
+
+
+
+
+
1267 Account
const& issuer,
+
1268 Account
const& owner,
+
1269 Account
const& depositor,
+
+
+
1272 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
1279 Account
const& issuer,
+
1280 Account
const& owner,
+
1281 Account
const& depositor,
+
+
+
1284 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
1285 tx[sfWithdrawalPolicy] = 1;
+
1286 testcase(
"explicitly select withdrawal policy");
+
+
+
+
+
+
1292 Account
const& issuer,
+
1293 Account
const& owner,
+
1294 Account
const& depositor,
+
+
+
1297 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
1304 Account
const& issuer,
+
1305 Account
const& owner,
+
1306 Account
const& depositor,
+
+
+
1309 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
1313 env(pay(owner, issuer, XRP(775)));
+
+
+
+
+
+
+
1320 Account
const& issuer,
+
1321 Account
const& owner,
+
1322 Account
const& depositor,
+
+
+
1325 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
+
+
1334 Account
const& issuer,
+
1335 Account
const& owner,
+
1336 Account
const& depositor,
+
+
+
+
1340 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
1347 Account
const& issuer,
+
1348 Account
const& owner,
+
1349 Account
const& depositor,
+
+
+
+
1353 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
-
-
-
-
-
-
1363 using namespace test::jtx;
-
-
-
1366 testcase(
"IOU fail because MPT is disabled");
-
-
-
1369 (testable_amendments() - featureMPTokensV1) |
-
1370 featureSingleAssetVault};
-
1371 Account issuer{
"issuer"};
-
1372 Account owner{
"owner"};
-
1373 env.fund(XRP(1000), issuer, owner);
-
-
-
-
1377 Asset asset = issuer[
"IOU"].asset();
-
-
1379 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
1386 testcase(
"IOU fail create frozen");
-
1387 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
1388 Account issuer{
"issuer"};
-
1389 Account owner{
"owner"};
-
1390 env.fund(XRP(1000), issuer, owner);
-
-
-
-
-
-
1396 Asset asset = issuer[
"IOU"].asset();
-
-
1398 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
1405 testcase(
"IOU fail create no ripling");
-
1406 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
1407 Account issuer{
"issuer"};
-
1408 Account owner{
"owner"};
-
1409 env.fund(XRP(1000), issuer, owner);
-
-
-
-
-
-
1415 Asset asset = issuer[
"IOU"].asset();
-
-
1417 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
1424 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
1425 Account issuer{
"issuer"};
-
1426 Account owner{
"owner"};
-
1427 env.fund(XRP(1000), owner);
-
-
-
-
1431 Asset asset = issuer[
"IOU"].asset();
-
-
-
1434 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
-
1442 testcase(
"IOU fail create vault for AMM LPToken");
-
1443 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
1444 Account
const gw(
"gateway");
-
1445 Account
const alice(
"alice");
-
1446 Account
const carol(
"carol");
-
1447 IOU
const USD = gw[
"USD"];
-
-
1449 auto const [asset1, asset2] =
-
-
-
-
-
1454 auto const defXRP = XRP(30000);
-
-
-
1457 return a + XRP(1000);
-
-
-
-
-
-
-
1464 auto const toFund1 = tofund(asset1);
-
1465 auto const toFund2 = tofund(asset2);
-
1466 BEAST_EXPECT(asset1 <= toFund1 && asset2 <= toFund2);
-
-
1468 if (!asset1.native() && !asset2.native())
-
1469 fund(env, gw, {alice, carol}, {toFund1, toFund2}, Fund::All);
-
1470 else if (asset1.native())
-
1471 fund(env, gw, {alice, carol}, toFund1, {toFund2}, Fund::All);
-
1472 else if (asset2.native())
-
1473 fund(env, gw, {alice, carol}, toFund2, {toFund1}, Fund::All);
-
-
-
1476 env, alice, asset1, asset2, CreateArg{.log =
false, .tfee = 0});
-
-
1478 Account
const owner{
"owner"};
-
1479 env.fund(XRP(1000000), owner);
-
-
-
-
1483 vault.create({.owner = owner, .asset = ammAlice.lptIssue()});
-
-
-
-
+
+
+
+
+
+
1362 using namespace test::jtx;
+
+
+
1365 testcase(
"IOU fail because MPT is disabled");
+
+
+
1368 (testable_amendments() - featureMPTokensV1) |
+
1369 featureSingleAssetVault};
+
1370 Account issuer{
"issuer"};
+
1371 Account owner{
"owner"};
+
1372 env.fund(XRP(1000), issuer, owner);
+
+
+
+
1376 Asset asset = issuer[
"IOU"].asset();
+
+
1378 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
1385 testcase(
"IOU fail create frozen");
+
1386 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
1387 Account issuer{
"issuer"};
+
1388 Account owner{
"owner"};
+
1389 env.fund(XRP(1000), issuer, owner);
+
+
+
+
+
+
1395 Asset asset = issuer[
"IOU"].asset();
+
+
1397 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
1404 testcase(
"IOU fail create no ripling");
+
1405 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
1406 Account issuer{
"issuer"};
+
1407 Account owner{
"owner"};
+
1408 env.fund(XRP(1000), issuer, owner);
+
+
+
+
+
+
1414 Asset asset = issuer[
"IOU"].asset();
+
+
1416 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
1423 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
1424 Account issuer{
"issuer"};
+
1425 Account owner{
"owner"};
+
1426 env.fund(XRP(1000), owner);
+
+
+
+
1430 Asset asset = issuer[
"IOU"].asset();
+
+
+
1433 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
+
1441 testcase(
"IOU fail create vault for AMM LPToken");
+
1442 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
1443 Account
const gw(
"gateway");
+
1444 Account
const alice(
"alice");
+
1445 Account
const carol(
"carol");
+
1446 IOU
const USD = gw[
"USD"];
+
+
1448 auto const [asset1, asset2] =
+
+
+
+
+
1453 auto const defXRP = XRP(30000);
+
+
+
1456 return a + XRP(1000);
+
+
+
+
+
+
+
1463 auto const toFund1 = tofund(asset1);
+
1464 auto const toFund2 = tofund(asset2);
+
1465 BEAST_EXPECT(asset1 <= toFund1 && asset2 <= toFund2);
+
+
1467 if (!asset1.native() && !asset2.native())
+
1468 fund(env, gw, {alice, carol}, {toFund1, toFund2}, Fund::All);
+
1469 else if (asset1.native())
+
1470 fund(env, gw, {alice, carol}, toFund1, {toFund2}, Fund::All);
+
1471 else if (asset2.native())
+
1472 fund(env, gw, {alice, carol}, toFund2, {toFund1}, Fund::All);
+
+
+
1475 env, alice, asset1, asset2, CreateArg{.log =
false, .tfee = 0});
+
+
1477 Account
const owner{
"owner"};
+
1478 env.fund(XRP(1000000), owner);
+
+
+
+
1482 vault.create({.owner = owner, .asset = ammAlice.lptIssue()});
+
+
+
+
-
-
-
-
-
-
1492 using namespace test::jtx;
-
-
-
-
1496 Account
const& issuer,
-
1497 Account
const& owner,
-
1498 Account
const& depositor,
-
-
1500 Vault& vault)> test) {
-
1501 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
1502 Account issuer{
"issuer"};
-
1503 Account owner{
"owner"};
-
1504 Account depositor{
"depositor"};
-
1505 env.fund(XRP(1000), issuer, owner, depositor);
-
-
-
1508 MPTTester mptt{env, issuer, mptInitNoFund};
-
-
-
1511 Asset asset = mptt.issuanceID();
-
-
1513 test(env, issuer, owner, depositor, asset, vault);
-
-
-
-
-
1518 Account
const& issuer,
-
1519 Account
const& owner,
-
1520 Account
const& depositor,
-
-
-
-
1524 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
1530 Account
const& issuer,
-
1531 Account
const& owner,
-
1532 Account
const& depositor,
-
-
-
1535 testcase(
"MPT cannot set Scale=0");
-
1536 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
1543 Account
const& issuer,
-
1544 Account
const& owner,
-
1545 Account
const& depositor,
-
-
-
1548 testcase(
"MPT cannot set Scale=1");
-
1549 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
+
+
+
+
+
+
1491 using namespace test::jtx;
+
+
+
+
1495 Account
const& issuer,
+
1496 Account
const& owner,
+
1497 Account
const& depositor,
+
+
1499 Vault& vault)> test) {
+
1500 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
1501 Account issuer{
"issuer"};
+
1502 Account owner{
"owner"};
+
1503 Account depositor{
"depositor"};
+
1504 env.fund(XRP(1000), issuer, owner, depositor);
+
+
+
1507 MPTTester mptt{env, issuer, mptInitNoFund};
+
+
+
1510 Asset asset = mptt.issuanceID();
+
+
1512 test(env, issuer, owner, depositor, asset, vault);
+
+
+
+
+
1517 Account
const& issuer,
+
1518 Account
const& owner,
+
1519 Account
const& depositor,
+
+
+
+
1523 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
1529 Account
const& issuer,
+
1530 Account
const& owner,
+
1531 Account
const& depositor,
+
+
+
1534 testcase(
"MPT cannot set Scale=0");
+
1535 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
1542 Account
const& issuer,
+
1543 Account
const& owner,
+
1544 Account
const& depositor,
+
+
+
1547 testcase(
"MPT cannot set Scale=1");
+
1548 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
-
-
-
-
-
-
1558 using namespace test::jtx;
-
-
1560 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
1561 Account issuer{
"issuer"};
-
1562 Account owner{
"owner"};
-
1563 Account depositor{
"depositor"};
-
1564 env.fund(XRP(1000), issuer, owner, depositor);
-
-
-
-
-
1569 env.trust(asset(1000), owner);
-
1570 env(pay(issuer, owner, asset(100)));
-
1571 env.trust(asset(1000), depositor);
-
1572 env(pay(issuer, depositor, asset(100)));
-
-
-
1575 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
1581 testcase(
"nontransferable deposits");
-
1582 auto tx1 = vault.deposit(
-
1583 {.depositor = depositor,
-
-
1585 .amount = asset(40)});
-
-
-
1588 auto tx2 = vault.deposit(
-
1589 {.depositor = owner, .id = keylet.
key, .amount = asset(60)});
-
-
-
-
-
1594 auto const vaultAccount =
-
-
1596 auto jvVault = env.rpc(
"vault_info",
strHex(key));
-
-
-
1599 jvVault[jss::result][jss::vault][sfAssetsTotal] ==
"100");
-
-
1601 jvVault[jss::result][jss::vault][jss::shares]
-
1602 [sfOutstandingAmount] ==
"100000000");
-
-
-
1605 return parseBase58<AccountID>(
-
1606 jvVault[jss::result][jss::vault][jss::Account]
-
-
-
-
-
1611 auto const MptID =
makeMptID(1, vaultAccount);
-
1612 Asset shares = MptID;
-
-
-
1615 testcase(
"nontransferable shares cannot be moved");
-
1616 env(pay(owner, depositor, shares(10)), ter{
tecNO_AUTH});
-
1617 env(pay(depositor, owner, shares(10)), ter{
tecNO_AUTH});
-
-
-
-
1621 testcase(
"nontransferable shares can be used to withdraw");
-
1622 auto tx1 = vault.withdraw(
-
1623 {.depositor = depositor,
-
-
1625 .amount = asset(20)});
-
-
-
1628 auto tx2 = vault.withdraw(
-
1629 {.depositor = owner, .id = keylet.
key, .amount = asset(30)});
-
-
-
-
-
-
1635 testcase(
"nontransferable shares balance check");
-
1636 auto jvVault = env.rpc(
"vault_info",
strHex(keylet.
key));
-
-
1638 jvVault[jss::result][jss::vault][sfAssetsTotal] ==
"50");
-
-
1640 jvVault[jss::result][jss::vault][jss::shares]
-
1641 [sfOutstandingAmount] ==
"50000000");
-
-
-
-
1645 testcase(
"nontransferable shares withdraw rest");
-
1646 auto tx1 = vault.withdraw(
-
1647 {.depositor = depositor,
-
-
1649 .amount = asset(20)});
-
-
-
1652 auto tx2 = vault.withdraw(
-
1653 {.depositor = owner, .id = keylet.
key, .amount = asset(30)});
-
-
-
-
-
-
1659 testcase(
"nontransferable shares delete empty vault");
-
1660 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
1662 BEAST_EXPECT(!env.le(keylet));
-
-
+
+
+
+
+
+
1557 using namespace test::jtx;
+
+
1559 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
1560 Account issuer{
"issuer"};
+
1561 Account owner{
"owner"};
+
1562 Account depositor{
"depositor"};
+
1563 env.fund(XRP(1000), issuer, owner, depositor);
+
+
+
+
+
1568 env.trust(asset(1000), owner);
+
1569 env(pay(issuer, owner, asset(100)));
+
1570 env.trust(asset(1000), depositor);
+
1571 env(pay(issuer, depositor, asset(100)));
+
+
+
1574 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
1580 testcase(
"nontransferable deposits");
+
1581 auto tx1 = vault.deposit(
+
1582 {.depositor = depositor,
+
+
1584 .amount = asset(40)});
+
+
+
1587 auto tx2 = vault.deposit(
+
1588 {.depositor = owner, .id = keylet.
key, .amount = asset(60)});
+
+
+
+
+
1593 auto const vaultAccount =
+
+
1595 auto jvVault = env.rpc(
"vault_info",
strHex(key));
+
+
+
1598 jvVault[jss::result][jss::vault][sfAssetsTotal] ==
"100");
+
+
1600 jvVault[jss::result][jss::vault][jss::shares]
+
1601 [sfOutstandingAmount] ==
"100000000");
+
+
+
1604 return parseBase58<AccountID>(
+
1605 jvVault[jss::result][jss::vault][jss::Account]
+
+
+
+
+
1610 auto const MptID =
makeMptID(1, vaultAccount);
+
1611 Asset shares = MptID;
+
+
+
1614 testcase(
"nontransferable shares cannot be moved");
+
1615 env(pay(owner, depositor, shares(10)), ter{
tecNO_AUTH});
+
1616 env(pay(depositor, owner, shares(10)), ter{
tecNO_AUTH});
+
+
+
+
1620 testcase(
"nontransferable shares can be used to withdraw");
+
1621 auto tx1 = vault.withdraw(
+
1622 {.depositor = depositor,
+
+
1624 .amount = asset(20)});
+
+
+
1627 auto tx2 = vault.withdraw(
+
1628 {.depositor = owner, .id = keylet.
key, .amount = asset(30)});
+
+
+
+
+
+
1634 testcase(
"nontransferable shares balance check");
+
1635 auto jvVault = env.rpc(
"vault_info",
strHex(keylet.
key));
+
+
1637 jvVault[jss::result][jss::vault][sfAssetsTotal] ==
"50");
+
+
1639 jvVault[jss::result][jss::vault][jss::shares]
+
1640 [sfOutstandingAmount] ==
"50000000");
+
+
+
+
1644 testcase(
"nontransferable shares withdraw rest");
+
1645 auto tx1 = vault.withdraw(
+
1646 {.depositor = depositor,
+
+
1648 .amount = asset(20)});
+
+
+
1651 auto tx2 = vault.withdraw(
+
1652 {.depositor = owner, .id = keylet.
key, .amount = asset(30)});
+
+
+
+
+
+
1658 testcase(
"nontransferable shares delete empty vault");
+
1659 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
1661 BEAST_EXPECT(!env.le(keylet));
+
+
-
-
-
-
-
-
1669 using namespace test::jtx;
-
-
-
-
1673 bool enableClawback =
true;
-
+
+
+
+
+
+
1668 using namespace test::jtx;
+
+
+
+
1672 bool enableClawback =
true;
+
+
1674 int initialXRP = 1000;
1677 auto testCase = [
this](
@@ -1787,7 +1787,7 @@ $(document).ready(function() { init_codefold(0); });
1688 Account issuer{
"issuer"};
1689 Account owner{
"owner"};
1690 Account depositor{
"depositor"};
-
1691 env.fund(XRP(1000), issuer, owner, depositor);
+
1691 env.fund(XRP(args.initialXRP), issuer, owner, depositor);
@@ -1967,2762 +1967,2972 @@ $(document).ready(function() { init_codefold(0); });
-
-
1872 "MPT 3rd party without MPToken cannot be withdrawal "
-
-
-
-
1876 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
1881 {.depositor = depositor,
-
-
1883 .amount = asset(100)});
-
-
-
-
-
-
1889 Account charlie{
"charlie"};
-
1890 env.fund(XRP(1000), charlie);
-
-
-
1893 tx = vault.withdraw(
-
1894 {.depositor = depositor,
-
-
1896 .amount = asset(100)});
-
1897 tx[sfDestination] = charlie.human();
-
-
-
-
1901 {.requireAuth =
false});
+
1871 testcase(
"MPT depositor without MPToken, auth required");
+
+
+
1874 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
1879 {.depositor = depositor,
+
+
1881 .amount = asset(1000)});
+
+
+
+
+
+
+
+
+
+
1891 auto const mptoken =
+
+
1893 auto const sleMPT1 = env.le(mptoken);
+
1894 BEAST_EXPECT(sleMPT1 ==
nullptr);
+
+
1896 tx = vault.withdraw(
+
1897 {.depositor = depositor,
+
+
1899 .amount = asset(100)});
+
+
-
-
-
-
1906 Account
const& issuer,
-
1907 Account
const& owner,
-
1908 Account
const& depositor,
-
-
-
-
1912 testcase(
"MPT depositor without MPToken cannot withdraw");
-
-
-
1915 vault.create({.owner = owner, .asset = asset});
-
-
-
1918 auto v = env.le(keylet);
-
-
1920 MPTID share = (*v)[sfShareMPTID];
-
-
-
1923 {.depositor = depositor,
-
-
1925 .amount = asset(1000)});
-
-
-
-
-
-
-
-
-
1934 auto const mptoken =
-
-
1936 BEAST_EXPECT(mptoken ==
nullptr);
-
-
1938 tx = vault.withdraw(
-
1939 {.depositor = depositor,
-
-
1941 .amount = asset(100)});
-
-
-
-
-
-
1947 mptt.authorize({.account = depositor});
-
-
-
1950 tx = vault.withdraw(
-
1951 {.depositor = depositor,
-
-
1953 .amount = asset(1000)});
-
-
-
-
-
-
-
1960 BEAST_EXPECT(mptSle ==
nullptr);
-
-
-
1963 {.requireAuth =
false});
-
-
-
-
1967 Account
const& issuer,
-
1968 Account
const& owner,
-
1969 Account
const& depositor,
-
-
-
-
-
-
1975 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
1980 {.depositor = depositor,
-
-
1982 .amount = asset(1000)});
-
-
-
-
-
1987 auto tx = vault.clawback(
-
-
-
1990 .holder = depositor,
-
1991 .amount = asset(0)});
-
-
-
-
1995 mptt.destroy({.issuer = issuer, .id = mptt.issuanceID()});
-
-
-
-
-
2000 vault.create({.owner = depositor, .asset = asset});
-
-
-
-
-
2005 auto tx = vault.deposit(
-
2006 {.depositor = depositor,
-
-
2008 .amount = asset(10)});
-
-
-
-
-
2013 auto tx = vault.withdraw(
-
2014 {.depositor = depositor,
-
-
2016 .amount = asset(10)});
-
-
-
-
-
2021 auto tx = vault.clawback(
-
-
-
2024 .holder = depositor,
-
2025 .amount = asset(0)});
-
-
-
-
2029 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
2034 Account
const& issuer,
-
2035 Account
const& owner,
-
2036 Account
const& depositor,
-
-
-
-
2040 testcase(
"MPT vault owner can receive shares unless unauthorized");
-
-
2042 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2047 {.depositor = depositor,
-
-
2049 .amount = asset(1000)});
-
-
-
-
-
2054 auto const vault = env.le(keylet);
-
2055 return vault->at(sfShareMPTID);
-
-
-
-
-
-
2061 env(pay(depositor, owner, shares(1)));
-
-
-
2064 tx = vault.withdraw(
-
2065 {.depositor = owner,
-
-
2067 .amount = shares(1)});
-
-
-
-
-
2072 env(pay(depositor, owner, shares(1)));
-
-
-
2075 tx = vault.clawback(
-
-
-
-
2079 .amount = asset(0)});
-
-
-
-
-
2084 env(pay(depositor, owner, shares(1)));
-
-
-
-
2088 env(pay(owner, depositor, shares(1)));
-
-
-
-
-
-
2094 jv[sfAccount] = owner.human();
-
2095 jv[sfMPTokenIssuanceID] =
to_string(issuanceId);
-
-
2097 jv[sfTransactionType] = jss::MPTokenAuthorize;
-
-
-
+
1903 auto const sleMPT2 = env.le(mptoken);
+
1904 BEAST_EXPECT(sleMPT2 ==
nullptr);
+
+
+
+
+
1909 Account charlie{
"charlie"};
+
1910 env.fund(XRP(1000), charlie);
+
+
+
1913 tx = vault.withdraw(
+
1914 {.depositor = depositor,
+
+
1916 .amount = asset(100)});
+
1917 tx[sfDestination] = charlie.human();
+
+
+
+
1921 {.requireAuth =
true});
+
+
+
+
+
1926 Account
const& issuer,
+
1927 Account
const& owner,
+
1928 Account
const& depositor,
+
+
+
+
1932 testcase(
"MPT depositor without MPToken, no auth required");
+
+
+
1935 vault.create({.owner = owner, .asset = asset});
+
+
+
1938 auto v = env.le(keylet);
+
+
+
+
1942 {.depositor = depositor,
+
+
1944 .amount = asset(1000)});
+
+
+
+
+
+
+
+
+
+
1954 auto const mptoken =
+
+
1956 auto const sleMPT1 = env.le(mptoken);
+
1957 BEAST_EXPECT(sleMPT1 ==
nullptr);
+
+
1959 tx = vault.withdraw(
+
1960 {.depositor = depositor,
+
+
1962 .amount = asset(100)});
+
+
+
+
1966 auto const sleMPT2 = env.le(mptoken);
+
1967 BEAST_EXPECT(sleMPT2 !=
nullptr);
+
1968 BEAST_EXPECT(sleMPT2->at(sfMPTAmount) == 100);
+
+
+
+
+
+
+
+
+
1977 auto const mptoken =
+
+
1979 auto const sleMPT1 = env.le(mptoken);
+
1980 BEAST_EXPECT(sleMPT1 ==
nullptr);
+
+
1982 tx = vault.withdraw(
+
1983 {.depositor = depositor,
+
+
1985 .amount = asset(100)});
+
1986 tx[sfDestination] = owner.human();
+
+
+
+
1990 auto const sleMPT2 = env.le(mptoken);
+
1991 BEAST_EXPECT(sleMPT2 ==
nullptr);
+
+
+
1994 {.requireAuth =
false});
+
+
+
1997 Env env{*
this, testable_amendments()};
+
+
1999 env.current()->fees().accountReserve(0).drops() /
+
+
2001 env.current()->fees().increment.drops() /
+
+
+
+
+
+
+
2008 Account
const& issuer,
+
2009 Account
const& owner,
+
2010 Account
const& depositor,
+
+
+
+
2014 testcase(
"MPT failed reserve to re-create MPToken");
+
+
+
2017 vault.create({.owner = owner, .asset = asset});
+
+
+
2020 auto v = env.le(keylet);
+
+
+
2023 env(pay(depositor, owner, asset(1000)));
+
+
+
+
2027 {.depositor = owner,
+
+
2029 .amount = asset(1000)});
+
+
+
+
+
+
+
+
+
+
2039 auto const mptoken =
+
+
2041 auto const sleMPT = env.le(mptoken);
+
2042 BEAST_EXPECT(sleMPT ==
nullptr);
+
+
+
2045 tx = vault.withdraw(
+
2046 {.depositor = owner,
+
+
2048 .amount = asset(100)});
+
+
+
+
2052 env(pay(depositor, owner, XRP(incReserve)));
+
+
+
+
+
+
+
+
2060 {.requireAuth =
false,
+
2061 .initialXRP = acctReserve + incReserve * 4 - 1});
+
+
+
+
2065 Account
const& issuer,
+
2066 Account
const& owner,
+
2067 Account
const& depositor,
+
+
+
+
+
+
2073 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
2078 {.depositor = depositor,
+
+
2080 .amount = asset(1000)});
+
+
+
+
+
2085 auto tx = vault.clawback(
+
+
+
2088 .holder = depositor,
+
2089 .amount = asset(0)});
+
+
+
+
2093 mptt.destroy({.issuer = issuer, .id = mptt.issuanceID()});
+
+
+
+
+
2098 vault.create({.owner = depositor, .asset = asset});
+
+
-
-
2103 tx = pay(depositor, owner, shares(1));
-
-
-
-
-
2108 tx = vault.clawback(
-
-
-
2111 .holder = depositor,
-
2112 .amount = asset(0)});
-
-
-
-
-
2117 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
-
-
-
2125 Account
const& issuer,
-
2126 Account
const& owner,
-
2127 Account
const& depositor,
-
-
-
-
-
-
-
2134 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2139 {.depositor = depositor,
-
-
2141 .amount = asset(1000)});
-
-
-
-
-
2146 auto tx = vault.clawback(
-
-
-
2149 .holder = depositor,
-
2150 .amount = asset(0)});
-
-
-
-
2154 {.enableClawback =
false});
-
-
-
-
2158 Account
const& issuer,
-
2159 Account
const& owner,
-
2160 Account
const& depositor,
-
-
-
-
-
2165 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
2169 {.depositor = depositor,
-
-
2171 .amount = asset(1000)});
-
-
-
-
-
-
2177 .holder = depositor,
-
-
+
+
2103 auto tx = vault.deposit(
+
2104 {.depositor = depositor,
+
+
2106 .amount = asset(10)});
+
+
+
+
+
2111 auto tx = vault.withdraw(
+
2112 {.depositor = depositor,
+
+
2114 .amount = asset(10)});
+
+
+
+
+
2119 auto tx = vault.clawback(
+
+
+
2122 .holder = depositor,
+
2123 .amount = asset(0)});
+
+
+
+
2127 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
2132 Account
const& issuer,
+
2133 Account
const& owner,
+
2134 Account
const& depositor,
+
+
+
+
2138 testcase(
"MPT vault owner can receive shares unless unauthorized");
+
+
2140 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
2145 {.depositor = depositor,
+
+
2147 .amount = asset(1000)});
+
+
+
+
+
2152 auto const vault = env.le(keylet);
+
2153 return vault->at(sfShareMPTID);
+
+
+
+
+
+
2159 env(pay(depositor, owner, shares(1)));
+
+
+
2162 tx = vault.withdraw(
+
2163 {.depositor = owner,
+
+
2165 .amount = shares(1)});
+
+
+
+
+
2170 env(pay(depositor, owner, shares(1)));
+
+
+
2173 tx = vault.clawback(
+
+
+
+
2177 .amount = asset(0)});
+
+
-
-
2182 auto tx = vault.withdraw(
-
2183 {.depositor = depositor,
-
-
2185 .amount = asset(100)});
-
-
-
-
2189 tx[sfDestination] = issuer.human();
-
-
-
-
2193 tx[sfDestination] = owner.human();
-
-
-
-
-
-
-
2200 auto tx = vault.deposit(
-
2201 {.depositor = depositor,
-
-
2203 .amount = asset(100)});
-
-
-
-
-
2208 tx = vault.clawback(
-
-
-
2211 .holder = depositor,
-
2212 .amount = asset(800)});
-
-
-
-
2216 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
2221 Account
const& issuer,
-
2222 Account
const& owner,
-
2223 Account
const& depositor,
-
-
-
-
2227 testcase(
"MPT lock of vault pseudo-account");
-
2228 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
2232 auto const vaultAccount =
-
2233 [&env, keylet = keylet,
this]() ->
AccountID {
-
2234 auto const vault = env.le(keylet);
-
2235 BEAST_EXPECT(vault !=
nullptr);
-
2236 return vault->at(sfAccount);
-
-
-
-
2240 {.depositor = depositor,
-
-
2242 .amount = asset(100)});
-
-
-
-
-
-
2248 jv[jss::Account] = issuer.human();
-
2249 jv[sfMPTokenIssuanceID] =
-
-
2251 jv[jss::Holder] =
toBase58(vaultAccount);
-
2252 jv[jss::TransactionType] = jss::MPTokenIssuanceSet;
-
-
-
-
-
-
-
-
2260 {.depositor = depositor,
-
-
2262 .amount = asset(100)});
-
-
-
2265 tx = vault.withdraw(
-
2266 {.depositor = depositor,
-
-
2268 .amount = asset(100)});
-
-
-
-
2272 tx = vault.clawback(
-
-
+
+
2182 env(pay(depositor, owner, shares(1)));
+
+
+
+
2186 env(pay(owner, depositor, shares(1)));
+
+
+
+
+
+
2192 jv[sfAccount] = owner.human();
+
2193 jv[sfMPTokenIssuanceID] =
to_string(issuanceId);
+
+
2195 jv[sfTransactionType] = jss::MPTokenAuthorize;
+
+
+
+
+
+
2201 tx = pay(depositor, owner, shares(1));
+
+
+
+
+
2206 tx = vault.clawback(
+
+
+
2209 .holder = depositor,
+
2210 .amount = asset(0)});
+
+
+
+
+
2215 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+
+
+
2223 Account
const& issuer,
+
2224 Account
const& owner,
+
2225 Account
const& depositor,
+
+
+
+
+
+
+
2232 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
2237 {.depositor = depositor,
+
+
2239 .amount = asset(1000)});
+
+
+
+
+
2244 auto tx = vault.clawback(
+
+
+
2247 .holder = depositor,
+
2248 .amount = asset(0)});
+
+
+
+
2252 {.enableClawback =
false});
+
+
+
+
2256 Account
const& issuer,
+
2257 Account
const& owner,
+
2258 Account
const& depositor,
+
+
+
+
+
2263 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
2267 {.depositor = depositor,
+
+
2269 .amount = asset(1000)});
+
+
+
+
+
2275 .holder = depositor,
-
2276 .amount = asset(100)});
-
+
+
-
-
2280 tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
-
2287 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
2288 Account owner{
"owner"};
-
2289 Account issuer{
"issuer"};
-
2290 env.fund(XRP(1000000), owner, issuer);
-
-
-
-
2294 MPTTester mptt{env, issuer, mptInitNoFund};
-
-
-
-
2298 mptt.authorize({.account = owner});
-
2299 mptt.authorize({.account = issuer, .holder = owner});
-
-
2301 env(pay(issuer, owner, asset(100)));
-
2302 auto [tx1, k1] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
2306 auto const shares = [&env, keylet = k1,
this]() ->
Asset {
-
2307 auto const vault = env.le(keylet);
-
2308 BEAST_EXPECT(vault !=
nullptr);
-
2309 return MPTIssue(vault->at(sfShareMPTID));
-
-
-
2312 auto [tx2, k2] = vault.create({.owner = owner, .asset = shares});
-
-
-
-
-
-
-
-
-
-
-
2321 using namespace test::jtx;
-
-
-
-
-
-
2327 Account
const& owner,
-
2328 Account
const& issuer,
-
2329 Account
const& charlie,
-
-
-
-
-
2334 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
2335 Account
const owner{
"owner"};
-
2336 Account
const issuer{
"issuer"};
-
2337 Account
const charlie{
"charlie"};
-
-
2339 env.fund(XRP(1000), issuer, owner, charlie);
-
-
-
-
-
2344 env.trust(asset(1000), owner);
-
2345 env.trust(asset(1000), charlie);
-
2346 env(pay(issuer, owner, asset(200)));
-
2347 env(rate(issuer, 1.25));
-
-
-
2350 auto const vaultAccount =
-
-
2352 return Account(
"vault", env.le(keylet)->at(sfAccount));
-
-
-
2355 return env.le(keylet)->at(sfShareMPTID);
-
-
-
-
-
-
-
-
-
-
-
-
+
+
2280 auto tx = vault.withdraw(
+
2281 {.depositor = depositor,
+
+
2283 .amount = asset(100)});
+
+
+
+
2287 tx[sfDestination] = issuer.human();
+
+
+
+
2291 tx[sfDestination] = owner.human();
+
+
+
+
+
+
+
2298 auto tx = vault.deposit(
+
2299 {.depositor = depositor,
+
+
2301 .amount = asset(100)});
+
+
+
+
+
2306 tx = vault.clawback(
+
+
+
2309 .holder = depositor,
+
2310 .amount = asset(800)});
+
+
+
+
2314 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
2319 Account
const& issuer,
+
2320 Account
const& owner,
+
2321 Account
const& depositor,
+
+
+
+
2325 testcase(
"MPT lock of vault pseudo-account");
+
2326 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
2330 auto const vaultAccount =
+
2331 [&env, keylet = keylet,
this]() ->
AccountID {
+
2332 auto const vault = env.le(keylet);
+
2333 BEAST_EXPECT(vault !=
nullptr);
+
2334 return vault->at(sfAccount);
+
+
+
+
2338 {.depositor = depositor,
+
+
2340 .amount = asset(100)});
+
+
+
+
+
+
2346 jv[jss::Account] = issuer.human();
+
2347 jv[sfMPTokenIssuanceID] =
+
+
2349 jv[jss::Holder] =
toBase58(vaultAccount);
+
2350 jv[jss::TransactionType] = jss::MPTokenIssuanceSet;
+
+
+
+
+
+
+
+
2358 {.depositor = depositor,
+
+
2360 .amount = asset(100)});
+
+
+
2363 tx = vault.withdraw(
+
2364 {.depositor = depositor,
+
+
2366 .amount = asset(100)});
+
-
-
-
2371 Account
const& owner,
-
2372 Account
const& issuer,
-
-
-
-
-
-
2378 testcase(
"IOU cannot use different asset");
-
-
-
2381 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
+
+
2370 tx = vault.clawback(
+
+
+
2373 .holder = depositor,
+
2374 .amount = asset(100)});
+
+
+
+
2378 tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
-
-
-
2387 auto tx = [&, account = vaultAccount(keylet)]() {
-
-
2389 jv[jss::Account] = issuer.human();
-
-
2391 auto& ja = jv[jss::LimitAmount] =
-
-
2393 ja[jss::issuer] =
toBase58(account);
-
-
2395 jv[jss::TransactionType] = jss::TrustSet;
-
-
-
-
-
-
-
-
-
2404 auto tx = vault.deposit(
-
2405 {.depositor = issuer, .id = keylet.
key, .amount = foo(20)});
-
-
-
+
2385 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
2386 Account owner{
"owner"};
+
2387 Account issuer{
"issuer"};
+
2388 env.fund(XRP(1000000), owner, issuer);
+
+
+
+
2392 MPTTester mptt{env, issuer, mptInitNoFund};
+
+
+
+
2396 mptt.authorize({.account = owner});
+
2397 mptt.authorize({.account = issuer, .holder = owner});
+
+
2399 env(pay(issuer, owner, asset(100)));
+
2400 auto [tx1, k1] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
2404 auto const shares = [&env, keylet = k1,
this]() ->
Asset {
+
2405 auto const vault = env.le(keylet);
+
2406 BEAST_EXPECT(vault !=
nullptr);
+
2407 return MPTIssue(vault->at(sfShareMPTID));
+
-
-
2411 auto tx = vault.withdraw(
-
2412 {.depositor = issuer, .id = keylet.
key, .amount = foo(20)});
-
-
-
-
-
2417 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
+
2410 auto [tx2, k2] = vault.create({.owner = owner, .asset = shares});
+
+
+
+
+
+
+
+
+
+
+
2419 using namespace test::jtx;
-
-
-
2423 Account
const& owner,
-
2424 Account
const& issuer,
-
2425 Account
const& charlie,
-
-
-
-
-
2430 testcase(
"IOU frozen trust line to vault account");
-
-
2432 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2437 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
2440 Asset const share =
Asset(issuanceId(keylet));
-
-
-
2443 auto trustSet = [&, account = vaultAccount(keylet)]() {
-
-
2445 jv[jss::Account] = issuer.human();
-
-
2447 auto& ja = jv[jss::LimitAmount] =
-
-
2449 ja[jss::issuer] =
toBase58(account);
-
-
2451 jv[jss::TransactionType] = jss::TrustSet;
-
-
-
-
-
-
-
-
-
-
-
-
2463 auto tx = vault.deposit(
-
2464 {.depositor = owner,
-
-
2466 .amount = asset(80)});
-
-
-
-
-
2471 auto tx = vault.withdraw(
-
2472 {.depositor = owner,
-
-
2474 .amount = asset(100)});
-
-
-
-
2478 tx[sfDestination] = charlie.human();
-
-
-
-
-
-
-
2485 auto tx = vault.clawback(
-
-
-
-
2489 .amount = asset(50)});
-
-
-
-
-
-
-
-
-
-
-
2500 {.depositor = owner,
-
-
2502 .amount = share(50'000'000)}));
-
-
2504 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
+
+
+
2423 int initialXRP = 1000;
+
+
+
+
+
+
+
+
2431 Account
const& owner,
+
2432 Account
const& issuer,
+
2433 Account
const& charlie,
+
+
+
+
+
2438 CaseArgs args = {}) {
+
2439 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
2440 Account
const owner{
"owner"};
+
2441 Account
const issuer{
"issuer"};
+
2442 Account
const charlie{
"charlie"};
+
+
2444 env.fund(XRP(args.initialXRP), issuer, owner, charlie);
+
+
+
+
+
2449 env.trust(asset(1000), owner);
+
2450 env.trust(asset(1000), charlie);
+
2451 env(pay(issuer, owner, asset(200)));
+
2452 env(rate(issuer, args.transferRate));
+
+
+
2455 auto const vaultAccount =
+
+
2457 return Account(
"vault", env.le(keylet)->at(sfAccount));
+
+
+
2460 return env.le(keylet)->at(sfShareMPTID);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2476 Account
const& owner,
+
2477 Account
const& issuer,
+
+
+
+
+
+
2483 testcase(
"IOU cannot use different asset");
+
+
+
2486 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
2492 auto tx = [&, account = vaultAccount(keylet)]() {
+
+
2494 jv[jss::Account] = issuer.human();
+
+
2496 auto& ja = jv[jss::LimitAmount] =
+
+
2498 ja[jss::issuer] =
toBase58(account);
+
+
2500 jv[jss::TransactionType] = jss::TrustSet;
+
+
+
+
+
+
-
-
-
2510 Account
const& owner,
-
2511 Account
const& issuer,
-
2512 Account
const& charlie,
-
-
-
-
-
2517 testcase(
"IOU transfer fees not applied");
-
-
2519 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2524 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
-
2528 Asset const share =
Asset(issuanceId(keylet));
-
-
-
2531 BEAST_EXPECT(env.balance(owner, issue) == asset(100));
-
-
2533 env.balance(vaultAccount(keylet), issue) == asset(100));
-
-
-
2536 auto tx = vault.clawback(
-
-
-
-
2540 .amount = asset(50)});
-
-
-
+
+
2509 auto tx = vault.deposit(
+
2510 {.depositor = issuer, .id = keylet.
key, .amount = foo(20)});
+
+
+
+
+
+
2516 auto tx = vault.withdraw(
+
2517 {.depositor = issuer, .id = keylet.
key, .amount = foo(20)});
+
+
+
+
+
2522 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+
2528 Account
const& owner,
+
2529 Account
const& issuer,
+
2530 Account
const& charlie,
+
+
+
+
+
2535 testcase(
"IOU frozen trust line to vault account");
+
+
2537 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
2542 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
-
-
2546 BEAST_EXPECT(env.balance(owner, issue) == asset(100));
-
2547 BEAST_EXPECT(env.balance(vaultAccount(keylet), issue) == asset(50));
-
-
-
2550 {.depositor = owner,
-
-
2552 .amount = share(20'000'000)}));
-
-
-
2555 BEAST_EXPECT(env.balance(owner, issue) == asset(120));
-
2556 BEAST_EXPECT(env.balance(vaultAccount(keylet), issue) == asset(30));
-
-
-
2559 auto tx = vault.withdraw(
-
2560 {.depositor = owner,
-
-
2562 .amount = share(30'000'000)});
-
2563 tx[sfDestination] = charlie.human();
-
-
-
-
-
2568 BEAST_EXPECT(env.balance(owner, issue) == asset(120));
-
2569 BEAST_EXPECT(env.balance(charlie, issue) == asset(30));
-
2570 BEAST_EXPECT(env.balance(vaultAccount(keylet), issue) == asset(0));
-
-
2572 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
-
2578 Account
const& owner,
-
2579 Account
const& issuer,
-
2580 Account
const& charlie,
-
-
-
-
-
2585 testcase(
"IOU frozen trust line to depositor");
-
-
2587 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2592 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
-
-
2597 auto tx = vault.withdraw(
-
2598 {.depositor = owner,
-
-
2600 .amount = asset(10)});
-
2601 tx[sfDestination] = charlie.human();
-
-
-
2604 env(withdrawToCharlie);
-
-
-
-
-
-
-
2611 auto const withdraw = vault.withdraw(
-
2612 {.depositor = owner, .id = keylet.
key, .amount = asset(10)});
-
-
-
-
-
-
-
-
-
2621 auto tx = vault.deposit(
-
2622 {.depositor = owner,
-
-
2624 .amount = asset(10)});
-
-
-
-
-
-
2630 auto tx = vault.clawback(
-
-
-
-
2634 .amount = asset(0)});
-
-
-
+
2545 Asset const share =
Asset(issuanceId(keylet));
+
+
+
2548 auto trustSet = [&, account = vaultAccount(keylet)]() {
+
+
2550 jv[jss::Account] = issuer.human();
+
+
2552 auto& ja = jv[jss::LimitAmount] =
+
+
2554 ja[jss::issuer] =
toBase58(account);
+
+
2556 jv[jss::TransactionType] = jss::TrustSet;
+
+
+
+
+
+
+
+
+
+
+
+
2568 auto tx = vault.deposit(
+
2569 {.depositor = owner,
+
+
2571 .amount = asset(80)});
+
+
+
+
+
2576 auto tx = vault.withdraw(
+
2577 {.depositor = owner,
+
+
2579 .amount = asset(100)});
+
+
+
+
2583 tx[sfDestination] = charlie.human();
+
+
+
+
+
+
+
2590 auto tx = vault.clawback(
+
+
+
+
2594 .amount = asset(50)});
+
+
+
+
+
+
+
+
+
+
+
2605 {.depositor = owner,
+
+
2607 .amount = share(50'000'000)}));
+
+
2609 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+
+
2616 Account
const& owner,
+
2617 Account
const& issuer,
+
2618 Account
const& charlie,
+
+
+
+
+
2623 testcase(
"IOU transfer fees not applied");
+
+
+
2626 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
2631 {.depositor = owner,
+
+
2633 .amount = asset(100)}));
+
+
+
+
2637 Asset const share =
Asset(issuanceId(keylet));
-
2639 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
-
2645 Account
const& owner,
-
2646 Account
const& issuer,
-
2647 Account
const& charlie,
-
-
-
-
-
2652 testcase(
"IOU no trust line to 3rd party");
+
+
2640 BEAST_EXPECT(env.balance(owner, issue) == asset(100));
+
+
2642 env.balance(vaultAccount(keylet), issue) == asset(100));
+
+
+
2645 auto tx = vault.clawback(
+
+
+
+
2649 .amount = asset(50)});
+
+
+
-
2654 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2659 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
2662 Account
const erin{
"erin"};
-
2663 env.fund(XRP(1000), erin);
-
-
-
-
-
2668 auto tx = vault.withdraw(
-
2669 {.depositor = owner,
-
-
2671 .amount = asset(10)});
-
2672 tx[sfDestination] = erin.human();
-
-
-
-
+
+
2655 BEAST_EXPECT(env.balance(owner, issue) == asset(100));
+
+
2657 env.balance(vaultAccount(keylet), issue) == asset(50));
+
+
+
2660 {.depositor = owner,
+
+
2662 .amount = share(20'000'000)}));
+
+
+
2665 BEAST_EXPECT(env.balance(owner, issue) == asset(120));
+
+
2667 env.balance(vaultAccount(keylet), issue) == asset(30));
+
+
+
2670 auto tx = vault.withdraw(
+
2671 {.depositor = owner,
+
+
2673 .amount = share(30'000'000)});
+
2674 tx[sfDestination] = charlie.human();
+
+
-
-
-
2680 Account
const& owner,
-
2681 Account
const& issuer,
-
2682 Account
const& charlie,
-
-
-
-
-
2687 testcase(
"IOU no trust line to depositor");
+
+
2679 BEAST_EXPECT(env.balance(owner, issue) == asset(120));
+
2680 BEAST_EXPECT(env.balance(charlie, issue) == asset(30));
+
+
2682 env.balance(vaultAccount(keylet), issue) == asset(0));
+
+
2684 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
2687 CaseArgs{.transferRate = 1.25});
-
2689 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2694 env.trust(asset(0), owner);
-
-
-
-
2698 {.depositor = owner, .id = keylet.key, .amount = asset(200)}));
-
-
-
-
-
2703 BEAST_EXPECT(trustline ==
nullptr);
-
-
-
-
2707 auto tx = vault.withdraw(
-
2708 {.depositor = owner,
-
-
2710 .amount = asset(10)});
-
-
-
-
-
-
-
-
2718 Account
const& owner,
-
2719 Account
const& issuer,
-
2720 Account
const& charlie,
-
-
-
-
-
2725 testcase(
"IOU frozen trust line to 3rd party");
-
-
2727 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2732 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
-
-
2737 auto tx = vault.withdraw(
-
2738 {.depositor = owner,
-
-
2740 .amount = asset(10)});
-
2741 tx[sfDestination] = charlie.human();
-
-
-
2744 env(withdrawToCharlie);
-
-
-
2747 env(trust(issuer, asset(0), charlie,
tfSetFreeze));
-
-
-
-
2751 auto const withdraw = vault.withdraw(
-
2752 {.depositor = owner, .id = keylet.
key, .amount = asset(10)});
-
-
+
+
+
2691 Account
const& owner,
+
2692 Account
const& issuer,
+
2693 Account
const& charlie,
+
+
+
+
+
2698 testcase(
"IOU frozen trust line to depositor");
+
+
2700 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
2705 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+
+
+
2710 auto tx = vault.withdraw(
+
2711 {.depositor = owner,
+
+
2713 .amount = asset(10)});
+
2714 tx[sfDestination] = charlie.human();
+
+
+
2717 env(withdrawToCharlie);
+
+
+
+
+
+
+
2724 auto const withdraw = vault.withdraw(
+
2725 {.depositor = owner, .id = keylet.
key, .amount = asset(10)});
+
+
+
+
+
+
+
+
+
2734 auto tx = vault.deposit(
+
2735 {.depositor = owner,
+
+
2737 .amount = asset(10)});
+
+
+
+
+
+
2743 auto tx = vault.clawback(
+
+
+
+
2747 .amount = asset(0)});
+
+
+
+
+
2752 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
-
-
-
-
-
-
-
-
-
2764 .amount = asset(0)}));
-
+
+
+
2758 Account
const& owner,
+
2759 Account
const& issuer,
+
2760 Account
const& charlie,
+
+
+
+
+
2765 testcase(
"IOU no trust line to 3rd party");
-
2767 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
+
2767 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
-
-
-
2773 Account
const& owner,
-
2774 Account
const& issuer,
-
2775 Account
const& charlie,
-
-
-
-
-
-
-
2782 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
2787 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
-
-
-
-
-
2795 auto tx = vault.withdraw(
-
2796 {.depositor = owner,
-
-
2798 .amount = asset(10)});
-
-
-
-
2802 tx[sfDestination] = charlie.human();
-
-
+
+
2772 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+
2775 Account
const erin{
"erin"};
+
2776 env.fund(XRP(1000), erin);
+
+
+
+
+
2781 auto tx = vault.withdraw(
+
2782 {.depositor = owner,
+
+
2784 .amount = asset(10)});
+
2785 tx[sfDestination] = erin.human();
+
+
+
+
+
+
+
+
2793 Account
const& owner,
+
2794 Account
const& issuer,
+
2795 Account
const& charlie,
+
+
+
+
+
2800 testcase(
"IOU no trust line to depositor");
+
+
2802 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
-
-
-
2808 {.depositor = owner,
-
-
2810 .amount = asset(10)});
-
-
-
-
-
-
-
-
-
-
2820 .amount = asset(0)}));
-
-
-
2823 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
-
-
-
-
-
2831 using namespace test::jtx;
-
-
-
-
2835 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
2836 Account issuer{
"issuer"};
-
2837 Account owner{
"owner"};
-
2838 Account depositor{
"depositor"};
-
2839 Account charlie{
"charlie"};
-
2840 Account pdOwner{
"pdOwner"};
-
2841 Account credIssuer1{
"credIssuer1"};
-
2842 Account credIssuer2{
"credIssuer2"};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
2807 env.trust(asset(0), owner);
+
+
+
+
2811 {.depositor = owner, .id = keylet.key, .amount = asset(200)}));
+
+
+
+
+
2816 BEAST_EXPECT(trustline ==
nullptr);
+
+
+
+
2820 auto tx = vault.withdraw(
+
2821 {.depositor = owner,
+
+
2823 .amount = asset(10)});
+
+
+
+
+
+
+
2830 Env env{*
this, testable_amendments()};
+
+
2832 env.current()->fees().accountReserve(0).drops() /
+
+
2834 env.current()->fees().increment.drops() /
+
+
+
+
+
+
+
2841 Account
const& owner,
+
2842 Account
const& issuer,
+
2843 Account
const& charlie,
+
+
+
+
+
2848 testcase(
"IOU no trust line to depositor no reserve");
+
+
2850 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
2856 env.trust(asset(0), owner);
+
-
-
2860 env.trust(asset(1000), owner);
-
2861 env(pay(issuer, owner, asset(500)));
-
2862 env.trust(asset(1000), depositor);
-
2863 env(pay(issuer, depositor, asset(500)));
-
2864 env.trust(asset(1000), charlie);
-
2865 env(pay(issuer, charlie, asset(5)));
-
-
-
2868 auto [tx, keylet] = vault.create(
-
-
-
-
2872 BEAST_EXPECT(env.le(keylet));
-
-
-
2875 testcase(
"private vault owner can deposit");
-
2876 auto tx = vault.deposit(
-
2877 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
-
-
-
-
-
2882 testcase(
"private vault depositor not authorized yet");
-
2883 auto tx = vault.deposit(
-
2884 {.depositor = depositor,
-
-
2886 .amount = asset(50)});
-
-
-
-
-
2891 testcase(
"private vault cannot set non-existing domain");
-
2892 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
2898 testcase(
"private vault set domainId");
-
-
-
2901 pdomain::Credentials
const credentials1{
-
2902 {.issuer = credIssuer1, .credType = credType}};
-
-
2904 env(pdomain::setTx(pdOwner, credentials1));
-
2905 auto const domainId1 = [&]() {
-
-
2907 return pdomain::getNewDomain(env.meta());
-
-
-
2910 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
-
-
+
+
2860 {.depositor = owner,
+
+
2862 .amount = asset(200)}));
+
+
+
+
+
2867 BEAST_EXPECT(trustline ==
nullptr);
+
+
+
2870 tx = vault.withdraw(
+
2871 {.depositor = owner,
+
+
2873 .amount = asset(10)});
+
+
+
+
2877 env(pay(charlie, owner, XRP(incReserve)));
+
+
+
+
+
+
+
2884 CaseArgs{.initialXRP = acctReserve + incReserve * 4 - 1});
+
+
+
+
+
2889 Account
const& owner,
+
2890 Account
const& issuer,
+
2891 Account
const& charlie,
+
+
+
+
+
2896 testcase(
"IOU no reserve for share MPToken");
+
+
2898 vault.create({.owner = owner, .asset = asset});
+
+
+
+
2902 env(pay(owner, charlie, asset(100)));
+
+
+
+
2906 env(ticket::create(charlie, 2));
+
+
+
+
+
2911 {.depositor = charlie,
+
+
2913 .amount = asset(100)});
+
+
+
+
2917 env(pay(issuer, charlie, XRP(incReserve)));
+
-
-
2921 pdomain::Credentials
const credentials{
-
2922 {.issuer = credIssuer1, .credType = credType},
-
2923 {.issuer = credIssuer2, .credType = credType}};
-
-
2925 env(pdomain::setTx(pdOwner, credentials));
-
2926 auto const domainId = [&]() {
-
-
2928 return pdomain::getNewDomain(env.meta());
-
-
-
2931 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
2937 tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
-
-
2945 testcase(
"private vault depositor still not authorized");
-
2946 auto tx = vault.deposit(
-
2947 {.depositor = depositor,
-
-
2949 .amount = asset(50)});
-
-
-
-
-
2954 auto const credKeylet =
-
2955 credentials::keylet(depositor, credIssuer1, credType);
-
-
2957 testcase(
"private vault depositor now authorized");
-
2958 env(credentials::create(depositor, credIssuer1, credType));
-
2959 env(credentials::accept(depositor, credIssuer1, credType));
-
2960 env(credentials::create(charlie, credIssuer1, credType));
-
-
-
2963 auto credSle = env.le(credKeylet);
-
2964 BEAST_EXPECT(credSle !=
nullptr);
+
+
+
+
+
2924 CaseArgs{.initialXRP = acctReserve + incReserve * 4 - 1});
+
+
+
+
2928 Account
const& owner,
+
2929 Account
const& issuer,
+
2930 Account
const& charlie,
+
+
+
+
+
2935 testcase(
"IOU frozen trust line to 3rd party");
+
+
2937 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
2942 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+
+
+
2947 auto tx = vault.withdraw(
+
2948 {.depositor = owner,
+
+
2950 .amount = asset(10)});
+
2951 tx[sfDestination] = charlie.human();
+
+
+
2954 env(withdrawToCharlie);
+
+
+
2957 env(trust(issuer, asset(0), charlie,
tfSetFreeze));
+
+
+
+
2961 auto const withdraw = vault.withdraw(
+
2962 {.depositor = owner, .id = keylet.
key, .amount = asset(10)});
+
+
-
2966 auto tx = vault.deposit(
-
2967 {.depositor = depositor,
-
-
2969 .amount = asset(50)});
-
-
-
-
-
2974 {.depositor = charlie, .id = keylet.
key, .amount = asset(50)});
-
-
-
-
-
-
2980 testcase(
"private vault depositor lost authorization");
-
2981 env(credentials::deleteCred(
-
2982 credIssuer1, depositor, credIssuer1, credType));
-
2983 env(credentials::deleteCred(
-
2984 credIssuer1, charlie, credIssuer1, credType));
-
-
2986 auto credSle = env.le(credKeylet);
-
2987 BEAST_EXPECT(credSle ==
nullptr);
-
-
2989 auto tx = vault.deposit(
-
2990 {.depositor = depositor,
-
-
2992 .amount = asset(50)});
-
+
+
+
+
+
+
+
+
+
2974 .amount = asset(0)}));
+
+
+
2977 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+
2983 Account
const& owner,
+
2984 Account
const& issuer,
+
2985 Account
const& charlie,
+
+
+
+
+
+
+
2992 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
-
-
-
2997 auto const shares = [&env, keylet = keylet,
this]() ->
Asset {
-
2998 auto const vault = env.le(keylet);
-
2999 BEAST_EXPECT(vault !=
nullptr);
-
3000 return MPTIssue(vault->at(sfShareMPTID));
-
+
+
+
2997 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+
+
-
-
3004 testcase(
"private vault expired authorization");
-
3005 uint32_t
const closeTime = env.current()
-
-
3007 .parentCloseTime.time_since_epoch()
-
-
-
-
3011 credentials::create(depositor, credIssuer2, credType);
-
3012 tx0[sfExpiration] = closeTime + 20;
-
-
3014 tx0 = credentials::create(charlie, credIssuer2, credType);
-
3015 tx0[sfExpiration] = closeTime + 20;
-
-
-
-
3019 env(credentials::accept(depositor, credIssuer2, credType));
-
3020 env(credentials::accept(charlie, credIssuer2, credType));
-
-
-
-
-
3025 auto tx1 = vault.deposit(
-
3026 {.depositor = depositor,
-
-
3028 .amount = asset(50)});
-
-
-
-
-
-
3034 BEAST_EXPECT(env.le(tokenKeylet) !=
nullptr);
-
-
-
-
-
-
-
-
-
3043 auto const credsKeylet =
-
3044 credentials::keylet(depositor, credIssuer2, credType);
-
3045 BEAST_EXPECT(env.le(credsKeylet) !=
nullptr);
-
-
3047 auto tx2 = vault.deposit(
-
3048 {.depositor = depositor,
-
-
3050 .amount = asset(1)});
-
-
-
-
3054 BEAST_EXPECT(env.le(credsKeylet) ==
nullptr);
-
-
-
-
3058 auto const credsKeylet =
-
3059 credentials::keylet(charlie, credIssuer2, credType);
-
3060 BEAST_EXPECT(env.le(credsKeylet) !=
nullptr);
-
-
-
3063 BEAST_EXPECT(env.le(tokenKeylet) ==
nullptr);
-
-
3065 auto tx3 = vault.deposit(
-
3066 {.depositor = charlie,
-
-
3068 .amount = asset(2)});
-
-
-
-
3072 BEAST_EXPECT(env.le(credsKeylet) ==
nullptr);
-
3073 BEAST_EXPECT(env.le(tokenKeylet) ==
nullptr);
-
-
-
-
-
3078 testcase(
"private vault reset domainId");
-
3079 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
3080 tx[sfDomainID] =
"0";
-
-
-
-
-
3085 {.depositor = depositor,
-
-
3087 .amount = asset(50)});
-
-
-
-
3091 tx = vault.withdraw(
-
3092 {.depositor = depositor,
-
-
3094 .amount = asset(50)});
-
-
-
-
3098 tx = vault.clawback(
-
-
-
3101 .holder = depositor,
-
3102 .amount = asset(0)});
-
-
-
3105 tx = vault.clawback(
-
-
-
-
3109 .amount = asset(0)});
-
-
-
-
-
-
-
-
-
-
+
+
+
3005 auto tx = vault.withdraw(
+
3006 {.depositor = owner,
+
+
3008 .amount = asset(10)});
+
+
+
+
3012 tx[sfDestination] = charlie.human();
+
+
+
+
+
+
3018 {.depositor = owner,
+
+
3020 .amount = asset(10)});
+
+
+
+
+
+
+
+
+
+
3030 .amount = asset(0)}));
+
+
+
3033 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
-
-
-
-
-
-
3124 using namespace test::jtx;
-
-
-
-
3128 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
3129 Account owner{
"owner"};
-
3130 Account depositor{
"depositor"};
-
3131 Account alice{
"charlie"};
-
-
-
3134 env.fund(XRP(100000), owner, depositor, alice);
-
-
-
-
3138 auto [tx, keylet] = vault.create(
-
-
-
-
-
3143 auto const [vaultAccount, issuanceId] =
-
-
3145 auto const vault = env.le(keylet);
-
3146 BEAST_EXPECT(vault !=
nullptr);
-
3147 return {vault->at(sfAccount), vault->at(sfShareMPTID)};
-
-
-
-
-
-
-
3154 testcase(
"private XRP vault owner can deposit");
-
3155 auto tx = vault.deposit(
-
3156 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
-
-
-
-
-
-
3162 testcase(
"private XRP vault cannot pay shares to depositor yet");
-
3163 env(pay(owner, depositor, shares(1)), ter{
tecNO_AUTH});
-
-
+
+
+
+
+
+
3041 using namespace test::jtx;
+
+
+
+
3045 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
3046 Account issuer{
"issuer"};
+
3047 Account owner{
"owner"};
+
3048 Account depositor{
"depositor"};
+
3049 Account charlie{
"charlie"};
+
3050 Account pdOwner{
"pdOwner"};
+
3051 Account credIssuer1{
"credIssuer1"};
+
3052 Account credIssuer2{
"credIssuer2"};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
3070 env.trust(asset(1000), owner);
+
3071 env(pay(issuer, owner, asset(500)));
+
3072 env.trust(asset(1000), depositor);
+
3073 env(pay(issuer, depositor, asset(500)));
+
3074 env.trust(asset(1000), charlie);
+
3075 env(pay(issuer, charlie, asset(5)));
+
+
+
3078 auto [tx, keylet] = vault.create(
+
+
+
+
3082 BEAST_EXPECT(env.le(keylet));
+
+
+
3085 testcase(
"private vault owner can deposit");
+
3086 auto tx = vault.deposit(
+
3087 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
+
+
+
+
+
3092 testcase(
"private vault depositor not authorized yet");
+
3093 auto tx = vault.deposit(
+
3094 {.depositor = depositor,
+
+
3096 .amount = asset(50)});
+
+
+
+
+
3101 testcase(
"private vault cannot set non-existing domain");
+
3102 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
3108 testcase(
"private vault set domainId");
+
+
+
3111 pdomain::Credentials
const credentials1{
+
3112 {.issuer = credIssuer1, .credType = credType}};
+
+
3114 env(pdomain::setTx(pdOwner, credentials1));
+
3115 auto const domainId1 = [&]() {
+
+
3117 return pdomain::getNewDomain(env.meta());
+
+
+
3120 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
+
+
+
+
3131 pdomain::Credentials
const credentials{
+
3132 {.issuer = credIssuer1, .credType = credType},
+
3133 {.issuer = credIssuer2, .credType = credType}};
+
+
3135 env(pdomain::setTx(pdOwner, credentials));
+
3136 auto const domainId = [&]() {
+
+
3138 return pdomain::getNewDomain(env.meta());
+
+
+
3141 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
3147 tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
+
3155 testcase(
"private vault depositor still not authorized");
+
3156 auto tx = vault.deposit(
+
3157 {.depositor = depositor,
+
+
3159 .amount = asset(50)});
+
+
+
+
+
3164 auto const credKeylet =
+
3165 credentials::keylet(depositor, credIssuer1, credType);
-
3167 testcase(
"private XRP vault depositor not authorized yet");
-
3168 auto tx = vault.deposit(
-
3169 {.depositor = depositor,
-
-
3171 .amount = asset(50)});
-
-
-
-
-
3176 testcase(
"private XRP vault set DomainID");
-
3177 pdomain::Credentials
const credentials{
-
3178 {.issuer = owner, .credType = credType}};
-
-
3180 env(pdomain::setTx(owner, credentials));
-
3181 auto const domainId = [&]() {
-
-
3183 return pdomain::getNewDomain(env.meta());
-
-
-
3186 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
3192 auto const credKeylet = credentials::keylet(depositor, owner, credType);
-
-
3194 testcase(
"private XRP vault depositor now authorized");
-
3195 env(credentials::create(depositor, owner, credType));
-
3196 env(credentials::accept(depositor, owner, credType));
-
+
3167 testcase(
"private vault depositor now authorized");
+
3168 env(credentials::create(depositor, credIssuer1, credType));
+
3169 env(credentials::accept(depositor, credIssuer1, credType));
+
3170 env(credentials::create(charlie, credIssuer1, credType));
+
+
+
3173 auto credSle = env.le(credKeylet);
+
3174 BEAST_EXPECT(credSle !=
nullptr);
+
+
3176 auto tx = vault.deposit(
+
3177 {.depositor = depositor,
+
+
3179 .amount = asset(50)});
+
+
+
+
+
3184 {.depositor = charlie, .id = keylet.
key, .amount = asset(50)});
+
+
+
+
+
+
3190 testcase(
"private vault depositor lost authorization");
+
3191 env(credentials::deleteCred(
+
3192 credIssuer1, depositor, credIssuer1, credType));
+
3193 env(credentials::deleteCred(
+
3194 credIssuer1, charlie, credIssuer1, credType));
+
+
3196 auto credSle = env.le(credKeylet);
+
3197 BEAST_EXPECT(credSle ==
nullptr);
-
3199 BEAST_EXPECT(env.le(credKeylet));
-
3200 auto tx = vault.deposit(
-
3201 {.depositor = depositor,
-
-
3203 .amount = asset(50)});
-
-
-
-
-
-
3209 testcase(
"private XRP vault can pay shares to depositor");
-
3210 env(pay(owner, depositor, shares(1)));
-
+
3199 auto tx = vault.deposit(
+
3200 {.depositor = depositor,
+
+
3202 .amount = asset(50)});
+
+
+
+
+
3207 auto const shares = [&env, keylet = keylet,
this]() ->
Asset {
+
3208 auto const vault = env.le(keylet);
+
3209 BEAST_EXPECT(vault !=
nullptr);
+
3210 return MPTIssue(vault->at(sfShareMPTID));
+
-
3214 testcase(
"private XRP vault cannot pay shares to 3rd party");
-
-
3216 jv[sfAccount] = alice.human();
-
3217 jv[sfTransactionType] = jss::MPTokenAuthorize;
-
3218 jv[sfMPTokenIssuanceID] =
to_string(issuanceId);
-
-
-
-
3222 env(pay(owner, alice, shares(1)), ter{
tecNO_AUTH});
-
-
-
-
-
-
-
-
-
3229 using namespace test::jtx;
-
-
3231 testcase(
"fail pseudo-account allocation");
-
3232 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
3233 Account
const owner{
"owner"};
-
-
3235 env.fund(XRP(1000), owner);
-
-
3237 auto const keylet =
keylet::vault(owner.id(), env.seq(owner));
-
3238 for (
int i = 0; i < 256; ++i)
-
-
-
-
-
3243 env(pay(env.master.id(), accountId, XRP(1000)),
-
-
-
-
-
-
3249 auto [tx, keylet1] =
-
3250 vault.create({.owner = owner, .asset =
xrpIssue()});
-
3251 BEAST_EXPECT(keylet.
key == keylet1.key);
-
-
-
-
-
-
-
-
-
3258 using namespace test::jtx;
-
-
-
-
3262 Account
const& owner;
-
3263 Account
const& issuer;
-
3264 Account
const& depositor;
-
3265 Account
const& vaultAccount;
-
-
-
-
-
-
-
-
+
3214 testcase(
"private vault expired authorization");
+
3215 uint32_t
const closeTime = env.current()
+
+
3217 .parentCloseTime.time_since_epoch()
+
+
+
+
3221 credentials::create(depositor, credIssuer2, credType);
+
3222 tx0[sfExpiration] = closeTime + 20;
+
+
3224 tx0 = credentials::create(charlie, credIssuer2, credType);
+
3225 tx0[sfExpiration] = closeTime + 20;
+
+
+
+
3229 env(credentials::accept(depositor, credIssuer2, credType));
+
3230 env(credentials::accept(charlie, credIssuer2, credType));
+
+
+
+
+
3235 auto tx1 = vault.deposit(
+
3236 {.depositor = depositor,
+
+
3238 .amount = asset(50)});
+
+
+
+
+
+
3244 BEAST_EXPECT(env.le(tokenKeylet) !=
nullptr);
+
+
+
+
+
+
+
+
+
3253 auto const credsKeylet =
+
3254 credentials::keylet(depositor, credIssuer2, credType);
+
3255 BEAST_EXPECT(env.le(credsKeylet) !=
nullptr);
+
+
3257 auto tx2 = vault.deposit(
+
3258 {.depositor = depositor,
+
+
3260 .amount = asset(1)});
+
+
+
+
3264 BEAST_EXPECT(env.le(credsKeylet) ==
nullptr);
+
+
+
+
3268 auto const credsKeylet =
+
3269 credentials::keylet(charlie, credIssuer2, credType);
+
3270 BEAST_EXPECT(env.le(credsKeylet) !=
nullptr);
+
+
+
3273 BEAST_EXPECT(env.le(tokenKeylet) ==
nullptr);
-
3275 auto testCase = [&,
this](
-
-
-
3278 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
3279 Account
const owner{
"owner"};
-
3280 Account
const issuer{
"issuer"};
-
3281 Account
const depositor{
"depositor"};
-
-
3283 env.fund(XRP(1000), issuer, owner, depositor);
-
-
+
3275 auto tx3 = vault.deposit(
+
3276 {.depositor = charlie,
+
+
3278 .amount = asset(2)});
+
+
+
+
3282 BEAST_EXPECT(env.le(credsKeylet) ==
nullptr);
+
3283 BEAST_EXPECT(env.le(tokenKeylet) ==
nullptr);
+
+
-
-
3288 env.trust(asset(1000), owner);
-
3289 env.trust(asset(1000), depositor);
-
3290 env(pay(issuer, owner, asset(200)));
-
3291 env(pay(issuer, depositor, asset(200)));
+
+
3288 testcase(
"private vault reset domainId");
+
3289 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
3290 tx[sfDomainID] =
"0";
+
-
3294 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
3295 tx[sfScale] = scale;
-
-
-
3298 auto const [vaultAccount, issuanceId] =
-
-
3300 auto const vault = env.le(keylet);
-
-
3302 Account(
"vault", vault->at(sfAccount)),
-
3303 vault->at(sfShareMPTID)};
-
-
-
3306 env.memoize(vaultAccount);
+
+
3295 {.depositor = depositor,
+
+
3297 .amount = asset(50)});
+
+
+
+
3301 tx = vault.withdraw(
+
3302 {.depositor = depositor,
+
+
3304 .amount = asset(50)});
+
+
-
-
-
3310 return env.app().openLedger().modify(
-
-
-
-
3314 if (!BEAST_EXPECT(vault !=
nullptr))
-
-
3316 auto shares = sb.
peek(
-
-
3318 if (!BEAST_EXPECT(shares !=
nullptr))
-
-
3320 if (fn(*vault, *shares))
-
-
-
-
-
-
-
-
-
+
3308 tx = vault.clawback(
+
+
+
3311 .holder = depositor,
+
3312 .amount = asset(0)});
+
+
+
3315 tx = vault.clawback(
+
+
+
+
3319 .amount = asset(0)});
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
3335 .depositor = depositor,
-
3336 .vaultAccount = vaultAccount,
-
-
-
-
-
-
-
-
-
-
3346 testCase(18, [&,
this](Env& env, Data d) {
-
3347 testcase(
"Scale deposit overflow on first deposit");
-
3348 auto tx = d.vault.deposit(
-
3349 {.depositor = d.depositor,
-
-
3351 .amount = d.asset(10)});
-
-
-
-
-
3356 testCase(18, [&,
this](Env& env, Data d) {
-
3357 testcase(
"Scale deposit overflow on second deposit");
-
-
-
3360 auto tx = d.vault.deposit(
-
3361 {.depositor = d.depositor,
-
-
3363 .amount = d.asset(5)});
-
-
-
-
-
-
3369 auto tx = d.vault.deposit(
-
3370 {.depositor = d.depositor,
-
-
3372 .amount = d.asset(10)});
-
-
-
-
-
-
3378 testCase(18, [&,
this](Env& env, Data d) {
-
3379 testcase(
"Scale deposit overflow on total shares");
-
-
-
3382 auto tx = d.vault.deposit(
-
3383 {.depositor = d.depositor,
-
-
3385 .amount = d.asset(5)});
-
-
-
+
+
+
+
+
3334 using namespace test::jtx;
+
+
+
+
3338 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
3339 Account owner{
"owner"};
+
3340 Account depositor{
"depositor"};
+
3341 Account alice{
"charlie"};
+
+
+
3344 env.fund(XRP(100000), owner, depositor, alice);
+
+
+
+
3348 auto [tx, keylet] = vault.create(
+
+
+
+
+
3353 auto const [vaultAccount, issuanceId] =
+
+
3355 auto const vault = env.le(keylet);
+
3356 BEAST_EXPECT(vault !=
nullptr);
+
3357 return {vault->at(sfAccount), vault->at(sfShareMPTID)};
+
+
+
+
+
+
+
3364 testcase(
"private XRP vault owner can deposit");
+
3365 auto tx = vault.deposit(
+
3366 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
+
+
+
+
+
+
3372 testcase(
"private XRP vault cannot pay shares to depositor yet");
+
3373 env(pay(owner, depositor, shares(1)), ter{
tecNO_AUTH});
+
+
+
+
3377 testcase(
"private XRP vault depositor not authorized yet");
+
3378 auto tx = vault.deposit(
+
3379 {.depositor = depositor,
+
+
3381 .amount = asset(50)});
+
+
+
+
+
3386 testcase(
"private XRP vault set DomainID");
+
3387 pdomain::Credentials
const credentials{
+
3388 {.issuer = owner, .credType = credType}};
-
-
3391 auto tx = d.vault.deposit(
-
3392 {.depositor = d.depositor,
-
-
3394 .amount = d.asset(5)});
-
-
-
-
-
-
3400 testCase(1, [&,
this](Env& env, Data d) {
-
-
-
3403 auto const start = env.balance(d.depositor, d.assets).number();
-
3404 auto tx = d.vault.deposit(
-
3405 {.depositor = d.depositor,
-
-
3407 .amount = d.asset(1)});
-
-
-
3410 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(10));
-
-
3412 env.balance(d.depositor, d.assets) ==
-
-
-
-
3416 testCase(1, [&,
this](Env& env, Data d) {
-
3417 testcase(
"Scale deposit insignificant amount");
-
-
3419 auto tx = d.vault.deposit(
-
3420 {.depositor = d.depositor,
-
-
-
-
-
-
3426 testCase(1, [&,
this](Env& env, Data d) {
-
3427 testcase(
"Scale deposit exact, using full precision");
-
-
3429 auto const start = env.balance(d.depositor, d.assets).number();
-
3430 auto tx = d.vault.deposit(
-
3431 {.depositor = d.depositor,
-
-
-
-
-
3436 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(15));
-
-
3438 env.balance(d.depositor, d.assets) ==
-
-
-
-
3442 testCase(1, [&,
this](Env& env, Data d) {
-
3443 testcase(
"Scale deposit exact, truncating from .5");
-
-
3445 auto const start = env.balance(d.depositor, d.assets).number();
-
-
-
-
3449 auto tx = d.vault.deposit(
-
3450 {.depositor = d.depositor,
-
-
-
-
-
3455 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(12));
-
-
3457 env.balance(d.depositor, d.assets) ==
-
-
-
-
-
3462 auto tx = d.vault.deposit(
-
3463 {.depositor = d.depositor,
-
-
-
-
-
3468 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(24));
-
-
3470 env.balance(d.depositor, d.assets) ==
-
-
-
-
-
3475 auto tx = d.vault.deposit(
-
3476 {.depositor = d.depositor,
-
-
-
-
-
3481 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(36));
-
-
3483 env.balance(d.depositor, d.assets) ==
-
-
-
-
-
3488 testCase(1, [&,
this](Env& env, Data d) {
-
3489 testcase(
"Scale deposit exact, truncating from .01");
-
-
3491 auto const start = env.balance(d.depositor, d.assets).number();
-
-
3493 auto tx = d.vault.deposit(
-
3494 {.depositor = d.depositor,
-
-
-
-
-
3499 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(12));
-
-
3501 env.balance(d.depositor, d.assets) ==
-
+
3390 env(pdomain::setTx(owner, credentials));
+
3391 auto const domainId = [&]() {
+
+
3393 return pdomain::getNewDomain(env.meta());
+
+
+
3396 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
3402 auto const credKeylet = credentials::keylet(depositor, owner, credType);
+
+
3404 testcase(
"private XRP vault depositor now authorized");
+
3405 env(credentials::create(depositor, owner, credType));
+
3406 env(credentials::accept(depositor, owner, credType));
+
+
+
3409 BEAST_EXPECT(env.le(credKeylet));
+
3410 auto tx = vault.deposit(
+
3411 {.depositor = depositor,
+
+
3413 .amount = asset(50)});
+
+
+
+
+
+
3419 testcase(
"private XRP vault can pay shares to depositor");
+
3420 env(pay(owner, depositor, shares(1)));
+
+
+
+
3424 testcase(
"private XRP vault cannot pay shares to 3rd party");
+
+
3426 jv[sfAccount] = alice.human();
+
3427 jv[sfTransactionType] = jss::MPTokenAuthorize;
+
3428 jv[sfMPTokenIssuanceID] =
to_string(issuanceId);
+
+
+
+
3432 env(pay(owner, alice, shares(1)), ter{
tecNO_AUTH});
+
+
+
+
+
+
+
+
+
3439 using namespace test::jtx;
+
+
3441 testcase(
"fail pseudo-account allocation");
+
3442 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
3443 Account
const owner{
"owner"};
+
+
3445 env.fund(XRP(1000), owner);
+
+
3447 auto const keylet =
keylet::vault(owner.id(), env.seq(owner));
+
3448 for (
int i = 0; i < 256; ++i)
+
+
+
+
+
3453 env(pay(env.master.id(), accountId, XRP(1000)),
+
+
+
+
+
+
3459 auto [tx, keylet1] =
+
3460 vault.create({.owner = owner, .asset =
xrpIssue()});
+
3461 BEAST_EXPECT(keylet.
key == keylet1.key);
+
+
+
+
+
+
+
+
+
3468 using namespace test::jtx;
+
+
+
+
3472 Account
const& owner;
+
3473 Account
const& issuer;
+
3474 Account
const& depositor;
+
3475 Account
const& vaultAccount;
+
+
+
+
+
+
+
+
+
+
3485 auto testCase = [&,
this](
+
+
+
3488 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
3489 Account
const owner{
"owner"};
+
3490 Account
const issuer{
"issuer"};
+
3491 Account
const depositor{
"depositor"};
+
+
3493 env.fund(XRP(1000), issuer, owner, depositor);
+
+
+
+
+
3498 env.trust(asset(1000), owner);
+
3499 env.trust(asset(1000), depositor);
+
3500 env(pay(issuer, owner, asset(200)));
+
3501 env(pay(issuer, depositor, asset(200)));
+
-
-
-
3506 auto tx = d.vault.deposit(
-
3507 {.depositor = d.depositor,
-
-
-
-
-
3512 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(18));
-
-
3514 env.balance(d.depositor, d.assets) ==
-
-
-
-
-
3519 testCase(1, [&,
this](Env& env, Data d) {
-
3520 testcase(
"Scale deposit exact, truncating from .99");
-
-
3522 auto const start = env.balance(d.depositor, d.assets).number();
-
-
3524 auto tx = d.vault.deposit(
-
3525 {.depositor = d.depositor,
-
-
-
-
-
3530 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(12));
-
-
3532 env.balance(d.depositor, d.assets) ==
-
-
-
-
-
3537 auto tx = d.vault.deposit(
-
3538 {.depositor = d.depositor,
-
-
-
-
-
3543 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(18));
-
-
3545 env.balance(d.depositor, d.assets) ==
-
-
-
-
-
3550 testCase(1, [&,
this](Env& env, Data d) {
-
-
3552 auto const start = env.balance(d.depositor, d.assets).number();
-
3553 auto tx = d.vault.deposit(
-
3554 {.depositor = d.depositor,
-
-
-
-
-
3559 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(1000));
-
-
3561 env.balance(d.depositor, d.assets) ==
-
-
-
3564 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3567 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
-
-
-
-
3576 auto const start = env.balance(d.depositor, d.assets).number();
-
3577 auto tx = d.vault.withdraw(
-
3578 {.depositor = d.depositor,
-
-
-
-
-
-
3584 env.balance(d.depositor, d.shares) == d.share(900));
-
-
3586 env.balance(d.depositor, d.assets) ==
-
-
-
3589 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3592 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
3597 testcase(
"Scale redeem with rounding");
-
-
-
-
-
3602 auto const start = env.balance(d.depositor, d.assets).number();
-
3603 d.peek([](
SLE& vault,
auto&) ->
bool {
-
3604 vault[sfAssetsAvailable] =
Number(1);
-
-
-
-
-
-
-
-
3612 auto tx = d.vault.withdraw(
-
3613 {.depositor = d.depositor,
-
-
-
-
-
-
3619 env.balance(d.depositor, d.shares) == d.share(900 - 25));
-
-
3621 env.balance(d.depositor, d.assets) ==
-
-
-
3624 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3627 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
-
-
-
-
-
3637 auto const start = env.balance(d.depositor, d.assets).number();
+
3504 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
3505 tx[sfScale] = scale;
+
+
+
3508 auto const [vaultAccount, issuanceId] =
+
+
3510 auto const vault = env.le(keylet);
+
+
3512 Account(
"vault", vault->at(sfAccount)),
+
3513 vault->at(sfShareMPTID)};
+
+
+
3516 env.memoize(vaultAccount);
+
+
+
+
3520 return env.app().openLedger().modify(
+
+
+
+
3524 if (!BEAST_EXPECT(vault !=
nullptr))
+
+
3526 auto shares = sb.
peek(
+
+
3528 if (!BEAST_EXPECT(shares !=
nullptr))
+
+
3530 if (fn(*vault, *shares))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
3545 .depositor = depositor,
+
3546 .vaultAccount = vaultAccount,
+
+
+
+
+
+
+
+
+
+
3556 testCase(18, [&,
this](Env& env, Data d) {
+
3557 testcase(
"Scale deposit overflow on first deposit");
+
3558 auto tx = d.vault.deposit(
+
3559 {.depositor = d.depositor,
+
+
3561 .amount = d.asset(10)});
+
+
+
+
+
3566 testCase(18, [&,
this](Env& env, Data d) {
+
3567 testcase(
"Scale deposit overflow on second deposit");
+
+
+
3570 auto tx = d.vault.deposit(
+
3571 {.depositor = d.depositor,
+
+
3573 .amount = d.asset(5)});
+
+
+
+
+
+
3579 auto tx = d.vault.deposit(
+
3580 {.depositor = d.depositor,
+
+
3582 .amount = d.asset(10)});
+
+
+
+
+
+
3588 testCase(18, [&,
this](Env& env, Data d) {
+
3589 testcase(
"Scale deposit overflow on total shares");
+
+
+
3592 auto tx = d.vault.deposit(
+
3593 {.depositor = d.depositor,
+
+
3595 .amount = d.asset(5)});
+
+
+
+
+
+
3601 auto tx = d.vault.deposit(
+
3602 {.depositor = d.depositor,
+
+
3604 .amount = d.asset(5)});
+
+
+
+
+
+
3610 testCase(1, [&,
this](Env& env, Data d) {
+
+
+
3613 auto const start = env.balance(d.depositor, d.assets).number();
+
3614 auto tx = d.vault.deposit(
+
3615 {.depositor = d.depositor,
+
+
3617 .amount = d.asset(1)});
+
+
+
3620 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(10));
+
+
3622 env.balance(d.depositor, d.assets) ==
+
+
+
+
3626 testCase(1, [&,
this](Env& env, Data d) {
+
3627 testcase(
"Scale deposit insignificant amount");
+
+
3629 auto tx = d.vault.deposit(
+
3630 {.depositor = d.depositor,
+
+
+
+
+
+
3636 testCase(1, [&,
this](Env& env, Data d) {
+
3637 testcase(
"Scale deposit exact, using full precision");
-
3639 tx = d.vault.withdraw(
-
3640 {.depositor = d.depositor,
-
-
-
-
-
-
3646 env.balance(d.depositor, d.shares) == d.share(875 - 21));
-
-
3648 env.balance(d.depositor, d.assets) ==
-
-
-
3651 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3654 env.balance(d.vaultAccount, d.shares) ==
-
-
-
+
3639 auto const start = env.balance(d.depositor, d.assets).number();
+
3640 auto tx = d.vault.deposit(
+
3641 {.depositor = d.depositor,
+
+
+
+
+
3646 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(15));
+
+
3648 env.balance(d.depositor, d.assets) ==
+
+
+
+
3652 testCase(1, [&,
this](Env& env, Data d) {
+
3653 testcase(
"Scale deposit exact, truncating from .5");
+
+
3655 auto const start = env.balance(d.depositor, d.assets).number();
+
+
-
-
3660 auto const rest = env.balance(d.depositor, d.shares).number();
-
-
3662 tx = d.vault.withdraw(
-
3663 {.depositor = d.depositor,
-
-
3665 .amount =
STAmount(d.share, rest)});
-
-
-
3668 BEAST_EXPECT(env.balance(d.depositor, d.shares).number() == 0);
-
-
3670 env.balance(d.vaultAccount, d.assets).number() == 0);
-
-
3672 env.balance(d.vaultAccount, d.shares).number() == 0);
-
-
-
-
3676 testCase(18, [&,
this](Env& env, Data d) {
-
3677 testcase(
"Scale withdraw overflow");
-
-
-
3680 auto tx = d.vault.deposit(
-
3681 {.depositor = d.depositor,
-
-
3683 .amount = d.asset(5)});
-
-
-
-
-
-
3689 auto tx = d.vault.withdraw(
-
3690 {.depositor = d.depositor,
-
-
-
-
+
3659 auto tx = d.vault.deposit(
+
3660 {.depositor = d.depositor,
+
+
+
+
+
3665 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(12));
+
+
3667 env.balance(d.depositor, d.assets) ==
+
+
+
+
+
3672 auto tx = d.vault.deposit(
+
3673 {.depositor = d.depositor,
+
+
+
+
+
3678 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(24));
+
+
3680 env.balance(d.depositor, d.assets) ==
+
+
+
+
+
3685 auto tx = d.vault.deposit(
+
3686 {.depositor = d.depositor,
+
+
+
+
+
3691 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(36));
+
+
3693 env.balance(d.depositor, d.assets) ==
+
3698 testCase(1, [&,
this](Env& env, Data d) {
-
-
3700 auto const start = env.balance(d.depositor, d.assets).number();
-
3701 auto tx = d.vault.deposit(
-
3702 {.depositor = d.depositor,
-
-
-
-
-
3707 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(1000));
-
-
3709 env.balance(d.depositor, d.assets) ==
-
-
-
3712 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3715 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
-
-
-
-
-
-
-
3727 auto const start = env.balance(d.depositor, d.assets).number();
-
3728 auto tx = d.vault.withdraw(
-
3729 {.depositor = d.depositor,
-
-
-
-
-
-
3735 env.balance(d.depositor, d.shares) == d.share(900));
-
-
3737 env.balance(d.depositor, d.assets) ==
-
-
-
3740 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3743 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
3748 testcase(
"Scale withdraw insignificant amount");
-
3749 auto tx = d.vault.withdraw(
-
3750 {.depositor = d.depositor,
-
-
-
-
-
-
-
3757 testcase(
"Scale withdraw with rounding assets");
-
-
-
-
-
-
-
-
3765 auto const start = env.balance(d.depositor, d.assets).number();
-
3766 d.peek([](
SLE& vault,
auto&) ->
bool {
-
3767 vault[sfAssetsAvailable] =
Number(1);
-
-
-
-
-
-
-
-
3775 auto tx = d.vault.withdraw(
-
3776 {.depositor = d.depositor,
-
-
-
-
-
-
3782 env.balance(d.depositor, d.shares) == d.share(900 - 25));
-
-
3784 env.balance(d.depositor, d.assets) ==
-
-
-
3787 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3790 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
3795 testcase(
"Scale withdraw with rounding shares up");
-
-
-
-
-
-
-
-
3803 auto const start = env.balance(d.depositor, d.assets).number();
-
3804 auto tx = d.vault.withdraw(
-
3805 {.depositor = d.depositor,
-
-
-
-
-
-
3811 env.balance(d.depositor, d.shares) == d.share(875 - 38));
-
-
3813 env.balance(d.depositor, d.assets) ==
-
-
-
3816 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3819 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
3824 testcase(
"Scale withdraw with rounding shares down");
-
-
-
-
-
-
-
-
3832 auto const start = env.balance(d.depositor, d.assets).number();
-
3833 auto tx = d.vault.withdraw(
-
3834 {.depositor = d.depositor,
-
-
-
-
-
-
3840 env.balance(d.depositor, d.shares) == d.share(837 - 37));
-
-
3842 env.balance(d.depositor, d.assets) ==
-
-
-
3845 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3848 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
3853 testcase(
"Scale withdraw tiny amount");
-
-
3855 auto const start = env.balance(d.depositor, d.assets).number();
-
3856 auto tx = d.vault.withdraw(
-
3857 {.depositor = d.depositor,
-
-
-
-
-
-
3863 env.balance(d.depositor, d.shares) == d.share(800 - 1));
-
-
3865 env.balance(d.depositor, d.assets) ==
-
-
-
3868 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3871 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
-
-
3878 env.balance(d.vaultAccount, d.assets).number();
-
-
3880 tx = d.vault.withdraw(
-
3881 {.depositor = d.depositor,
-
-
3883 .amount =
STAmount(d.asset, rest)});
-
-
-
3886 BEAST_EXPECT(env.balance(d.depositor, d.shares).number() == 0);
-
-
3888 env.balance(d.vaultAccount, d.assets).number() == 0);
-
-
3890 env.balance(d.vaultAccount, d.shares).number() == 0);
-
-
-
-
3894 testCase(18, [&,
this](Env& env, Data d) {
-
3895 testcase(
"Scale clawback overflow");
-
-
-
3898 auto tx = d.vault.deposit(
-
3899 {.depositor = d.depositor,
-
-
3901 .amount = d.asset(5)});
-
-
-
-
-
-
3907 auto tx = d.vault.clawback(
-
3908 {.issuer = d.issuer,
-
-
3910 .holder = d.depositor,
-
-
-
-
-
-
-
3917 testCase(1, [&,
this](Env& env, Data d) {
-
-
3919 auto const start = env.balance(d.depositor, d.assets).number();
-
3920 auto tx = d.vault.deposit(
-
3921 {.depositor = d.depositor,
-
-
-
-
-
3926 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(1000));
-
-
3928 env.balance(d.depositor, d.assets) ==
-
-
-
3931 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3934 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
-
-
-
-
-
-
3945 auto const start = env.balance(d.depositor, d.assets).number();
-
3946 auto tx = d.vault.clawback(
-
3947 {.issuer = d.issuer,
-
-
3949 .holder = d.depositor,
-
-
-
-
-
3954 env.balance(d.depositor, d.shares) == d.share(900));
-
-
3956 env.balance(d.depositor, d.assets) ==
-
-
-
3959 env.balance(d.vaultAccount, d.assets) ==
-
-
-
3962 env.balance(d.vaultAccount, d.shares) ==
-
+
3699 testcase(
"Scale deposit exact, truncating from .01");
+
+
3701 auto const start = env.balance(d.depositor, d.assets).number();
+
+
3703 auto tx = d.vault.deposit(
+
3704 {.depositor = d.depositor,
+
+
+
+
+
3709 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(12));
+
+
3711 env.balance(d.depositor, d.assets) ==
+
+
+
+
+
3716 auto tx = d.vault.deposit(
+
3717 {.depositor = d.depositor,
+
+
+
+
+
3722 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(18));
+
+
3724 env.balance(d.depositor, d.assets) ==
+
+
+
+
+
3729 testCase(1, [&,
this](Env& env, Data d) {
+
3730 testcase(
"Scale deposit exact, truncating from .99");
+
+
3732 auto const start = env.balance(d.depositor, d.assets).number();
+
+
3734 auto tx = d.vault.deposit(
+
3735 {.depositor = d.depositor,
+
+
+
+
+
3740 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(12));
+
+
3742 env.balance(d.depositor, d.assets) ==
+
+
+
+
+
3747 auto tx = d.vault.deposit(
+
3748 {.depositor = d.depositor,
+
+
+
+
+
3753 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(18));
+
+
3755 env.balance(d.depositor, d.assets) ==
+
+
+
+
+
3760 testCase(1, [&,
this](Env& env, Data d) {
+
+
3762 auto const start = env.balance(d.depositor, d.assets).number();
+
3763 auto tx = d.vault.deposit(
+
3764 {.depositor = d.depositor,
+
+
+
+
+
3769 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(1000));
+
+
3771 env.balance(d.depositor, d.assets) ==
+
+
+
3774 env.balance(d.vaultAccount, d.assets) ==
+
+
+
3777 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
+
+
+
+
3786 auto const start = env.balance(d.depositor, d.assets).number();
+
3787 auto tx = d.vault.withdraw(
+
3788 {.depositor = d.depositor,
+
+
+
+
+
+
3794 env.balance(d.depositor, d.shares) == d.share(900));
+
+
3796 env.balance(d.depositor, d.assets) ==
+
+
+
3799 env.balance(d.vaultAccount, d.assets) ==
+
+
+
3802 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
3807 testcase(
"Scale redeem with rounding");
+
+
+
+
+
3812 auto const start = env.balance(d.depositor, d.assets).number();
+
3813 d.peek([](
SLE& vault,
auto&) ->
bool {
+
3814 vault[sfAssetsAvailable] =
Number(1);
+
+
+
+
+
+
+
+
3822 auto tx = d.vault.withdraw(
+
3823 {.depositor = d.depositor,
+
+
+
+
+
+
3829 env.balance(d.depositor, d.shares) == d.share(900 - 25));
+
+
3831 env.balance(d.depositor, d.assets) ==
+
+
+
3834 env.balance(d.vaultAccount, d.assets) ==
+
+
+
3837 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
+
+
+
+
+
3847 auto const start = env.balance(d.depositor, d.assets).number();
+
+
3849 tx = d.vault.withdraw(
+
3850 {.depositor = d.depositor,
+
+
+
+
+
+
3856 env.balance(d.depositor, d.shares) == d.share(875 - 21));
+
+
3858 env.balance(d.depositor, d.assets) ==
+
+
+
3861 env.balance(d.vaultAccount, d.assets) ==
+
+
+
3864 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
+
3870 auto const rest = env.balance(d.depositor, d.shares).number();
+
+
3872 tx = d.vault.withdraw(
+
3873 {.depositor = d.depositor,
+
+
3875 .amount =
STAmount(d.share, rest)});
+
+
+
3878 BEAST_EXPECT(env.balance(d.depositor, d.shares).number() == 0);
+
+
3880 env.balance(d.vaultAccount, d.assets).number() == 0);
+
+
3882 env.balance(d.vaultAccount, d.shares).number() == 0);
+
+
+
+
3886 testCase(18, [&,
this](Env& env, Data d) {
+
3887 testcase(
"Scale withdraw overflow");
+
+
+
3890 auto tx = d.vault.deposit(
+
3891 {.depositor = d.depositor,
+
+
3893 .amount = d.asset(5)});
+
+
+
+
+
+
3899 auto tx = d.vault.withdraw(
+
3900 {.depositor = d.depositor,
+
+
+
+
+
+
+
+
3908 testCase(1, [&,
this](Env& env, Data d) {
+
+
3910 auto const start = env.balance(d.depositor, d.assets).number();
+
3911 auto tx = d.vault.deposit(
+
3912 {.depositor = d.depositor,
+
+
+
+
+
3917 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(1000));
+
+
3919 env.balance(d.depositor, d.assets) ==
+
+
+
3922 env.balance(d.vaultAccount, d.assets) ==
+
+
+
3925 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
+
+
+
+
+
+
+
3937 auto const start = env.balance(d.depositor, d.assets).number();
+
3938 auto tx = d.vault.withdraw(
+
3939 {.depositor = d.depositor,
+
+
+
+
+
+
3945 env.balance(d.depositor, d.shares) == d.share(900));
+
+
3947 env.balance(d.depositor, d.assets) ==
+
+
+
3950 env.balance(d.vaultAccount, d.assets) ==
+
+
+
3953 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
3958 testcase(
"Scale withdraw insignificant amount");
+
3959 auto tx = d.vault.withdraw(
+
3960 {.depositor = d.depositor,
+
+
+
-
3967 testcase(
"Scale clawback insignificant amount");
-
3968 auto tx = d.vault.clawback(
-
3969 {.issuer = d.issuer,
-
-
3971 .holder = d.depositor,
-
-
-
-
-
-
3977 testcase(
"Scale clawback with rounding assets");
-
-
-
-
-
-
-
-
3985 auto const start = env.balance(d.depositor, d.assets).number();
-
3986 auto tx = d.vault.clawback(
-
3987 {.issuer = d.issuer,
-
-
3989 .holder = d.depositor,
-
-
-
+
3967 testcase(
"Scale withdraw with rounding assets");
+
+
+
+
+
+
+
+
3975 auto const start = env.balance(d.depositor, d.assets).number();
+
3976 d.peek([](
SLE& vault,
auto&) ->
bool {
+
3977 vault[sfAssetsAvailable] =
Number(1);
+
+
+
+
+
+
+
+
3985 auto tx = d.vault.withdraw(
+
3986 {.depositor = d.depositor,
+
+
+
+
+
+
3992 env.balance(d.depositor, d.shares) == d.share(900 - 25));
-
3994 env.balance(d.depositor, d.shares) == d.share(900 - 25));
-
-
3996 env.balance(d.depositor, d.assets) ==
-
-
-
3999 env.balance(d.vaultAccount, d.assets) ==
-
-
-
4002 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
4007 testcase(
"Scale clawback with rounding shares up");
-
-
-
-
-
-
-
-
4015 auto const start = env.balance(d.depositor, d.assets).number();
-
4016 auto tx = d.vault.clawback(
-
4017 {.issuer = d.issuer,
-
-
4019 .holder = d.depositor,
-
-
-
-
-
4024 env.balance(d.depositor, d.shares) == d.share(875 - 38));
+
3994 env.balance(d.depositor, d.assets) ==
+
+
+
3997 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4000 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
4005 testcase(
"Scale withdraw with rounding shares up");
+
+
+
+
+
+
+
+
4013 auto const start = env.balance(d.depositor, d.assets).number();
+
4014 auto tx = d.vault.withdraw(
+
4015 {.depositor = d.depositor,
+
+
+
+
+
+
4021 env.balance(d.depositor, d.shares) == d.share(875 - 38));
+
+
4023 env.balance(d.depositor, d.assets) ==
+
-
4026 env.balance(d.depositor, d.assets) ==
-
+
4026 env.balance(d.vaultAccount, d.assets) ==
+
-
4029 env.balance(d.vaultAccount, d.assets) ==
-
-
-
4032 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
4037 testcase(
"Scale clawback with rounding shares down");
-
-
-
-
-
-
-
-
4045 auto const start = env.balance(d.depositor, d.assets).number();
-
4046 auto tx = d.vault.clawback(
-
4047 {.issuer = d.issuer,
-
-
4049 .holder = d.depositor,
-
-
-
-
-
4054 env.balance(d.depositor, d.shares) == d.share(837 - 37));
-
-
4056 env.balance(d.depositor, d.assets) ==
-
-
-
4059 env.balance(d.vaultAccount, d.assets) ==
-
-
-
4062 env.balance(d.vaultAccount, d.shares) ==
-
-
-
-
-
4067 testcase(
"Scale clawback tiny amount");
-
-
4069 auto const start = env.balance(d.depositor, d.assets).number();
-
4070 auto tx = d.vault.clawback(
-
4071 {.issuer = d.issuer,
-
-
4073 .holder = d.depositor,
-
-
-
+
4029 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
4034 testcase(
"Scale withdraw with rounding shares down");
+
+
+
+
+
+
+
+
4042 auto const start = env.balance(d.depositor, d.assets).number();
+
4043 auto tx = d.vault.withdraw(
+
4044 {.depositor = d.depositor,
+
+
+
+
+
+
4050 env.balance(d.depositor, d.shares) == d.share(837 - 37));
+
+
4052 env.balance(d.depositor, d.assets) ==
+
+
+
4055 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4058 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
4063 testcase(
"Scale withdraw tiny amount");
+
+
4065 auto const start = env.balance(d.depositor, d.assets).number();
+
4066 auto tx = d.vault.withdraw(
+
4067 {.depositor = d.depositor,
+
+
+
+
+
+
4073 env.balance(d.depositor, d.shares) == d.share(800 - 1));
+
+
4075 env.balance(d.depositor, d.assets) ==
+
-
4078 env.balance(d.depositor, d.shares) == d.share(800 - 1));
-
-
4080 env.balance(d.depositor, d.assets) ==
-
-
-
4083 env.balance(d.vaultAccount, d.assets) ==
-
-
-
4086 env.balance(d.vaultAccount, d.shares) ==
-
-
+
4078 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4081 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
+
+
4088 env.balance(d.vaultAccount, d.assets).number();
-
-
-
-
4093 env.balance(d.vaultAccount, d.assets).number();
-
4094 d.peek([](
SLE& vault,
auto&) ->
bool {
-
4095 vault[sfAssetsAvailable] =
Number(5);
-
-
-
-
-
-
-
-
4103 tx = d.vault.clawback(
-
4104 {.issuer = d.issuer,
-
-
4106 .holder = d.depositor,
-
4107 .amount =
STAmount(d.asset, rest)});
-
-
-
4110 BEAST_EXPECT(env.balance(d.depositor, d.shares).number() == 0);
-
-
4112 env.balance(d.vaultAccount, d.assets).number() == 0);
-
-
4114 env.balance(d.vaultAccount, d.shares).number() == 0);
-
-
-
-
-
-
-
-
-
-
4122 using namespace test::jtx;
-
-
-
4125 Env env{*
this, testable_amendments() | featureSingleAssetVault};
-
4126 Account
const owner{
"owner"};
-
4127 Account
const issuer{
"issuer"};
-
-
4129 env.fund(XRP(1000), issuer, owner);
-
-
-
-
4133 env.trust(asset(1000), owner);
-
4134 env(pay(issuer, owner, asset(200)));
-
-
-
4137 auto const sequence = env.seq(owner);
-
4138 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
4144 auto tx1 = vault.deposit(
-
4145 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
-
-
-
4148 auto tx2 = vault.set({.owner = owner, .id = keylet.
key});
-
4149 tx2[sfAssetsMaximum] = asset(1000).number();
-
-
-
-
-
4154 auto const sleVault = [&env, keylet = keylet,
this]() {
-
4155 auto const vault = env.le(keylet);
-
4156 BEAST_EXPECT(vault !=
nullptr);
-
-
-
-
4160 auto const check = [&, keylet = keylet, sle = sleVault,
this](
-
-
-
4163 BEAST_EXPECT(vault.isObject());
-
-
4165 constexpr auto checkString =
-
-
4167 return node.isMember(field.fieldName) &&
-
4168 node[field.fieldName].isString() &&
-
4169 node[field.fieldName] == v;
-
-
4171 constexpr auto checkObject =
-
-
4173 return node.isMember(field.fieldName) &&
-
4174 node[field.fieldName].isObject() &&
-
4175 node[field.fieldName] == v;
-
-
4177 constexpr auto checkInt =
-
4178 [](
auto& node,
SField const& field,
int v) ->
bool {
-
4179 return node.isMember(field.fieldName) &&
-
4180 ((node[field.fieldName].isInt() &&
-
4181 node[field.fieldName] ==
Json::Int(v)) ||
-
4182 (node[field.fieldName].isUInt() &&
-
-
+
4090 tx = d.vault.withdraw(
+
4091 {.depositor = d.depositor,
+
+
4093 .amount =
STAmount(d.asset, rest)});
+
+
+
4096 BEAST_EXPECT(env.balance(d.depositor, d.shares).number() == 0);
+
+
4098 env.balance(d.vaultAccount, d.assets).number() == 0);
+
+
4100 env.balance(d.vaultAccount, d.shares).number() == 0);
+
+
+
+
4104 testCase(18, [&,
this](Env& env, Data d) {
+
4105 testcase(
"Scale clawback overflow");
+
+
+
4108 auto tx = d.vault.deposit(
+
4109 {.depositor = d.depositor,
+
+
4111 .amount = d.asset(5)});
+
+
+
+
+
+
4117 auto tx = d.vault.clawback(
+
4118 {.issuer = d.issuer,
+
+
4120 .holder = d.depositor,
+
+
+
+
+
+
+
4127 testCase(1, [&,
this](Env& env, Data d) {
+
+
4129 auto const start = env.balance(d.depositor, d.assets).number();
+
4130 auto tx = d.vault.deposit(
+
4131 {.depositor = d.depositor,
+
+
+
+
+
4136 BEAST_EXPECT(env.balance(d.depositor, d.shares) == d.share(1000));
+
+
4138 env.balance(d.depositor, d.assets) ==
+
+
+
4141 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4144 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
+
+
+
+
+
+
4155 auto const start = env.balance(d.depositor, d.assets).number();
+
4156 auto tx = d.vault.clawback(
+
4157 {.issuer = d.issuer,
+
+
4159 .holder = d.depositor,
+
+
+
+
+
4164 env.balance(d.depositor, d.shares) == d.share(900));
+
+
4166 env.balance(d.depositor, d.assets) ==
+
+
+
4169 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4172 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
4177 testcase(
"Scale clawback insignificant amount");
+
4178 auto tx = d.vault.clawback(
+
4179 {.issuer = d.issuer,
+
+
4181 .holder = d.depositor,
+
+
+
-
4186 BEAST_EXPECT(vault[
"LedgerEntryType"].asString() ==
"Vault");
-
4187 BEAST_EXPECT(vault[jss::index].asString() ==
strHex(keylet.
key));
-
4188 BEAST_EXPECT(checkInt(vault, sfFlags, 0));
-
-
-
-
4192 checkString(vault, sfAccount,
toBase58(sle->at(sfAccount))));
-
-
4194 checkObject(vault, sfAsset,
to_json(sle->at(sfAsset))));
-
4195 BEAST_EXPECT(checkString(vault, sfAssetsAvailable,
"50"));
-
4196 BEAST_EXPECT(checkString(vault, sfAssetsMaximum,
"1000"));
-
4197 BEAST_EXPECT(checkString(vault, sfAssetsTotal,
"50"));
-
4198 BEAST_EXPECT(checkString(vault, sfLossUnrealized,
"0"));
-
-
4200 auto const strShareID =
strHex(sle->at(sfShareMPTID));
-
4201 BEAST_EXPECT(checkString(vault, sfShareMPTID, strShareID));
-
4202 BEAST_EXPECT(checkString(vault, sfOwner,
toBase58(owner.id())));
-
4203 BEAST_EXPECT(checkInt(vault, sfSequence, sequence));
-
4204 BEAST_EXPECT(checkInt(
-
-
-
4207 if (issuance.isObject())
-
-
-
4210 issuance[
"LedgerEntryType"].asString() ==
-
-
-
4213 issuance[jss::mpt_issuance_id].asString() == strShareID);
-
4214 BEAST_EXPECT(checkInt(issuance, sfSequence, 1));
-
4215 BEAST_EXPECT(checkInt(
-
-
-
-
-
4220 checkString(issuance, sfOutstandingAmount,
"50000000"));
-
-
-
-
-
4225 testcase(
"RPC ledger_entry selected by key");
-
-
4227 jvParams[jss::ledger_index] = jss::validated;
-
4228 jvParams[jss::vault] =
strHex(keylet.
key);
-
4229 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4231 BEAST_EXPECT(!jvVault[jss::result].isMember(jss::error));
-
4232 BEAST_EXPECT(jvVault[jss::result].isMember(jss::node));
-
4233 check(jvVault[jss::result][jss::node]);
-
-
-
-
4237 testcase(
"RPC ledger_entry selected by owner and seq");
-
-
4239 jvParams[jss::ledger_index] = jss::validated;
-
4240 jvParams[jss::vault][jss::owner] = owner.human();
-
4241 jvParams[jss::vault][jss::seq] = sequence;
-
4242 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4244 BEAST_EXPECT(!jvVault[jss::result].isMember(jss::error));
-
4245 BEAST_EXPECT(jvVault[jss::result].isMember(jss::node));
-
4246 check(jvVault[jss::result][jss::node]);
-
-
-
-
4250 testcase(
"RPC ledger_entry cannot find vault by key");
-
-
4252 jvParams[jss::ledger_index] = jss::validated;
-
-
4254 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4256 jvVault[jss::result][jss::error].asString() ==
"entryNotFound");
-
-
-
-
4260 testcase(
"RPC ledger_entry cannot find vault by owner and seq");
-
-
4262 jvParams[jss::ledger_index] = jss::validated;
-
4263 jvParams[jss::vault][jss::owner] = issuer.human();
-
4264 jvParams[jss::vault][jss::seq] = 1'000'000;
-
4265 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4267 jvVault[jss::result][jss::error].asString() ==
"entryNotFound");
-
-
-
-
4271 testcase(
"RPC ledger_entry malformed key");
-
-
4273 jvParams[jss::ledger_index] = jss::validated;
-
4274 jvParams[jss::vault] = 42;
-
4275 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4277 jvVault[jss::result][jss::error].asString() ==
-
4278 "malformedRequest");
-
-
-
-
4282 testcase(
"RPC ledger_entry malformed owner");
-
-
4284 jvParams[jss::ledger_index] = jss::validated;
-
4285 jvParams[jss::vault][jss::owner] = 42;
-
4286 jvParams[jss::vault][jss::seq] = sequence;
-
4287 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4289 jvVault[jss::result][jss::error].asString() ==
-
-
-
-
-
4294 testcase(
"RPC ledger_entry malformed seq");
-
-
4296 jvParams[jss::ledger_index] = jss::validated;
-
4297 jvParams[jss::vault][jss::owner] = issuer.human();
-
4298 jvParams[jss::vault][jss::seq] =
"foo";
-
4299 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4301 jvVault[jss::result][jss::error].asString() ==
-
4302 "malformedRequest");
-
-
-
-
4306 testcase(
"RPC ledger_entry negative seq");
-
-
4308 jvParams[jss::ledger_index] = jss::validated;
-
4309 jvParams[jss::vault][jss::owner] = issuer.human();
-
4310 jvParams[jss::vault][jss::seq] = -1;
-
4311 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4313 jvVault[jss::result][jss::error].asString() ==
-
4314 "malformedRequest");
-
-
-
-
4318 testcase(
"RPC ledger_entry oversized seq");
-
-
4320 jvParams[jss::ledger_index] = jss::validated;
-
4321 jvParams[jss::vault][jss::owner] = issuer.human();
-
4322 jvParams[jss::vault][jss::seq] = 1e20;
-
4323 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4325 jvVault[jss::result][jss::error].asString() ==
-
4326 "malformedRequest");
-
+
+
4187 testcase(
"Scale clawback with rounding assets");
+
+
+
+
+
+
+
+
4195 auto const start = env.balance(d.depositor, d.assets).number();
+
4196 auto tx = d.vault.clawback(
+
4197 {.issuer = d.issuer,
+
+
4199 .holder = d.depositor,
+
+
+
+
+
4204 env.balance(d.depositor, d.shares) == d.share(900 - 25));
+
+
4206 env.balance(d.depositor, d.assets) ==
+
+
+
4209 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4212 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
4217 testcase(
"Scale clawback with rounding shares up");
+
+
+
+
+
+
+
+
4225 auto const start = env.balance(d.depositor, d.assets).number();
+
4226 auto tx = d.vault.clawback(
+
4227 {.issuer = d.issuer,
+
+
4229 .holder = d.depositor,
+
+
+
+
+
4234 env.balance(d.depositor, d.shares) == d.share(875 - 38));
+
+
4236 env.balance(d.depositor, d.assets) ==
+
+
+
4239 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4242 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
4247 testcase(
"Scale clawback with rounding shares down");
+
+
+
+
+
+
+
+
4255 auto const start = env.balance(d.depositor, d.assets).number();
+
4256 auto tx = d.vault.clawback(
+
4257 {.issuer = d.issuer,
+
+
4259 .holder = d.depositor,
+
+
+
+
+
4264 env.balance(d.depositor, d.shares) == d.share(837 - 37));
+
+
4266 env.balance(d.depositor, d.assets) ==
+
+
+
4269 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4272 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
4277 testcase(
"Scale clawback tiny amount");
+
+
4279 auto const start = env.balance(d.depositor, d.assets).number();
+
4280 auto tx = d.vault.clawback(
+
4281 {.issuer = d.issuer,
+
+
4283 .holder = d.depositor,
+
+
+
+
+
4288 env.balance(d.depositor, d.shares) == d.share(800 - 1));
+
+
4290 env.balance(d.depositor, d.assets) ==
+
+
+
4293 env.balance(d.vaultAccount, d.assets) ==
+
+
+
4296 env.balance(d.vaultAccount, d.shares) ==
+
+
+
+
+
+
+
4303 env.balance(d.vaultAccount, d.assets).number();
+
4304 d.peek([](
SLE& vault,
auto&) ->
bool {
+
4305 vault[sfAssetsAvailable] =
Number(5);
+
+
+
+
+
+
+
+
4313 tx = d.vault.clawback(
+
4314 {.issuer = d.issuer,
+
+
4316 .holder = d.depositor,
+
4317 .amount =
STAmount(d.asset, rest)});
+
+
+
4320 BEAST_EXPECT(env.balance(d.depositor, d.shares).number() == 0);
+
+
4322 env.balance(d.vaultAccount, d.assets).number() == 0);
+
+
4324 env.balance(d.vaultAccount, d.shares).number() == 0);
+
+
+
+
-
-
4330 testcase(
"RPC ledger_entry bool seq");
-
-
4332 jvParams[jss::ledger_index] = jss::validated;
-
4333 jvParams[jss::vault][jss::owner] = issuer.human();
-
4334 jvParams[jss::vault][jss::seq] =
true;
-
4335 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
-
4337 jvVault[jss::result][jss::error].asString() ==
-
4338 "malformedRequest");
-
-
-
-
-
-
-
4345 jvParams[jss::account] = owner.human();
-
4346 jvParams[jss::type] = jss::vault;
-
-
4348 "json",
"account_objects",
to_string(jvParams))[jss::result];
-
-
4350 BEAST_EXPECT(jv[jss::account_objects].size() == 1);
-
4351 check(jv[jss::account_objects][0u]);
-
-
-
-
-
-
-
4358 jvParams[jss::ledger_index] = jss::validated;
-
4359 jvParams[jss::binary] =
false;
-
4360 jvParams[jss::type] = jss::vault;
-
-
4362 env.rpc(
"json",
"ledger_data",
to_string(jvParams));
-
4363 BEAST_EXPECT(jv[jss::result][jss::state].size() == 1);
-
4364 check(jv[jss::result][jss::state][0u]);
-
-
-
-
4368 testcase(
"RPC vault_info command line");
-
-
4370 env.rpc(
"vault_info",
strHex(keylet.
key),
"validated");
-
-
4372 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
-
4373 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
-
-
4375 jv[jss::result][jss::vault],
-
4376 jv[jss::result][jss::vault][jss::shares]);
-
-
-
-
-
-
4382 jvParams[jss::ledger_index] = jss::validated;
-
4383 jvParams[jss::vault_id] =
strHex(keylet.
key);
-
4384 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4386 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
-
4387 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
-
-
4389 jv[jss::result][jss::vault],
-
4390 jv[jss::result][jss::vault][jss::shares]);
-
-
-
-
4394 testcase(
"RPC vault_info invalid vault_id");
-
-
4396 jvParams[jss::ledger_index] = jss::validated;
-
4397 jvParams[jss::vault_id] =
"foobar";
-
4398 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4400 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4404 testcase(
"RPC vault_info json invalid index");
-
-
4406 jvParams[jss::ledger_index] = jss::validated;
-
4407 jvParams[jss::vault_id] = 0;
-
4408 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4410 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4414 testcase(
"RPC vault_info json by owner and sequence");
-
-
4416 jvParams[jss::ledger_index] = jss::validated;
-
4417 jvParams[jss::owner] = owner.human();
-
4418 jvParams[jss::seq] = sequence;
-
4419 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4421 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
-
4422 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
-
-
4424 jv[jss::result][jss::vault],
-
4425 jv[jss::result][jss::vault][jss::shares]);
-
-
-
-
4429 testcase(
"RPC vault_info json malformed sequence");
-
-
4431 jvParams[jss::ledger_index] = jss::validated;
-
4432 jvParams[jss::owner] = owner.human();
-
4433 jvParams[jss::seq] =
"foobar";
-
4434 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4436 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4440 testcase(
"RPC vault_info json invalid sequence");
-
-
4442 jvParams[jss::ledger_index] = jss::validated;
-
4443 jvParams[jss::owner] = owner.human();
-
4444 jvParams[jss::seq] = 0;
-
4445 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4447 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4451 testcase(
"RPC vault_info json negative sequence");
-
-
4453 jvParams[jss::ledger_index] = jss::validated;
-
4454 jvParams[jss::owner] = owner.human();
-
4455 jvParams[jss::seq] = -1;
-
4456 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4458 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4462 testcase(
"RPC vault_info json oversized sequence");
-
-
4464 jvParams[jss::ledger_index] = jss::validated;
-
4465 jvParams[jss::owner] = owner.human();
-
4466 jvParams[jss::seq] = 1e20;
-
4467 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4469 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4473 testcase(
"RPC vault_info json bool sequence");
-
-
4475 jvParams[jss::ledger_index] = jss::validated;
-
4476 jvParams[jss::owner] = owner.human();
-
4477 jvParams[jss::seq] =
true;
-
4478 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4480 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4484 testcase(
"RPC vault_info json malformed owner");
-
-
4486 jvParams[jss::ledger_index] = jss::validated;
-
4487 jvParams[jss::owner] =
"foobar";
-
4488 jvParams[jss::seq] = sequence;
-
4489 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4491 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4495 testcase(
"RPC vault_info json invalid combination only owner");
-
-
4497 jvParams[jss::ledger_index] = jss::validated;
-
4498 jvParams[jss::owner] = owner.human();
-
4499 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4501 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4505 testcase(
"RPC vault_info json invalid combination only seq");
-
-
4507 jvParams[jss::ledger_index] = jss::validated;
-
4508 jvParams[jss::seq] = sequence;
-
4509 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
+
+
+
4332 using namespace test::jtx;
+
+
+
4335 Env env{*
this, testable_amendments() | featureSingleAssetVault};
+
4336 Account
const owner{
"owner"};
+
4337 Account
const issuer{
"issuer"};
+
+
4339 env.fund(XRP(1000), issuer, owner);
+
+
+
+
4343 env.trust(asset(1000), owner);
+
4344 env(pay(issuer, owner, asset(200)));
+
+
+
4347 auto const sequence = env.seq(owner);
+
4348 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
4354 auto tx1 = vault.deposit(
+
4355 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
+
+
+
4358 auto tx2 = vault.set({.owner = owner, .id = keylet.
key});
+
4359 tx2[sfAssetsMaximum] = asset(1000).number();
+
+
+
+
+
4364 auto const sleVault = [&env, keylet = keylet,
this]() {
+
4365 auto const vault = env.le(keylet);
+
4366 BEAST_EXPECT(vault !=
nullptr);
+
+
+
+
4370 auto const check = [&, keylet = keylet, sle = sleVault,
this](
+
+
+
4373 BEAST_EXPECT(vault.isObject());
+
+
4375 constexpr auto checkString =
+
+
4377 return node.isMember(field.fieldName) &&
+
4378 node[field.fieldName].isString() &&
+
4379 node[field.fieldName] == v;
+
+
4381 constexpr auto checkObject =
+
+
4383 return node.isMember(field.fieldName) &&
+
4384 node[field.fieldName].isObject() &&
+
4385 node[field.fieldName] == v;
+
+
4387 constexpr auto checkInt =
+
4388 [](
auto& node,
SField const& field,
int v) ->
bool {
+
4389 return node.isMember(field.fieldName) &&
+
4390 ((node[field.fieldName].isInt() &&
+
4391 node[field.fieldName] ==
Json::Int(v)) ||
+
4392 (node[field.fieldName].isUInt() &&
+
+
+
+
4396 BEAST_EXPECT(vault[
"LedgerEntryType"].asString() ==
"Vault");
+
4397 BEAST_EXPECT(vault[jss::index].asString() ==
strHex(keylet.
key));
+
4398 BEAST_EXPECT(checkInt(vault, sfFlags, 0));
+
+
+
+
4402 checkString(vault, sfAccount,
toBase58(sle->at(sfAccount))));
+
+
4404 checkObject(vault, sfAsset,
to_json(sle->at(sfAsset))));
+
4405 BEAST_EXPECT(checkString(vault, sfAssetsAvailable,
"50"));
+
4406 BEAST_EXPECT(checkString(vault, sfAssetsMaximum,
"1000"));
+
4407 BEAST_EXPECT(checkString(vault, sfAssetsTotal,
"50"));
+
4408 BEAST_EXPECT(checkString(vault, sfLossUnrealized,
"0"));
+
+
4410 auto const strShareID =
strHex(sle->at(sfShareMPTID));
+
4411 BEAST_EXPECT(checkString(vault, sfShareMPTID, strShareID));
+
4412 BEAST_EXPECT(checkString(vault, sfOwner,
toBase58(owner.id())));
+
4413 BEAST_EXPECT(checkInt(vault, sfSequence, sequence));
+
4414 BEAST_EXPECT(checkInt(
+
+
+
4417 if (issuance.isObject())
+
+
+
4420 issuance[
"LedgerEntryType"].asString() ==
+
+
+
4423 issuance[jss::mpt_issuance_id].asString() == strShareID);
+
4424 BEAST_EXPECT(checkInt(issuance, sfSequence, 1));
+
4425 BEAST_EXPECT(checkInt(
+
+
+
+
+
4430 checkString(issuance, sfOutstandingAmount,
"50000000"));
+
+
+
+
+
4435 testcase(
"RPC ledger_entry selected by key");
+
+
4437 jvParams[jss::ledger_index] = jss::validated;
+
4438 jvParams[jss::vault] =
strHex(keylet.
key);
+
4439 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+
4441 BEAST_EXPECT(!jvVault[jss::result].isMember(jss::error));
+
4442 BEAST_EXPECT(jvVault[jss::result].isMember(jss::node));
+
4443 check(jvVault[jss::result][jss::node]);
+
+
+
+
4447 testcase(
"RPC ledger_entry selected by owner and seq");
+
+
4449 jvParams[jss::ledger_index] = jss::validated;
+
4450 jvParams[jss::vault][jss::owner] = owner.human();
+
4451 jvParams[jss::vault][jss::seq] = sequence;
+
4452 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+
4454 BEAST_EXPECT(!jvVault[jss::result].isMember(jss::error));
+
4455 BEAST_EXPECT(jvVault[jss::result].isMember(jss::node));
+
4456 check(jvVault[jss::result][jss::node]);
+
+
+
+
4460 testcase(
"RPC ledger_entry cannot find vault by key");
+
+
4462 jvParams[jss::ledger_index] = jss::validated;
+
+
4464 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+
4466 jvVault[jss::result][jss::error].asString() ==
"entryNotFound");
+
+
+
+
4470 testcase(
"RPC ledger_entry cannot find vault by owner and seq");
+
+
4472 jvParams[jss::ledger_index] = jss::validated;
+
4473 jvParams[jss::vault][jss::owner] = issuer.human();
+
4474 jvParams[jss::vault][jss::seq] = 1'000'000;
+
4475 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+
4477 jvVault[jss::result][jss::error].asString() ==
"entryNotFound");
+
+
+
+
4481 testcase(
"RPC ledger_entry malformed key");
+
+
4483 jvParams[jss::ledger_index] = jss::validated;
+
4484 jvParams[jss::vault] = 42;
+
4485 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+
4487 jvVault[jss::result][jss::error].asString() ==
+
4488 "malformedRequest");
+
+
+
+
4492 testcase(
"RPC ledger_entry malformed owner");
+
+
4494 jvParams[jss::ledger_index] = jss::validated;
+
4495 jvParams[jss::vault][jss::owner] = 42;
+
4496 jvParams[jss::vault][jss::seq] = sequence;
+
4497 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+
4499 jvVault[jss::result][jss::error].asString() ==
+
+
+
+
+
4504 testcase(
"RPC ledger_entry malformed seq");
+
+
4506 jvParams[jss::ledger_index] = jss::validated;
+
4507 jvParams[jss::vault][jss::owner] = issuer.human();
+
4508 jvParams[jss::vault][jss::seq] =
"foo";
+
4509 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
4511 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4515 testcase(
"RPC vault_info json invalid combination seq vault_id");
-
-
4517 jvParams[jss::ledger_index] = jss::validated;
-
4518 jvParams[jss::vault_id] =
strHex(keylet.
key);
-
4519 jvParams[jss::seq] = sequence;
-
4520 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4522 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4526 testcase(
"RPC vault_info json invalid combination owner vault_id");
-
-
4528 jvParams[jss::ledger_index] = jss::validated;
-
4529 jvParams[jss::vault_id] =
strHex(keylet.
key);
-
4530 jvParams[jss::owner] = owner.human();
-
4531 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4533 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
-
4538 "RPC vault_info json invalid combination owner seq "
-
-
-
4541 jvParams[jss::ledger_index] = jss::validated;
-
4542 jvParams[jss::vault_id] =
strHex(keylet.
key);
-
4543 jvParams[jss::seq] = sequence;
-
4544 jvParams[jss::owner] = owner.human();
-
4545 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
4511 jvVault[jss::result][jss::error].asString() ==
+
4512 "malformedRequest");
+
+
+
+
4516 testcase(
"RPC ledger_entry negative seq");
+
+
4518 jvParams[jss::ledger_index] = jss::validated;
+
4519 jvParams[jss::vault][jss::owner] = issuer.human();
+
4520 jvParams[jss::vault][jss::seq] = -1;
+
4521 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+
4523 jvVault[jss::result][jss::error].asString() ==
+
4524 "malformedRequest");
+
+
+
+
4528 testcase(
"RPC ledger_entry oversized seq");
+
+
4530 jvParams[jss::ledger_index] = jss::validated;
+
4531 jvParams[jss::vault][jss::owner] = issuer.human();
+
4532 jvParams[jss::vault][jss::seq] = 1e20;
+
4533 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+
4535 jvVault[jss::result][jss::error].asString() ==
+
4536 "malformedRequest");
+
+
+
+
4540 testcase(
"RPC ledger_entry bool seq");
+
+
4542 jvParams[jss::ledger_index] = jss::validated;
+
4543 jvParams[jss::vault][jss::owner] = issuer.human();
+
4544 jvParams[jss::vault][jss::seq] =
true;
+
4545 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
4547 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4551 testcase(
"RPC vault_info json no input");
-
-
4553 jvParams[jss::ledger_index] = jss::validated;
-
4554 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
-
4556 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4560 testcase(
"RPC vault_info command line invalid index");
-
4561 Json::Value jv = env.rpc(
"vault_info",
"foobar",
"validated");
-
4562 BEAST_EXPECT(jv[jss::error].asString() ==
"invalidParams");
-
-
-
-
4566 testcase(
"RPC vault_info command line invalid index");
-
4567 Json::Value jv = env.rpc(
"vault_info",
"0",
"validated");
-
-
4569 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
4573 testcase(
"RPC vault_info command line invalid index");
-
-
-
-
4577 jv[jss::result][jss::error].asString() ==
"entryNotFound");
-
-
-
-
4581 testcase(
"RPC vault_info command line invalid ledger");
-
-
-
4584 jv[jss::result][jss::error].asString() ==
"lgrNotFound");
-
-
+
4547 jvVault[jss::result][jss::error].asString() ==
+
4548 "malformedRequest");
+
+
+
+
+
+
+
4555 jvParams[jss::account] = owner.human();
+
4556 jvParams[jss::type] = jss::vault;
+
+
4558 "json",
"account_objects",
to_string(jvParams))[jss::result];
+
+
4560 BEAST_EXPECT(jv[jss::account_objects].size() == 1);
+
4561 check(jv[jss::account_objects][0u]);
+
+
+
+
+
+
+
4568 jvParams[jss::ledger_index] = jss::validated;
+
4569 jvParams[jss::binary] =
false;
+
4570 jvParams[jss::type] = jss::vault;
+
+
4572 env.rpc(
"json",
"ledger_data",
to_string(jvParams));
+
4573 BEAST_EXPECT(jv[jss::result][jss::state].size() == 1);
+
4574 check(jv[jss::result][jss::state][0u]);
+
+
+
+
4578 testcase(
"RPC vault_info command line");
+
+
4580 env.rpc(
"vault_info",
strHex(keylet.
key),
"validated");
+
+
4582 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
+
4583 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
+
+
4585 jv[jss::result][jss::vault],
+
4586 jv[jss::result][jss::vault][jss::shares]);
+
+
+
+
+
+
4592 jvParams[jss::ledger_index] = jss::validated;
+
4593 jvParams[jss::vault_id] =
strHex(keylet.
key);
+
4594 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4596 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
+
4597 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
+
+
4599 jv[jss::result][jss::vault],
+
4600 jv[jss::result][jss::vault][jss::shares]);
+
+
+
+
4604 testcase(
"RPC vault_info invalid vault_id");
+
+
4606 jvParams[jss::ledger_index] = jss::validated;
+
4607 jvParams[jss::vault_id] =
"foobar";
+
4608 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4610 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4614 testcase(
"RPC vault_info json invalid index");
+
+
4616 jvParams[jss::ledger_index] = jss::validated;
+
4617 jvParams[jss::vault_id] = 0;
+
4618 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4620 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4624 testcase(
"RPC vault_info json by owner and sequence");
+
+
4626 jvParams[jss::ledger_index] = jss::validated;
+
4627 jvParams[jss::owner] = owner.human();
+
4628 jvParams[jss::seq] = sequence;
+
4629 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4631 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
+
4632 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
+
+
4634 jv[jss::result][jss::vault],
+
4635 jv[jss::result][jss::vault][jss::shares]);
+
+
+
+
4639 testcase(
"RPC vault_info json malformed sequence");
+
+
4641 jvParams[jss::ledger_index] = jss::validated;
+
4642 jvParams[jss::owner] = owner.human();
+
4643 jvParams[jss::seq] =
"foobar";
+
4644 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4646 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4650 testcase(
"RPC vault_info json invalid sequence");
+
+
4652 jvParams[jss::ledger_index] = jss::validated;
+
4653 jvParams[jss::owner] = owner.human();
+
4654 jvParams[jss::seq] = 0;
+
4655 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4657 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4661 testcase(
"RPC vault_info json negative sequence");
+
+
4663 jvParams[jss::ledger_index] = jss::validated;
+
4664 jvParams[jss::owner] = owner.human();
+
4665 jvParams[jss::seq] = -1;
+
4666 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4668 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4672 testcase(
"RPC vault_info json oversized sequence");
+
+
4674 jvParams[jss::ledger_index] = jss::validated;
+
4675 jvParams[jss::owner] = owner.human();
+
4676 jvParams[jss::seq] = 1e20;
+
4677 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4679 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4683 testcase(
"RPC vault_info json bool sequence");
+
+
4685 jvParams[jss::ledger_index] = jss::validated;
+
4686 jvParams[jss::owner] = owner.human();
+
4687 jvParams[jss::seq] =
true;
+
4688 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4690 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4694 testcase(
"RPC vault_info json malformed owner");
+
+
4696 jvParams[jss::ledger_index] = jss::validated;
+
4697 jvParams[jss::owner] =
"foobar";
+
4698 jvParams[jss::seq] = sequence;
+
4699 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4701 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4705 testcase(
"RPC vault_info json invalid combination only owner");
+
+
4707 jvParams[jss::ledger_index] = jss::validated;
+
4708 jvParams[jss::owner] = owner.human();
+
4709 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4711 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4715 testcase(
"RPC vault_info json invalid combination only seq");
+
+
4717 jvParams[jss::ledger_index] = jss::validated;
+
4718 jvParams[jss::seq] = sequence;
+
4719 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4721 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4725 testcase(
"RPC vault_info json invalid combination seq vault_id");
+
+
4727 jvParams[jss::ledger_index] = jss::validated;
+
4728 jvParams[jss::vault_id] =
strHex(keylet.
key);
+
4729 jvParams[jss::seq] = sequence;
+
4730 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4732 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4736 testcase(
"RPC vault_info json invalid combination owner vault_id");
+
+
4738 jvParams[jss::ledger_index] = jss::validated;
+
4739 jvParams[jss::vault_id] =
strHex(keylet.
key);
+
4740 jvParams[jss::owner] = owner.human();
+
4741 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4743 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
+
4748 "RPC vault_info json invalid combination owner seq "
+
+
+
4751 jvParams[jss::ledger_index] = jss::validated;
+
4752 jvParams[jss::vault_id] =
strHex(keylet.
key);
+
4753 jvParams[jss::seq] = sequence;
+
4754 jvParams[jss::owner] = owner.human();
+
4755 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4757 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4761 testcase(
"RPC vault_info json no input");
+
+
4763 jvParams[jss::ledger_index] = jss::validated;
+
4764 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+
4766 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4770 testcase(
"RPC vault_info command line invalid index");
+
4771 Json::Value jv = env.rpc(
"vault_info",
"foobar",
"validated");
+
4772 BEAST_EXPECT(jv[jss::error].asString() ==
"invalidParams");
+
+
+
+
4776 testcase(
"RPC vault_info command line invalid index");
+
4777 Json::Value jv = env.rpc(
"vault_info",
"0",
"validated");
+
+
4779 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
4783 testcase(
"RPC vault_info command line invalid index");
+
+
+
+
4787 jv[jss::result][jss::error].asString() ==
"entryNotFound");
+
+
+
+
4791 testcase(
"RPC vault_info command line invalid ledger");
+
+
+
4794 jv[jss::result][jss::error].asString() ==
"lgrNotFound");
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
4608BEAST_DEFINE_TESTSUITE_PRIO(Vault, app,
ripple, 1);
-
-
+
+
4818BEAST_DEFINE_TESTSUITE_PRIO(Vault, app,
ripple, 1);
+
+
A generic endpoint for log messages.
@@ -4744,22 +4954,23 @@ $(document).ready(function() { init_codefold(0); });
Discardable, editable view to a ledger.
-
-
-
void testFailedPseudoAccount()
+
+
+
void testFailedPseudoAccount()
ripple::test::jtx::PrettyAsset PrettyAsset
-
-
-
-
void testNonTransferableShares()
-
-
void testWithDomainCheck()
+
+
+
+
void testNonTransferableShares()
+
+
void testWithDomainCheck()
static auto constexpr negativeAmount
-
void run() override
Runs the suite.
-
+
void run() override
Runs the suite.
+
-
void testWithDomainCheckXRP()
-
+
void testWithDomainCheckXRP()
+
+
constexpr value_type drops() const
Returns the number of drops.
Integers of any length that is a multiple of 32-bits.
void update(std::shared_ptr< SLE > const &sle) override
Indicate changes to a peeked SLE.
std::shared_ptr< SLE > peek(Keylet const &k) override
Prepare to modify the SLE associated with key.
@@ -4792,14 +5003,16 @@ $(document).ready(function() { init_codefold(0); });
constexpr std::uint32_t const tfVaultPrivate
-
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
Json::Value to_json(Asset const &asset)
std::string strHex(FwdIt begin, FwdIt end)
constexpr std::uint32_t const tfMPTUnauthorize
constexpr std::uint32_t tfSetfAuth
constexpr std::uint32_t asfDefaultRipple
constexpr std::uint32_t tfClearFreeze
+
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
+
@ tecNO_LINE_INSUF_RESERVE
@@ -4833,11 +5046,13 @@ $(document).ready(function() { init_codefold(0); });
constexpr std::uint32_t tfSetFreeze
constexpr std::uint32_t const tfMPTCanLock
constexpr std::uint32_t const tfMPTCanClawback
+
constexpr XRPAmount DROPS_PER_XRP
Number of drops per 1 XRP.
+
A pair of SHAMap key and LedgerEntryType.
diff --git a/View_8cpp_source.html b/View_8cpp_source.html
index bab0278568..260b60da4a 100644
--- a/View_8cpp_source.html
+++ b/View_8cpp_source.html
@@ -1418,2092 +1418,2098 @@ $(document).ready(function() { init_codefold(0); });
1243 if (view.
read(index))
-
-
-
-
-
-
-
-
-
-
-
-
1256 STAmount{Issue{currency, noAccount()}},
-
1257 STAmount{Issue{currency, dstId}},
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1262 STAmount{Issue{currency, noAccount()}},
+
1263 STAmount{Issue{currency, dstId}},
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
1271 auto const& mptID = mptIssue.
getMptID();
-
1272 auto const mpt = view.
peek(keylet::mptIssuance(mptID));
-
-
-
-
-
1277 if (view.
peek(keylet::mptoken(mptID, accountID)))
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
1277 auto const& mptID = mptIssue.
getMptID();
+
1278 auto const mpt = view.
peek(keylet::mptIssuance(mptID));
+
+
+
+
+
1283 if (view.
peek(keylet::mptoken(mptID, accountID)))
+
+
+
+
-
-
-
-
-
-
-
1287 MPTID const& mptIssuanceID,
-
-
-
-
-
-
1293 auto const sleAcct = view.
peek(keylet::account(account));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
1307 auto const mptokenKey = keylet::mptoken(mptIssuanceID, account);
-
1308 auto const sleMpt = view.
peek(mptokenKey);
-
1309 if (!sleMpt || (*sleMpt)[sfMPTAmount] != 0)
-
-
-
-
1313 keylet::ownerDir(account),
-
1314 (*sleMpt)[sfOwnerNode],
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
1293 MPTID const& mptIssuanceID,
+
+
+
+
+
+
1299 auto const sleAcct = view.
peek(keylet::account(account));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1313 auto const mptokenKey = keylet::mptoken(mptIssuanceID, account);
+
1314 auto const sleMpt = view.
peek(mptokenKey);
+
1315 if (!sleMpt || (*sleMpt)[sfMPTAmount] != 0)
+
+
+
+
1319 keylet::ownerDir(account),
+
1320 (*sleMpt)[sfOwnerNode],
+
+
+
-
-
-
-
-
-
-
-
-
-
1334 std::uint32_t const uOwnerCount = sleAcct->getFieldU32(sfOwnerCount);
-
-
1336 (uOwnerCount < 2) ?
XRPAmount(beast::zero)
-
-
-
1339 if (priorBalance < reserveCreate)
-
-
-
1342 auto const mptokenKey = keylet::mptoken(mptIssuanceID, account);
-
-
1344 if (
auto ter =
dirLink(view, account, mptoken))
-
-
-
1347 (*mptoken)[sfAccount] = account;
-
1348 (*mptoken)[sfMPTokenIssuanceID] = mptIssuanceID;
-
1349 (*mptoken)[sfFlags] = 0;
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1340 std::uint32_t const uOwnerCount = sleAcct->getFieldU32(sfOwnerCount);
+
+
1342 (uOwnerCount < 2) ?
XRPAmount(beast::zero)
+
+
+
1345 if (priorBalance < reserveCreate)
+
+
+
1348 auto const mptokenKey = keylet::mptoken(mptIssuanceID, account);
+
+
1350 if (
auto ter =
dirLink(view, account, mptoken))
+
+
+
1353 (*mptoken)[sfAccount] = account;
+
1354 (*mptoken)[sfMPTokenIssuanceID] = mptIssuanceID;
+
1355 (*mptoken)[sfFlags] = 0;
+
-
1358 auto const sleMptIssuance = view.
read(keylet::mptIssuance(mptIssuanceID));
-
1359 if (!sleMptIssuance)
-
-
-
-
-
-
1365 if (account != (*sleMptIssuance)[sfIssuer])
+
+
+
+
+
+
+
1364 auto const sleMptIssuance = view.
read(keylet::mptIssuance(mptIssuanceID));
+
1365 if (!sleMptIssuance)
-
1368 auto const sleMpt = view.
peek(keylet::mptoken(mptIssuanceID, *holderID));
-
-
-
-
-
-
-
-
-
-
1378 flagsOut &= ~lsfMPTAuthorized;
-
-
-
-
-
-
1384 if (flagsIn != flagsOut)
-
1385 sleMpt->setFieldU32(sfFlags, flagsOut);
-
-
-
-
+
+
+
+
1371 if (account != (*sleMptIssuance)[sfIssuer])
+
+
+
1374 auto const sleMpt = view.
peek(keylet::mptoken(mptIssuanceID, *holderID));
+
+
+
+
+
+
+
+
+
+
1384 flagsOut &= ~lsfMPTAuthorized;
+
+
+
+
+
+
1390 if (flagsIn != flagsOut)
+
1391 sleMpt->setFieldU32(sfFlags, flagsOut);
+
+
+
+
-
-
-
-
-
-
1394 bool const bSrcHigh,
-
-
-
-
-
-
1400 bool const bNoRipple,
-
-
-
-
-
-
-
-
-
-
-
1411 JLOG(j.
trace()) <<
"trustCreate: " << to_string(uSrcAccountID) <<
", "
-
1412 << to_string(uDstAccountID) <<
", "
-
-
-
1415 auto const& uLowAccountID = !bSrcHigh ? uSrcAccountID : uDstAccountID;
-
1416 auto const& uHighAccountID = bSrcHigh ? uSrcAccountID : uDstAccountID;
-
-
-
1419 view.
insert(sleRippleState);
+
+
+
+
+
+
1400 bool const bSrcHigh,
+
+
+
+
+
+
1406 bool const bNoRipple,
+
+
+
+
+
+
+
+
+
+
+
1417 JLOG(j.
trace()) <<
"trustCreate: " << to_string(uSrcAccountID) <<
", "
+
1418 << to_string(uDstAccountID) <<
", "
+
-
-
1422 keylet::ownerDir(uLowAccountID),
-
1423 sleRippleState->key(),
-
-
-
-
-
-
-
1430 keylet::ownerDir(uHighAccountID),
-
1431 sleRippleState->key(),
-
-
-
-
-
-
1437 bool const bSetDst = saLimit.
getIssuer() == uDstAccountID;
-
1438 bool const bSetHigh = bSrcHigh ^ bSetDst;
+
1421 auto const& uLowAccountID = !bSrcHigh ? uSrcAccountID : uDstAccountID;
+
1422 auto const& uHighAccountID = bSrcHigh ? uSrcAccountID : uDstAccountID;
+
+
+
1425 view.
insert(sleRippleState);
+
+
+
1428 keylet::ownerDir(uLowAccountID),
+
1429 sleRippleState->key(),
+
+
+
+
+
+
+
1436 keylet::ownerDir(uHighAccountID),
+
1437 sleRippleState->key(),
+
-
1440 XRPL_ASSERT(sleAccount,
"ripple::trustCreate : non-null SLE");
-
-
-
-
-
1445 sleAccount->getAccountID(sfAccount) ==
-
1446 (bSetHigh ? uHighAccountID : uLowAccountID),
-
1447 "ripple::trustCreate : matching account ID");
-
1448 auto const slePeer =
-
1449 view.
peek(keylet::account(bSetHigh ? uLowAccountID : uHighAccountID));
-
-
-
-
-
1454 sleRippleState->setFieldU64(sfLowNode, *lowNode);
-
1455 sleRippleState->setFieldU64(sfHighNode, *highNode);
-
-
1457 sleRippleState->setFieldAmount(
-
1458 bSetHigh ? sfHighLimit : sfLowLimit, saLimit);
-
1459 sleRippleState->setFieldAmount(
-
1460 bSetHigh ? sfLowLimit : sfHighLimit,
-
-
1462 saBalance.
getCurrency(), bSetDst ? uSrcAccountID : uDstAccountID}));
-
-
-
1465 sleRippleState->setFieldU32(
-
1466 bSetHigh ? sfHighQualityIn : sfLowQualityIn, uQualityIn);
-
-
-
1469 sleRippleState->setFieldU32(
-
1470 bSetHigh ? sfHighQualityOut : sfLowQualityOut, uQualityOut);
-
-
+
+
+
+
1443 bool const bSetDst = saLimit.
getIssuer() == uDstAccountID;
+
1444 bool const bSetHigh = bSrcHigh ^ bSetDst;
+
+
1446 XRPL_ASSERT(sleAccount,
"ripple::trustCreate : non-null SLE");
+
+
+
+
+
1451 sleAccount->getAccountID(sfAccount) ==
+
1452 (bSetHigh ? uHighAccountID : uLowAccountID),
+
1453 "ripple::trustCreate : matching account ID");
+
1454 auto const slePeer =
+
1455 view.
peek(keylet::account(bSetHigh ? uLowAccountID : uHighAccountID));
+
+
+
+
+
1460 sleRippleState->setFieldU64(sfLowNode, *lowNode);
+
1461 sleRippleState->setFieldU64(sfHighNode, *highNode);
+
+
1463 sleRippleState->setFieldAmount(
+
1464 bSetHigh ? sfHighLimit : sfLowLimit, saLimit);
+
1465 sleRippleState->setFieldAmount(
+
1466 bSetHigh ? sfLowLimit : sfHighLimit,
+
+
1468 saBalance.
getCurrency(), bSetDst ? uSrcAccountID : uDstAccountID}));
+
+
+
1471 sleRippleState->setFieldU32(
+
1472 bSetHigh ? sfHighQualityIn : sfLowQualityIn, uQualityIn);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
1475 sleRippleState->setFieldU32(
+
1476 bSetHigh ? sfHighQualityOut : sfLowQualityOut, uQualityOut);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
1497 sleRippleState->setFieldU32(sfFlags, uFlags);
-
-
-
-
1501 sleRippleState->setFieldAmount(
-
1502 sfBalance, bSetHigh ? -saBalance : saBalance);
-
-
-
1505 uSrcAccountID, uDstAccountID, saBalance, saBalance.
zeroed());
-
-
-
-
+
+
+
+
+
+
+
1503 sleRippleState->setFieldU32(sfFlags, uFlags);
+
+
+
+
1507 sleRippleState->setFieldAmount(
+
1508 sfBalance, bSetHigh ? -saBalance : saBalance);
-
-
-
-
-
-
-
-
-
-
-
1519 auto const sle = view.
read(keylet::account(accountID));
-
-
-
-
1523 auto const balance = sle->getFieldAmount(sfBalance);
-
1524 if (balance.xrp() != 0)
-
-
-
-
-
-
-
1531 auto const line = view.
peek(keylet::line(accountID, issue));
-
-
-
1534 if (line->at(sfBalance)->iou() != beast::zero)
-
-
-
-
-
-
-
1541 auto sleLowAccount =
-
1542 view.
peek(keylet::account(line->at(sfLowLimit)->getIssuer()));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
1556 auto sleHighAccount =
-
1557 view.
peek(keylet::account(line->at(sfHighLimit)->getIssuer()));
-
1558 if (!sleHighAccount)
-
-
-
-
-
-
-
-
-
-
-
-
-
1571 line->at(sfLowLimit)->getIssuer(),
-
1572 line->at(sfHighLimit)->getIssuer(),
-
-
+
+
1511 uSrcAccountID, uDstAccountID, saBalance, saBalance.
zeroed());
+
+
+
-
-
-
-
-
-
-
-
-
-
1583 auto const& mptID = mptIssue.
getMptID();
-
1584 auto const mptoken = view.
peek(keylet::mptoken(mptID, accountID));
-
-
-
1587 if (mptoken->at(sfMPTAmount) != 0)
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
1525 auto const sle = view.
read(keylet::account(accountID));
+
+
+
+
1529 auto const balance = sle->getFieldAmount(sfBalance);
+
1530 if (balance.xrp() != 0)
+
+
+
+
+
+
+
1537 auto const line = view.
peek(keylet::line(accountID, issue));
+
+
+
1540 if (line->at(sfBalance)->iou() != beast::zero)
+
+
+
+
+
+
+
1547 auto sleLowAccount =
+
1548 view.
peek(keylet::account(line->at(sfLowLimit)->getIssuer()));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1562 auto sleHighAccount =
+
1563 view.
peek(keylet::account(line->at(sfHighLimit)->getIssuer()));
+
1564 if (!sleHighAccount)
+
+
+
+
+
+
+
+
+
+
+
+
+
1577 line->at(sfLowLimit)->getIssuer(),
+
1578 line->at(sfHighLimit)->getIssuer(),
+
+
-
-
-
-
-
-
-
-
-
-
-
-
1609 std::uint64_t uLowNode = sleRippleState->getFieldU64(sfLowNode);
-
1610 std::uint64_t uHighNode = sleRippleState->getFieldU64(sfHighNode);
-
-
1612 JLOG(j.
trace()) <<
"trustDelete: Deleting ripple line: low";
-
-
-
1615 keylet::ownerDir(uLowAccountID),
-
-
1617 sleRippleState->key(),
-
-
-
-
-
-
1623 JLOG(j.
trace()) <<
"trustDelete: Deleting ripple line: high";
-
-
-
1626 keylet::ownerDir(uHighAccountID),
-
-
1628 sleRippleState->key(),
-
-
-
-
-
-
1634 JLOG(j.
trace()) <<
"trustDelete: Deleting ripple line: state";
-
1635 view.
erase(sleRippleState);
-
-
-
+
+
+
+
+
+
+
+
+
+
1589 auto const& mptID = mptIssue.
getMptID();
+
1590 auto const mptoken = view.
peek(keylet::mptoken(mptID, accountID));
+
+
+
1593 if (mptoken->at(sfMPTAmount) != 0)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1615 std::uint64_t uLowNode = sleRippleState->getFieldU64(sfLowNode);
+
1616 std::uint64_t uHighNode = sleRippleState->getFieldU64(sfHighNode);
+
+
1618 JLOG(j.
trace()) <<
"trustDelete: Deleting ripple line: low";
+
+
+
1621 keylet::ownerDir(uLowAccountID),
+
+
1623 sleRippleState->key(),
+
+
+
+
+
+
1629 JLOG(j.
trace()) <<
"trustDelete: Deleting ripple line: high";
+
+
+
1632 keylet::ownerDir(uHighAccountID),
+
+
1634 sleRippleState->key(),
+
+
+
+
-
-
-
-
-
-
-
1645 auto offerIndex = sle->key();
-
1646 auto owner = sle->getAccountID(sfAccount);
-
-
-
1649 uint256 uDirectory = sle->getFieldH256(sfBookDirectory);
-
-
-
1652 keylet::ownerDir(owner),
-
1653 sle->getFieldU64(sfOwnerNode),
-
-
-
-
-
-
-
-
1661 keylet::page(uDirectory),
-
1662 sle->getFieldU64(sfBookNode),
-
-
-
-
-
-
-
1669 if (sle->isFieldPresent(sfAdditionalBooks))
-
-
-
1672 sle->isFlag(
lsfHybrid) && sle->isFieldPresent(sfDomainID),
-
1673 "ripple::offerDelete : should be a hybrid domain offer");
+
1640 JLOG(j.
trace()) <<
"trustDelete: Deleting ripple line: state";
+
1641 view.
erase(sleRippleState);
+
+
+
+
+
+
+
+
+
+
+
+
1651 auto offerIndex = sle->key();
+
1652 auto owner = sle->getAccountID(sfAccount);
+
+
+
1655 uint256 uDirectory = sle->getFieldH256(sfBookDirectory);
+
+
+
1658 keylet::ownerDir(owner),
+
1659 sle->getFieldU64(sfOwnerNode),
+
+
+
+
+
+
+
+
1667 keylet::page(uDirectory),
+
1668 sle->getFieldU64(sfBookNode),
+
+
+
+
+
-
1675 auto const& additionalBookDirs = sle->getFieldArray(sfAdditionalBooks);
-
-
1677 for (
auto const& bookDir : additionalBookDirs)
-
-
1679 auto const& dirIndex = bookDir.getFieldH256(sfBookDirectory);
-
1680 auto const& dirNode = bookDir.getFieldU64(sfBookNode);
-
-
-
1683 keylet::page(dirIndex), dirNode, offerIndex,
false))
-
-
-
-
-
-
-
-
-
-
-
-
+
1675 if (sle->isFieldPresent(sfAdditionalBooks))
+
+
+
1678 sle->isFlag(
lsfHybrid) && sle->isFieldPresent(sfDomainID),
+
1679 "ripple::offerDelete : should be a hybrid domain offer");
+
+
1681 auto const& additionalBookDirs = sle->getFieldArray(sfAdditionalBooks);
+
+
1683 for (
auto const& bookDir : additionalBookDirs)
+
+
1685 auto const& dirIndex = bookDir.getFieldH256(sfBookDirectory);
+
1686 auto const& dirNode = bookDir.getFieldU64(sfBookNode);
+
+
+
1689 keylet::page(dirIndex), dirNode, offerIndex,
false))
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
1715 !bCheckIssuer || uSenderID == issuer || uReceiverID == issuer,
-
1716 "ripple::rippleCreditIOU : matching issuer or don't care");
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
1721 uSenderID != uReceiverID,
-
1722 "ripple::rippleCreditIOU : sender is not receiver");
-
-
1724 bool const bSenderHigh = uSenderID > uReceiverID;
-
1725 auto const index = keylet::line(uSenderID, uReceiverID, currency);
-
-
-
-
1729 "ripple::rippleCreditIOU : sender is not XRP");
-
-
-
1732 "ripple::rippleCreditIOU : receiver is not XRP");
-
-
-
1735 if (
auto const sleRippleState = view.
peek(index))
-
-
1737 STAmount saBalance = sleRippleState->getFieldAmount(sfBalance);
-
-
-
-
-
1742 view.
creditHook(uSenderID, uReceiverID, saAmount, saBalance);
-
-
1744 STAmount const saBefore = saBalance;
-
-
1746 saBalance -= saAmount;
+
1721 !bCheckIssuer || uSenderID == issuer || uReceiverID == issuer,
+
1722 "ripple::rippleCreditIOU : matching issuer or don't care");
+
+
+
+
+
1727 uSenderID != uReceiverID,
+
1728 "ripple::rippleCreditIOU : sender is not receiver");
+
+
1730 bool const bSenderHigh = uSenderID > uReceiverID;
+
1731 auto const index = keylet::line(uSenderID, uReceiverID, currency);
+
+
+
+
1735 "ripple::rippleCreditIOU : sender is not XRP");
+
+
+
1738 "ripple::rippleCreditIOU : receiver is not XRP");
+
+
+
1741 if (
auto const sleRippleState = view.
peek(index))
+
+
1743 STAmount saBalance = sleRippleState->getFieldAmount(sfBalance);
+
+
+
-
1748 JLOG(j.
trace()) <<
"rippleCreditIOU: " << to_string(uSenderID) <<
" -> "
-
1749 << to_string(uReceiverID)
-
-
-
+
1748 view.
creditHook(uSenderID, uReceiverID, saAmount, saBalance);
+
+
1750 STAmount const saBefore = saBalance;
+
+
1752 saBalance -= saAmount;
-
1754 std::uint32_t const uFlags(sleRippleState->getFieldU32(sfFlags));
-
1755 bool bDelete =
false;
-
-
-
-
1759 if (saBefore > beast::zero
-
-
1761 && saBalance <= beast::zero
-
-
-
-
-
-
-
-
1769 view.
read(keylet::account(uSenderID))->getFlags() &
-
-
-
1772 !sleRippleState->getFieldAmount(
-
1773 !bSenderHigh ? sfLowLimit : sfHighLimit)
-
-
1775 && !sleRippleState->getFieldU32(
-
1776 !bSenderHigh ? sfLowQualityIn : sfHighQualityIn)
-
-
1778 && !sleRippleState->getFieldU32(
-
1779 !bSenderHigh ? sfLowQualityOut : sfHighQualityOut))
-
-
-
-
-
1784 view, view.
peek(keylet::account(uSenderID)), -1, j);
-
-
-
1787 sleRippleState->setFieldU32(
-
-
1789 uFlags & (!bSenderHigh ? ~
lsfLowReserve : ~lsfHighReserve));
-
-
-
1792 bDelete = !saBalance
-
-
-
+
1754 JLOG(j.
trace()) <<
"rippleCreditIOU: " << to_string(uSenderID) <<
" -> "
+
1755 << to_string(uReceiverID)
+
+
+
+
+
1760 std::uint32_t const uFlags(sleRippleState->getFieldU32(sfFlags));
+
1761 bool bDelete =
false;
+
+
+
+
1765 if (saBefore > beast::zero
+
+
1767 && saBalance <= beast::zero
+
+
+
+
+
+
+
+
1775 view.
read(keylet::account(uSenderID))->getFlags() &
+
+
+
1778 !sleRippleState->getFieldAmount(
+
1779 !bSenderHigh ? sfLowLimit : sfHighLimit)
+
+
1781 && !sleRippleState->getFieldU32(
+
1782 !bSenderHigh ? sfLowQualityIn : sfHighQualityIn)
+
+
1784 && !sleRippleState->getFieldU32(
+
1785 !bSenderHigh ? sfLowQualityOut : sfHighQualityOut))
+
+
+
+
+
1790 view, view.
peek(keylet::account(uSenderID)), -1, j);
+
+
+
1793 sleRippleState->setFieldU32(
+
+
1795 uFlags & (!bSenderHigh ? ~
lsfLowReserve : ~lsfHighReserve));
-
-
-
-
-
1801 sleRippleState->setFieldAmount(sfBalance, saBalance);
-
-
-
-
-
-
-
-
1809 bSenderHigh ? uReceiverID : uSenderID,
-
1810 !bSenderHigh ? uReceiverID : uSenderID,
-
-
-
-
1814 view.
update(sleRippleState);
-
-
-
-
1818 STAmount const saReceiverLimit(
Issue{currency, uReceiverID});
-
-
-
-
-
1823 JLOG(j.
debug()) <<
"rippleCreditIOU: "
-
-
1825 << to_string(uSenderID) <<
" -> " << to_string(uReceiverID)
-
-
-
1828 auto const sleAccount = view.
peek(keylet::account(uReceiverID));
-
-
-
-
+
+
1798 bDelete = !saBalance
+
+
+
+
+
+
+
+
+
1807 sleRippleState->setFieldAmount(sfBalance, saBalance);
+
+
+
+
+
+
+
+
1815 bSenderHigh ? uReceiverID : uSenderID,
+
1816 !bSenderHigh ? uReceiverID : uSenderID,
+
+
+
+
1820 view.
update(sleRippleState);
+
+
+
+
1824 STAmount const saReceiverLimit(
Issue{currency, uReceiverID});
+
+
+
+
+
1829 JLOG(j.
debug()) <<
"rippleCreditIOU: "
+
+
1831 << to_string(uSenderID) <<
" -> " << to_string(uReceiverID)
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
1834 auto const sleAccount = view.
peek(keylet::account(uReceiverID));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
1865 auto const issuer = saAmount.
getIssuer();
-
-
-
-
1869 "ripple::rippleSendIOU : neither sender nor receiver is XRP");
-
-
1871 uSenderID != uReceiverID,
-
1872 "ripple::rippleSendIOU : sender is not receiver");
-
-
1874 if (uSenderID == issuer || uReceiverID == issuer || issuer ==
noAccount())
-
-
-
-
-
-
-
1881 saActual = saAmount;
-
-
-
-
-
-
-
-
1889 saActual = (waiveFee == WaiveTransferFee::Yes)
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1871 auto const issuer = saAmount.
getIssuer();
+
+
+
+
1875 "ripple::rippleSendIOU : neither sender nor receiver is XRP");
+
+
1877 uSenderID != uReceiverID,
+
1878 "ripple::rippleSendIOU : sender is not receiver");
+
+
1880 if (uSenderID == issuer || uReceiverID == issuer || issuer ==
noAccount())
+
+
+
+
+
+
+
1887 saActual = saAmount;
+
+
+
+
-
1893 JLOG(j.
debug()) <<
"rippleSendIOU> " << to_string(uSenderID) <<
" - > "
-
1894 << to_string(uReceiverID)
-
-
-
-
-
-
-
-
1902 terResult =
rippleCreditIOU(view, uSenderID, issuer, saActual,
true, j);
+
+
+
1895 saActual = (waiveFee == WaiveTransferFee::Yes)
+
+
+
+
1899 JLOG(j.
debug()) <<
"rippleSendIOU> " << to_string(uSenderID) <<
" - > "
+
1900 << to_string(uReceiverID)
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
1928 "ripple::accountSendIOU : minimum amount and not MPT");
-
-
-
-
-
-
-
1935 if (!saAmount || (uSenderID == uReceiverID))
-
+
+
1908 terResult =
rippleCreditIOU(view, uSenderID, issuer, saActual,
true, j);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1934 "ripple::accountSendIOU : minimum amount and not MPT");
+
+
-
-
-
-
-
1942 JLOG(j.
trace()) <<
"accountSendIOU: " << to_string(uSenderID) <<
" -> "
-
1943 << to_string(uReceiverID) <<
" : "
-
-
-
-
1947 view, uSenderID, uReceiverID, saAmount, saActual, j, waiveFee);
-
-
-
-
-
-
-
-
-
-
-
1958 ? view.
peek(keylet::account(uSenderID))
-
-
-
1961 ? view.
peek(keylet::account(uReceiverID))
-
-
-
1964 if (
auto stream = j.
trace())
-
-
-
-
-
-
1970 sender_bal = sender->getFieldAmount(sfBalance).getFullText();
-
-
-
1973 receiver_bal = receiver->getFieldAmount(sfBalance).getFullText();
+
+
+
+
1941 if (!saAmount || (uSenderID == uReceiverID))
+
+
+
+
+
+
+
1948 JLOG(j.
trace()) <<
"accountSendIOU: " << to_string(uSenderID) <<
" -> "
+
1949 << to_string(uReceiverID) <<
" : "
+
+
+
+
1953 view, uSenderID, uReceiverID, saAmount, saActual, j, waiveFee);
+
+
+
+
+
+
+
+
+
+
+
1964 ? view.
peek(keylet::account(uSenderID))
+
+
+
1967 ? view.
peek(keylet::account(uReceiverID))
+
+
+
1970 if (
auto stream = j.
trace())
+
+
+
-
1975 stream <<
"accountSendIOU> " << to_string(uSenderID) <<
" ("
-
1976 << sender_bal <<
") -> " << to_string(uReceiverID) <<
" ("
-
1977 << receiver_bal <<
") : " << saAmount.
getFullText();
-
-
-
-
-
1982 if (sender->getFieldAmount(sfBalance) < saAmount)
-
-
-
-
-
-
-
-
-
-
-
1993 auto const sndBal = sender->getFieldAmount(sfBalance);
-
-
-
-
1997 sender->setFieldAmount(sfBalance, sndBal - saAmount);
-
-
-
+
+
1976 sender_bal = sender->getFieldAmount(sfBalance).getFullText();
+
+
+
1979 receiver_bal = receiver->getFieldAmount(sfBalance).getFullText();
+
+
1981 stream <<
"accountSendIOU> " << to_string(uSenderID) <<
" ("
+
1982 << sender_bal <<
") -> " << to_string(uReceiverID) <<
" ("
+
1983 << receiver_bal <<
") : " << saAmount.
getFullText();
+
+
+
+
+
1988 if (sender->getFieldAmount(sfBalance) < saAmount)
+
+
+
+
+
+
+
+
+
+
+
1999 auto const sndBal = sender->getFieldAmount(sfBalance);
+
-
-
-
-
2005 auto const rcvBal = receiver->getFieldAmount(sfBalance);
-
2006 receiver->setFieldAmount(sfBalance, rcvBal + saAmount);
-
-
-
-
-
-
2012 if (
auto stream = j.
trace())
-
-
-
-
-
-
2018 sender_bal = sender->getFieldAmount(sfBalance).getFullText();
-
-
-
2021 receiver_bal = receiver->getFieldAmount(sfBalance).getFullText();
+
+
2003 sender->setFieldAmount(sfBalance, sndBal - saAmount);
+
+
+
+
+
+
+
+
2011 auto const rcvBal = receiver->getFieldAmount(sfBalance);
+
2012 receiver->setFieldAmount(sfBalance, rcvBal + saAmount);
+
+
+
+
+
+
2018 if (
auto stream = j.
trace())
+
+
+
-
2023 stream <<
"accountSendIOU< " << to_string(uSenderID) <<
" ("
-
2024 << sender_bal <<
") -> " << to_string(uReceiverID) <<
" ("
-
2025 << receiver_bal <<
") : " << saAmount.
getFullText();
-
-
-
-
+
+
2024 sender_bal = sender->getFieldAmount(sfBalance).getFullText();
+
+
+
2027 receiver_bal = receiver->getFieldAmount(sfBalance).getFullText();
+
+
2029 stream <<
"accountSendIOU< " << to_string(uSenderID) <<
" ("
+
2030 << sender_bal <<
") -> " << to_string(uReceiverID) <<
" ("
+
2031 << receiver_bal <<
") : " << saAmount.
getFullText();
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
2041 auto const issuer = saAmount.
getIssuer();
-
2042 auto sleIssuance = view.
peek(mptID);
-
-
-
2045 if (uSenderID == issuer)
-
-
2047 (*sleIssuance)[sfOutstandingAmount] += saAmount.
mpt().
value();
-
2048 view.
update(sleIssuance);
-
-
-
-
2052 auto const mptokenID = keylet::mptoken(mptID.key, uSenderID);
-
2053 if (
auto sle = view.
peek(mptokenID))
-
-
2055 auto const amt = sle->getFieldU64(sfMPTAmount);
-
2056 auto const pay = saAmount.
mpt().
value();
-
-
-
2059 (*sle)[sfMPTAmount] = amt - pay;
-
-
-
-
-
-
-
2066 if (uReceiverID == issuer)
-
-
2068 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
-
2069 auto const redeem = saAmount.
mpt().
value();
-
2070 if (outstanding >= redeem)
-
-
2072 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - redeem);
-
2073 view.
update(sleIssuance);
-
-
-
-
-
-
-
2080 auto const mptokenID = keylet::mptoken(mptID.key, uReceiverID);
-
2081 if (
auto sle = view.
peek(mptokenID))
-
-
2083 (*sle)[sfMPTAmount] += saAmount.
mpt().
value();
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
2047 auto const issuer = saAmount.
getIssuer();
+
2048 auto sleIssuance = view.
peek(mptID);
+
+
+
2051 if (uSenderID == issuer)
+
+
2053 (*sleIssuance)[sfOutstandingAmount] += saAmount.
mpt().
value();
+
2054 view.
update(sleIssuance);
+
+
+
+
2058 auto const mptokenID = keylet::mptoken(mptID.key, uSenderID);
+
2059 if (
auto sle = view.
peek(mptokenID))
+
+
2061 auto const amt = sle->getFieldU64(sfMPTAmount);
+
2062 auto const pay = saAmount.
mpt().
value();
+
+
+
2065 (*sle)[sfMPTAmount] = amt - pay;
+
+
+
+
+
+
+
2072 if (uReceiverID == issuer)
+
+
2074 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
+
2075 auto const redeem = saAmount.
mpt().
value();
+
2076 if (outstanding >= redeem)
+
+
2078 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - redeem);
+
2079 view.
update(sleIssuance);
+
+
+
+
+
+
+
2086 auto const mptokenID = keylet::mptoken(mptID.key, uReceiverID);
+
2087 if (
auto sle = view.
peek(mptokenID))
+
+
2089 (*sle)[sfMPTAmount] += saAmount.
mpt().
value();
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2104 uSenderID != uReceiverID,
-
2105 "ripple::rippleSendMPT : sender is not receiver");
-
-
-
2108 auto const issuer = saAmount.
getIssuer();
-
-
-
-
-
-
-
2115 if (uSenderID == issuer || uReceiverID == issuer)
-
-
-
-
2119 if (uSenderID == issuer)
-
-
2121 auto const sendAmount = saAmount.
mpt().
value();
-
2122 auto const maximumAmount =
-
-
2124 if (sendAmount > maximumAmount ||
-
2125 sle->getFieldU64(sfOutstandingAmount) >
-
2126 maximumAmount - sendAmount)
-
-
-
-
-
-
-
-
-
2135 saActual = saAmount;
-
-
-
-
-
2140 saActual = (waiveFee == WaiveTransferFee::Yes)
-
-
-
-
-
-
2146 JLOG(j.
debug()) <<
"rippleSendMPT> " << to_string(uSenderID) <<
" - > "
-
2147 << to_string(uReceiverID)
-
-
-
-
2151 if (
auto const terResult =
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2110 uSenderID != uReceiverID,
+
2111 "ripple::rippleSendMPT : sender is not receiver");
+
+
+
2114 auto const issuer = saAmount.
getIssuer();
+
+
+
+
+
+
+
2121 if (uSenderID == issuer || uReceiverID == issuer)
+
+
+
+
2125 if (uSenderID == issuer)
+
+
2127 auto const sendAmount = saAmount.
mpt().
value();
+
2128 auto const maximumAmount =
+
+
2130 if (sendAmount > maximumAmount ||
+
2131 sle->getFieldU64(sfOutstandingAmount) >
+
2132 maximumAmount - sendAmount)
+
+
+
+
+
+
+
+
+
2141 saActual = saAmount;
+
+
+
+
+
2146 saActual = (waiveFee == WaiveTransferFee::Yes)
+
+
+
+
+
+
2152 JLOG(j.
debug()) <<
"rippleSendMPT> " << to_string(uSenderID) <<
" - > "
+
2153 << to_string(uReceiverID)
+
+
+
+
2157 if (
auto const terResult =
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2170 "ripple::accountSendMPT : minimum amount and MPT");
-
-
-
-
-
2175 if (!saAmount || (uSenderID == uReceiverID))
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2176 "ripple::accountSendMPT : minimum amount and MPT");
-
-
-
-
2181 view, uSenderID, uReceiverID, saAmount, saActual, j, waiveFee);
-
-
+
+
+
+
2181 if (!saAmount || (uSenderID == uReceiverID))
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2197 view, uSenderID, uReceiverID, saAmount, j, waiveFee);
-
-
-
2200 view, uSenderID, uReceiverID, saAmount, j, waiveFee);
-
-
-
+
+
+
+
2187 view, uSenderID, uReceiverID, saAmount, saActual, j, waiveFee);
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2219 auto sle = view.
peek(keylet::account(sender));
-
-
-
-
-
2224 if (before > beast::zero
-
-
2226 &&
after <= beast::zero
-
-
-
-
2230 &&
static_cast<bool>(
-
-
-
-
2234 !state->getFieldAmount(!bSenderHigh ? sfLowLimit : sfHighLimit)
-
-
2236 && !state->getFieldU32(!bSenderHigh ? sfLowQualityIn : sfHighQualityIn)
-
-
-
2239 !state->getFieldU32(!bSenderHigh ? sfLowQualityOut : sfHighQualityOut))
-
-
-
-
-
-
-
-
-
2248 sfFlags, flags & (!bSenderHigh ? ~
lsfLowReserve : ~lsfHighReserve));
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2203 view, uSenderID, uReceiverID, saAmount, j, waiveFee);
+
+
+
2206 view, uSenderID, uReceiverID, saAmount, j, waiveFee);
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
2268 "ripple::issueIOU : neither account nor issuer is XRP");
-
-
-
2271 XRPL_ASSERT(issue == amount.
issue(),
"ripple::issueIOU : matching issue");
-
-
-
-
2275 issue.
account != account,
"ripple::issueIOU : not issuer account");
-
-
2277 JLOG(j.
trace()) <<
"issueIOU: " << to_string(account) <<
": "
-
-
-
2280 bool bSenderHigh = issue.
account > account;
-
-
2282 auto const index = keylet::line(issue.
account, account, issue.
currency);
-
-
2284 if (
auto state = view.
peek(index))
-
-
2286 STAmount final_balance = state->getFieldAmount(sfBalance);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2225 auto sle = view.
peek(keylet::account(sender));
+
+
+
+
+
2230 if (before > beast::zero
+
+
2232 &&
after <= beast::zero
+
+
+
+
2236 &&
static_cast<bool>(
+
+
+
+
2240 !state->getFieldAmount(!bSenderHigh ? sfLowLimit : sfHighLimit)
+
+
2242 && !state->getFieldU32(!bSenderHigh ? sfLowQualityIn : sfHighQualityIn)
+
+
+
2245 !state->getFieldU32(!bSenderHigh ? sfLowQualityOut : sfHighQualityOut))
+
+
+
+
+
+
+
+
+
2254 sfFlags, flags & (!bSenderHigh ? ~
lsfLowReserve : ~lsfHighReserve));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2274 "ripple::issueIOU : neither account nor issuer is XRP");
+
+
+
2277 XRPL_ASSERT(issue == amount.
issue(),
"ripple::issueIOU : matching issue");
+
+
+
+
2281 issue.
account != account,
"ripple::issueIOU : not issuer account");
+
+
2283 JLOG(j.
trace()) <<
"issueIOU: " << to_string(account) <<
": "
+
+
+
2286 bool bSenderHigh = issue.
account > account;
-
-
-
-
2291 STAmount const start_balance = final_balance;
-
-
2293 final_balance -= amount;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2312 state->setFieldAmount(sfBalance, final_balance);
-
-
-
-
-
2317 bSenderHigh ? account : issue.
account,
-
2318 bSenderHigh ? issue.
account : account,
-
-
-
-
-
-
-
-
-
-
-
-
+
2288 auto const index = keylet::line(issue.
account, account, issue.
currency);
+
+
2290 if (
auto state = view.
peek(index))
+
+
2292 STAmount final_balance = state->getFieldAmount(sfBalance);
+
+
+
+
+
2297 STAmount const start_balance = final_balance;
+
+
2299 final_balance -= amount;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2318 state->setFieldAmount(sfBalance, final_balance);
+
+
+
+
+
2323 bSenderHigh ? account : issue.
account,
+
2324 bSenderHigh ? issue.
account : account,
+
+
+
+
+
+
-
-
-
2334 auto const receiverAccount = view.
peek(keylet::account(account));
-
2335 if (!receiverAccount)
-
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
2340 auto const receiverAccount = view.
peek(keylet::account(account));
+
2341 if (!receiverAccount)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
2368 "ripple::redeemIOU : neither account nor issuer is XRP");
-
-
-
2371 XRPL_ASSERT(issue == amount.
issue(),
"ripple::redeemIOU : matching issue");
-
-
-
-
2375 issue.
account != account,
"ripple::redeemIOU : not issuer account");
-
-
2377 JLOG(j.
trace()) <<
"redeemIOU: " << to_string(account) <<
": "
-
-
-
2380 bool bSenderHigh = account > issue.
account;
-
-
-
-
-
2385 STAmount final_balance = state->getFieldAmount(sfBalance);
-
-
-
-
-
2390 STAmount const start_balance = final_balance;
-
-
2392 final_balance -= amount;
-
-
-
2395 view, state, bSenderHigh, account, start_balance, final_balance, j);
-
-
-
-
-
-
-
-
-
-
2405 state->setFieldAmount(sfBalance, final_balance);
-
-
-
-
-
-
-
2412 bSenderHigh ? issue.
account : account,
-
2413 bSenderHigh ? account : issue.
account,
-
-
-
-
-
-
-
-
-
-
-
-
2425 JLOG(j.
fatal()) <<
"redeemIOU: " << to_string(account)
-
-
2427 <<
" but no trust line exists!";
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
2374 "ripple::redeemIOU : neither account nor issuer is XRP");
+
+
+
2377 XRPL_ASSERT(issue == amount.
issue(),
"ripple::redeemIOU : matching issue");
+
+
+
+
2381 issue.
account != account,
"ripple::redeemIOU : not issuer account");
+
+
2383 JLOG(j.
trace()) <<
"redeemIOU: " << to_string(account) <<
": "
+
+
+
2386 bool bSenderHigh = account > issue.
account;
+
+
+
+
+
2391 STAmount final_balance = state->getFieldAmount(sfBalance);
+
+
+
+
+
2396 STAmount const start_balance = final_balance;
+
+
2398 final_balance -= amount;
+
+
+
2401 view, state, bSenderHigh, account, start_balance, final_balance, j);
+
+
+
+
+
+
+
+
+
+
2411 state->setFieldAmount(sfBalance, final_balance);
+
+
+
+
+
+
+
2418 bSenderHigh ? issue.
account : account,
+
2419 bSenderHigh ? account : issue.
account,
+
+
+
+
+
+
+
+
+
+
+
+
2431 JLOG(j.
fatal()) <<
"redeemIOU: " << to_string(account)
+
+
2433 <<
" but no trust line exists!";
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
2442 from != beast::zero,
"ripple::transferXRP : nonzero from account");
-
2443 XRPL_ASSERT(to != beast::zero,
"ripple::transferXRP : nonzero to account");
-
2444 XRPL_ASSERT(from != to,
"ripple::transferXRP : sender is not receiver");
-
2445 XRPL_ASSERT(amount.
native(),
"ripple::transferXRP : amount is XRP");
-
-
-
-
2449 if (!sender || !receiver)
-
-
-
2452 JLOG(j.
trace()) <<
"transferXRP: " << to_string(from) <<
" -> "
-
2453 << to_string(to) <<
") : " << amount.
getFullText();
-
-
2455 if (sender->getFieldAmount(sfBalance) < amount)
-
-
-
-
-
-
-
-
-
-
-
-
2467 sender->setFieldAmount(
-
2468 sfBalance, sender->getFieldAmount(sfBalance) - amount);
-
-
-
2471 receiver->setFieldAmount(
-
2472 sfBalance, receiver->getFieldAmount(sfBalance) + amount);
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
2448 from != beast::zero,
"ripple::transferXRP : nonzero from account");
+
2449 XRPL_ASSERT(to != beast::zero,
"ripple::transferXRP : nonzero to account");
+
2450 XRPL_ASSERT(from != to,
"ripple::transferXRP : sender is not receiver");
+
2451 XRPL_ASSERT(amount.
native(),
"ripple::transferXRP : amount is XRP");
+
+
+
+
2455 if (!sender || !receiver)
+
+
+
2458 JLOG(j.
trace()) <<
"transferXRP: " << to_string(from) <<
" -> "
+
2459 << to_string(to) <<
") : " << amount.
getFullText();
+
+
2461 if (sender->getFieldAmount(sfBalance) < amount)
+
+
+
+
+
+
+
+
+
+
+
+
2473 sender->setFieldAmount(
+
2474 sfBalance, sender->getFieldAmount(sfBalance) - amount);
+
+
+
2477 receiver->setFieldAmount(
+
2478 sfBalance, receiver->getFieldAmount(sfBalance) + amount);
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
2488 auto const trustLine =
-
-
-
2491 if (!trustLine && authType == AuthType::StrongAuth)
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
2496 if (
auto const issuerAccount = view.
read(keylet::account(issue.
account));
-
-
-
-
2500 return ((*trustLine)[sfFlags] &
-
-
-
-
-
-
-
-
+
2494 auto const trustLine =
+
+
+
2497 if (!trustLine && authType == AuthType::StrongAuth)
+
+
+
+
+
2502 if (
auto const issuerAccount = view.
read(keylet::account(issue.
account));
+
+
+
+
2506 return ((*trustLine)[sfFlags] &
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
2518 auto const mptID = keylet::mptIssuance(mptIssue.
getMptID());
-
2519 auto const sleIssuance = view.
read(mptID);
-
-
-
-
2523 auto const mptIssuer = sleIssuance->getAccountID(sfIssuer);
-
-
-
2526 if (mptIssuer == account)
-
+
+
+
+
+
+
+
+
+
+
+
2524 auto const mptID = keylet::mptIssuance(mptIssue.
getMptID());
+
2525 auto const sleIssuance = view.
read(mptID);
+
+
-
-
-
-
-
-
-
2535 auto const sleIssuer = view.
read(keylet::account(mptIssuer));
-
-
-
-
2539 if (sleIssuer->isFieldPresent(sfVaultID))
-
-
2541 auto const sleVault =
-
2542 view.
read(keylet::vault(sleIssuer->getFieldH256(sfVaultID)));
-
-
-
-
2546 auto const asset = sleVault->at(sfAsset);
-
-
-
-
2550 return requireAuth(view, issue, account, authType);
-
-
-
2553 view, issue, account, authType, depth + 1);
-
-
-
-
-
-
-
-
2561 auto const mptokenID = keylet::mptoken(mptID.key, account);
-
2562 auto const sleToken = view.
read(mptokenID);
-
-
-
-
2566 (authType == AuthType::StrongAuth || authType == AuthType::Legacy))
-
-
-
-
-
2571 auto const maybeDomainID = sleIssuance->at(~sfDomainID);
-
-
-
-
-
2576 "ripple::requireAuth : issuance requires authorization");
-
-
2578 if (
auto const ter =
-
2579 credentials::validDomain(view, *maybeDomainID, account);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
2529 auto const mptIssuer = sleIssuance->getAccountID(sfIssuer);
+
+
+
2532 if (mptIssuer == account)
+
+
+
+
+
+
+
+
+
2541 auto const sleIssuer = view.
read(keylet::account(mptIssuer));
+
+
+
+
2545 if (sleIssuer->isFieldPresent(sfVaultID))
+
+
2547 auto const sleVault =
+
2548 view.
read(keylet::vault(sleIssuer->getFieldH256(sfVaultID)));
+
+
+
+
2552 auto const asset = sleVault->at(sfAsset);
+
+
+
+
2556 return requireAuth(view, issue, account, authType);
+
+
+
2559 view, issue, account, authType, depth + 1);
+
+
+
+
+
+
+
+
2567 auto const mptokenID = keylet::mptoken(mptID.key, account);
+
2568 auto const sleToken = view.
read(mptokenID);
+
+
+
+
2572 (authType == AuthType::StrongAuth || authType == AuthType::Legacy))
+
+
+
+
+
2577 auto const maybeDomainID = sleIssuance->at(~sfDomainID);
+
+
+
+
+
2582 "ripple::requireAuth : issuance requires authorization");
+
+
2584 if (
auto const ter =
+
2585 credentials::validDomain(view, *maybeDomainID, account);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
2599 MPTID const& mptIssuanceID,
-
-
-
-
-
2604 auto const sleIssuance = view.
read(keylet::mptIssuance(mptIssuanceID));
-
-
-
-
-
-
2610 "ripple::enforceMPTokenAuthorization : authorization required");
-
-
2612 if (account == sleIssuance->at(sfIssuer))
-
-
-
2615 auto const keylet = keylet::mptoken(mptIssuanceID, account);
-
2616 auto const sleToken = view.
read(keylet);
-
2617 auto const maybeDomainID = sleIssuance->at(~sfDomainID);
-
-
2619 bool const authorizedByDomain = [&]() ->
bool {
-
-
2621 if (!maybeDomainID.has_value())
-
-
-
-
-
-
-
-
-
-
-
2632 if (!authorizedByDomain && sleToken ==
nullptr)
-
-
-
-
-
-
-
-
-
-
-
2643 else if (!authorizedByDomain && maybeDomainID.has_value())
-
-
-
-
-
-
-
2650 else if (!authorizedByDomain)
-
-
-
-
-
2655 sleToken !=
nullptr && !maybeDomainID.has_value(),
-
2656 "ripple::enforceMPTokenAuthorization : found MPToken");
-
-
-
-
-
-
2662 else if (authorizedByDomain && sleToken !=
nullptr)
-
-
-
-
-
2667 maybeDomainID.has_value(),
-
2668 "ripple::enforceMPTokenAuthorization : found MPToken for domain");
-
-
-
2671 else if (authorizedByDomain)
-
-
-
-
-
2676 maybeDomainID.has_value() && sleToken ==
nullptr,
-
2677 "ripple::enforceMPTokenAuthorization : new MPToken for domain");
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2692 "ripple::enforceMPTokenAuthorization : condition list is incomplete");
-
-
-
+
+
+
+
+
+
2605 MPTID const& mptIssuanceID,
+
+
+
+
+
2610 auto const sleIssuance = view.
read(keylet::mptIssuance(mptIssuanceID));
+
+
+
+
+
+
2616 "ripple::enforceMPTokenAuthorization : authorization required");
+
+
2618 if (account == sleIssuance->at(sfIssuer))
+
+
+
2621 auto const keylet = keylet::mptoken(mptIssuanceID, account);
+
2622 auto const sleToken = view.
read(keylet);
+
2623 auto const maybeDomainID = sleIssuance->at(~sfDomainID);
+
+
2625 bool const authorizedByDomain = [&]() ->
bool {
+
+
2627 if (!maybeDomainID.has_value())
+
+
+
+
+
+
+
+
+
+
+
2638 if (!authorizedByDomain && sleToken ==
nullptr)
+
+
+
+
+
+
+
+
+
+
+
2649 else if (!authorizedByDomain && maybeDomainID.has_value())
+
+
+
+
+
+
+
2656 else if (!authorizedByDomain)
+
+
+
+
+
2661 sleToken !=
nullptr && !maybeDomainID.has_value(),
+
2662 "ripple::enforceMPTokenAuthorization : found MPToken");
+
+
+
+
+
+
2668 else if (authorizedByDomain && sleToken !=
nullptr)
+
+
+
+
+
2673 maybeDomainID.has_value(),
+
2674 "ripple::enforceMPTokenAuthorization : found MPToken for domain");
+
+
+
2677 else if (authorizedByDomain)
+
+
+
+
+
2682 maybeDomainID.has_value() && sleToken ==
nullptr,
+
2683 "ripple::enforceMPTokenAuthorization : new MPToken for domain");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2698 "ripple::enforceMPTokenAuthorization : condition list is incomplete");
+
+
+
-
-
-
-
-
-
-
-
-
-
2704 auto const mptID = keylet::mptIssuance(mptIssue.
getMptID());
-
2705 auto const sleIssuance = view.
read(mptID);
-
-
-
-
-
-
2711 if (from != (*sleIssuance)[sfIssuer] && to != (*sleIssuance)[sfIssuer])
-
-
-
-
+
+
+
+
+
+
+
+
+
+
2710 auto const mptID = keylet::mptIssuance(mptIssue.
getMptID());
+
2711 auto const sleIssuance = view.
read(mptID);
+
+
+
+
+
+
2717 if (from != (*sleIssuance)[sfIssuer] && to != (*sleIssuance)[sfIssuer])
+
+
+
+
-
-
-
-
-
-
2720 Keylet const& ownerDirKeylet,
-
-
-
-
-
-
-
2727 unsigned int uDirEntry{0};
-
2728 uint256 dirEntry{beast::zero};
-
-
-
2731 if (view.
exists(ownerDirKeylet) &&
-
2732 dirFirst(view, ownerDirKeylet.
key, sleDirNode, uDirEntry, dirEntry))
-
-
-
-
2736 if (maxNodesToDelete && ++deleted > *maxNodesToDelete)
-
-
-
-
2740 auto sleItem = view.
peek(keylet::child(dirEntry));
-
-
-
-
-
-
2746 <<
"DeleteAccount: Directory node in ledger " << view.
seq()
-
2747 <<
" has index to object that is missing: "
-
2748 << to_string(dirEntry);
-
-
-
-
-
-
2754 sleItem->getFieldU16(sfLedgerEntryType))};
-
-
-
-
2758 auto const [ter, skipEntry] = deleter(nodeType, dirEntry, sleItem);
-
-
+
+
+
+
+
+
2726 Keylet const& ownerDirKeylet,
+
+
+
+
+
+
+
2733 unsigned int uDirEntry{0};
+
2734 uint256 dirEntry{beast::zero};
+
+
+
2737 if (view.
exists(ownerDirKeylet) &&
+
2738 dirFirst(view, ownerDirKeylet.
key, sleDirNode, uDirEntry, dirEntry))
+
+
+
+
2742 if (maxNodesToDelete && ++deleted > *maxNodesToDelete)
+
+
+
+
2746 auto sleItem = view.
peek(keylet::child(dirEntry));
+
+
+
+
+
+
2752 <<
"DeleteAccount: Directory node in ledger " << view.
seq()
+
2753 <<
" has index to object that is missing: "
+
2754 << to_string(dirEntry);
+
+
+
+
+
+
2760 sleItem->getFieldU16(sfLedgerEntryType))};
-
-
-
-
-
-
-
-
-
-
+
+
+
2764 auto const [ter, skipEntry] = deleter(nodeType, dirEntry, sleItem);
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
2780 "ripple::cleanupOnAccountDelete : minimum dir entries");
-
-
-
-
-
2785 <<
"DeleteAccount iterator re-validation failed.";
-
-
-
-
2789 if (skipEntry == SkipEntry::No)
-
-
-
-
2793 dirNext(view, ownerDirKeylet.
key, sleDirNode, uDirEntry, dirEntry));
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
2786 "ripple::cleanupOnAccountDelete : minimum dir entries");
+
+
+
+
+
2791 <<
"DeleteAccount iterator re-validation failed.";
+
+
+
+
2795 if (skipEntry == SkipEntry::No)
+
+
+
+
2799 dirNext(view, ownerDirKeylet.
key, sleDirNode, uDirEntry, dirEntry));
+
+
+
+
-
-
-
-
-
-
-
-
-
-
2806 if (!sleState || sleState->getType() != ltRIPPLE_STATE)
-
-
-
-
2810 sleState->getFieldAmount(sfLowLimit).getIssuer(),
-
2811 sleState->getFieldAmount(sfHighLimit).getIssuer());
-
2812 auto sleLow = view.
peek(keylet::account(low));
-
2813 auto sleHigh = view.
peek(keylet::account(high));
-
2814 if (!sleLow || !sleHigh)
-
-
-
2817 bool const ammLow = sleLow->isFieldPresent(sfAMMID);
-
2818 bool const ammHigh = sleHigh->isFieldPresent(sfAMMID);
-
-
-
2821 if (ammLow && ammHigh)
-
-
-
-
2825 if (!ammLow && !ammHigh)
-
-
-
-
2829 if (ammAccountID && (low != *ammAccountID && high != *ammAccountID))
-
-
-
2832 if (
auto const ter =
trustDelete(view, sleState, low, high, j);
-
-
-
-
2836 <<
"deleteAMMTrustLine: failed to delete the trustline.";
-
-
-
-
-
2841 if (!(sleState->getFlags() & uFlags))
-
-
-
+
+
+
+
+
+
+
+
+
+
2812 if (!sleState || sleState->getType() != ltRIPPLE_STATE)
+
+
+
+
2816 sleState->getFieldAmount(sfLowLimit).getIssuer(),
+
2817 sleState->getFieldAmount(sfHighLimit).getIssuer());
+
2818 auto sleLow = view.
peek(keylet::account(low));
+
2819 auto sleHigh = view.
peek(keylet::account(high));
+
2820 if (!sleLow || !sleHigh)
+
+
+
2823 bool const ammLow = sleLow->isFieldPresent(sfAMMID);
+
2824 bool const ammHigh = sleHigh->isFieldPresent(sfAMMID);
+
+
+
2827 if (ammLow && ammHigh)
+
+
+
+
2831 if (!ammLow && !ammHigh)
+
+
+
+
2835 if (ammAccountID && (low != *ammAccountID && high != *ammAccountID))
+
+
+
2838 if (
auto const ter =
trustDelete(view, sleState, low, high, j);
+
+
+
+
2842 <<
"deleteAMMTrustLine: failed to delete the trustline.";
+
+
-
-
+
+
2847 if (!(sleState->getFlags() & uFlags))
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2863 view, uSenderID, uReceiverID, saAmount, bCheckIssuer, j);
-
-
-
-
-
-
2869 "ripple::rippleCredit : not checking issuer");
-
-
2871 view, uSenderID, uReceiverID, saAmount, j);
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2869 view, uSenderID, uReceiverID, saAmount, bCheckIssuer, j);
+
+
+
+
+
+
2875 "ripple::rippleCredit : not checking issuer");
+
+
2877 view, uSenderID, uReceiverID, saAmount, j);
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
2885 "ripple::assetsToSharesDeposit : non-negative assets");
-
-
2887 assets.
asset() == vault->at(sfAsset),
-
2888 "ripple::assetsToSharesDeposit : assets and vault match");
-
2889 if (assets.
negative() || assets.
asset() != vault->at(sfAsset))
-
-
-
2892 Number const assetTotal = vault->at(sfAssetsTotal);
-
2893 STAmount shares{vault->at(sfShareMPTID)};
-
2894 if (assetTotal == 0)
-
-
-
-
-
-
2900 Number const shareTotal = issuance->at(sfOutstandingAmount);
-
2901 shares = (shareTotal * (assets / assetTotal)).truncate();
-
-
+
+
+
+
+
+
+
+
+
+
+
2891 "ripple::assetsToSharesDeposit : non-negative assets");
+
+
2893 assets.
asset() == vault->at(sfAsset),
+
2894 "ripple::assetsToSharesDeposit : assets and vault match");
+
2895 if (assets.
negative() || assets.
asset() != vault->at(sfAsset))
+
+
+
2898 Number const assetTotal = vault->at(sfAssetsTotal);
+
2899 STAmount shares{vault->at(sfShareMPTID)};
+
2900 if (assetTotal == 0)
+
+
+
+
+
+
2906 Number const shareTotal = issuance->at(sfOutstandingAmount);
+
2907 shares = (shareTotal * (assets / assetTotal)).truncate();
+
+
-
-
-
-
-
-
-
-
-
-
-
2913 "ripple::sharesToAssetsDeposit : non-negative shares");
-
-
2915 shares.
asset() == vault->at(sfShareMPTID),
-
2916 "ripple::sharesToAssetsDeposit : shares and vault match");
-
2917 if (shares.
negative() || shares.
asset() != vault->at(sfShareMPTID))
-
-
-
2920 Number const assetTotal = vault->at(sfAssetsTotal);
-
2921 STAmount assets{vault->at(sfAsset)};
-
2922 if (assetTotal == 0)
-
-
-
-
2926 shares.
exponent() - vault->at(sfScale),
-
-
-
2929 Number const shareTotal = issuance->at(sfOutstandingAmount);
-
2930 assets = assetTotal * (shares / shareTotal);
-
-
+
+
+
+
+
+
+
+
+
+
+
2919 "ripple::sharesToAssetsDeposit : non-negative shares");
+
+
2921 shares.
asset() == vault->at(sfShareMPTID),
+
2922 "ripple::sharesToAssetsDeposit : shares and vault match");
+
2923 if (shares.
negative() || shares.
asset() != vault->at(sfShareMPTID))
+
+
+
2926 Number const assetTotal = vault->at(sfAssetsTotal);
+
2927 STAmount assets{vault->at(sfAsset)};
+
2928 if (assetTotal == 0)
+
+
+
+
2932 shares.
exponent() - vault->at(sfScale),
+
+
+
2935 Number const shareTotal = issuance->at(sfOutstandingAmount);
+
2936 assets = assetTotal * (shares / shareTotal);
+
+
-
-
-
-
-
-
-
-
-
-
-
-
2943 "ripple::assetsToSharesDeposit : non-negative assets");
-
-
2945 assets.
asset() == vault->at(sfAsset),
-
2946 "ripple::assetsToSharesWithdraw : assets and vault match");
-
2947 if (assets.
negative() || assets.
asset() != vault->at(sfAsset))
-
-
-
2950 Number assetTotal = vault->at(sfAssetsTotal);
-
2951 assetTotal -= vault->at(sfLossUnrealized);
-
2952 STAmount shares{vault->at(sfShareMPTID)};
-
2953 if (assetTotal == 0)
-
-
2955 Number const shareTotal = issuance->at(sfOutstandingAmount);
-
2956 Number result = shareTotal * (assets / assetTotal);
-
2957 if (truncate == TruncateShares::yes)
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
2949 "ripple::assetsToSharesDeposit : non-negative assets");
+
+
2951 assets.
asset() == vault->at(sfAsset),
+
2952 "ripple::assetsToSharesWithdraw : assets and vault match");
+
2953 if (assets.
negative() || assets.
asset() != vault->at(sfAsset))
+
+
+
2956 Number assetTotal = vault->at(sfAssetsTotal);
+
2957 assetTotal -= vault->at(sfLossUnrealized);
+
2958 STAmount shares{vault->at(sfShareMPTID)};
+
2959 if (assetTotal == 0)
+
+
2961 Number const shareTotal = issuance->at(sfOutstandingAmount);
+
2962 Number result = shareTotal * (assets / assetTotal);
+
2963 if (truncate == TruncateShares::yes)
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
2971 "ripple::sharesToAssetsDeposit : non-negative shares");
-
-
2973 shares.
asset() == vault->at(sfShareMPTID),
-
2974 "ripple::sharesToAssetsWithdraw : shares and vault match");
-
2975 if (shares.
negative() || shares.
asset() != vault->at(sfShareMPTID))
-
-
-
2978 Number assetTotal = vault->at(sfAssetsTotal);
-
2979 assetTotal -= vault->at(sfLossUnrealized);
-
2980 STAmount assets{vault->at(sfAsset)};
-
2981 if (assetTotal == 0)
-
-
2983 Number const shareTotal = issuance->at(sfOutstandingAmount);
-
2984 assets = assetTotal * (shares / shareTotal);
-
-
+
+
+
+
+
+
+
+
+
+
+
2977 "ripple::sharesToAssetsDeposit : non-negative shares");
+
+
2979 shares.
asset() == vault->at(sfShareMPTID),
+
2980 "ripple::sharesToAssetsWithdraw : shares and vault match");
+
2981 if (shares.
negative() || shares.
asset() != vault->at(sfShareMPTID))
+
+
+
2984 Number assetTotal = vault->at(sfAssetsTotal);
+
2985 assetTotal -= vault->at(sfLossUnrealized);
+
2986 STAmount assets{vault->at(sfAsset)};
+
2987 if (assetTotal == 0)
+
+
2989 Number const shareTotal = issuance->at(sfOutstandingAmount);
+
2990 assets = assetTotal * (shares / shareTotal);
+
+
-
-
-
-
-
-
-
-
-
-
-
2996 auto const mptID = keylet::mptIssuance(mptIssue.getMptID());
-
2997 auto sleIssuance = view.
peek(mptID);
-
-
-
3000 JLOG(j.
error()) <<
"rippleLockEscrowMPT: MPT issuance not found for "
-
3001 << mptIssue.getMptID();
-
-
-
-
-
-
-
3008 <<
"rippleLockEscrowMPT: sender is the issuer, cannot lock MPTs.";
-
-
-
-
-
-
-
3015 auto const mptokenID = keylet::mptoken(mptID.key, sender);
-
3016 auto sle = view.
peek(mptokenID);
-
-
-
-
3020 <<
"rippleLockEscrowMPT: MPToken not found for " << sender;
-
-
-
-
3024 auto const amt = sle->getFieldU64(sfMPTAmount);
-
3025 auto const pay = amount.
mpt().
value();
-
-
-
-
-
-
3031 <<
"rippleLockEscrowMPT: insufficient MPTAmount for "
-
3032 << to_string(sender) <<
": " << amt <<
" < " << pay;
-
-
-
-
3036 (*sle)[sfMPTAmount] = amt - pay;
-
-
-
3039 uint64_t
const locked = (*sle)[~sfLockedAmount].value_or(0);
-
-
-
-
-
3044 <<
"rippleLockEscrowMPT: overflow on locked amount for "
-
3045 << to_string(sender) <<
": " << locked <<
" + " << pay;
-
-
-
-
3049 if (sle->isFieldPresent(sfLockedAmount))
-
3050 (*sle)[sfLockedAmount] += pay;
-
-
3052 sle->setFieldU64(sfLockedAmount, pay);
-
-
-
-
-
-
-
-
3060 uint64_t
const issuanceEscrowed =
-
3061 (*sleIssuance)[~sfLockedAmount].value_or(0);
-
3062 auto const pay = amount.
mpt().
value();
-
-
-
-
-
-
3068 JLOG(j.
error()) <<
"rippleLockEscrowMPT: overflow on issuance "
-
3069 "locked amount for "
-
3070 << mptIssue.getMptID() <<
": " << issuanceEscrowed
-
-
-
-
-
3075 if (sleIssuance->isFieldPresent(sfLockedAmount))
-
3076 (*sleIssuance)[sfLockedAmount] += pay;
-
-
3078 sleIssuance->setFieldU64(sfLockedAmount, pay);
-
-
3080 view.
update(sleIssuance);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
3096 netAmount == grossAmount,
-
3097 "ripple::rippleUnlockEscrowMPT : netAmount == grossAmount");
-
-
3099 auto const& issuer = netAmount.
getIssuer();
-
-
3101 auto const mptID = keylet::mptIssuance(mptIssue.getMptID());
-
3102 auto sleIssuance = view.
peek(mptID);
-
-
-
3105 JLOG(j.
error()) <<
"rippleUnlockEscrowMPT: MPT issuance not found for "
-
3106 << mptIssue.getMptID();
-
-
-
-
-
-
3112 if (!sleIssuance->isFieldPresent(sfLockedAmount))
-
-
-
3115 <<
"rippleUnlockEscrowMPT: no locked amount in issuance for "
-
3116 << mptIssue.getMptID();
-
-
-
-
3120 auto const locked = sleIssuance->getFieldU64(sfLockedAmount);
-
3121 auto const redeem = grossAmount.
mpt().
value();
-
-
-
-
-
-
-
3128 <<
"rippleUnlockEscrowMPT: insufficient locked amount for "
-
3129 << mptIssue.getMptID() <<
": " << locked <<
" < " << redeem;
-
-
-
-
3133 auto const newLocked = locked - redeem;
-
-
3135 sleIssuance->makeFieldAbsent(sfLockedAmount);
-
-
3137 sleIssuance->setFieldU64(sfLockedAmount, newLocked);
-
3138 view.
update(sleIssuance);
-
-
-
3141 if (issuer != receiver)
-
-
-
3144 auto const mptokenID = keylet::mptoken(mptID.key, receiver);
-
3145 auto sle = view.
peek(mptokenID);
-
-
-
-
3149 <<
"rippleUnlockEscrowMPT: MPToken not found for " << receiver;
-
-
-
-
3153 auto current = sle->getFieldU64(sfMPTAmount);
-
3154 auto delta = netAmount.
mpt().
value();
-
-
-
-
-
-
3160 <<
"rippleUnlockEscrowMPT: overflow on MPTAmount for "
-
3161 << to_string(receiver) <<
": " <<
current <<
" + " << delta;
-
-
-
-
3165 (*sle)[sfMPTAmount] += delta;
-
-
-
-
-
-
3171 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
-
3172 auto const redeem = netAmount.
mpt().
value();
-
-
-
-
-
-
-
3179 <<
"rippleUnlockEscrowMPT: insufficient outstanding amount for "
-
3180 << mptIssue.getMptID() <<
": " << outstanding <<
" < "
-
-
-
-
-
3185 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - redeem);
-
3186 view.
update(sleIssuance);
-
-
-
3189 if (issuer == sender)
-
-
3191 JLOG(j.
error()) <<
"rippleUnlockEscrowMPT: sender is the issuer, "
-
3192 "cannot unlock MPTs.";
-
-
-
-
-
-
3198 auto const mptokenID = keylet::mptoken(mptID.key, sender);
-
3199 auto sle = view.
peek(mptokenID);
-
-
-
-
3203 <<
"rippleUnlockEscrowMPT: MPToken not found for " << sender;
-
-
-
-
3207 if (!sle->isFieldPresent(sfLockedAmount))
-
-
-
3210 <<
"rippleUnlockEscrowMPT: no locked amount in MPToken for "
-
3211 << to_string(sender);
-
-
-
-
3215 auto const locked = sle->getFieldU64(sfLockedAmount);
-
3216 auto const delta = grossAmount.
mpt().
value();
-
-
-
-
-
-
3222 <<
"rippleUnlockEscrowMPT: insufficient locked amount for "
-
3223 << to_string(sender) <<
": " << locked <<
" < " << delta;
-
-
-
-
3227 auto const newLocked = locked - delta;
-
-
3229 sle->makeFieldAbsent(sfLockedAmount);
-
-
3231 sle->setFieldU64(sfLockedAmount, newLocked);
-
-
-
-
-
-
-
-
-
-
-
3242 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
-
-
-
-
-
-
3248 <<
"rippleUnlockEscrowMPT: insufficient outstanding amount for "
-
3249 << mptIssue.getMptID() <<
": " << outstanding <<
" < " << diff;
-
-
-
-
3253 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - diff);
-
3254 view.
update(sleIssuance);
-
-
-
+
+
+
+
+
+
+
+
+
+
+
3002 auto const mptID = keylet::mptIssuance(mptIssue.getMptID());
+
3003 auto sleIssuance = view.
peek(mptID);
+
+
+
3006 JLOG(j.
error()) <<
"rippleLockEscrowMPT: MPT issuance not found for "
+
3007 << mptIssue.getMptID();
+
+
+
+
+
+
+
3014 <<
"rippleLockEscrowMPT: sender is the issuer, cannot lock MPTs.";
+
+
+
+
+
+
+
3021 auto const mptokenID = keylet::mptoken(mptID.key, sender);
+
3022 auto sle = view.
peek(mptokenID);
+
+
+
+
3026 <<
"rippleLockEscrowMPT: MPToken not found for " << sender;
+
+
+
+
3030 auto const amt = sle->getFieldU64(sfMPTAmount);
+
3031 auto const pay = amount.
mpt().
value();
+
+
+
+
+
+
3037 <<
"rippleLockEscrowMPT: insufficient MPTAmount for "
+
3038 << to_string(sender) <<
": " << amt <<
" < " << pay;
+
+
+
+
3042 (*sle)[sfMPTAmount] = amt - pay;
+
+
+
3045 uint64_t
const locked = (*sle)[~sfLockedAmount].value_or(0);
+
+
+
+
+
3050 <<
"rippleLockEscrowMPT: overflow on locked amount for "
+
3051 << to_string(sender) <<
": " << locked <<
" + " << pay;
+
+
+
+
3055 if (sle->isFieldPresent(sfLockedAmount))
+
3056 (*sle)[sfLockedAmount] += pay;
+
+
3058 sle->setFieldU64(sfLockedAmount, pay);
+
+
+
+
+
+
+
+
3066 uint64_t
const issuanceEscrowed =
+
3067 (*sleIssuance)[~sfLockedAmount].value_or(0);
+
3068 auto const pay = amount.
mpt().
value();
+
+
+
+
+
+
3074 JLOG(j.
error()) <<
"rippleLockEscrowMPT: overflow on issuance "
+
3075 "locked amount for "
+
3076 << mptIssue.getMptID() <<
": " << issuanceEscrowed
+
+
+
+
+
3081 if (sleIssuance->isFieldPresent(sfLockedAmount))
+
3082 (*sleIssuance)[sfLockedAmount] += pay;
+
+
3084 sleIssuance->setFieldU64(sfLockedAmount, pay);
+
+
3086 view.
update(sleIssuance);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
3102 netAmount == grossAmount,
+
3103 "ripple::rippleUnlockEscrowMPT : netAmount == grossAmount");
+
+
3105 auto const& issuer = netAmount.
getIssuer();
+
+
3107 auto const mptID = keylet::mptIssuance(mptIssue.getMptID());
+
3108 auto sleIssuance = view.
peek(mptID);
+
+
+
3111 JLOG(j.
error()) <<
"rippleUnlockEscrowMPT: MPT issuance not found for "
+
3112 << mptIssue.getMptID();
+
+
+
+
+
+
3118 if (!sleIssuance->isFieldPresent(sfLockedAmount))
+
+
+
3121 <<
"rippleUnlockEscrowMPT: no locked amount in issuance for "
+
3122 << mptIssue.getMptID();
+
+
+
+
3126 auto const locked = sleIssuance->getFieldU64(sfLockedAmount);
+
3127 auto const redeem = grossAmount.
mpt().
value();
+
+
+
+
+
+
+
3134 <<
"rippleUnlockEscrowMPT: insufficient locked amount for "
+
3135 << mptIssue.getMptID() <<
": " << locked <<
" < " << redeem;
+
+
+
+
3139 auto const newLocked = locked - redeem;
+
+
3141 sleIssuance->makeFieldAbsent(sfLockedAmount);
+
+
3143 sleIssuance->setFieldU64(sfLockedAmount, newLocked);
+
3144 view.
update(sleIssuance);
+
+
+
3147 if (issuer != receiver)
+
+
+
3150 auto const mptokenID = keylet::mptoken(mptID.key, receiver);
+
3151 auto sle = view.
peek(mptokenID);
+
+
+
+
3155 <<
"rippleUnlockEscrowMPT: MPToken not found for " << receiver;
+
+
+
+
3159 auto current = sle->getFieldU64(sfMPTAmount);
+
3160 auto delta = netAmount.
mpt().
value();
+
+
+
+
+
+
3166 <<
"rippleUnlockEscrowMPT: overflow on MPTAmount for "
+
3167 << to_string(receiver) <<
": " <<
current <<
" + " << delta;
+
+
+
+
3171 (*sle)[sfMPTAmount] += delta;
+
+
+
+
+
+
3177 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
+
3178 auto const redeem = netAmount.
mpt().
value();
+
+
+
+
+
+
+
3185 <<
"rippleUnlockEscrowMPT: insufficient outstanding amount for "
+
3186 << mptIssue.getMptID() <<
": " << outstanding <<
" < "
+
+
+
+
+
3191 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - redeem);
+
3192 view.
update(sleIssuance);
+
+
+
3195 if (issuer == sender)
+
+
3197 JLOG(j.
error()) <<
"rippleUnlockEscrowMPT: sender is the issuer, "
+
3198 "cannot unlock MPTs.";
+
+
+
+
+
+
3204 auto const mptokenID = keylet::mptoken(mptID.key, sender);
+
3205 auto sle = view.
peek(mptokenID);
+
+
+
+
3209 <<
"rippleUnlockEscrowMPT: MPToken not found for " << sender;
+
+
+
+
3213 if (!sle->isFieldPresent(sfLockedAmount))
+
+
+
3216 <<
"rippleUnlockEscrowMPT: no locked amount in MPToken for "
+
3217 << to_string(sender);
+
+
+
+
3221 auto const locked = sle->getFieldU64(sfLockedAmount);
+
3222 auto const delta = grossAmount.
mpt().
value();
+
+
+
+
+
+
3228 <<
"rippleUnlockEscrowMPT: insufficient locked amount for "
+
3229 << to_string(sender) <<
": " << locked <<
" < " << delta;
+
+
+
+
3233 auto const newLocked = locked - delta;
+
+
3235 sle->makeFieldAbsent(sfLockedAmount);
+
+
3237 sle->setFieldU64(sfLockedAmount, newLocked);
+
+
+
+
+
+
+
+
+
+
+
3248 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
+
+
+
+
+
+
3254 <<
"rippleUnlockEscrowMPT: insufficient outstanding amount for "
+
3255 << mptIssue.getMptID() <<
": " << outstanding <<
" < " << diff;
+
+
-
-
-
-
-
+
3259 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - diff);
+
3260 view.
update(sleIssuance);
+
+
-
+
+
+
+
Provide a light-weight way to check active() before string formatting.
@@ -3606,7 +3612,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
AccountID const & noAccount()
A placeholder for empty accounts.
-
static bool updateTrustLine(ApplyView &view, SLE::pointer state, bool bSenderHigh, AccountID const &sender, STAmount const &before, STAmount const &after, beast::Journal j)
+
static bool updateTrustLine(ApplyView &view, SLE::pointer state, bool bSenderHigh, AccountID const &sender, STAmount const &before, STAmount const &after, beast::Journal j)
std::uint8_t constexpr maxAssetCheckDepth
Maximum recursion depth for vault shares being put as an asset inside another vault; counted from 0.
STAmount accountFunds(ReadView const &view, AccountID const &id, STAmount const &saDefault, FreezeHandling freezeHandling, beast::Journal j)
FreezeHandling
Controls the treatment of frozen account balances.
@@ -3614,19 +3620,19 @@ $(document).ready(function() { init_codefold(0); });
bool areCompatible(ReadView const &validLedger, ReadView const &testLedger, beast::Journal::Stream &s, char const *reason)
Return false if the test ledger is provably incompatible with the valid ledger, that is,...
bool isXRP(AccountID const &c)
AccountID const & xrpAccount()
Compute AccountID from public key.
-
TER rippleLockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, STAmount const &saAmount, beast::Journal j)
+
TER rippleLockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, STAmount const &saAmount, beast::Journal j)
-
std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
+
std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
bool isIndividualFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
bool canSubtract(STAmount const &amt1, STAmount const &amt2)
Determines if it is safe to subtract one STAmount from another.
-
static TER rippleSendMPT(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, STAmount &saActual, beast::Journal j, WaiveTransferFee waiveFee)
+
static TER rippleSendMPT(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, STAmount &saActual, beast::Journal j, WaiveTransferFee waiveFee)
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
bool dirNext(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
bool canAdd(STAmount const &amt1, STAmount const &amt2)
Safely checks if two STAmount values can be added without overflow, underflow, or precision loss.
bool isDeepFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
std::optional< uint256 > hashOfSeq(ReadView const &ledger, LedgerIndex seq, beast::Journal journal)
Return the hash of a ledger by sequence.
std::uint64_t constexpr maxMPTokenAmount
The maximum amount of MPTokenIssuance.
-
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
+
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
@@ -3650,40 +3656,41 @@ $(document).ready(function() { init_codefold(0); });
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
-
std::optional< STAmount > assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
+
std::optional< STAmount > assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
STAmount multiply(STAmount const &amount, Rate const &rate)
AuthHandling
Controls the treatment of unauthorized MPT balances.
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
-
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
-
TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
+
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
+
TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
@ current
This was a new validation and was added.
-
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< std::uint16_t > maxNodesToDelete=std::nullopt)
Cleanup owner directory entries on account delete.
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
@ expired
List is expired, but has the largest non-pending sequence seen so far.
std::set< uint256 > getEnabledAmendments(ReadView const &view)
-
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, AccountID const &uGranteeID, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
-
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, AccountID const &uGranteeID, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
+
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
-
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
+
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items in the given directory.
static std::uint32_t confineOwnerCount(std::uint32_t current, std::int32_t adjustment, std::optional< AccountID > const &id=std::nullopt, beast::Journal j=beast::Journal{beast::Journal::getNullSink()})
-
static TER rippleCreditIOU(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
+
static TER rippleCreditIOU(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
constexpr std::uint32_t const tfMPTUnauthorize
-
TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
+
TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
Expected< std::shared_ptr< SLE >, TER > createPseudoAccount(ApplyView &view, uint256 const &pseudoOwnerKey, SField const &ownerField)
Create pseudo-account, storing pseudoOwnerKey into ownerField.
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
bool isVaultPseudoAccountFrozen(ReadView const &view, AccountID const &account, MPTIssue const &mptShare, int depth)
-
TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
-
static TER accountSendIOU(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee)
+
TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
+
static TER accountSendIOU(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee)
std::map< uint256, NetClock::time_point > majorityAmendments_t
bool forEachItemAfter(ReadView const &view, Keylet const &root, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items after an item in the given directory.
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
-
TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
+
TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
+
@ tecNO_LINE_INSUF_RESERVE
@@ -3699,7 +3706,7 @@ $(document).ready(function() { init_codefold(0); });
-
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
+
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
TER addEmptyHolding(ApplyView &view, AccountID const &accountID, XRPAmount priorBalance, Issue const &issue, beast::Journal journal)
Any transactors that call addEmptyHolding() in doApply must call canAddHolding() in preflight with th...
AccountID pseudoAccountAddress(ReadView const &view, uint256 const &pseudoOwnerKey)
@@ -3711,30 +3718,30 @@ $(document).ready(function() { init_codefold(0); });
bool cdirFirst(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the first entry in the directory, advancing the index.
std::string to_string(base_uint< Bits, Tag > const &a)
LedgerEntryType
Identifiers for on-ledger objects.
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
-
TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+
TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
Number root(Number f, unsigned d)
TER verifyValidDomain(ApplyView &view, AccountID const &account, uint256 domainID, beast::Journal j)
-
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
-
TER enforceMPTokenAuthorization(ApplyView &view, MPTID const &mptIssuanceID, AccountID const &account, XRPAmount const &priorBalance, beast::Journal j)
Enforce account has MPToken to match its authorization.
+
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
+
TER enforceMPTokenAuthorization(ApplyView &view, MPTID const &mptIssuanceID, AccountID const &account, XRPAmount const &priorBalance, beast::Journal j)
Enforce account has MPToken to match its authorization.
TER canAddHolding(ReadView const &view, Asset const &asset)
bool cdirNext(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the next entry in the directory, advancing the index.
-
static TER rippleSendIOU(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, STAmount &saActual, beast::Journal j, WaiveTransferFee waiveFee)
+
static TER rippleSendIOU(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, STAmount &saActual, beast::Journal j, WaiveTransferFee waiveFee)
bool isAnyFrozen(ReadView const &view, std::initializer_list< AccountID > const &accounts, MPTIssue const &mptIssue, int depth=0)
std::vector< SField const * > const & getPseudoAccountFields()
-
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
+
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
TERSubset< CanCvtToTER > TER
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
-
TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
-
static TER rippleCreditMPT(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j)
+
TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
+
static TER rippleCreditMPT(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j)
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
-
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
bool isPseudoAccount(std::shared_ptr< SLE const > sleAcct)
-
static TER accountSendMPT(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee)
+
static TER accountSendMPT(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee)
TER dirLink(ApplyView &view, AccountID const &owner, std::shared_ptr< SLE > &object)
Rate const parityRate
A transfer rate signifying a 1:1 exchange.
XRPAmount xrpLiquid(ReadView const &view, AccountID const &id, std::int32_t ownerCountAdj, beast::Journal j)
diff --git a/View_8h_source.html b/View_8h_source.html
index 06a3bd37fa..29fdc786d7 100644
--- a/View_8h_source.html
+++ b/View_8h_source.html
@@ -897,56 +897,56 @@ $(document).ready(function() { init_codefold(0); });
bool areCompatible(ReadView const &validLedger, ReadView const &testLedger, beast::Journal::Stream &s, char const *reason)
Return false if the test ledger is provably incompatible with the valid ledger, that is,...
-
TER rippleLockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, STAmount const &saAmount, beast::Journal j)
+
TER rippleLockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, STAmount const &saAmount, beast::Journal j)
LedgerIndex getCandidateLedger(LedgerIndex requested)
Find a ledger index from which we could easily get the requested ledger.
-
std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
+
std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
bool isIndividualFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
bool dirNext(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
bool isDeepFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
std::optional< uint256 > hashOfSeq(ReadView const &ledger, LedgerIndex seq, beast::Journal journal)
Return the hash of a ledger by sequence.
-
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
+
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
base_uint< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
-
std::optional< STAmount > assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
+
std::optional< STAmount > assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
AuthHandling
Controls the treatment of unauthorized MPT balances.
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
-
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
-
TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
-
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate=TruncateShares::no)
+
TER transferXRP(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &amount, beast::Journal j)
+
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< std::uint16_t > maxNodesToDelete=std::nullopt)
Cleanup owner directory entries on account delete.
bool isFrozen(ReadView const &view, AccountID const &account, Currency const ¤cy, AccountID const &issuer)
std::set< uint256 > getEnabledAmendments(ReadView const &view)
-
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, AccountID const &uGranteeID, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
-
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
+
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &uGrantorID, AccountID const &uGranteeID, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
+
TER requireAuth(ReadView const &view, Issue const &issue, AccountID const &account, AuthType authType=AuthType::Legacy)
Check if the account lacks required authorization.
-
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
+
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items in the given directory.
base_uint< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
-
TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
+
TER canTransfer(ReadView const &view, MPTIssue const &mptIssue, AccountID const &from, AccountID const &to)
Check if the destination account is allowed to receive MPT.
Expected< std::shared_ptr< SLE >, TER > createPseudoAccount(ApplyView &view, uint256 const &pseudoOwnerKey, SField const &ownerField)
Create pseudo-account, storing pseudoOwnerKey into ownerField.
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
bool isVaultPseudoAccountFrozen(ReadView const &view, AccountID const &account, MPTIssue const &mptShare, int depth)
-
TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
+
TER issueIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
bool forEachItemAfter(ReadView const &view, Keylet const &root, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items after an item in the given directory.
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
-
TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
+
TER trustDelete(ApplyView &view, std::shared_ptr< SLE > const &sleRippleState, AccountID const &uLowAccountID, AccountID const &uHighAccountID, beast::Journal j)
-
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
+
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
TER addEmptyHolding(ApplyView &view, AccountID const &accountID, XRPAmount priorBalance, Issue const &issue, beast::Journal journal)
Any transactors that call addEmptyHolding() in doApply must call canAddHolding() in preflight with th...
AccountID pseudoAccountAddress(ReadView const &view, uint256 const &pseudoOwnerKey)
@@ -955,21 +955,21 @@ $(document).ready(function() { init_codefold(0); });
majorityAmendments_t getMajorityAmendments(ReadView const &view)
bool cdirFirst(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the first entry in the directory, advancing the index.
LedgerEntryType
Identifiers for on-ledger objects.
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
-
TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
+
TER trustCreate(ApplyView &view, bool const bSrcHigh, AccountID const &uSrcAccountID, AccountID const &uDstAccountID, uint256 const &uIndex, SLE::ref sleAccount, bool const bAuth, bool const bNoRipple, bool const bFreeze, bool bDeepFreeze, STAmount const &saBalance, STAmount const &saLimit, std::uint32_t uSrcQualityIn, std::uint32_t uSrcQualityOut, beast::Journal j)
Create a trust line.
Number root(Number f, unsigned d)
-
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
-
TER enforceMPTokenAuthorization(ApplyView &view, MPTID const &mptIssuanceID, AccountID const &account, XRPAmount const &priorBalance, beast::Journal j)
Enforce account has MPToken to match its authorization.
+
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
+
TER enforceMPTokenAuthorization(ApplyView &view, MPTID const &mptIssuanceID, AccountID const &account, XRPAmount const &priorBalance, beast::Journal j)
Enforce account has MPToken to match its authorization.
TER canAddHolding(ReadView const &view, Asset const &asset)
bool cdirNext(ReadView const &view, uint256 const &root, std::shared_ptr< SLE const > &page, unsigned int &index, uint256 &entry)
Returns the next entry in the directory, advancing the index.
bool isAnyFrozen(ReadView const &view, std::initializer_list< AccountID > const &accounts, MPTIssue const &mptIssue, int depth=0)
std::vector< SField const * > const & getPseudoAccountFields()
-
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
+
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags=0, std::optional< AccountID > holderID=std::nullopt)
TERSubset< CanCvtToTER > TER
-
TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
-
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
+
TER removeEmptyHolding(ApplyView &view, AccountID const &accountID, Issue const &issue, beast::Journal journal)
+
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
bool isPseudoAccount(std::shared_ptr< SLE const > sleAcct)
TER dirLink(ApplyView &view, AccountID const &owner, std::shared_ptr< SLE > &object)
XRPAmount xrpLiquid(ReadView const &view, AccountID const &id, std::int32_t ownerCountAdj, beast::Journal j)
diff --git a/XRPEndpointStep_8cpp_source.html b/XRPEndpointStep_8cpp_source.html
index 972c82b026..1dec98a6d0 100644
--- a/XRPEndpointStep_8cpp_source.html
+++ b/XRPEndpointStep_8cpp_source.html
@@ -632,7 +632,7 @@ $(document).ready(function() { init_codefold(0); });
TER checkFreeze(ReadView const &view, AccountID const &src, AccountID const &dst, Currency const ¤cy)
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
-
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
+
TER accountSend(ApplyView &view, AccountID const &from, AccountID const &to, STAmount const &saAmount, beast::Journal j, WaiveTransferFee waiveFee=WaiveTransferFee::No)
Calls static accountSendIOU if saAmount represents Issue.
diff --git a/classripple_1_1VaultWithdraw.html b/classripple_1_1VaultWithdraw.html
index 6bb1501c81..1e51def6b6 100644
--- a/classripple_1_1VaultWithdraw.html
+++ b/classripple_1_1VaultWithdraw.html
@@ -470,7 +470,7 @@ Static Private Member Functions
@@ -499,7 +499,7 @@ Static Private Member Functions
Implements ripple::Transactor.
-
Definition at line 165 of file VaultWithdraw.cpp.
+
Definition at line 150 of file VaultWithdraw.cpp.
diff --git a/classripple_1_1Vault__test.html b/classripple_1_1Vault__test.html
index 0382555a0e..250f833566 100644
--- a/classripple_1_1Vault__test.html
+++ b/classripple_1_1Vault__test.html
@@ -381,7 +381,7 @@ Static Private Attributes
@@ -408,7 +408,7 @@ Static Private Attributes
@@ -435,7 +435,7 @@ Static Private Attributes
@@ -462,7 +462,7 @@ Static Private Attributes
@@ -489,7 +489,7 @@ Static Private Attributes
@@ -516,7 +516,7 @@ Static Private Attributes
@@ -543,7 +543,7 @@ Static Private Attributes
@@ -570,7 +570,7 @@ Static Private Attributes
@@ -597,7 +597,7 @@ Static Private Attributes
@@ -624,7 +624,7 @@ Static Private Attributes
@@ -651,7 +651,7 @@ Static Private Attributes
@@ -678,7 +678,7 @@ Static Private Attributes
@@ -709,7 +709,7 @@ Static Private Attributes
Implements beast::unit_test::suite.
-
Definition at line 4590 of file Vault_test.cpp.
+
Definition at line 4800 of file Vault_test.cpp.
diff --git a/namespaceripple.html b/namespaceripple.html
index 5b87b48b4b..5655b715fb 100644
--- a/namespaceripple.html
+++ b/namespaceripple.html
@@ -16909,7 +16909,7 @@ template<class T >
@@ -17017,7 +17017,7 @@ template<class T >
@@ -17128,7 +17128,7 @@ template<class T >
Create a trust line.
This can set an initial balance.
-Definition at line 1392 of file View.cpp.
+Definition at line 1398 of file View.cpp.
@@ -17170,7 +17170,7 @@ template<class T >
@@ -17212,7 +17212,7 @@ template<class T >
@@ -17302,7 +17302,7 @@ template<class T >
@@ -17341,7 +17341,7 @@ template<class T >
Delete an offer.
Requirements: The passed sle be obtained from a prior call to view.peek()
-Definition at line 1641 of file View.cpp.
+Definition at line 1647 of file View.cpp.
@@ -17398,7 +17398,7 @@ template<class T >
Calls static rippleCreditIOU if saAmount represents Issue.
Calls static rippleCreditMPT if saAmount represents MPTIssue.
-Definition at line 2850 of file View.cpp.
+Definition at line 2856 of file View.cpp.
@@ -17440,7 +17440,7 @@ template<class T >
@@ -17494,7 +17494,7 @@ template<class T >
@@ -17551,7 +17551,7 @@ template<class T >
Calls static accountSendIOU if saAmount represents Issue.
Calls static accountSendMPT if saAmount represents MPTIssue.
-Definition at line 2185 of file View.cpp.
+Definition at line 2191 of file View.cpp.
@@ -17599,7 +17599,7 @@ template<class T >
@@ -17647,7 +17647,7 @@ template<class T >
@@ -17695,7 +17695,7 @@ template<class T >
@@ -17743,7 +17743,7 @@ template<class T >
If WeakAuth then return tecNO_AUTH if lsfRequireAuth is set, and the RippleState exists, and is not authorized. Return tecNO_LINE if lsfRequireAuth is set and the RippleState doesn't exist. Consequently, if WeakAuth and lsfRequireAuth is not set, this function will return tesSUCCESS even if RippleState does not exist.
The default "Legacy" auth type is equivalent to WeakAuth.
-Definition at line 2479 of file View.cpp.
+Definition at line 2485 of file View.cpp.
@@ -17798,7 +17798,7 @@ template<class T >
If WeakAuth then return tecNO_AUTH if lsfMPTRequireAuth is set and MPToken doesn't exist or is not authorized (explicitly or via credentials, if DomainID is set in MPTokenIssuance). Consequently, if WeakAuth and lsfMPTRequireAuth is not set, this function will return true even if MPToken does not exist.
The default "Legacy" auth type is equivalent to StrongAuth.
-Definition at line 2511 of file View.cpp.
+Definition at line 2517 of file View.cpp.
@@ -17895,7 +17895,7 @@ template<class T >
The caller does NOT need to look for existing MPToken to match mptIssue/account - this function checks lsfMPTAuthorized of an existing MPToken iff DomainID is not set.
Do not use for accounts which hold implied permission e.g. object owners or if MPTokenIssuance does not require authorization. In both cases use MPTokenAuthorize::authorize if MPToken does not yet exist.
-Definition at line 2597 of file View.cpp.
+Definition at line 2603 of file View.cpp.
@@ -17940,7 +17940,7 @@ template<class T >
Check if the destination account is allowed to receive MPT.
Return tecNO_AUTH if it doesn't and tesSUCCESS otherwise.
-Definition at line 2698 of file View.cpp.
+Definition at line 2704 of file View.cpp.
@@ -18034,7 +18034,7 @@ template<class T >
Delete trustline to AMM.
The passed sle must be obtained from a prior call to view.peek(). Fail if neither side of the trustline is AMM or if ammAccountID is seated and is not one of the trustline's side.
-Definition at line 2800 of file View.cpp.
+Definition at line 2806 of file View.cpp.
@@ -18070,7 +18070,7 @@ template<class T >
@@ -18106,7 +18106,7 @@ template<class T >
@@ -18148,7 +18148,7 @@ template<class T >
@@ -18184,7 +18184,7 @@ template<class T >
@@ -18224,7 +18224,7 @@ template<class T >
- Returns
- true if now refers to a time strictly after mark, else false.
-Definition at line 3260 of file View.cpp.
+Definition at line 3266 of file View.cpp.
@@ -26818,7 +26818,7 @@ template<class Handler >
@@ -26886,7 +26886,7 @@ template<class Handler >
@@ -26948,7 +26948,7 @@ template<class Handler >
@@ -27004,7 +27004,7 @@ template<class Handler >
@@ -27072,7 +27072,7 @@ template<class Handler >
@@ -27134,7 +27134,7 @@ template<class Handler >
@@ -27202,7 +27202,7 @@ template<class Handler >
@@ -27250,7 +27250,7 @@ template<class Handler >