rippled
Loading...
Searching...
No Matches
CrossingLimits_test.cpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5 Permission to use, copy, modify, and/or distribute this software for any
6 purpose with or without fee is hereby granted, provided that the above
7 copyright notice and this permission notice appear in all copies.
8 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16//==============================================================================
17
18#include <test/jtx.h>
19#include <xrpl/beast/unit_test.h>
20#include <xrpl/protocol/Feature.h>
21
22namespace ripple {
23namespace test {
24
26{
27public:
28 void
30 {
31 testcase("Step Limit");
32
33 using namespace jtx;
34 Env env(*this, features);
35
36 auto const gw = Account("gateway");
37 auto const USD = gw["USD"];
38
39 env.fund(XRP(100000000), gw, "alice", "bob", "carol", "dan");
40 env.trust(USD(1), "bob");
41 env(pay(gw, "bob", USD(1)));
42 env.trust(USD(1), "dan");
43 env(pay(gw, "dan", USD(1)));
44 n_offers(env, 2000, "bob", XRP(1), USD(1));
45 n_offers(env, 1, "dan", XRP(1), USD(1));
46
47 // Alice offers to buy 1000 XRP for 1000 USD. She takes Bob's first
48 // offer, removes 999 more as unfunded, then hits the step limit.
49 env(offer("alice", USD(1000), XRP(1000)));
50 env.require(balance("alice", USD(1)));
51 env.require(owners("alice", 2));
52 env.require(balance("bob", USD(0)));
53 env.require(owners("bob", 1001));
54 env.require(balance("dan", USD(1)));
55 env.require(owners("dan", 2));
56
57 // Carol offers to buy 1000 XRP for 1000 USD. She removes Bob's next
58 // 1000 offers as unfunded and hits the step limit.
59 env(offer("carol", USD(1000), XRP(1000)));
60 env.require(balance("carol", USD(none)));
61 env.require(owners("carol", 1));
62 env.require(balance("bob", USD(0)));
63 env.require(owners("bob", 1));
64 env.require(balance("dan", USD(1)));
65 env.require(owners("dan", 2));
66 }
67
68 void
70 {
71 testcase("Crossing Limit");
72
73 using namespace jtx;
74 Env env(*this, features);
75
76 auto const gw = Account("gateway");
77 auto const USD = gw["USD"];
78
79 // The number of allowed offers to cross is different between
80 // Taker and FlowCross. Taker allows 850 and FlowCross allows 1000.
81 // Accommodate that difference in the test.
82 int const maxConsumed = features[featureFlowCross] ? 1000 : 850;
83
84 env.fund(XRP(100000000), gw, "alice", "bob", "carol");
85 int const bobsOfferCount = maxConsumed + 150;
86 env.trust(USD(bobsOfferCount), "bob");
87 env(pay(gw, "bob", USD(bobsOfferCount)));
88 env.close();
89 n_offers(env, bobsOfferCount, "bob", XRP(1), USD(1));
90
91 // Alice offers to buy Bob's offers. However she hits the offer
92 // crossing limit, so she can't buy them all at once.
93 env(offer("alice", USD(bobsOfferCount), XRP(bobsOfferCount)));
94 env.close();
95 env.require(balance("alice", USD(maxConsumed)));
96 env.require(balance("bob", USD(150)));
97 env.require(owners("bob", 150 + 1));
98
99 // Carol offers to buy 1000 XRP for 1000 USD. She takes Bob's
100 // remaining 150 offers without hitting a limit.
101 env(offer("carol", USD(1000), XRP(1000)));
102 env.close();
103 env.require(balance("carol", USD(150)));
104 env.require(balance("bob", USD(0)));
105 env.require(owners("bob", 1));
106 }
107
108 void
110 {
111 testcase("Step And Crossing Limit");
112
113 using namespace jtx;
114 Env env(*this, features);
115
116 auto const gw = Account("gateway");
117 auto const USD = gw["USD"];
118
119 env.fund(XRP(100000000), gw, "alice", "bob", "carol", "dan", "evita");
120
121 // The number of offers allowed to cross is different between
122 // Taker and FlowCross. Taker allows 850 and FlowCross allows 1000.
123 // Accommodate that difference in the test.
124 bool const isFlowCross{features[featureFlowCross]};
125 int const maxConsumed = isFlowCross ? 1000 : 850;
126
127 int const evitasOfferCount{maxConsumed + 49};
128 env.trust(USD(1000), "alice");
129 env(pay(gw, "alice", USD(1000)));
130 env.trust(USD(1000), "carol");
131 env(pay(gw, "carol", USD(1)));
132 env.trust(USD(evitasOfferCount + 1), "evita");
133 env(pay(gw, "evita", USD(evitasOfferCount + 1)));
134
135 // Taker and FlowCross have another difference we must accommodate.
136 // Taker allows a total of 1000 unfunded offers to be consumed
137 // beyond the 850 offers it can take. FlowCross draws no such
138 // distinction; its limit is 1000 funded or unfunded.
139 //
140 // Give carol an extra 150 (unfunded) offers when we're using Taker
141 // to accommodate that difference.
142 int const carolsOfferCount{isFlowCross ? 700 : 850};
143 n_offers(env, 400, "alice", XRP(1), USD(1));
144 n_offers(env, carolsOfferCount, "carol", XRP(1), USD(1));
145 n_offers(env, evitasOfferCount, "evita", XRP(1), USD(1));
146
147 // Bob offers to buy 1000 XRP for 1000 USD. He takes all 400 USD from
148 // Alice's offers, 1 USD from Carol's and then removes 599 of Carol's
149 // offers as unfunded, before hitting the step limit.
150 env(offer("bob", USD(1000), XRP(1000)));
151 env.require(balance("bob", USD(401)));
152 env.require(balance("alice", USD(600)));
153 env.require(owners("alice", 1));
154 env.require(balance("carol", USD(0)));
155 env.require(owners("carol", carolsOfferCount - 599));
156 env.require(balance("evita", USD(evitasOfferCount + 1)));
157 env.require(owners("evita", evitasOfferCount + 1));
158
159 // Dan offers to buy maxConsumed + 50 XRP USD. He removes all of
160 // Carol's remaining offers as unfunded, then takes
161 // (maxConsumed - 100) USD from Evita's, hitting the crossing limit.
162 env(offer("dan", USD(maxConsumed + 50), XRP(maxConsumed + 50)));
163 env.require(balance("dan", USD(maxConsumed - 100)));
164 env.require(owners("dan", 2));
165 env.require(balance("alice", USD(600)));
166 env.require(owners("alice", 1));
167 env.require(balance("carol", USD(0)));
168 env.require(owners("carol", 1));
169 env.require(balance("evita", USD(150)));
170 env.require(owners("evita", 150));
171 }
172
173 void
175 {
176 testcase("Auto Bridged Limits Taker");
177
178 using namespace jtx;
179 Env env(*this, features);
180
181 auto const gw = Account("gateway");
182 auto const USD = gw["USD"];
183 auto const EUR = gw["EUR"];
184
185 env.fund(XRP(100000000), gw, "alice", "bob", "carol", "dan", "evita");
186
187 env.trust(USD(2000), "alice");
188 env(pay(gw, "alice", USD(2000)));
189 env.trust(USD(1000), "carol");
190 env(pay(gw, "carol", USD(3)));
191 env.trust(USD(1000), "evita");
192 env(pay(gw, "evita", USD(1000)));
193
194 n_offers(env, 302, "alice", EUR(2), XRP(1));
195 n_offers(env, 300, "alice", XRP(1), USD(4));
196 n_offers(env, 497, "carol", XRP(1), USD(3));
197 n_offers(env, 1001, "evita", EUR(1), USD(1));
198
199 // Bob offers to buy 2000 USD for 2000 EUR, even though he only has
200 // 1000 EUR.
201 // 1. He spends 600 EUR taking Alice's auto-bridged offers and
202 // gets 1200 USD for that.
203 // 2. He spends another 2 EUR taking one of Alice's EUR->XRP and
204 // one of Carol's XRP-USD offers. He gets 3 USD for that.
205 // 3. The remainder of Carol's offers are now unfunded. We've
206 // consumed 602 offers so far. We now chew through 398 more
207 // of Carol's unfunded offers until we hit the 1000 offer limit.
208 // This sets have_bridge to false -- we will handle no more
209 // bridged offers.
210 // 4. However, have_direct is still true. So we go around one more
211 // time and take one of Evita's offers.
212 // 5. After taking one of Evita's offers we notice (again) that our
213 // offer count was exceeded. So we completely stop after taking
214 // one of Evita's offers.
215 env.trust(EUR(10000), "bob");
216 env.close();
217 env(pay(gw, "bob", EUR(1000)));
218 env.close();
219 env(offer("bob", USD(2000), EUR(2000)));
220 env.require(balance("bob", USD(1204)));
221 env.require(balance("bob", EUR(397)));
222
223 env.require(balance("alice", USD(800)));
224 env.require(balance("alice", EUR(602)));
225 env.require(offers("alice", 1));
226 env.require(owners("alice", 3));
227
228 env.require(balance("carol", USD(0)));
229 env.require(balance("carol", EUR(none)));
230 env.require(offers("carol", 100));
231 env.require(owners("carol", 101));
232
233 env.require(balance("evita", USD(999)));
234 env.require(balance("evita", EUR(1)));
235 env.require(offers("evita", 1000));
236 env.require(owners("evita", 1002));
237
238 // Dan offers to buy 900 EUR for 900 USD.
239 // 1. He removes all 100 of Carol's remaining unfunded offers.
240 // 2. Then takes 850 USD from Evita's offers.
241 // 3. Consuming 850 of Evita's funded offers hits the crossing
242 // limit. So Dan's offer crossing stops even though he would
243 // be willing to take another 50 of Evita's offers.
244 env.trust(EUR(10000), "dan");
245 env.close();
246 env(pay(gw, "dan", EUR(1000)));
247 env.close();
248
249 env(offer("dan", USD(900), EUR(900)));
250 env.require(balance("dan", USD(850)));
251 env.require(balance("dan", EUR(150)));
252
253 env.require(balance("alice", USD(800)));
254 env.require(balance("alice", EUR(602)));
255 env.require(offers("alice", 1));
256 env.require(owners("alice", 3));
257
258 env.require(balance("carol", USD(0)));
259 env.require(balance("carol", EUR(none)));
260 env.require(offers("carol", 0));
261 env.require(owners("carol", 1));
262
263 env.require(balance("evita", USD(149)));
264 env.require(balance("evita", EUR(851)));
265 env.require(offers("evita", 150));
266 env.require(owners("evita", 152));
267 }
268
269 void
271 {
272 testcase("Auto Bridged Limits FlowCross");
273
274 // If any book step in a payment strand consumes 1000 offers, the
275 // liquidity from the offers is used, but that strand will be marked as
276 // dry for the remainder of the transaction.
277
278 using namespace jtx;
279
280 auto const gw = Account("gateway");
281 auto const alice = Account("alice");
282 auto const bob = Account("bob");
283 auto const carol = Account("carol");
284
285 auto const USD = gw["USD"];
286 auto const EUR = gw["EUR"];
287
288 // There are two almost identical tests. There is a strand with a large
289 // number of unfunded offers that will cause the strand to be marked dry
290 // even though there will still be liquidity available on that strand.
291 // In the first test, the strand has the best initial quality. In the
292 // second test the strand does not have the best quality (the
293 // implementation has to handle this case correct and not mark the
294 // strand dry until the liquidity is actually used)
295
296 // The implementation allows any single step to consume at most 1000
297 // offers. With the `FlowSortStrands` feature enabled, if the total
298 // number of offers consumed by all the steps combined exceeds 1500, the
299 // payment stops.
300 {
301 Env env(*this, features);
302
303 env.fund(XRP(100000000), gw, alice, bob, carol);
304
305 env.trust(USD(4000), alice);
306 env(pay(gw, alice, USD(4000)));
307 env.trust(USD(1000), carol);
308 env(pay(gw, carol, USD(3)));
309
310 // Notice the strand with the 800 unfunded offers has the initial
311 // best quality
312 n_offers(env, 2000, alice, EUR(2), XRP(1));
313 n_offers(env, 100, alice, XRP(1), USD(4));
314 n_offers(
315 env, 801, carol, XRP(1), USD(3)); // only one offer is funded
316 n_offers(env, 1000, alice, XRP(1), USD(3));
317
318 n_offers(env, 1, alice, EUR(500), USD(500));
319
320 // Bob offers to buy 2000 USD for 2000 EUR; He starts with 2000 EUR
321 // 1. The best quality is the autobridged offers that take 2 EUR
322 // and give 4 USD.
323 // Bob spends 200 EUR and receives 400 USD.
324 // 100 EUR->XRP offers consumed.
325 // 100 XRP->USD offers consumed.
326 // 200 total offers consumed.
327 //
328 // 2. The best quality is the autobridged offers that take 2 EUR
329 // and give 3 USD.
330 // a. One of Carol's offers is taken. This leaves her other
331 // offers unfunded.
332 // b. Carol's remaining 800 offers are consumed as unfunded.
333 // c. 199 of alice's XRP(1) to USD(3) offers are consumed.
334 // A book step is allowed to consume a maxium of 1000 offers
335 // at a given quality, and that limit is now reached.
336 // d. Now the strand is dry, even though there are still funded
337 // XRP(1) to USD(3) offers available.
338 // Bob has spent 400 EUR and received 600 USD in this step.
339 // 200 EUR->XRP offers consumed
340 // 800 unfunded XRP->USD offers consumed
341 // 200 funded XRP->USD offers consumed (1 carol, 199 alice)
342 // 1400 total offers consumed so far (100 left before the
343 // limit)
344 // 3. The best is the non-autobridged offers that takes 500 EUR and
345 // gives 500 USD.
346 // Bob started with 2000 EUR
347 // Bob spent 500 EUR (100+400)
348 // Bob has 1500 EUR left
349 // In this step:
350 // Bob spents 500 EUR and receives 500 USD.
351 // In total:
352 // Bob spent 1100 EUR (200 + 400 + 500)
353 // Bob has 900 EUR remaining (2000 - 1100)
354 // Bob received 1500 USD (400 + 600 + 500)
355 // Alice spent 1497 USD (100*4 + 199*3 + 500)
356 // Alice has 2503 remaining (4000 - 1497)
357 // Alice received 1100 EUR (200 + 400 + 500)
358 env.trust(EUR(10000), bob);
359 env.close();
360 env(pay(gw, bob, EUR(2000)));
361 env.close();
362 env(offer(bob, USD(4000), EUR(4000)));
363 env.close();
364
365 env.require(balance(bob, USD(1500)));
366 env.require(balance(bob, EUR(900)));
367 env.require(offers(bob, 1));
368 env.require(owners(bob, 3));
369
370 env.require(balance(alice, USD(2503)));
371 env.require(balance(alice, EUR(1100)));
372 auto const numAOffers =
373 2000 + 100 + 1000 + 1 - (2 * 100 + 2 * 199 + 1 + 1);
374 env.require(offers(alice, numAOffers));
375 env.require(owners(alice, numAOffers + 2));
376
377 env.require(offers(carol, 0));
378 }
379 {
380 Env env(*this, features);
381
382 env.fund(XRP(100000000), gw, alice, bob, carol);
383
384 env.trust(USD(4000), alice);
385 env(pay(gw, alice, USD(4000)));
386 env.trust(USD(1000), carol);
387 env(pay(gw, carol, USD(3)));
388
389 // Notice the strand with the 800 unfunded offers does not have the
390 // initial best quality
391 n_offers(env, 1, alice, EUR(1), USD(10));
392 n_offers(env, 2000, alice, EUR(2), XRP(1));
393 n_offers(env, 100, alice, XRP(1), USD(4));
394 n_offers(
395 env, 801, carol, XRP(1), USD(3)); // only one offer is funded
396 n_offers(env, 1000, alice, XRP(1), USD(3));
397
398 n_offers(env, 1, alice, EUR(499), USD(499));
399
400 // Bob offers to buy 2000 USD for 2000 EUR; He starts with 2000 EUR
401 // 1. The best quality is the offer that takes 1 EUR and gives 10
402 // USD
403 // Bob spends 1 EUR and receives 10 USD.
404 //
405 // 2. The best quality is the autobridged offers that takes 2 EUR
406 // and gives 4 USD.
407 // Bob spends 200 EUR and receives 400 USD.
408 //
409 // 3. The best quality is the autobridged offers that takes 2 EUR
410 // and gives 3 USD.
411 // a. One of Carol's offers is taken. This leaves her other
412 // offers unfunded.
413 // b. Carol's remaining 800 offers are consumed as unfunded.
414 // c. 199 of alice's XRP(1) to USD(3) offers are consumed.
415 // A book step is allowed to consume a maxium of 1000 offers
416 // at a given quality, and that limit is now reached.
417 // d. Now the strand is dry, even though there are still funded
418 // XRP(1) to USD(3) offers available. Bob has spent 400 EUR and
419 // received 600 USD in this step. (200 funded offers consumed
420 // 800 unfunded offers)
421 // 4. The best is the non-autobridged offers that takes 499 EUR and
422 // gives 499 USD.
423 // Bob has 2000 EUR, and has spent 1+200+400=601 EUR. He has
424 // 1399 left. Bob spent 499 EUR and receives 499 USD.
425 // In total: Bob spent EUR(1 + 200 + 400 + 499) = EUR(1100). He
426 // started with 2000 so has 900 remaining
427 // Bob received USD(10 + 400 + 600 + 499) = USD(1509).
428 // Alice spent 10 + 100*4 + 199*3 + 499 = 1506 USD. She
429 // started with 4000 so has 2494 USD remaining. Alice
430 // received 200 + 400 + 500 = 1100 EUR
431 env.trust(EUR(10000), bob);
432 env.close();
433 env(pay(gw, bob, EUR(2000)));
434 env.close();
435 env(offer(bob, USD(4000), EUR(4000)));
436 env.close();
437
438 env.require(balance(bob, USD(1509)));
439 env.require(balance(bob, EUR(900)));
440 env.require(offers(bob, 1));
441 env.require(owners(bob, 3));
442
443 env.require(balance(alice, USD(2494)));
444 env.require(balance(alice, EUR(1100)));
445 auto const numAOffers =
446 1 + 2000 + 100 + 1000 + 1 - (1 + 2 * 100 + 2 * 199 + 1 + 1);
447 env.require(offers(alice, numAOffers));
448 env.require(owners(alice, numAOffers + 2));
449
450 env.require(offers(carol, 0));
451 }
452 }
453
454 void
456 {
457 // Taker and FlowCross are too different in the way they handle
458 // autobridging to make one test suit both approaches.
459 //
460 // o Taker alternates between books, completing one full increment
461 // before returning to make another pass.
462 //
463 // o FlowCross extracts as much as possible in one book at one Quality
464 // before proceeding to the other book. This reduces the number of
465 // times we change books.
466 //
467 // So the tests for the two forms of autobridging are separate.
468 if (features[featureFlowCross])
470 else
472 }
473
474 void
476 {
477 testcase("Offer Overflow");
478
479 using namespace jtx;
480
481 auto const gw = Account("gateway");
482 auto const alice = Account("alice");
483 auto const bob = Account("bob");
484
485 auto const USD = gw["USD"];
486
487 Env env(*this, features);
488
489 env.fund(XRP(100000000), gw, alice, bob);
490
491 env.trust(USD(8000), alice);
492 env.trust(USD(8000), bob);
493 env.close();
494
495 env(pay(gw, alice, USD(8000)));
496 env.close();
497
498 // The new flow cross handles consuming excessive offers differently
499 // than the old offer crossing code. In the old code, the total number
500 // of consumed offers is tracked, and the crossings will stop after this
501 // limit is hit. In the new code, the number of offers is tracked per
502 // offerbook and per quality. This test shows how they can differ. Set
503 // up a book with many offers. At each quality keep the number of offers
504 // below the limit. However, if all the offers are consumed it would
505 // create a tecOVERSIZE error.
506
507 // The featureFlowSortStrands introduces a way of tracking the total
508 // number of consumed offers; with this feature the transaction no
509 // longer fails with a tecOVERSIZE error.
510 // The implementation allows any single step to consume at most 1000
511 // offers. With the `FlowSortStrands` feature enabled, if the total
512 // number of offers consumed by all the steps combined exceeds 1500, the
513 // payment stops. Since the first set of offers consumes 998 offers, the
514 // second set will consume 998, which is not over the limit and the
515 // payment stops. So 2*998, or 1996 is the expected value when
516 // `FlowSortStrands` is enabled.
517 n_offers(env, 998, alice, XRP(1.00), USD(1));
518 n_offers(env, 998, alice, XRP(0.99), USD(1));
519 n_offers(env, 998, alice, XRP(0.98), USD(1));
520 n_offers(env, 998, alice, XRP(0.97), USD(1));
521 n_offers(env, 998, alice, XRP(0.96), USD(1));
522 n_offers(env, 998, alice, XRP(0.95), USD(1));
523
524 bool const withFlowCross = features[featureFlowCross];
525 bool const withSortStrands = features[featureFlowSortStrands];
526
527 auto const expectedTER = [&]() -> TER {
528 if (withFlowCross && !withSortStrands)
529 return TER{tecOVERSIZE};
530 return tesSUCCESS;
531 }();
532
533 env(offer(bob, USD(8000), XRP(8000)), ter(expectedTER));
534 env.close();
535
536 auto const expectedUSD = [&] {
537 if (!withFlowCross)
538 return USD(850);
539 if (!withSortStrands)
540 return USD(0);
541 return USD(1996);
542 }();
543
544 env.require(balance(bob, expectedUSD));
545 }
546
547 void
548 run() override
549 {
550 auto testAll = [this](FeatureBitset features) {
551 testStepLimit(features);
552 testCrossingLimit(features);
553 testStepAndCrossingLimit(features);
554 testAutoBridgedLimits(features);
555 testOfferOverflow(features);
556 };
557 using namespace jtx;
558 auto const sa = supported_amendments();
559 testAll(sa);
560 testAll(sa - featureFlowSortStrands);
561 testAll(sa - featureFlowCross - featureFlowSortStrands);
562 }
563};
564
565BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(CrossingLimits, tx, ripple, 10);
566
567} // namespace test
568} // namespace ripple
A testsuite class.
Definition: suite.h:55
testcase_t testcase
Memberspace for declaring test cases.
Definition: suite.h:155
void testStepAndCrossingLimit(FeatureBitset features)
void testAutoBridgedLimitsTaker(FeatureBitset features)
void testAutoBridgedLimits(FeatureBitset features)
void testStepLimit(FeatureBitset features)
void testCrossingLimit(FeatureBitset features)
void run() override
Runs the suite.
void testAutoBridgedLimitsFlowCross(FeatureBitset features)
void testOfferOverflow(FeatureBitset features)
Immutable cryptographic account descriptor.
Definition: Account.h:39
A transaction testing environment.
Definition: Env.h:118
void require(Args const &... args)
Check a set of requirements.
Definition: Env.h:530
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Definition: Env.cpp:115
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
Definition: Env.cpp:262
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition: Env.cpp:231
A balance matches.
Definition: balance.h:39
Match the number of items in the account's owner directory.
Definition: owners.h:71
Set the expected result code for a JTx The test will fail if the code doesn't match.
Definition: ter.h:35
static none_t const none
Definition: tags.h:34
owner_count< ltOFFER > offers
Match the number of offers in the account's owner directory.
Definition: owners.h:90
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
Definition: pay.cpp:29
void n_offers(Env &env, std::size_t n, Account const &account, STAmount const &in, STAmount const &out)
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
Definition: offer.cpp:28
XRP_t const XRP
Converts to XRP Issue or STAmount.
Definition: amount.cpp:104
FeatureBitset supported_amendments()
Definition: Env.h:71
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
@ tecOVERSIZE
Definition: TER.h:298
@ tesSUCCESS
Definition: TER.h:242