7#ifndef BITCOIN_CONSENSUS_AMOUNT_H
8#define BITCOIN_CONSENSUS_AMOUNT_H
51 return a.amount ==
b.amount;
61 return a.amount <
b.amount;
134 return stream <<
ca.amount;
bool MoneyRange(const Amount nValue)
static constexpr Amount SATOSHI
static constexpr Amount MAX_MONEY
No amount larger than this (in satoshi) is valid.
static constexpr Amount COIN
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Amount & operator/=(const int64_t n)
friend constexpr bool operator>=(const Amount a, const Amount b)
constexpr Amount operator%(const double b) const =delete
friend constexpr bool operator<(const Amount a, const Amount b)
Comparison.
SERIALIZE_METHODS(Amount, obj)
static constexpr Amount zero() noexcept
constexpr Amount operator%(const int64_t b) const
friend constexpr Amount operator*(const double a, const Amount b)=delete
Do not implement double ops to get an error with double and ensure casting to integer is explicit.
constexpr int64_t operator/(const Amount b) const
Division.
friend constexpr bool operator!=(const Amount a, const Amount b)
friend constexpr bool operator>(const Amount a, const Amount b)
friend std::ostream & operator<<(std::ostream &stream, const Amount &ca)
constexpr Amount operator/(const double b) const =delete
Amount & operator-=(const Amount a)
friend constexpr Amount operator-(const Amount a, const Amount b)
friend constexpr Amount operator+(const Amount a, const Amount b)
Addition and subtraction.
constexpr Amount operator-() const
Unary minus.
constexpr Amount operator/(const int64_t b) const
Amount & operator+=(const Amount a)
Implement standard operators.
constexpr Amount operator%(const Amount b) const
Modulus.
friend constexpr Amount operator*(const int a, const Amount b)
constexpr Amount() noexcept
std::string ToString() const
constexpr Amount operator%(const int b) const
constexpr Amount(int64_t _amount)
static constexpr Amount satoshi() noexcept
constexpr Amount operator/(const int b) const
friend constexpr Amount operator*(const int64_t a, const Amount b)
Multiplication.
friend constexpr bool operator<=(const Amount a, const Amount b)
friend constexpr bool operator==(const Amount a, const Amount b)
Equality.
static const Currency & get()