1#ifndef XRPL_PROTOCOL_RATE_H_INCLUDED
2#define XRPL_PROTOCOL_RATE_H_INCLUDED
4#include <xrpl/beast/utility/instrumentation.h>
5#include <xrpl/protocol/STAmount.h>
7#include <boost/operators.hpp>
20struct Rate :
private boost::totally_ordered<Rate>
34 return lhs.value == rhs.value;
40 return lhs.value < rhs.value;
51multiply(STAmount
const& amount, Rate
const& rate);
54multiplyRound(STAmount
const& amount, Rate
const& rate,
bool roundUp);
58 STAmount
const& amount,
64divide(STAmount
const& amount, Rate
const& rate);
67divideRound(STAmount
const& amount, Rate
const& rate,
bool roundUp);
71 STAmount
const& amount,
Rate transferFeeAsRate(std::uint16_t fee)
Given a transfer fee (in basis points) convert it to a transfer rate.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
STAmount divide(STAmount const &amount, Rate const &rate)
STAmount multiply(STAmount const &amount, Rate const &rate)
std::ostream & operator<<(std::ostream &out, base_uint< Bits, Tag > const &u)
STAmount divideRound(STAmount const &amount, Rate const &rate, bool roundUp)
bool operator<(Slice const &lhs, Slice const &rhs) noexcept
STAmount multiplyRound(STAmount const &amount, Rate const &rate, bool roundUp)
constexpr bool operator==(base_uint< Bits, Tag > const &lhs, base_uint< Bits, Tag > const &rhs)
Rate const parityRate
A transfer rate signifying a 1:1 exchange.
Represents a transfer rate.