/ src / util / moneystr.h
moneystr.h
 1  // Copyright (c) 2009-2010 Satoshi Nakamoto
 2  // Copyright (c) 2009-2022 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  /**
 7   * Money parsing/formatting utilities.
 8   */
 9  #ifndef BITCOIN_UTIL_MONEYSTR_H
10  #define BITCOIN_UTIL_MONEYSTR_H
11  
12  #include <consensus/amount.h>
13  
14  #include <optional>
15  #include <string>
16  
17  /* Do not use these functions to represent or parse monetary amounts to or from
18   * JSON but use AmountFromValue and ValueFromAmount for that.
19   */
20  std::string FormatMoney(const CAmount n);
21  /** Parse an amount denoted in full coins. E.g. "0.0034" supplied on the command line. **/
22  std::optional<CAmount> ParseMoney(const std::string& str);
23  
24  #endif // BITCOIN_UTIL_MONEYSTR_H