Skip to content

Commit

Permalink
Make currency/account private in Issue and add getters/setters.
Browse files Browse the repository at this point in the history
Change Issue to IOUIssue
Change Asset to Issue
issueFromJson/assetFromJson refactoring
Update ifdef
  • Loading branch information
gregtatcam committed Jan 2, 2025
1 parent 4dfb617 commit fff9be7
Show file tree
Hide file tree
Showing 140 changed files with 2,051 additions and 1,728 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---
<!-- Please search existing issues to avoid creating duplicates.-->

## Issue Description
## IOUIssue Description
<!--Provide a summary for your issue/bug.-->

## Steps to Reproduce
Expand Down
2 changes: 1 addition & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ On supported platforms, see the [instructions on installing or updating `rippled

### Code Cleanup and Testing

* Replace compare() with the three-way comparison operator in base_uint, Issue and Book by @drlongle in https://github.com/XRPLF/rippled/pull/4411
* Replace compare() with the three-way comparison operator in base_uint, IOUIssue and Book by @drlongle in https://github.com/XRPLF/rippled/pull/4411
* Rectify the import paths of boost::function_output_iterator by @ckeshava in https://github.com/XRPLF/rippled/pull/4293
* Expand Linux test matrix by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4454
* Add patched recipe for SOCI by @thejohnfreeman in https://github.com/XRPLF/rippled/pull/4510
Expand Down
3 changes: 2 additions & 1 deletion cmake/RippledCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ target_link_libraries(xrpl.libxrpl
)

if(xrpld)
add_executable(rippled)
add_executable(rippled
../include/xrpl/protocol/Issue.h)
if(unity)
set_target_properties(rippled PROPERTIES UNITY_BUILD ON)
endif()
Expand Down
6 changes: 3 additions & 3 deletions include/xrpl/basics/Resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class Resolver

virtual ~Resolver() = 0;

/** Issue an asynchronous stop request. */
/** IOUIssue an asynchronous stop request. */
virtual void
stop_async() = 0;

/** Issue a synchronous stop request. */
/** IOUIssue a synchronous stop request. */
virtual void
stop() = 0;

/** Issue a synchronous start request. */
/** IOUIssue a synchronous start request. */
virtual void
start() = 0;

Expand Down
24 changes: 12 additions & 12 deletions include/xrpl/protocol/AMMCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <xrpl/basics/Number.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Asset.h>
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/UintTypes.h>

Expand Down Expand Up @@ -59,14 +59,14 @@ ammAccountID(
/** Calculate Liquidity Provider Token (LPT) Currency.
*/
Currency
ammLPTCurrency(Asset const& asset1, Asset const& asset2);
ammLPTCurrency(Issue const& asset1, Issue const& asset2);

/** Calculate LPT Issue from AMM asset pair.
/** Calculate LPT IOUIssue from AMM asset pair.
*/
Issue
IOUIssue
ammLPTIssue(
Asset const& asset1,
Asset const& asset2,
Issue const& asset1,
Issue const& asset2,
AccountID const& ammAccountID);

/** Validate the amount.
Expand All @@ -77,19 +77,19 @@ ammLPTIssue(
NotTEC
invalidAMMAmount(
STAmount const& amount,
std::optional<std::pair<Asset, Asset>> const& pair = std::nullopt,
std::optional<std::pair<Issue, Issue>> const& pair = std::nullopt,
bool validZero = false);

NotTEC
invalidAMMAsset(
Asset const& issue,
std::optional<std::pair<Asset, Asset>> const& pair = std::nullopt);
Issue const& issue,
std::optional<std::pair<Issue, Issue>> const& pair = std::nullopt);

NotTEC
invalidAMMAssetPair(
Asset const& issue1,
Asset const& issue2,
std::optional<std::pair<Asset, Asset>> const& pair = std::nullopt);
Issue const& issue1,
Issue const& issue2,
std::optional<std::pair<Issue, Issue>> const& pair = std::nullopt);

/** Get time slot of the auction slot.
*/
Expand Down
18 changes: 9 additions & 9 deletions include/xrpl/protocol/AmountConversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
namespace ripple {

inline STAmount
toSTAmount(IOUAmount const& iou, Asset const& asset)
toSTAmount(IOUAmount const& iou, Issue const& asset)
{
XRPL_ASSERT(asset.holds<Issue>(), "ripple::toSTAmount : is Issue");
XRPL_ASSERT(asset.holds<IOUIssue>(), "ripple::toSTAmount : is Issue");
bool const isNeg = iou.signum() < 0;
std::uint64_t const umant = isNeg ? -iou.mantissa() : iou.mantissa();
return STAmount(asset, umant, iou.exponent(), isNeg, STAmount::unchecked());
Expand All @@ -53,7 +53,7 @@ toSTAmount(XRPAmount const& xrp)
}

inline STAmount
toSTAmount(XRPAmount const& xrp, Asset const& asset)
toSTAmount(XRPAmount const& xrp, Issue const& asset)
{
XRPL_ASSERT(isXRP(asset), "ripple::toSTAmount : is XRP");
return toSTAmount(xrp);
Expand All @@ -66,7 +66,7 @@ toSTAmount(MPTAmount const& mpt)
}

inline STAmount
toSTAmount(MPTAmount const& mpt, Asset const& asset)
toSTAmount(MPTAmount const& mpt, Issue const& asset)
{
XRPL_ASSERT(asset.holds<MPTIssue>(), "ripple::toSTAmount : is MPT");
return STAmount(mpt, asset.get<MPTIssue>());
Expand Down Expand Up @@ -163,7 +163,7 @@ toAmount<MPTAmount>(MPTAmount const& amt)
template <typename T>
T
toAmount(
Asset const& asset,
Issue const& asset,
Number const& n,
Number::rounding_mode mode = Number::getround())
{
Expand Down Expand Up @@ -192,7 +192,7 @@ toAmount(

template <typename T>
T
toMaxAmount(Asset const& asset)
toMaxAmount(Issue const& asset)
{
if constexpr (std::is_same_v<IOUAmount, T>)
return IOUAmount(STAmount::cMaxValue, STAmount::cMaxOffset);
Expand All @@ -204,7 +204,7 @@ toMaxAmount(Asset const& asset)
{
return std::visit(
[]<ValidIssueType TIss>(TIss const& issue_) {
if constexpr (std::is_same_v<TIss, Issue>)
if constexpr (std::is_same_v<TIss, IOUIssue>)
{
if (isXRP(issue_))
return STAmount(
Expand All @@ -227,15 +227,15 @@ toMaxAmount(Asset const& asset)

inline STAmount
toSTAmount(
Asset const& asset,
Issue const& asset,
Number const& n,
Number::rounding_mode mode = Number::getround())
{
return toAmount<STAmount>(asset, n, mode);
}

template <typename T>
Asset
Issue
getAsset(T const& amt)
{
if constexpr (std::is_same_v<IOUAmount, T>)
Expand Down
Loading

0 comments on commit fff9be7

Please sign in to comment.