MCPcopy
hub / github.com/bisq-network/bisq / parseAltcoin

Method parseAltcoin

core/src/main/java/bisq/core/monetary/Altcoin.java:91–100  ·  view source on GitHub ↗

Parses an amount expressed in the way humans are used to. This takes string in a format understood by BigDecimal#BigDecimal(String), for example "0", "1", "0.10", "1.23E3", "1234.5E-5". @throws IllegalArgumentException if you try to specify fractional satoshis, or a value out of r

(final String currencyCode, String input)

Source from the content-addressed store, hash-verified

89 * @throws IllegalArgumentException if you try to specify fractional satoshis, or a value out of range.
90 */
91 public static Altcoin parseAltcoin(final String currencyCode, String input) {
92 String cleaned = ParsingUtils.convertCharsForNumber(input);
93 try {
94 long val = new BigDecimal(cleaned).movePointRight(SMALLEST_UNIT_EXPONENT)
95 .toBigIntegerExact().longValue();
96 return Altcoin.valueOf(currencyCode, val);
97 } catch (ArithmeticException e) {
98 throw new IllegalArgumentException(e);
99 }
100 }
101
102 public Altcoin add(final Altcoin value) {
103 checkArgument(value.currencyCode.equals(currencyCode));

Callers 4

VolumeMakerClass · 0.95
PriceMakerClass · 0.95
parseMethod · 0.95
parseMethod · 0.95

Calls 2

convertCharsForNumberMethod · 0.95
valueOfMethod · 0.95

Tested by

no test coverage detected