Skip to content

Commit 2a4aefb

Browse files
Dynamic mpt 7439 remove clear flags (#809)
* Align DynamicMPT mutable flags with rippled #7439 (XLS-94) rippled PR XRPLF/rippled#7439 removed the "clear" mutable flags for DynamicMPT and renamed the capability mutable flags. A flag marked mutable at issuance can now be enabled once and then becomes immutable; it can no longer be cleared.
1 parent daf08fa commit 2a4aefb

12 files changed

Lines changed: 748 additions & 766 deletions

File tree

xrpl4j-core/src/main/java/org/xrpl/xrpl4j/model/flags/MpTokenIssuanceCreateMutableFlags.java

Lines changed: 83 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,51 @@
44
* A set of static {@link Flags} which can be set in the {@code MutableFlags} field of
55
* {@link org.xrpl.xrpl4j.model.transactions.MpTokenIssuanceCreate} transactions.
66
*
7-
* <p>These flags (prefixed with {@code tmf}) declare which fields or flags of the created
8-
* {@code MPTokenIssuance} may be mutated after issuance via {@code MPTokenIssuanceSet}.
7+
* <p>These flags (prefixed with {@code tmf}) declare which capabilities of the created
8+
* {@code MPTokenIssuance} may be mutated after issuance via {@code MPTokenIssuanceSet}. Only
9+
* capabilities that were declared mutable at creation time may be enabled, and a capability
10+
* becomes immutable once enabled. The {@code CanMutate*} flags declare that the corresponding
11+
* field may be modified.
912
*
1013
* @see <a href="https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0094-dynamic-MPT">XLS-94</a>
1114
*/
1215
@SuppressWarnings("abbreviationaswordinname")
1316
public class MpTokenIssuanceCreateMutableFlags extends Flags {
1417

1518
/**
16-
* Indicates flag {@code lsfMPTCanLock} can be changed. Hex: {@code 0x00000002}.
19+
* Indicates flag {@code lsfMPTCanLock} can be enabled. Hex: {@code 0x00000002}.
1720
*/
18-
public static final MpTokenIssuanceCreateMutableFlags CAN_MUTATE_CAN_LOCK =
21+
public static final MpTokenIssuanceCreateMutableFlags CAN_ENABLE_CAN_LOCK =
1922
new MpTokenIssuanceCreateMutableFlags(0x00000002);
2023

2124
/**
22-
* Indicates flag {@code lsfMPTRequireAuth} can be changed. Hex: {@code 0x00000004}.
25+
* Indicates flag {@code lsfMPTRequireAuth} can be enabled. Hex: {@code 0x00000004}.
2326
*/
24-
public static final MpTokenIssuanceCreateMutableFlags CAN_MUTATE_REQUIRE_AUTH =
27+
public static final MpTokenIssuanceCreateMutableFlags CAN_ENABLE_REQUIRE_AUTH =
2528
new MpTokenIssuanceCreateMutableFlags(0x00000004);
2629

2730
/**
28-
* Indicates flag {@code lsfMPTCanEscrow} can be changed. Hex: {@code 0x00000008}.
31+
* Indicates flag {@code lsfMPTCanEscrow} can be enabled. Hex: {@code 0x00000008}.
2932
*/
30-
public static final MpTokenIssuanceCreateMutableFlags CAN_MUTATE_CAN_ESCROW =
33+
public static final MpTokenIssuanceCreateMutableFlags CAN_ENABLE_CAN_ESCROW =
3134
new MpTokenIssuanceCreateMutableFlags(0x00000008);
3235

3336
/**
34-
* Indicates flag {@code lsfMPTCanTrade} can be changed. Hex: {@code 0x00000010}.
37+
* Indicates flag {@code lsfMPTCanTrade} can be enabled. Hex: {@code 0x00000010}.
3538
*/
36-
public static final MpTokenIssuanceCreateMutableFlags CAN_MUTATE_CAN_TRADE =
39+
public static final MpTokenIssuanceCreateMutableFlags CAN_ENABLE_CAN_TRADE =
3740
new MpTokenIssuanceCreateMutableFlags(0x00000010);
3841

3942
/**
40-
* Indicates flag {@code lsfMPTCanTransfer} can be changed. Hex: {@code 0x00000020}.
43+
* Indicates flag {@code lsfMPTCanTransfer} can be enabled. Hex: {@code 0x00000020}.
4144
*/
42-
public static final MpTokenIssuanceCreateMutableFlags CAN_MUTATE_CAN_TRANSFER =
45+
public static final MpTokenIssuanceCreateMutableFlags CAN_ENABLE_CAN_TRANSFER =
4346
new MpTokenIssuanceCreateMutableFlags(0x00000020);
4447

4548
/**
46-
* Indicates flag {@code lsfMPTCanClawback} can be changed. Hex: {@code 0x00000040}.
49+
* Indicates flag {@code lsfMPTCanClawback} can be enabled. Hex: {@code 0x00000040}.
4750
*/
48-
public static final MpTokenIssuanceCreateMutableFlags CAN_MUTATE_CAN_CLAWBACK =
51+
public static final MpTokenIssuanceCreateMutableFlags CAN_ENABLE_CAN_CLAWBACK =
4952
new MpTokenIssuanceCreateMutableFlags(0x00000040);
5053

5154
/**
@@ -65,12 +68,12 @@ public class MpTokenIssuanceCreateMutableFlags extends Flags {
6568
* Bit {@code 0x00000001} is reserved (mirrors {@code lsfMPTLocked}) and is excluded.
6669
*/
6770
public static final long VALID_MASK =
68-
CAN_MUTATE_CAN_LOCK.getValue() |
69-
CAN_MUTATE_REQUIRE_AUTH.getValue() |
70-
CAN_MUTATE_CAN_ESCROW.getValue() |
71-
CAN_MUTATE_CAN_TRADE.getValue() |
72-
CAN_MUTATE_CAN_TRANSFER.getValue() |
73-
CAN_MUTATE_CAN_CLAWBACK.getValue() |
71+
CAN_ENABLE_CAN_LOCK.getValue() |
72+
CAN_ENABLE_REQUIRE_AUTH.getValue() |
73+
CAN_ENABLE_CAN_ESCROW.getValue() |
74+
CAN_ENABLE_CAN_TRADE.getValue() |
75+
CAN_ENABLE_CAN_TRANSFER.getValue() |
76+
CAN_ENABLE_CAN_CLAWBACK.getValue() |
7477
CAN_MUTATE_METADATA.getValue() |
7578
CAN_MUTATE_TRANSFER_FEE.getValue();
7679

@@ -98,23 +101,23 @@ public static MpTokenIssuanceCreateMutableFlags of(long value) {
98101
}
99102

100103
private static MpTokenIssuanceCreateMutableFlags of(
101-
boolean tmfMPTCanMutateCanLock,
102-
boolean tmfMPTCanMutateRequireAuth,
103-
boolean tmfMPTCanMutateCanEscrow,
104-
boolean tmfMPTCanMutateCanTrade,
105-
boolean tmfMPTCanMutateCanTransfer,
106-
boolean tmfMPTCanMutateCanClawback,
104+
boolean tmfMPTCanEnableCanLock,
105+
boolean tmfMPTCanEnableRequireAuth,
106+
boolean tmfMPTCanEnableCanEscrow,
107+
boolean tmfMPTCanEnableCanTrade,
108+
boolean tmfMPTCanEnableCanTransfer,
109+
boolean tmfMPTCanEnableCanClawback,
107110
boolean tmfMPTCanMutateMetadata,
108111
boolean tmfMPTCanMutateTransferFee
109112
) {
110113
return new MpTokenIssuanceCreateMutableFlags(
111114
Flags.of(
112-
tmfMPTCanMutateCanLock ? CAN_MUTATE_CAN_LOCK : UNSET,
113-
tmfMPTCanMutateRequireAuth ? CAN_MUTATE_REQUIRE_AUTH : UNSET,
114-
tmfMPTCanMutateCanEscrow ? CAN_MUTATE_CAN_ESCROW : UNSET,
115-
tmfMPTCanMutateCanTrade ? CAN_MUTATE_CAN_TRADE : UNSET,
116-
tmfMPTCanMutateCanTransfer ? CAN_MUTATE_CAN_TRANSFER : UNSET,
117-
tmfMPTCanMutateCanClawback ? CAN_MUTATE_CAN_CLAWBACK : UNSET,
115+
tmfMPTCanEnableCanLock ? CAN_ENABLE_CAN_LOCK : UNSET,
116+
tmfMPTCanEnableRequireAuth ? CAN_ENABLE_REQUIRE_AUTH : UNSET,
117+
tmfMPTCanEnableCanEscrow ? CAN_ENABLE_CAN_ESCROW : UNSET,
118+
tmfMPTCanEnableCanTrade ? CAN_ENABLE_CAN_TRADE : UNSET,
119+
tmfMPTCanEnableCanTransfer ? CAN_ENABLE_CAN_TRANSFER : UNSET,
120+
tmfMPTCanEnableCanClawback ? CAN_ENABLE_CAN_CLAWBACK : UNSET,
118121
tmfMPTCanMutateMetadata ? CAN_MUTATE_METADATA : UNSET,
119122
tmfMPTCanMutateTransferFee ? CAN_MUTATE_TRANSFER_FEE : UNSET
120123
).getValue()
@@ -131,57 +134,57 @@ public static Builder builder() {
131134
}
132135

133136
/**
134-
* Whether the {@code tmfMPTCanMutateCanLock} flag is set, indicating {@code lsfMPTCanLock} can be changed.
137+
* Whether the {@code tmfMPTCanEnableCanLock} flag is set, indicating {@code lsfMPTCanLock} can be enabled.
135138
*
136139
* @return {@code true} if set, otherwise {@code false}.
137140
*/
138-
public boolean tmfMptCanMutateCanLock() {
139-
return this.isSet(CAN_MUTATE_CAN_LOCK);
141+
public boolean tmfMptCanEnableCanLock() {
142+
return this.isSet(CAN_ENABLE_CAN_LOCK);
140143
}
141144

142145
/**
143-
* Whether the {@code tmfMPTCanMutateRequireAuth} flag is set, indicating {@code lsfMPTRequireAuth} can be changed.
146+
* Whether the {@code tmfMPTCanEnableRequireAuth} flag is set, indicating {@code lsfMPTRequireAuth} can be enabled.
144147
*
145148
* @return {@code true} if set, otherwise {@code false}.
146149
*/
147-
public boolean tmfMptCanMutateRequireAuth() {
148-
return this.isSet(CAN_MUTATE_REQUIRE_AUTH);
150+
public boolean tmfMptCanEnableRequireAuth() {
151+
return this.isSet(CAN_ENABLE_REQUIRE_AUTH);
149152
}
150153

151154
/**
152-
* Whether the {@code tmfMPTCanMutateCanEscrow} flag is set, indicating {@code lsfMPTCanEscrow} can be changed.
155+
* Whether the {@code tmfMPTCanEnableCanEscrow} flag is set, indicating {@code lsfMPTCanEscrow} can be enabled.
153156
*
154157
* @return {@code true} if set, otherwise {@code false}.
155158
*/
156-
public boolean tmfMptCanMutateCanEscrow() {
157-
return this.isSet(CAN_MUTATE_CAN_ESCROW);
159+
public boolean tmfMptCanEnableCanEscrow() {
160+
return this.isSet(CAN_ENABLE_CAN_ESCROW);
158161
}
159162

160163
/**
161-
* Whether the {@code tmfMPTCanMutateCanTrade} flag is set, indicating {@code lsfMPTCanTrade} can be changed.
164+
* Whether the {@code tmfMPTCanEnableCanTrade} flag is set, indicating {@code lsfMPTCanTrade} can be enabled.
162165
*
163166
* @return {@code true} if set, otherwise {@code false}.
164167
*/
165-
public boolean tmfMptCanMutateCanTrade() {
166-
return this.isSet(CAN_MUTATE_CAN_TRADE);
168+
public boolean tmfMptCanEnableCanTrade() {
169+
return this.isSet(CAN_ENABLE_CAN_TRADE);
167170
}
168171

169172
/**
170-
* Whether the {@code tmfMPTCanMutateCanTransfer} flag is set, indicating {@code lsfMPTCanTransfer} can be changed.
173+
* Whether the {@code tmfMPTCanEnableCanTransfer} flag is set, indicating {@code lsfMPTCanTransfer} can be enabled.
171174
*
172175
* @return {@code true} if set, otherwise {@code false}.
173176
*/
174-
public boolean tmfMptCanMutateCanTransfer() {
175-
return this.isSet(CAN_MUTATE_CAN_TRANSFER);
177+
public boolean tmfMptCanEnableCanTransfer() {
178+
return this.isSet(CAN_ENABLE_CAN_TRANSFER);
176179
}
177180

178181
/**
179-
* Whether the {@code tmfMPTCanMutateCanClawback} flag is set, indicating {@code lsfMPTCanClawback} can be changed.
182+
* Whether the {@code tmfMPTCanEnableCanClawback} flag is set, indicating {@code lsfMPTCanClawback} can be enabled.
180183
*
181184
* @return {@code true} if set, otherwise {@code false}.
182185
*/
183-
public boolean tmfMptCanMutateCanClawback() {
184-
return this.isSet(CAN_MUTATE_CAN_CLAWBACK);
186+
public boolean tmfMptCanEnableCanClawback() {
187+
return this.isSet(CAN_ENABLE_CAN_CLAWBACK);
185188
}
186189

187190
/**
@@ -207,84 +210,84 @@ public boolean tmfMptCanMutateTransferFee() {
207210
*/
208211
public static class Builder {
209212

210-
private boolean tmfMptCanMutateCanLock = false;
211-
private boolean tmfMptCanMutateRequireAuth = false;
212-
private boolean tmfMptCanMutateCanEscrow = false;
213-
private boolean tmfMptCanMutateCanTrade = false;
214-
private boolean tmfMptCanMutateCanTransfer = false;
215-
private boolean tmfMptCanMutateCanClawback = false;
213+
private boolean tmfMptCanEnableCanLock = false;
214+
private boolean tmfMptCanEnableRequireAuth = false;
215+
private boolean tmfMptCanEnableCanEscrow = false;
216+
private boolean tmfMptCanEnableCanTrade = false;
217+
private boolean tmfMptCanEnableCanTransfer = false;
218+
private boolean tmfMptCanEnableCanClawback = false;
216219
private boolean tmfMptCanMutateMetadata = false;
217220
private boolean tmfMptCanMutateTransferFee = false;
218221

219222
/**
220-
* Set {@code tmfMptCanMutateCanLock}.
223+
* Set {@code tmfMptCanEnableCanLock}.
221224
*
222225
* @param value A boolean value.
223226
*
224227
* @return The same {@link Builder}.
225228
*/
226-
public Builder tmfMptCanMutateCanLock(boolean value) {
227-
this.tmfMptCanMutateCanLock = value;
229+
public Builder tmfMptCanEnableCanLock(boolean value) {
230+
this.tmfMptCanEnableCanLock = value;
228231
return this;
229232
}
230233

231234
/**
232-
* Set {@code tmfMptCanMutateRequireAuth}.
235+
* Set {@code tmfMptCanEnableRequireAuth}.
233236
*
234237
* @param value A boolean value.
235238
*
236239
* @return The same {@link Builder}.
237240
*/
238-
public Builder tmfMptCanMutateRequireAuth(boolean value) {
239-
this.tmfMptCanMutateRequireAuth = value;
241+
public Builder tmfMptCanEnableRequireAuth(boolean value) {
242+
this.tmfMptCanEnableRequireAuth = value;
240243
return this;
241244
}
242245

243246
/**
244-
* Set {@code tmfMptCanMutateCanEscrow}.
247+
* Set {@code tmfMptCanEnableCanEscrow}.
245248
*
246249
* @param value A boolean value.
247250
*
248251
* @return The same {@link Builder}.
249252
*/
250-
public Builder tmfMptCanMutateCanEscrow(boolean value) {
251-
this.tmfMptCanMutateCanEscrow = value;
253+
public Builder tmfMptCanEnableCanEscrow(boolean value) {
254+
this.tmfMptCanEnableCanEscrow = value;
252255
return this;
253256
}
254257

255258
/**
256-
* Set {@code tmfMptCanMutateCanTrade}.
259+
* Set {@code tmfMptCanEnableCanTrade}.
257260
*
258261
* @param value A boolean value.
259262
*
260263
* @return The same {@link Builder}.
261264
*/
262-
public Builder tmfMptCanMutateCanTrade(boolean value) {
263-
this.tmfMptCanMutateCanTrade = value;
265+
public Builder tmfMptCanEnableCanTrade(boolean value) {
266+
this.tmfMptCanEnableCanTrade = value;
264267
return this;
265268
}
266269

267270
/**
268-
* Set {@code tmfMptCanMutateCanTransfer}.
271+
* Set {@code tmfMptCanEnableCanTransfer}.
269272
*
270273
* @param value A boolean value.
271274
*
272275
* @return The same {@link Builder}.
273276
*/
274-
public Builder tmfMptCanMutateCanTransfer(boolean value) {
275-
this.tmfMptCanMutateCanTransfer = value;
277+
public Builder tmfMptCanEnableCanTransfer(boolean value) {
278+
this.tmfMptCanEnableCanTransfer = value;
276279
return this;
277280
}
278281

279282
/**
280-
* Set {@code tmfMptCanMutateCanClawback}.
283+
* Set {@code tmfMptCanEnableCanClawback}.
281284
*
282285
* @param value A boolean value.
283286
*
284287
* @return The same {@link Builder}.
285288
*/
286-
public Builder tmfMptCanMutateCanClawback(boolean value) {
287-
this.tmfMptCanMutateCanClawback = value;
289+
public Builder tmfMptCanEnableCanClawback(boolean value) {
290+
this.tmfMptCanEnableCanClawback = value;
288291
return this;
289292
}
290293

@@ -319,12 +322,12 @@ public Builder tmfMptCanMutateTransferFee(boolean value) {
319322
*/
320323
public MpTokenIssuanceCreateMutableFlags build() {
321324
return MpTokenIssuanceCreateMutableFlags.of(
322-
tmfMptCanMutateCanLock,
323-
tmfMptCanMutateRequireAuth,
324-
tmfMptCanMutateCanEscrow,
325-
tmfMptCanMutateCanTrade,
326-
tmfMptCanMutateCanTransfer,
327-
tmfMptCanMutateCanClawback,
325+
tmfMptCanEnableCanLock,
326+
tmfMptCanEnableRequireAuth,
327+
tmfMptCanEnableCanEscrow,
328+
tmfMptCanEnableCanTrade,
329+
tmfMptCanEnableCanTransfer,
330+
tmfMptCanEnableCanClawback,
328331
tmfMptCanMutateMetadata,
329332
tmfMptCanMutateTransferFee
330333
);

0 commit comments

Comments
 (0)