| 281 | } |
| 282 | |
| 283 | UniValue ValueFromAmount(const CAmount amount) |
| 284 | { |
| 285 | static_assert(COIN > 1); |
| 286 | int64_t quotient = amount / COIN; |
| 287 | int64_t remainder = amount % COIN; |
| 288 | if (amount < 0) { |
| 289 | quotient = -quotient; |
| 290 | remainder = -remainder; |
| 291 | } |
| 292 | return UniValue(UniValue::VNUM, |
| 293 | strprintf("%s%d.%08d", amount < 0 ? "-" : "", quotient, remainder)); |
| 294 | } |
| 295 | |
| 296 | std::string FormatScript(const CScript& script) |
| 297 | { |