Add single asset vault (XLS-65d) (#5224)

- Specification: XRPLF/XRPL-Standards#239
- Amendment: `SingleAssetVault`
- Implements a vault feature used to store a fungible asset (XRP, IOU, or MPT, but not NFT) and to receive shares in the vault (an MPT) in exchange.
- A vault can be private or public.
- A private vault can use permissioned domains, subject to the `PermissionedDomains` amendment.
- Shares can be exchanged back into asset with `VaultWithdraw`.
- Permissions on the asset in the vault are transitively applied on shares in the vault.
- Issuer of the asset in the vault can clawback with `VaultClawback`.
- Extended `MPTokenIssuance` with `DomainID`, used by the permissioned domain on the vault shares.

Co-authored-by: John Freeman <jfreeman08@gmail.com>
This commit is contained in:
Bronek Kozicki
2025-05-20 19:06:41 +01:00
committed by GitHub
parent dd62cfcc22
commit e514de76ed
93 changed files with 7257 additions and 385 deletions

View File

@@ -43,16 +43,6 @@ checkVL(
return strHex(expected) == strHex(sle->getFieldVL(field));
}
static inline Keylet
credentialKeylet(
test::jtx::Account const& subject,
test::jtx::Account const& issuer,
std::string_view credType)
{
return keylet::credential(
subject.id(), issuer.id(), Slice(credType.data(), credType.size()));
}
struct Credentials_test : public beast::unit_test::suite
{
void
@@ -72,7 +62,7 @@ struct Credentials_test : public beast::unit_test::suite
{
testcase("Create for subject.");
auto const credKey = credentialKeylet(subject, issuer, credType);
auto const credKey = credentials::keylet(subject, issuer, credType);
env.fund(XRP(5000), subject, issuer, other);
env.close();
@@ -150,7 +140,7 @@ struct Credentials_test : public beast::unit_test::suite
{
testcase("Create for themself.");
auto const credKey = credentialKeylet(issuer, issuer, credType);
auto const credKey = credentials::keylet(issuer, issuer, credType);
env(credentials::create(issuer, issuer, credType),
credentials::uri(uri));
@@ -224,7 +214,7 @@ struct Credentials_test : public beast::unit_test::suite
{
testcase("Delete issuer before accept");
auto const credKey = credentialKeylet(subject, issuer, credType);
auto const credKey = credentials::keylet(subject, issuer, credType);
env(credentials::create(subject, issuer, credType));
env.close();
@@ -260,7 +250,7 @@ struct Credentials_test : public beast::unit_test::suite
{
testcase("Delete issuer after accept");
auto const credKey = credentialKeylet(subject, issuer, credType);
auto const credKey = credentials::keylet(subject, issuer, credType);
env(credentials::create(subject, issuer, credType));
env.close();
env(credentials::accept(subject, issuer, credType));
@@ -298,7 +288,7 @@ struct Credentials_test : public beast::unit_test::suite
{
testcase("Delete subject before accept");
auto const credKey = credentialKeylet(subject, issuer, credType);
auto const credKey = credentials::keylet(subject, issuer, credType);
env(credentials::create(subject, issuer, credType));
env.close();
@@ -334,7 +324,7 @@ struct Credentials_test : public beast::unit_test::suite
{
testcase("Delete subject after accept");
auto const credKey = credentialKeylet(subject, issuer, credType);
auto const credKey = credentials::keylet(subject, issuer, credType);
env(credentials::create(subject, issuer, credType));
env.close();
env(credentials::accept(subject, issuer, credType));
@@ -372,7 +362,7 @@ struct Credentials_test : public beast::unit_test::suite
{
testcase("Delete by other");
auto const credKey = credentialKeylet(subject, issuer, credType);
auto const credKey = credentials::keylet(subject, issuer, credType);
auto jv = credentials::create(subject, issuer, credType);
uint32_t const t = env.current()
->info()
@@ -417,7 +407,7 @@ struct Credentials_test : public beast::unit_test::suite
env.close();
{
auto const credKey =
credentialKeylet(subject, issuer, credType);
credentials::keylet(subject, issuer, credType);
BEAST_EXPECT(!env.le(credKey));
BEAST_EXPECT(!ownerCount(env, subject));
BEAST_EXPECT(!ownerCount(env, issuer));
@@ -439,7 +429,7 @@ struct Credentials_test : public beast::unit_test::suite
env.close();
{
auto const credKey =
credentialKeylet(subject, issuer, credType);
credentials::keylet(subject, issuer, credType);
BEAST_EXPECT(!env.le(credKey));
BEAST_EXPECT(!ownerCount(env, subject));
BEAST_EXPECT(!ownerCount(env, issuer));