Skip to content

Commit

Permalink
BATM-4385: six decimal places for USDT on Binance exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
drocek committed Nov 7, 2023
1 parent 620f92a commit 9b525c7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
50 changes: 26 additions & 24 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
</artifact>
</component>
<component group="com.fasterxml.jackson" name="jackson-base" version="2.12.0">
<artifact name="jackson-base-2.12.0.pom">
<sha256 value="145cf8abce581cec4993f90175ef2eb8edc465a5c2100b5a637ed7bbd1da53e5" origin="Generated by Gradle"/>
</artifact>
<artifact name="jackson-base-2.12.0.pom">
<sha256 value="145cf8abce581cec4993f90175ef2eb8edc465a5c2100b5a637ed7bbd1da53e5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson" name="jackson-bom" version="2.12.0">
<artifact name="jackson-bom-2.12.0.pom">
Expand Down Expand Up @@ -74,11 +74,6 @@
<sha256 value="35ba920affa5b6c330d5845fc8e59c851bf7e7968d55a4ea7cd44de79081d5cd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.datatype" name="jackson-datatypes-collections" version="2.12.0">
<artifact name="jackson-datatypes-collections-2.12.0.pom">
<sha256 value="8b7775f572a36a27a56803545733f31f42f88e6e7411a8da3c7fda3d3d705c7e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.datatype" name="jackson-datatype-guava" version="2.12.0">
<artifact name="jackson-datatype-guava-2.12.0.jar">
<sha256 value="484a53b30466d3eb2ac95de3e3fd1e6c060e1629f907140fa1aeadd153caee2b" origin="Generated by Gradle"/>
Expand All @@ -103,6 +98,11 @@
<sha256 value="0e86803f0aad2794010de92a995af8d1c4a43b002e56f5859fdb08dd6bfb7e4d" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.datatype" name="jackson-datatypes-collections" version="2.12.0">
<artifact name="jackson-datatypes-collections-2.12.0.pom">
<sha256 value="8b7775f572a36a27a56803545733f31f42f88e6e7411a8da3c7fda3d3d705c7e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-base" version="2.12.0">
<artifact name="jackson-jaxrs-base-2.12.0.jar">
<sha256 value="9f524c13234447cf4ccb2708dfb8337fb6bacb918307047ca7aa9f226d6e8e5f" origin="Generated by Gradle"/>
Expand All @@ -111,11 +111,6 @@
<sha256 value="f46df1094708f5f3ce3d2f1262cc745f100d160ecc3b8051bf0f7f21ff2504dd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-providers" version="2.12.0">
<artifact name="jackson-jaxrs-providers-2.12.0.pom">
<sha256 value="dea16d396006d10877bc35e2a0a09c5363b823e4128da357c6618569678f3fb2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-json-provider" version="2.12.0">
<artifact name="jackson-jaxrs-json-provider-2.12.0.jar">
<sha256 value="7bcf0f909304403ff08f2373a0a1ebe0a80d4db5d0e702ed388074a3887d23e1" origin="Generated by Gradle"/>
Expand All @@ -124,15 +119,10 @@
<sha256 value="4b25e14c6bd710fccb87dab5c648966b2f1457feee3d26ce284fb8667095b605" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-modules-base" version="2.12.0">
<artifact name="jackson-modules-base-2.12.0.pom">
<sha256 value="5e3e8b4568b4d058e5d1f8e68eb0e190541a3d8a8537dfc45f1a7af40f91e057" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-modules-java8" version="2.12.0">
<artifact name="jackson-modules-java8-2.12.0.pom">
<sha256 value="f4473079941288f100f4ad38effadf34cb76229cc73728492c8b7bd2bc0b179e" origin="Generated by Gradle"/>
</artifact>
<component group="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-providers" version="2.12.0">
<artifact name="jackson-jaxrs-providers-2.12.0.pom">
<sha256 value="dea16d396006d10877bc35e2a0a09c5363b823e4128da357c6618569678f3fb2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-module-jaxb-annotations" version="2.12.0">
<artifact name="jackson-module-jaxb-annotations-2.12.0.jar">
Expand All @@ -142,6 +132,16 @@
<sha256 value="89552c18387b668300555fec92f4d9adbffe3047b4b51ca706055598c427ba42" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-modules-base" version="2.12.0">
<artifact name="jackson-modules-base-2.12.0.pom">
<sha256 value="5e3e8b4568b4d058e5d1f8e68eb0e190541a3d8a8537dfc45f1a7af40f91e057" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.fasterxml.jackson.module" name="jackson-modules-java8" version="2.12.0">
<artifact name="jackson-modules-java8-2.12.0.pom">
<sha256 value="f4473079941288f100f4ad38effadf34cb76229cc73728492c8b7bd2bc0b179e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.generalbytes.bitrafael.public" name="bitrafael-client" version="1.0.44">
<artifact name="bitrafael-client-1.0.44.jar">
<sha256 value="1449595b744ea24a32a15220d8abf8aa55249c1f45c27b311a2e031428842385" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -1132,7 +1132,9 @@
</component>
<component group="net.java" name="jvnet-parent" version="1">
<artifact name="jvnet-parent-1.pom">
<sha256 value="281440811268e65d9e266b3cc898297e214e04f09740d0386ceeb4a8923d63bf" origin="Generated by Gradle"/>
<sha256 value="281440811268e65d9e266b3cc898297e214e04f09740d0386ceeb4a8923d63bf" origin="Generated by Gradle">
<also-trust value="5b936f6757872c1b901cb821001652eda746e3b6cffef9c434443534a96bfc9a"/>
</sha256>
</artifact>
</component>
<component group="net.java" name="jvnet-parent" version="3">
Expand Down Expand Up @@ -1655,7 +1657,7 @@
</component>
<component group="org.junit" name="junit-bom" version="5.7.1">
<artifact name="junit-bom-5.7.1.module">
<sha256 value="9854e3894d64b2485207e0046bca07b3d42d169e782f4fa8c9ce229a78faee04" origin="Generated by Gradle"/>
<sha256 value="9854e3894d64b2485207e0046bca07b3d42d169e782f4fa8c9ce229a78faee04" origin="Generated by Gradle"/>
</artifact>
<artifact name="junit-bom-5.7.1.pom">
<sha256 value="0b9b14a3d62106fafe8c68a717b87b87ad18685899451b753c04fa41b6857784" origin="Generated by Gradle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
************************************************************************************/
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;
import org.knowm.xchange.dto.account.AccountInfo;
import org.knowm.xchange.dto.account.Wallet;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -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);
}

Expand All @@ -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"));
Expand Down

0 comments on commit 9b525c7

Please sign in to comment.