mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-15 16:32:26 +00:00
Compare commits
2 Commits
develop
...
gregtatcam
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a903cab4c8 | ||
|
|
d560d8be6d |
@@ -105,7 +105,9 @@ AMMClawback::preclaim(PreclaimContext const& ctx)
|
||||
// permission
|
||||
if (((issuerFlagsIn & lsfAllowTrustLineClawback) == 0u) ||
|
||||
((issuerFlagsIn & lsfNoFreeze) != 0u))
|
||||
return tesSUCCESS;
|
||||
{
|
||||
return tecNO_PERMISSION;
|
||||
}
|
||||
}
|
||||
|
||||
auto const checkClawAsset = [&](Asset const asset) -> bool {
|
||||
|
||||
@@ -10,14 +10,14 @@ namespace test {
|
||||
class AMMClawback_test : public beast::unit_test::suite
|
||||
{
|
||||
void
|
||||
testInvalidRequest()
|
||||
testInvalidRequest(FeatureBitset features)
|
||||
{
|
||||
testcase("test invalid request");
|
||||
using namespace jtx;
|
||||
|
||||
// Test if holder does not exist.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(100000), gw, alice);
|
||||
@@ -42,7 +42,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
// Test if asset pair provided does not exist. This should
|
||||
// return terNO_AMM error.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(100000), gw, alice);
|
||||
@@ -74,7 +74,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
// Test if the issuer field and holder field is the same. This should
|
||||
// return temMALFORMED error.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(10000), gw, alice);
|
||||
@@ -102,7 +102,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
|
||||
// Test if the Asset field matches the Account field.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(10000), gw, alice);
|
||||
@@ -130,7 +130,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
|
||||
// Test if the Amount field matches the Asset field.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(10000), gw, alice);
|
||||
@@ -159,7 +159,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
|
||||
// Test if the Amount is invalid, which is less than zero.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(10000), gw, alice);
|
||||
@@ -192,7 +192,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
// Test if the issuer did not set asfAllowTrustLineClawback, AMMClawback
|
||||
// transaction is prohibited.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(10000), gw, alice);
|
||||
@@ -216,7 +216,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
|
||||
// Test invalid flag.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(10000), gw, alice);
|
||||
@@ -244,7 +244,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
// Test if tfClawTwoAssets is set when the two assets in the AMM pool
|
||||
// are not issued by the same issuer.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(10000), gw, alice);
|
||||
@@ -275,7 +275,7 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
|
||||
// Test clawing back XRP is being prohibited.
|
||||
{
|
||||
Env env(*this);
|
||||
Env env(*this, features);
|
||||
Account const gw{"gateway"};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(1000000), gw, alice);
|
||||
@@ -2491,10 +2491,14 @@ class AMMClawback_test : public beast::unit_test::suite
|
||||
FeatureBitset const all =
|
||||
jtx::testable_amendments() - featureSingleAssetVault - featureLendingProtocol;
|
||||
|
||||
testInvalidRequest();
|
||||
testInvalidRequest(all);
|
||||
testInvalidRequest(all - featureMPTokensV2);
|
||||
testFeatureDisabled(all - featureAMMClawback);
|
||||
for (auto const& features :
|
||||
{all - fixAMMv1_3 - fixAMMClawbackRounding, all - fixAMMClawbackRounding, all})
|
||||
{all - fixAMMv1_3 - fixAMMClawbackRounding - featureMPTokensV2,
|
||||
all - fixAMMClawbackRounding - featureMPTokensV2,
|
||||
all - featureMPTokensV2,
|
||||
all})
|
||||
{
|
||||
testAMMClawbackSpecificAmount(features);
|
||||
testAMMClawbackExceedBalance(features);
|
||||
|
||||
Reference in New Issue
Block a user