Skip to content

Commit

Permalink
Merge pull request #5 from shawnxie999/mpt-rename-new
Browse files Browse the repository at this point in the history
Rename MPT
  • Loading branch information
gregtatcam authored Jan 4, 2024
2 parents bc9b900 + f43d99a commit ed90cdd
Show file tree
Hide file tree
Showing 67 changed files with 1,202 additions and 1,202 deletions.
16 changes: 8 additions & 8 deletions Builds/CMake/RippledCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ target_sources (rippled PRIVATE
src/ripple/app/tx/impl/AMMWithdraw.cpp
src/ripple/app/tx/impl/ApplyContext.cpp
src/ripple/app/tx/impl/BookTip.cpp
src/ripple/app/tx/impl/CFTokenIssuanceCreate.cpp
src/ripple/app/tx/impl/CFTokenIssuanceDestroy.cpp
src/ripple/app/tx/impl/CFTokenAuthorize.cpp
src/ripple/app/tx/impl/CFTokenIssuanceSet.cpp
src/ripple/app/tx/impl/MPTokenIssuanceCreate.cpp
src/ripple/app/tx/impl/MPTokenIssuanceDestroy.cpp
src/ripple/app/tx/impl/MPTokenAuthorize.cpp
src/ripple/app/tx/impl/MPTokenIssuanceSet.cpp
src/ripple/app/tx/impl/CancelCheck.cpp
src/ripple/app/tx/impl/CancelOffer.cpp
src/ripple/app/tx/impl/CashCheck.cpp
Expand Down Expand Up @@ -683,7 +683,7 @@ target_sources (rippled PRIVATE
src/ripple/rpc/handlers/BlackList.cpp
src/ripple/rpc/handlers/BookOffers.cpp
src/ripple/rpc/handlers/CanDelete.cpp
src/ripple/rpc/handlers/CFTHolders.cpp
src/ripple/rpc/handlers/MPTHolders.cpp
src/ripple/rpc/handlers/Connect.cpp
src/ripple/rpc/handlers/ConsensusInfo.cpp
src/ripple/rpc/handlers/CrawlShards.cpp
Expand Down Expand Up @@ -738,7 +738,7 @@ target_sources (rippled PRIVATE
src/ripple/rpc/handlers/ValidatorListSites.cpp
src/ripple/rpc/handlers/Validators.cpp
src/ripple/rpc/handlers/WalletPropose.cpp
src/ripple/rpc/impl/CFTokenIssuanceID.cpp
src/ripple/rpc/impl/MPTokenIssuanceID.cpp
src/ripple/rpc/impl/DeliveredAmount.cpp
src/ripple/rpc/impl/Handler.cpp
src/ripple/rpc/impl/LegacyPathFind.cpp
Expand Down Expand Up @@ -788,7 +788,7 @@ if (tests)
src/test/app/AMM_test.cpp
src/test/app/AMMCalc_test.cpp
src/test/app/AMMExtended_test.cpp
src/test/app/CFToken_test.cpp
src/test/app/MPToken_test.cpp
src/test/app/Check_test.cpp
src/test/app/Clawback_test.cpp
src/test/app/CrossingLimits_test.cpp
Expand Down Expand Up @@ -937,7 +937,7 @@ if (tests)
src/test/jtx/impl/Account.cpp
src/test/jtx/impl/AMM.cpp
src/test/jtx/impl/AMMTest.cpp
src/test/jtx/impl/cft.cpp
src/test/jtx/impl/mpt.cpp
src/test/jtx/impl/Env.cpp
src/test/jtx/impl/JSONRPCClient.cpp
src/test/jtx/impl/TestHelpers.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/app/ledger/OrderBookDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ OrderBookDB::update(std::shared_ptr<ReadView const> const& ledger)
sle->getFieldH256(sfRootIndex) == sle->key())
{
Book book;
// TODO update for CFT once supported in the offers
// TODO update for MPT once supported in the offers
Currency currency;
AccountID account;
currency = static_cast<Currency>(
Expand Down
10 changes: 5 additions & 5 deletions src/ripple/app/ledger/impl/LedgerToJson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <ripple/rpc/Context.h>
#include <ripple/rpc/DeliveredAmount.h>
#include <ripple/rpc/impl/RPCHelpers.h>
#include <ripple/rpc/CFTokenIssuanceID.h>
#include <ripple/rpc/MPTokenIssuanceID.h>

namespace ripple {

Expand Down Expand Up @@ -159,8 +159,8 @@ fillJsonTx(
txn,
{txn->getTransactionID(), fill.ledger.seq(), *stMeta});

// If applicable, insert cft issuance id
RPC::insertCFTokenIssuanceID(
// If applicable, insert mpt issuance id
RPC::insertMPTokenIssuanceID(
txJson[jss::meta],
txn,
{txn->getTransactionID(), fill.ledger.seq(), *stMeta});
Expand Down Expand Up @@ -198,8 +198,8 @@ fillJsonTx(
txn,
{txn->getTransactionID(), fill.ledger.seq(), *stMeta});

// If applicable, insert cft issuance id
RPC::insertCFTokenIssuanceID(
// If applicable, insert mpt issuance id
RPC::insertMPTokenIssuanceID(
txJson[jss::metaData],
txn,
{txn->getTransactionID(), fill.ledger.seq(), *stMeta});
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/misc/NetworkOPs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#include <ripple/rpc/impl/RPCHelpers.h>
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/steady_timer.hpp>
#include <ripple/rpc/CFTokenIssuanceID.h>
#include <ripple/rpc/MPTokenIssuanceID.h>

#include <algorithm>
#include <mutex>
Expand Down Expand Up @@ -3118,7 +3118,7 @@ NetworkOPsImp::transJson(
jvObj[jss::meta] = meta->get().getJson(JsonOptions::none);
RPC::insertDeliveredAmount(
jvObj[jss::meta], *ledger, transaction, meta->get());
RPC::insertCFTokenIssuanceID(
RPC::insertMPTokenIssuanceID(
jvObj[jss::meta], transaction, meta->get());
}

Expand Down
64 changes: 32 additions & 32 deletions src/ripple/app/paths/impl/AmountSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef RIPPLE_PATH_IMPL_AMOUNTSPEC_H_INCLUDED
#define RIPPLE_PATH_IMPL_AMOUNTSPEC_H_INCLUDED

#include <ripple/basics/CFTAmount.h>
#include <ripple/basics/MPTAmount.h>
#include <ripple/basics/IOUAmount.h>
#include <ripple/basics/XRPAmount.h>
#include <ripple/protocol/STAmount.h>
Expand All @@ -34,10 +34,10 @@ struct AmountSpec
explicit AmountSpec() = default;

bool native;
bool is_cft;
bool is_mpt;
union
{
CFTAmount cft;
MPTAmount mpt;
XRPAmount xrp;
IOUAmount iou = {};
};
Expand All @@ -47,8 +47,8 @@ struct AmountSpec
friend std::ostream&
operator<<(std::ostream& stream, AmountSpec const& amt)
{
if (amt.is_cft)
stream << to_string(amt.cft);
if (amt.is_mpt)
stream << to_string(amt.mpt);
else if (amt.native)
stream << to_string(amt.xrp);
else
Expand All @@ -65,14 +65,14 @@ struct EitherAmount
{
#ifndef NDEBUG
bool native = false;
bool is_cft = false;
bool is_mpt = false;
#endif

union
{
IOUAmount iou = {};
XRPAmount xrp;
CFTAmount cft;
MPTAmount mpt;
};

EitherAmount() = default;
Expand All @@ -96,21 +96,21 @@ struct EitherAmount
#pragma GCC diagnostic pop
#endif

explicit EitherAmount(CFTAmount const& a) : cft(a)
explicit EitherAmount(MPTAmount const& a) : mpt(a)
{
#ifndef NDEBUG
is_cft = true;
is_mpt = true;
#endif
}

explicit EitherAmount(AmountSpec const& a)
{
#ifndef NDEBUG
native = a.native;
is_cft = a.is_cft;
is_mpt = a.is_mpt;
#endif
if (a.is_cft)
cft = a.cft;
if (a.is_mpt)
mpt = a.mpt;
else if (a.native)
xrp = a.xrp;
else
Expand All @@ -121,8 +121,8 @@ struct EitherAmount
friend std::ostream&
operator<<(std::ostream& stream, EitherAmount const& amt)
{
if (amt.is_cft)
stream << to_string(amt.cft);
if (amt.is_mpt)
stream << to_string(amt.mpt);
else if (amt.native)
stream << to_string(amt.xrp);
else
Expand All @@ -144,24 +144,24 @@ template <>
inline IOUAmount&
get<IOUAmount>(EitherAmount& amt)
{
assert(!amt.native && !amt.is_cft);
assert(!amt.native && !amt.is_mpt);
return amt.iou;
}

template <>
inline XRPAmount&
get<XRPAmount>(EitherAmount& amt)
{
assert(amt.native && !amt.is_cft);
assert(amt.native && !amt.is_mpt);
return amt.xrp;
}

template <>
inline CFTAmount&
get<CFTAmount>(EitherAmount& amt)
inline MPTAmount&
get<MPTAmount>(EitherAmount& amt)
{
assert(amt.is_cft && !amt.native);
return amt.cft;
assert(amt.is_mpt && !amt.native);
return amt.mpt;
}

template <class T>
Expand All @@ -176,24 +176,24 @@ template <>
inline IOUAmount const&
get<IOUAmount>(EitherAmount const& amt)
{
assert(!amt.native && !amt.is_cft);
assert(!amt.native && !amt.is_mpt);
return amt.iou;
}

template <>
inline XRPAmount const&
get<XRPAmount>(EitherAmount const& amt)
{
assert(amt.native && !amt.is_cft);
assert(amt.native && !amt.is_mpt);
return amt.xrp;
}

template <>
inline CFTAmount const&
get<CFTAmount>(EitherAmount const& amt)
inline MPTAmount const&
get<MPTAmount>(EitherAmount const& amt)
{
assert(amt.is_cft && !amt.native);
return amt.cft;
assert(amt.is_mpt && !amt.native);
return amt.mpt;
}

inline AmountSpec
Expand All @@ -212,8 +212,8 @@ toAmountSpec(STAmount const& amt)
}
else
{
if (amt.isCFT())
result.cft = CFTAmount(sMant);
if (amt.isMPT())
result.mpt = MPTAmount(sMant);
else
result.iou = IOUAmount(sMant, amt.exponent());
result.issuer = amt.issue().account();
Expand All @@ -228,8 +228,8 @@ toEitherAmount(STAmount const& amt)
{
if (isXRP(amt))
return EitherAmount{amt.xrp()};
else if (amt.isCFT())
return EitherAmount{amt.cft()};
else if (amt.isMPT())
return EitherAmount{amt.mpt()};
return EitherAmount{amt.iou()};
}

Expand All @@ -240,9 +240,9 @@ toAmountSpec(EitherAmount const& ea, std::optional<Asset> const& a)
r.native = (!a || isXRP(*a));
r.currency = a;
assert(ea.native == r.native);
if (r.is_cft)
if (r.is_mpt)
{
r.cft = ea.cft;
r.mpt = ea.mpt;
}
else if (r.native)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/app/tx/impl/CreateOffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel)
bool const bookExisted = static_cast<bool>(sb.peek(dir));

auto const bookNode = sb.dirAppend(dir, offer_index, [&](SLE::ref sle) {
// TODO add CFT once offers are supported for CFT
// TODO add MPT once offers are supported for MPT
sle->setFieldH160(
sfTakerPaysCurrency,
static_cast<Currency>(saTakerPays.issue().asset()));
Expand Down
Loading

0 comments on commit ed90cdd

Please sign in to comment.