diff --git a/Batch__test_8cpp_source.html b/Batch__test_8cpp_source.html
index b5c90cb843..dee0133c0d 100644
--- a/Batch__test_8cpp_source.html
+++ b/Batch__test_8cpp_source.html
@@ -4329,7 +4329,7 @@ $(function() {
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
-
+
void create(MPTCreate const &arg=MPTCreate{})
Adds a new Batch Txn on a JTx and autofills.
Set a batch nested multi-signature on a JTx.
diff --git a/BookChanges__test_8cpp_source.html b/BookChanges__test_8cpp_source.html
index 3073cb3254..89799c5bce 100644
--- a/BookChanges__test_8cpp_source.html
+++ b/BookChanges__test_8cpp_source.html
@@ -242,7 +242,7 @@ $(function() {
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
-
+
Sets the SendMax on a JTx.
diff --git a/Book__test_8cpp_source.html b/Book__test_8cpp_source.html
index 2620464b0a..769f96e685 100644
--- a/Book__test_8cpp_source.html
+++ b/Book__test_8cpp_source.html
@@ -2142,13 +2142,13 @@ $(function() {
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
-
-
-
-
-
-
-
+
+
+
+
+
+
+
Match the number of items in the account's owner directory.
Check a set of conditions.
diff --git a/Delegate__test_8cpp_source.html b/Delegate__test_8cpp_source.html
index dfe37a68e3..dd318e5daa 100644
--- a/Delegate__test_8cpp_source.html
+++ b/Delegate__test_8cpp_source.html
@@ -1613,7 +1613,7 @@ $(function() {
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
-
+
Sets the optional URI on a DIDSet.
diff --git a/EscrowToken__test_8cpp_source.html b/EscrowToken__test_8cpp_source.html
index 8ddab4f40d..562c8ca258 100644
--- a/EscrowToken__test_8cpp_source.html
+++ b/EscrowToken__test_8cpp_source.html
@@ -3993,7 +3993,7 @@ $(function() {
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
Converts to IOU Issue or STAmount.
-
+
void create(MPTCreate const &arg=MPTCreate{})
Converts to MPT Issue or STAmount.
ripple::MPTID const & mpt() const
diff --git a/LedgerEntry__test_8cpp_source.html b/LedgerEntry__test_8cpp_source.html
index bbcbb9726d..267d9856a8 100644
--- a/LedgerEntry__test_8cpp_source.html
+++ b/LedgerEntry__test_8cpp_source.html
@@ -2852,7 +2852,7 @@ $(function() {
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
-
+
void create(MPTCreate const &arg=MPTCreate{})
Oracle class facilitates unit-testing of the Price Oracle feature.
diff --git a/MPToken__test_8cpp_source.html b/MPToken__test_8cpp_source.html
index 57e2a7703c..76800a0ddf 100644
--- a/MPToken__test_8cpp_source.html
+++ b/MPToken__test_8cpp_source.html
@@ -2473,10 +2473,10 @@ $(function() {
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
-
+
void authorize(MPTAuthorize const &arg=MPTAuthorize{})
void set(MPTSet const &set={})
-MPTID const & issuanceID() const
+MPTID const & issuanceID() const
void create(MPTCreate const &arg=MPTCreate{})
void destroy(MPTDestroy const &arg=MPTDestroy{})
Converts to MPT Issue or STAmount.
diff --git a/PermissionedDEX__test_8cpp_source.html b/PermissionedDEX__test_8cpp_source.html
index 9288f4947b..476fb6ccc2 100644
--- a/PermissionedDEX__test_8cpp_source.html
+++ b/PermissionedDEX__test_8cpp_source.html
@@ -1709,7 +1709,7 @@ $(function() {
void enableFeature(uint256 const feature)
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
-
+
diff --git a/Subscribe__test_8cpp_source.html b/Subscribe__test_8cpp_source.html
index eaa47881cf..fa945de78a 100644
--- a/Subscribe__test_8cpp_source.html
+++ b/Subscribe__test_8cpp_source.html
@@ -1718,13 +1718,13 @@ $(function() {
Env & apply(JsonValue &&jv, FN const &... fN)
Apply funclets and submit.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
void memoize(Account const &account)
Associate AccountID with account.
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/Vault__test_8cpp_source.html b/Vault__test_8cpp_source.html
index 48cffb41b1..d3a59ec658 100644
--- a/Vault__test_8cpp_source.html
+++ b/Vault__test_8cpp_source.html
@@ -95,3153 +95,3143 @@ $(function() {
- 20#include <test/jtx/AMM.h>
+
21#include <test/jtx/AMMTest.h>
- 22#include <test/jtx/Account.h>
- 23#include <test/jtx/Env.h>
- 24#include <test/jtx/amount.h>
- 25#include <test/jtx/credentials.h>
- 26#include <test/jtx/fee.h>
- 27#include <test/jtx/flags.h>
- 28#include <test/jtx/mpt.h>
- 29#include <test/jtx/permissioned_domains.h>
- 30#include <test/jtx/utility.h>
- 31#include <test/jtx/vault.h>
-
- 33#include <xrpld/ledger/View.h>
-
- 35#include <xrpl/basics/base_uint.h>
- 36#include <xrpl/beast/unit_test/suite.h>
- 37#include <xrpl/json/json_forwards.h>
- 38#include <xrpl/json/json_value.h>
- 39#include <xrpl/protocol/AccountID.h>
- 40#include <xrpl/protocol/Asset.h>
- 41#include <xrpl/protocol/Feature.h>
- 42#include <xrpl/protocol/Indexes.h>
- 43#include <xrpl/protocol/Issue.h>
- 44#include <xrpl/protocol/MPTIssue.h>
- 45#include <xrpl/protocol/Protocol.h>
- 46#include <xrpl/protocol/SField.h>
- 47#include <xrpl/protocol/STAmount.h>
- 48#include <xrpl/protocol/STNumber.h>
- 49#include <xrpl/protocol/TER.h>
- 50#include <xrpl/protocol/TxFlags.h>
- 51#include <xrpl/protocol/XRPAmount.h>
- 52#include <xrpl/protocol/jss.h>
-
-
+
+ 23#include <xrpld/ledger/View.h>
+
+ 25#include <xrpl/basics/base_uint.h>
+ 26#include <xrpl/beast/unit_test/suite.h>
+ 27#include <xrpl/json/json_forwards.h>
+ 28#include <xrpl/json/json_value.h>
+ 29#include <xrpl/protocol/AccountID.h>
+ 30#include <xrpl/protocol/Asset.h>
+ 31#include <xrpl/protocol/Feature.h>
+ 32#include <xrpl/protocol/Indexes.h>
+ 33#include <xrpl/protocol/Issue.h>
+ 34#include <xrpl/protocol/MPTIssue.h>
+ 35#include <xrpl/protocol/Protocol.h>
+ 36#include <xrpl/protocol/SField.h>
+ 37#include <xrpl/protocol/STAmount.h>
+ 38#include <xrpl/protocol/STNumber.h>
+ 39#include <xrpl/protocol/TER.h>
+ 40#include <xrpl/protocol/TxFlags.h>
+ 41#include <xrpl/protocol/XRPAmount.h>
+ 42#include <xrpl/protocol/jss.h>
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+ 59 using namespace test::jtx;
-
-
-
-
-
-
-
-
- 69 using namespace test::jtx;
-
- 71 auto const testSequence = [
this](
-
-
- 74 Account
const& issuer,
-
- 76 Account
const& depositor,
- 77 Account
const& charlie,
-
-
- 80 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
- 81 tx[sfData] =
"AFEED00E";
- 82 tx[sfAssetsMaximum] = asset(100).number();
-
-
- 85 BEAST_EXPECT(env.le(keylet));
-
- 87 auto const share = [&env, keylet = keylet,
this]() ->
PrettyAsset {
- 88 auto const vault = env.le(keylet);
- 89 BEAST_EXPECT(vault !=
nullptr);
- 90 return MPTIssue(vault->at(sfShareMPTID));
-
-
-
- 94 Account alice{
"alice"};
-
-
- 97 env.fund(XRP(1000), alice, dave, erin);
-
-
-
-
-
- 103 testcase(prefix +
" fail to deposit more than assets held");
- 104 auto tx = vault.deposit(
- 105 {.depositor = depositor,
-
- 107 .amount = asset(10000)});
-
-
-
-
- 112 testcase(prefix +
" deposit non-zero amount");
- 113 auto tx = vault.deposit(
- 114 {.depositor = depositor,
-
- 116 .amount = asset(50)});
-
-
-
-
- 121 testcase(prefix +
" deposit non-zero amount again");
- 122 auto tx = vault.deposit(
- 123 {.depositor = depositor,
-
- 125 .amount = asset(50)});
-
-
-
-
- 130 testcase(prefix +
" fail to delete non-empty vault");
- 131 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
- 136 testcase(prefix +
" fail to update because wrong owner");
- 137 auto tx = vault.set({.owner = issuer, .id = keylet.
key});
- 138 tx[sfAssetsMaximum] = asset(50).number();
-
-
-
-
-
- 144 prefix +
" fail to set maximum lower than current amount");
- 145 auto tx = vault.set({.owner = owner, .id = keylet.
key});
- 146 tx[sfAssetsMaximum] = asset(50).number();
-
-
-
-
- 151 testcase(prefix +
" set maximum higher than current amount");
- 152 auto tx = vault.set({.owner = owner, .id = keylet.
key});
- 153 tx[sfAssetsMaximum] = asset(150).number();
-
-
-
-
-
- 159 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 165 testcase(prefix +
" fail to set domain on public vault");
- 166 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 172 testcase(prefix +
" fail to deposit more than maximum");
- 173 auto tx = vault.deposit(
- 174 {.depositor = depositor,
-
- 176 .amount = asset(100)});
-
-
-
-
- 181 testcase(prefix +
" reset maximum to zero i.e. not enforced");
- 182 auto tx = vault.set({.owner = owner, .id = keylet.
key});
- 183 tx[sfAssetsMaximum] = asset(0).number();
-
-
-
-
- 188 testcase(prefix +
" fail to withdraw more than assets held");
- 189 auto tx = vault.withdraw(
- 190 {.depositor = depositor,
-
- 192 .amount = asset(1000)});
-
-
-
-
- 197 testcase(prefix +
" deposit some more");
- 198 auto tx = vault.deposit(
- 199 {.depositor = depositor,
-
- 201 .amount = asset(100)});
-
-
-
-
- 206 testcase(prefix +
" clawback some");
-
-
- 209 auto tx = vault.clawback(
-
-
-
- 213 .amount = asset(10)});
-
-
-
+ 61 auto const testSequence = [
this](
+
+
+ 64 Account
const& issuer,
+
+ 66 Account
const& depositor,
+ 67 Account
const& charlie,
+
+
+ 70 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+ 71 tx[sfData] =
"AFEED00E";
+ 72 tx[sfAssetsMaximum] = asset(100).number();
+
+
+ 75 BEAST_EXPECT(env.le(keylet));
+
+ 77 auto const share = [&env, keylet = keylet,
this]() ->
PrettyAsset {
+ 78 auto const vault = env.le(keylet);
+ 79 BEAST_EXPECT(vault !=
nullptr);
+ 80 return MPTIssue(vault->at(sfShareMPTID));
+
+
+
+ 84 Account alice{
"alice"};
+
+
+ 87 env.fund(XRP(1000), alice, dave, erin);
+
+
+
+
+
+ 93 testcase(prefix +
" fail to deposit more than assets held");
+ 94 auto tx = vault.deposit(
+ 95 {.depositor = depositor,
+
+ 97 .amount = asset(10000)});
+
+
+
+
+ 102 testcase(prefix +
" deposit non-zero amount");
+ 103 auto tx = vault.deposit(
+ 104 {.depositor = depositor,
+
+ 106 .amount = asset(50)});
+
+
+
+
+ 111 testcase(prefix +
" deposit non-zero amount again");
+ 112 auto tx = vault.deposit(
+ 113 {.depositor = depositor,
+
+ 115 .amount = asset(50)});
+
+
+
+
+ 120 testcase(prefix +
" fail to delete non-empty vault");
+ 121 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+ 126 testcase(prefix +
" fail to update because wrong owner");
+ 127 auto tx = vault.set({.owner = issuer, .id = keylet.
key});
+ 128 tx[sfAssetsMaximum] = asset(50).number();
+
+
+
+
+
+ 134 prefix +
" fail to set maximum lower than current amount");
+ 135 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+ 136 tx[sfAssetsMaximum] = asset(50).number();
+
+
+
+
+ 141 testcase(prefix +
" set maximum higher than current amount");
+ 142 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+ 143 tx[sfAssetsMaximum] = asset(150).number();
+
+
+
+
+
+ 149 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 155 testcase(prefix +
" fail to set domain on public vault");
+ 156 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 162 testcase(prefix +
" fail to deposit more than maximum");
+ 163 auto tx = vault.deposit(
+ 164 {.depositor = depositor,
+
+ 166 .amount = asset(100)});
+
+
+
+
+ 171 testcase(prefix +
" reset maximum to zero i.e. not enforced");
+ 172 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+ 173 tx[sfAssetsMaximum] = asset(0).number();
+
+
+
+
+ 178 testcase(prefix +
" fail to withdraw more than assets held");
+ 179 auto tx = vault.withdraw(
+ 180 {.depositor = depositor,
+
+ 182 .amount = asset(1000)});
+
+
+
+
+ 187 testcase(prefix +
" deposit some more");
+ 188 auto tx = vault.deposit(
+ 189 {.depositor = depositor,
+
+ 191 .amount = asset(100)});
+
+
+
+
+ 196 testcase(prefix +
" clawback some");
+
+
+ 199 auto tx = vault.clawback(
+
+
+
+ 203 .amount = asset(10)});
+
+
+
+
+
+
+
+ 211 auto tx = vault.clawback(
+ 212 {.issuer = issuer, .id = keylet.
key, .holder = depositor});
+
+
+
+ 216 if (!asset.raw().native())
-
-
-
- 221 auto tx = vault.clawback(
- 222 {.issuer = issuer, .id = keylet.
key, .holder = depositor});
-
+ 218 testcase(prefix +
" deposit again");
+ 219 auto tx = vault.deposit(
+ 220 {.depositor = depositor,
+
+ 222 .amount = asset(200)});
+
- 226 if (!asset.raw().native())
-
- 228 testcase(prefix +
" deposit again");
- 229 auto tx = vault.deposit(
+
+
+ 228 prefix +
" fail to withdraw to 3rd party lsfDepositAuth");
+ 229 auto tx = vault.withdraw(
230 {.depositor = depositor,
- 232 .amount = asset(200)});
-
-
-
-
-
- 238 prefix +
" fail to withdraw to 3rd party lsfDepositAuth");
- 239 auto tx = vault.withdraw(
- 240 {.depositor = depositor,
-
- 242 .amount = asset(100)});
- 243 tx[sfDestination] = alice.human();
-
-
-
- 247 if (!asset.raw().native())
-
-
- 250 prefix +
" fail to withdraw to 3rd party no authorization");
- 251 auto tx = vault.withdraw(
- 252 {.depositor = depositor,
-
- 254 .amount = asset(100)});
- 255 tx[sfDestination] = erin.human();
-
-
-
-
- 260 if (!asset.raw().native() && asset.raw().holds<
Issue>())
-
- 262 testcase(prefix +
" temporary authorization for 3rd party");
- 263 env(trust(erin, asset(1000)));
- 264 env(trust(issuer, asset(0), erin,
tfSetfAuth));
- 265 env(pay(issuer, erin, asset(10)));
-
-
- 268 auto tx = vault.deposit(
- 269 {.depositor = erin, .id = keylet.
key, .amount = asset(10)});
+ 232 .amount = asset(100)});
+ 233 tx[sfDestination] = alice.human();
+
+
+
+ 237 if (!asset.raw().native())
+
+
+ 240 prefix +
" fail to withdraw to 3rd party no authorization");
+ 241 auto tx = vault.withdraw(
+ 242 {.depositor = depositor,
+
+ 244 .amount = asset(100)});
+ 245 tx[sfDestination] = erin.human();
+
+
+
+
+ 250 if (!asset.raw().native() && asset.raw().holds<
Issue>())
+
+ 252 testcase(prefix +
" temporary authorization for 3rd party");
+ 253 env(trust(erin, asset(1000)));
+ 254 env(trust(issuer, asset(0), erin,
tfSetfAuth));
+ 255 env(pay(issuer, erin, asset(10)));
+
+
+ 258 auto tx = vault.deposit(
+ 259 {.depositor = erin, .id = keylet.
key, .amount = asset(10)});
+
+ 261 env(pay(erin, depositor, share(10)));
+
+ 263 testcase(prefix +
" withdraw to authorized 3rd party");
+
+
+ 266 {.depositor = depositor,
+
+ 268 .amount = asset(10)});
+ 269 tx[sfDestination] = erin.human();
- 271 env(pay(erin, depositor, share(10)));
-
- 273 testcase(prefix +
" withdraw to authorized 3rd party");
-
-
- 276 {.depositor = depositor,
-
- 278 .amount = asset(10)});
- 279 tx[sfDestination] = erin.human();
-
-
- 282 env(pay(erin, issuer, asset(10)));
-
- 284 testcase(prefix +
" fail to pay to unauthorized 3rd party");
- 285 env(trust(erin, asset(0)));
-
- 287 env(pay(depositor, erin, share(1)), ter{
tecNO_LINE});
-
-
-
-
-
- 293 " fail to withdraw to 3rd party lsfRequireDestTag");
+
+ 272 env(pay(erin, issuer, asset(10)));
+
+ 274 testcase(prefix +
" fail to pay to unauthorized 3rd party");
+ 275 env(trust(erin, asset(0)));
+
+ 277 env(pay(depositor, erin, share(1)), ter{
tecNO_LINE});
+
+
+
+
+
+ 283 " fail to withdraw to 3rd party lsfRequireDestTag");
+ 284 auto tx = vault.withdraw(
+ 285 {.depositor = depositor,
+
+ 287 .amount = asset(100)});
+ 288 tx[sfDestination] = dave.human();
+
+
+
+
+ 293 testcase(prefix +
" withdraw to authorized 3rd party");
294 auto tx = vault.withdraw(
295 {.depositor = depositor,
297 .amount = asset(100)});
- 298 tx[sfDestination] = dave.human();
-
+ 298 tx[sfDestination] = charlie.human();
+
- 303 testcase(prefix +
" withdraw to authorized 3rd party");
+ 303 testcase(prefix +
" withdraw to issuer");
304 auto tx = vault.withdraw(
305 {.depositor = depositor,
- 307 .amount = asset(100)});
- 308 tx[sfDestination] = charlie.human();
+ 307 .amount = asset(50)});
+ 308 tx[sfDestination] = issuer.human();
- 313 testcase(prefix +
" withdraw to issuer");
+ 313 testcase(prefix +
" withdraw remaining assets");
314 auto tx = vault.withdraw(
315 {.depositor = depositor,
317 .amount = asset(50)});
- 318 tx[sfDestination] = issuer.human();
-
-
-
-
- 323 testcase(prefix +
" withdraw remaining assets");
- 324 auto tx = vault.withdraw(
- 325 {.depositor = depositor,
-
- 327 .amount = asset(50)});
-
-
-
-
- 332 testcase(prefix +
" fail to delete because wrong owner");
- 333 auto tx = vault.del({.owner = issuer, .id = keylet.
key});
-
-
-
-
- 338 testcase(prefix +
" delete empty vault");
- 339 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
- 341 BEAST_EXPECT(!env.le(keylet));
-
-
-
- 345 auto testCases = [
this, &testSequence](
-
-
-
- 349 Account
const& issuer,
- 350 Account
const& owner,
- 351 Account
const& depositor,
- 352 Account
const& charlie)> setup) {
- 353 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 354 Account issuer{
"issuer"};
- 355 Account owner{
"owner"};
- 356 Account depositor{
"depositor"};
- 357 Account charlie{
"charlie"};
-
- 359 env.fund(XRP(1000), issuer, owner, depositor, charlie);
-
-
-
-
-
-
-
- 367 PrettyAsset asset = setup(env, issuer, owner, depositor, charlie);
-
- 369 prefix, env, issuer, owner, depositor, charlie, vault, asset);
-
+
+
+
+
+ 322 testcase(prefix +
" fail to delete because wrong owner");
+ 323 auto tx = vault.del({.owner = issuer, .id = keylet.
key});
+
+
+
+
+ 328 testcase(prefix +
" delete empty vault");
+ 329 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+ 331 BEAST_EXPECT(!env.le(keylet));
+
+
+
+ 335 auto testCases = [
this, &testSequence](
+
+
+
+ 339 Account
const& issuer,
+ 340 Account
const& owner,
+ 341 Account
const& depositor,
+ 342 Account
const& charlie)> setup) {
+ 343 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 344 Account issuer{
"issuer"};
+ 345 Account owner{
"owner"};
+ 346 Account depositor{
"depositor"};
+ 347 Account charlie{
"charlie"};
+
+ 349 env.fund(XRP(1000), issuer, owner, depositor, charlie);
+
+
+
+
+
+
+
+ 357 PrettyAsset asset = setup(env, issuer, owner, depositor, charlie);
+
+ 359 prefix, env, issuer, owner, depositor, charlie, vault, asset);
+
+
+
+
+
+ 365 Account
const& issuer,
+ 366 Account
const& owner,
+ 367 Account
const& depositor,
+
+
+
-
+
375 Account
const& issuer,
376 Account
const& owner,
377 Account
const& depositor,
-
-
-
-
-
-
-
- 385 Account
const& issuer,
- 386 Account
const& owner,
- 387 Account
const& depositor,
- 388 Account
const& charlie) ->
Asset {
-
- 390 env(trust(owner, asset(1000)));
- 391 env(trust(depositor, asset(1000)));
- 392 env(trust(charlie, asset(1000)));
- 393 env(trust(issuer, asset(0), owner,
tfSetfAuth));
- 394 env(trust(issuer, asset(0), depositor,
tfSetfAuth));
- 395 env(trust(issuer, asset(0), charlie,
tfSetfAuth));
- 396 env(pay(issuer, depositor, asset(1000)));
-
-
-
-
-
-
-
- 404 Account
const& issuer,
- 405 Account
const& owner,
- 406 Account
const& depositor,
- 407 Account
const& charlie) ->
Asset {
- 408 MPTTester mptt{env, issuer, mptInitNoFund};
-
-
-
-
- 413 mptt.authorize({.account = depositor});
- 414 mptt.authorize({.account = charlie});
- 415 env(pay(issuer, depositor, asset(1000)));
-
-
-
-
-
-
-
-
- 424 using namespace test::jtx;
-
-
-
-
- 429 supported_amendments() | featureSingleAssetVault;
-
-
- 432 auto testCase = [&,
this](
-
-
- 435 Account
const& issuer,
- 436 Account
const& owner,
-
-
- 439 CaseArgs args = {}) {
- 440 Env env{*
this, args.features};
- 441 Account issuer{
"issuer"};
- 442 Account owner{
"owner"};
-
- 444 env.fund(XRP(1000), issuer, owner);
+ 378 Account
const& charlie) ->
Asset {
+
+ 380 env(trust(owner, asset(1000)));
+ 381 env(trust(depositor, asset(1000)));
+ 382 env(trust(charlie, asset(1000)));
+ 383 env(trust(issuer, asset(0), owner,
tfSetfAuth));
+ 384 env(trust(issuer, asset(0), depositor,
tfSetfAuth));
+ 385 env(trust(issuer, asset(0), charlie,
tfSetfAuth));
+ 386 env(pay(issuer, depositor, asset(1000)));
+
+
+
+
+
+
+
+ 394 Account
const& issuer,
+ 395 Account
const& owner,
+ 396 Account
const& depositor,
+ 397 Account
const& charlie) ->
Asset {
+ 398 MPTTester mptt{env, issuer, mptInitNoFund};
+
+
+
+
+ 403 mptt.authorize({.account = depositor});
+ 404 mptt.authorize({.account = charlie});
+ 405 env(pay(issuer, depositor, asset(1000)));
+
+
+
+
+
+
+
+
+ 414 using namespace test::jtx;
+
+
+
+
+ 419 supported_amendments() | featureSingleAssetVault;
+
+
+ 422 auto testCase = [&,
this](
+
+
+ 425 Account
const& issuer,
+ 426 Account
const& owner,
+
+
+ 429 CaseArgs args = {}) {
+ 430 Env env{*
this, args.features};
+ 431 Account issuer{
"issuer"};
+ 432 Account owner{
"owner"};
+
+ 434 env.fund(XRP(1000), issuer, owner);
+
+
+
+
+
+
+
+ 442 env(trust(owner, asset(1000)));
+ 443 env(trust(issuer, asset(0), owner,
tfSetfAuth));
+ 444 env(pay(issuer, owner, asset(1000)));
-
-
-
-
-
- 452 env(trust(owner, asset(1000)));
- 453 env(trust(issuer, asset(0), owner,
tfSetfAuth));
- 454 env(pay(issuer, owner, asset(1000)));
-
-
- 457 test(env, issuer, owner, asset, vault);
-
-
-
-
- 462 Account
const& issuer,
- 463 Account
const& owner,
-
-
- 466 testcase(
"disabled single asset vault");
-
-
- 469 vault.create({.owner = owner, .asset = asset});
-
-
-
- 473 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
- 478 auto tx = vault.deposit(
-
-
- 481 .amount = asset(10)});
-
-
-
-
- 486 auto tx = vault.withdraw(
-
-
- 489 .amount = asset(10)});
-
-
-
-
- 494 auto tx = vault.clawback(
-
-
-
- 498 .amount = asset(10)});
-
-
-
-
- 503 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
- 507 {.features = supported_amendments() - featureSingleAssetVault});
-
- 509 testCase([&](Env& env,
- 510 Account
const& issuer,
- 511 Account
const& owner,
-
-
-
+ 447 test(env, issuer, owner, asset, vault);
+
+
+
+
+ 452 Account
const& issuer,
+ 453 Account
const& owner,
+
+
+ 456 testcase(
"disabled single asset vault");
+
+
+ 459 vault.create({.owner = owner, .asset = asset});
+
+
+
+ 463 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+ 468 auto tx = vault.deposit(
+
+
+ 471 .amount = asset(10)});
+
+
+
+
+ 476 auto tx = vault.withdraw(
+
+
+ 479 .amount = asset(10)});
+
+
+
+
+ 484 auto tx = vault.clawback(
+
+
+
+ 488 .amount = asset(10)});
+
+
+
+
+ 493 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+ 497 {.features = supported_amendments() - featureSingleAssetVault});
+
+ 499 testCase([&](Env& env,
+ 500 Account
const& issuer,
+ 501 Account
const& owner,
+
+
+
+
+ 506 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 511 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
- 516 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 521 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 527 auto tx = vault.deposit(
-
-
- 530 .amount = asset(10)});
-
-
-
-
-
- 536 auto tx = vault.withdraw(
-
-
+
+ 517 auto tx = vault.deposit(
+
+
+ 520 .amount = asset(10)});
+
+
+
+
+
+ 526 auto tx = vault.withdraw(
+
+
+ 529 .amount = asset(10)});
+
+
+
+
+
+ 535 auto tx = vault.clawback(
+
+
+
539 .amount = asset(10)});
- 545 auto tx = vault.clawback(
-
-
-
- 549 .amount = asset(10)});
-
-
-
-
-
- 555 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 561 testCase([&](Env& env,
- 562 Account
const& issuer,
- 563 Account
const& owner,
-
-
-
+ 545 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 551 testCase([&](Env& env,
+ 552 Account
const& issuer,
+ 553 Account
const& owner,
+
+
+
+
+ 558 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 563 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
- 568 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 573 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 579 auto tx = vault.deposit(
-
-
- 582 .amount = asset(10)});
-
-
-
-
-
- 588 auto tx = vault.withdraw(
-
-
+
+ 569 auto tx = vault.deposit(
+
+
+ 572 .amount = asset(10)});
+
+
+
+
+
+ 578 auto tx = vault.withdraw(
+
+
+ 581 .amount = asset(10)});
+
+
+
+
+
+ 587 auto tx = vault.clawback(
+
+
+
591 .amount = asset(10)});
- 597 auto tx = vault.clawback(
-
-
-
- 601 .amount = asset(10)});
-
-
-
-
-
- 607 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
-
-
- 616 Account
const& owner,
-
-
- 619 testcase(
"disabled permissioned domain");
-
-
- 622 vault.create({.owner = owner, .asset =
xrpIssue()});
-
-
-
-
- 627 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 633 auto tx = vault.set({.owner = owner, .id = keylet.
key});
- 634 tx[sfDomainID] =
"0";
-
-
-
- 638 {.features = (supported_amendments() | featureSingleAssetVault) -
- 639 featurePermissionedDomains});
+ 597 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
+
+ 606 Account
const& owner,
+
+
+ 609 testcase(
"disabled permissioned domain");
+
+
+ 612 vault.create({.owner = owner, .asset =
xrpIssue()});
+
+
+
+
+ 617 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 623 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+ 624 tx[sfDomainID] =
"0";
+
+
+
+ 628 {.features = (supported_amendments() | featureSingleAssetVault) -
+ 629 featurePermissionedDomains});
+
+ 631 testCase([&](Env& env,
+ 632 Account
const& issuer,
+ 633 Account
const& owner,
+
+
+
+
+
+ 639 vault.create({.owner = owner, .asset =
xrpIssue()});
- 641 testCase([&](Env& env,
- 642 Account
const& issuer,
- 643 Account
const& owner,
-
-
-
-
-
- 649 vault.create({.owner = owner, .asset =
xrpIssue()});
-
-
- 652 auto tx = vault.set({
-
-
-
-
-
-
-
- 660 auto tx = vault.deposit(
-
-
- 663 .amount = asset(10)});
-
-
-
-
- 668 auto tx = vault.withdraw(
-
-
- 671 .amount = asset(10)});
-
-
-
-
- 676 auto tx = vault.clawback(
-
-
-
- 680 .amount = asset(10)});
-
-
-
-
- 685 auto tx = vault.del({
-
-
-
-
-
-
-
- 693 testCase([&](Env& env,
- 694 Account
const& issuer,
- 695 Account
const& owner,
-
-
-
-
- 700 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+ 642 auto tx = vault.set({
+
+
+
+
+
+
+
+ 650 auto tx = vault.deposit(
+
+
+ 653 .amount = asset(10)});
+
+
+
+
+ 658 auto tx = vault.withdraw(
+
+
+ 661 .amount = asset(10)});
+
+
+
+
+ 666 auto tx = vault.clawback(
+
+
+
+ 670 .amount = asset(10)});
+
+
+
+
+ 675 auto tx = vault.del({
+
+
+
+
+
+
+
+ 683 testCase([&](Env& env,
+ 684 Account
const& issuer,
+ 685 Account
const& owner,
+
+
+
+
+ 690 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+ 693 auto tx = vault.clawback(
+
+
+
+ 697 .amount = asset(10)});
+
+
+
-
- 703 auto tx = vault.clawback(
-
-
-
- 707 .amount = asset(10)});
-
-
-
-
- 712 testCase([&](Env& env,
-
- 714 Account
const& owner,
-
-
- 717 testcase(
"withdraw to bad destination");
-
- 719 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+ 702 testCase([&](Env& env,
+
+ 704 Account
const& owner,
+
+
+ 707 testcase(
"withdraw to bad destination");
+
+ 709 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+ 712 auto tx = vault.withdraw(
+
+
+ 715 .amount = asset(10)});
+ 716 tx[jss::Destination] =
"0";
+
+
+
-
- 722 auto tx = vault.withdraw(
-
-
- 725 .amount = asset(10)});
- 726 tx[jss::Destination] =
"0";
-
-
-
-
- 731 testCase([&](Env& env,
-
- 733 Account
const& owner,
-
-
- 736 testcase(
"create or set invalid data");
-
- 738 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 754 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 760 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
-
- 767 testCase([&](Env& env,
-
- 769 Account
const& owner,
-
-
-
-
- 774 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
- 777 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
- 782 testCase([&](Env& env,
-
- 784 Account
const& owner,
-
-
- 787 testcase(
"create with invalid metadata");
-
- 789 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
- 793 tx[sfMPTokenMetadata] =
"";
-
-
-
-
-
-
-
-
-
-
-
-
- 806 testCase([&](Env& env,
-
- 808 Account
const& owner,
-
-
-
-
- 813 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
- 816 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 822 testCase([&](Env& env,
-
- 824 Account
const& owner,
-
-
-
+ 721 testCase([&](Env& env,
+
+ 723 Account
const& owner,
+
+
+ 726 testcase(
"create or set invalid data");
+
+ 728 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 744 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 750 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+ 757 testCase([&](Env& env,
+
+ 759 Account
const& owner,
+
+
+
+
+ 764 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+ 767 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+ 772 testCase([&](Env& env,
+
+ 774 Account
const& owner,
+
+
+ 777 testcase(
"create with invalid metadata");
+
+ 779 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+ 783 tx[sfMPTokenMetadata] =
"";
+
+
+
+
+
+
+
+
+
+
+
+
+ 796 testCase([&](Env& env,
+
+ 798 Account
const& owner,
+
+
+
+
+ 803 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+ 806 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 812 testCase([&](Env& env,
+
+ 814 Account
const& owner,
+
+
+
+
+ 819 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+ 822 auto tx = vault.deposit(
+
+
+
+
+
- 829 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
- 832 auto tx = vault.deposit(
-
-
-
-
-
-
-
- 840 auto tx = vault.deposit(
- 841 {.depositor = owner, .id = keylet.
key, .amount = asset(0)});
-
-
-
-
- 846 testCase([&](Env& env,
-
- 848 Account
const& owner,
-
-
- 851 testcase(
"invalid set immutable flag");
-
- 853 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
- 856 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 862 testCase([&](Env& env,
-
- 864 Account
const& owner,
-
-
- 867 testcase(
"invalid withdraw amount");
+
+ 830 auto tx = vault.deposit(
+ 831 {.depositor = owner, .id = keylet.
key, .amount = asset(0)});
+
+
+
+
+ 836 testCase([&](Env& env,
+
+ 838 Account
const& owner,
+
+
+ 841 testcase(
"invalid set immutable flag");
+
+ 843 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+ 846 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 852 testCase([&](Env& env,
+
+ 854 Account
const& owner,
+
+
+ 857 testcase(
"invalid withdraw amount");
+
+ 859 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+ 862 auto tx = vault.withdraw(
+
+
+
+
+
- 869 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
- 872 auto tx = vault.withdraw(
-
-
-
-
-
-
-
- 880 auto tx = vault.withdraw(
- 881 {.depositor = owner, .id = keylet.
key, .amount = asset(0)});
-
-
-
-
- 886 testCase([&](Env& env,
- 887 Account
const& issuer,
- 888 Account
const& owner,
-
-
-
-
- 893 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
- 896 auto tx = vault.clawback(
-
-
-
- 900 .amount = asset(50)});
-
-
+
+ 870 auto tx = vault.withdraw(
+ 871 {.depositor = owner, .id = keylet.
key, .amount = asset(0)});
+
+
+
+
+ 876 testCase([&](Env& env,
+ 877 Account
const& issuer,
+ 878 Account
const& owner,
+
+
+
+
+ 883 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+ 886 auto tx = vault.clawback(
+
+
+
+ 890 .amount = asset(50)});
+
+
+
+
+ 895 auto tx = vault.clawback(
+
+
+
+
+
+
+
-
- 905 auto tx = vault.clawback(
-
-
-
-
-
-
-
-
- 914 testCase([&](Env& env,
-
- 916 Account
const& owner,
-
-
-
-
- 921 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
- 925 tx[sfWithdrawalPolicy] = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 944 tx[sfDomainID] =
"0";
-
-
-
-
-
-
-
-
-
- 954 using namespace test::jtx;
-
-
-
- 958 Account
const& issuer,
- 959 Account
const& owner,
- 960 Account
const& depositor,
-
- 962 Vault& vault)> test) {
- 963 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 964 Account issuer{
"issuer"};
- 965 Account owner{
"owner"};
- 966 Account depositor{
"depositor"};
- 967 env.fund(XRP(1000), issuer, owner, depositor);
-
-
-
-
- 972 test(env, issuer, owner, depositor, asset, vault);
-
-
-
-
- 977 Account
const& issuer,
- 978 Account
const& owner,
- 979 Account
const& depositor,
-
-
-
-
- 984 tx[sfAssetsMaximum] = asset(0).number();
-
-
-
-
-
- 990 Account
const& issuer,
- 991 Account
const& owner,
- 992 Account
const& depositor,
-
-
-
- 996 auto tx = vault.deposit(
- 997 {.depositor = depositor,
-
- 999 .amount = asset(10)});
-
-
-
-
-
- 1005 Account
const& issuer,
- 1006 Account
const& owner,
- 1007 Account
const& depositor,
-
-
- 1010 testcase(
"nothing to withdraw from");
- 1011 auto tx = vault.withdraw(
- 1012 {.depositor = depositor,
-
- 1014 .amount = asset(10)});
-
-
-
-
-
- 1020 Account
const& issuer,
- 1021 Account
const& owner,
- 1022 Account
const& depositor,
-
-
-
-
-
-
-
-
-
- 1032 Account
const& issuer,
- 1033 Account
const& owner,
- 1034 Account
const& depositor,
-
-
- 1037 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
- 1044 Account
const& issuer,
- 1045 Account
const& owner,
- 1046 Account
const& depositor,
-
-
- 1049 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
- 1050 tx[sfWithdrawalPolicy] = 1;
- 1051 testcase(
"explicitly select withdrawal policy");
-
-
-
-
-
- 1057 Account
const& issuer,
- 1058 Account
const& owner,
- 1059 Account
const& depositor,
-
-
- 1062 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
- 1069 Account
const& issuer,
- 1070 Account
const& owner,
- 1071 Account
const& depositor,
-
-
- 1074 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
- 1078 env(pay(owner, issuer, XRP(775)));
-
-
-
-
-
-
- 1085 Account
const& issuer,
- 1086 Account
const& owner,
- 1087 Account
const& depositor,
-
-
- 1090 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
-
-
-
- 1101 using namespace test::jtx;
-
-
- 1104 testcase(
"IOU fail create frozen");
-
- 1106 *
this, supported_amendments() | featureSingleAssetVault};
- 1107 Account issuer{
"issuer"};
- 1108 Account owner{
"owner"};
- 1109 env.fund(XRP(1000), issuer, owner);
+ 904 testCase([&](Env& env,
+
+ 906 Account
const& owner,
+
+
+
+
+ 911 auto [tx1, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+ 915 tx[sfWithdrawalPolicy] = 0;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 934 tx[sfDomainID] =
"0";
+
+
+
+
+
+
+
+
+
+ 944 using namespace test::jtx;
+
+
+
+ 948 Account
const& issuer,
+ 949 Account
const& owner,
+ 950 Account
const& depositor,
+
+ 952 Vault& vault)> test) {
+ 953 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 954 Account issuer{
"issuer"};
+ 955 Account owner{
"owner"};
+ 956 Account depositor{
"depositor"};
+ 957 env.fund(XRP(1000), issuer, owner, depositor);
+
+
+
+
+ 962 test(env, issuer, owner, depositor, asset, vault);
+
+
+
+
+ 967 Account
const& issuer,
+ 968 Account
const& owner,
+ 969 Account
const& depositor,
+
+
+
+
+ 974 tx[sfAssetsMaximum] = asset(0).number();
+
+
+
+
+
+ 980 Account
const& issuer,
+ 981 Account
const& owner,
+ 982 Account
const& depositor,
+
+
+
+ 986 auto tx = vault.deposit(
+ 987 {.depositor = depositor,
+
+ 989 .amount = asset(10)});
+
+
+
+
+
+ 995 Account
const& issuer,
+ 996 Account
const& owner,
+ 997 Account
const& depositor,
+
+
+ 1000 testcase(
"nothing to withdraw from");
+ 1001 auto tx = vault.withdraw(
+ 1002 {.depositor = depositor,
+
+ 1004 .amount = asset(10)});
+
+
+
+
+
+ 1010 Account
const& issuer,
+ 1011 Account
const& owner,
+ 1012 Account
const& depositor,
+
+
+
+
+
+
+
+
+
+ 1022 Account
const& issuer,
+ 1023 Account
const& owner,
+ 1024 Account
const& depositor,
+
+
+ 1027 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+ 1034 Account
const& issuer,
+ 1035 Account
const& owner,
+ 1036 Account
const& depositor,
+
+
+ 1039 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+ 1040 tx[sfWithdrawalPolicy] = 1;
+ 1041 testcase(
"explicitly select withdrawal policy");
+
+
+
+
+
+ 1047 Account
const& issuer,
+ 1048 Account
const& owner,
+ 1049 Account
const& depositor,
+
+
+ 1052 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+ 1059 Account
const& issuer,
+ 1060 Account
const& owner,
+ 1061 Account
const& depositor,
+
+
+ 1064 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+ 1068 env(pay(owner, issuer, XRP(775)));
+
+
+
+
+
+
+ 1075 Account
const& issuer,
+ 1076 Account
const& owner,
+ 1077 Account
const& depositor,
+
+
+ 1080 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
+
+
+
+ 1091 using namespace test::jtx;
+
+
+ 1094 testcase(
"IOU fail create frozen");
+
+ 1096 *
this, supported_amendments() | featureSingleAssetVault};
+ 1097 Account issuer{
"issuer"};
+ 1098 Account owner{
"owner"};
+ 1099 env.fund(XRP(1000), issuer, owner);
+
+
+
+
+
+ 1105 Asset asset = issuer[
"IOU"];
+
+ 1107 vault.create({.owner = owner, .asset = asset});
+
+
-
-
-
-
- 1115 Asset asset = issuer[
"IOU"];
-
- 1117 vault.create({.owner = owner, .asset = asset});
-
-
+
+
+
+ 1114 testcase(
"IOU fail create no ripling");
+
+ 1116 *
this, supported_amendments() | featureSingleAssetVault};
+ 1117 Account issuer{
"issuer"};
+ 1118 Account owner{
"owner"};
+ 1119 env.fund(XRP(1000), issuer, owner);
-
-
-
- 1124 testcase(
"IOU fail create no ripling");
-
- 1126 *
this, supported_amendments() | featureSingleAssetVault};
- 1127 Account issuer{
"issuer"};
- 1128 Account owner{
"owner"};
- 1129 env.fund(XRP(1000), issuer, owner);
-
-
-
-
-
- 1135 Asset asset = issuer[
"IOU"];
-
- 1137 vault.create({.owner = owner, .asset = asset});
-
+
+
+
+
+ 1125 Asset asset = issuer[
"IOU"];
+
+ 1127 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
+ 1135 *
this, supported_amendments() | featureSingleAssetVault};
+ 1136 Account issuer{
"issuer"};
+ 1137 Account owner{
"owner"};
+ 1138 env.fund(XRP(1000), owner);
-
-
-
-
-
- 1145 *
this, supported_amendments() | featureSingleAssetVault};
- 1146 Account issuer{
"issuer"};
- 1147 Account owner{
"owner"};
- 1148 env.fund(XRP(1000), owner);
-
-
-
- 1152 Asset asset = issuer[
"IOU"];
-
-
- 1155 vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
-
- 1163 testcase(
"IOU fail create vault for AMM LPToken");
- 1164 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 1165 Account
const gw(
"gateway");
- 1166 Account
const alice(
"alice");
- 1167 Account
const carol(
"carol");
- 1168 IOU
const USD = gw[
"USD"];
-
- 1170 auto const [asset1, asset2] =
-
-
-
-
- 1175 auto const defXRP = XRP(30000);
-
-
- 1178 return a + XRP(1000);
-
-
-
-
-
-
- 1185 auto const toFund1 = tofund(asset1);
- 1186 auto const toFund2 = tofund(asset2);
- 1187 BEAST_EXPECT(asset1 <= toFund1 && asset2 <= toFund2);
+
+
+ 1142 Asset asset = issuer[
"IOU"];
+
+
+ 1145 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+
+ 1153 testcase(
"IOU fail create vault for AMM LPToken");
+ 1154 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 1155 Account
const gw(
"gateway");
+ 1156 Account
const alice(
"alice");
+ 1157 Account
const carol(
"carol");
+ 1158 IOU
const USD = gw[
"USD"];
+
+ 1160 auto const [asset1, asset2] =
+
+
+
+
+ 1165 auto const defXRP = XRP(30000);
+
+
+ 1168 return a + XRP(1000);
+
+
+
+
+
+
+ 1175 auto const toFund1 = tofund(asset1);
+ 1176 auto const toFund2 = tofund(asset2);
+ 1177 BEAST_EXPECT(asset1 <= toFund1 && asset2 <= toFund2);
+
+ 1179 if (!asset1.native() && !asset2.native())
+ 1180 fund(env, gw, {alice, carol}, {toFund1, toFund2}, Fund::All);
+ 1181 else if (asset1.native())
+ 1182 fund(env, gw, {alice, carol}, toFund1, {toFund2}, Fund::All);
+ 1183 else if (asset2.native())
+ 1184 fund(env, gw, {alice, carol}, toFund2, {toFund1}, Fund::All);
+
+
+ 1187 env, alice, asset1, asset2, CreateArg{.log =
false, .tfee = 0});
- 1189 if (!asset1.native() && !asset2.native())
- 1190 fund(env, gw, {alice, carol}, {toFund1, toFund2}, Fund::All);
- 1191 else if (asset1.native())
- 1192 fund(env, gw, {alice, carol}, toFund1, {toFund2}, Fund::All);
- 1193 else if (asset2.native())
- 1194 fund(env, gw, {alice, carol}, toFund2, {toFund1}, Fund::All);
-
-
- 1197 env, alice, asset1, asset2, CreateArg{.log =
false, .tfee = 0});
-
- 1199 Account
const owner{
"owner"};
- 1200 env.fund(XRP(1000000), owner);
-
-
-
- 1204 vault.create({.owner = owner, .asset = ammAlice.lptIssue()});
-
-
-
-
-
-
-
-
- 1213 using namespace test::jtx;
+ 1189 Account
const owner{
"owner"};
+ 1190 env.fund(XRP(1000000), owner);
+
+
+
+ 1194 vault.create({.owner = owner, .asset = ammAlice.lptIssue()});
+
+
+
+
+
+
+
+
+ 1203 using namespace test::jtx;
+
+ 1205 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 1206 Account issuer{
"issuer"};
+ 1207 Account owner{
"owner"};
+ 1208 Account depositor{
"depositor"};
+ 1209 env.fund(XRP(1000), issuer, owner, depositor);
+
+
+
+ 1213 MPTTester mptt{env, issuer, mptInitNoFund};
- 1215 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 1216 Account issuer{
"issuer"};
- 1217 Account owner{
"owner"};
- 1218 Account depositor{
"depositor"};
- 1219 env.fund(XRP(1000), issuer, owner, depositor);
-
-
-
- 1223 MPTTester mptt{env, issuer, mptInitNoFund};
-
-
-
- 1227 Asset asset = mptt.issuanceID();
- 1228 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
-
- 1235 using namespace test::jtx;
-
- 1237 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 1238 Account issuer{
"issuer"};
- 1239 Account owner{
"owner"};
- 1240 Account depositor{
"depositor"};
- 1241 env.fund(XRP(1000), issuer, owner, depositor);
-
-
-
-
- 1246 env.trust(asset(1000), owner);
- 1247 env(pay(issuer, owner, asset(100)));
- 1248 env.trust(asset(1000), depositor);
- 1249 env(pay(issuer, depositor, asset(100)));
-
-
- 1252 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
- 1258 testcase(
"nontransferable deposits");
- 1259 auto tx1 = vault.deposit(
- 1260 {.depositor = depositor,
-
- 1262 .amount = asset(40)});
-
+
+
+ 1217 Asset asset = mptt.issuanceID();
+ 1218 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+
+ 1225 using namespace test::jtx;
+
+ 1227 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 1228 Account issuer{
"issuer"};
+ 1229 Account owner{
"owner"};
+ 1230 Account depositor{
"depositor"};
+ 1231 env.fund(XRP(1000), issuer, owner, depositor);
+
+
+
+
+ 1236 env.trust(asset(1000), owner);
+ 1237 env(pay(issuer, owner, asset(100)));
+ 1238 env.trust(asset(1000), depositor);
+ 1239 env(pay(issuer, depositor, asset(100)));
+
+
+ 1242 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+ 1248 testcase(
"nontransferable deposits");
+ 1249 auto tx1 = vault.deposit(
+ 1250 {.depositor = depositor,
+
+ 1252 .amount = asset(40)});
+
+
+ 1255 auto tx2 = vault.deposit(
+ 1256 {.depositor = owner, .id = keylet.
key, .amount = asset(60)});
+
+
+
+
+ 1261 auto const vaultAccount =
+
+ 1263 auto jvVault = env.rpc(
"vault_info",
strHex(key));
- 1265 auto tx2 = vault.deposit(
- 1266 {.depositor = owner, .id = keylet.
key, .amount = asset(60)});
-
-
-
+
+ 1266 jvVault[jss::result][jss::vault][sfAssetsTotal] ==
"100");
+
+ 1268 jvVault[jss::result][jss::vault][jss::shares]
+ 1269 [sfOutstandingAmount] ==
"100");
- 1271 auto const vaultAccount =
-
- 1273 auto jvVault = env.rpc(
"vault_info",
strHex(key));
-
-
- 1276 jvVault[jss::result][jss::vault][sfAssetsTotal] ==
"100");
-
- 1278 jvVault[jss::result][jss::vault][jss::shares]
- 1279 [sfOutstandingAmount] ==
"100");
+
+ 1272 return parseBase58<AccountID>(
+ 1273 jvVault[jss::result][jss::vault][jss::Account]
+
+
+
+
+ 1278 auto const MptID =
makeMptID(1, vaultAccount);
+ 1279 Asset shares = MptID;
-
- 1282 return parseBase58<AccountID>(
- 1283 jvVault[jss::result][jss::vault][jss::Account]
-
-
-
-
- 1288 auto const MptID =
makeMptID(1, vaultAccount);
- 1289 Asset shares = MptID;
-
-
- 1292 testcase(
"nontransferable shares cannot be moved");
- 1293 env(pay(owner, depositor, shares(10)), ter{
tecNO_AUTH});
- 1294 env(pay(depositor, owner, shares(10)), ter{
tecNO_AUTH});
-
-
-
- 1298 testcase(
"nontransferable shares can be used to withdraw");
- 1299 auto tx1 = vault.withdraw(
- 1300 {.depositor = depositor,
-
- 1302 .amount = asset(20)});
-
-
- 1305 auto tx2 = vault.withdraw(
- 1306 {.depositor = owner, .id = keylet.
key, .amount = asset(30)});
-
-
+
+ 1282 testcase(
"nontransferable shares cannot be moved");
+ 1283 env(pay(owner, depositor, shares(10)), ter{
tecNO_AUTH});
+ 1284 env(pay(depositor, owner, shares(10)), ter{
tecNO_AUTH});
+
+
+
+ 1288 testcase(
"nontransferable shares can be used to withdraw");
+ 1289 auto tx1 = vault.withdraw(
+ 1290 {.depositor = depositor,
+
+ 1292 .amount = asset(20)});
+
+
+ 1295 auto tx2 = vault.withdraw(
+ 1296 {.depositor = owner, .id = keylet.
key, .amount = asset(30)});
+
+
+
+
+
+ 1302 testcase(
"nontransferable shares balance check");
+ 1303 auto jvVault = env.rpc(
"vault_info",
strHex(keylet.
key));
+
+ 1305 jvVault[jss::result][jss::vault][sfAssetsTotal] ==
"50");
+
+ 1307 jvVault[jss::result][jss::vault][jss::shares]
+ 1308 [sfOutstandingAmount] ==
"50");
- 1312 testcase(
"nontransferable shares balance check");
- 1313 auto jvVault = env.rpc(
"vault_info",
strHex(keylet.
key));
-
- 1315 jvVault[jss::result][jss::vault][sfAssetsTotal] ==
"50");
-
- 1317 jvVault[jss::result][jss::vault][jss::shares]
- 1318 [sfOutstandingAmount] ==
"50");
-
-
-
- 1322 testcase(
"nontransferable shares withdraw rest");
- 1323 auto tx1 = vault.withdraw(
- 1324 {.depositor = depositor,
-
- 1326 .amount = asset(20)});
-
-
- 1329 auto tx2 = vault.withdraw(
- 1330 {.depositor = owner, .id = keylet.
key, .amount = asset(30)});
-
-
-
-
-
- 1336 testcase(
"nontransferable shares delete empty vault");
- 1337 auto tx = vault.del({.owner = owner, .id = keylet.
key});
-
- 1339 BEAST_EXPECT(!env.le(keylet));
-
-
+ 1312 testcase(
"nontransferable shares withdraw rest");
+ 1313 auto tx1 = vault.withdraw(
+ 1314 {.depositor = depositor,
+
+ 1316 .amount = asset(20)});
+
+
+ 1319 auto tx2 = vault.withdraw(
+ 1320 {.depositor = owner, .id = keylet.
key, .amount = asset(30)});
+
+
+
+
+
+ 1326 testcase(
"nontransferable shares delete empty vault");
+ 1327 auto tx = vault.del({.owner = owner, .id = keylet.
key});
+
+ 1329 BEAST_EXPECT(!env.le(keylet));
+
+
+
+
+
+
+ 1336 using namespace test::jtx;
+
+
+
+ 1340 bool enableClawback =
true;
+
-
-
-
- 1346 using namespace test::jtx;
-
-
-
- 1350 bool enableClawback =
true;
-
-
- 1353 auto testCase = [
this](
-
-
- 1356 Account
const& issuer,
- 1357 Account
const& owner,
- 1358 Account
const& depositor,
-
-
- 1361 MPTTester& mptt)> test,
- 1362 CaseArgs args = {}) {
- 1363 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 1364 Account issuer{
"issuer"};
- 1365 Account owner{
"owner"};
- 1366 Account depositor{
"depositor"};
- 1367 env.fund(XRP(1000), issuer, owner, depositor);
-
-
-
- 1371 MPTTester mptt{env, issuer, mptInitNoFund};
-
-
-
-
-
-
- 1378 mptt.authorize({.account = owner});
- 1379 mptt.authorize({.account = issuer, .holder = owner});
- 1380 mptt.authorize({.account = depositor});
- 1381 mptt.authorize({.account = issuer, .holder = depositor});
- 1382 env(pay(issuer, depositor, asset(1000)));
-
-
- 1385 test(env, issuer, owner, depositor, asset, vault, mptt);
-
-
-
-
- 1390 Account
const& issuer,
- 1391 Account
const& owner,
- 1392 Account
const& depositor,
-
-
-
- 1396 testcase(
"MPT nothing to clawback from");
- 1397 auto tx = vault.clawback(
-
-
- 1400 .holder = depositor,
- 1401 .amount = asset(10)});
-
-
-
-
-
- 1407 Account
const& issuer,
- 1408 Account
const& owner,
- 1409 Account
const& depositor,
-
-
-
- 1413 testcase(
"MPT global lock blocks create");
- 1414 mptt.set({.account = issuer, .flags =
tfMPTLock});
- 1415 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
- 1421 Account
const& issuer,
- 1422 Account
const& owner,
- 1423 Account
const& depositor,
-
-
-
- 1427 testcase(
"MPT global lock blocks deposit");
- 1428 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
+ 1343 auto testCase = [
this](
+
+
+ 1346 Account
const& issuer,
+ 1347 Account
const& owner,
+ 1348 Account
const& depositor,
+
+
+ 1351 MPTTester& mptt)> test,
+ 1352 CaseArgs args = {}) {
+ 1353 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 1354 Account issuer{
"issuer"};
+ 1355 Account owner{
"owner"};
+ 1356 Account depositor{
"depositor"};
+ 1357 env.fund(XRP(1000), issuer, owner, depositor);
+
+
+
+ 1361 MPTTester mptt{env, issuer, mptInitNoFund};
+
+
+
+
+
+
+ 1368 mptt.authorize({.account = owner});
+ 1369 mptt.authorize({.account = issuer, .holder = owner});
+ 1370 mptt.authorize({.account = depositor});
+ 1371 mptt.authorize({.account = issuer, .holder = depositor});
+ 1372 env(pay(issuer, depositor, asset(1000)));
+
+
+ 1375 test(env, issuer, owner, depositor, asset, vault, mptt);
+
+
+
+
+ 1380 Account
const& issuer,
+ 1381 Account
const& owner,
+ 1382 Account
const& depositor,
+
+
+
+ 1386 testcase(
"MPT nothing to clawback from");
+ 1387 auto tx = vault.clawback(
+
+
+ 1390 .holder = depositor,
+ 1391 .amount = asset(10)});
+
+
+
+
+
+ 1397 Account
const& issuer,
+ 1398 Account
const& owner,
+ 1399 Account
const& depositor,
+
+
+
+ 1403 testcase(
"MPT global lock blocks create");
+ 1404 mptt.set({.account = issuer, .flags =
tfMPTLock});
+ 1405 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+ 1411 Account
const& issuer,
+ 1412 Account
const& owner,
+ 1413 Account
const& depositor,
+
+
+
+ 1417 testcase(
"MPT global lock blocks deposit");
+ 1418 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+ 1422 mptt.set({.account = issuer, .flags =
tfMPTLock});
+
+
+
+ 1426 {.depositor = depositor,
+
+ 1428 .amount = asset(100)});
+
- 1432 mptt.set({.account = issuer, .flags =
tfMPTLock});
-
-
-
- 1436 {.depositor = depositor,
-
- 1438 .amount = asset(100)});
-
-
-
-
- 1443 tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 1449 Account
const& issuer,
- 1450 Account
const& owner,
- 1451 Account
const& depositor,
-
-
-
- 1455 testcase(
"MPT global lock blocks withdrawal");
- 1456 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
- 1460 {.depositor = depositor,
-
- 1462 .amount = asset(100)});
-
-
+
+ 1433 tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 1439 Account
const& issuer,
+ 1440 Account
const& owner,
+ 1441 Account
const& depositor,
+
+
+
+ 1445 testcase(
"MPT global lock blocks withdrawal");
+ 1446 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+ 1450 {.depositor = depositor,
+
+ 1452 .amount = asset(100)});
+
+
+
+
+
+ 1458 auto v = env.le(keylet);
+
+ 1460 MPTID share = (*v)[sfShareMPTID];
+
+ 1462 BEAST_EXPECT(issuance);
+ 1463 Number outstandingShares = issuance->at(sfOutstandingAmount);
+ 1464 BEAST_EXPECT(outstandingShares == 100);
-
-
- 1468 auto v = env.le(keylet);
-
- 1470 MPTID share = (*v)[sfShareMPTID];
-
- 1472 BEAST_EXPECT(issuance);
- 1473 Number outstandingShares = issuance->at(sfOutstandingAmount);
- 1474 BEAST_EXPECT(outstandingShares == 100);
-
- 1476 mptt.set({.account = issuer, .flags =
tfMPTLock});
-
-
- 1479 tx = vault.withdraw(
- 1480 {.depositor = depositor,
+ 1466 mptt.set({.account = issuer, .flags =
tfMPTLock});
+
+
+ 1469 tx = vault.withdraw(
+ 1470 {.depositor = depositor,
+
+ 1472 .amount = asset(100)});
+
+
+ 1475 tx[sfDestination] = issuer.human();
+
+
+
+ 1479 tx = vault.clawback(
+
- 1482 .amount = asset(100)});
-
-
- 1485 tx[sfDestination] = issuer.human();
-
-
-
- 1489 tx = vault.clawback(
-
-
- 1492 .holder = depositor,
- 1493 .amount = asset(0)});
-
-
-
-
- 1498 tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
+ 1482 .holder = depositor,
+ 1483 .amount = asset(0)});
+
+
+
+
+ 1488 tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 1494 Account
const& issuer,
+ 1495 Account
const& owner,
+ 1496 Account
const& depositor,
+
+
+
+ 1500 testcase(
"MPT only issuer can clawback");
-
-
- 1504 Account
const& issuer,
- 1505 Account
const& owner,
- 1506 Account
const& depositor,
-
-
-
- 1510 testcase(
"MPT only issuer can clawback");
-
- 1512 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 1517 {.depositor = depositor,
-
- 1519 .amount = asset(100)});
-
-
-
-
- 1524 auto tx = vault.clawback(
- 1525 {.issuer = owner, .id = keylet.
key, .holder = depositor});
-
-
-
+ 1502 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 1507 {.depositor = depositor,
+
+ 1509 .amount = asset(100)});
+
+
+
+
+ 1514 auto tx = vault.clawback(
+ 1515 {.issuer = owner, .id = keylet.
key, .holder = depositor});
+
+
+
+
+
+
+ 1522 Account
const& issuer,
+ 1523 Account
const& owner,
+ 1524 Account
const& depositor,
+
+
+
+
-
-
- 1532 Account
const& issuer,
- 1533 Account
const& owner,
- 1534 Account
const& depositor,
-
-
-
-
-
- 1540 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 1545 {.depositor = depositor,
-
- 1547 .amount = asset(1000)});
-
-
-
-
- 1552 auto tx = vault.clawback(
-
-
- 1555 .holder = depositor,
- 1556 .amount = asset(0)});
-
-
-
- 1560 mptt.destroy({.issuer = issuer, .id = mptt.issuanceID()});
-
-
-
-
- 1565 vault.create({.owner = depositor, .asset = asset});
-
-
-
-
- 1570 auto tx = vault.deposit(
- 1571 {.depositor = depositor,
-
- 1573 .amount = asset(10)});
-
-
-
-
- 1578 auto tx = vault.withdraw(
- 1579 {.depositor = depositor,
-
- 1581 .amount = asset(10)});
-
-
-
-
- 1586 auto tx = vault.clawback(
-
-
- 1589 .holder = depositor,
- 1590 .amount = asset(0)});
-
-
-
- 1594 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
- 1600 Account
const& issuer,
- 1601 Account
const& owner,
- 1602 Account
const& depositor,
-
-
-
-
-
-
- 1609 vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 1614 {.depositor = depositor,
-
- 1616 .amount = asset(1000)});
-
-
-
-
- 1621 auto tx = vault.clawback(
-
-
- 1624 .holder = depositor,
- 1625 .amount = asset(0)});
-
-
-
- 1629 {.enableClawback =
false});
-
-
-
- 1633 Account
const& issuer,
- 1634 Account
const& owner,
- 1635 Account
const& depositor,
-
-
-
-
- 1640 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
- 1644 {.depositor = depositor,
-
- 1646 .amount = asset(1000)});
-
-
-
-
-
- 1652 .holder = depositor,
-
-
-
-
- 1657 auto tx = vault.withdraw(
- 1658 {.depositor = depositor,
-
- 1660 .amount = asset(100)});
-
-
-
- 1664 tx[sfDestination] = issuer.human();
-
- 1666 tx[sfDestination] = owner.human();
-
-
-
-
-
-
- 1673 auto tx = vault.deposit(
- 1674 {.depositor = depositor,
-
- 1676 .amount = asset(100)});
-
-
-
-
- 1681 tx = vault.clawback(
-
-
- 1684 .holder = depositor,
- 1685 .amount = asset(800)});
-
-
- 1688 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
- 1693 Account
const& issuer,
- 1694 Account
const& owner,
- 1695 Account
const& depositor,
-
-
-
- 1699 testcase(
"MPT lock of vault pseudo-account");
- 1700 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
- 1704 auto const vaultAccount =
- 1705 [&env, keylet = keylet,
this]() ->
AccountID {
- 1706 auto const vault = env.le(keylet);
- 1707 BEAST_EXPECT(vault !=
nullptr);
- 1708 return vault->at(sfAccount);
-
-
-
- 1712 {.depositor = depositor,
-
- 1714 .amount = asset(100)});
-
-
-
-
-
- 1720 jv[jss::Account] = issuer.human();
- 1721 jv[sfMPTokenIssuanceID] =
-
- 1723 jv[jss::Holder] =
toBase58(vaultAccount);
- 1724 jv[jss::TransactionType] = jss::MPTokenIssuanceSet;
-
-
-
-
-
-
-
- 1732 {.depositor = depositor,
-
- 1734 .amount = asset(100)});
-
-
- 1737 tx = vault.withdraw(
- 1738 {.depositor = depositor,
-
- 1740 .amount = asset(100)});
-
-
-
- 1744 tx = vault.clawback(
-
-
- 1747 .holder = depositor,
- 1748 .amount = asset(100)});
-
-
-
- 1752 tx = vault.del({.owner = owner, .id = keylet.
key});
-
-
+ 1530 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 1535 {.depositor = depositor,
+
+ 1537 .amount = asset(1000)});
+
+
+
+
+ 1542 auto tx = vault.clawback(
+
+
+ 1545 .holder = depositor,
+ 1546 .amount = asset(0)});
+
+
+
+ 1550 mptt.destroy({.issuer = issuer, .id = mptt.issuanceID()});
+
+
+
+
+ 1555 vault.create({.owner = depositor, .asset = asset});
+
+
+
+
+ 1560 auto tx = vault.deposit(
+ 1561 {.depositor = depositor,
+
+ 1563 .amount = asset(10)});
+
+
+
+
+ 1568 auto tx = vault.withdraw(
+ 1569 {.depositor = depositor,
+
+ 1571 .amount = asset(10)});
+
+
+
+
+ 1576 auto tx = vault.clawback(
+
+
+ 1579 .holder = depositor,
+ 1580 .amount = asset(0)});
+
+
+
+ 1584 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+ 1590 Account
const& issuer,
+ 1591 Account
const& owner,
+ 1592 Account
const& depositor,
+
+
+
+
+
+
+ 1599 vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 1604 {.depositor = depositor,
+
+ 1606 .amount = asset(1000)});
+
+
+
+
+ 1611 auto tx = vault.clawback(
+
+
+ 1614 .holder = depositor,
+ 1615 .amount = asset(0)});
+
+
+
+ 1619 {.enableClawback =
false});
+
+
+
+ 1623 Account
const& issuer,
+ 1624 Account
const& owner,
+ 1625 Account
const& depositor,
+
+
+
+
+ 1630 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+ 1634 {.depositor = depositor,
+
+ 1636 .amount = asset(1000)});
+
+
+
+
+
+ 1642 .holder = depositor,
+
+
+
+
+ 1647 auto tx = vault.withdraw(
+ 1648 {.depositor = depositor,
+
+ 1650 .amount = asset(100)});
+
+
+
+ 1654 tx[sfDestination] = issuer.human();
+
+ 1656 tx[sfDestination] = owner.human();
+
+
+
+
+
+
+ 1663 auto tx = vault.deposit(
+ 1664 {.depositor = depositor,
+
+ 1666 .amount = asset(100)});
+
+
+
+
+ 1671 tx = vault.clawback(
+
+
+ 1674 .holder = depositor,
+ 1675 .amount = asset(800)});
+
+
+ 1678 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+ 1683 Account
const& issuer,
+ 1684 Account
const& owner,
+ 1685 Account
const& depositor,
+
+
+
+ 1689 testcase(
"MPT lock of vault pseudo-account");
+ 1690 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+ 1694 auto const vaultAccount =
+ 1695 [&env, keylet = keylet,
this]() ->
AccountID {
+ 1696 auto const vault = env.le(keylet);
+ 1697 BEAST_EXPECT(vault !=
nullptr);
+ 1698 return vault->at(sfAccount);
+
+
+
+ 1702 {.depositor = depositor,
+
+ 1704 .amount = asset(100)});
+
+
+
+
+
+ 1710 jv[jss::Account] = issuer.human();
+ 1711 jv[sfMPTokenIssuanceID] =
+
+ 1713 jv[jss::Holder] =
toBase58(vaultAccount);
+ 1714 jv[jss::TransactionType] = jss::MPTokenIssuanceSet;
+
+
+
+
+
+
+
+ 1722 {.depositor = depositor,
+
+ 1724 .amount = asset(100)});
+
+
+ 1727 tx = vault.withdraw(
+ 1728 {.depositor = depositor,
+
+ 1730 .amount = asset(100)});
+
+
+
+ 1734 tx = vault.clawback(
+
+
+ 1737 .holder = depositor,
+ 1738 .amount = asset(100)});
+
+
+
+ 1742 tx = vault.del({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+ 1749 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 1750 Account owner{
"owner"};
+ 1751 Account issuer{
"issuer"};
+ 1752 env.fund(XRP(1000000), owner, issuer);
+
+
-
-
-
- 1759 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 1760 Account owner{
"owner"};
- 1761 Account issuer{
"issuer"};
- 1762 env.fund(XRP(1000000), owner, issuer);
-
-
-
- 1766 MPTTester mptt{env, issuer, mptInitNoFund};
-
-
-
- 1770 mptt.authorize({.account = owner});
- 1771 mptt.authorize({.account = issuer, .holder = owner});
-
- 1773 env(pay(issuer, owner, asset(100)));
- 1774 auto [tx1, k1] = vault.create({.owner = owner, .asset = asset});
-
+ 1756 MPTTester mptt{env, issuer, mptInitNoFund};
+
+
+
+ 1760 mptt.authorize({.account = owner});
+ 1761 mptt.authorize({.account = issuer, .holder = owner});
+
+ 1763 env(pay(issuer, owner, asset(100)));
+ 1764 auto [tx1, k1] = vault.create({.owner = owner, .asset = asset});
+
+
+
+ 1768 auto const shares = [&env, keylet = k1,
this]() ->
Asset {
+ 1769 auto const vault = env.le(keylet);
+ 1770 BEAST_EXPECT(vault !=
nullptr);
+ 1771 return MPTIssue(vault->at(sfShareMPTID));
+
+
+ 1774 auto [tx2, k2] = vault.create({.owner = owner, .asset = shares});
+
-
- 1778 auto const shares = [&env, keylet = k1,
this]() ->
Asset {
- 1779 auto const vault = env.le(keylet);
- 1780 BEAST_EXPECT(vault !=
nullptr);
- 1781 return MPTIssue(vault->at(sfShareMPTID));
-
-
- 1784 auto [tx2, k2] = vault.create({.owner = owner, .asset = shares});
-
-
-
-
-
-
-
-
- 1793 using namespace test::jtx;
-
-
-
-
-
- 1799 Account
const& owner,
- 1800 Account
const& issuer,
- 1801 Account
const& charlie,
-
-
-
-
-
-
-
- 1809 *
this, supported_amendments() | featureSingleAssetVault};
- 1810 Account
const owner{
"owner"};
- 1811 Account
const issuer{
"issuer"};
- 1812 Account
const charlie{
"charlie"};
-
- 1814 env.fund(XRP(1000), issuer, owner, charlie);
-
-
-
-
- 1819 env.trust(asset(1000), owner);
- 1820 env(pay(issuer, owner, asset(200)));
- 1821 env(rate(issuer, 1.25));
-
-
- 1824 auto const [tx, keylet] =
- 1825 vault.create({.owner = owner, .asset = asset});
-
-
-
- 1829 auto const vaultAccount =
-
- 1831 return env.le(keylet)->at(sfAccount);
-
-
- 1834 return env.le(keylet)->at(sfShareMPTID);
-
- 1836 auto const vaultBalance =
- 1837 [&env, &vaultAccount, issue = asset.
raw().
get<
Issue>()](
-
- 1839 auto const account = vaultAccount(keylet);
-
-
-
-
- 1844 env.lookup(issue.account).name()};
- 1845 auto amount = sle->getFieldAmount(sfBalance);
-
- 1847 if (account > issue.account)
-
- 1849 return {amount, env.lookup(issue.account).name()};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1866 Account
const& owner,
- 1867 Account
const& issuer,
-
-
-
-
-
- 1873 testcase(
"IOU cannot use different asset");
-
-
- 1876 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
- 1882 auto tx = [&, account = vaultAccount(keylet)]() {
-
- 1884 jv[jss::Account] = issuer.human();
-
- 1886 auto& ja = jv[jss::LimitAmount] =
-
- 1888 ja[jss::issuer] =
toBase58(account);
-
- 1890 jv[jss::TransactionType] = jss::TrustSet;
-
-
-
-
-
-
-
-
- 1899 auto tx = vault.deposit(
- 1900 {.depositor = issuer, .id = keylet.
key, .amount = foo(20)});
-
-
-
-
-
- 1906 auto tx = vault.withdraw(
- 1907 {.depositor = issuer, .id = keylet.
key, .amount = foo(20)});
-
-
-
-
- 1912 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
- 1918 Account
const& owner,
- 1919 Account
const& issuer,
- 1920 Account
const& charlie,
-
-
-
-
-
- 1926 testcase(
"IOU frozen trust line to vault account");
+
+
+
+
+
+
+ 1783 using namespace test::jtx;
+
+
+
+
+
+ 1789 Account
const& owner,
+ 1790 Account
const& issuer,
+ 1791 Account
const& charlie,
+
+
+
+
+
+
+
+ 1799 *
this, supported_amendments() | featureSingleAssetVault};
+ 1800 Account
const owner{
"owner"};
+ 1801 Account
const issuer{
"issuer"};
+ 1802 Account
const charlie{
"charlie"};
+
+ 1804 env.fund(XRP(1000), issuer, owner, charlie);
+
+
+
+
+ 1809 env.trust(asset(1000), owner);
+ 1810 env(pay(issuer, owner, asset(200)));
+ 1811 env(rate(issuer, 1.25));
+
+
+ 1814 auto const [tx, keylet] =
+ 1815 vault.create({.owner = owner, .asset = asset});
+
+
+
+ 1819 auto const vaultAccount =
+
+ 1821 return env.le(keylet)->at(sfAccount);
+
+
+ 1824 return env.le(keylet)->at(sfShareMPTID);
+
+ 1826 auto const vaultBalance =
+ 1827 [&env, &vaultAccount, issue = asset.
raw().
get<
Issue>()](
+
+ 1829 auto const account = vaultAccount(keylet);
+
+
+
+
+ 1834 env.lookup(issue.account).name()};
+ 1835 auto amount = sle->getFieldAmount(sfBalance);
+
+ 1837 if (account > issue.account)
+
+ 1839 return {amount, env.lookup(issue.account).name()};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1856 Account
const& owner,
+ 1857 Account
const& issuer,
+
+
+
+
+
+ 1863 testcase(
"IOU cannot use different asset");
+
+
+ 1866 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+
+ 1872 auto tx = [&, account = vaultAccount(keylet)]() {
+
+ 1874 jv[jss::Account] = issuer.human();
+
+ 1876 auto& ja = jv[jss::LimitAmount] =
+
+ 1878 ja[jss::issuer] =
toBase58(account);
+
+ 1880 jv[jss::TransactionType] = jss::TrustSet;
+
+
+
+
+
+
+
+
+ 1889 auto tx = vault.deposit(
+ 1890 {.depositor = issuer, .id = keylet.
key, .amount = foo(20)});
+
+
+
+
+
+ 1896 auto tx = vault.withdraw(
+ 1897 {.depositor = issuer, .id = keylet.
key, .amount = foo(20)});
+
+
+
+
+ 1902 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+ 1908 Account
const& owner,
+ 1909 Account
const& issuer,
+ 1910 Account
const& charlie,
+
+
+
+
+
+ 1916 testcase(
"IOU frozen trust line to vault account");
+
+ 1918 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 1923 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+ 1926 Asset const share =
Asset(issuanceId(keylet));
- 1928 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 1933 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
- 1936 Asset const share =
Asset(issuanceId(keylet));
-
-
- 1939 auto trustSet = [&, account = vaultAccount(keylet)]() {
-
- 1941 jv[jss::Account] = issuer.human();
-
- 1943 auto& ja = jv[jss::LimitAmount] =
-
- 1945 ja[jss::issuer] =
toBase58(account);
-
- 1947 jv[jss::TransactionType] = jss::TrustSet;
-
-
-
-
-
-
-
-
-
-
-
- 1959 auto tx = vault.deposit(
- 1960 {.depositor = owner,
-
- 1962 .amount = asset(80)});
-
-
-
-
- 1967 auto tx = vault.withdraw(
- 1968 {.depositor = owner,
-
- 1970 .amount = asset(100)});
-
-
-
- 1974 tx[sfDestination] = charlie.human();
-
-
-
-
-
-
- 1981 auto tx = vault.clawback(
-
-
-
- 1985 .amount = asset(50)});
-
-
-
-
-
-
-
-
-
-
- 1996 {.depositor = owner, .id = keylet.key, .amount = share(50)}));
-
- 1998 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
- 2004 Account
const& owner,
- 2005 Account
const& issuer,
- 2006 Account
const& charlie,
-
-
-
-
- 2011 auto vaultBalance) {
- 2012 testcase(
"IOU transfer fees not applied");
-
- 2014 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 2019 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
- 2023 Asset const share =
Asset(issuanceId(keylet));
-
-
- 2026 BEAST_EXPECT(env.balance(owner, issue) == asset(100));
- 2027 BEAST_EXPECT(vaultBalance(keylet) == asset(100));
+
+ 1929 auto trustSet = [&, account = vaultAccount(keylet)]() {
+
+ 1931 jv[jss::Account] = issuer.human();
+
+ 1933 auto& ja = jv[jss::LimitAmount] =
+
+ 1935 ja[jss::issuer] =
toBase58(account);
+
+ 1937 jv[jss::TransactionType] = jss::TrustSet;
+
+
+
+
+
+
+
+
+
+
+
+ 1949 auto tx = vault.deposit(
+ 1950 {.depositor = owner,
+
+ 1952 .amount = asset(80)});
+
+
+
+
+ 1957 auto tx = vault.withdraw(
+ 1958 {.depositor = owner,
+
+ 1960 .amount = asset(100)});
+
+
+
+ 1964 tx[sfDestination] = charlie.human();
+
+
+
+
+
+
+ 1971 auto tx = vault.clawback(
+
+
+
+ 1975 .amount = asset(50)});
+
+
+
+
+
+
+
+
+
+
+ 1986 {.depositor = owner, .id = keylet.key, .amount = share(50)}));
+
+ 1988 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+ 1994 Account
const& owner,
+ 1995 Account
const& issuer,
+ 1996 Account
const& charlie,
+
+
+
+
+ 2001 auto vaultBalance) {
+ 2002 testcase(
"IOU transfer fees not applied");
+
+ 2004 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 2009 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+
+ 2013 Asset const share =
Asset(issuanceId(keylet));
+
+
+ 2016 BEAST_EXPECT(env.balance(owner, issue) == asset(100));
+ 2017 BEAST_EXPECT(vaultBalance(keylet) == asset(100));
+
+
+ 2020 auto tx = vault.clawback(
+
+
+
+ 2024 .amount = asset(50)});
+
+
+
-
- 2030 auto tx = vault.clawback(
-
-
-
- 2034 .amount = asset(50)});
-
-
-
-
-
- 2040 BEAST_EXPECT(env.balance(owner, issue) == asset(100));
- 2041 BEAST_EXPECT(vaultBalance(keylet) == asset(50));
-
-
- 2044 {.depositor = owner, .id = keylet.key, .amount = share(20)}));
-
-
- 2047 BEAST_EXPECT(env.balance(owner, issue) == asset(120));
- 2048 BEAST_EXPECT(vaultBalance(keylet) == asset(30));
-
-
- 2051 auto tx = vault.withdraw(
- 2052 {.depositor = owner,
-
- 2054 .amount = share(30)});
- 2055 tx[sfDestination] = charlie.human();
-
-
-
-
- 2060 BEAST_EXPECT(env.balance(owner, issue) == asset(120));
- 2061 BEAST_EXPECT(env.balance(charlie, issue) == asset(30));
- 2062 BEAST_EXPECT(vaultBalance(keylet) == asset(0));
-
- 2064 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
- 2070 Account
const& owner,
- 2071 Account
const& issuer,
- 2072 Account
const& charlie,
-
-
-
-
- 2077 testcase(
"IOU frozen trust line to depositor");
-
- 2079 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 2084 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
-
- 2089 auto tx = vault.withdraw(
- 2090 {.depositor = owner,
-
- 2092 .amount = asset(10)});
- 2093 tx[sfDestination] = charlie.human();
-
-
- 2096 env(withdrawToCharlie);
-
-
-
-
-
-
- 2103 auto const withdraw = vault.withdraw(
- 2104 {.depositor = owner, .id = keylet.
key, .amount = asset(10)});
-
-
-
-
-
-
-
-
- 2113 auto tx = vault.deposit(
- 2114 {.depositor = owner,
-
- 2116 .amount = asset(10)});
-
-
-
-
-
- 2122 auto tx = vault.clawback(
-
-
-
- 2126 .amount = asset(0)});
-
-
-
-
- 2131 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
- 2137 Account
const& owner,
- 2138 Account
const& issuer,
- 2139 Account
const& charlie,
-
-
-
-
- 2144 testcase(
"IOU frozen trust line to 3rd party");
-
- 2146 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 2151 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
-
- 2156 auto tx = vault.withdraw(
- 2157 {.depositor = owner,
-
- 2159 .amount = asset(10)});
- 2160 tx[sfDestination] = charlie.human();
-
-
- 2163 env(withdrawToCharlie);
+
+ 2030 BEAST_EXPECT(env.balance(owner, issue) == asset(100));
+ 2031 BEAST_EXPECT(vaultBalance(keylet) == asset(50));
+
+
+ 2034 {.depositor = owner, .id = keylet.key, .amount = share(20)}));
+
+
+ 2037 BEAST_EXPECT(env.balance(owner, issue) == asset(120));
+ 2038 BEAST_EXPECT(vaultBalance(keylet) == asset(30));
+
+
+ 2041 auto tx = vault.withdraw(
+ 2042 {.depositor = owner,
+
+ 2044 .amount = share(30)});
+ 2045 tx[sfDestination] = charlie.human();
+
+
+
+
+ 2050 BEAST_EXPECT(env.balance(owner, issue) == asset(120));
+ 2051 BEAST_EXPECT(env.balance(charlie, issue) == asset(30));
+ 2052 BEAST_EXPECT(vaultBalance(keylet) == asset(0));
+
+ 2054 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+ 2060 Account
const& owner,
+ 2061 Account
const& issuer,
+ 2062 Account
const& charlie,
+
+
+
+
+ 2067 testcase(
"IOU frozen trust line to depositor");
+
+ 2069 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 2074 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+
+
+ 2079 auto tx = vault.withdraw(
+ 2080 {.depositor = owner,
+
+ 2082 .amount = asset(10)});
+ 2083 tx[sfDestination] = charlie.human();
+
+
+ 2086 env(withdrawToCharlie);
+
+
+
+
+
+
+ 2093 auto const withdraw = vault.withdraw(
+ 2094 {.depositor = owner, .id = keylet.
key, .amount = asset(10)});
+
+
+
+
+
+
+
+
+ 2103 auto tx = vault.deposit(
+ 2104 {.depositor = owner,
+
+ 2106 .amount = asset(10)});
+
+
+
+
+
+ 2112 auto tx = vault.clawback(
+
+
+
+ 2116 .amount = asset(0)});
+
+
+
+
+ 2121 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+ 2127 Account
const& owner,
+ 2128 Account
const& issuer,
+ 2129 Account
const& charlie,
+
+
+
+
+ 2134 testcase(
"IOU frozen trust line to 3rd party");
+
+ 2136 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 2141 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+
+
+ 2146 auto tx = vault.withdraw(
+ 2147 {.depositor = owner,
+
+ 2149 .amount = asset(10)});
+ 2150 tx[sfDestination] = charlie.human();
+
+
+ 2153 env(withdrawToCharlie);
+
+
+ 2156 env(trust(issuer, asset(0), charlie,
tfSetFreeze));
+
+
+
+ 2160 auto const withdraw = vault.withdraw(
+ 2161 {.depositor = owner, .id = keylet.
key, .amount = asset(10)});
+
+
-
- 2166 env(trust(issuer, asset(0), charlie,
tfSetFreeze));
+
+
-
- 2170 auto const withdraw = vault.withdraw(
- 2171 {.depositor = owner, .id = keylet.
key, .amount = asset(10)});
-
-
-
-
-
+
+
+
+
+ 2173 .amount = asset(0)}));
+
+
+ 2176 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
- 2183 .amount = asset(0)}));
-
-
- 2186 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
- 2192 Account
const& owner,
- 2193 Account
const& issuer,
- 2194 Account
const& charlie,
-
-
-
-
-
-
- 2201 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
- 2206 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
-
-
-
-
-
-
-
- 2214 auto tx = vault.withdraw(
- 2215 {.depositor = owner,
-
- 2217 .amount = asset(10)});
-
-
-
- 2221 tx[sfDestination] = charlie.human();
-
-
-
-
-
- 2227 {.depositor = owner,
-
- 2229 .amount = asset(10)});
-
-
-
-
-
-
-
-
-
- 2239 .amount = asset(0)}));
-
+
+
+
+
+ 2182 Account
const& owner,
+ 2183 Account
const& issuer,
+ 2184 Account
const& charlie,
+
+
+
+
+
+
+ 2191 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
+
+
+
+ 2196 {.depositor = owner, .id = keylet.key, .amount = asset(100)}));
+
+
+
+
+
+
+
+ 2204 auto tx = vault.withdraw(
+ 2205 {.depositor = owner,
+
+ 2207 .amount = asset(10)});
+
+
+
+ 2211 tx[sfDestination] = charlie.human();
+
+
+
+
+
+ 2217 {.depositor = owner,
+
+ 2219 .amount = asset(10)});
+
+
+
+
+
+
+
+
+
+ 2229 .amount = asset(0)}));
+
+
+ 2232 env(vault.del({.owner = owner, .id = keylet.key}));
+
+
+
+
+
+
+
+ 2240 using namespace test::jtx;
- 2242 env(vault.del({.owner = owner, .id = keylet.key}));
-
-
-
-
-
-
-
- 2250 using namespace test::jtx;
-
-
-
- 2254 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 2255 Account issuer{
"issuer"};
- 2256 Account owner{
"owner"};
- 2257 Account depositor{
"depositor"};
- 2258 Account charlie{
"charlie"};
- 2259 Account pdOwner{
"pdOwner"};
- 2260 Account credIssuer1{
"credIssuer1"};
- 2261 Account credIssuer2{
"credIssuer2"};
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ 2244 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 2245 Account issuer{
"issuer"};
+ 2246 Account owner{
"owner"};
+ 2247 Account depositor{
"depositor"};
+ 2248 Account charlie{
"charlie"};
+ 2249 Account pdOwner{
"pdOwner"};
+ 2250 Account credIssuer1{
"credIssuer1"};
+ 2251 Account credIssuer2{
"credIssuer2"};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2269 env.trust(asset(1000), owner);
+ 2270 env(pay(issuer, owner, asset(500)));
+ 2271 env.trust(asset(1000), depositor);
+ 2272 env(pay(issuer, depositor, asset(500)));
+ 2273 env.trust(asset(1000), charlie);
+ 2274 env(pay(issuer, charlie, asset(5)));
-
-
-
- 2279 env.trust(asset(1000), owner);
- 2280 env(pay(issuer, owner, asset(500)));
- 2281 env.trust(asset(1000), depositor);
- 2282 env(pay(issuer, depositor, asset(500)));
- 2283 env.trust(asset(1000), charlie);
- 2284 env(pay(issuer, charlie, asset(5)));
-
-
- 2287 auto [tx, keylet] = vault.create(
-
-
-
- 2291 BEAST_EXPECT(env.le(keylet));
-
-
- 2294 testcase(
"private vault owner can deposit");
- 2295 auto tx = vault.deposit(
- 2296 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
-
-
-
-
- 2301 testcase(
"private vault depositor not authorized yet");
- 2302 auto tx = vault.deposit(
- 2303 {.depositor = depositor,
-
- 2305 .amount = asset(50)});
-
-
+
+ 2277 auto [tx, keylet] = vault.create(
+
+
+
+ 2281 BEAST_EXPECT(env.le(keylet));
+
+
+ 2284 testcase(
"private vault owner can deposit");
+ 2285 auto tx = vault.deposit(
+ 2286 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
+
+
+
+
+ 2291 testcase(
"private vault depositor not authorized yet");
+ 2292 auto tx = vault.deposit(
+ 2293 {.depositor = depositor,
+
+ 2295 .amount = asset(50)});
+
+
+
+
+ 2300 testcase(
"private vault cannot set non-existing domain");
+ 2301 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 2307 testcase(
"private vault set domainId");
-
- 2310 testcase(
"private vault cannot set non-existing domain");
- 2311 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 2317 testcase(
"private vault set domainId");
+
+ 2310 pdomain::Credentials
const credentials1{
+ 2311 {.issuer = credIssuer1, .credType = credType}};
+
+ 2313 env(pdomain::setTx(pdOwner, credentials1));
+ 2314 auto const domainId1 = [&]() {
+
+ 2316 return pdomain::getNewDomain(env.meta());
+
-
- 2320 pdomain::Credentials
const credentials1{
- 2321 {.issuer = credIssuer1, .credType = credType}};
-
- 2323 env(pdomain::setTx(pdOwner, credentials1));
- 2324 auto const domainId1 = [&]() {
-
- 2326 return pdomain::getNewDomain(env.meta());
-
+ 2319 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
+
- 2329 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
+
+ 2330 pdomain::Credentials
const credentials{
+ 2331 {.issuer = credIssuer1, .credType = credType},
+ 2332 {.issuer = credIssuer2, .credType = credType}};
-
-
-
-
-
-
- 2340 pdomain::Credentials
const credentials{
- 2341 {.issuer = credIssuer1, .credType = credType},
- 2342 {.issuer = credIssuer2, .credType = credType}};
-
- 2344 env(pdomain::setTx(pdOwner, credentials));
- 2345 auto const domainId = [&]() {
-
- 2347 return pdomain::getNewDomain(env.meta());
-
-
- 2350 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
+ 2334 env(pdomain::setTx(pdOwner, credentials));
+ 2335 auto const domainId = [&]() {
+
+ 2337 return pdomain::getNewDomain(env.meta());
+
+
+ 2340 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+
+
+ 2348 testcase(
"private vault depositor still not authorized");
+ 2349 auto tx = vault.deposit(
+ 2350 {.depositor = depositor,
+
+ 2352 .amount = asset(50)});
+
+
-
- 2358 testcase(
"private vault depositor still not authorized");
- 2359 auto tx = vault.deposit(
- 2360 {.depositor = depositor,
-
- 2362 .amount = asset(50)});
-
-
-
-
- 2367 auto const credKeylet =
- 2368 credentials::keylet(depositor, credIssuer1, credType);
-
- 2370 testcase(
"private vault depositor now authorized");
- 2371 env(credentials::create(depositor, credIssuer1, credType));
- 2372 env(credentials::accept(depositor, credIssuer1, credType));
- 2373 env(credentials::create(charlie, credIssuer1, credType));
-
-
- 2376 auto credSle = env.le(credKeylet);
- 2377 BEAST_EXPECT(credSle !=
nullptr);
-
- 2379 auto tx = vault.deposit(
- 2380 {.depositor = depositor,
-
- 2382 .amount = asset(50)});
-
-
-
-
- 2387 {.depositor = charlie, .id = keylet.
key, .amount = asset(50)});
-
-
-
+ 2357 auto const credKeylet =
+ 2358 credentials::keylet(depositor, credIssuer1, credType);
+
+ 2360 testcase(
"private vault depositor now authorized");
+ 2361 env(credentials::create(depositor, credIssuer1, credType));
+ 2362 env(credentials::accept(depositor, credIssuer1, credType));
+ 2363 env(credentials::create(charlie, credIssuer1, credType));
+
+
+ 2366 auto credSle = env.le(credKeylet);
+ 2367 BEAST_EXPECT(credSle !=
nullptr);
+
+ 2369 auto tx = vault.deposit(
+ 2370 {.depositor = depositor,
+
+ 2372 .amount = asset(50)});
+
+
+
+
+ 2377 {.depositor = charlie, .id = keylet.
key, .amount = asset(50)});
+
+
+
+
+
+ 2383 testcase(
"private vault depositor lost authorization");
+ 2384 env(credentials::deleteCred(
+ 2385 credIssuer1, depositor, credIssuer1, credType));
+ 2386 env(credentials::deleteCred(
+ 2387 credIssuer1, charlie, credIssuer1, credType));
+
+ 2389 auto credSle = env.le(credKeylet);
+ 2390 BEAST_EXPECT(credSle ==
nullptr);
-
- 2393 testcase(
"private vault depositor lost authorization");
- 2394 env(credentials::deleteCred(
- 2395 credIssuer1, depositor, credIssuer1, credType));
- 2396 env(credentials::deleteCred(
- 2397 credIssuer1, charlie, credIssuer1, credType));
-
- 2399 auto credSle = env.le(credKeylet);
- 2400 BEAST_EXPECT(credSle ==
nullptr);
-
- 2402 auto tx = vault.deposit(
- 2403 {.depositor = depositor,
-
- 2405 .amount = asset(50)});
-
-
-
-
- 2410 auto const shares = [&env, keylet = keylet,
this]() ->
Asset {
- 2411 auto const vault = env.le(keylet);
- 2412 BEAST_EXPECT(vault !=
nullptr);
- 2413 return MPTIssue(vault->at(sfShareMPTID));
-
-
-
- 2417 testcase(
"private vault expired authorization");
- 2418 uint32_t
const closeTime = env.current()
-
- 2420 .parentCloseTime.time_since_epoch()
-
-
-
- 2424 credentials::create(depositor, credIssuer2, credType);
- 2425 tx0[sfExpiration] = closeTime + 20;
-
- 2427 tx0 = credentials::create(charlie, credIssuer2, credType);
- 2428 tx0[sfExpiration] = closeTime + 20;
-
-
-
- 2432 env(credentials::accept(depositor, credIssuer2, credType));
- 2433 env(credentials::accept(charlie, credIssuer2, credType));
-
-
-
-
- 2438 auto tx1 = vault.deposit(
- 2439 {.depositor = depositor,
-
- 2441 .amount = asset(50)});
-
+ 2392 auto tx = vault.deposit(
+ 2393 {.depositor = depositor,
+
+ 2395 .amount = asset(50)});
+
+
+
+
+ 2400 auto const shares = [&env, keylet = keylet,
this]() ->
Asset {
+ 2401 auto const vault = env.le(keylet);
+ 2402 BEAST_EXPECT(vault !=
nullptr);
+ 2403 return MPTIssue(vault->at(sfShareMPTID));
+
+
+
+ 2407 testcase(
"private vault expired authorization");
+ 2408 uint32_t
const closeTime = env.current()
+
+ 2410 .parentCloseTime.time_since_epoch()
+
+
+
+ 2414 credentials::create(depositor, credIssuer2, credType);
+ 2415 tx0[sfExpiration] = closeTime + 20;
+
+ 2417 tx0 = credentials::create(charlie, credIssuer2, credType);
+ 2418 tx0[sfExpiration] = closeTime + 20;
+
+
+
+ 2422 env(credentials::accept(depositor, credIssuer2, credType));
+ 2423 env(credentials::accept(charlie, credIssuer2, credType));
+
+
+
+
+ 2428 auto tx1 = vault.deposit(
+ 2429 {.depositor = depositor,
+
+ 2431 .amount = asset(50)});
+
+
+
+
+
+ 2437 BEAST_EXPECT(env.le(tokenKeylet) !=
nullptr);
+
+
+
+
+
-
-
-
- 2447 BEAST_EXPECT(env.le(tokenKeylet) !=
nullptr);
-
+
+
+ 2446 auto const credsKeylet =
+ 2447 credentials::keylet(depositor, credIssuer2, credType);
+ 2448 BEAST_EXPECT(env.le(credsKeylet) !=
nullptr);
-
-
-
-
-
-
- 2456 auto const credsKeylet =
- 2457 credentials::keylet(depositor, credIssuer2, credType);
- 2458 BEAST_EXPECT(env.le(credsKeylet) !=
nullptr);
+ 2450 auto tx2 = vault.deposit(
+ 2451 {.depositor = depositor,
+
+ 2453 .amount = asset(1)});
+
+
+
+ 2457 BEAST_EXPECT(env.le(credsKeylet) ==
nullptr);
+
- 2460 auto tx2 = vault.deposit(
- 2461 {.depositor = depositor,
-
- 2463 .amount = asset(1)});
-
-
-
- 2467 BEAST_EXPECT(env.le(credsKeylet) ==
nullptr);
-
-
-
- 2471 auto const credsKeylet =
- 2472 credentials::keylet(charlie, credIssuer2, credType);
- 2473 BEAST_EXPECT(env.le(credsKeylet) !=
nullptr);
-
-
+
+ 2461 auto const credsKeylet =
+ 2462 credentials::keylet(charlie, credIssuer2, credType);
+ 2463 BEAST_EXPECT(env.le(credsKeylet) !=
nullptr);
+
+
+ 2466 BEAST_EXPECT(env.le(tokenKeylet) ==
nullptr);
+
+ 2468 auto tx3 = vault.deposit(
+ 2469 {.depositor = charlie,
+
+ 2471 .amount = asset(2)});
+
+
+
+ 2475 BEAST_EXPECT(env.le(credsKeylet) ==
nullptr);
2476 BEAST_EXPECT(env.le(tokenKeylet) ==
nullptr);
-
- 2478 auto tx3 = vault.deposit(
- 2479 {.depositor = charlie,
-
- 2481 .amount = asset(2)});
-
-
-
- 2485 BEAST_EXPECT(env.le(credsKeylet) ==
nullptr);
- 2486 BEAST_EXPECT(env.le(tokenKeylet) ==
nullptr);
-
-
-
-
- 2491 testcase(
"private vault reset domainId");
- 2492 auto tx = vault.set({.owner = owner, .id = keylet.
key});
- 2493 tx[sfDomainID] =
"0";
-
-
-
-
- 2498 {.depositor = depositor,
-
- 2500 .amount = asset(50)});
-
-
-
- 2504 tx = vault.withdraw(
- 2505 {.depositor = depositor,
-
- 2507 .amount = asset(50)});
-
-
- 2510 tx = vault.clawback(
-
-
- 2513 .holder = depositor,
- 2514 .amount = asset(0)});
-
-
- 2517 tx = vault.clawback(
-
-
-
- 2521 .amount = asset(0)});
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2535 using namespace test::jtx;
-
-
-
- 2539 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 2540 Account owner{
"owner"};
- 2541 Account depositor{
"depositor"};
- 2542 Account alice{
"charlie"};
-
-
- 2545 env.fund(XRP(100000), owner, depositor, alice);
-
-
-
- 2549 auto [tx, keylet] = vault.create(
-
-
-
+
+
+
+
+ 2481 testcase(
"private vault reset domainId");
+ 2482 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+ 2483 tx[sfDomainID] =
"0";
+
+
+
+
+ 2488 {.depositor = depositor,
+
+ 2490 .amount = asset(50)});
+
+
+
+ 2494 tx = vault.withdraw(
+ 2495 {.depositor = depositor,
+
+ 2497 .amount = asset(50)});
+
+
+ 2500 tx = vault.clawback(
+
+
+ 2503 .holder = depositor,
+ 2504 .amount = asset(0)});
+
+
+ 2507 tx = vault.clawback(
+
+
+
+ 2511 .amount = asset(0)});
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2525 using namespace test::jtx;
+
+
+
+ 2529 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 2530 Account owner{
"owner"};
+ 2531 Account depositor{
"depositor"};
+ 2532 Account alice{
"charlie"};
+
+
+ 2535 env.fund(XRP(100000), owner, depositor, alice);
+
+
+
+ 2539 auto [tx, keylet] = vault.create(
+
+
+
+
+ 2544 auto const [vaultAccount, issuanceId] =
+
+ 2546 auto const vault = env.le(keylet);
+ 2547 BEAST_EXPECT(vault !=
nullptr);
+ 2548 return {vault->at(sfAccount), vault->at(sfShareMPTID)};
+
+
+
+
- 2554 auto const [vaultAccount, issuanceId] =
-
- 2556 auto const vault = env.le(keylet);
- 2557 BEAST_EXPECT(vault !=
nullptr);
- 2558 return {vault->at(sfAccount), vault->at(sfShareMPTID)};
-
-
-
-
-
-
- 2565 testcase(
"private XRP vault owner can deposit");
- 2566 auto tx = vault.deposit(
- 2567 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
-
-
-
-
- 2572 testcase(
"private XRP vault cannot pay shares to depositor yet");
- 2573 env(pay(owner, depositor, shares(1)), ter{
tecNO_AUTH});
-
-
-
- 2577 testcase(
"private XRP vault depositor not authorized yet");
- 2578 auto tx = vault.deposit(
- 2579 {.depositor = depositor,
-
- 2581 .amount = asset(50)});
-
-
-
-
- 2586 testcase(
"private XRP vault set DomainID");
- 2587 pdomain::Credentials
const credentials{
- 2588 {.issuer = owner, .credType = credType}};
-
- 2590 env(pdomain::setTx(owner, credentials));
- 2591 auto const domainId = [&]() {
-
- 2593 return pdomain::getNewDomain(env.meta());
-
-
- 2596 auto tx = vault.set({.owner = owner, .id = keylet.
key});
-
-
-
-
-
- 2602 auto const credKeylet = credentials::keylet(depositor, owner, credType);
-
- 2604 testcase(
"private XRP vault depositor now authorized");
- 2605 env(credentials::create(depositor, owner, credType));
- 2606 env(credentials::accept(depositor, owner, credType));
-
-
- 2609 BEAST_EXPECT(env.le(credKeylet));
- 2610 auto tx = vault.deposit(
- 2611 {.depositor = depositor,
-
- 2613 .amount = asset(50)});
-
-
-
-
-
- 2619 testcase(
"private XRP vault can pay shares to depositor");
- 2620 env(pay(owner, depositor, shares(1)));
-
-
-
- 2624 testcase(
"private XRP vault cannot pay shares to 3rd party");
-
- 2626 jv[sfAccount] = alice.human();
- 2627 jv[sfTransactionType] = jss::MPTokenAuthorize;
- 2628 jv[sfMPTokenIssuanceID] =
to_string(issuanceId);
-
-
-
- 2632 env(pay(owner, alice, shares(1)), ter{
tecNO_AUTH});
-
-
-
-
-
-
- 2639 using namespace test::jtx;
-
- 2641 testcase(
"failed pseudo-account allocation");
- 2642 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 2643 Account
const owner{
"owner"};
-
- 2645 env.fund(XRP(1000), owner);
-
- 2647 auto const keylet =
keylet::vault(owner.id(), env.seq(owner));
- 2648 for (
int i = 0; i < 256; ++i)
-
-
-
-
- 2653 env(pay(env.master.id(), accountId, XRP(1000)),
-
-
-
-
-
- 2659 auto [tx, keylet1] =
- 2660 vault.create({.owner = owner, .asset =
xrpIssue()});
- 2661 BEAST_EXPECT(keylet.
key == keylet1.key);
-
-
-
-
-
-
- 2668 using namespace test::jtx;
-
-
- 2671 Env env{*
this, supported_amendments() | featureSingleAssetVault};
- 2672 Account
const owner{
"owner"};
- 2673 Account
const issuer{
"issuer"};
-
- 2675 env.fund(XRP(1000), issuer, owner);
+
+ 2555 testcase(
"private XRP vault owner can deposit");
+ 2556 auto tx = vault.deposit(
+ 2557 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
+
+
+
+
+ 2562 testcase(
"private XRP vault cannot pay shares to depositor yet");
+ 2563 env(pay(owner, depositor, shares(1)), ter{
tecNO_AUTH});
+
+
+
+ 2567 testcase(
"private XRP vault depositor not authorized yet");
+ 2568 auto tx = vault.deposit(
+ 2569 {.depositor = depositor,
+
+ 2571 .amount = asset(50)});
+
+
+
+
+ 2576 testcase(
"private XRP vault set DomainID");
+ 2577 pdomain::Credentials
const credentials{
+ 2578 {.issuer = owner, .credType = credType}};
+
+ 2580 env(pdomain::setTx(owner, credentials));
+ 2581 auto const domainId = [&]() {
+
+ 2583 return pdomain::getNewDomain(env.meta());
+
+
+ 2586 auto tx = vault.set({.owner = owner, .id = keylet.
key});
+
+
+
+
+
+ 2592 auto const credKeylet = credentials::keylet(depositor, owner, credType);
+
+ 2594 testcase(
"private XRP vault depositor now authorized");
+ 2595 env(credentials::create(depositor, owner, credType));
+ 2596 env(credentials::accept(depositor, owner, credType));
+
+
+ 2599 BEAST_EXPECT(env.le(credKeylet));
+ 2600 auto tx = vault.deposit(
+ 2601 {.depositor = depositor,
+
+ 2603 .amount = asset(50)});
+
+
+
+
+
+ 2609 testcase(
"private XRP vault can pay shares to depositor");
+ 2610 env(pay(owner, depositor, shares(1)));
+
+
+
+ 2614 testcase(
"private XRP vault cannot pay shares to 3rd party");
+
+ 2616 jv[sfAccount] = alice.human();
+ 2617 jv[sfTransactionType] = jss::MPTokenAuthorize;
+ 2618 jv[sfMPTokenIssuanceID] =
to_string(issuanceId);
+
+
+
+ 2622 env(pay(owner, alice, shares(1)), ter{
tecNO_AUTH});
+
+
+
+
+
+
+ 2629 using namespace test::jtx;
+
+ 2631 testcase(
"failed pseudo-account allocation");
+ 2632 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 2633 Account
const owner{
"owner"};
+
+ 2635 env.fund(XRP(1000), owner);
+
+ 2637 auto const keylet =
keylet::vault(owner.id(), env.seq(owner));
+ 2638 for (
int i = 0; i < 256; ++i)
+
+
+
+
+ 2643 env(pay(env.master.id(), accountId, XRP(1000)),
+
+
+
+
+
+ 2649 auto [tx, keylet1] =
+ 2650 vault.create({.owner = owner, .asset =
xrpIssue()});
+ 2651 BEAST_EXPECT(keylet.
key == keylet1.key);
+
+
+
+
+
+
+ 2658 using namespace test::jtx;
+
+
+ 2661 Env env{*
this, supported_amendments() | featureSingleAssetVault};
+ 2662 Account
const owner{
"owner"};
+ 2663 Account
const issuer{
"issuer"};
+
+ 2665 env.fund(XRP(1000), issuer, owner);
+
+
+
+ 2669 env.trust(asset(1000), owner);
+ 2670 env(pay(issuer, owner, asset(200)));
+
+
+ 2673 auto const sequence = env.seq(owner);
+ 2674 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
+
-
- 2679 env.trust(asset(1000), owner);
- 2680 env(pay(issuer, owner, asset(200)));
-
-
- 2683 auto const sequence = env.seq(owner);
- 2684 auto [tx, keylet] = vault.create({.owner = owner, .asset = asset});
-
-
-
-
-
- 2690 auto tx1 = vault.deposit(
- 2691 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
-
-
- 2694 auto tx2 = vault.set({.owner = owner, .id = keylet.
key});
- 2695 tx2[sfAssetsMaximum] = asset(1000).number();
-
-
-
-
- 2700 auto const sleVault = [&env, keylet = keylet,
this]() {
- 2701 auto const vault = env.le(keylet);
- 2702 BEAST_EXPECT(vault !=
nullptr);
-
-
-
- 2706 auto const check = [&, keylet = keylet, sle = sleVault,
this](
-
-
- 2709 BEAST_EXPECT(vault.isObject());
-
- 2711 constexpr auto checkString =
-
- 2713 return node.isMember(field.fieldName) &&
- 2714 node[field.fieldName].isString() &&
- 2715 node[field.fieldName] == v;
-
- 2717 constexpr auto checkObject =
-
- 2719 return node.isMember(field.fieldName) &&
- 2720 node[field.fieldName].isObject() &&
- 2721 node[field.fieldName] == v;
-
- 2723 constexpr auto checkInt =
- 2724 [](
auto& node,
SField const& field,
int v) ->
bool {
- 2725 return node.isMember(field.fieldName) &&
- 2726 ((node[field.fieldName].isInt() &&
- 2727 node[field.fieldName] ==
Json::Int(v)) ||
- 2728 (node[field.fieldName].isUInt() &&
-
-
-
- 2732 BEAST_EXPECT(vault[
"LedgerEntryType"].asString() ==
"Vault");
- 2733 BEAST_EXPECT(vault[jss::index].asString() ==
strHex(keylet.
key));
- 2734 BEAST_EXPECT(checkInt(vault, sfFlags, 0));
-
-
-
- 2738 checkString(vault, sfAccount,
toBase58(sle->at(sfAccount))));
-
- 2740 checkObject(vault, sfAsset,
to_json(sle->at(sfAsset))));
- 2741 BEAST_EXPECT(checkString(vault, sfAssetsAvailable,
"50"));
- 2742 BEAST_EXPECT(checkString(vault, sfAssetsMaximum,
"1000"));
- 2743 BEAST_EXPECT(checkString(vault, sfAssetsTotal,
"50"));
- 2744 BEAST_EXPECT(checkString(vault, sfLossUnrealized,
"0"));
-
- 2746 auto const strShareID =
strHex(sle->at(sfShareMPTID));
- 2747 BEAST_EXPECT(checkString(vault, sfShareMPTID, strShareID));
- 2748 BEAST_EXPECT(checkString(vault, sfOwner,
toBase58(owner.id())));
- 2749 BEAST_EXPECT(checkInt(vault, sfSequence, sequence));
- 2750 BEAST_EXPECT(checkInt(
-
-
- 2753 if (issuance.isObject())
-
-
- 2756 issuance[
"LedgerEntryType"].asString() ==
-
-
- 2759 issuance[jss::mpt_issuance_id].asString() == strShareID);
- 2760 BEAST_EXPECT(checkInt(issuance, sfSequence, 1));
- 2761 BEAST_EXPECT(checkInt(
-
-
-
- 2765 BEAST_EXPECT(checkString(issuance, sfOutstandingAmount,
"50"));
-
-
-
-
- 2770 testcase(
"RPC ledger_entry selected by key");
-
- 2772 jvParams[jss::ledger_index] = jss::validated;
- 2773 jvParams[jss::vault] =
strHex(keylet.
key);
- 2774 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2776 BEAST_EXPECT(!jvVault[jss::result].isMember(jss::error));
- 2777 BEAST_EXPECT(jvVault[jss::result].isMember(jss::node));
- 2778 check(jvVault[jss::result][jss::node]);
-
-
-
- 2782 testcase(
"RPC ledger_entry selected by owner and seq");
-
- 2784 jvParams[jss::ledger_index] = jss::validated;
- 2785 jvParams[jss::vault][jss::owner] = owner.human();
- 2786 jvParams[jss::vault][jss::seq] = sequence;
- 2787 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2789 BEAST_EXPECT(!jvVault[jss::result].isMember(jss::error));
- 2790 BEAST_EXPECT(jvVault[jss::result].isMember(jss::node));
- 2791 check(jvVault[jss::result][jss::node]);
+
+
+ 2680 auto tx1 = vault.deposit(
+ 2681 {.depositor = owner, .id = keylet.
key, .amount = asset(50)});
+
+
+ 2684 auto tx2 = vault.set({.owner = owner, .id = keylet.
key});
+ 2685 tx2[sfAssetsMaximum] = asset(1000).number();
+
+
+
+
+ 2690 auto const sleVault = [&env, keylet = keylet,
this]() {
+ 2691 auto const vault = env.le(keylet);
+ 2692 BEAST_EXPECT(vault !=
nullptr);
+
+
+
+ 2696 auto const check = [&, keylet = keylet, sle = sleVault,
this](
+
+
+ 2699 BEAST_EXPECT(vault.isObject());
+
+ 2701 constexpr auto checkString =
+
+ 2703 return node.isMember(field.fieldName) &&
+ 2704 node[field.fieldName].isString() &&
+ 2705 node[field.fieldName] == v;
+
+ 2707 constexpr auto checkObject =
+
+ 2709 return node.isMember(field.fieldName) &&
+ 2710 node[field.fieldName].isObject() &&
+ 2711 node[field.fieldName] == v;
+
+ 2713 constexpr auto checkInt =
+ 2714 [](
auto& node,
SField const& field,
int v) ->
bool {
+ 2715 return node.isMember(field.fieldName) &&
+ 2716 ((node[field.fieldName].isInt() &&
+ 2717 node[field.fieldName] ==
Json::Int(v)) ||
+ 2718 (node[field.fieldName].isUInt() &&
+
+
+
+ 2722 BEAST_EXPECT(vault[
"LedgerEntryType"].asString() ==
"Vault");
+ 2723 BEAST_EXPECT(vault[jss::index].asString() ==
strHex(keylet.
key));
+ 2724 BEAST_EXPECT(checkInt(vault, sfFlags, 0));
+
+
+
+ 2728 checkString(vault, sfAccount,
toBase58(sle->at(sfAccount))));
+
+ 2730 checkObject(vault, sfAsset,
to_json(sle->at(sfAsset))));
+ 2731 BEAST_EXPECT(checkString(vault, sfAssetsAvailable,
"50"));
+ 2732 BEAST_EXPECT(checkString(vault, sfAssetsMaximum,
"1000"));
+ 2733 BEAST_EXPECT(checkString(vault, sfAssetsTotal,
"50"));
+ 2734 BEAST_EXPECT(checkString(vault, sfLossUnrealized,
"0"));
+
+ 2736 auto const strShareID =
strHex(sle->at(sfShareMPTID));
+ 2737 BEAST_EXPECT(checkString(vault, sfShareMPTID, strShareID));
+ 2738 BEAST_EXPECT(checkString(vault, sfOwner,
toBase58(owner.id())));
+ 2739 BEAST_EXPECT(checkInt(vault, sfSequence, sequence));
+ 2740 BEAST_EXPECT(checkInt(
+
+
+ 2743 if (issuance.isObject())
+
+
+ 2746 issuance[
"LedgerEntryType"].asString() ==
+
+
+ 2749 issuance[jss::mpt_issuance_id].asString() == strShareID);
+ 2750 BEAST_EXPECT(checkInt(issuance, sfSequence, 1));
+ 2751 BEAST_EXPECT(checkInt(
+
+
+
+ 2755 BEAST_EXPECT(checkString(issuance, sfOutstandingAmount,
"50"));
+
+
+
+
+ 2760 testcase(
"RPC ledger_entry selected by key");
+
+ 2762 jvParams[jss::ledger_index] = jss::validated;
+ 2763 jvParams[jss::vault] =
strHex(keylet.
key);
+ 2764 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2766 BEAST_EXPECT(!jvVault[jss::result].isMember(jss::error));
+ 2767 BEAST_EXPECT(jvVault[jss::result].isMember(jss::node));
+ 2768 check(jvVault[jss::result][jss::node]);
+
+
+
+ 2772 testcase(
"RPC ledger_entry selected by owner and seq");
+
+ 2774 jvParams[jss::ledger_index] = jss::validated;
+ 2775 jvParams[jss::vault][jss::owner] = owner.human();
+ 2776 jvParams[jss::vault][jss::seq] = sequence;
+ 2777 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2779 BEAST_EXPECT(!jvVault[jss::result].isMember(jss::error));
+ 2780 BEAST_EXPECT(jvVault[jss::result].isMember(jss::node));
+ 2781 check(jvVault[jss::result][jss::node]);
+
+
+
+ 2785 testcase(
"RPC ledger_entry cannot find vault by key");
+
+ 2787 jvParams[jss::ledger_index] = jss::validated;
+
+ 2789 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2791 jvVault[jss::result][jss::error].asString() ==
"entryNotFound");
- 2795 testcase(
"RPC ledger_entry cannot find vault by key");
+ 2795 testcase(
"RPC ledger_entry cannot find vault by owner and seq");
2797 jvParams[jss::ledger_index] = jss::validated;
-
- 2799 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2801 jvVault[jss::result][jss::error].asString() ==
"entryNotFound");
-
-
-
- 2805 testcase(
"RPC ledger_entry cannot find vault by owner and seq");
-
- 2807 jvParams[jss::ledger_index] = jss::validated;
- 2808 jvParams[jss::vault][jss::owner] = issuer.human();
- 2809 jvParams[jss::vault][jss::seq] = 1'000'000;
+ 2798 jvParams[jss::vault][jss::owner] = issuer.human();
+ 2799 jvParams[jss::vault][jss::seq] = 1'000'000;
+ 2800 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2802 jvVault[jss::result][jss::error].asString() ==
"entryNotFound");
+
+
+
+ 2806 testcase(
"RPC ledger_entry malformed key");
+
+ 2808 jvParams[jss::ledger_index] = jss::validated;
+ 2809 jvParams[jss::vault] = 42;
2810 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
- 2812 jvVault[jss::result][jss::error].asString() ==
"entryNotFound");
-
-
-
- 2816 testcase(
"RPC ledger_entry malformed key");
-
- 2818 jvParams[jss::ledger_index] = jss::validated;
- 2819 jvParams[jss::vault] = 42;
- 2820 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2822 jvVault[jss::result][jss::error].asString() ==
- 2823 "malformedRequest");
-
-
-
- 2827 testcase(
"RPC ledger_entry malformed owner");
-
- 2829 jvParams[jss::ledger_index] = jss::validated;
- 2830 jvParams[jss::vault][jss::owner] = 42;
- 2831 jvParams[jss::vault][jss::seq] = sequence;
- 2832 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2834 jvVault[jss::result][jss::error].asString() ==
-
-
-
-
- 2839 testcase(
"RPC ledger_entry malformed seq");
-
- 2841 jvParams[jss::ledger_index] = jss::validated;
- 2842 jvParams[jss::vault][jss::owner] = issuer.human();
- 2843 jvParams[jss::vault][jss::seq] =
"foo";
- 2844 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2846 jvVault[jss::result][jss::error].asString() ==
- 2847 "malformedRequest");
-
-
-
- 2851 testcase(
"RPC ledger_entry zero seq");
-
- 2853 jvParams[jss::ledger_index] = jss::validated;
- 2854 jvParams[jss::vault][jss::owner] = issuer.human();
- 2855 jvParams[jss::vault][jss::seq] = 0;
- 2856 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2858 jvVault[jss::result][jss::error].asString() ==
- 2859 "malformedRequest");
-
-
-
- 2863 testcase(
"RPC ledger_entry negative seq");
-
- 2865 jvParams[jss::ledger_index] = jss::validated;
- 2866 jvParams[jss::vault][jss::owner] = issuer.human();
- 2867 jvParams[jss::vault][jss::seq] = -1;
- 2868 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2870 jvVault[jss::result][jss::error].asString() ==
- 2871 "malformedRequest");
-
-
-
- 2875 testcase(
"RPC ledger_entry oversized seq");
-
- 2877 jvParams[jss::ledger_index] = jss::validated;
- 2878 jvParams[jss::vault][jss::owner] = issuer.human();
- 2879 jvParams[jss::vault][jss::seq] = 1e20;
- 2880 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2882 jvVault[jss::result][jss::error].asString() ==
- 2883 "malformedRequest");
-
-
-
- 2887 testcase(
"RPC ledger_entry bool seq");
-
- 2889 jvParams[jss::ledger_index] = jss::validated;
- 2890 jvParams[jss::vault][jss::owner] = issuer.human();
- 2891 jvParams[jss::vault][jss::seq] =
true;
- 2892 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
-
- 2894 jvVault[jss::result][jss::error].asString() ==
- 2895 "malformedRequest");
-
-
-
-
+ 2812 jvVault[jss::result][jss::error].asString() ==
+ 2813 "malformedRequest");
+
+
+
+ 2817 testcase(
"RPC ledger_entry malformed owner");
+
+ 2819 jvParams[jss::ledger_index] = jss::validated;
+ 2820 jvParams[jss::vault][jss::owner] = 42;
+ 2821 jvParams[jss::vault][jss::seq] = sequence;
+ 2822 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2824 jvVault[jss::result][jss::error].asString() ==
+
+
+
+
+ 2829 testcase(
"RPC ledger_entry malformed seq");
+
+ 2831 jvParams[jss::ledger_index] = jss::validated;
+ 2832 jvParams[jss::vault][jss::owner] = issuer.human();
+ 2833 jvParams[jss::vault][jss::seq] =
"foo";
+ 2834 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2836 jvVault[jss::result][jss::error].asString() ==
+ 2837 "malformedRequest");
+
+
+
+ 2841 testcase(
"RPC ledger_entry zero seq");
+
+ 2843 jvParams[jss::ledger_index] = jss::validated;
+ 2844 jvParams[jss::vault][jss::owner] = issuer.human();
+ 2845 jvParams[jss::vault][jss::seq] = 0;
+ 2846 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2848 jvVault[jss::result][jss::error].asString() ==
+ 2849 "malformedRequest");
+
+
+
+ 2853 testcase(
"RPC ledger_entry negative seq");
+
+ 2855 jvParams[jss::ledger_index] = jss::validated;
+ 2856 jvParams[jss::vault][jss::owner] = issuer.human();
+ 2857 jvParams[jss::vault][jss::seq] = -1;
+ 2858 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2860 jvVault[jss::result][jss::error].asString() ==
+ 2861 "malformedRequest");
+
+
+
+ 2865 testcase(
"RPC ledger_entry oversized seq");
+
+ 2867 jvParams[jss::ledger_index] = jss::validated;
+ 2868 jvParams[jss::vault][jss::owner] = issuer.human();
+ 2869 jvParams[jss::vault][jss::seq] = 1e20;
+ 2870 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2872 jvVault[jss::result][jss::error].asString() ==
+ 2873 "malformedRequest");
+
+
+
+ 2877 testcase(
"RPC ledger_entry bool seq");
+
+ 2879 jvParams[jss::ledger_index] = jss::validated;
+ 2880 jvParams[jss::vault][jss::owner] = issuer.human();
+ 2881 jvParams[jss::vault][jss::seq] =
true;
+ 2882 auto jvVault = env.rpc(
"json",
"ledger_entry",
to_string(jvParams));
+
+ 2884 jvVault[jss::result][jss::error].asString() ==
+ 2885 "malformedRequest");
+
+
+
+
+
+
+ 2892 jvParams[jss::account] = owner.human();
+ 2893 jvParams[jss::type] = jss::vault;
+
+ 2895 "json",
"account_objects",
to_string(jvParams))[jss::result];
+
+ 2897 BEAST_EXPECT(jv[jss::account_objects].size() == 1);
+ 2898 check(jv[jss::account_objects][0u]);
+
-
- 2902 jvParams[jss::account] = owner.human();
- 2903 jvParams[jss::type] = jss::vault;
-
- 2905 "json",
"account_objects",
to_string(jvParams))[jss::result];
-
- 2907 BEAST_EXPECT(jv[jss::account_objects].size() == 1);
- 2908 check(jv[jss::account_objects][0u]);
-
-
-
-
+
+
+
+
+ 2905 jvParams[jss::ledger_index] = jss::validated;
+ 2906 jvParams[jss::binary] =
false;
+ 2907 jvParams[jss::type] = jss::vault;
+
+ 2909 env.rpc(
"json",
"ledger_data",
to_string(jvParams));
+ 2910 BEAST_EXPECT(jv[jss::result][jss::state].size() == 1);
+ 2911 check(jv[jss::result][jss::state][0u]);
+
-
- 2915 jvParams[jss::ledger_index] = jss::validated;
- 2916 jvParams[jss::binary] =
false;
- 2917 jvParams[jss::type] = jss::vault;
-
- 2919 env.rpc(
"json",
"ledger_data",
to_string(jvParams));
- 2920 BEAST_EXPECT(jv[jss::result][jss::state].size() == 1);
- 2921 check(jv[jss::result][jss::state][0u]);
-
-
-
- 2925 testcase(
"RPC vault_info command line");
-
- 2927 env.rpc(
"vault_info",
strHex(keylet.
key),
"validated");
-
- 2929 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
- 2930 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
-
- 2932 jv[jss::result][jss::vault],
- 2933 jv[jss::result][jss::vault][jss::shares]);
-
-
-
-
-
- 2939 jvParams[jss::ledger_index] = jss::validated;
- 2940 jvParams[jss::vault_id] =
strHex(keylet.
key);
- 2941 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 2943 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
- 2944 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
-
- 2946 jv[jss::result][jss::vault],
- 2947 jv[jss::result][jss::vault][jss::shares]);
+
+ 2915 testcase(
"RPC vault_info command line");
+
+ 2917 env.rpc(
"vault_info",
strHex(keylet.
key),
"validated");
+
+ 2919 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
+ 2920 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
+
+ 2922 jv[jss::result][jss::vault],
+ 2923 jv[jss::result][jss::vault][jss::shares]);
+
+
+
+
+
+ 2929 jvParams[jss::ledger_index] = jss::validated;
+ 2930 jvParams[jss::vault_id] =
strHex(keylet.
key);
+ 2931 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 2933 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
+ 2934 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
+
+ 2936 jv[jss::result][jss::vault],
+ 2937 jv[jss::result][jss::vault][jss::shares]);
+
+
+
+ 2941 testcase(
"RPC vault_info invalid vault_id");
+
+ 2943 jvParams[jss::ledger_index] = jss::validated;
+ 2944 jvParams[jss::vault_id] =
"foobar";
+ 2945 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 2947 jv[jss::result][jss::error].asString() ==
"malformedRequest");
- 2951 testcase(
"RPC vault_info invalid vault_id");
+ 2951 testcase(
"RPC vault_info json invalid index");
2953 jvParams[jss::ledger_index] = jss::validated;
- 2954 jvParams[jss::vault_id] =
"foobar";
+ 2954 jvParams[jss::vault_id] = 0;
2955 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
2957 jv[jss::result][jss::error].asString() ==
"malformedRequest");
- 2961 testcase(
"RPC vault_info json invalid index");
+ 2961 testcase(
"RPC vault_info json by owner and sequence");
2963 jvParams[jss::ledger_index] = jss::validated;
- 2964 jvParams[jss::vault_id] = 0;
- 2965 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 2967 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 2971 testcase(
"RPC vault_info json by owner and sequence");
-
- 2973 jvParams[jss::ledger_index] = jss::validated;
- 2974 jvParams[jss::owner] = owner.human();
- 2975 jvParams[jss::seq] = sequence;
- 2976 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 2978 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
- 2979 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
-
- 2981 jv[jss::result][jss::vault],
- 2982 jv[jss::result][jss::vault][jss::shares]);
-
-
-
- 2986 testcase(
"RPC vault_info json malformed sequence");
-
- 2988 jvParams[jss::ledger_index] = jss::validated;
- 2989 jvParams[jss::owner] = owner.human();
- 2990 jvParams[jss::seq] =
"foobar";
- 2991 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 2993 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 2997 testcase(
"RPC vault_info json invalid sequence");
-
- 2999 jvParams[jss::ledger_index] = jss::validated;
- 3000 jvParams[jss::owner] = owner.human();
- 3001 jvParams[jss::seq] = 0;
- 3002 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3004 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3008 testcase(
"RPC vault_info json negative sequence");
-
- 3010 jvParams[jss::ledger_index] = jss::validated;
- 3011 jvParams[jss::owner] = owner.human();
- 3012 jvParams[jss::seq] = -1;
- 3013 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3015 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3019 testcase(
"RPC vault_info json oversized sequence");
-
- 3021 jvParams[jss::ledger_index] = jss::validated;
- 3022 jvParams[jss::owner] = owner.human();
- 3023 jvParams[jss::seq] = 1e20;
- 3024 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3026 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3030 testcase(
"RPC vault_info json bool sequence");
-
- 3032 jvParams[jss::ledger_index] = jss::validated;
- 3033 jvParams[jss::owner] = owner.human();
- 3034 jvParams[jss::seq] =
true;
- 3035 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3037 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3041 testcase(
"RPC vault_info json malformed owner");
-
- 3043 jvParams[jss::ledger_index] = jss::validated;
- 3044 jvParams[jss::owner] =
"foobar";
- 3045 jvParams[jss::seq] = sequence;
+ 2964 jvParams[jss::owner] = owner.human();
+ 2965 jvParams[jss::seq] = sequence;
+ 2966 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 2968 BEAST_EXPECT(!jv[jss::result].isMember(jss::error));
+ 2969 BEAST_EXPECT(jv[jss::result].isMember(jss::vault));
+
+ 2971 jv[jss::result][jss::vault],
+ 2972 jv[jss::result][jss::vault][jss::shares]);
+
+
+
+ 2976 testcase(
"RPC vault_info json malformed sequence");
+
+ 2978 jvParams[jss::ledger_index] = jss::validated;
+ 2979 jvParams[jss::owner] = owner.human();
+ 2980 jvParams[jss::seq] =
"foobar";
+ 2981 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 2983 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 2987 testcase(
"RPC vault_info json invalid sequence");
+
+ 2989 jvParams[jss::ledger_index] = jss::validated;
+ 2990 jvParams[jss::owner] = owner.human();
+ 2991 jvParams[jss::seq] = 0;
+ 2992 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 2994 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 2998 testcase(
"RPC vault_info json negative sequence");
+
+ 3000 jvParams[jss::ledger_index] = jss::validated;
+ 3001 jvParams[jss::owner] = owner.human();
+ 3002 jvParams[jss::seq] = -1;
+ 3003 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 3005 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 3009 testcase(
"RPC vault_info json oversized sequence");
+
+ 3011 jvParams[jss::ledger_index] = jss::validated;
+ 3012 jvParams[jss::owner] = owner.human();
+ 3013 jvParams[jss::seq] = 1e20;
+ 3014 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 3016 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 3020 testcase(
"RPC vault_info json bool sequence");
+
+ 3022 jvParams[jss::ledger_index] = jss::validated;
+ 3023 jvParams[jss::owner] = owner.human();
+ 3024 jvParams[jss::seq] =
true;
+ 3025 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 3027 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 3031 testcase(
"RPC vault_info json malformed owner");
+
+ 3033 jvParams[jss::ledger_index] = jss::validated;
+ 3034 jvParams[jss::owner] =
"foobar";
+ 3035 jvParams[jss::seq] = sequence;
+ 3036 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 3038 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 3042 testcase(
"RPC vault_info json invalid combination only owner");
+
+ 3044 jvParams[jss::ledger_index] = jss::validated;
+ 3045 jvParams[jss::owner] = owner.human();
3046 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
3048 jv[jss::result][jss::error].asString() ==
"malformedRequest");
- 3052 testcase(
"RPC vault_info json invalid combination only owner");
+ 3052 testcase(
"RPC vault_info json invalid combination only seq");
3054 jvParams[jss::ledger_index] = jss::validated;
- 3055 jvParams[jss::owner] = owner.human();
+ 3055 jvParams[jss::seq] = sequence;
3056 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
3058 jv[jss::result][jss::error].asString() ==
"malformedRequest");
- 3062 testcase(
"RPC vault_info json invalid combination only seq");
+ 3062 testcase(
"RPC vault_info json invalid combination seq vault_id");
3064 jvParams[jss::ledger_index] = jss::validated;
- 3065 jvParams[jss::seq] = sequence;
- 3066 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3068 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3072 testcase(
"RPC vault_info json invalid combination seq vault_id");
-
- 3074 jvParams[jss::ledger_index] = jss::validated;
- 3075 jvParams[jss::vault_id] =
strHex(keylet.
key);
- 3076 jvParams[jss::seq] = sequence;
- 3077 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3079 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3083 testcase(
"RPC vault_info json invalid combination owner vault_id");
-
- 3085 jvParams[jss::ledger_index] = jss::validated;
- 3086 jvParams[jss::vault_id] =
strHex(keylet.
key);
- 3087 jvParams[jss::owner] = owner.human();
- 3088 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3090 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
-
- 3095 "RPC vault_info json invalid combination owner seq "
-
-
- 3098 jvParams[jss::ledger_index] = jss::validated;
- 3099 jvParams[jss::vault_id] =
strHex(keylet.
key);
- 3100 jvParams[jss::seq] = sequence;
- 3101 jvParams[jss::owner] = owner.human();
- 3102 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3104 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3108 testcase(
"RPC vault_info json no input");
-
- 3110 jvParams[jss::ledger_index] = jss::validated;
- 3111 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
-
- 3113 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3117 testcase(
"RPC vault_info command line invalid index");
- 3118 Json::Value jv = env.rpc(
"vault_info",
"foobar",
"validated");
- 3119 BEAST_EXPECT(jv[jss::error].asString() ==
"invalidParams");
-
-
-
- 3123 testcase(
"RPC vault_info command line invalid index");
- 3124 Json::Value jv = env.rpc(
"vault_info",
"0",
"validated");
-
- 3126 jv[jss::result][jss::error].asString() ==
"malformedRequest");
-
-
-
- 3130 testcase(
"RPC vault_info command line invalid index");
-
-
-
- 3134 jv[jss::result][jss::error].asString() ==
"entryNotFound");
-
-
-
- 3138 testcase(
"RPC vault_info command line invalid ledger");
-
-
- 3141 jv[jss::result][jss::error].asString() ==
"lgrNotFound");
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 3164BEAST_DEFINE_TESTSUITE_PRIO(Vault, tx,
ripple, 1);
-
-
+ 3065 jvParams[jss::vault_id] =
strHex(keylet.
key);
+ 3066 jvParams[jss::seq] = sequence;
+ 3067 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 3069 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 3073 testcase(
"RPC vault_info json invalid combination owner vault_id");
+
+ 3075 jvParams[jss::ledger_index] = jss::validated;
+ 3076 jvParams[jss::vault_id] =
strHex(keylet.
key);
+ 3077 jvParams[jss::owner] = owner.human();
+ 3078 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 3080 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+
+ 3085 "RPC vault_info json invalid combination owner seq "
+
+
+ 3088 jvParams[jss::ledger_index] = jss::validated;
+ 3089 jvParams[jss::vault_id] =
strHex(keylet.
key);
+ 3090 jvParams[jss::seq] = sequence;
+ 3091 jvParams[jss::owner] = owner.human();
+ 3092 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 3094 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 3098 testcase(
"RPC vault_info json no input");
+
+ 3100 jvParams[jss::ledger_index] = jss::validated;
+ 3101 auto jv = env.rpc(
"json",
"vault_info",
to_string(jvParams));
+
+ 3103 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 3107 testcase(
"RPC vault_info command line invalid index");
+ 3108 Json::Value jv = env.rpc(
"vault_info",
"foobar",
"validated");
+ 3109 BEAST_EXPECT(jv[jss::error].asString() ==
"invalidParams");
+
+
+
+ 3113 testcase(
"RPC vault_info command line invalid index");
+ 3114 Json::Value jv = env.rpc(
"vault_info",
"0",
"validated");
+
+ 3116 jv[jss::result][jss::error].asString() ==
"malformedRequest");
+
+
+
+ 3120 testcase(
"RPC vault_info command line invalid index");
+
+
+
+ 3124 jv[jss::result][jss::error].asString() ==
"entryNotFound");
+
+
+
+ 3128 testcase(
"RPC vault_info command line invalid ledger");
+
+
+ 3131 jv[jss::result][jss::error].asString() ==
"lgrNotFound");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3154BEAST_DEFINE_TESTSUITE_PRIO(Vault, tx,
ripple, 1);
+
+
@@ -3257,23 +3247,23 @@ $(function() {
void setIssuer(AccountID const &uIssuer)
Issue const & issue() const
-
-
-
-void testFailedPseudoAccount()
-ripple::test::jtx::PrettyAsset PrettyAsset
-
-
-
-void testNonTransferableShares()
-
-void testWithDomainCheck()
-static auto constexpr negativeAmount
-void run() override
Runs the suite.
-
-void testWithDomainCheckXRP()
-ripple::test::jtx::PrettyAmount PrettyAmount
-
+
+
+
+void testFailedPseudoAccount()
+ripple::test::jtx::PrettyAsset PrettyAsset
+
+
+
+void testNonTransferableShares()
+
+void testWithDomainCheck()
+static auto constexpr negativeAmount
+void run() override
Runs the suite.
+
+void testWithDomainCheckXRP()
+ripple::test::jtx::PrettyAmount PrettyAmount
+
Integers of any length that is a multiple of 32-bits.
diff --git a/classripple_1_1Vault__test.html b/classripple_1_1Vault__test.html
index 4cc91c51a1..3a96f75208 100644
--- a/classripple_1_1Vault__test.html
+++ b/classripple_1_1Vault__test.html
@@ -256,7 +256,7 @@ Static Private Attributes
-
Definition at line 56 of file Vault_test.cpp.
+
Definition at line 46 of file Vault_test.cpp.
◆ PrettyAsset
@@ -278,7 +278,7 @@ Static Private Attributes
@@ -302,7 +302,7 @@ Static Private Attributes
@@ -330,7 +330,7 @@ Static Private Attributes
@@ -357,7 +357,7 @@ Static Private Attributes
@@ -384,7 +384,7 @@ Static Private Attributes
@@ -411,7 +411,7 @@ Static Private Attributes
@@ -438,7 +438,7 @@ Static Private Attributes
@@ -465,7 +465,7 @@ Static Private Attributes
@@ -492,7 +492,7 @@ Static Private Attributes
@@ -519,7 +519,7 @@ Static Private Attributes
@@ -546,7 +546,7 @@ Static Private Attributes
@@ -573,7 +573,7 @@ Static Private Attributes
@@ -600,7 +600,7 @@ Static Private Attributes
@@ -627,7 +627,7 @@ Static Private Attributes
@@ -658,7 +658,7 @@ Static Private Attributes
Implements beast::unit_test::suite.
-Definition at line 3147 of file Vault_test.cpp.
+Definition at line 3137 of file Vault_test.cpp.
@@ -1407,10 +1407,10 @@ template<class Condition >
return {STAmount{asset.raw(), 1ul, 0, true, STAmount::unchecked{}}, ""};
}
-ripple::test::jtx::PrettyAsset PrettyAsset
-ripple::test::jtx::PrettyAmount PrettyAmount
+ripple::test::jtx::PrettyAsset PrettyAsset
+ripple::test::jtx::PrettyAmount PrettyAmount
-Definition at line 61 of file Vault_test.cpp.
+Definition at line 51 of file Vault_test.cpp.
diff --git a/classripple_1_1test_1_1jtx_1_1MPTTester.html b/classripple_1_1test_1_1jtx_1_1MPTTester.html
index 9dd65e72f6..50642b11ad 100644
--- a/classripple_1_1test_1_1jtx_1_1MPTTester.html
+++ b/classripple_1_1test_1_1jtx_1_1MPTTester.html
@@ -213,7 +213,7 @@ Private Attributes
-
Definition at line 144 of file mpt.h.
+
Definition at line 145 of file mpt.h.
◆ SLEP
@@ -235,7 +235,7 @@ Private Attributes
@@ -452,7 +452,7 @@ Private Attributes
@@ -601,7 +601,7 @@ Private Attributes
@@ -719,7 +719,7 @@ template<typename A >
@@ -800,7 +800,7 @@ template<typename A >
@@ -824,7 +824,7 @@ template<typename A >
@@ -848,7 +848,7 @@ template<typename A >
@@ -872,7 +872,7 @@ template<typename A >
@@ -896,7 +896,7 @@ template<typename A >
diff --git a/classripple_1_1test_1_1jtx_1_1PermissionedDEX.html b/classripple_1_1test_1_1jtx_1_1PermissionedDEX.html
index 40a6633963..a5d5f51e91 100644
--- a/classripple_1_1test_1_1jtx_1_1PermissionedDEX.html
+++ b/classripple_1_1test_1_1jtx_1_1PermissionedDEX.html
@@ -133,7 +133,7 @@ Public Attributes
-
Definition at line 34 of file permissioned_dex.h.
+
Definition at line 36 of file permissioned_dex.h.
◆ PermissionedDEX()
@@ -168,7 +168,7 @@ Public Attributes
@@ -184,7 +184,7 @@ Public Attributes
@@ -200,7 +200,7 @@ Public Attributes
@@ -216,7 +216,7 @@ Public Attributes
@@ -232,7 +232,7 @@ Public Attributes
@@ -248,7 +248,7 @@ Public Attributes
@@ -264,7 +264,7 @@ Public Attributes
@@ -280,7 +280,7 @@ Public Attributes
diff --git a/classripple_1_1test_1_1jtx_1_1mptbalance.html b/classripple_1_1test_1_1jtx_1_1mptbalance.html
index 5816387ae4..3f091ef754 100644
--- a/classripple_1_1test_1_1jtx_1_1mptbalance.html
+++ b/classripple_1_1test_1_1jtx_1_1mptbalance.html
@@ -158,7 +158,7 @@ Private Attributes
-
Definition at line 57 of file mpt.h.
+
Definition at line 58 of file mpt.h.
◆ mptbalance()
@@ -192,7 +192,7 @@ Private Attributes
-
Definition at line 65 of file mpt.h.
+
Definition at line 66 of file mpt.h.
@@ -238,7 +238,7 @@ Private Attributes
-
Definition at line 60 of file mpt.h.
+
Definition at line 61 of file mpt.h.
@@ -262,7 +262,7 @@ Private Attributes
-
Definition at line 61 of file mpt.h.
+
Definition at line 62 of file mpt.h.
@@ -286,7 +286,7 @@ Private Attributes
-
Definition at line 62 of file mpt.h.
+
Definition at line 63 of file mpt.h.
diff --git a/classripple_1_1test_1_1jtx_1_1mptflags.html b/classripple_1_1test_1_1jtx_1_1mptflags.html
index a61fdb44b1..7f636ccb92 100644
--- a/classripple_1_1test_1_1jtx_1_1mptflags.html
+++ b/classripple_1_1test_1_1jtx_1_1mptflags.html
@@ -158,7 +158,7 @@ Private Attributes
-
Definition at line 36 of file mpt.h.
+
Definition at line 37 of file mpt.h.
◆ mptflags()
@@ -192,7 +192,7 @@ Private Attributes
-
Definition at line 44 of file mpt.h.
+
Definition at line 45 of file mpt.h.
@@ -238,7 +238,7 @@ Private Attributes
-
Definition at line 39 of file mpt.h.
+
Definition at line 40 of file mpt.h.
@@ -262,7 +262,7 @@ Private Attributes
-
Definition at line 40 of file mpt.h.
+
Definition at line 41 of file mpt.h.
@@ -286,7 +286,7 @@ Private Attributes
-
Definition at line 41 of file mpt.h.
+
Definition at line 42 of file mpt.h.
diff --git a/classripple_1_1test_1_1jtx_1_1requireAny.html b/classripple_1_1test_1_1jtx_1_1requireAny.html
index 1d43650c25..da149706e8 100644
--- a/classripple_1_1test_1_1jtx_1_1requireAny.html
+++ b/classripple_1_1test_1_1jtx_1_1requireAny.html
@@ -106,7 +106,7 @@ Private Attributes
-
Definition at line 74 of file mpt.h.
+
Definition at line 75 of file mpt.h.
◆ requireAny()
@@ -124,7 +124,7 @@ Private Attributes
-
Definition at line 80 of file mpt.h.
+
Definition at line 81 of file mpt.h.
@@ -170,7 +170,7 @@ Private Attributes
-
Definition at line 77 of file mpt.h.
+
Definition at line 78 of file mpt.h.
diff --git a/jtx_8h_source.html b/jtx_8h_source.html
index f48dc56218..88ec932023 100644
--- a/jtx_8h_source.html
+++ b/jtx_8h_source.html
@@ -100,62 +100,63 @@ $(function() {
- 25#include <test/jtx/Account.h>
- 26#include <test/jtx/Env.h>
- 27#include <test/jtx/Env_ss.h>
- 28#include <test/jtx/JTx.h>
- 29#include <test/jtx/TestHelpers.h>
- 30#include <test/jtx/account_txn_id.h>
- 31#include <test/jtx/acctdelete.h>
- 32#include <test/jtx/amount.h>
- 33#include <test/jtx/balance.h>
- 34#include <test/jtx/batch.h>
- 35#include <test/jtx/check.h>
- 36#include <test/jtx/credentials.h>
- 37#include <test/jtx/delegate.h>
- 38#include <test/jtx/delivermin.h>
- 39#include <test/jtx/deposit.h>
- 40#include <test/jtx/did.h>
- 41#include <test/jtx/domain.h>
- 42#include <test/jtx/escrow.h>
- 43#include <test/jtx/fee.h>
- 44#include <test/jtx/flags.h>
- 45#include <test/jtx/invoice_id.h>
- 46#include <test/jtx/jtx_json.h>
- 47#include <test/jtx/last_ledger_sequence.h>
- 48#include <test/jtx/ledgerStateFix.h>
- 49#include <test/jtx/memo.h>
- 50#include <test/jtx/mpt.h>
- 51#include <test/jtx/multisign.h>
- 52#include <test/jtx/noop.h>
- 53#include <test/jtx/offer.h>
- 54#include <test/jtx/owners.h>
- 55#include <test/jtx/paths.h>
- 56#include <test/jtx/pay.h>
- 57#include <test/jtx/permissioned_dex.h>
- 58#include <test/jtx/permissioned_domains.h>
- 59#include <test/jtx/prop.h>
- 60#include <test/jtx/quality.h>
- 61#include <test/jtx/rate.h>
- 62#include <test/jtx/regkey.h>
- 63#include <test/jtx/require.h>
- 64#include <test/jtx/requires.h>
- 65#include <test/jtx/rpc.h>
- 66#include <test/jtx/sendmax.h>
- 67#include <test/jtx/seq.h>
- 68#include <test/jtx/sig.h>
- 69#include <test/jtx/tag.h>
- 70#include <test/jtx/tags.h>
- 71#include <test/jtx/ter.h>
- 72#include <test/jtx/ticket.h>
- 73#include <test/jtx/token.h>
- 74#include <test/jtx/trust.h>
- 75#include <test/jtx/txflags.h>
- 76#include <test/jtx/utility.h>
-
- 78#include <xrpl/json/to_string.h>
-
-
+ 25#include <test/jtx/AMM.h>
+ 26#include <test/jtx/Account.h>
+ 27#include <test/jtx/Env.h>
+ 28#include <test/jtx/Env_ss.h>
+ 29#include <test/jtx/JTx.h>
+ 30#include <test/jtx/TestHelpers.h>
+ 31#include <test/jtx/account_txn_id.h>
+ 32#include <test/jtx/acctdelete.h>
+ 33#include <test/jtx/amount.h>
+ 34#include <test/jtx/balance.h>
+ 35#include <test/jtx/batch.h>
+ 36#include <test/jtx/check.h>
+ 37#include <test/jtx/credentials.h>
+ 38#include <test/jtx/delegate.h>
+ 39#include <test/jtx/delivermin.h>
+ 40#include <test/jtx/deposit.h>
+ 41#include <test/jtx/did.h>
+ 42#include <test/jtx/domain.h>
+ 43#include <test/jtx/escrow.h>
+ 44#include <test/jtx/fee.h>
+ 45#include <test/jtx/flags.h>
+ 46#include <test/jtx/invoice_id.h>
+ 47#include <test/jtx/jtx_json.h>
+ 48#include <test/jtx/last_ledger_sequence.h>
+ 49#include <test/jtx/ledgerStateFix.h>
+ 50#include <test/jtx/memo.h>
+ 51#include <test/jtx/mpt.h>
+ 52#include <test/jtx/multisign.h>
+ 53#include <test/jtx/noop.h>
+ 54#include <test/jtx/offer.h>
+ 55#include <test/jtx/owners.h>
+ 56#include <test/jtx/paths.h>
+ 57#include <test/jtx/pay.h>
+ 58#include <test/jtx/permissioned_dex.h>
+ 59#include <test/jtx/permissioned_domains.h>
+ 60#include <test/jtx/prop.h>
+ 61#include <test/jtx/quality.h>
+ 62#include <test/jtx/rate.h>
+ 63#include <test/jtx/regkey.h>
+ 64#include <test/jtx/require.h>
+ 65#include <test/jtx/requires.h>
+ 66#include <test/jtx/rpc.h>
+ 67#include <test/jtx/sendmax.h>
+ 68#include <test/jtx/seq.h>
+ 69#include <test/jtx/sig.h>
+ 70#include <test/jtx/tag.h>
+ 71#include <test/jtx/tags.h>
+ 72#include <test/jtx/ter.h>
+ 73#include <test/jtx/ticket.h>
+ 74#include <test/jtx/token.h>
+ 75#include <test/jtx/trust.h>
+ 76#include <test/jtx/txflags.h>
+ 77#include <test/jtx/utility.h>
+
+ 79#include <xrpl/json/to_string.h>
+
+