]> Git Repo - VerusCoin.git/blame - src/amount.cpp
Merge pull request #128 from miketout/dev
[VerusCoin.git] / src / amount.cpp
CommitLineData
eda37330 1// Copyright (c) 2009-2010 Satoshi Nakamoto
f914f1a7 2// Copyright (c) 2009-2014 The Bitcoin Core developers
eda37330 3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#include "amount.h"
7
8#include "tinyformat.h"
9
a7322d77 10const std::string CURRENCY_UNIT = "KMD";
091b2116 11
eda37330 12CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
13{
14 if (nSize > 0)
15 nSatoshisPerK = nFeePaid*1000/nSize;
16 else
17 nSatoshisPerK = 0;
18}
19
20CAmount CFeeRate::GetFee(size_t nSize) const
21{
22 CAmount nFee = nSatoshisPerK*nSize / 1000;
23
24 if (nFee == 0 && nSatoshisPerK > 0)
25 nFee = nSatoshisPerK;
26
27 return nFee;
28}
29
30std::string CFeeRate::ToString() const
31{
091b2116 32 return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);
eda37330 33}
This page took 0.099143 seconds and 4 git commands to generate.