mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-03 04:01:01 +00:00
Merge branch 'develop' of https://github.com/XRPLF/rippled into xrplf/sponsor
This commit is contained in:
@@ -111,20 +111,9 @@ class MPToken_test : public beast::unit_test::Suite
|
||||
.metadata = "test",
|
||||
.err = temMALFORMED});
|
||||
|
||||
if (!features[featureSingleAssetVault])
|
||||
if (!features[featureSingleAssetVault] || !features[featurePermissionedDomains])
|
||||
{
|
||||
// tries to set DomainID when SAV is disabled
|
||||
mptAlice.create(
|
||||
{.maxAmt = 100,
|
||||
.assetScale = 0,
|
||||
.metadata = "test",
|
||||
.flags = tfMPTRequireAuth,
|
||||
.domainID = uint256(42),
|
||||
.err = temDISABLED});
|
||||
}
|
||||
else if (!features[featurePermissionedDomains])
|
||||
{
|
||||
// tries to set DomainID when PD is disabled
|
||||
// tries to set DomainID when SAV or PD is disabled
|
||||
mptAlice.create(
|
||||
{.maxAmt = 100,
|
||||
.assetScale = 0,
|
||||
@@ -617,7 +606,8 @@ class MPToken_test : public beast::unit_test::Suite
|
||||
// (2)
|
||||
mptAlice.set({.account = alice, .flags = 0x00000008, .err = temINVALID_FLAG});
|
||||
|
||||
if (!features[featureSingleAssetVault] && !features[featureDynamicMPT])
|
||||
if (!features[featureSingleAssetVault] && !features[featureDynamicMPT] &&
|
||||
!features[featureConfidentialTransfer])
|
||||
{
|
||||
// test invalid flags - nothing is being changed
|
||||
mptAlice.set({.account = alice, .flags = 0x00000000, .err = tecNO_PERMISSION});
|
||||
@@ -4058,7 +4048,7 @@ class MPToken_test : public beast::unit_test::Suite
|
||||
// view may contain partial state and must be discarded.
|
||||
if (expectedOutstanding)
|
||||
{
|
||||
auto const sle = av.peek(keylet::mptIssuance(mptTester.issuanceID()));
|
||||
auto const sle = av.peek(keylet::mptokenIssuance(mptTester.issuanceID()));
|
||||
if (!BEAST_EXPECT(sle))
|
||||
return;
|
||||
BEAST_EXPECTS(sle->getFieldU64(sfOutstandingAmount) == *expectedOutstanding, label);
|
||||
@@ -7470,21 +7460,42 @@ class MPToken_test : public beast::unit_test::Suite
|
||||
|
||||
// MPTLock is set
|
||||
usd.set({.flags = tfMPTLock});
|
||||
// carol and issuer can't withdraw
|
||||
for (auto const& account : {carol, gw})
|
||||
{
|
||||
amm.withdraw(
|
||||
{.account = account,
|
||||
.asset1Out = usd(1),
|
||||
.asset2Out = eur(1),
|
||||
.err = Ter(tecLOCKED)});
|
||||
amm.withdraw({.account = account, .tokens = 1'000, .err = Ter(tecLOCKED)});
|
||||
// can single withdraw another asset
|
||||
amm.withdraw(
|
||||
{.account = account,
|
||||
.asset1Out = eur(1),
|
||||
.assets = std::make_pair(eur, usd)});
|
||||
}
|
||||
auto const fix330 = env.current()->rules().enabled(fixCleanup3_3_0);
|
||||
|
||||
// carol can't withdraw the locked token (any withdrawal type)
|
||||
amm.withdraw(
|
||||
{.account = carol,
|
||||
.asset1Out = usd(1),
|
||||
.asset2Out = eur(1),
|
||||
.err = Ter(tecLOCKED)});
|
||||
amm.withdraw({.account = carol, .tokens = 1'000, .err = Ter(tecLOCKED)});
|
||||
// can single withdraw the non-locked asset
|
||||
amm.withdraw(
|
||||
{.account = carol, .asset1Out = eur(1), .assets = std::make_pair(eur, usd)});
|
||||
|
||||
// post-fixCleanup3_3_0 the issuer can redeem even when locked.
|
||||
// Each successful withdrawal burns LP tokens, so replenish between
|
||||
// each type to keep gw's LP balance stable.
|
||||
auto const gwLockErr = fix330 ? Ter(tesSUCCESS) : Ter(tecLOCKED);
|
||||
auto const replenish = [&](IOUAmount tokens) {
|
||||
usd.set({.flags = tfMPTUnlock});
|
||||
amm.deposit({.account = gw, .tokens = tokens});
|
||||
usd.set({.flags = tfMPTLock});
|
||||
};
|
||||
|
||||
amm.withdraw(
|
||||
{.account = gw, .asset1Out = usd(1), .asset2Out = eur(1), .err = gwLockErr});
|
||||
if (fix330)
|
||||
replenish(IOUAmount{1});
|
||||
|
||||
amm.withdraw({.account = gw, .tokens = 1'000, .err = gwLockErr});
|
||||
if (fix330)
|
||||
replenish(IOUAmount{1'000});
|
||||
|
||||
// can single withdraw the non-locked asset
|
||||
amm.withdraw(
|
||||
{.account = gw, .asset1Out = eur(1), .assets = std::make_pair(eur, usd)});
|
||||
|
||||
usd.set({.flags = tfMPTUnlock});
|
||||
|
||||
// MPTRequireAuth is set
|
||||
|
||||
Reference in New Issue
Block a user