mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-02 16:26:48 +00:00
Add support for XLS-85 Token Escrow (#5185)
- Specification: https://github.com/XRPLF/XRPL-Standards/pull/272 - Amendment: `TokenEscrow` - Enables escrowing of IOU and MPT tokens in addition to native XRP. - Allows accounts to lock issued tokens (IOU/MPT) in escrow objects, with support for freeze, authorization, and transfer rates. - Adds new ledger fields (`sfLockedAmount`, `sfIssuerNode`, etc.) to track locked balances for IOU and MPT escrows. - Updates EscrowCreate, EscrowFinish, and EscrowCancel transaction logic to support IOU and MPT assets, including proper handling of trustlines and MPT authorization, transfer rates, and locked balances. - Enforces invariant checks for escrowed IOU/MPT amounts. - Extends GatewayBalances RPC to report locked (escrowed) balances.
This commit is contained in:
@@ -573,21 +573,6 @@ public:
|
||||
env.fund(XRP(10000), alice, becky, gw1);
|
||||
env.close();
|
||||
|
||||
// A couple of helper lambdas
|
||||
auto escrow = [&env](
|
||||
Account const& account,
|
||||
Account const& to,
|
||||
STAmount const& amount) {
|
||||
Json::Value jv;
|
||||
jv[jss::TransactionType] = jss::EscrowCreate;
|
||||
jv[jss::Account] = account.human();
|
||||
jv[jss::Destination] = to.human();
|
||||
jv[jss::Amount] = amount.getJson(JsonOptions::none);
|
||||
NetClock::time_point finish = env.now() + 1s;
|
||||
jv[sfFinishAfter.jsonName] = finish.time_since_epoch().count();
|
||||
return jv;
|
||||
};
|
||||
|
||||
auto payChan = [](Account const& account,
|
||||
Account const& to,
|
||||
STAmount const& amount,
|
||||
@@ -623,8 +608,10 @@ public:
|
||||
env.close();
|
||||
|
||||
// Escrow, in each direction
|
||||
env(escrow(alice, becky, XRP(1000)));
|
||||
env(escrow(becky, alice, XRP(1000)));
|
||||
env(escrow::create(alice, becky, XRP(1000)),
|
||||
escrow::finish_time(env.now() + 1s));
|
||||
env(escrow::create(becky, alice, XRP(1000)),
|
||||
escrow::finish_time(env.now() + 1s));
|
||||
|
||||
// Pay channels, in each direction
|
||||
env(payChan(alice, becky, XRP(1000), 100s, alice.pk()));
|
||||
|
||||
@@ -99,6 +99,12 @@ public:
|
||||
// is tested elsewhere.
|
||||
continue;
|
||||
}
|
||||
if (flag == asfAllowTrustLineLocking)
|
||||
{
|
||||
// These flags are part of the AllowTokenLocking amendment
|
||||
// and are tested elsewhere
|
||||
continue;
|
||||
}
|
||||
|
||||
if (std::find(goodFlags.begin(), goodFlags.end(), flag) !=
|
||||
goodFlags.end())
|
||||
|
||||
Reference in New Issue
Block a user