diff --git a/src/Amount.cpp b/src/Amount.cpp index 0edb6bd448..9e78907a7d 100644 --- a/src/Amount.cpp +++ b/src/Amount.cpp @@ -312,3 +312,13 @@ STAmount getNeeded(const STAmount& offerOut, const STAmount& offerIn, const STAm STAmount ret = (needed * offerIn) / offerOut; return (ret > offerIn) ? offerIn : ret; } + +STAmount convertToDisplayAmount(const STAmount& internalAmount, const STAmount& totalNow, const STAmount& totalInit) +{ // Convert an internal ledger/account quantity of native currency to a display amount + return (internalAmount * totalInit) / totalNow; +} + +STAmount convertToInternalAmount(const STAmount& displayAmount, const STAmount& totalNow, const STAmount& totalInit) +{ // Convert a display/request currency amount to an internal amount + return (displayAmount * totalNow) / totalInit; +}