xrpld
Loading...
Searching...
No Matches
LoanPermissionedDomain_test.cpp
1#include <test/app/lending/LoanTestBase.h>
2#include <test/jtx/Account.h>
3#include <test/jtx/Env.h>
4#include <test/jtx/JTx.h>
5#include <test/jtx/TestHelpers.h>
6#include <test/jtx/amount.h>
7#include <test/jtx/credentials.h>
8#include <test/jtx/fee.h>
9#include <test/jtx/pay.h>
10#include <test/jtx/permissioned_domains.h>
11#include <test/jtx/sig.h>
12#include <test/jtx/ter.h>
13#include <test/jtx/trust.h>
14
15#include <xrpl/basics/Number.h>
16#include <xrpl/basics/base_uint.h>
17#include <xrpl/beast/unit_test/suite.h>
18#include <xrpl/beast/utility/Zero.h>
19#include <xrpl/protocol/Feature.h>
20#include <xrpl/protocol/Indexes.h>
21#include <xrpl/protocol/Keylet.h>
22#include <xrpl/protocol/LedgerFormats.h>
23#include <xrpl/protocol/SField.h>
24#include <xrpl/protocol/TER.h>
25#include <xrpl/protocol/TxFlags.h>
26#include <xrpl/protocol/Units.h>
27
28#include <chrono>
29#include <cstdint>
30#include <functional>
31#include <optional>
32#include <string>
33#include <vector>
34
35namespace xrpl::test {
36
37// LoanSet and LoanPay behaviour for private loan brokers that gate borrowers
38// through a permissioned domain.
40{
41 std::string const credType_{"LoanCredential"};
42
43 // Funds `account` and gives it a trust line and a balance of `asset`
44 static void
46 jtx::Env& env,
47 jtx::Account const& issuer,
48 jtx::Account const& account,
49 jtx::PrettyAsset const& asset)
50 {
51 using namespace jtx;
52
53 env.fund(XRP(1'000'000), account);
54 env.close();
55 env(trust(account, asset(1'000'000'000)));
56 env(pay(issuer, account, asset(1'000'000)));
57 env.close();
58 }
59
60 // Issues a `credType_` credential from `credIssuer` to `subject`, and has
61 // the subject accept it
62 void
63 issueCredential(jtx::Env& env, jtx::Account const& subject, jtx::Account const& credIssuer)
64 {
65 using namespace jtx;
66
67 env(credentials::create(subject, credIssuer, credType_));
68 env.close();
69 env(credentials::accept(subject, credIssuer, credType_));
70 env.close();
71 }
72
73 // Build a LoanSet with fixed terms, signed by the counterparty
74 static jtx::JTx
76 jtx::Env& env,
77 jtx::Account const& submitter,
78 BrokerInfo const& broker,
79 jtx::Account const& counterparty)
80 {
81 using namespace jtx;
82 auto setTx = env.jt(loan::set(submitter, broker.brokerID, broker.asset(100).number()));
83 Sig(sfCounterpartySignature, counterparty)(env, setTx);
84 Fee{env.current()->fees().base * 2}(env, setTx);
85 loan::kCounterparty(counterparty)(env, setTx);
86 loan::kInterestRate(TenthBips32{1000})(env, setTx);
87 loan::kPaymentTotal(2)(env, setTx);
88 loan::kPaymentInterval(100)(env, setTx);
89 return setTx;
90 }
91
92 // Has `borrower` make one loan payment and checks that it was genuinely
93 // applied, not merely that the loan object survives: the borrower's balance
94 // dropped (fees are charged separately in XRP), one payment period was
95 // consumed, and the loan's outstanding figures decreased.
96 void
98 jtx::Env& env,
99 jtx::Account const& borrower,
100 Keylet const& loanKeylet,
101 jtx::PrettyAsset const& asset)
102 {
103 using namespace jtx;
104
105 auto const sleLoanBefore = env.le(loanKeylet);
106 if (!BEAST_EXPECT(sleLoanBefore))
107 return;
108 auto const balanceBefore = env.balance(borrower, asset).value();
109 auto const paymentRemainingBefore = sleLoanBefore->at(sfPaymentRemaining);
110 auto const principalBefore = sleLoanBefore->at(sfPrincipalOutstanding);
111 auto const totalValueBefore = sleLoanBefore->at(sfTotalValueOutstanding);
112
113 env(loan::pay(borrower, loanKeylet.key, asset(51)));
114 env.close();
115
116 auto const sleLoan = env.le(loanKeylet);
117 if (!BEAST_EXPECT(sleLoan))
118 return;
119 BEAST_EXPECT(env.balance(borrower, asset).value() < balanceBefore);
120 BEAST_EXPECT(sleLoan->at(sfPaymentRemaining) == paymentRemainingBefore - 1);
121 BEAST_EXPECT(sleLoan->at(sfPrincipalOutstanding) < principalBefore);
122 BEAST_EXPECT(sleLoan->at(sfTotalValueOutstanding) < totalValueBefore);
123 }
124
125 void
127 {
128 testcase("Private broker gates new loans on its permissioned domain");
129 using namespace jtx;
130 using namespace loan_broker;
131
132 Account const issuer{"issuer"};
133 Account const alice{"alice"}; // Broker owner
134 Account const bob{"bob"}; // Borrower with credentials
135 Account const carol{"carol"}; // Borrower without credentials
136 Account const credIssuer{"credIssuer"};
137
138 // DomainID and private Loan Brokers require featureLendingProtocolV1_2.
139 Env env{*this, all_ | featureLendingProtocolV1_2};
140
141 auto const asset = createFundedIouAsset(env, issuer, alice, bob);
142 fundBorrower(env, issuer, carol, asset);
143 env.fund(XRP(1'000'000), credIssuer);
144 env.close();
145
146 auto const domainId = createDomain(env, credIssuer, credIssuer, credType_);
147
148 // Only bob gets credentials; carol does not
149 issueCredential(env, bob, credIssuer);
150
151 auto const broker = createVaultAndBroker(
152 env, asset, alice, {.flags = tfLoanBrokerPrivate, .domainID = domainId});
153
154 auto const setBrokerDomain = [&](uint256 const& newDomainId) {
155 env(set(alice, broker.vaultID), kLoanBrokerId(broker.brokerID), kDomainId(newDomainId));
156 env.close();
157 };
158
159 // Each step moves the broker (or its domain) into a new state, which
160 // later steps build on
161 struct Step
162 {
163 std::string name;
164 std::function<void()> changeState;
165 std::optional<uint256> expectedDomainId;
166 TER memberResult;
167 TER nonMemberResult;
168 };
169
170 std::vector<Step> const steps{
171 {
172 .name = "DomainID set",
173 .changeState = {},
174 .expectedDomainId = domainId,
175 .memberResult = tesSUCCESS,
176 .nonMemberResult = tecNO_AUTH,
177 },
178 {
179 .name = "DomainID unset",
180 .changeState = [&] { setBrokerDomain(beast::kZero); },
181 .expectedDomainId = std::nullopt,
182 .memberResult = tecNO_AUTH,
183 .nonMemberResult = tecNO_AUTH,
184 },
185 {
186 .name = "DomainID set again",
187 .changeState = [&] { setBrokerDomain(domainId); },
188 .expectedDomainId = domainId,
189 .memberResult = tesSUCCESS,
190 .nonMemberResult = tecNO_AUTH,
191 },
192 {
193 .name = "Domain deleted while the broker still refers to it",
194 .changeState =
195 [&] {
196 env(pdomain::deleteTx(credIssuer, domainId));
197 env.close();
198 BEAST_EXPECT(!env.le(keylet::permissionedDomain(domainId)));
199 },
200 .expectedDomainId = domainId,
201 .memberResult = tecOBJECT_NOT_FOUND,
202 .nonMemberResult = tecOBJECT_NOT_FOUND,
203 },
204 {
205 .name = "Stale DomainID cleared by the broker owner",
206 .changeState = [&] { setBrokerDomain(beast::kZero); },
207 .expectedDomainId = std::nullopt,
208 .memberResult = tecNO_AUTH,
209 .nonMemberResult = tecNO_AUTH,
210 },
211 };
212
213 // Submits a LoanSet for `borrower` and checks a loan is created only
214 // on success. Returns the new loan's keylet, if any.
215 auto const trySetLoan = [&](Account const& borrower,
216 TER expected) -> std::optional<Keylet> {
217 auto const loanKeylet = nextLoanKeylet(env, broker);
218 env(makeLoanSet(env, borrower, broker, alice), Ter(expected));
219 env.close();
220
221 bool const created = isTesSuccess(expected);
222 BEAST_EXPECT(static_cast<bool>(env.le(loanKeylet)) == created);
223 if (!created)
224 return std::nullopt;
225 return loanKeylet;
226 };
227
228 // A loan bob took out in an earlier step that is yet to be repaid
229 std::optional<Keylet> outstandingLoan;
230 for (auto const& step : steps)
231 {
232 testcase(step.name);
233
234 if (step.changeState)
235 step.changeState();
236
237 if (auto const sleBroker = env.le(broker.brokerKeylet()); BEAST_EXPECT(sleBroker))
238 {
239 BEAST_EXPECT(sleBroker->at(~sfDomainID) == step.expectedDomainId);
240 BEAST_EXPECT(sleBroker->isFlag(lsfLoanBrokerPrivate));
241 }
242
243 // Existing loans can be repaid whatever state the domain is in
244 if (outstandingLoan)
245 payLoanAndVerify(env, bob, *outstandingLoan, asset);
246
247 trySetLoan(carol, step.nonMemberResult);
248 outstandingLoan = trySetLoan(bob, step.memberResult);
249 }
250 }
251
252 void
254 {
255 testcase("Private Broker Credential Validation");
256 using namespace jtx;
257
258 Account const issuer{"issuer"};
259 Account const alice{"alice"}; // Broker owner
260 Account const bob{"bob"}; // Borrower with credentials
261 Account const carol{"carol"}; // Borrower without credentials
262 Account const credIssuer{"credIssuer"};
263
264 // DomainID and private Loan Brokers require featureLendingProtocolV1_2.
265 Env env{*this, all_ | featureLendingProtocolV1_2};
266
267 auto const asset = createFundedIouAsset(env, issuer, alice, bob);
268 fundBorrower(env, issuer, carol, asset);
269 env.fund(XRP(1'000'000), credIssuer);
270 env.close();
271
272 auto const domainId = createDomain(env, credIssuer, credIssuer, credType_);
273
274 auto const broker = createVaultAndBroker(
275 env, asset, alice, {.flags = tfLoanBrokerPrivate, .domainID = domainId});
276
277 {
278 testcase("Borrower without credentials cannot create loan");
279 env(makeLoanSet(env, carol, broker, alice), Ter(tecNO_AUTH));
280 }
281
282 issueCredential(env, bob, credIssuer);
283
284 {
285 testcase("Borrower with valid credentials can create loan");
286 auto const loanKeylet = nextLoanKeylet(env, broker);
287 env(makeLoanSet(env, bob, broker, alice));
288 env.close();
289
290 BEAST_EXPECT(env.le(loanKeylet));
291 }
292
293 {
294 testcase("Private broker without DomainID configured rejects loans");
295 auto const noDomainBroker =
296 createVaultAndBroker(env, asset, alice, {.flags = tfLoanBrokerPrivate});
297
298 // Even bob with credentials should fail - broker has no domain configured
299 env(makeLoanSet(env, bob, noDomainBroker, alice), Ter(tecNO_AUTH));
300 }
301
302 {
303 testcase("Public broker allows anyone to create loan");
304 auto const publicBroker = createVaultAndBroker(env, asset, alice);
305
306 // Carol without credentials can create loan on public broker
307 auto const loanKeylet = nextLoanKeylet(env, publicBroker);
308 env(makeLoanSet(env, carol, publicBroker, alice));
309 env.close();
310
311 BEAST_EXPECT(env.le(loanKeylet));
312 }
313
314 {
315 testcase(
316 "When the broker owner submits, the domain check must validate the borrower (the "
317 "counterparty)");
318 env(makeLoanSet(env, alice, broker, carol), Ter(tecNO_AUTH));
319 }
320
321 {
322 testcase("Broker owner submits with a credentialed borrower (bob) as counterparty.");
323 auto const loanKeylet = nextLoanKeylet(env, broker);
324 env(makeLoanSet(env, alice, broker, bob));
325 env.close();
326
327 BEAST_EXPECT(env.le(loanKeylet));
328 }
329
330 {
331 testcase("Broker owner outside the domain cannot take a loan from their own broker");
332 auto const loanKeylet = nextLoanKeylet(env, broker);
333 env(makeLoanSet(env, alice, broker, alice), Ter(tecNO_AUTH));
334 env.close();
335
336 BEAST_EXPECT(!env.le(loanKeylet));
337 }
338
339 {
340 testcase("Borrower whose only credential has expired");
341 using namespace std::chrono_literals;
342
343 auto jv = credentials::create(carol, credIssuer, credType_);
344 std::uint32_t const expiration =
345 env.current()->header().parentCloseTime.time_since_epoch().count() + 100;
346 jv[sfExpiration.jsonName] = expiration;
347 env(jv);
348 env(credentials::accept(carol, credIssuer, credType_));
349 env.close();
350
351 auto const credKeylet = credentials::keylet(carol, credIssuer, credType_);
352
353 // Advance time past expiration
354 env.close(150s);
355 BEAST_EXPECT(env.le(credKeylet));
356
357 env(makeLoanSet(env, carol, broker, alice), Ter(tecEXPIRED));
358 env.close();
359
360 // The expired credential was deleted despite the tec result
361 BEAST_EXPECT(!env.le(credKeylet));
362
363 // With the credential gone, the borrower is rejected outright
364 env(makeLoanSet(env, carol, broker, alice), Ter(tecNO_AUTH));
365 env.close();
366 }
367 }
368
369 void
371 {
372 testcase("Private broker does not treat the domain owner as a member");
373 using namespace jtx;
374
375 Account const issuer{"issuer"};
376 Account const alice{"alice"}; // Broker owner
377 Account const bob{"bob"}; // Domain owner
378 Account const carol{"carol"}; // Neither owner nor member
379 Account const credIssuer{"credIssuer"};
380
381 // DomainID and private Loan Brokers require featureLendingProtocolV1_2.
382 Env env{*this, all_ | featureLendingProtocolV1_2};
383
384 auto const asset = createFundedIouAsset(env, issuer, alice, bob);
385 fundBorrower(env, issuer, carol, asset);
386 env.fund(XRP(1'000'000), credIssuer);
387 env.close();
388
389 // Bob owns the domain but holds no credential in it yet
390 auto const domainId = createDomain(env, bob, credIssuer, credType_);
391 BEAST_EXPECT(!env.le(credentials::keylet(bob, credIssuer, credType_)));
392
393 // Alice creates a private broker attached to bob's domain
394 auto const broker = createVaultAndBroker(
395 env, asset, alice, {.flags = tfLoanBrokerPrivate, .domainID = domainId});
396
397 {
398 testcase("Owning the domain does not make the owner a member");
399 auto const loanKeylet = nextLoanKeylet(env, broker);
400 env(makeLoanSet(env, bob, broker, alice), Ter(tecNO_AUTH));
401 env.close();
402
403 BEAST_EXPECT(!env.le(loanKeylet));
404 }
405
406 {
407 testcase("The domain owner is not a member as the counterparty either");
408 auto const loanKeylet = nextLoanKeylet(env, broker);
409 env(makeLoanSet(env, alice, broker, bob), Ter(tecNO_AUTH));
410 env.close();
411
412 BEAST_EXPECT(!env.le(loanKeylet));
413 }
414
415 {
416 testcase("Anyone else without a credential is rejected the same way");
417 env(makeLoanSet(env, carol, broker, alice), Ter(tecNO_AUTH));
418 }
419
420 // The domain owner can join the domain like anyone else
421 issueCredential(env, bob, credIssuer);
422
423 {
424 testcase("The domain owner can borrow once they hold a credential");
425 auto const loanKeylet = nextLoanKeylet(env, broker);
426 env(makeLoanSet(env, bob, broker, alice));
427 env.close();
428
429 BEAST_EXPECT(env.le(loanKeylet));
430 }
431
432 {
433 testcase("The credentialed domain owner can also borrow as the counterparty");
434 auto const loanKeylet = nextLoanKeylet(env, broker);
435 env(makeLoanSet(env, alice, broker, bob));
436 env.close();
437
438 BEAST_EXPECT(env.le(loanKeylet));
439 }
440
441 {
442 testcase("Broker owner who also owns the domain");
443 auto const aliceDomainId = createDomain(env, alice, credIssuer, credType_);
444 auto const aliceBroker = createVaultAndBroker(
445 env, asset, alice, {.flags = tfLoanBrokerPrivate, .domainID = aliceDomainId});
446
447 // Being the domain owner does not let alice lend to a non-member
448 env(makeLoanSet(env, alice, aliceBroker, carol), Ter(tecNO_AUTH));
449
450 // Nor does it let alice take a self-loan without a credential
451 {
452 auto const loanKeylet = nextLoanKeylet(env, aliceBroker);
453 env(makeLoanSet(env, alice, aliceBroker, alice), Ter(tecNO_AUTH));
454 env.close();
455
456 BEAST_EXPECT(!env.le(loanKeylet));
457 }
458
459 // Once alice holds a credential in her own domain, the self-loan
460 // goes through
461 issueCredential(env, alice, credIssuer);
462 {
463 auto const loanKeylet = nextLoanKeylet(env, aliceBroker);
464 env(makeLoanSet(env, alice, aliceBroker, alice));
465 env.close();
466
467 BEAST_EXPECT(env.le(loanKeylet));
468 }
469 }
470
471 {
472 testcase("Once the domain is deleted, the former owner gets tecOBJECT_NOT_FOUND");
473 env(pdomain::deleteTx(bob, domainId));
474 env.close();
475 BEAST_EXPECT(!env.le(keylet::permissionedDomain(domainId)));
476
477 // Bob still holds a credential, but the broker's domain is gone
478 BEAST_EXPECT(env.le(credentials::keylet(bob, credIssuer, credType_)));
479 env(makeLoanSet(env, bob, broker, alice), Ter(tecOBJECT_NOT_FOUND));
480 }
481 }
482
483 void
485 {
486 testcase("LoanPay works after borrower credential is revoked");
487 using namespace jtx;
488
489 Account const issuer{"issuer"};
490 Account const alice{"alice"}; // Broker owner
491 Account const bob{"bob"}; // Borrower
492 Account const credIssuer{"credIssuer"};
493
494 // DomainID and private Loan Brokers require featureLendingProtocolV1_2.
495 Env env{*this, all_ | featureLendingProtocolV1_2};
496
497 auto const asset = createFundedIouAsset(env, issuer, alice, bob);
498 env.fund(XRP(1'000'000), credIssuer);
499 env.close();
500
501 auto const domainId = createDomain(env, credIssuer, credIssuer, credType_);
502 issueCredential(env, bob, credIssuer);
503
504 auto const broker = createVaultAndBroker(
505 env, asset, alice, {.flags = tfLoanBrokerPrivate, .domainID = domainId});
506
507 // Create a loan for bob
508 auto const loanKeylet = nextLoanKeylet(env, broker);
509 env(makeLoanSet(env, bob, broker, alice));
510 env.close();
511 BEAST_EXPECT(env.le(loanKeylet));
512
513 // Now delete bob's credential
514 env(credentials::deleteCred(bob, bob, credIssuer, credType_));
515 env.close();
516
517 // Verify credential is gone
518 auto const credKeylet = credentials::keylet(bob, credIssuer, credType_);
519 BEAST_EXPECT(!env.le(credKeylet));
520
521 // Bob should still be able to make a loan payment even without credentials
522 payLoanAndVerify(env, bob, loanKeylet, asset);
523
524 // Bob should NOT be able to create a NEW loan (no credentials)
525 {
526 auto const newLoanKeylet = nextLoanKeylet(env, broker);
527 env(makeLoanSet(env, bob, broker, alice), Ter(tecNO_AUTH));
528
529 BEAST_EXPECT(!env.le(newLoanKeylet));
530 }
531 }
532
533 void
535 {
536 testcase("LoanPay works after borrower credential has expired");
537 using namespace jtx;
538 using namespace std::chrono_literals;
539
540 Account const issuer{"issuer"};
541 Account const alice{"alice"}; // Broker owner
542 Account const bob{"bob"}; // Borrower
543 Account const credIssuer{"credIssuer"};
544
545 // DomainID and private Loan Brokers require featureLendingProtocolV1_2.
546 Env env{*this, all_ | featureLendingProtocolV1_2};
547
548 auto const asset = createFundedIouAsset(env, issuer, alice, bob);
549 env.fund(XRP(1'000'000), credIssuer);
550 env.close();
551
552 auto const domainId = createDomain(env, credIssuer, credIssuer, credType_);
553 auto const broker = createVaultAndBroker(
554 env, asset, alice, {.flags = tfLoanBrokerPrivate, .domainID = domainId});
555
556 // Give bob a credential that expires shortly, well before the first
557 // loan payment falls due
558 auto jv = credentials::create(bob, credIssuer, credType_);
559 std::uint32_t const expiration =
560 env.current()->header().parentCloseTime.time_since_epoch().count() + 20;
561 jv[sfExpiration.jsonName] = expiration;
562 env(jv);
563 env(credentials::accept(bob, credIssuer, credType_));
564 env.close();
565
566 // Create a loan for bob while the credential is still valid
567 auto const loanKeylet = nextLoanKeylet(env, broker);
568 env(makeLoanSet(env, bob, broker, alice));
569 env.close();
570 BEAST_EXPECT(env.le(loanKeylet));
571
572 // Advance time past expiration
573 env.close(30s);
574 auto const credKeylet = credentials::keylet(bob, credIssuer, credType_);
575 BEAST_EXPECT(env.le(credKeylet));
576
577 // Bob can still make a loan payment with an expired credential
578 payLoanAndVerify(env, bob, loanKeylet, asset);
579
580 // LoanPay does not check the domain, so it leaves the expired
581 // credential in place
582 BEAST_EXPECT(env.le(credKeylet));
583
584 // Bob cannot create a new loan with the expired credential
585 {
586 auto const newLoanKeylet = nextLoanKeylet(env, broker);
587 env(makeLoanSet(env, bob, broker, alice), Ter(tecEXPIRED));
588 env.close();
589
590 BEAST_EXPECT(!env.le(newLoanKeylet));
591 }
592 }
593
594public:
595 void
604};
605
606BEAST_DEFINE_TESTSUITE(LoanPermissionedDomain, tx, xrpl);
607
608} // namespace xrpl::test
TestcaseT testcase
Memberspace for declaring test cases.
Definition suite.h:155
A step in a payment path.
Definition Steps.h:83
void issueCredential(jtx::Env &env, jtx::Account const &subject, jtx::Account const &credIssuer)
static jtx::JTx makeLoanSet(jtx::Env &env, jtx::Account const &submitter, BrokerInfo const &broker, jtx::Account const &counterparty)
void payLoanAndVerify(jtx::Env &env, jtx::Account const &borrower, Keylet const &loanKeylet, jtx::PrettyAsset const &asset)
static void fundBorrower(jtx::Env &env, jtx::Account const &issuer, jtx::Account const &account, jtx::PrettyAsset const &asset)
Shared base for the Loan*_test family under src/test/app/lending/.
jtx::PrettyAsset createFundedIouAsset(jtx::Env &env, jtx::Account const &issuer, jtx::Account const &lender, jtx::Account const &borrower, Number const &lenderPay=100 '000 '000, Number const &borrowerPay=1 '000 '000)
FeatureBitset const all_
BrokerInfo createVaultAndBroker(jtx::Env &env, jtx::PrettyAsset const &asset, jtx::Account const &lender, BrokerParameters const &params=BrokerParameters::defaults())
Keylet nextLoanKeylet(jtx::Env const &env, BrokerInfo const &broker)
uint256 createDomain(jtx::Env &env, jtx::Account const &owner, jtx::Account const &credIssuer, std::string const &credType)
Immutable cryptographic account descriptor.
Definition jtx/Account.h:21
A transaction testing environment.
Definition Env.h:161
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Definition Env.cpp:133
SLE::const_pointer le(Account const &account) const
Return an account root.
Definition Env.cpp:311
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition Env.cpp:323
JTx jt(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
Definition Env.h:723
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition Env.cpp:201
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition Env.h:377
Set the fee on a JTx.
Definition fee.h:20
Set the regular signature on a JTx.
Definition sig.h:19
Set the expected result code for a JTx The test will fail if the code doesn't match.
Definition ter.h:18
constexpr Zero kZero
Definition Zero.h:30
Keylet permissionedDomain(AccountID const &account, SeqProxy const &seq) noexcept
Definition Indexes.cpp:583
json::Value deleteCred(jtx::Account const &acc, jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
Definition creds.cpp:40
json::Value accept(jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
Definition creds.cpp:29
json::Value create(jtx::Account const &subject, jtx::Account const &issuer, std::string_view credType)
Definition creds.cpp:16
Keylet keylet(test::jtx::Account const &subject, test::jtx::Account const &issuer, std::string_view credType)
Definition credentials.h:21
json::Value set(AccountID const &account, UInt256 const &loanBrokerID, Number principalRequested, std::uint32_t flags)
json::Value pay(AccountID const &account, UInt256 const &loanID, STAmount const &amount, std::uint32_t flags)
json::Value deleteTx(AccountID const &account, UInt256 const &domain)
json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
Definition pay.cpp:14
XrpT const XRP
Converts to XRP Issue or STAmount.
Definition amount.cpp:92
json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
Definition trust.cpp:18
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
TenthBips< std::uint32_t > TenthBips32
Definition Units.h:454
bool isTesSuccess(TER x) noexcept
Definition TER.h:686
TERSubset< CanCvtToTER > TER
Definition TER.h:657
@ tecOBJECT_NOT_FOUND
Definition TER.h:337
@ tecNO_AUTH
Definition TER.h:311
@ tecEXPIRED
Definition TER.h:325
@ tesSUCCESS
Definition TER.h:253
UInt256 uint256
Definition base_uint.h:587
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:20
UInt256 key
Definition Keylet.h:21
Execution context for applying a JSON transaction.
Definition JTx.h:27
STAmount const & value() const