mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 10:35:50 +00:00
Introduce MPT support (XLS-33d): (#5143)
Amendment: - MPTokensV1 New Transactions: - MPTokenIssuanceCreate - MPTokenIssuanceDestroy - MPTokenIssuanceSet - MPTokenAuthorize Modified Transactions: - Payment - Clawback New Objects: - MPTokenIssuance - MPToken API updates: - ledger_entry - account_objects - ledger_data Other: - Add += and -= operators to ValueProxy Read full spec: https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0033d-multi-purpose-tokens --------- Co-authored-by: Shawn Xie <shawnxie920@gmail.com> Co-authored-by: Howard Hinnant <howard.hinnant@gmail.com> Co-authored-by: Ed Hennis <ed@ripple.com> Co-authored-by: John Freeman <jfreeman08@gmail.com>
This commit is contained in:
committed by
GitHub
parent
63209c2646
commit
23c37fa506
@@ -20,6 +20,7 @@
|
||||
#ifndef RIPPLE_BASICS_NUMBER_H_INCLUDED
|
||||
#define RIPPLE_BASICS_NUMBER_H_INCLUDED
|
||||
|
||||
#include <xrpl/basics/MPTAmount.h>
|
||||
#include <xrpl/basics/XRPAmount.h>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
@@ -52,6 +53,7 @@ public:
|
||||
explicit constexpr Number(rep mantissa, int exponent, unchecked) noexcept;
|
||||
|
||||
Number(XRPAmount const& x);
|
||||
Number(MPTAmount const& x);
|
||||
|
||||
constexpr rep
|
||||
mantissa() const noexcept;
|
||||
@@ -88,9 +90,16 @@ public:
|
||||
static constexpr Number
|
||||
lowest() noexcept;
|
||||
|
||||
/** Conversions to Number are implicit and conversions away from Number
|
||||
* are explicit. This design encourages and facilitates the use of Number
|
||||
* as the preferred type for floating point arithmetic as it makes
|
||||
* "mixed mode" more convenient, e.g. MPTAmount + Number.
|
||||
*/
|
||||
explicit
|
||||
operator XRPAmount() const; // round to nearest, even on tie
|
||||
explicit
|
||||
operator MPTAmount() const; // round to nearest, even on tie
|
||||
explicit
|
||||
operator rep() const; // round to nearest, even on tie
|
||||
|
||||
friend constexpr bool
|
||||
@@ -212,6 +221,10 @@ inline Number::Number(XRPAmount const& x) : Number{x.drops()}
|
||||
{
|
||||
}
|
||||
|
||||
inline Number::Number(MPTAmount const& x) : Number{x.value()}
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Number::rep
|
||||
Number::mantissa() const noexcept
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user