Skip to content

Commit ccb9f1e

Browse files
authored
Support DynamicMPT XLS-94d (#5705)
* extends the functionality of the MPTokenIssuanceSet transaction, allowing the issuer to update fields or flags that were explicitly marked as mutable during creation.
1 parent 3e4e9a2 commit ccb9f1e

File tree

12 files changed

+1215
-26
lines changed

12 files changed

+1215
-26
lines changed

include/xrpl/protocol/LedgerFormats.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ enum LedgerSpecificFlags {
188188
lsfMPTCanTransfer = 0x00000020,
189189
lsfMPTCanClawback = 0x00000040,
190190

191+
lsfMPTCanMutateCanLock = 0x00000002,
192+
lsfMPTCanMutateRequireAuth = 0x00000004,
193+
lsfMPTCanMutateCanEscrow = 0x00000008,
194+
lsfMPTCanMutateCanTrade = 0x00000010,
195+
lsfMPTCanMutateCanTransfer = 0x00000020,
196+
lsfMPTCanMutateCanClawback = 0x00000040,
197+
lsfMPTCanMutateMetadata = 0x00010000,
198+
lsfMPTCanMutateTransferFee = 0x00020000,
199+
191200
// ltMPTOKEN
192201
lsfMPTAuthorized = 0x00000002,
193202

include/xrpl/protocol/TxFlags.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,20 @@ constexpr std::uint32_t const tfMPTCanClawback = lsfMPTCanClawback;
151151
constexpr std::uint32_t const tfMPTokenIssuanceCreateMask =
152152
~(tfUniversal | tfMPTCanLock | tfMPTRequireAuth | tfMPTCanEscrow | tfMPTCanTrade | tfMPTCanTransfer | tfMPTCanClawback);
153153

154+
// MPTokenIssuanceCreate MutableFlags:
155+
// Indicating specific fields or flags may be changed after issuance.
156+
constexpr std::uint32_t const tfMPTCanMutateCanLock = lsfMPTCanMutateCanLock;
157+
constexpr std::uint32_t const tfMPTCanMutateRequireAuth = lsfMPTCanMutateRequireAuth;
158+
constexpr std::uint32_t const tfMPTCanMutateCanEscrow = lsfMPTCanMutateCanEscrow;
159+
constexpr std::uint32_t const tfMPTCanMutateCanTrade = lsfMPTCanMutateCanTrade;
160+
constexpr std::uint32_t const tfMPTCanMutateCanTransfer = lsfMPTCanMutateCanTransfer;
161+
constexpr std::uint32_t const tfMPTCanMutateCanClawback = lsfMPTCanMutateCanClawback;
162+
constexpr std::uint32_t const tfMPTCanMutateMetadata = lsfMPTCanMutateMetadata;
163+
constexpr std::uint32_t const tfMPTCanMutateTransferFee = lsfMPTCanMutateTransferFee;
164+
constexpr std::uint32_t const tfMPTokenIssuanceCreateMutableMask =
165+
~(tfMPTCanMutateCanLock | tfMPTCanMutateRequireAuth | tfMPTCanMutateCanEscrow | tfMPTCanMutateCanTrade
166+
| tfMPTCanMutateCanTransfer | tfMPTCanMutateCanClawback | tfMPTCanMutateMetadata | tfMPTCanMutateTransferFee);
167+
154168
// MPTokenAuthorize flags:
155169
constexpr std::uint32_t const tfMPTUnauthorize = 0x00000001;
156170
constexpr std::uint32_t const tfMPTokenAuthorizeMask = ~(tfUniversal | tfMPTUnauthorize);
@@ -161,6 +175,25 @@ constexpr std::uint32_t const tfMPTUnlock = 0x00000002;
161175
constexpr std::uint32_t const tfMPTokenIssuanceSetMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
162176
constexpr std::uint32_t const tfMPTokenIssuanceSetPermissionMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);
163177

178+
// MPTokenIssuanceSet MutableFlags:
179+
// Set or Clear flags.
180+
constexpr std::uint32_t const tfMPTSetCanLock = 0x00000001;
181+
constexpr std::uint32_t const tfMPTClearCanLock = 0x00000002;
182+
constexpr std::uint32_t const tfMPTSetRequireAuth = 0x00000004;
183+
constexpr std::uint32_t const tfMPTClearRequireAuth = 0x00000008;
184+
constexpr std::uint32_t const tfMPTSetCanEscrow = 0x00000010;
185+
constexpr std::uint32_t const tfMPTClearCanEscrow = 0x00000020;
186+
constexpr std::uint32_t const tfMPTSetCanTrade = 0x00000040;
187+
constexpr std::uint32_t const tfMPTClearCanTrade = 0x00000080;
188+
constexpr std::uint32_t const tfMPTSetCanTransfer = 0x00000100;
189+
constexpr std::uint32_t const tfMPTClearCanTransfer = 0x00000200;
190+
constexpr std::uint32_t const tfMPTSetCanClawback = 0x00000400;
191+
constexpr std::uint32_t const tfMPTClearCanClawback = 0x00000800;
192+
constexpr std::uint32_t const tfMPTokenIssuanceSetMutableMask = ~(tfMPTSetCanLock | tfMPTClearCanLock |
193+
tfMPTSetRequireAuth | tfMPTClearRequireAuth | tfMPTSetCanEscrow | tfMPTClearCanEscrow |
194+
tfMPTSetCanTrade | tfMPTClearCanTrade | tfMPTSetCanTransfer | tfMPTClearCanTransfer |
195+
tfMPTSetCanClawback | tfMPTClearCanClawback);
196+
164197
// MPTokenIssuanceDestroy flags:
165198
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
166199

include/xrpl/protocol/detail/features.macro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
// If you add an amendment here, then do not forget to increment `numFeatures`
3333
// in include/xrpl/protocol/Feature.h.
3434

35+
XRPL_FEATURE(DynamicMPT, Supported::no, VoteBehavior::DefaultNo)
3536
XRPL_FIX (TokenEscrowV1, Supported::yes, VoteBehavior::DefaultNo)
3637
XRPL_FIX (DelegateV1_1, Supported::no, VoteBehavior::DefaultNo)
3738
XRPL_FIX (PriceOracleOrder, Supported::no, VoteBehavior::DefaultNo)

include/xrpl/protocol/detail/ledger_entries.macro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ LEDGER_ENTRY(ltMPTOKEN_ISSUANCE, 0x007e, MPTokenIssuance, mpt_issuance, ({
412412
{sfPreviousTxnID, soeREQUIRED},
413413
{sfPreviousTxnLgrSeq, soeREQUIRED},
414414
{sfDomainID, soeOPTIONAL},
415+
{sfMutableFlags, soeDEFAULT},
415416
}))
416417

417418
/** A ledger object which tracks MPToken

include/xrpl/protocol/detail/sfields.macro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ TYPED_SFIELD(sfVoteWeight, UINT32, 48)
114114
TYPED_SFIELD(sfFirstNFTokenSequence, UINT32, 50)
115115
TYPED_SFIELD(sfOracleDocumentID, UINT32, 51)
116116
TYPED_SFIELD(sfPermissionValue, UINT32, 52)
117+
TYPED_SFIELD(sfMutableFlags, UINT32, 53)
117118

118119
// 64-bit integers (common)
119120
TYPED_SFIELD(sfIndexNext, UINT64, 1)

include/xrpl/protocol/detail/transactions.macro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate,
548548
{sfMaximumAmount, soeOPTIONAL},
549549
{sfMPTokenMetadata, soeOPTIONAL},
550550
{sfDomainID, soeOPTIONAL},
551+
{sfMutableFlags, soeOPTIONAL},
551552
}))
552553

553554
/** This transaction type destroys a MPTokensIssuance instance */
@@ -566,6 +567,9 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet,
566567
{sfMPTokenIssuanceID, soeREQUIRED},
567568
{sfHolder, soeOPTIONAL},
568569
{sfDomainID, soeOPTIONAL},
570+
{sfMPTokenMetadata, soeOPTIONAL},
571+
{sfTransferFee, soeOPTIONAL},
572+
{sfMutableFlags, soeOPTIONAL},
569573
}))
570574

571575
/** This transaction type authorizes a MPToken instance */

0 commit comments

Comments
 (0)