From 9b525c73c92c481bc767f05ca063b9b9ab1363b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Ro=C4=8Dek?= Date: Tue, 7 Nov 2023 13:03:06 +0100 Subject: [PATCH] BATM-4385: six decimal places for USDT on Binance exchange --- gradle.properties | 2 +- gradle/verification-metadata.xml | 50 ++++++++++--------- .../exchanges/binance/BinanceExchange.java | 11 +++- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2479bf09e..591f6bfd6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # buildscript - project id projectGroup=com.generalbytes.batm.public -projectVersion=1.2.0 +projectVersion=1.2.1 # buildscript - common dependency versions bitrafaelVersion=1.0.44 diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 068423da7..b437247e2 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -36,9 +36,9 @@ - - - + + + @@ -74,11 +74,6 @@ - - - - - @@ -103,6 +98,11 @@ + + + + + @@ -111,11 +111,6 @@ - - - - - @@ -124,15 +119,10 @@ - - - - - - - - - + + + + @@ -142,6 +132,16 @@ + + + + + + + + + + @@ -1132,7 +1132,9 @@ - + + + @@ -1655,7 +1657,7 @@ - + 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"));