Dash Core
0.12.2.1
P2P Digital Currency
amount.cpp
Go to the documentation of this file.
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-2015 The Bitcoin Core developers
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
10
const
std::string
CURRENCY_UNIT
=
"DASH"
;
11
12
CFeeRate::CFeeRate
(
const
CAmount
& nFeePaid,
size_t
nSize)
13
{
14
if
(nSize > 0)
15
nSatoshisPerK
= nFeePaid*1000/nSize;
16
else
17
nSatoshisPerK
= 0;
18
}
19
20
CAmount
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
30
std::string
CFeeRate::ToString
()
const
31
{
32
return
strprintf
(
"%d.%08d %s/kB"
,
nSatoshisPerK
/
COIN
,
nSatoshisPerK
%
COIN
,
CURRENCY_UNIT
);
33
}
strprintf
#define strprintf
Definition:
tinyformat.h:1011
COIN
static const CAmount COIN
Definition:
amount.h:16
CURRENCY_UNIT
const std::string CURRENCY_UNIT
Definition:
amount.cpp:10
CFeeRate::GetFee
CAmount GetFee(size_t size) const
Definition:
amount.cpp:20
CAmount
int64_t CAmount
Definition:
amount.h:14
CFeeRate::nSatoshisPerK
CAmount nSatoshisPerK
Definition:
amount.h:39
CFeeRate::ToString
std::string ToString() const
Definition:
amount.cpp:30
CFeeRate::CFeeRate
CFeeRate()
Definition:
amount.h:41
tinyformat.h
amount.h
src
amount.cpp
Generated on Thu Dec 14 2017 13:15:02 for Dash Core by
1.8.14