Skip to content

Commit fc6800c

Browse files
committed
cosmetic changes and rename amendment
1 parent 4ea7d56 commit fc6800c

File tree

7 files changed

+76
-81
lines changed

7 files changed

+76
-81
lines changed

src/ripple/app/tx/impl/NFTokenAcceptOffer.cpp

+14-22
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ NFTokenAcceptOffer::preclaim(PreclaimContext const& ctx)
109109

110110
// The two offers may not form a loop. A broker may not sell the
111111
// token to the current owner of the token.
112-
if (ctx.view.rules().enabled(fixUnburnableNFToken) &&
112+
if (ctx.view.rules().enabled(fixNonFungibleTokensV1_2) &&
113113
((*bo)[sfOwner] == (*so)[sfOwner]))
114114
return tecCANT_ACCEPT_OWN_NFTOKEN_OFFER;
115115

@@ -121,37 +121,29 @@ NFTokenAcceptOffer::preclaim(PreclaimContext const& ctx)
121121
// If the buyer specified a destination
122122
if (auto const dest = bo->at(~sfDestination))
123123
{
124-
// fixUnburnableNFToken
125-
if (ctx.view.rules().enabled(fixUnburnableNFToken))
124+
// Before this fix the destination could be either the seller or
125+
// a broker. After, it must be whoever is submitting the tx.
126+
if (ctx.view.rules().enabled(fixNonFungibleTokensV1_2))
126127
{
127-
// the destination may only be the account brokering the offer
128128
if (*dest != ctx.tx[sfAccount])
129129
return tecNO_PERMISSION;
130130
}
131-
else
132-
{
133-
// the destination must be the seller or the broker.
134-
if (*dest != so->at(sfOwner) && *dest != ctx.tx[sfAccount])
135-
return tecNFTOKEN_BUY_SELL_MISMATCH;
136-
}
131+
else if (*dest != so->at(sfOwner) && *dest != ctx.tx[sfAccount])
132+
return tecNFTOKEN_BUY_SELL_MISMATCH;
137133
}
138134

139135
// If the seller specified a destination
140136
if (auto const dest = so->at(~sfDestination))
141137
{
142-
// fixUnburnableNFToken
143-
if (ctx.view.rules().enabled(fixUnburnableNFToken))
138+
// Before this fix the destination could be either the seller or
139+
// a broker. After, it must be whoever is submitting the tx.
140+
if (ctx.view.rules().enabled(fixNonFungibleTokensV1_2))
144141
{
145-
// the destination may only be the account brokering the offer
146142
if (*dest != ctx.tx[sfAccount])
147143
return tecNO_PERMISSION;
148144
}
149-
else
150-
{
151-
// the destination must be the buyer or the broker.
152-
if (*dest != bo->at(sfOwner) && *dest != ctx.tx[sfAccount])
153-
return tecNFTOKEN_BUY_SELL_MISMATCH;
154-
}
145+
else if (*dest != bo->at(sfOwner) && *dest != ctx.tx[sfAccount])
146+
return tecNFTOKEN_BUY_SELL_MISMATCH;
155147
}
156148

157149
// The broker can specify an amount that represents their cut; if they
@@ -200,7 +192,7 @@ NFTokenAcceptOffer::preclaim(PreclaimContext const& ctx)
200192
// After this amendment, we allow an IOU issuer to buy an NFT with their
201193
// own currency
202194
auto const needed = bo->at(sfAmount);
203-
if (ctx.view.rules().enabled(fixUnburnableNFToken))
195+
if (ctx.view.rules().enabled(fixNonFungibleTokensV1_2))
204196
{
205197
if (accountFunds(
206198
ctx.view, (*bo)[sfOwner], needed, fhZERO_IF_FROZEN, ctx.j) <
@@ -243,7 +235,7 @@ NFTokenAcceptOffer::preclaim(PreclaimContext const& ctx)
243235

244236
// The account offering to buy must have funds:
245237
auto const needed = so->at(sfAmount);
246-
if (!ctx.view.rules().enabled(fixUnburnableNFToken))
238+
if (!ctx.view.rules().enabled(fixNonFungibleTokensV1_2))
247239
{
248240
if (accountHolds(
249241
ctx.view,
@@ -298,7 +290,7 @@ NFTokenAcceptOffer::pay(
298290
// their own currency, we know that something went wrong. This was
299291
// originally found in the context of IOU transfer fees. Since there are
300292
// several payouts in this tx, just confirm that the end state is OK.
301-
if (!view().rules().enabled(fixUnburnableNFToken))
293+
if (!view().rules().enabled(fixNonFungibleTokensV1_2))
302294
return result;
303295
if (result != tesSUCCESS)
304296
return result;

src/ripple/app/tx/impl/NFTokenBurn.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ NFTokenBurn::preclaim(PreclaimContext const& ctx)
7777
}
7878
}
7979

80-
if (!ctx.view.rules().enabled(fixUnburnableNFToken))
80+
if (!ctx.view.rules().enabled(fixNonFungibleTokensV1_2))
8181
{
8282
// If there are too many offers, then burning the token would produce
8383
// too much metadata. Disallow burning a token with too many offers.
@@ -109,7 +109,7 @@ NFTokenBurn::doApply()
109109
view().update(issuer);
110110
}
111111

112-
if (ctx_.view().rules().enabled(fixUnburnableNFToken))
112+
if (ctx_.view().rules().enabled(fixNonFungibleTokensV1_2))
113113
{
114114
// Delete up to 500 offers in total.
115115
// Because the number of sell offers is likely to be less than

src/ripple/app/tx/impl/NFTokenCreateOffer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ NFTokenCreateOffer::preclaim(PreclaimContext const& ctx)
155155
{
156156
// After this amendment, we allow an IOU issuer to make a buy offer
157157
// using their own currency.
158-
if (ctx.view.rules().enabled(fixUnburnableNFToken))
158+
if (ctx.view.rules().enabled(fixNonFungibleTokensV1_2))
159159
{
160160
if (accountFunds(
161161
ctx.view,

src/ripple/protocol/Feature.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ extern uint256 const fixTrustLinesToSelf;
341341
extern uint256 const fixRemoveNFTokenAutoTrustLine;
342342
extern uint256 const featureImmediateOfferKilled;
343343
extern uint256 const featureDisallowIncoming;
344-
extern uint256 const fixUnburnableNFToken;
344+
extern uint256 const fixNonFungibleTokensV1_2;
345345

346346
} // namespace ripple
347347

src/ripple/protocol/impl/Feature.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ REGISTER_FIX (fixTrustLinesToSelf, Supported::yes, DefaultVote::no)
451451
REGISTER_FIX (fixRemoveNFTokenAutoTrustLine, Supported::yes, DefaultVote::yes);
452452
REGISTER_FEATURE(ImmediateOfferKilled, Supported::yes, DefaultVote::no);
453453
REGISTER_FEATURE(DisallowIncoming, Supported::yes, DefaultVote::no);
454-
REGISTER_FIX (fixUnburnableNFToken, Supported::yes, DefaultVote::no);
454+
REGISTER_FIX (fixNonFungibleTokensV1_2, Supported::yes, DefaultVote::no);
455455

456456
// The following amendments have been active for at least two years. Their
457457
// pre-amendment code has been removed and the identifiers are deprecated.

src/test/app/NFTokenBurn_test.cpp

+14-13
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ class NFTokenBurn_test : public beast::unit_test::suite
256256
// Otherwise either alice or minter can burn.
257257
AcctStat& burner = owner.acct == becky.acct
258258
? *(stats[acctDist(engine)])
259-
: mintDist(engine) ? alice : minter;
259+
: mintDist(engine) ? alice
260+
: minter;
260261

261262
if (owner.acct == burner.acct)
262263
env(token::burn(burner, nft));
@@ -524,8 +525,8 @@ class NFTokenBurn_test : public beast::unit_test::suite
524525
using namespace test::jtx;
525526

526527
// Test what happens if a NFT is unburnable when there are
527-
// more than 500 offers, before fixUnburnableNFToken goes live
528-
if (!features[fixUnburnableNFToken])
528+
// more than 500 offers, before fixNonFungibleTokensV1_2 goes live
529+
if (!features[fixNonFungibleTokensV1_2])
529530
{
530531
Env env{*this, features};
531532

@@ -620,10 +621,10 @@ class NFTokenBurn_test : public beast::unit_test::suite
620621
}
621622

622623
// Test that up to 499 buy/sell offers will be removed when NFT is
623-
// burned after fixUnburnableNFToken is enabled. This is to test that we
624-
// can successfully remove all offers if the number of offers is less
625-
// than 500.
626-
if (features[fixUnburnableNFToken])
624+
// burned after fixNonFungibleTokensV1_2 is enabled. This is to test
625+
// that we can successfully remove all offers if the number of offers is
626+
// less than 500.
627+
if (features[fixNonFungibleTokensV1_2])
627628
{
628629
Env env{*this, features};
629630

@@ -673,8 +674,8 @@ class NFTokenBurn_test : public beast::unit_test::suite
673674
}
674675

675676
// Test that up to 500 buy offers are removed when NFT is burned
676-
// after fixUnburnableNFToken is enabled
677-
if (features[fixUnburnableNFToken])
677+
// after fixNonFungibleTokensV1_2 is enabled
678+
if (features[fixNonFungibleTokensV1_2])
678679
{
679680
Env env{*this, features};
680681

@@ -718,8 +719,8 @@ class NFTokenBurn_test : public beast::unit_test::suite
718719
}
719720

720721
// Test that up to 500 buy/sell offers are removed when NFT is burned
721-
// after fixUnburnableNFToken is enabled
722-
if (features[fixUnburnableNFToken])
722+
// after fixNonFungibleTokensV1_2 is enabled
723+
if (features[fixNonFungibleTokensV1_2])
723724
{
724725
Env env{*this, features};
725726

@@ -786,8 +787,8 @@ class NFTokenBurn_test : public beast::unit_test::suite
786787
FeatureBitset const all{supported_amendments()};
787788
FeatureBitset const fixNFTDir{fixNFTokenDirV1};
788789

789-
testWithFeats(all - fixUnburnableNFToken - fixNFTDir);
790-
testWithFeats(all - fixUnburnableNFToken);
790+
testWithFeats(all - fixNonFungibleTokensV1_2 - fixNFTDir);
791+
testWithFeats(all - fixNonFungibleTokensV1_2);
791792
testWithFeats(all);
792793
}
793794
};

0 commit comments

Comments
 (0)