From 2faaa01d8e7054ab4c9e314ffe27571a182bfc13 Mon Sep 17 00:00:00 2001 From: Bronek Date: Mon, 15 Sep 2025 07:51:47 -0700 Subject: [PATCH] deploy: 37c377a1b6ab18055bd3c8b954c5de97aaee683b --- ApplyContext_8cpp_source.html | 2 +- ApplyContext_8h_source.html | 2 +- ApplyStateTable_8cpp_source.html | 2 +- ApplyStateTable_8h_source.html | 2 +- ApplyViewImpl_8cpp_source.html | 2 +- ApplyViewImpl_8h_source.html | 2 +- CanonicalTXSet_8cpp_source.html | 2 +- EscrowToken__test_8cpp_source.html | 838 ++++++++++-------- Escrow_8cpp_source.html | 823 ++++++++--------- Escrow_8h_source.html | 8 +- InvariantCheck_8cpp_source.html | 2 +- InvariantCheck_8h_source.html | 2 +- Livecache__test_8cpp_source.html | 2 +- PayChan_8cpp_source.html | 2 +- PaymentSandbox_8cpp_source.html | 2 +- RCLConsensus_8cpp_source.html | 2 +- RCLConsensus_8h_source.html | 2 +- STNumber__test_8cpp_source.html | 2 +- Transactor_8cpp_source.html | 2 +- VaultWithdraw_8cpp_source.html | 2 +- View_8cpp_source.html | 336 +++---- View_8h_source.html | 323 +++---- classripple_1_1EscrowCancel.html | 6 +- classripple_1_1EscrowFinish.html | 2 +- namespacemembers_func_r.html | 2 +- namespacemembers_r.html | 2 +- namespaceripple.html | 30 +- search/all_19.js | 2 +- search/functions_12.js | 2 +- ...ctripple_1_1test_1_1EscrowToken__test.html | 14 +- 30 files changed, 1265 insertions(+), 1157 deletions(-) diff --git a/ApplyContext_8cpp_source.html b/ApplyContext_8cpp_source.html index 31b5908e84..05073a3e49 100644 --- a/ApplyContext_8cpp_source.html +++ b/ApplyContext_8cpp_source.html @@ -294,7 +294,7 @@ $(document).ready(function() { init_codefold(0); });
@ tecINVARIANT_FAILED
Definition TER.h:313
bool isTesSuccess(TER x) noexcept
Definition TER.h:674
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
ApplyFlags
Definition ApplyView.h:31
@ tapDRY_RUN
Definition ApplyView.h:50
diff --git a/ApplyContext_8h_source.html b/ApplyContext_8h_source.html index f740c6afa5..9bea661242 100644 --- a/ApplyContext_8h_source.html +++ b/ApplyContext_8h_source.html @@ -287,7 +287,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
ApplyFlags
Definition ApplyView.h:31
@ tapBATCH
Definition ApplyView.h:46
STL namespace.
diff --git a/ApplyStateTable_8cpp_source.html b/ApplyStateTable_8cpp_source.html index 8cf25dfd61..10d79a3659 100644 --- a/ApplyStateTable_8cpp_source.html +++ b/ApplyStateTable_8cpp_source.html @@ -895,7 +895,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
LedgerEntryType
Identifiers for on-ledger objects.
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
STL namespace.
diff --git a/ApplyStateTable_8h_source.html b/ApplyStateTable_8h_source.html index 4d689aa322..a10f3a2cf8 100644 --- a/ApplyStateTable_8h_source.html +++ b/ApplyStateTable_8h_source.html @@ -294,7 +294,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
diff --git a/ApplyViewImpl_8cpp_source.html b/ApplyViewImpl_8cpp_source.html index f45160be85..764973daad 100644 --- a/ApplyViewImpl_8cpp_source.html +++ b/ApplyViewImpl_8cpp_source.html @@ -165,7 +165,7 @@ $(document).ready(function() { init_codefold(0); });
detail::ApplyStateTable items_
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
ApplyFlags
Definition ApplyView.h:31
diff --git a/ApplyViewImpl_8h_source.html b/ApplyViewImpl_8h_source.html index 5682f4eb65..7bd6fb67b2 100644 --- a/ApplyViewImpl_8h_source.html +++ b/ApplyViewImpl_8h_source.html @@ -184,7 +184,7 @@ $(document).ready(function() { init_codefold(0); });
ApplyFlags flags() const override
Returns the tx apply flags.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
ApplyFlags
Definition ApplyView.h:31
diff --git a/CanonicalTXSet_8cpp_source.html b/CanonicalTXSet_8cpp_source.html index 1ffbbd75b6..cd0d8b955d 100644 --- a/CanonicalTXSet_8cpp_source.html +++ b/CanonicalTXSet_8cpp_source.html @@ -196,7 +196,7 @@ $(document).ready(function() { init_codefold(0); });
T make_pair(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
bool operator<(Slice const &lhs, Slice const &rhs) noexcept
Definition Slice.h:223
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
diff --git a/EscrowToken__test_8cpp_source.html b/EscrowToken__test_8cpp_source.html index 78ed543bcc..30c0482899 100644 --- a/EscrowToken__test_8cpp_source.html +++ b/EscrowToken__test_8cpp_source.html @@ -3646,406 +3646,474 @@ $(document).ready(function() { init_codefold(0); });
3501 BEAST_EXPECT(
3502 transferRate.value == std::uint32_t(1'000'000'000 * 1.25));
3503
-
3504 // bob can finish escrow
-
3505 env(escrow::finish(bob, alice, seq1),
-
3506 escrow::condition(escrow::cb1),
-
3507 escrow::fulfillment(escrow::fb1),
-
3508 fee(baseFee * 150));
-
3509 env.close();
-
3510
-
3511 BEAST_EXPECT(env.balance(alice, MPT) == preAlice - delta);
-
3512 BEAST_EXPECT(env.balance(bob, MPT) == MPT(10'100));
-
3513 }
+
3504 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 125);
+
3505 BEAST_EXPECT(issuerMPTEscrowed(env, MPT) == 125);
+
3506 BEAST_EXPECT(env.balance(gw, MPT) == MPT(20'000));
+
3507
+
3508 // bob can finish escrow
+
3509 env(escrow::finish(bob, alice, seq1),
+
3510 escrow::condition(escrow::cb1),
+
3511 escrow::fulfillment(escrow::fb1),
+
3512 fee(baseFee * 150));
+
3513 env.close();
3514
-
3515 // test locked rate: cancel
-
3516 {
-
3517 Env env{*this, features};
-
3518 auto const baseFee = env.current()->fees().base;
-
3519 auto const alice = Account("alice");
-
3520 auto const bob = Account("bob");
-
3521 auto const gw = Account("gw");
-
3522
-
3523 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
-
3524 mptGw.create(
-
3525 {.transferFee = 25000,
-
3526 .ownerCount = 1,
-
3527 .holderCount = 0,
-
3528 .flags = tfMPTCanEscrow | tfMPTCanTransfer});
-
3529 mptGw.authorize({.account = alice});
-
3530 mptGw.authorize({.account = bob});
-
3531 auto const MPT = mptGw["MPT"];
-
3532 env(pay(gw, alice, MPT(10'000)));
-
3533 env(pay(gw, bob, MPT(10'000)));
-
3534 env.close();
+
3515 BEAST_EXPECT(env.balance(alice, MPT) == preAlice - delta);
+
3516 BEAST_EXPECT(env.balance(bob, MPT) == MPT(10'100));
+
3517
+
3518 auto const escrowedWithFix =
+
3519 env.current()->rules().enabled(fixTokenEscrowV1) ? 0 : 25;
+
3520 auto const outstandingWithFix =
+
3521 env.current()->rules().enabled(fixTokenEscrowV1) ? MPT(19'975)
+
3522 : MPT(20'000);
+
3523 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == escrowedWithFix);
+
3524 BEAST_EXPECT(issuerMPTEscrowed(env, MPT) == escrowedWithFix);
+
3525 BEAST_EXPECT(env.balance(gw, MPT) == outstandingWithFix);
+
3526 }
+
3527
+
3528 // test locked rate: cancel
+
3529 {
+
3530 Env env{*this, features};
+
3531 auto const baseFee = env.current()->fees().base;
+
3532 auto const alice = Account("alice");
+
3533 auto const bob = Account("bob");
+
3534 auto const gw = Account("gw");
3535
-
3536 // alice can create escrow w/ xfer rate
-
3537 auto const preAlice = env.balance(alice, MPT);
-
3538 auto const preBob = env.balance(bob, MPT);
-
3539 auto const seq1 = env.seq(alice);
-
3540 auto const delta = MPT(125);
-
3541 env(escrow::create(alice, bob, MPT(125)),
-
3542 escrow::condition(escrow::cb1),
-
3543 escrow::finish_time(env.now() + 1s),
-
3544 escrow::cancel_time(env.now() + 3s),
-
3545 fee(baseFee * 150));
-
3546 env.close();
-
3547 auto const transferRate = escrow::rate(env, alice, seq1);
-
3548 BEAST_EXPECT(
-
3549 transferRate.value == std::uint32_t(1'000'000'000 * 1.25));
-
3550
-
3551 // alice can cancel escrow
-
3552 env(escrow::cancel(alice, alice, seq1), fee(baseFee));
-
3553 env.close();
-
3554
-
3555 BEAST_EXPECT(env.balance(alice, MPT) == preAlice);
-
3556 BEAST_EXPECT(env.balance(bob, MPT) == preBob);
-
3557 }
-
3558 }
+
3536 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
+
3537 mptGw.create(
+
3538 {.transferFee = 25000,
+
3539 .ownerCount = 1,
+
3540 .holderCount = 0,
+
3541 .flags = tfMPTCanEscrow | tfMPTCanTransfer});
+
3542 mptGw.authorize({.account = alice});
+
3543 mptGw.authorize({.account = bob});
+
3544 auto const MPT = mptGw["MPT"];
+
3545 env(pay(gw, alice, MPT(10'000)));
+
3546 env(pay(gw, bob, MPT(10'000)));
+
3547 env.close();
+
3548
+
3549 // alice can create escrow w/ xfer rate
+
3550 auto const preAlice = env.balance(alice, MPT);
+
3551 auto const preBob = env.balance(bob, MPT);
+
3552 auto const seq1 = env.seq(alice);
+
3553 auto const delta = MPT(125);
+
3554 env(escrow::create(alice, bob, MPT(125)),
+
3555 escrow::condition(escrow::cb1),
+
3556 escrow::finish_time(env.now() + 1s),
+
3557 escrow::cancel_time(env.now() + 3s),
+
3558 fee(baseFee * 150));
+
3559 env.close();
+
3560 auto const transferRate = escrow::rate(env, alice, seq1);
+
3561 BEAST_EXPECT(
+
3562 transferRate.value == std::uint32_t(1'000'000'000 * 1.25));
+
3563
+
3564 // alice can cancel escrow
+
3565 env(escrow::cancel(alice, alice, seq1), fee(baseFee));
+
3566 env.close();
+
3567
+
3568 BEAST_EXPECT(env.balance(alice, MPT) == preAlice);
+
3569 BEAST_EXPECT(env.balance(bob, MPT) == preBob);
+
3570 BEAST_EXPECT(env.balance(gw, MPT) == MPT(20'000));
+
3571 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 0);
+
3572 BEAST_EXPECT(issuerMPTEscrowed(env, MPT) == 0);
+
3573 }
+
3574
+
3575 // test locked rate: issuer is destination
+
3576 {
+
3577 Env env{*this, features};
+
3578 auto const baseFee = env.current()->fees().base;
+
3579 auto const alice = Account("alice");
+
3580 auto const bob = Account("bob");
+
3581 auto const gw = Account("gw");
+
3582
+
3583 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
+
3584 mptGw.create(
+
3585 {.transferFee = 25000,
+
3586 .ownerCount = 1,
+
3587 .holderCount = 0,
+
3588 .flags = tfMPTCanEscrow | tfMPTCanTransfer});
+
3589 mptGw.authorize({.account = alice});
+
3590 mptGw.authorize({.account = bob});
+
3591 auto const MPT = mptGw["MPT"];
+
3592 env(pay(gw, alice, MPT(10'000)));
+
3593 env(pay(gw, bob, MPT(10'000)));
+
3594 env.close();
+
3595
+
3596 // alice can create escrow w/ xfer rate
+
3597 auto const preAlice = env.balance(alice, MPT);
+
3598 auto const seq1 = env.seq(alice);
+
3599 auto const delta = MPT(125);
+
3600 env(escrow::create(alice, gw, MPT(125)),
+
3601 escrow::condition(escrow::cb1),
+
3602 escrow::finish_time(env.now() + 1s),
+
3603 fee(baseFee * 150));
+
3604 env.close();
+
3605 auto const transferRate = escrow::rate(env, alice, seq1);
+
3606 BEAST_EXPECT(
+
3607 transferRate.value == std::uint32_t(1'000'000'000 * 1.25));
+
3608
+
3609 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 125);
+
3610 BEAST_EXPECT(issuerMPTEscrowed(env, MPT) == 125);
+
3611 BEAST_EXPECT(env.balance(gw, MPT) == MPT(20'000));
+
3612
+
3613 // bob can finish escrow
+
3614 env(escrow::finish(gw, alice, seq1),
+
3615 escrow::condition(escrow::cb1),
+
3616 escrow::fulfillment(escrow::fb1),
+
3617 fee(baseFee * 150));
+
3618 env.close();
+
3619
+
3620 BEAST_EXPECT(env.balance(alice, MPT) == preAlice - delta);
+
3621 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 0);
+
3622 BEAST_EXPECT(issuerMPTEscrowed(env, MPT) == 0);
+
3623 BEAST_EXPECT(env.balance(gw, MPT) == MPT(19'875));
+
3624 }
+
3625 }
-
3559
-
3560 void
-
- -
3562 {
-
3563 testcase("MPT Require Auth");
-
3564 using namespace test::jtx;
-
3565 using namespace std::literals;
-
3566
-
3567 Env env{*this, features};
-
3568 auto const baseFee = env.current()->fees().base;
-
3569 auto const alice = Account("alice");
-
3570 auto const bob = Account("bob");
-
3571 auto const gw = Account("gw");
-
3572
-
3573 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
-
3574 mptGw.create(
-
3575 {.ownerCount = 1,
-
3576 .holderCount = 0,
- -
3578 mptGw.authorize({.account = alice});
-
3579 mptGw.authorize({.account = gw, .holder = alice});
-
3580 mptGw.authorize({.account = bob});
-
3581 mptGw.authorize({.account = gw, .holder = bob});
-
3582 auto const MPT = mptGw["MPT"];
-
3583 env(pay(gw, alice, MPT(10'000)));
-
3584 env.close();
-
3585
-
3586 auto seq = env.seq(alice);
-
3587 auto const delta = MPT(125);
-
3588 // alice can create escrow - is authorized
-
3589 env(escrow::create(alice, bob, MPT(100)),
- -
3591 escrow::finish_time(env.now() + 1s),
-
3592 fee(baseFee * 150));
-
3593 env.close();
-
3594
-
3595 // bob can finish escrow - is authorized
-
3596 env(escrow::finish(bob, alice, seq),
- - -
3599 fee(baseFee * 150));
-
3600 env.close();
-
3601 }
-
-
3602
-
3603 void
-
- -
3605 {
-
3606 testcase("MPT Lock");
-
3607 using namespace test::jtx;
-
3608 using namespace std::literals;
-
3609
-
3610 Env env{*this, features};
-
3611 auto const baseFee = env.current()->fees().base;
-
3612 auto const alice = Account("alice");
-
3613 auto const bob = Account("bob");
-
3614 auto const gw = Account("gw");
-
3615
-
3616 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
-
3617 mptGw.create(
-
3618 {.ownerCount = 1,
-
3619 .holderCount = 0,
- -
3621 mptGw.authorize({.account = alice});
-
3622 mptGw.authorize({.account = bob});
-
3623 auto const MPT = mptGw["MPT"];
-
3624 env(pay(gw, alice, MPT(10'000)));
-
3625 env(pay(gw, bob, MPT(10'000)));
-
3626 env.close();
-
3627
-
3628 // alice create escrow
-
3629 auto seq1 = env.seq(alice);
-
3630 env(escrow::create(alice, bob, MPT(100)),
- -
3632 escrow::finish_time(env.now() + 1s),
-
3633 escrow::cancel_time(env.now() + 2s),
-
3634 fee(baseFee * 150));
-
3635 env.close();
-
3636
-
3637 // lock account & dest
-
3638 mptGw.set({.account = gw, .holder = alice, .flags = tfMPTLock});
-
3639 mptGw.set({.account = gw, .holder = bob, .flags = tfMPTLock});
-
3640
-
3641 // bob cannot finish
-
3642 env(escrow::finish(bob, alice, seq1),
- - -
3645 fee(baseFee * 150),
-
3646 ter(tecLOCKED));
-
3647 env.close();
-
3648
-
3649 // bob can cancel
-
3650 env(escrow::cancel(bob, alice, seq1));
+
3626
+
3627 void
+
+ +
3629 {
+
3630 testcase("MPT Require Auth");
+
3631 using namespace test::jtx;
+
3632 using namespace std::literals;
+
3633
+
3634 Env env{*this, features};
+
3635 auto const baseFee = env.current()->fees().base;
+
3636 auto const alice = Account("alice");
+
3637 auto const bob = Account("bob");
+
3638 auto const gw = Account("gw");
+
3639
+
3640 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
+
3641 mptGw.create(
+
3642 {.ownerCount = 1,
+
3643 .holderCount = 0,
+ +
3645 mptGw.authorize({.account = alice});
+
3646 mptGw.authorize({.account = gw, .holder = alice});
+
3647 mptGw.authorize({.account = bob});
+
3648 mptGw.authorize({.account = gw, .holder = bob});
+
3649 auto const MPT = mptGw["MPT"];
+
3650 env(pay(gw, alice, MPT(10'000)));
3651 env.close();
-
3652 }
+
3652
+
3653 auto seq = env.seq(alice);
+
3654 auto const delta = MPT(125);
+
3655 // alice can create escrow - is authorized
+
3656 env(escrow::create(alice, bob, MPT(100)),
+ +
3658 escrow::finish_time(env.now() + 1s),
+
3659 fee(baseFee * 150));
+
3660 env.close();
+
3661
+
3662 // bob can finish escrow - is authorized
+
3663 env(escrow::finish(bob, alice, seq),
+ + +
3666 fee(baseFee * 150));
+
3667 env.close();
+
3668 }
-
3653
-
3654 void
-
- -
3656 {
-
3657 testcase("MPT Can Transfer");
-
3658 using namespace test::jtx;
-
3659 using namespace std::literals;
-
3660
-
3661 Env env{*this, features};
-
3662 auto const baseFee = env.current()->fees().base;
-
3663 auto const alice = Account("alice");
-
3664 auto const bob = Account("bob");
-
3665 auto const gw = Account("gw");
-
3666
-
3667 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
-
3668 mptGw.create(
-
3669 {.ownerCount = 1, .holderCount = 0, .flags = tfMPTCanEscrow});
-
3670 mptGw.authorize({.account = alice});
-
3671 mptGw.authorize({.account = bob});
-
3672 auto const MPT = mptGw["MPT"];
-
3673 env(pay(gw, alice, MPT(10'000)));
-
3674 env(pay(gw, bob, MPT(10'000)));
-
3675 env.close();
+
3669
+
3670 void
+
+ +
3672 {
+
3673 testcase("MPT Lock");
+
3674 using namespace test::jtx;
+
3675 using namespace std::literals;
3676
-
3677 // alice cannot create escrow to non issuer
-
3678 env(escrow::create(alice, bob, MPT(100)),
- -
3680 escrow::finish_time(env.now() + 1s),
-
3681 escrow::cancel_time(env.now() + 2s),
-
3682 fee(baseFee * 150),
-
3683 ter(tecNO_AUTH));
-
3684 env.close();
-
3685
-
3686 // Escrow Create & Finish
-
3687 {
-
3688 // alice an create escrow to issuer
-
3689 auto seq = env.seq(alice);
-
3690 env(escrow::create(alice, gw, MPT(100)),
- -
3692 escrow::finish_time(env.now() + 1s),
-
3693 fee(baseFee * 150));
-
3694 env.close();
-
3695
-
3696 // gw can finish
-
3697 env(escrow::finish(gw, alice, seq),
- - -
3700 fee(baseFee * 150));
-
3701 env.close();
-
3702 }
+
3677 Env env{*this, features};
+
3678 auto const baseFee = env.current()->fees().base;
+
3679 auto const alice = Account("alice");
+
3680 auto const bob = Account("bob");
+
3681 auto const gw = Account("gw");
+
3682
+
3683 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
+
3684 mptGw.create(
+
3685 {.ownerCount = 1,
+
3686 .holderCount = 0,
+ +
3688 mptGw.authorize({.account = alice});
+
3689 mptGw.authorize({.account = bob});
+
3690 auto const MPT = mptGw["MPT"];
+
3691 env(pay(gw, alice, MPT(10'000)));
+
3692 env(pay(gw, bob, MPT(10'000)));
+
3693 env.close();
+
3694
+
3695 // alice create escrow
+
3696 auto seq1 = env.seq(alice);
+
3697 env(escrow::create(alice, bob, MPT(100)),
+ +
3699 escrow::finish_time(env.now() + 1s),
+
3700 escrow::cancel_time(env.now() + 2s),
+
3701 fee(baseFee * 150));
+
3702 env.close();
3703
-
3704 // Escrow Create & Cancel
-
3705 {
-
3706 // alice an create escrow to issuer
-
3707 auto seq = env.seq(alice);
-
3708 env(escrow::create(alice, gw, MPT(100)),
- -
3710 escrow::finish_time(env.now() + 1s),
-
3711 escrow::cancel_time(env.now() + 2s),
-
3712 fee(baseFee * 150));
-
3713 env.close();
-
3714
-
3715 // alice can cancel
-
3716 env(escrow::cancel(alice, alice, seq));
-
3717 env.close();
-
3718 }
+
3704 // lock account & dest
+
3705 mptGw.set({.account = gw, .holder = alice, .flags = tfMPTLock});
+
3706 mptGw.set({.account = gw, .holder = bob, .flags = tfMPTLock});
+
3707
+
3708 // bob cannot finish
+
3709 env(escrow::finish(bob, alice, seq1),
+ + +
3712 fee(baseFee * 150),
+
3713 ter(tecLOCKED));
+
3714 env.close();
+
3715
+
3716 // bob can cancel
+
3717 env(escrow::cancel(bob, alice, seq1));
+
3718 env.close();
3719 }
3720
3721 void
- +
3723 {
-
3724 testcase("MPT Destroy");
+
3724 testcase("MPT Can Transfer");
3725 using namespace test::jtx;
3726 using namespace std::literals;
3727
-
3728 // tecHAS_OBLIGATIONS: issuer cannot destroy issuance
-
3729 {
-
3730 Env env{*this, features};
-
3731 auto const baseFee = env.current()->fees().base;
-
3732 auto const alice = Account("alice");
-
3733 auto const bob = Account("bob");
-
3734 auto const gw = Account("gw");
-
3735
-
3736 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
-
3737 mptGw.create(
-
3738 {.ownerCount = 1,
-
3739 .holderCount = 0,
-
3740 .flags = tfMPTCanEscrow | tfMPTCanTransfer});
-
3741 mptGw.authorize({.account = alice});
-
3742 mptGw.authorize({.account = bob});
-
3743 auto const MPT = mptGw["MPT"];
-
3744 env(pay(gw, alice, MPT(10'000)));
-
3745 env(pay(gw, bob, MPT(10'000)));
-
3746 env.close();
-
3747
-
3748 auto const seq1 = env.seq(alice);
-
3749 env(escrow::create(alice, bob, MPT(10)),
- -
3751 escrow::finish_time(env.now() + 1s),
-
3752 fee(baseFee * 150));
-
3753 env.close();
-
3754
-
3755 env(pay(alice, gw, MPT(10'000)), ter(tecPATH_PARTIAL));
-
3756 env(pay(alice, gw, MPT(9'990)));
-
3757 env(pay(bob, gw, MPT(10'000)));
-
3758 BEAST_EXPECT(env.balance(alice, MPT) == MPT(0));
-
3759 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 10);
-
3760 BEAST_EXPECT(env.balance(bob, MPT) == MPT(0));
-
3761 BEAST_EXPECT(mptEscrowed(env, bob, MPT) == 0);
-
3762 BEAST_EXPECT(env.balance(gw, MPT) == MPT(10));
-
3763 mptGw.authorize({.account = bob, .flags = tfMPTUnauthorize});
-
3764 mptGw.destroy(
-
3765 {.id = mptGw.issuanceID(),
-
3766 .ownerCount = 1,
-
3767 .err = tecHAS_OBLIGATIONS});
-
3768
-
3769 env(escrow::finish(bob, alice, seq1),
- - -
3772 fee(baseFee * 150),
-
3773 ter(tesSUCCESS));
-
3774 env.close();
-
3775
-
3776 env(pay(bob, gw, MPT(10)));
-
3777 mptGw.destroy({.id = mptGw.issuanceID(), .ownerCount = 0});
-
3778 }
-
3779
-
3780 // tecHAS_OBLIGATIONS: holder cannot destroy mptoken
-
3781 {
-
3782 Env env{*this, features};
-
3783 auto const baseFee = env.current()->fees().base;
-
3784 auto const alice = Account("alice");
-
3785 auto const bob = Account("bob");
-
3786 auto const gw = Account("gw");
-
3787 env.fund(XRP(10'000), bob);
-
3788 env.close();
-
3789
-
3790 MPTTester mptGw(env, gw, {.holders = {alice}});
-
3791 mptGw.create(
-
3792 {.ownerCount = 1,
-
3793 .holderCount = 0,
-
3794 .flags = tfMPTCanEscrow | tfMPTCanTransfer});
-
3795 mptGw.authorize({.account = alice});
-
3796 auto const MPT = mptGw["MPT"];
-
3797 env(pay(gw, alice, MPT(10'000)));
-
3798 env.close();
-
3799
-
3800 auto const seq1 = env.seq(alice);
-
3801 env(escrow::create(alice, bob, MPT(10)),
- -
3803 escrow::finish_time(env.now() + 1s),
-
3804 fee(baseFee * 150),
-
3805 ter(tesSUCCESS));
-
3806 env.close();
-
3807
-
3808 env(pay(alice, gw, MPT(9'990)));
-
3809 env.close();
-
3810
-
3811 BEAST_EXPECT(env.balance(alice, MPT) == MPT(0));
-
3812 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 10);
-
3813 mptGw.authorize(
-
3814 {.account = alice,
-
3815 .flags = tfMPTUnauthorize,
-
3816 .err = tecHAS_OBLIGATIONS});
-
3817
-
3818 env(escrow::finish(bob, alice, seq1),
- - -
3821 fee(baseFee * 150),
-
3822 ter(tesSUCCESS));
-
3823 env.close();
-
3824
+
3728 Env env{*this, features};
+
3729 auto const baseFee = env.current()->fees().base;
+
3730 auto const alice = Account("alice");
+
3731 auto const bob = Account("bob");
+
3732 auto const gw = Account("gw");
+
3733
+
3734 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
+
3735 mptGw.create(
+
3736 {.ownerCount = 1, .holderCount = 0, .flags = tfMPTCanEscrow});
+
3737 mptGw.authorize({.account = alice});
+
3738 mptGw.authorize({.account = bob});
+
3739 auto const MPT = mptGw["MPT"];
+
3740 env(pay(gw, alice, MPT(10'000)));
+
3741 env(pay(gw, bob, MPT(10'000)));
+
3742 env.close();
+
3743
+
3744 // alice cannot create escrow to non issuer
+
3745 env(escrow::create(alice, bob, MPT(100)),
+ +
3747 escrow::finish_time(env.now() + 1s),
+
3748 escrow::cancel_time(env.now() + 2s),
+
3749 fee(baseFee * 150),
+
3750 ter(tecNO_AUTH));
+
3751 env.close();
+
3752
+
3753 // Escrow Create & Finish
+
3754 {
+
3755 // alice an create escrow to issuer
+
3756 auto seq = env.seq(alice);
+
3757 env(escrow::create(alice, gw, MPT(100)),
+ +
3759 escrow::finish_time(env.now() + 1s),
+
3760 fee(baseFee * 150));
+
3761 env.close();
+
3762
+
3763 // gw can finish
+
3764 env(escrow::finish(gw, alice, seq),
+ + +
3767 fee(baseFee * 150));
+
3768 env.close();
+
3769 }
+
3770
+
3771 // Escrow Create & Cancel
+
3772 {
+
3773 // alice an create escrow to issuer
+
3774 auto seq = env.seq(alice);
+
3775 env(escrow::create(alice, gw, MPT(100)),
+ +
3777 escrow::finish_time(env.now() + 1s),
+
3778 escrow::cancel_time(env.now() + 2s),
+
3779 fee(baseFee * 150));
+
3780 env.close();
+
3781
+
3782 // alice can cancel
+
3783 env(escrow::cancel(alice, alice, seq));
+
3784 env.close();
+
3785 }
+
3786 }
+
+
3787
+
3788 void
+
+ +
3790 {
+
3791 testcase("MPT Destroy");
+
3792 using namespace test::jtx;
+
3793 using namespace std::literals;
+
3794
+
3795 // tecHAS_OBLIGATIONS: issuer cannot destroy issuance
+
3796 {
+
3797 Env env{*this, features};
+
3798 auto const baseFee = env.current()->fees().base;
+
3799 auto const alice = Account("alice");
+
3800 auto const bob = Account("bob");
+
3801 auto const gw = Account("gw");
+
3802
+
3803 MPTTester mptGw(env, gw, {.holders = {alice, bob}});
+
3804 mptGw.create(
+
3805 {.ownerCount = 1,
+
3806 .holderCount = 0,
+
3807 .flags = tfMPTCanEscrow | tfMPTCanTransfer});
+
3808 mptGw.authorize({.account = alice});
+
3809 mptGw.authorize({.account = bob});
+
3810 auto const MPT = mptGw["MPT"];
+
3811 env(pay(gw, alice, MPT(10'000)));
+
3812 env(pay(gw, bob, MPT(10'000)));
+
3813 env.close();
+
3814
+
3815 auto const seq1 = env.seq(alice);
+
3816 env(escrow::create(alice, bob, MPT(10)),
+ +
3818 escrow::finish_time(env.now() + 1s),
+
3819 fee(baseFee * 150));
+
3820 env.close();
+
3821
+
3822 env(pay(alice, gw, MPT(10'000)), ter(tecPATH_PARTIAL));
+
3823 env(pay(alice, gw, MPT(9'990)));
+
3824 env(pay(bob, gw, MPT(10'000)));
3825 BEAST_EXPECT(env.balance(alice, MPT) == MPT(0));
-
3826 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 0);
-
3827 mptGw.authorize({.account = alice, .flags = tfMPTUnauthorize});
-
3828 BEAST_EXPECT(!env.le(keylet::mptoken(MPT.mpt(), alice)));
-
3829 }
-
3830 }
+
3826 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 10);
+
3827 BEAST_EXPECT(env.balance(bob, MPT) == MPT(0));
+
3828 BEAST_EXPECT(mptEscrowed(env, bob, MPT) == 0);
+
3829 BEAST_EXPECT(env.balance(gw, MPT) == MPT(10));
+
3830 mptGw.authorize({.account = bob, .flags = tfMPTUnauthorize});
+
3831 mptGw.destroy(
+
3832 {.id = mptGw.issuanceID(),
+
3833 .ownerCount = 1,
+
3834 .err = tecHAS_OBLIGATIONS});
+
3835
+
3836 env(escrow::finish(bob, alice, seq1),
+ + +
3839 fee(baseFee * 150),
+
3840 ter(tesSUCCESS));
+
3841 env.close();
+
3842
+
3843 env(pay(bob, gw, MPT(10)));
+
3844 mptGw.destroy({.id = mptGw.issuanceID(), .ownerCount = 0});
+
3845 }
+
3846
+
3847 // tecHAS_OBLIGATIONS: holder cannot destroy mptoken
+
3848 {
+
3849 Env env{*this, features};
+
3850 auto const baseFee = env.current()->fees().base;
+
3851 auto const alice = Account("alice");
+
3852 auto const bob = Account("bob");
+
3853 auto const gw = Account("gw");
+
3854 env.fund(XRP(10'000), bob);
+
3855 env.close();
+
3856
+
3857 MPTTester mptGw(env, gw, {.holders = {alice}});
+
3858 mptGw.create(
+
3859 {.ownerCount = 1,
+
3860 .holderCount = 0,
+
3861 .flags = tfMPTCanEscrow | tfMPTCanTransfer});
+
3862 mptGw.authorize({.account = alice});
+
3863 auto const MPT = mptGw["MPT"];
+
3864 env(pay(gw, alice, MPT(10'000)));
+
3865 env.close();
+
3866
+
3867 auto const seq1 = env.seq(alice);
+
3868 env(escrow::create(alice, bob, MPT(10)),
+ +
3870 escrow::finish_time(env.now() + 1s),
+
3871 fee(baseFee * 150),
+
3872 ter(tesSUCCESS));
+
3873 env.close();
+
3874
+
3875 env(pay(alice, gw, MPT(9'990)));
+
3876 env.close();
+
3877
+
3878 BEAST_EXPECT(env.balance(alice, MPT) == MPT(0));
+
3879 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 10);
+
3880 mptGw.authorize(
+
3881 {.account = alice,
+
3882 .flags = tfMPTUnauthorize,
+
3883 .err = tecHAS_OBLIGATIONS});
+
3884
+
3885 env(escrow::finish(bob, alice, seq1),
+ + +
3888 fee(baseFee * 150),
+
3889 ter(tesSUCCESS));
+
3890 env.close();
+
3891
+
3892 BEAST_EXPECT(env.balance(alice, MPT) == MPT(0));
+
3893 BEAST_EXPECT(mptEscrowed(env, alice, MPT) == 0);
+
3894 mptGw.authorize({.account = alice, .flags = tfMPTUnauthorize});
+
3895 BEAST_EXPECT(!env.le(keylet::mptoken(MPT.mpt(), alice)));
+
3896 }
+
3897 }
-
3831
-
3832 void
-
- -
3834 {
-
3835 testIOUEnablement(features);
-
3836 testIOUAllowLockingFlag(features);
-
3837 testIOUCreatePreflight(features);
-
3838 testIOUCreatePreclaim(features);
-
3839 testIOUFinishPreclaim(features);
-
3840 testIOUFinishDoApply(features);
-
3841 testIOUCancelPreclaim(features);
-
3842 testIOUBalances(features);
-
3843 testIOUMetaAndOwnership(features);
-
3844 testIOURippleState(features);
-
3845 testIOUGateway(features);
-
3846 testIOULockedRate(features);
-
3847 testIOULimitAmount(features);
-
3848 testIOURequireAuth(features);
-
3849 testIOUFreeze(features);
-
3850 testIOUINSF(features);
-
3851 testIOUPrecisionLoss(features);
-
3852 }
+
3898
+
3899 void
+
+ +
3901 {
+
3902 testIOUEnablement(features);
+
3903 testIOUAllowLockingFlag(features);
+
3904 testIOUCreatePreflight(features);
+
3905 testIOUCreatePreclaim(features);
+
3906 testIOUFinishPreclaim(features);
+
3907 testIOUFinishDoApply(features);
+
3908 testIOUCancelPreclaim(features);
+
3909 testIOUBalances(features);
+
3910 testIOUMetaAndOwnership(features);
+
3911 testIOURippleState(features);
+
3912 testIOUGateway(features);
+
3913 testIOULockedRate(features);
+
3914 testIOULimitAmount(features);
+
3915 testIOURequireAuth(features);
+
3916 testIOUFreeze(features);
+
3917 testIOUINSF(features);
+
3918 testIOUPrecisionLoss(features);
+
3919 }
-
3853
-
3854 void
-
- -
3856 {
-
3857 testMPTEnablement(features);
-
3858 testMPTCreatePreflight(features);
-
3859 testMPTCreatePreclaim(features);
-
3860 testMPTFinishPreclaim(features);
-
3861 testMPTFinishDoApply(features);
-
3862 testMPTCancelPreclaim(features);
-
3863 testMPTBalances(features);
-
3864 testMPTMetaAndOwnership(features);
-
3865 testMPTGateway(features);
-
3866 testMPTLockedRate(features);
-
3867 testMPTRequireAuth(features);
-
3868 testMPTLock(features);
-
3869 testMPTCanTransfer(features);
-
3870 testMPTDestroy(features);
-
3871 }
+
3920
+
3921 void
+
+ +
3923 {
+
3924 testMPTEnablement(features);
+
3925 testMPTCreatePreflight(features);
+
3926 testMPTCreatePreclaim(features);
+
3927 testMPTFinishPreclaim(features);
+
3928 testMPTFinishDoApply(features);
+
3929 testMPTCancelPreclaim(features);
+
3930 testMPTBalances(features);
+
3931 testMPTMetaAndOwnership(features);
+
3932 testMPTGateway(features);
+
3933 testMPTLockedRate(features);
+
3934 testMPTRequireAuth(features);
+
3935 testMPTLock(features);
+
3936 testMPTCanTransfer(features);
+
3937 testMPTDestroy(features);
+
3938 }
-
3872
-
3873public:
-
3874 void
-
-
3875 run() override
-
3876 {
-
3877 using namespace test::jtx;
- - - -
3881 }
+
3939
+
3940public:
+
3941 void
+
+
3942 run() override
+
3943 {
+
3944 using namespace test::jtx;
+ + + +
3948 testMPTWithFeats(all - fixTokenEscrowV1);
+
3949 }
-
3882};
+
3950};
-
3883
-
3884BEAST_DEFINE_TESTSUITE(EscrowToken, app, ripple);
-
3885
-
3886} // namespace test
-
3887} // namespace ripple
+
3951
+
3952BEAST_DEFINE_TESTSUITE(EscrowToken, app, ripple);
+
3953
+
3954} // namespace test
+
3955} // namespace ripple
Represents a JSON value.
Definition json_value.h:149
@@ -4158,7 +4226,7 @@ $(document).ready(function() { init_codefold(0); });
std::uint32_t value
Definition Rate.h:41
void testMPTBalances(FeatureBitset features)
-
void testIOUWithFeats(FeatureBitset features)
+
void testIOUWithFeats(FeatureBitset features)
void testMPTLockedRate(FeatureBitset features)
void testIOUINSF(FeatureBitset features)
void testIOULimitAmount(FeatureBitset features)
@@ -4169,23 +4237,23 @@ $(document).ready(function() { init_codefold(0); });
static uint64_t issuerMPTEscrowed(jtx::Env const &env, jtx::MPT const &mpt)
static uint64_t mptEscrowed(jtx::Env const &env, jtx::Account const &account, jtx::MPT const &mpt)
void testIOUEnablement(FeatureBitset features)
-
void run() override
Runs the suite.
+
void run() override
Runs the suite.
void testIOUFreeze(FeatureBitset features)
void testIOUAllowLockingFlag(FeatureBitset features)
void testMPTCreatePreclaim(FeatureBitset features)
void testIOUFinishDoApply(FeatureBitset features)
jtx::PrettyAmount issuerBalance(jtx::Env &env, jtx::Account const &account, Issue const &issue)
-
void testMPTRequireAuth(FeatureBitset features)
-
void testMPTCanTransfer(FeatureBitset features)
+
void testMPTRequireAuth(FeatureBitset features)
+
void testMPTCanTransfer(FeatureBitset features)
void testMPTCreatePreflight(FeatureBitset features)
-
void testMPTDestroy(FeatureBitset features)
-
void testMPTLock(FeatureBitset features)
+
void testMPTDestroy(FeatureBitset features)
+
void testMPTLock(FeatureBitset features)
void testIOUCreatePreclaim(FeatureBitset features)
void testIOUPrecisionLoss(FeatureBitset features)
void testIOUBalances(FeatureBitset features)
void testMPTCancelPreclaim(FeatureBitset features)
void testIOUGateway(FeatureBitset features)
-
void testMPTWithFeats(FeatureBitset features)
+
void testMPTWithFeats(FeatureBitset features)
void testIOUFinishPreclaim(FeatureBitset features)
void testIOUCreatePreflight(FeatureBitset features)
void testMPTEnablement(FeatureBitset features)
diff --git a/Escrow_8cpp_source.html b/Escrow_8cpp_source.html index cf8872b34a..c90a79d359 100644 --- a/Escrow_8cpp_source.html +++ b/Escrow_8cpp_source.html @@ -1125,420 +1125,425 @@ $(document).ready(function() { init_codefold(0); });
1007 // compute balance to transfer
1008 finalAmt = amount.value() - xferFee;
1009 }
-
1010
-
1011 return rippleUnlockEscrowMPT(view, sender, receiver, finalAmt, journal);
-
1012}
+
1010 return rippleUnlockEscrowMPT(
+
1011 view,
+
1012 sender,
+
1013 receiver,
+
1014 finalAmt,
+
1015 view.rules().enabled(fixTokenEscrowV1) ? amount : finalAmt,
+
1016 journal);
+
1017}
-
1013
-
1014TER
-
- -
1016{
-
1017 auto const k = keylet::escrow(ctx_.tx[sfOwner], ctx_.tx[sfOfferSequence]);
-
1018 auto const slep = ctx_.view().peek(k);
-
1019 if (!slep)
-
1020 {
-
1021 if (ctx_.view().rules().enabled(featureTokenEscrow))
-
1022 return tecINTERNAL; // LCOV_EXCL_LINE
-
1023
-
1024 return tecNO_TARGET;
-
1025 }
-
1026
-
1027 // If a cancel time is present, a finish operation should only succeed prior
-
1028 // to that time. fix1571 corrects a logic error in the check that would make
-
1029 // a finish only succeed strictly after the cancel time.
-
1030 if (ctx_.view().rules().enabled(fix1571))
-
1031 {
-
1032 auto const now = ctx_.view().info().parentCloseTime;
-
1033
-
1034 // Too soon: can't execute before the finish time
-
1035 if ((*slep)[~sfFinishAfter] && !after(now, (*slep)[sfFinishAfter]))
-
1036 return tecNO_PERMISSION;
-
1037
-
1038 // Too late: can't execute after the cancel time
-
1039 if ((*slep)[~sfCancelAfter] && after(now, (*slep)[sfCancelAfter]))
-
1040 return tecNO_PERMISSION;
-
1041 }
-
1042 else
-
1043 {
-
1044 // Too soon?
-
1045 if ((*slep)[~sfFinishAfter] &&
- -
1047 (*slep)[sfFinishAfter])
-
1048 return tecNO_PERMISSION;
-
1049
-
1050 // Too late?
-
1051 if ((*slep)[~sfCancelAfter] &&
- -
1053 (*slep)[sfCancelAfter])
-
1054 return tecNO_PERMISSION;
-
1055 }
-
1056
-
1057 // Check cryptocondition fulfillment
-
1058 {
-
1059 auto const id = ctx_.tx.getTransactionID();
-
1060 auto flags = ctx_.app.getHashRouter().getFlags(id);
+
1018
+
1019TER
+
+ +
1021{
+
1022 auto const k = keylet::escrow(ctx_.tx[sfOwner], ctx_.tx[sfOfferSequence]);
+
1023 auto const slep = ctx_.view().peek(k);
+
1024 if (!slep)
+
1025 {
+
1026 if (ctx_.view().rules().enabled(featureTokenEscrow))
+
1027 return tecINTERNAL; // LCOV_EXCL_LINE
+
1028
+
1029 return tecNO_TARGET;
+
1030 }
+
1031
+
1032 // If a cancel time is present, a finish operation should only succeed prior
+
1033 // to that time. fix1571 corrects a logic error in the check that would make
+
1034 // a finish only succeed strictly after the cancel time.
+
1035 if (ctx_.view().rules().enabled(fix1571))
+
1036 {
+
1037 auto const now = ctx_.view().info().parentCloseTime;
+
1038
+
1039 // Too soon: can't execute before the finish time
+
1040 if ((*slep)[~sfFinishAfter] && !after(now, (*slep)[sfFinishAfter]))
+
1041 return tecNO_PERMISSION;
+
1042
+
1043 // Too late: can't execute after the cancel time
+
1044 if ((*slep)[~sfCancelAfter] && after(now, (*slep)[sfCancelAfter]))
+
1045 return tecNO_PERMISSION;
+
1046 }
+
1047 else
+
1048 {
+
1049 // Too soon?
+
1050 if ((*slep)[~sfFinishAfter] &&
+ +
1052 (*slep)[sfFinishAfter])
+
1053 return tecNO_PERMISSION;
+
1054
+
1055 // Too late?
+
1056 if ((*slep)[~sfCancelAfter] &&
+ +
1058 (*slep)[sfCancelAfter])
+
1059 return tecNO_PERMISSION;
+
1060 }
1061
-
1062 auto const cb = ctx_.tx[~sfCondition];
-
1063
-
1064 // It's unlikely that the results of the check will
-
1065 // expire from the hash router, but if it happens,
-
1066 // simply re-run the check.
-
1067 if (cb && !any(flags & (SF_CF_INVALID | SF_CF_VALID)))
-
1068 {
-
1069 auto const fb = ctx_.tx[~sfFulfillment];
-
1070
-
1071 if (!fb)
-
1072 return tecINTERNAL;
-
1073
-
1074 if (checkCondition(*fb, *cb))
-
1075 flags = SF_CF_VALID;
-
1076 else
-
1077 flags = SF_CF_INVALID;
+
1062 // Check cryptocondition fulfillment
+
1063 {
+
1064 auto const id = ctx_.tx.getTransactionID();
+
1065 auto flags = ctx_.app.getHashRouter().getFlags(id);
+
1066
+
1067 auto const cb = ctx_.tx[~sfCondition];
+
1068
+
1069 // It's unlikely that the results of the check will
+
1070 // expire from the hash router, but if it happens,
+
1071 // simply re-run the check.
+
1072 if (cb && !any(flags & (SF_CF_INVALID | SF_CF_VALID)))
+
1073 {
+
1074 auto const fb = ctx_.tx[~sfFulfillment];
+
1075
+
1076 if (!fb)
+
1077 return tecINTERNAL;
1078
-
1079 ctx_.app.getHashRouter().setFlags(id, flags);
-
1080 }
-
1081
-
1082 // If the check failed, then simply return an error
-
1083 // and don't look at anything else.
-
1084 if (any(flags & SF_CF_INVALID))
- +
1079 if (checkCondition(*fb, *cb))
+
1080 flags = SF_CF_VALID;
+
1081 else
+
1082 flags = SF_CF_INVALID;
+
1083
+
1084 ctx_.app.getHashRouter().setFlags(id, flags);
+
1085 }
1086
-
1087 // Check against condition in the ledger entry:
-
1088 auto const cond = (*slep)[~sfCondition];
-
1089
-
1090 // If a condition wasn't specified during creation,
-
1091 // one shouldn't be included now.
-
1092 if (!cond && cb)
- +
1087 // If the check failed, then simply return an error
+
1088 // and don't look at anything else.
+
1089 if (any(flags & SF_CF_INVALID))
+ +
1091
+
1092 // Check against condition in the ledger entry:
+
1093 auto const cond = (*slep)[~sfCondition];
1094
-
1095 // If a condition was specified during creation of
-
1096 // the suspended payment, the identical condition
-
1097 // must be presented again. We don't check if the
-
1098 // fulfillment matches the condition since we did
-
1099 // that in preflight.
-
1100 if (cond && (cond != cb))
- -
1102 }
-
1103
-
1104 // NOTE: Escrow payments cannot be used to fund accounts.
-
1105 AccountID const destID = (*slep)[sfDestination];
-
1106 auto const sled = ctx_.view().peek(keylet::account(destID));
-
1107 if (!sled)
-
1108 return tecNO_DST;
-
1109
-
1110 if (ctx_.view().rules().enabled(featureDepositAuth))
-
1111 {
-
1112 if (auto err = verifyDepositPreauth(
-
1113 ctx_.tx, ctx_.view(), account_, destID, sled, ctx_.journal);
-
1114 !isTesSuccess(err))
-
1115 return err;
-
1116 }
-
1117
-
1118 AccountID const account = (*slep)[sfAccount];
-
1119
-
1120 // Remove escrow from owner directory
-
1121 {
-
1122 auto const page = (*slep)[sfOwnerNode];
-
1123 if (!ctx_.view().dirRemove(
-
1124 keylet::ownerDir(account), page, k.key, true))
-
1125 {
-
1126 JLOG(j_.fatal()) << "Unable to delete Escrow from owner.";
-
1127 return tefBAD_LEDGER;
-
1128 }
-
1129 }
-
1130
-
1131 // Remove escrow from recipient's owner directory, if present.
-
1132 if (auto const optPage = (*slep)[~sfDestinationNode])
-
1133 {
-
1134 if (!ctx_.view().dirRemove(
-
1135 keylet::ownerDir(destID), *optPage, k.key, true))
-
1136 {
-
1137 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
-
1138 return tefBAD_LEDGER;
-
1139 }
-
1140 }
-
1141
-
1142 STAmount const amount = slep->getFieldAmount(sfAmount);
-
1143 // Transfer amount to destination
-
1144 if (isXRP(amount))
-
1145 (*sled)[sfBalance] = (*sled)[sfBalance] + amount;
-
1146 else
-
1147 {
-
1148 if (!ctx_.view().rules().enabled(featureTokenEscrow))
-
1149 return temDISABLED; // LCOV_EXCL_LINE
-
1150
-
1151 Rate lockedRate = slep->isFieldPresent(sfTransferRate)
-
1152 ? ripple::Rate(slep->getFieldU32(sfTransferRate))
-
1153 : parityRate;
-
1154 auto const issuer = amount.getIssuer();
-
1155 bool const createAsset = destID == account_;
-
1156 if (auto const ret = std::visit(
-
1157 [&]<typename T>(T const&) {
-
1158 return escrowUnlockApplyHelper<T>(
-
1159 ctx_.view(),
-
1160 lockedRate,
-
1161 sled,
- -
1163 amount,
-
1164 issuer,
-
1165 account,
-
1166 destID,
-
1167 createAsset,
-
1168 j_);
-
1169 },
-
1170 amount.asset().value());
-
1171 !isTesSuccess(ret))
-
1172 return ret;
-
1173
-
1174 // Remove escrow from issuers owner directory, if present.
-
1175 if (auto const optPage = (*slep)[~sfIssuerNode]; optPage)
-
1176 {
-
1177 if (!ctx_.view().dirRemove(
-
1178 keylet::ownerDir(issuer), *optPage, k.key, true))
-
1179 {
-
1180 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
-
1181 return tefBAD_LEDGER; // LCOV_EXCL_LINE
-
1182 }
-
1183 }
-
1184 }
-
1185
-
1186 ctx_.view().update(sled);
-
1187
-
1188 // Adjust source owner count
-
1189 auto const sle = ctx_.view().peek(keylet::account(account));
-
1190 adjustOwnerCount(ctx_.view(), sle, -1, ctx_.journal);
-
1191 ctx_.view().update(sle);
+
1095 // If a condition wasn't specified during creation,
+
1096 // one shouldn't be included now.
+
1097 if (!cond && cb)
+ +
1099
+
1100 // If a condition was specified during creation of
+
1101 // the suspended payment, the identical condition
+
1102 // must be presented again. We don't check if the
+
1103 // fulfillment matches the condition since we did
+
1104 // that in preflight.
+
1105 if (cond && (cond != cb))
+ +
1107 }
+
1108
+
1109 // NOTE: Escrow payments cannot be used to fund accounts.
+
1110 AccountID const destID = (*slep)[sfDestination];
+
1111 auto const sled = ctx_.view().peek(keylet::account(destID));
+
1112 if (!sled)
+
1113 return tecNO_DST;
+
1114
+
1115 if (ctx_.view().rules().enabled(featureDepositAuth))
+
1116 {
+
1117 if (auto err = verifyDepositPreauth(
+
1118 ctx_.tx, ctx_.view(), account_, destID, sled, ctx_.journal);
+
1119 !isTesSuccess(err))
+
1120 return err;
+
1121 }
+
1122
+
1123 AccountID const account = (*slep)[sfAccount];
+
1124
+
1125 // Remove escrow from owner directory
+
1126 {
+
1127 auto const page = (*slep)[sfOwnerNode];
+
1128 if (!ctx_.view().dirRemove(
+
1129 keylet::ownerDir(account), page, k.key, true))
+
1130 {
+
1131 JLOG(j_.fatal()) << "Unable to delete Escrow from owner.";
+
1132 return tefBAD_LEDGER;
+
1133 }
+
1134 }
+
1135
+
1136 // Remove escrow from recipient's owner directory, if present.
+
1137 if (auto const optPage = (*slep)[~sfDestinationNode])
+
1138 {
+
1139 if (!ctx_.view().dirRemove(
+
1140 keylet::ownerDir(destID), *optPage, k.key, true))
+
1141 {
+
1142 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
+
1143 return tefBAD_LEDGER;
+
1144 }
+
1145 }
+
1146
+
1147 STAmount const amount = slep->getFieldAmount(sfAmount);
+
1148 // Transfer amount to destination
+
1149 if (isXRP(amount))
+
1150 (*sled)[sfBalance] = (*sled)[sfBalance] + amount;
+
1151 else
+
1152 {
+
1153 if (!ctx_.view().rules().enabled(featureTokenEscrow))
+
1154 return temDISABLED; // LCOV_EXCL_LINE
+
1155
+
1156 Rate lockedRate = slep->isFieldPresent(sfTransferRate)
+
1157 ? ripple::Rate(slep->getFieldU32(sfTransferRate))
+
1158 : parityRate;
+
1159 auto const issuer = amount.getIssuer();
+
1160 bool const createAsset = destID == account_;
+
1161 if (auto const ret = std::visit(
+
1162 [&]<typename T>(T const&) {
+
1163 return escrowUnlockApplyHelper<T>(
+
1164 ctx_.view(),
+
1165 lockedRate,
+
1166 sled,
+ +
1168 amount,
+
1169 issuer,
+
1170 account,
+
1171 destID,
+
1172 createAsset,
+
1173 j_);
+
1174 },
+
1175 amount.asset().value());
+
1176 !isTesSuccess(ret))
+
1177 return ret;
+
1178
+
1179 // Remove escrow from issuers owner directory, if present.
+
1180 if (auto const optPage = (*slep)[~sfIssuerNode]; optPage)
+
1181 {
+
1182 if (!ctx_.view().dirRemove(
+
1183 keylet::ownerDir(issuer), *optPage, k.key, true))
+
1184 {
+
1185 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
+
1186 return tefBAD_LEDGER; // LCOV_EXCL_LINE
+
1187 }
+
1188 }
+
1189 }
+
1190
+
1191 ctx_.view().update(sled);
1192
-
1193 // Remove escrow from ledger
-
1194 ctx_.view().erase(slep);
-
1195 return tesSUCCESS;
-
1196}
-
+
1193 // Adjust source owner count
+
1194 auto const sle = ctx_.view().peek(keylet::account(account));
+
1195 adjustOwnerCount(ctx_.view(), sle, -1, ctx_.journal);
+
1196 ctx_.view().update(sle);
1197
-
1198//------------------------------------------------------------------------------
-
1199
-
1200NotTEC
-
- -
1202{
-
1203 if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
-
1204 return temINVALID_FLAG;
-
1205
-
1206 if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
-
1207 return ret;
-
1208
-
1209 return preflight2(ctx);
-
1210}
+
1198 // Remove escrow from ledger
+
1199 ctx_.view().erase(slep);
+
1200 return tesSUCCESS;
+
1201}
-
1211
-
1212template <ValidIssueType T>
-
1213static TER
- -
1215 PreclaimContext const& ctx,
-
1216 AccountID const& account,
-
1217 STAmount const& amount);
-
1218
-
1219template <>
-
- - -
1222 PreclaimContext const& ctx,
-
1223 AccountID const& account,
-
1224 STAmount const& amount)
-
1225{
-
1226 AccountID issuer = amount.getIssuer();
-
1227 // If the issuer is the same as the account, return tecINTERNAL
-
1228 if (issuer == account)
-
1229 return tecINTERNAL; // LCOV_EXCL_LINE
-
1230
-
1231 // If the issuer has requireAuth set, check if the account is authorized
-
1232 if (auto const ter = requireAuth(ctx.view, amount.issue(), account);
-
1233 ter != tesSUCCESS)
-
1234 return ter;
+
1202
+
1203//------------------------------------------------------------------------------
+
1204
+
1205NotTEC
+
+ +
1207{
+
1208 if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
+
1209 return temINVALID_FLAG;
+
1210
+
1211 if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
+
1212 return ret;
+
1213
+
1214 return preflight2(ctx);
+
1215}
+
+
1216
+
1217template <ValidIssueType T>
+
1218static TER
+ +
1220 PreclaimContext const& ctx,
+
1221 AccountID const& account,
+
1222 STAmount const& amount);
+
1223
+
1224template <>
+
+ + +
1227 PreclaimContext const& ctx,
+
1228 AccountID const& account,
+
1229 STAmount const& amount)
+
1230{
+
1231 AccountID issuer = amount.getIssuer();
+
1232 // If the issuer is the same as the account, return tecINTERNAL
+
1233 if (issuer == account)
+
1234 return tecINTERNAL; // LCOV_EXCL_LINE
1235
-
1236 return tesSUCCESS;
-
1237}
+
1236 // If the issuer has requireAuth set, check if the account is authorized
+
1237 if (auto const ter = requireAuth(ctx.view, amount.issue(), account);
+
1238 ter != tesSUCCESS)
+
1239 return ter;
+
1240
+
1241 return tesSUCCESS;
+
1242}
-
1238
-
1239template <>
-
- - -
1242 PreclaimContext const& ctx,
-
1243 AccountID const& account,
-
1244 STAmount const& amount)
-
1245{
-
1246 AccountID issuer = amount.getIssuer();
-
1247 // If the issuer is the same as the account, return tecINTERNAL
-
1248 if (issuer == account)
-
1249 return tecINTERNAL; // LCOV_EXCL_LINE
-
1250
-
1251 // If the mpt does not exist, return tecOBJECT_NOT_FOUND
-
1252 auto const issuanceKey =
- -
1254 auto const sleIssuance = ctx.view.read(issuanceKey);
-
1255 if (!sleIssuance)
-
1256 return tecOBJECT_NOT_FOUND;
-
1257
-
1258 // If the issuer has requireAuth set, check if the account is
-
1259 // authorized
-
1260 auto const& mptIssue = amount.get<MPTIssue>();
-
1261 if (auto const ter =
-
1262 requireAuth(ctx.view, mptIssue, account, AuthType::WeakAuth);
-
1263 ter != tesSUCCESS)
-
1264 return ter;
-
1265
-
1266 return tesSUCCESS;
-
1267}
+
1243
+
1244template <>
+
+ + +
1247 PreclaimContext const& ctx,
+
1248 AccountID const& account,
+
1249 STAmount const& amount)
+
1250{
+
1251 AccountID issuer = amount.getIssuer();
+
1252 // If the issuer is the same as the account, return tecINTERNAL
+
1253 if (issuer == account)
+
1254 return tecINTERNAL; // LCOV_EXCL_LINE
+
1255
+
1256 // If the mpt does not exist, return tecOBJECT_NOT_FOUND
+
1257 auto const issuanceKey =
+ +
1259 auto const sleIssuance = ctx.view.read(issuanceKey);
+
1260 if (!sleIssuance)
+
1261 return tecOBJECT_NOT_FOUND;
+
1262
+
1263 // If the issuer has requireAuth set, check if the account is
+
1264 // authorized
+
1265 auto const& mptIssue = amount.get<MPTIssue>();
+
1266 if (auto const ter =
+
1267 requireAuth(ctx.view, mptIssue, account, AuthType::WeakAuth);
+
1268 ter != tesSUCCESS)
+
1269 return ter;
+
1270
+
1271 return tesSUCCESS;
+
1272}
-
1268
-
1269TER
-
- -
1271{
-
1272 if (ctx.view.rules().enabled(featureTokenEscrow))
-
1273 {
-
1274 auto const k = keylet::escrow(ctx.tx[sfOwner], ctx.tx[sfOfferSequence]);
-
1275 auto const slep = ctx.view.read(k);
-
1276 if (!slep)
-
1277 return tecNO_TARGET;
-
1278
-
1279 AccountID const account = (*slep)[sfAccount];
-
1280 STAmount const amount = (*slep)[sfAmount];
-
1281
-
1282 if (!isXRP(amount))
-
1283 {
-
1284 if (auto const ret = std::visit(
-
1285 [&]<typename T>(T const&) {
-
1286 return escrowCancelPreclaimHelper<T>(
-
1287 ctx, account, amount);
-
1288 },
-
1289 amount.asset().value());
-
1290 !isTesSuccess(ret))
-
1291 return ret;
-
1292 }
-
1293 }
-
1294 return tesSUCCESS;
-
1295}
+
1273
+
1274TER
+
+ +
1276{
+
1277 if (ctx.view.rules().enabled(featureTokenEscrow))
+
1278 {
+
1279 auto const k = keylet::escrow(ctx.tx[sfOwner], ctx.tx[sfOfferSequence]);
+
1280 auto const slep = ctx.view.read(k);
+
1281 if (!slep)
+
1282 return tecNO_TARGET;
+
1283
+
1284 AccountID const account = (*slep)[sfAccount];
+
1285 STAmount const amount = (*slep)[sfAmount];
+
1286
+
1287 if (!isXRP(amount))
+
1288 {
+
1289 if (auto const ret = std::visit(
+
1290 [&]<typename T>(T const&) {
+
1291 return escrowCancelPreclaimHelper<T>(
+
1292 ctx, account, amount);
+
1293 },
+
1294 amount.asset().value());
+
1295 !isTesSuccess(ret))
+
1296 return ret;
+
1297 }
+
1298 }
+
1299 return tesSUCCESS;
+
1300}
-
1296
-
1297TER
-
- -
1299{
-
1300 auto const k = keylet::escrow(ctx_.tx[sfOwner], ctx_.tx[sfOfferSequence]);
-
1301 auto const slep = ctx_.view().peek(k);
-
1302 if (!slep)
-
1303 {
-
1304 if (ctx_.view().rules().enabled(featureTokenEscrow))
-
1305 return tecINTERNAL; // LCOV_EXCL_LINE
-
1306
-
1307 return tecNO_TARGET;
-
1308 }
-
1309
-
1310 if (ctx_.view().rules().enabled(fix1571))
-
1311 {
-
1312 auto const now = ctx_.view().info().parentCloseTime;
-
1313
-
1314 // No cancel time specified: can't execute at all.
-
1315 if (!(*slep)[~sfCancelAfter])
-
1316 return tecNO_PERMISSION;
-
1317
-
1318 // Too soon: can't execute before the cancel time.
-
1319 if (!after(now, (*slep)[sfCancelAfter]))
-
1320 return tecNO_PERMISSION;
-
1321 }
-
1322 else
-
1323 {
-
1324 // Too soon?
-
1325 if (!(*slep)[~sfCancelAfter] ||
- -
1327 (*slep)[sfCancelAfter])
-
1328 return tecNO_PERMISSION;
-
1329 }
-
1330
-
1331 AccountID const account = (*slep)[sfAccount];
-
1332
-
1333 // Remove escrow from owner directory
-
1334 {
-
1335 auto const page = (*slep)[sfOwnerNode];
-
1336 if (!ctx_.view().dirRemove(
-
1337 keylet::ownerDir(account), page, k.key, true))
-
1338 {
-
1339 JLOG(j_.fatal()) << "Unable to delete Escrow from owner.";
-
1340 return tefBAD_LEDGER;
-
1341 }
-
1342 }
-
1343
-
1344 // Remove escrow from recipient's owner directory, if present.
-
1345 if (auto const optPage = (*slep)[~sfDestinationNode]; optPage)
-
1346 {
-
1347 if (!ctx_.view().dirRemove(
-
1348 keylet::ownerDir((*slep)[sfDestination]),
-
1349 *optPage,
-
1350 k.key,
-
1351 true))
-
1352 {
-
1353 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
-
1354 return tefBAD_LEDGER;
-
1355 }
-
1356 }
-
1357
-
1358 auto const sle = ctx_.view().peek(keylet::account(account));
-
1359 STAmount const amount = slep->getFieldAmount(sfAmount);
-
1360
-
1361 // Transfer amount back to the owner
-
1362 if (isXRP(amount))
-
1363 (*sle)[sfBalance] = (*sle)[sfBalance] + amount;
-
1364 else
-
1365 {
-
1366 if (!ctx_.view().rules().enabled(featureTokenEscrow))
-
1367 return temDISABLED; // LCOV_EXCL_LINE
-
1368
-
1369 auto const issuer = amount.getIssuer();
-
1370 bool const createAsset = account == account_;
-
1371 if (auto const ret = std::visit(
-
1372 [&]<typename T>(T const&) {
-
1373 return escrowUnlockApplyHelper<T>(
-
1374 ctx_.view(),
-
1375 parityRate,
-
1376 slep,
- -
1378 amount,
-
1379 issuer,
-
1380 account, // sender and receiver are the same
-
1381 account,
-
1382 createAsset,
-
1383 j_);
-
1384 },
-
1385 amount.asset().value());
-
1386 !isTesSuccess(ret))
-
1387 return ret; // LCOV_EXCL_LINE
-
1388
-
1389 // Remove escrow from issuers owner directory, if present.
-
1390 if (auto const optPage = (*slep)[~sfIssuerNode]; optPage)
-
1391 {
-
1392 if (!ctx_.view().dirRemove(
-
1393 keylet::ownerDir(issuer), *optPage, k.key, true))
-
1394 {
-
1395 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
-
1396 return tefBAD_LEDGER; // LCOV_EXCL_LINE
-
1397 }
-
1398 }
-
1399 }
-
1400
-
1401 adjustOwnerCount(ctx_.view(), sle, -1, ctx_.journal);
-
1402 ctx_.view().update(sle);
-
1403
-
1404 // Remove escrow from ledger
-
1405 ctx_.view().erase(slep);
-
1406
-
1407 return tesSUCCESS;
-
1408}
+
1301
+
1302TER
+
+ +
1304{
+
1305 auto const k = keylet::escrow(ctx_.tx[sfOwner], ctx_.tx[sfOfferSequence]);
+
1306 auto const slep = ctx_.view().peek(k);
+
1307 if (!slep)
+
1308 {
+
1309 if (ctx_.view().rules().enabled(featureTokenEscrow))
+
1310 return tecINTERNAL; // LCOV_EXCL_LINE
+
1311
+
1312 return tecNO_TARGET;
+
1313 }
+
1314
+
1315 if (ctx_.view().rules().enabled(fix1571))
+
1316 {
+
1317 auto const now = ctx_.view().info().parentCloseTime;
+
1318
+
1319 // No cancel time specified: can't execute at all.
+
1320 if (!(*slep)[~sfCancelAfter])
+
1321 return tecNO_PERMISSION;
+
1322
+
1323 // Too soon: can't execute before the cancel time.
+
1324 if (!after(now, (*slep)[sfCancelAfter]))
+
1325 return tecNO_PERMISSION;
+
1326 }
+
1327 else
+
1328 {
+
1329 // Too soon?
+
1330 if (!(*slep)[~sfCancelAfter] ||
+ +
1332 (*slep)[sfCancelAfter])
+
1333 return tecNO_PERMISSION;
+
1334 }
+
1335
+
1336 AccountID const account = (*slep)[sfAccount];
+
1337
+
1338 // Remove escrow from owner directory
+
1339 {
+
1340 auto const page = (*slep)[sfOwnerNode];
+
1341 if (!ctx_.view().dirRemove(
+
1342 keylet::ownerDir(account), page, k.key, true))
+
1343 {
+
1344 JLOG(j_.fatal()) << "Unable to delete Escrow from owner.";
+
1345 return tefBAD_LEDGER;
+
1346 }
+
1347 }
+
1348
+
1349 // Remove escrow from recipient's owner directory, if present.
+
1350 if (auto const optPage = (*slep)[~sfDestinationNode]; optPage)
+
1351 {
+
1352 if (!ctx_.view().dirRemove(
+
1353 keylet::ownerDir((*slep)[sfDestination]),
+
1354 *optPage,
+
1355 k.key,
+
1356 true))
+
1357 {
+
1358 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
+
1359 return tefBAD_LEDGER;
+
1360 }
+
1361 }
+
1362
+
1363 auto const sle = ctx_.view().peek(keylet::account(account));
+
1364 STAmount const amount = slep->getFieldAmount(sfAmount);
+
1365
+
1366 // Transfer amount back to the owner
+
1367 if (isXRP(amount))
+
1368 (*sle)[sfBalance] = (*sle)[sfBalance] + amount;
+
1369 else
+
1370 {
+
1371 if (!ctx_.view().rules().enabled(featureTokenEscrow))
+
1372 return temDISABLED; // LCOV_EXCL_LINE
+
1373
+
1374 auto const issuer = amount.getIssuer();
+
1375 bool const createAsset = account == account_;
+
1376 if (auto const ret = std::visit(
+
1377 [&]<typename T>(T const&) {
+
1378 return escrowUnlockApplyHelper<T>(
+
1379 ctx_.view(),
+
1380 parityRate,
+
1381 slep,
+ +
1383 amount,
+
1384 issuer,
+
1385 account, // sender and receiver are the same
+
1386 account,
+
1387 createAsset,
+
1388 j_);
+
1389 },
+
1390 amount.asset().value());
+
1391 !isTesSuccess(ret))
+
1392 return ret; // LCOV_EXCL_LINE
+
1393
+
1394 // Remove escrow from issuers owner directory, if present.
+
1395 if (auto const optPage = (*slep)[~sfIssuerNode]; optPage)
+
1396 {
+
1397 if (!ctx_.view().dirRemove(
+
1398 keylet::ownerDir(issuer), *optPage, k.key, true))
+
1399 {
+
1400 JLOG(j_.fatal()) << "Unable to delete Escrow from recipient.";
+
1401 return tefBAD_LEDGER; // LCOV_EXCL_LINE
+
1402 }
+
1403 }
+
1404 }
+
1405
+
1406 adjustOwnerCount(ctx_.view(), sle, -1, ctx_.journal);
+
1407 ctx_.view().update(sle);
+
1408
+
1409 // Remove escrow from ledger
+
1410 ctx_.view().erase(slep);
+
1411
+
1412 return tesSUCCESS;
+
1413}
-
1409
-
1410} // namespace ripple
+
1414
+
1415} // namespace ripple
A generic endpoint for log messages.
Definition Journal.h:60
Stream fatal() const
Definition Journal.h:352
Stream debug() const
Definition Journal.h:328
@@ -1556,16 +1561,16 @@ $(document).ready(function() { init_codefold(0); });
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
virtual void erase(std::shared_ptr< SLE > const &sle)=0
Remove a peeked SLE.
constexpr value_type const & value() const
Definition Asset.h:156
-
TER doApply() override
Definition Escrow.cpp:1298
-
static NotTEC preflight(PreflightContext const &ctx)
Definition Escrow.cpp:1201
-
static TER preclaim(PreclaimContext const &ctx)
Definition Escrow.cpp:1270
+
TER doApply() override
Definition Escrow.cpp:1303
+
static NotTEC preflight(PreflightContext const &ctx)
Definition Escrow.cpp:1206
+
static TER preclaim(PreclaimContext const &ctx)
Definition Escrow.cpp:1275
static NotTEC preflight(PreflightContext const &ctx)
Definition Escrow.cpp:122
TER doApply() override
Definition Escrow.cpp:455
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
Definition Escrow.cpp:82
static TER preclaim(PreclaimContext const &ctx)
Definition Escrow.cpp:363
static TER preclaim(PreclaimContext const &ctx)
Definition Escrow.cpp:761
static NotTEC preflight(PreflightContext const &ctx)
Definition Escrow.cpp:628
-
TER doApply() override
Definition Escrow.cpp:1015
+
TER doApply() override
Definition Escrow.cpp:1020
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition Escrow.cpp:683
HashRouterFlags getFlags(uint256 const &key)
bool setFlags(uint256 const &key, HashRouterFlags flags)
Set the flags on a hash.
@@ -1631,6 +1636,7 @@ $(document).ready(function() { init_codefold(0); });
@ fhIGNORE_FREEZE
Definition View.h:78
TER escrowCreatePreclaimHelper< MPTIssue >(PreclaimContext const &ctx, AccountID const &account, AccountID const &dest, STAmount const &amount)
Definition Escrow.cpp:283
bool isXRP(AccountID const &c)
Definition AccountID.h:90
+
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
Definition View.cpp:3005
static TER escrowFinishPreclaimHelper(PreclaimContext const &ctx, AccountID const &dest, STAmount const &amount)
bool canAdd(STAmount const &amt1, STAmount const &amt2)
Safely checks if two STAmount values can be added without overflow, underflow, or precision loss.
Definition STAmount.cpp:528
TER escrowLockApplyHelper< Issue >(ApplyView &view, AccountID const &issuer, AccountID const &sender, STAmount const &amount, beast::Journal journal)
Definition Escrow.cpp:408
@@ -1641,7 +1647,7 @@ $(document).ready(function() { init_codefold(0); });
@ lsfDefaultRipple
@ lsfAllowTrustLineLocking
-
TER escrowCancelPreclaimHelper< MPTIssue >(PreclaimContext const &ctx, AccountID const &account, STAmount const &amount)
Definition Escrow.cpp:1241
+
TER escrowCancelPreclaimHelper< MPTIssue >(PreclaimContext const &ctx, AccountID const &account, STAmount const &amount)
Definition Escrow.cpp:1246
static TER escrowLockApplyHelper(ApplyView &view, AccountID const &issuer, AccountID const &sender, STAmount const &amount, beast::Journal journal)
@ ahIGNORE_AUTH
Definition View.h:81
@@ -1658,7 +1664,6 @@ $(document).ready(function() { init_codefold(0); });
TER escrowCreatePreclaimHelper< Issue >(PreclaimContext const &ctx, AccountID const &account, AccountID const &dest, STAmount const &amount)
Definition Escrow.cpp:205
-
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &amount, beast::Journal j)
Definition View.cpp:3005
static bool adjustOwnerCount(ApplyContext &ctx, int count)
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
static bool checkCondition(Slice f, Slice c)
Definition Escrow.cpp:610
@@ -1691,10 +1696,10 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
Definition TER.h:674
TER escrowFinishPreclaimHelper< MPTIssue >(PreclaimContext const &ctx, AccountID const &dest, STAmount const &amount)
Definition Escrow.cpp:728
NotTEC escrowCreatePreflightHelper< Issue >(PreflightContext const &ctx)
Definition Escrow.cpp:94
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
constexpr std::uint32_t tfUniversalMask
Definition TxFlags.h:63
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Calls static rippleCreditIOU if saAmount represents Issue.
Definition View.cpp:2769
-
TER escrowCancelPreclaimHelper< Issue >(PreclaimContext const &ctx, AccountID const &account, STAmount const &amount)
Definition Escrow.cpp:1221
+
TER escrowCancelPreclaimHelper< Issue >(PreclaimContext const &ctx, AccountID const &account, STAmount const &amount)
Definition Escrow.cpp:1226
TER escrowLockApplyHelper< MPTIssue >(ApplyView &view, AccountID const &issuer, AccountID const &sender, STAmount const &amount, beast::Journal journal)
Definition Escrow.cpp:435
static TER escrowUnlockApplyHelper(ApplyView &view, Rate lockedRate, std::shared_ptr< SLE > const &sleDest, STAmount const &xrpBalance, STAmount const &amount, AccountID const &issuer, AccountID const &sender, AccountID const &receiver, bool createAsset, beast::Journal journal)
bool isPseudoAccount(std::shared_ptr< SLE const > sleAcct)
Definition View.cpp:1139
diff --git a/Escrow_8h_source.html b/Escrow_8h_source.html index 44ad57e4d1..fd159a2b41 100644 --- a/Escrow_8h_source.html +++ b/Escrow_8h_source.html @@ -193,9 +193,9 @@ $(document).ready(function() { init_codefold(0); });
EscrowCancel(ApplyContext &ctx)
Definition Escrow.h:80
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition Escrow.h:78
-
TER doApply() override
Definition Escrow.cpp:1298
-
static NotTEC preflight(PreflightContext const &ctx)
Definition Escrow.cpp:1201
-
static TER preclaim(PreclaimContext const &ctx)
Definition Escrow.cpp:1270
+
TER doApply() override
Definition Escrow.cpp:1303
+
static NotTEC preflight(PreflightContext const &ctx)
Definition Escrow.cpp:1206
+
static TER preclaim(PreclaimContext const &ctx)
Definition Escrow.cpp:1275
EscrowCreate(ApplyContext &ctx)
Definition Escrow.h:32
static NotTEC preflight(PreflightContext const &ctx)
Definition Escrow.cpp:122
@@ -206,7 +206,7 @@ $(document).ready(function() { init_codefold(0); });
static TER preclaim(PreclaimContext const &ctx)
Definition Escrow.cpp:761
static NotTEC preflight(PreflightContext const &ctx)
Definition Escrow.cpp:628
-
TER doApply() override
Definition Escrow.cpp:1015
+
TER doApply() override
Definition Escrow.cpp:1020
EscrowFinish(ApplyContext &ctx)
Definition Escrow.h:56
static XRPAmount calculateBaseFee(ReadView const &view, STTx const &tx)
Definition Escrow.cpp:683
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition Escrow.h:54
diff --git a/InvariantCheck_8cpp_source.html b/InvariantCheck_8cpp_source.html index f8c7b88c15..ee03c88447 100644 --- a/InvariantCheck_8cpp_source.html +++ b/InvariantCheck_8cpp_source.html @@ -2393,7 +2393,7 @@ $(document).ready(function() { init_codefold(0); });
@ tesSUCCESS
Definition TER.h:244
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
Definition View.cpp:385
STAmount ammLPTokens(STAmount const &asset1, STAmount const &asset2, Issue const &lptIssue)
Calculate LP Tokens given AMM pool reserves.
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
@ transactionID
transaction plus signature to give transaction ID
bool withinRelativeDistance(Quality const &calcQuality, Quality const &reqQuality, Number const &dist)
Check if the relative distance between the qualities is within the requested distance.
Definition AMMHelpers.h:129
Number root2(Number f)
Definition Number.cpp:701
diff --git a/InvariantCheck_8h_source.html b/InvariantCheck_8h_source.html index 7b0f344b9e..5023aa914a 100644 --- a/InvariantCheck_8h_source.html +++ b/InvariantCheck_8h_source.html @@ -855,7 +855,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
diff --git a/Livecache__test_8cpp_source.html b/Livecache__test_8cpp_source.html index 408369a8ef..3b4d64fe94 100644 --- a/Livecache__test_8cpp_source.html +++ b/Livecache__test_8cpp_source.html @@ -387,7 +387,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
static auto sum(TCollection const &col)
std::enable_if_t< std::is_integral< Integral >::value, Integral > rand_int()
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
T sort(T... args)
Describes a connectible peer address along with some metadata.
diff --git a/PayChan_8cpp_source.html b/PayChan_8cpp_source.html index b91b372db5..db4a353d76 100644 --- a/PayChan_8cpp_source.html +++ b/PayChan_8cpp_source.html @@ -785,7 +785,7 @@ $(document).ready(function() { init_codefold(0); });
bool isTesSuccess(TER x) noexcept
Definition TER.h:674
constexpr std::uint32_t tfClose
Definition TxFlags.h:133
constexpr std::uint32_t tfPayChanClaimMask
Definition TxFlags.h:134
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
constexpr std::uint32_t tfUniversalMask
Definition TxFlags.h:63
@ terNO_ACCOUNT
Definition TER.h:217
TERSubset< CanCvtToTER > TER
Definition TER.h:645
diff --git a/PaymentSandbox_8cpp_source.html b/PaymentSandbox_8cpp_source.html index 0c973c7450..098370e7b4 100644 --- a/PaymentSandbox_8cpp_source.html +++ b/PaymentSandbox_8cpp_source.html @@ -553,7 +553,7 @@ $(document).ready(function() { init_codefold(0); });
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
bool isXRP(AccountID const &c)
Definition AccountID.h:90
AccountID const & xrpAccount()
Compute AccountID from public key.
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
diff --git a/RCLConsensus_8cpp_source.html b/RCLConsensus_8cpp_source.html index 4b7b21966a..f1e67935a5 100644 --- a/RCLConsensus_8cpp_source.html +++ b/RCLConsensus_8cpp_source.html @@ -1438,7 +1438,7 @@ $(document).ready(function() { init_codefold(0); });
boost::intrusive_ptr< SHAMapItem > make_shamapitem(uint256 const &tag, Slice data)
Definition SHAMapItem.h:161
Rules makeRulesGivenLedger(DigestAwareReadView const &ledger, Rules const &current)
Definition ReadView.cpp:69
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
@ tapNONE
Definition ApplyView.h:32
@ ledgerMaster
ledger master data for signing
@ proposal
proposal for signing
diff --git a/RCLConsensus_8h_source.html b/RCLConsensus_8h_source.html index 51d0db58c0..34a3eddd31 100644 --- a/RCLConsensus_8h_source.html +++ b/RCLConsensus_8h_source.html @@ -613,7 +613,7 @@ $(document).ready(function() { init_codefold(0); });
base_uint< 160, detail::NodeIDTag > NodeID
NodeID is a 160-bit hash representing one node.
Definition UintTypes.h:59
boost::outcome_v2::result< T, std::error_code > Result
Definition b58_utils.h:37
ConsensusPhase
Phases of consensus for a single ledger round.
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
@ ledgerMaster
ledger master data for signing
@ proposal
proposal for signing
diff --git a/STNumber__test_8cpp_source.html b/STNumber__test_8cpp_source.html index d7e6da0ec4..829eac77ae 100644 --- a/STNumber__test_8cpp_source.html +++ b/STNumber__test_8cpp_source.html @@ -405,7 +405,7 @@ $(document).ready(function() { init_codefold(0); });
Issue const & noIssue()
Returns an asset specifier that represents no account and currency.
Definition Issue.h:123
STNumber numberFromJson(SField const &field, Json::Value const &value)
Definition STNumber.cpp:179
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
diff --git a/Transactor_8cpp_source.html b/Transactor_8cpp_source.html index b88f426738..66185e6b5c 100644 --- a/Transactor_8cpp_source.html +++ b/Transactor_8cpp_source.html @@ -1573,7 +1573,7 @@ $(document).ready(function() { init_codefold(0); });
@ SigBad
Signature is bad. Didn't do local checks.
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
static void removeDeletedTrustLines(ApplyView &view, std::vector< uint256 > const &trustLines, beast::Journal viewJ)
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
XRPAmount scaleFeeLoad(XRPAmount fee, LoadFeeTrack const &feeTrack, Fees const &fees, bool bUnlimited)
@ tapFAIL_HARD
Definition ApplyView.h:36
diff --git a/VaultWithdraw_8cpp_source.html b/VaultWithdraw_8cpp_source.html index 9656a77c57..8e618036c3 100644 --- a/VaultWithdraw_8cpp_source.html +++ b/VaultWithdraw_8cpp_source.html @@ -479,7 +479,7 @@ $(document).ready(function() { init_codefold(0); });
@ lsfMPTCanTransfer
@ lsfRequireDestTag
-
AuthType
Definition View.h:770
+
AuthType
Definition View.h:771
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate)
Definition View.cpp:2854
diff --git a/View_8cpp_source.html b/View_8cpp_source.html index e87e49c59e..83f4b49a3a 100644 --- a/View_8cpp_source.html +++ b/View_8cpp_source.html @@ -3234,161 +3234,189 @@ $(document).ready(function() { init_codefold(0); });
3003
3004TER
- +
3006 ApplyView& view,
3007 AccountID const& sender,
3008 AccountID const& receiver,
-
3009 STAmount const& amount,
- -
3011{
-
3012 auto const issuer = amount.getIssuer();
-
3013 auto const mptIssue = amount.get<MPTIssue>();
-
3014 auto const mptID = keylet::mptIssuance(mptIssue.getMptID());
-
3015 auto sleIssuance = view.peek(mptID);
-
3016 if (!sleIssuance)
-
3017 { // LCOV_EXCL_START
-
3018 JLOG(j.error()) << "rippleUnlockEscrowMPT: MPT issuance not found for "
-
3019 << mptIssue.getMptID();
-
3020 return tecOBJECT_NOT_FOUND;
-
3021 } // LCOV_EXCL_STOP
-
3022
-
3023 // Decrease the Issuance EscrowedAmount
-
3024 {
-
3025 if (!sleIssuance->isFieldPresent(sfLockedAmount))
-
3026 { // LCOV_EXCL_START
-
3027 JLOG(j.error())
-
3028 << "rippleUnlockEscrowMPT: no locked amount in issuance for "
-
3029 << mptIssue.getMptID();
-
3030 return tecINTERNAL;
-
3031 } // LCOV_EXCL_STOP
-
3032
-
3033 auto const locked = sleIssuance->getFieldU64(sfLockedAmount);
-
3034 auto const redeem = amount.mpt().value();
-
3035
-
3036 // Underflow check for subtraction
-
3037 if (!canSubtract(
-
3038 STAmount(mptIssue, locked), STAmount(mptIssue, redeem)))
-
3039 { // LCOV_EXCL_START
-
3040 JLOG(j.error())
-
3041 << "rippleUnlockEscrowMPT: insufficient locked amount for "
-
3042 << mptIssue.getMptID() << ": " << locked << " < " << redeem;
-
3043 return tecINTERNAL;
-
3044 } // LCOV_EXCL_STOP
-
3045
-
3046 auto const newLocked = locked - redeem;
-
3047 if (newLocked == 0)
-
3048 sleIssuance->makeFieldAbsent(sfLockedAmount);
-
3049 else
-
3050 sleIssuance->setFieldU64(sfLockedAmount, newLocked);
-
3051 view.update(sleIssuance);
-
3052 }
-
3053
-
3054 if (issuer != receiver)
-
3055 {
-
3056 // Increase the MPT Holder MPTAmount
-
3057 auto const mptokenID = keylet::mptoken(mptID.key, receiver);
-
3058 auto sle = view.peek(mptokenID);
-
3059 if (!sle)
-
3060 { // LCOV_EXCL_START
-
3061 JLOG(j.error())
-
3062 << "rippleUnlockEscrowMPT: MPToken not found for " << receiver;
-
3063 return tecOBJECT_NOT_FOUND; // LCOV_EXCL_LINE
-
3064 } // LCOV_EXCL_STOP
-
3065
-
3066 auto current = sle->getFieldU64(sfMPTAmount);
-
3067 auto delta = amount.mpt().value();
-
3068
-
3069 // Overflow check for addition
-
3070 if (!canAdd(STAmount(mptIssue, current), STAmount(mptIssue, delta)))
-
3071 { // LCOV_EXCL_START
-
3072 JLOG(j.error())
-
3073 << "rippleUnlockEscrowMPT: overflow on MPTAmount for "
-
3074 << to_string(receiver) << ": " << current << " + " << delta;
-
3075 return tecINTERNAL;
-
3076 } // LCOV_EXCL_STOP
-
3077
-
3078 (*sle)[sfMPTAmount] += delta;
-
3079 view.update(sle);
-
3080 }
-
3081 else
-
3082 {
-
3083 // Decrease the Issuance OutstandingAmount
-
3084 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
-
3085 auto const redeem = amount.mpt().value();
-
3086
-
3087 // Underflow check for subtraction
-
3088 if (!canSubtract(
-
3089 STAmount(mptIssue, outstanding), STAmount(mptIssue, redeem)))
-
3090 { // LCOV_EXCL_START
-
3091 JLOG(j.error())
-
3092 << "rippleUnlockEscrowMPT: insufficient outstanding amount for "
-
3093 << mptIssue.getMptID() << ": " << outstanding << " < "
-
3094 << redeem;
-
3095 return tecINTERNAL;
-
3096 } // LCOV_EXCL_STOP
-
3097
-
3098 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - redeem);
-
3099 view.update(sleIssuance);
-
3100 }
-
3101
-
3102 if (issuer == sender)
-
3103 { // LCOV_EXCL_START
-
3104 JLOG(j.error()) << "rippleUnlockEscrowMPT: sender is the issuer, "
-
3105 "cannot unlock MPTs.";
-
3106 return tecINTERNAL;
-
3107 } // LCOV_EXCL_STOP
-
3108 else
-
3109 {
-
3110 // Decrease the MPT Holder EscrowedAmount
-
3111 auto const mptokenID = keylet::mptoken(mptID.key, sender);
-
3112 auto sle = view.peek(mptokenID);
-
3113 if (!sle)
-
3114 { // LCOV_EXCL_START
-
3115 JLOG(j.error())
-
3116 << "rippleUnlockEscrowMPT: MPToken not found for " << sender;
-
3117 return tecOBJECT_NOT_FOUND;
-
3118 } // LCOV_EXCL_STOP
-
3119
-
3120 if (!sle->isFieldPresent(sfLockedAmount))
-
3121 { // LCOV_EXCL_START
-
3122 JLOG(j.error())
-
3123 << "rippleUnlockEscrowMPT: no locked amount in MPToken for "
-
3124 << to_string(sender);
-
3125 return tecINTERNAL;
-
3126 } // LCOV_EXCL_STOP
-
3127
-
3128 auto const locked = sle->getFieldU64(sfLockedAmount);
-
3129 auto const delta = amount.mpt().value();
-
3130
-
3131 // Underflow check for subtraction
-
3132 if (!canSubtract(STAmount(mptIssue, locked), STAmount(mptIssue, delta)))
-
3133 { // LCOV_EXCL_START
-
3134 JLOG(j.error())
-
3135 << "rippleUnlockEscrowMPT: insufficient locked amount for "
-
3136 << to_string(sender) << ": " << locked << " < " << delta;
-
3137 return tecINTERNAL;
-
3138 } // LCOV_EXCL_STOP
-
3139
-
3140 auto const newLocked = locked - delta;
-
3141 if (newLocked == 0)
-
3142 sle->makeFieldAbsent(sfLockedAmount);
-
3143 else
-
3144 sle->setFieldU64(sfLockedAmount, newLocked);
-
3145 view.update(sle);
-
3146 }
-
3147 return tesSUCCESS;
-
3148}
+
3009 STAmount const& netAmount,
+
3010 STAmount const& grossAmount,
+ +
3012{
+
3013 if (!view.rules().enabled(fixTokenEscrowV1))
+
3014 XRPL_ASSERT(
+
3015 netAmount == grossAmount,
+
3016 "ripple::rippleUnlockEscrowMPT : netAmount == grossAmount");
+
3017
+
3018 auto const& issuer = netAmount.getIssuer();
+
3019 auto const& mptIssue = netAmount.get<MPTIssue>();
+
3020 auto const mptID = keylet::mptIssuance(mptIssue.getMptID());
+
3021 auto sleIssuance = view.peek(mptID);
+
3022 if (!sleIssuance)
+
3023 { // LCOV_EXCL_START
+
3024 JLOG(j.error()) << "rippleUnlockEscrowMPT: MPT issuance not found for "
+
3025 << mptIssue.getMptID();
+
3026 return tecOBJECT_NOT_FOUND;
+
3027 } // LCOV_EXCL_STOP
+
3028
+
3029 // Decrease the Issuance EscrowedAmount
+
3030 {
+
3031 if (!sleIssuance->isFieldPresent(sfLockedAmount))
+
3032 { // LCOV_EXCL_START
+
3033 JLOG(j.error())
+
3034 << "rippleUnlockEscrowMPT: no locked amount in issuance for "
+
3035 << mptIssue.getMptID();
+
3036 return tecINTERNAL;
+
3037 } // LCOV_EXCL_STOP
+
3038
+
3039 auto const locked = sleIssuance->getFieldU64(sfLockedAmount);
+
3040 auto const redeem = grossAmount.mpt().value();
+
3041
+
3042 // Underflow check for subtraction
+
3043 if (!canSubtract(
+
3044 STAmount(mptIssue, locked), STAmount(mptIssue, redeem)))
+
3045 { // LCOV_EXCL_START
+
3046 JLOG(j.error())
+
3047 << "rippleUnlockEscrowMPT: insufficient locked amount for "
+
3048 << mptIssue.getMptID() << ": " << locked << " < " << redeem;
+
3049 return tecINTERNAL;
+
3050 } // LCOV_EXCL_STOP
+
3051
+
3052 auto const newLocked = locked - redeem;
+
3053 if (newLocked == 0)
+
3054 sleIssuance->makeFieldAbsent(sfLockedAmount);
+
3055 else
+
3056 sleIssuance->setFieldU64(sfLockedAmount, newLocked);
+
3057 view.update(sleIssuance);
+
3058 }
+
3059
+
3060 if (issuer != receiver)
+
3061 {
+
3062 // Increase the MPT Holder MPTAmount
+
3063 auto const mptokenID = keylet::mptoken(mptID.key, receiver);
+
3064 auto sle = view.peek(mptokenID);
+
3065 if (!sle)
+
3066 { // LCOV_EXCL_START
+
3067 JLOG(j.error())
+
3068 << "rippleUnlockEscrowMPT: MPToken not found for " << receiver;
+
3069 return tecOBJECT_NOT_FOUND; // LCOV_EXCL_LINE
+
3070 } // LCOV_EXCL_STOP
+
3071
+
3072 auto current = sle->getFieldU64(sfMPTAmount);
+
3073 auto delta = netAmount.mpt().value();
+
3074
+
3075 // Overflow check for addition
+
3076 if (!canAdd(STAmount(mptIssue, current), STAmount(mptIssue, delta)))
+
3077 { // LCOV_EXCL_START
+
3078 JLOG(j.error())
+
3079 << "rippleUnlockEscrowMPT: overflow on MPTAmount for "
+
3080 << to_string(receiver) << ": " << current << " + " << delta;
+
3081 return tecINTERNAL;
+
3082 } // LCOV_EXCL_STOP
+
3083
+
3084 (*sle)[sfMPTAmount] += delta;
+
3085 view.update(sle);
+
3086 }
+
3087 else
+
3088 {
+
3089 // Decrease the Issuance OutstandingAmount
+
3090 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
+
3091 auto const redeem = netAmount.mpt().value();
+
3092
+
3093 // Underflow check for subtraction
+
3094 if (!canSubtract(
+
3095 STAmount(mptIssue, outstanding), STAmount(mptIssue, redeem)))
+
3096 { // LCOV_EXCL_START
+
3097 JLOG(j.error())
+
3098 << "rippleUnlockEscrowMPT: insufficient outstanding amount for "
+
3099 << mptIssue.getMptID() << ": " << outstanding << " < "
+
3100 << redeem;
+
3101 return tecINTERNAL;
+
3102 } // LCOV_EXCL_STOP
+
3103
+
3104 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - redeem);
+
3105 view.update(sleIssuance);
+
3106 }
+
3107
+
3108 if (issuer == sender)
+
3109 { // LCOV_EXCL_START
+
3110 JLOG(j.error()) << "rippleUnlockEscrowMPT: sender is the issuer, "
+
3111 "cannot unlock MPTs.";
+
3112 return tecINTERNAL;
+
3113 } // LCOV_EXCL_STOP
+
3114 else
+
3115 {
+
3116 // Decrease the MPT Holder EscrowedAmount
+
3117 auto const mptokenID = keylet::mptoken(mptID.key, sender);
+
3118 auto sle = view.peek(mptokenID);
+
3119 if (!sle)
+
3120 { // LCOV_EXCL_START
+
3121 JLOG(j.error())
+
3122 << "rippleUnlockEscrowMPT: MPToken not found for " << sender;
+
3123 return tecOBJECT_NOT_FOUND;
+
3124 } // LCOV_EXCL_STOP
+
3125
+
3126 if (!sle->isFieldPresent(sfLockedAmount))
+
3127 { // LCOV_EXCL_START
+
3128 JLOG(j.error())
+
3129 << "rippleUnlockEscrowMPT: no locked amount in MPToken for "
+
3130 << to_string(sender);
+
3131 return tecINTERNAL;
+
3132 } // LCOV_EXCL_STOP
+
3133
+
3134 auto const locked = sle->getFieldU64(sfLockedAmount);
+
3135 auto const delta = grossAmount.mpt().value();
+
3136
+
3137 // Underflow check for subtraction
+
3138 if (!canSubtract(STAmount(mptIssue, locked), STAmount(mptIssue, delta)))
+
3139 { // LCOV_EXCL_START
+
3140 JLOG(j.error())
+
3141 << "rippleUnlockEscrowMPT: insufficient locked amount for "
+
3142 << to_string(sender) << ": " << locked << " < " << delta;
+
3143 return tecINTERNAL;
+
3144 } // LCOV_EXCL_STOP
+
3145
+
3146 auto const newLocked = locked - delta;
+
3147 if (newLocked == 0)
+
3148 sle->makeFieldAbsent(sfLockedAmount);
+
3149 else
+
3150 sle->setFieldU64(sfLockedAmount, newLocked);
+
3151 view.update(sle);
+
3152 }
+
3153
+
3154 // Note: The gross amount is the amount that was locked, the net
+
3155 // amount is the amount that is being unlocked. The difference is the fee
+
3156 // that was charged for the transfer. If this difference is greater than
+
3157 // zero, we need to update the outstanding amount.
+
3158 auto const diff = grossAmount.mpt().value() - netAmount.mpt().value();
+
3159 if (diff != 0)
+
3160 {
+
3161 auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount);
+
3162 // Underflow check for subtraction
+
3163 if (!canSubtract(
+
3164 STAmount(mptIssue, outstanding), STAmount(mptIssue, diff)))
+
3165 { // LCOV_EXCL_START
+
3166 JLOG(j.error())
+
3167 << "rippleUnlockEscrowMPT: insufficient outstanding amount for "
+
3168 << mptIssue.getMptID() << ": " << outstanding << " < " << diff;
+
3169 return tecINTERNAL;
+
3170 } // LCOV_EXCL_STOP
+
3171
+
3172 sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - diff);
+
3173 view.update(sleIssuance);
+
3174 }
+
3175 return tesSUCCESS;
+
3176}
-
3149
-
3150bool
-
- -
3152{
-
3153 return now.time_since_epoch().count() > mark;
-
3154}
+
3177
+
3178bool
+
+ +
3180{
+
3181 return now.time_since_epoch().count() > mark;
+
3182}
-
3155
-
3156} // namespace ripple
+
3183
+
3184} // namespace ripple
Provide a light-weight way to check active() before string formatting.
Definition Journal.h:205
@@ -3501,6 +3529,7 @@ $(document).ready(function() { init_codefold(0); });
@ telFAILED_PROCESSING
Definition TER.h:56
std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
Definition View.cpp:2825
bool isIndividualFrozen(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer)
Definition View.cpp:214
+
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
Definition View.cpp:3005
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
Definition View.cpp:2720
bool canSubtract(STAmount const &amt1, STAmount const &amt2)
Determines if it is safe to subtract one STAmount from another.
Definition STAmount.cpp:608
static TER rippleSendMPT(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, STAmount &saActual, beast::Journal j, WaiveTransferFee waiveFee)
Definition View.cpp:2023
@@ -3532,7 +3561,7 @@ $(document).ready(function() { init_codefold(0); });
@ lsfLowDeepFreeze
-
AuthType
Definition View.h:770
+
AuthType
Definition View.h:771
std::optional< STAmount > assetsToSharesWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets, TruncateShares truncate)
Definition View.cpp:2854
std::optional< STAmount > assetsToSharesDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &assets)
Definition View.cpp:2797
@@ -3554,7 +3583,6 @@ $(document).ready(function() { init_codefold(0); });
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
Definition View.cpp:2883
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
Definition View.cpp:1030
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags, std::optional< AccountID > holderID)
Definition View.cpp:1221
-
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &amount, beast::Journal j)
Definition View.cpp:3005
static std::uint32_t confineOwnerCount(std::uint32_t current, std::int32_t adjustment, std::optional< AccountID > const &id=std::nullopt, beast::Journal j=beast::Journal{beast::Journal::getNullSink()})
Definition View.cpp:578
static TER rippleCreditIOU(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Definition View.cpp:1635
static bool adjustOwnerCount(ApplyContext &ctx, int count)
@@ -3593,8 +3621,8 @@ $(document).ready(function() { init_codefold(0); });
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:630
LedgerEntryType
Identifiers for on-ledger objects.
bool forEachItemAfter(ReadView const &view, Keylet const &root, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items after an item in the given directory.
Definition View.cpp:682
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
-
TruncateShares
Definition View.h:933
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
+
TruncateShares
Definition View.h:934
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< uint16_t > maxNodesToDelete)
Definition View.cpp:2642
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items in the given directory.
Definition View.cpp:654
Number root(Number f, unsigned d)
Definition Number.cpp:636
diff --git a/View_8h_source.html b/View_8h_source.html index ffad0fa6c4..d153930d39 100644 --- a/View_8h_source.html +++ b/View_8h_source.html @@ -687,167 +687,168 @@ $(document).ready(function() { init_codefold(0); });
716
717TER
- +
719 ApplyView& view,
720 AccountID const& uGrantorID,
721 AccountID const& uGranteeID,
-
722 STAmount const& saAmount,
- -
724
-
728[[nodiscard]] TER
- -
730 ApplyView& view,
-
731 AccountID const& from,
-
732 AccountID const& to,
-
733 STAmount const& saAmount,
- - -
736
-
737[[nodiscard]] TER
- -
739 ApplyView& view,
-
740 AccountID const& account,
-
741 STAmount const& amount,
-
742 Issue const& issue,
- -
744
-
745[[nodiscard]] TER
- -
747 ApplyView& view,
-
748 AccountID const& account,
-
749 STAmount const& amount,
-
750 Issue const& issue,
- -
752
-
753[[nodiscard]] TER
- -
755 ApplyView& view,
-
756 AccountID const& from,
-
757 AccountID const& to,
-
758 STAmount const& amount,
- -
760
-
761/* Check if MPToken (for MPT) or trust line (for IOU) exists:
-
762 * - StrongAuth - before checking if authorization is required
-
763 * - WeakAuth
-
764 * for MPT - after checking lsfMPTRequireAuth flag
-
765 * for IOU - do not check if trust line exists
-
766 * - Legacy
-
767 * for MPT - before checking lsfMPTRequireAuth flag i.e. same as StrongAuth
-
768 * for IOU - do not check if trust line exists i.e. same as WeakAuth
-
769 */
- -
771
-
789[[nodiscard]] TER
- -
791 ReadView const& view,
-
792 Issue const& issue,
-
793 AccountID const& account,
-
794 AuthType authType = AuthType::Legacy);
-
795
-
818[[nodiscard]] TER
- -
820 ReadView const& view,
-
821 MPTIssue const& mptIssue,
-
822 AccountID const& account,
-
823 AuthType authType = AuthType::Legacy,
-
824 int depth = 0);
-
825
-
-
826[[nodiscard]] TER inline requireAuth(
-
827 ReadView const& view,
-
828 Asset const& asset,
-
829 AccountID const& account,
-
830 AuthType authType = AuthType::Legacy)
-
831{
-
832 return std::visit(
-
833 [&]<ValidIssueType TIss>(TIss const& issue_) {
-
834 return requireAuth(view, issue_, account, authType);
-
835 },
-
836 asset.value());
-
837}
+
722 STAmount const& netAmount,
+
723 STAmount const& grossAmount,
+ +
725
+
729[[nodiscard]] TER
+ +
731 ApplyView& view,
+
732 AccountID const& from,
+
733 AccountID const& to,
+
734 STAmount const& saAmount,
+ + +
737
+
738[[nodiscard]] TER
+ +
740 ApplyView& view,
+
741 AccountID const& account,
+
742 STAmount const& amount,
+
743 Issue const& issue,
+ +
745
+
746[[nodiscard]] TER
+ +
748 ApplyView& view,
+
749 AccountID const& account,
+
750 STAmount const& amount,
+
751 Issue const& issue,
+ +
753
+
754[[nodiscard]] TER
+ +
756 ApplyView& view,
+
757 AccountID const& from,
+
758 AccountID const& to,
+
759 STAmount const& amount,
+ +
761
+
762/* Check if MPToken (for MPT) or trust line (for IOU) exists:
+
763 * - StrongAuth - before checking if authorization is required
+
764 * - WeakAuth
+
765 * for MPT - after checking lsfMPTRequireAuth flag
+
766 * for IOU - do not check if trust line exists
+
767 * - Legacy
+
768 * for MPT - before checking lsfMPTRequireAuth flag i.e. same as StrongAuth
+
769 * for IOU - do not check if trust line exists i.e. same as WeakAuth
+
770 */
+ +
772
+
790[[nodiscard]] TER
+ +
792 ReadView const& view,
+
793 Issue const& issue,
+
794 AccountID const& account,
+
795 AuthType authType = AuthType::Legacy);
+
796
+
819[[nodiscard]] TER
+ +
821 ReadView const& view,
+
822 MPTIssue const& mptIssue,
+
823 AccountID const& account,
+
824 AuthType authType = AuthType::Legacy,
+
825 int depth = 0);
+
826
+
+
827[[nodiscard]] TER inline requireAuth(
+
828 ReadView const& view,
+
829 Asset const& asset,
+
830 AccountID const& account,
+
831 AuthType authType = AuthType::Legacy)
+
832{
+
833 return std::visit(
+
834 [&]<ValidIssueType TIss>(TIss const& issue_) {
+
835 return requireAuth(view, issue_, account, authType);
+
836 },
+
837 asset.value());
+
838}
-
838
-
862[[nodiscard]] TER
- -
864 ApplyView& view,
-
865 MPTID const& mptIssuanceID,
-
866 AccountID const& account,
-
867 XRPAmount const& priorBalance,
- -
869
-
874[[nodiscard]] TER
- -
876 ReadView const& view,
-
877 MPTIssue const& mptIssue,
-
878 AccountID const& from,
-
879 AccountID const& to);
-
880
- - -
887 uint256 const&,
- -
896[[nodiscard]] TER
- -
898 ApplyView& view,
-
899 Keylet const& ownerDirKeylet,
-
900 EntryDeleter const& deleter,
- -
902 std::optional<std::uint16_t> maxNodesToDelete = std::nullopt);
-
903
-
908[[nodiscard]] TER
- -
910 ApplyView& view,
-
911 std::shared_ptr<SLE> sleState,
-
912 std::optional<AccountID> const& ammAccountID,
- -
914
-
915// From the perspective of a vault, return the number of shares to give the
-
916// depositor when they deposit a fixed amount of assets. Since shares are MPT
-
917// this number is integral and always truncated in this calculation.
-
918[[nodiscard]] std::optional<STAmount>
- -
920 std::shared_ptr<SLE const> const& vault,
-
921 std::shared_ptr<SLE const> const& issuance,
-
922 STAmount const& assets);
-
923
-
924// From the perspective of a vault, return the number of assets to take from
-
925// depositor when they receive a fixed amount of shares. Note, since shares are
-
926// MPT, they are always an integral number.
-
927[[nodiscard]] std::optional<STAmount>
- -
929 std::shared_ptr<SLE const> const& vault,
-
930 std::shared_ptr<SLE const> const& issuance,
-
931 STAmount const& shares);
-
932
-
933enum class TruncateShares : bool { no = false, yes = true };
-
934
-
935// From the perspective of a vault, return the number of shares to demand from
-
936// the depositor when they ask to withdraw a fixed amount of assets. Since
-
937// shares are MPT this number is integral, and it will be rounded to nearest
-
938// unless explicitly requested to be truncated instead.
-
939[[nodiscard]] std::optional<STAmount>
- -
941 std::shared_ptr<SLE const> const& vault,
-
942 std::shared_ptr<SLE const> const& issuance,
-
943 STAmount const& assets,
- -
945
-
946// From the perspective of a vault, return the number of assets to give the
-
947// depositor when they redeem a fixed amount of shares. Note, since shares are
-
948// MPT, they are always an integral number.
-
949[[nodiscard]] std::optional<STAmount>
- -
951 std::shared_ptr<SLE const> const& vault,
-
952 std::shared_ptr<SLE const> const& issuance,
-
953 STAmount const& shares);
-
954
-
961bool
- -
963
-
964} // namespace ripple
-
965
-
966#endif
+
839
+
863[[nodiscard]] TER
+ +
865 ApplyView& view,
+
866 MPTID const& mptIssuanceID,
+
867 AccountID const& account,
+
868 XRPAmount const& priorBalance,
+ +
870
+
875[[nodiscard]] TER
+ +
877 ReadView const& view,
+
878 MPTIssue const& mptIssue,
+
879 AccountID const& from,
+
880 AccountID const& to);
+
881
+ + +
888 uint256 const&,
+ +
897[[nodiscard]] TER
+ +
899 ApplyView& view,
+
900 Keylet const& ownerDirKeylet,
+
901 EntryDeleter const& deleter,
+ +
903 std::optional<std::uint16_t> maxNodesToDelete = std::nullopt);
+
904
+
909[[nodiscard]] TER
+ +
911 ApplyView& view,
+
912 std::shared_ptr<SLE> sleState,
+
913 std::optional<AccountID> const& ammAccountID,
+ +
915
+
916// From the perspective of a vault, return the number of shares to give the
+
917// depositor when they deposit a fixed amount of assets. Since shares are MPT
+
918// this number is integral and always truncated in this calculation.
+
919[[nodiscard]] std::optional<STAmount>
+ +
921 std::shared_ptr<SLE const> const& vault,
+
922 std::shared_ptr<SLE const> const& issuance,
+
923 STAmount const& assets);
+
924
+
925// From the perspective of a vault, return the number of assets to take from
+
926// depositor when they receive a fixed amount of shares. Note, since shares are
+
927// MPT, they are always an integral number.
+
928[[nodiscard]] std::optional<STAmount>
+ +
930 std::shared_ptr<SLE const> const& vault,
+
931 std::shared_ptr<SLE const> const& issuance,
+
932 STAmount const& shares);
+
933
+
934enum class TruncateShares : bool { no = false, yes = true };
+
935
+
936// From the perspective of a vault, return the number of shares to demand from
+
937// the depositor when they ask to withdraw a fixed amount of assets. Since
+
938// shares are MPT this number is integral, and it will be rounded to nearest
+
939// unless explicitly requested to be truncated instead.
+
940[[nodiscard]] std::optional<STAmount>
+ +
942 std::shared_ptr<SLE const> const& vault,
+
943 std::shared_ptr<SLE const> const& issuance,
+
944 STAmount const& assets,
+ +
946
+
947// From the perspective of a vault, return the number of assets to give the
+
948// depositor when they redeem a fixed amount of shares. Note, since shares are
+
949// MPT, they are always an integral number.
+
950[[nodiscard]] std::optional<STAmount>
+ +
952 std::shared_ptr<SLE const> const& vault,
+
953 std::shared_ptr<SLE const> const& issuance,
+
954 STAmount const& shares);
+
955
+
962bool
+ +
964
+
965} // namespace ripple
+
966
+
967#endif
Provide a light-weight way to check active() before string formatting.
Definition Journal.h:205
A generic endpoint for log messages.
Definition Journal.h:60
Writeable view to a ledger, for applying a transaction.
Definition ApplyView.h:144
@@ -889,6 +890,7 @@ $(document).ready(function() { init_codefold(0); });
LedgerIndex getCandidateLedger(LedgerIndex requested)
Find a ledger index from which we could easily get the requested ledger.
Definition View.h:430
std::optional< STAmount > sharesToAssetsDeposit(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
Definition View.cpp:2825
bool isIndividualFrozen(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer)
Definition View.cpp:214
+
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j)
Definition View.cpp:3005
TER deleteAMMTrustLine(ApplyView &view, std::shared_ptr< SLE > sleState, std::optional< AccountID > const &ammAccountID, beast::Journal j)
Delete trustline to AMM.
Definition View.cpp:2720
bool dirFirst(ApplyView &view, uint256 const &root, std::shared_ptr< SLE > &page, unsigned int &index, uint256 &entry)
Definition View.cpp:124
base_uint< 256 > uint256
Definition base_uint.h:558
@@ -898,7 +900,7 @@ $(document).ready(function() { init_codefold(0); });
Rate transferRate(ReadView const &view, AccountID const &issuer)
Returns IOU issuer transfer fee as Rate.
Definition View.cpp:760
TER redeemIOU(ApplyView &view, AccountID const &account, STAmount const &amount, Issue const &issue, beast::Journal j)
Definition View.cpp:2288
base_uint< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
Definition UintTypes.h:64
-
AuthType
Definition View.h:770
+
AuthType
Definition View.h:771
@@ -919,7 +921,6 @@ $(document).ready(function() { init_codefold(0); });
@ yes
Definition Steps.h:45
std::optional< STAmount > sharesToAssetsWithdraw(std::shared_ptr< SLE const > const &vault, std::shared_ptr< SLE const > const &issuance, STAmount const &shares)
Definition View.cpp:2883
TER authorizeMPToken(ApplyView &view, XRPAmount const &priorBalance, MPTID const &mptIssuanceID, AccountID const &account, beast::Journal journal, std::uint32_t flags, std::optional< AccountID > holderID)
Definition View.cpp:1221
-
TER rippleUnlockEscrowMPT(ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &amount, beast::Journal j)
Definition View.cpp:3005
static bool adjustOwnerCount(ApplyContext &ctx, int count)
base_uint< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition UintTypes.h:56
bool isVaultPseudoAccountFrozen(ReadView const &view, AccountID const &account, MPTIssue const &mptShare, int depth)
Definition View.cpp:308
@@ -941,8 +942,8 @@ $(document).ready(function() { init_codefold(0); });
majorityAmendments_t getMajorityAmendments(ReadView const &view)
Definition View.cpp:936
LedgerEntryType
Identifiers for on-ledger objects.
bool forEachItemAfter(ReadView const &view, Keylet const &root, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items after an item in the given directory.
Definition View.cpp:682
-
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3151
-
TruncateShares
Definition View.h:933
+
bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition View.cpp:3179
+
TruncateShares
Definition View.h:934
TER cleanupOnAccountDelete(ApplyView &view, Keylet const &ownerDirKeylet, EntryDeleter const &deleter, beast::Journal j, std::optional< uint16_t > maxNodesToDelete)
Definition View.cpp:2642
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items in the given directory.
Definition View.cpp:654
diff --git a/classripple_1_1EscrowCancel.html b/classripple_1_1EscrowCancel.html index 07627387f5..cc9418c61a 100644 --- a/classripple_1_1EscrowCancel.html +++ b/classripple_1_1EscrowCancel.html @@ -405,7 +405,7 @@ Static Private Member Functions
-

Definition at line 1201 of file Escrow.cpp.

+

Definition at line 1206 of file Escrow.cpp.

@@ -433,7 +433,7 @@ Static Private Member Functions
-

Definition at line 1270 of file Escrow.cpp.

+

Definition at line 1275 of file Escrow.cpp.

@@ -462,7 +462,7 @@ Static Private Member Functions

Implements ripple::Transactor.

-

Definition at line 1298 of file Escrow.cpp.

+

Definition at line 1303 of file Escrow.cpp.

diff --git a/classripple_1_1EscrowFinish.html b/classripple_1_1EscrowFinish.html index 188a4de06c..843a1afafb 100644 --- a/classripple_1_1EscrowFinish.html +++ b/classripple_1_1EscrowFinish.html @@ -500,7 +500,7 @@ Static Private Member Functions

Implements ripple::Transactor.

-

Definition at line 1015 of file Escrow.cpp.

+

Definition at line 1020 of file Escrow.cpp.

diff --git a/namespacemembers_func_r.html b/namespacemembers_func_r.html index a0ea7a9eb1..ad278bf99c 100644 --- a/namespacemembers_func_r.html +++ b/namespacemembers_func_r.html @@ -135,7 +135,7 @@ $(function() {
  • rippleLockEscrowMPT() : ripple
  • rippleSendIOU() : ripple
  • rippleSendMPT() : ripple
  • -
  • rippleUnlockEscrowMPT() : ripple
  • +
  • rippleUnlockEscrowMPT() : ripple
  • rngcpy() : ripple::NodeStore
  • rngfill() : beast
  • roleRequired() : ripple::RPC
  • diff --git a/namespacemembers_r.html b/namespacemembers_r.html index ea3728d74c..0904e7d207 100644 --- a/namespacemembers_r.html +++ b/namespacemembers_r.html @@ -156,7 +156,7 @@ $(function() {
  • rippleLockEscrowMPT() : ripple
  • rippleSendIOU() : ripple
  • rippleSendMPT() : ripple
  • -
  • rippleUnlockEscrowMPT() : ripple
  • +
  • rippleUnlockEscrowMPT() : ripple
  • rngcpy() : ripple::NodeStore
  • rngfill() : beast
  • Role : ripple
  • diff --git a/namespaceripple.html b/namespaceripple.html index 69bd0a4545..c4aa88768e 100644 --- a/namespaceripple.html +++ b/namespaceripple.html @@ -4932,8 +4932,8 @@ requires (T::ConsequencesFactory ==   TER rippleLockEscrowMPT (ApplyView &view, AccountID const &sender, STAmount const &amount, beast::Journal j)   -TER rippleUnlockEscrowMPT (ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &amount, beast::Journal j) -  +TER rippleUnlockEscrowMPT (ApplyView &view, AccountID const &sender, AccountID const &receiver, STAmount const &netAmount, STAmount const &grossAmount, beast::Journal j) +  bool after (NetClock::time_point now, std::uint32_t mark)  Has the specified time passed?
      @@ -7984,7 +7984,7 @@ template<class T >

    Deleter function prototype.

    Returns the status of the entry deletion (if should not be skipped) and if the entry should be skipped. The status is always tesSUCCESS if the entry should be skipped.

    -

    Definition at line 885 of file View.h.

    +

    Definition at line 886 of file View.h.

    @@ -10409,7 +10409,7 @@ ledger. Legacy  -

    Definition at line 770 of file View.h.

    +

    Definition at line 771 of file View.h.

    @@ -10437,7 +10437,7 @@ ledger. yes  -

    Definition at line 933 of file View.h.

    +

    Definition at line 934 of file View.h.

    @@ -37380,7 +37380,7 @@ template<>
    -

    Definition at line 1220 of file Escrow.cpp.

    +

    Definition at line 1225 of file Escrow.cpp.

    @@ -37418,7 +37418,7 @@ template<>
    -

    Definition at line 1240 of file Escrow.cpp.

    +

    Definition at line 1245 of file Escrow.cpp.

    @@ -42968,8 +42968,8 @@ template<class Clock , class Duration , class Rep , class Period > - -

    ◆ rippleUnlockEscrowMPT()

    + +

    ◆ rippleUnlockEscrowMPT()

    @@ -42996,7 +42996,13 @@ template<class Clock , class Duration , class Rep , class Period >
    STAmount const &  - amount, + netAmount, + + + + + STAmount const &  + grossAmount, @@ -43052,7 +43058,7 @@ template<class Clock , class Duration , class Rep , class Period >
    Returns
    true if now refers to a time strictly after mark, else false.
    -

    Definition at line 3151 of file View.cpp.

    +

    Definition at line 3179 of file View.cpp.

    @@ -43686,7 +43692,7 @@ template<class Clock , class Duration , class Rep , class Period >
    -

    Definition at line 826 of file View.h.

    +

    Definition at line 827 of file View.h.

    diff --git a/search/all_19.js b/search/all_19.js index e4e0338cbe..ef15679e2a 100644 --- a/search/all_19.js +++ b/search/all_19.js @@ -591,7 +591,7 @@ var searchData= ['ripplelockescrowmpt_588',['rippleLockEscrowMPT',['../namespaceripple.html#a02de69480d9655456084663dc5d7c100',1,'ripple']]], ['ripplesendiou_589',['rippleSendIOU',['../namespaceripple.html#ad9c8cd6337807aee48aba8ba202e5c5c',1,'ripple']]], ['ripplesendmpt_590',['rippleSendMPT',['../namespaceripple.html#a33cfcdda48d70867c06c798f8a894ff0',1,'ripple']]], - ['rippleunlockescrowmpt_591',['rippleUnlockEscrowMPT',['../namespaceripple.html#a83da4b11e236a23156ac525c94494dcf',1,'ripple']]], + ['rippleunlockescrowmpt_591',['rippleUnlockEscrowMPT',['../namespaceripple.html#a2bf72b4d8923d178f4cb5ed49cdc1e24',1,'ripple']]], ['rmax_592',['rmax',['../structripple_1_1RPC_1_1Tuning_1_1LimitRange.html#a0030613e1637c29d503482140a3486d4',1,'ripple::RPC::Tuning::LimitRange']]], ['rmdatadir_5f_593',['rmDataDir_',['../classripple_1_1detail_1_1RippledCfgGuard.html#a38b532a544b1b520f4847719bca0f92d',1,'ripple::detail::RippledCfgGuard']]], ['rmdir_594',['rmDir',['../classripple_1_1test_1_1detail_1_1DirGuard.html#a9e20eb76f70e5404f202aa9ba73e46b8',1,'ripple::test::detail::DirGuard']]], diff --git a/search/functions_12.js b/search/functions_12.js index 6dc9b42ee2..3d9dd19a76 100644 --- a/search/functions_12.js +++ b/search/functions_12.js @@ -274,7 +274,7 @@ var searchData= ['ripplelockescrowmpt_271',['rippleLockEscrowMPT',['../namespaceripple.html#a02de69480d9655456084663dc5d7c100',1,'ripple']]], ['ripplesendiou_272',['rippleSendIOU',['../namespaceripple.html#ad9c8cd6337807aee48aba8ba202e5c5c',1,'ripple']]], ['ripplesendmpt_273',['rippleSendMPT',['../namespaceripple.html#a33cfcdda48d70867c06c798f8a894ff0',1,'ripple']]], - ['rippleunlockescrowmpt_274',['rippleUnlockEscrowMPT',['../namespaceripple.html#a83da4b11e236a23156ac525c94494dcf',1,'ripple']]], + ['rippleunlockescrowmpt_274',['rippleUnlockEscrowMPT',['../namespaceripple.html#a2bf72b4d8923d178f4cb5ed49cdc1e24',1,'ripple']]], ['rmdir_275',['rmDir',['../classripple_1_1test_1_1detail_1_1DirGuard.html#a9e20eb76f70e5404f202aa9ba73e46b8',1,'ripple::test::detail::DirGuard']]], ['rngcpy_276',['rngcpy',['../namespaceripple_1_1NodeStore.html#a7d4a8031401dc30a5634fc01033275e1',1,'ripple::NodeStore']]], ['rngfill_277',['rngfill',['../namespacebeast.html#a3c2683b0fd77fcae6b6ef91fb90e5cbc',1,'beast::rngfill(std::array< std::uint8_t, N > &a, Generator &g)'],['../namespacebeast.html#ad4d3145468ad564a92ac41b9812274a0',1,'beast::rngfill(void *const buffer, std::size_t const bytes, Generator &g)']]], diff --git a/structripple_1_1test_1_1EscrowToken__test.html b/structripple_1_1test_1_1EscrowToken__test.html index 49b3553743..0c9b3e3cb0 100644 --- a/structripple_1_1test_1_1EscrowToken__test.html +++ b/structripple_1_1test_1_1EscrowToken__test.html @@ -1026,7 +1026,7 @@ Private Attributes
    -

    Definition at line 3561 of file EscrowToken_test.cpp.

    +

    Definition at line 3628 of file EscrowToken_test.cpp.

    @@ -1046,7 +1046,7 @@ Private Attributes
    -

    Definition at line 3604 of file EscrowToken_test.cpp.

    +

    Definition at line 3671 of file EscrowToken_test.cpp.

    @@ -1066,7 +1066,7 @@ Private Attributes
    -

    Definition at line 3655 of file EscrowToken_test.cpp.

    +

    Definition at line 3722 of file EscrowToken_test.cpp.

    @@ -1086,7 +1086,7 @@ Private Attributes
    -

    Definition at line 3722 of file EscrowToken_test.cpp.

    +

    Definition at line 3789 of file EscrowToken_test.cpp.

    @@ -1106,7 +1106,7 @@ Private Attributes
    -

    Definition at line 3833 of file EscrowToken_test.cpp.

    +

    Definition at line 3900 of file EscrowToken_test.cpp.

    @@ -1126,7 +1126,7 @@ Private Attributes
    -

    Definition at line 3855 of file EscrowToken_test.cpp.

    +

    Definition at line 3922 of file EscrowToken_test.cpp.

    @@ -1157,7 +1157,7 @@ Private Attributes

    Implements beast::unit_test::suite.

    -

    Definition at line 3875 of file EscrowToken_test.cpp.

    +

    Definition at line 3942 of file EscrowToken_test.cpp.