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

@@ -412,6 +412,9 @@ class MPToken_test : public beast::unit_test::suite
// bob creates a mptoken
mptAlice.authorize({.account = bob, .holderCount = 1});
mptAlice.authorize(
{.account = bob, .holderCount = 1, .err = tecDUPLICATE});
// bob deletes his mptoken
mptAlice.authorize(
{.account = bob, .holderCount = 0, .flags = tfMPTUnauthorize});
@@ -621,6 +624,25 @@ class MPToken_test : public beast::unit_test::suite
// locks up bob's mptoken again
mptAlice.set({.account = alice, .holder = bob, .flags = tfMPTLock});
if (!features[featureSingleAssetVault])
{
// Delete bobs' mptoken even though it is locked
mptAlice.authorize({.account = bob, .flags = tfMPTUnauthorize});
mptAlice.set(
{.account = alice,
.holder = bob,
.flags = tfMPTUnlock,
.err = tecOBJECT_NOT_FOUND});
return;
}
// Cannot delete locked MPToken
mptAlice.authorize(
{.account = bob,
.flags = tfMPTUnauthorize,
.err = tecNO_PERMISSION});
// alice unlocks mptissuance
mptAlice.set({.account = alice, .flags = tfMPTUnlock});
@@ -2283,20 +2305,27 @@ public:
FeatureBitset const all{supported_amendments()};
// MPTokenIssuanceCreate
testCreateValidation(all);
testCreateEnabled(all);
testCreateValidation(all - featureSingleAssetVault);
testCreateValidation(all | featureSingleAssetVault);
testCreateEnabled(all - featureSingleAssetVault);
testCreateEnabled(all | featureSingleAssetVault);
// MPTokenIssuanceDestroy
testDestroyValidation(all);
testDestroyEnabled(all);
testDestroyValidation(all - featureSingleAssetVault);
testDestroyValidation(all | featureSingleAssetVault);
testDestroyEnabled(all - featureSingleAssetVault);
testDestroyEnabled(all | featureSingleAssetVault);
// MPTokenAuthorize
testAuthorizeValidation(all);
testAuthorizeEnabled(all);
testAuthorizeValidation(all - featureSingleAssetVault);
testAuthorizeValidation(all | featureSingleAssetVault);
testAuthorizeEnabled(all - featureSingleAssetVault);
testAuthorizeEnabled(all | featureSingleAssetVault);
// MPTokenIssuanceSet
testSetValidation(all);
testSetEnabled(all);
testSetEnabled(all - featureSingleAssetVault);
testSetEnabled(all | featureSingleAssetVault);
// MPT clawback
testClawbackValidation(all);