diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index e0a6c1eca08..c0d357b6b9b 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -34,11 +34,6 @@ namespace ripple { -template -concept AssetType = - std::is_same_v || std::is_convertible_v || - std::is_convertible_v || std::is_convertible_v; - // Internal form: // 1: If amount is zero, then value is zero and offset is -100 // 2: Otherwise: diff --git a/include/xrpl/protocol/detail/features.macro b/include/xrpl/protocol/detail/features.macro index 436c073f34c..55f41397ed1 100644 --- a/include/xrpl/protocol/detail/features.macro +++ b/include/xrpl/protocol/detail/features.macro @@ -29,9 +29,9 @@ // If you add an amendment here, then do not forget to increment `numFeatures` // in include/xrpl/protocol/Feature.h. +XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo) // InvariantsV1_1 will be changes to Supported::yes when all the // invariants expected to be included under it are complete. -XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(InvariantsV1_1, Supported::no, VoteBehavior::DefaultNo) XRPL_FIX (NFTokenPageLinks, Supported::yes, VoteBehavior::DefaultNo) XRPL_FIX (InnerObjTemplate2, Supported::yes, VoteBehavior::DefaultNo) @@ -95,7 +95,6 @@ XRPL_FIX (1513, Supported::yes, VoteBehavior::DefaultYe XRPL_FEATURE(FlowCross, Supported::yes, VoteBehavior::DefaultYes) XRPL_FEATURE(Flow, Supported::yes, VoteBehavior::DefaultYes) XRPL_FEATURE(OwnerPaysFee, Supported::no, VoteBehavior::DefaultNo) -XRPL_FEATURE(MPTokensV1, Supported::yes, VoteBehavior::DefaultNo) // The following amendments are obsolete, but must remain supported // because they could potentially get enabled. diff --git a/include/xrpl/protocol/jss.h b/include/xrpl/protocol/jss.h index 45e872a4450..bafdde4fbcc 100644 --- a/include/xrpl/protocol/jss.h +++ b/include/xrpl/protocol/jss.h @@ -78,8 +78,6 @@ JSS(LastLedgerSequence); // in: TransactionSign; field JSS(LastUpdateTime); // field. JSS(LedgerHashes); // ledger type. JSS(LimitAmount); // field. -JSS(BidMax); // in: AMM Bid -JSS(BidMin); // in: AMM Bid JSS(MPToken); // ledger type. JSS(MPTokenIssuance); // ledger type. JSS(NetworkID); // field. diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index 31fc10d5ce3..fa888faea17 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -671,7 +671,6 @@ class MPToken_test : public beast::unit_test::suite Json::Value jv; jv[jss::secret] = alice.name(); - jv[jss::tx_json][jss::Fee] = to_string(env.current()->fees().base); jv[jss::tx_json] = pay(alice, carol, mpt); jv[jss::tx_json][jss::Fee] = to_string(env.current()->fees().base); auto const jrr = env.rpc("json", "submit", to_string(jv)); @@ -1409,7 +1408,6 @@ class MPToken_test : public beast::unit_test::suite jv[jss::Flags] = tfSingleAsset; test(jv, field.fieldName); }; - ammDeposit(sfAmount); for (SField const& field : {std::ref(sfAmount), std::ref(sfAmount2), diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index 9ad9f5e36c6..d3611efe462 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -136,7 +136,6 @@ Account const& MPTTester::holder(std::string const& holder_) const { auto const& it = holders_.find(holder_); - assert(it != holders_.cend()); if (it == holders_.cend()) Throw("Holder is not found"); return it->second; diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp b/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp index 3e70e95aaee..8042c9c6982 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp +++ b/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp @@ -262,7 +262,6 @@ MPTokenAuthorize::doApply() .account = account_, .flags = tx.getFlags(), .holderID = tx[~sfHolder]}); - .holderID = tx[~sfMPTokenHolder]}); } } // namespace ripple diff --git a/src/xrpld/ledger/View.h b/src/xrpld/ledger/View.h index e7fe05c0850..74027752486 100644 --- a/src/xrpld/ledger/View.h +++ b/src/xrpld/ledger/View.h @@ -182,15 +182,6 @@ accountHolds( AuthHandling zeroIfUnauthorized, beast::Journal j); -[[nodiscard]] STAmount -accountHolds( - ReadView const& view, - AccountID const& account, - MPTIssue const& mptIssue, - FreezeHandling zeroIfFrozen, - AuthHandling zeroIfUnauthorized, - beast::Journal j); - // Returns the amount an account can spend of the currency type saDefault, or // returns saDefault if this account is the issuer of the currency in // question. Should be used in favor of accountHolds when questioning how much diff --git a/src/xrpld/ledger/detail/View.cpp b/src/xrpld/ledger/detail/View.cpp index c4e7c5c0172..ae4eb095017 100644 --- a/src/xrpld/ledger/detail/View.cpp +++ b/src/xrpld/ledger/detail/View.cpp @@ -230,18 +230,6 @@ isIndividualFrozen( return false; } -bool -isIndividualFrozen( - ReadView const& view, - AccountID const& account, - MPTIssue const& mptIssue) -{ - if (auto const sle = - view.read(keylet::mptoken(mptIssue.getMptID(), account))) - return sle->getFlags() & lsfMPTLocked; - return false; -} - // Can the specified account spend the specified currency issued by // the specified issuer or does the freeze flag prohibit it? bool @@ -601,19 +589,6 @@ transferRate(ReadView const& view, MPTID const& issuanceID) return parityRate; } -Rate -transferRate(ReadView const& view, MPTID const& issuanceID) -{ - // fee is 0-50,000 (0-50%), rate is 1,000,000,000-2,000,000,000 - // For example, if transfer fee is 50% then 10,000 * 50,000 = 500,000 - // which represents 50% of 1,000,000,000 - if (auto const sle = view.read(keylet::mptIssuance(issuanceID)); - sle && sle->isFieldPresent(sfTransferFee)) - return Rate{1'000'000'000u + 10'000 * sle->getFieldU16(sfTransferFee)}; - - return parityRate; -} - bool areCompatible( ReadView const& validLedger, @@ -1543,93 +1518,6 @@ accountSend( saAmount.asset().value()); } -static TER -rippleSendMPT( - ApplyView& view, - AccountID const& uSenderID, - AccountID const& uReceiverID, - STAmount const& saAmount, - STAmount& saActual, - beast::Journal j, - WaiveTransferFee waiveFee) -{ - assert(uSenderID != uReceiverID); - - // Safe to get MPT since rippleSendMPT is only called by accountSendMPT - auto const issuer = saAmount.getIssuer(); - - auto const sle = - view.read(keylet::mptIssuance(saAmount.get().getMptID())); - if (!sle) - return tecOBJECT_NOT_FOUND; - - if (uSenderID == issuer || uReceiverID == issuer) - { - // if sender is issuer, check that the new OutstandingAmount will not - // exceed MaximumAmount - if (uSenderID == issuer) - { - auto const sendAmount = saAmount.mpt().value(); - auto const maximumAmount = - sle->at(~sfMaximumAmount).value_or(maxMPTokenAmount); - if (sendAmount > maximumAmount || - sle->getFieldU64(sfOutstandingAmount) > - maximumAmount - sendAmount) - return tecPATH_DRY; - } - - // Direct send: redeeming MPTs and/or sending own MPTs. - auto const ter = - rippleCreditMPT(view, uSenderID, uReceiverID, saAmount, j); - if (ter != tesSUCCESS) - return ter; - saActual = saAmount; - return tesSUCCESS; - } - - // Sending 3rd party MPTs: transit. - saActual = (waiveFee == WaiveTransferFee::Yes) - ? saAmount - : multiply( - saAmount, - transferRate(view, saAmount.get().getMptID())); - - JLOG(j.debug()) << "rippleSend> " << to_string(uSenderID) << " - > " - << to_string(uReceiverID) - << " : deliver=" << saAmount.getFullText() - << " cost=" << saActual.getFullText(); - - if (auto const terResult = - rippleCreditMPT(view, issuer, uReceiverID, saAmount, j); - terResult != tesSUCCESS) - return terResult; - - return rippleCreditMPT(view, uSenderID, issuer, saActual, j); -} - -TER -accountSendMPT( - ApplyView& view, - AccountID const& uSenderID, - AccountID const& uReceiverID, - STAmount const& saAmount, - beast::Journal j, - WaiveTransferFee waiveFee) -{ - assert(saAmount >= beast::zero && saAmount.holds()); - - /* If we aren't sending anything or if the sender is the same as the - * receiver then we don't need to do anything. - */ - if (!saAmount || (uSenderID == uReceiverID)) - return tesSUCCESS; - - STAmount saActual{saAmount.asset()}; - - return rippleSendMPT( - view, uSenderID, uReceiverID, saAmount, saActual, j, waiveFee); -} - static bool updateTrustLine( ApplyView& view, @@ -2089,66 +1977,6 @@ deleteAMMTrustLine( return tesSUCCESS; } -TER -rippleCreditMPT( - ApplyView& view, - AccountID const& uSenderID, - AccountID const& uReceiverID, - STAmount const& saAmount, - beast::Journal j) -{ - auto const mptID = keylet::mptIssuance(saAmount.get().getMptID()); - auto const issuer = saAmount.getIssuer(); - auto sleIssuance = view.peek(mptID); - if (!sleIssuance) - return tecOBJECT_NOT_FOUND; - if (uSenderID == issuer) - { - (*sleIssuance)[sfOutstandingAmount] += saAmount.mpt().value(); - view.update(sleIssuance); - } - else - { - auto const mptokenID = keylet::mptoken(mptID.key, uSenderID); - if (auto sle = view.peek(mptokenID)) - { - auto const amt = sle->getFieldU64(sfMPTAmount); - auto const pay = saAmount.mpt().value(); - if (amt < pay) - return tecINSUFFICIENT_FUNDS; - (*sle)[sfMPTAmount] = amt - pay; - view.update(sle); - } - else - return tecNO_AUTH; - } - - if (uReceiverID == issuer) - { - auto const outstanding = sleIssuance->getFieldU64(sfOutstandingAmount); - auto const redeem = saAmount.mpt().value(); - if (outstanding >= redeem) - { - sleIssuance->setFieldU64(sfOutstandingAmount, outstanding - redeem); - view.update(sleIssuance); - } - else - return tecINTERNAL; - } - else - { - auto const mptokenID = keylet::mptoken(mptID.key, uReceiverID); - if (auto sle = view.peek(mptokenID)) - { - (*sle)[sfMPTAmount] += saAmount.mpt().value(); - view.update(sle); - } - else - return tecNO_AUTH; - } - return tesSUCCESS; -} - TER rippleCredit( ApplyView& view,