diff --git a/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/bitcoin/exchanges/binance/BinanceExchange.java b/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/bitcoin/exchanges/binance/BinanceExchange.java index ff2b8c0f0..0f5cf602e 100644 --- a/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/bitcoin/exchanges/binance/BinanceExchange.java +++ b/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/bitcoin/exchanges/binance/BinanceExchange.java @@ -17,6 +17,7 @@ ************************************************************************************/ package com.generalbytes.batm.server.extensions.extra.bitcoin.exchanges.binance; +import com.generalbytes.batm.common.currencies.CryptoCurrency; import com.generalbytes.batm.server.extensions.extra.bitcoin.exchanges.XChangeExchange; import org.knowm.xchange.ExchangeSpecification; import org.knowm.xchange.currency.CurrencyPair; @@ -24,6 +25,7 @@ import org.knowm.xchange.dto.account.Wallet; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Set; import java.util.stream.Collectors; @@ -91,6 +93,11 @@ protected BigDecimal getAmountRoundedToMinStep(BigDecimal cryptoAmount, BigDecim public String sendCoins(String destinationAddress, BigDecimal amount, String cryptoCurrency, String description) { BigDecimal withdrawalFee = getWithdrawalFee(cryptoCurrency); amount = amount.add(withdrawalFee); + + if (CryptoCurrency.USDT.getCode().equals(cryptoCurrency)) { + amount = amount.setScale(6, RoundingMode.FLOOR); + } + return super.sendCoins(destinationAddress, amount, cryptoCurrency, description); } @@ -110,8 +117,8 @@ protected BigDecimal getWithdrawalMinStep(String cryptoCurrency) { } protected static class SupportedCryptoCurrency { - private String cryptoCurrency; - private BigDecimal withdrawalMinStep; + private final String cryptoCurrency; + private final BigDecimal withdrawalMinStep; public SupportedCryptoCurrency(String cryptoCurrency) { this(cryptoCurrency, new BigDecimal("0.00000001"));