mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 19:49:32 +00:00
replace BigInteger.valueOf(0) with BigInteger.ZERO
This commit is contained in:
parent
cd89b8bf15
commit
3730773006
34 changed files with 81 additions and 81 deletions
|
@ -218,12 +218,12 @@ public class CoreDisputesService {
|
||||||
disputeResult.setSellerPayoutAmountBeforeCost(sellerSecurityDeposit);
|
disputeResult.setSellerPayoutAmountBeforeCost(sellerSecurityDeposit);
|
||||||
} else if (payout == DisputePayout.BUYER_GETS_ALL) {
|
} else if (payout == DisputePayout.BUYER_GETS_ALL) {
|
||||||
disputeResult.setBuyerPayoutAmountBeforeCost(tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit)); // TODO (woodser): apply min payout to incentivize loser? (see post v1.1.7)
|
disputeResult.setBuyerPayoutAmountBeforeCost(tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit)); // TODO (woodser): apply min payout to incentivize loser? (see post v1.1.7)
|
||||||
disputeResult.setSellerPayoutAmountBeforeCost(BigInteger.valueOf(0));
|
disputeResult.setSellerPayoutAmountBeforeCost(BigInteger.ZERO);
|
||||||
} else if (payout == DisputePayout.SELLER_GETS_TRADE_AMOUNT) {
|
} else if (payout == DisputePayout.SELLER_GETS_TRADE_AMOUNT) {
|
||||||
disputeResult.setBuyerPayoutAmountBeforeCost(buyerSecurityDeposit);
|
disputeResult.setBuyerPayoutAmountBeforeCost(buyerSecurityDeposit);
|
||||||
disputeResult.setSellerPayoutAmountBeforeCost(tradeAmount.add(sellerSecurityDeposit));
|
disputeResult.setSellerPayoutAmountBeforeCost(tradeAmount.add(sellerSecurityDeposit));
|
||||||
} else if (payout == DisputePayout.SELLER_GETS_ALL) {
|
} else if (payout == DisputePayout.SELLER_GETS_ALL) {
|
||||||
disputeResult.setBuyerPayoutAmountBeforeCost(BigInteger.valueOf(0));
|
disputeResult.setBuyerPayoutAmountBeforeCost(BigInteger.ZERO);
|
||||||
disputeResult.setSellerPayoutAmountBeforeCost(tradeAmount.add(sellerSecurityDeposit).add(buyerSecurityDeposit));
|
disputeResult.setSellerPayoutAmountBeforeCost(tradeAmount.add(sellerSecurityDeposit).add(buyerSecurityDeposit));
|
||||||
} else if (payout == DisputePayout.CUSTOM) {
|
} else if (payout == DisputePayout.CUSTOM) {
|
||||||
if (customWinnerAmount > trade.getWallet().getBalance().longValueExact()) throw new RuntimeException("Winner payout is more than the trade wallet's balance");
|
if (customWinnerAmount > trade.getWallet().getBalance().longValueExact()) throw new RuntimeException("Winner payout is more than the trade wallet's balance");
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class Price extends MonetaryWrapper implements Comparable<Price> {
|
||||||
else if (monetary instanceof CryptoMoney && this.monetary instanceof CryptoMoney)
|
else if (monetary instanceof CryptoMoney && this.monetary instanceof CryptoMoney)
|
||||||
return HavenoUtils.coinToAtomicUnits(new CryptoExchangeRate((CryptoMoney) this.monetary).cryptoToCoin((CryptoMoney) monetary));
|
return HavenoUtils.coinToAtomicUnits(new CryptoExchangeRate((CryptoMoney) this.monetary).cryptoToCoin((CryptoMoney) monetary));
|
||||||
else
|
else
|
||||||
return BigInteger.valueOf(0);
|
return BigInteger.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCurrencyCode() {
|
public String getCurrencyCode() {
|
||||||
|
|
|
@ -143,9 +143,9 @@ public class OfferUtil {
|
||||||
public BigInteger getBalanceShortage(BigInteger cost, BigInteger balance) {
|
public BigInteger getBalanceShortage(BigInteger cost, BigInteger balance) {
|
||||||
if (cost != null) {
|
if (cost != null) {
|
||||||
BigInteger shortage = cost.subtract(balance);
|
BigInteger shortage = cost.subtract(balance);
|
||||||
return shortage.compareTo(BigInteger.valueOf(0)) < 0 ? BigInteger.valueOf(0) : shortage;
|
return shortage.compareTo(BigInteger.ZERO) < 0 ? BigInteger.ZERO : shortage;
|
||||||
} else {
|
} else {
|
||||||
return BigInteger.valueOf(0);
|
return BigInteger.ZERO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1029,7 +1029,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
|
|
||||||
// get earliest unscheduled txs with sufficient incoming amount
|
// get earliest unscheduled txs with sufficient incoming amount
|
||||||
List<String> scheduledTxHashes = new ArrayList<String>();
|
List<String> scheduledTxHashes = new ArrayList<String>();
|
||||||
BigInteger scheduledAmount = BigInteger.valueOf(0);
|
BigInteger scheduledAmount = BigInteger.ZERO;
|
||||||
for (MoneroTxWallet lockedTx : lockedTxs) {
|
for (MoneroTxWallet lockedTx : lockedTxs) {
|
||||||
if (isTxScheduled(openOffers, lockedTx.getHash())) continue;
|
if (isTxScheduled(openOffers, lockedTx.getHash())) continue;
|
||||||
if (lockedTx.getIncomingTransfers() == null || lockedTx.getIncomingTransfers().isEmpty()) continue;
|
if (lockedTx.getIncomingTransfers() == null || lockedTx.getIncomingTransfers().isEmpty()) continue;
|
||||||
|
@ -1048,7 +1048,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
}
|
}
|
||||||
|
|
||||||
private BigInteger getScheduledAmount(List<OpenOffer> openOffers) {
|
private BigInteger getScheduledAmount(List<OpenOffer> openOffers) {
|
||||||
BigInteger scheduledAmount = BigInteger.valueOf(0);
|
BigInteger scheduledAmount = BigInteger.ZERO;
|
||||||
for (OpenOffer openOffer : openOffers) {
|
for (OpenOffer openOffer : openOffers) {
|
||||||
if (openOffer.getState() != OpenOffer.State.SCHEDULED) continue;
|
if (openOffer.getState() != OpenOffer.State.SCHEDULED) continue;
|
||||||
if (openOffer.getScheduledTxHashes() == null) continue;
|
if (openOffer.getScheduledTxHashes() == null) continue;
|
||||||
|
@ -1178,7 +1178,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify maker's reserve tx (double spend, trade fee, trade amount, mining fee)
|
// verify maker's reserve tx (double spend, trade fee, trade amount, mining fee)
|
||||||
BigInteger sendAmount = offer.getDirection() == OfferDirection.BUY ? BigInteger.valueOf(0) : offer.getAmount();
|
BigInteger sendAmount = offer.getDirection() == OfferDirection.BUY ? BigInteger.ZERO : offer.getAmount();
|
||||||
BigInteger securityDeposit = offer.getDirection() == OfferDirection.BUY ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit();
|
BigInteger securityDeposit = offer.getDirection() == OfferDirection.BUY ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit();
|
||||||
Tuple2<MoneroTx, BigInteger> txResult = xmrWalletService.verifyTradeTx(
|
Tuple2<MoneroTx, BigInteger> txResult = xmrWalletService.verifyTradeTx(
|
||||||
offer.getId(),
|
offer.getId(),
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class MakerReserveOfferFunds extends Task<PlaceOfferModel> {
|
||||||
|
|
||||||
// create reserve tx
|
// create reserve tx
|
||||||
BigInteger makerFee = offer.getMakerFee();
|
BigInteger makerFee = offer.getMakerFee();
|
||||||
BigInteger sendAmount = offer.getDirection() == OfferDirection.BUY ? BigInteger.valueOf(0) : offer.getAmount();
|
BigInteger sendAmount = offer.getDirection() == OfferDirection.BUY ? BigInteger.ZERO : offer.getAmount();
|
||||||
BigInteger securityDeposit = offer.getDirection() == OfferDirection.BUY ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit();
|
BigInteger securityDeposit = offer.getDirection() == OfferDirection.BUY ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit();
|
||||||
String returnAddress = model.getXmrWalletService().getOrCreateAddressEntry(offer.getId(), XmrAddressEntry.Context.TRADE_PAYOUT).getAddressString();
|
String returnAddress = model.getXmrWalletService().getOrCreateAddressEntry(offer.getId(), XmrAddressEntry.Context.TRADE_PAYOUT).getAddressString();
|
||||||
XmrAddressEntry fundingEntry = model.getXmrWalletService().getAddressEntry(offer.getId(), XmrAddressEntry.Context.OFFER_FUNDING).orElse(null);
|
XmrAddressEntry fundingEntry = model.getXmrWalletService().getAddressEntry(offer.getId(), XmrAddressEntry.Context.OFFER_FUNDING).orElse(null);
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class ValidateOffer extends Task<PlaceOfferModel> {
|
||||||
|
|
||||||
public static void checkBINotNullOrZero(BigInteger value, String name) {
|
public static void checkBINotNullOrZero(BigInteger value, String name) {
|
||||||
checkNotNull(value, name + " is null");
|
checkNotNull(value, name + " is null");
|
||||||
checkArgument(value.compareTo(BigInteger.valueOf(0)) > 0,
|
checkArgument(value.compareTo(BigInteger.ZERO) > 0,
|
||||||
name + " must be positive. " + name + "=" + value);
|
name + " must be positive. " + name + "=" + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class TakeOfferModel implements Model {
|
||||||
@Getter
|
@Getter
|
||||||
private BigInteger totalToPay;
|
private BigInteger totalToPay;
|
||||||
@Getter
|
@Getter
|
||||||
private BigInteger missingCoin = BigInteger.valueOf(0);
|
private BigInteger missingCoin = BigInteger.ZERO;
|
||||||
@Getter
|
@Getter
|
||||||
private BigInteger totalAvailableBalance;
|
private BigInteger totalAvailableBalance;
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -156,7 +156,7 @@ public class TakeOfferModel implements Model {
|
||||||
@NotNull
|
@NotNull
|
||||||
public BigInteger getFundsNeededForTrade() {
|
public BigInteger getFundsNeededForTrade() {
|
||||||
// If taking a buy offer, taker needs to reserve the offer.amt too.
|
// If taking a buy offer, taker needs to reserve the offer.amt too.
|
||||||
return securityDeposit.add(offer.isBuyOffer() ? amount : BigInteger.valueOf(0));
|
return securityDeposit.add(offer.isBuyOffer() ? amount : BigInteger.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateModelInputs() {
|
private void validateModelInputs() {
|
||||||
|
@ -173,7 +173,7 @@ public class TakeOfferModel implements Model {
|
||||||
this.amount = null;
|
this.amount = null;
|
||||||
this.availableBalance = null;
|
this.availableBalance = null;
|
||||||
this.isXmrWalletFunded = false;
|
this.isXmrWalletFunded = false;
|
||||||
this.missingCoin = BigInteger.valueOf(0);
|
this.missingCoin = BigInteger.ZERO;
|
||||||
this.offer = null;
|
this.offer = null;
|
||||||
this.paymentAccount = null;
|
this.paymentAccount = null;
|
||||||
this.securityDeposit = null;
|
this.securityDeposit = null;
|
||||||
|
|
|
@ -367,7 +367,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PaymentMethod getDummyPaymentMethod(String id) {
|
public static PaymentMethod getDummyPaymentMethod(String id) {
|
||||||
return new PaymentMethod(id, 0, BigInteger.valueOf(0), Arrays.asList());
|
return new PaymentMethod(id, 0, BigInteger.ZERO, Arrays.asList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||||
|
|
||||||
// Used for dummy entries in payment methods list (SHOW_ALL)
|
// Used for dummy entries in payment methods list (SHOW_ALL)
|
||||||
private PaymentMethod(String id) {
|
private PaymentMethod(String id) {
|
||||||
this(id, 0, BigInteger.valueOf(0), new ArrayList<String>());
|
this(id, 0, BigInteger.ZERO, new ArrayList<String>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1051,7 +1051,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
||||||
String optionTradeDetails;
|
String optionTradeDetails;
|
||||||
// We don't translate those strings (yet) as it is only displayed to mediators/arbitrators.
|
// We don't translate those strings (yet) as it is only displayed to mediators/arbitrators.
|
||||||
String headline;
|
String headline;
|
||||||
if (potentialGain.compareTo(BigInteger.valueOf(0)) > 0) {
|
if (potentialGain.compareTo(BigInteger.ZERO) > 0) {
|
||||||
headline = "This might be a potential option trade!";
|
headline = "This might be a potential option trade!";
|
||||||
optionTradeDetails = "\nBTC amount calculated with price at dispute opening: " + HavenoUtils.formatXmr(potentialAmountAtDisputeOpening, true) +
|
optionTradeDetails = "\nBTC amount calculated with price at dispute opening: " + HavenoUtils.formatXmr(potentialAmountAtDisputeOpening, true) +
|
||||||
"\nMax loss of security deposit is: " + HavenoUtils.formatXmr(maxLossSecDeposit, true) +
|
"\nMax loss of security deposit is: " + HavenoUtils.formatXmr(maxLossSecDeposit, true) +
|
||||||
|
|
|
@ -386,7 +386,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
|
||||||
// verify payouts sum to unlocked balance within loss of precision due to conversion to centineros
|
// verify payouts sum to unlocked balance within loss of precision due to conversion to centineros
|
||||||
BigInteger txCost = arbitratorSignedPayoutTx.getFee().add(arbitratorSignedPayoutTx.getChangeAmount()); // cost = fee + lost dust change
|
BigInteger txCost = arbitratorSignedPayoutTx.getFee().add(arbitratorSignedPayoutTx.getChangeAmount()); // cost = fee + lost dust change
|
||||||
if (!arbitratorSignedPayoutTx.getChangeAmount().equals(BigInteger.ZERO)) log.warn("Dust left in multisig wallet for {} {}: {}", getClass().getSimpleName(), trade.getId(), arbitratorSignedPayoutTx.getChangeAmount());
|
if (!arbitratorSignedPayoutTx.getChangeAmount().equals(BigInteger.ZERO)) log.warn("Dust left in multisig wallet for {} {}: {}", getClass().getSimpleName(), trade.getId(), arbitratorSignedPayoutTx.getChangeAmount());
|
||||||
if (trade.getWallet().getUnlockedBalance().subtract(actualBuyerAmount.add(actualSellerAmount).add(txCost)).compareTo(BigInteger.valueOf(0)) > 0) {
|
if (trade.getWallet().getUnlockedBalance().subtract(actualBuyerAmount.add(actualSellerAmount).add(txCost)).compareTo(BigInteger.ZERO) > 0) {
|
||||||
throw new RuntimeException("The dispute payout amounts do not sum to the wallet's unlocked balance while verifying the dispute payout tx, unlocked balance=" + trade.getWallet().getUnlockedBalance() + " vs sum payout amount=" + actualBuyerAmount.add(actualSellerAmount) + ", buyer payout=" + actualBuyerAmount + ", seller payout=" + actualSellerAmount);
|
throw new RuntimeException("The dispute payout amounts do not sum to the wallet's unlocked balance while verifying the dispute payout tx, unlocked balance=" + trade.getWallet().getUnlockedBalance() + " vs sum payout amount=" + actualBuyerAmount.add(actualSellerAmount) + ", buyer payout=" + actualBuyerAmount + ", seller payout=" + actualSellerAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
|
||||||
public static BigInteger[] getBuyerSellerPayoutTxCost(DisputeResult disputeResult, BigInteger payoutTxCost) {
|
public static BigInteger[] getBuyerSellerPayoutTxCost(DisputeResult disputeResult, BigInteger payoutTxCost) {
|
||||||
boolean isBuyerWinner = disputeResult.getWinner() == Winner.BUYER;
|
boolean isBuyerWinner = disputeResult.getWinner() == Winner.BUYER;
|
||||||
BigInteger loserAmount = isBuyerWinner ? disputeResult.getSellerPayoutAmountBeforeCost() : disputeResult.getBuyerPayoutAmountBeforeCost();
|
BigInteger loserAmount = isBuyerWinner ? disputeResult.getSellerPayoutAmountBeforeCost() : disputeResult.getBuyerPayoutAmountBeforeCost();
|
||||||
if (loserAmount.equals(BigInteger.valueOf(0))) {
|
if (loserAmount.equals(BigInteger.ZERO)) {
|
||||||
BigInteger buyerPayoutTxFee = isBuyerWinner ? payoutTxCost : BigInteger.ZERO;
|
BigInteger buyerPayoutTxFee = isBuyerWinner ? payoutTxCost : BigInteger.ZERO;
|
||||||
BigInteger sellerPayoutTxFee = isBuyerWinner ? BigInteger.ZERO : payoutTxCost;
|
BigInteger sellerPayoutTxFee = isBuyerWinner ? BigInteger.ZERO : payoutTxCost;
|
||||||
return new BigInteger[] { buyerPayoutTxFee, sellerPayoutTxFee };
|
return new BigInteger[] { buyerPayoutTxFee, sellerPayoutTxFee };
|
||||||
|
|
|
@ -216,8 +216,8 @@ public class ClosedTradableManager implements PersistedDataHost {
|
||||||
|
|
||||||
public BigInteger getXmrTradeFee(Tradable tradable) {
|
public BigInteger getXmrTradeFee(Tradable tradable) {
|
||||||
return isMaker(tradable) ?
|
return isMaker(tradable) ?
|
||||||
tradable.getOptionalMakerFee().orElse(BigInteger.valueOf(0)) :
|
tradable.getOptionalMakerFee().orElse(BigInteger.ZERO) :
|
||||||
tradable.getOptionalTakerFee().orElse(BigInteger.valueOf(0));
|
tradable.getOptionalTakerFee().orElse(BigInteger.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMaker(Tradable tradable) {
|
public boolean isMaker(Tradable tradable) {
|
||||||
|
|
|
@ -199,11 +199,11 @@ public class HavenoUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BigInteger parseXmr(String input) {
|
public static BigInteger parseXmr(String input) {
|
||||||
if (input == null || input.length() == 0) return BigInteger.valueOf(0);
|
if (input == null || input.length() == 0) return BigInteger.ZERO;
|
||||||
try {
|
try {
|
||||||
return xmrToAtomicUnits(new BigDecimal(ParsingUtils.parseNumberStringToDouble(input)).doubleValue());
|
return xmrToAtomicUnits(new BigDecimal(ParsingUtils.parseNumberStringToDouble(input)).doubleValue());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return BigInteger.valueOf(0);
|
return BigInteger.ZERO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ public class HavenoUtils {
|
||||||
|
|
||||||
public static BigInteger getFeePerXmr(BigInteger feePerXmr, BigInteger amount) {
|
public static BigInteger getFeePerXmr(BigInteger feePerXmr, BigInteger amount) {
|
||||||
BigDecimal feePerXmrAsDecimal = feePerXmr == null ? BigDecimal.valueOf(0) : new BigDecimal(feePerXmr);
|
BigDecimal feePerXmrAsDecimal = feePerXmr == null ? BigDecimal.valueOf(0) : new BigDecimal(feePerXmr);
|
||||||
BigDecimal amountMultiplier = BigDecimal.valueOf(divide(amount == null ? BigInteger.valueOf(0) : amount, HavenoUtils.xmrToAtomicUnits(1.0)));
|
BigDecimal amountMultiplier = BigDecimal.valueOf(divide(amount == null ? BigInteger.ZERO : amount, HavenoUtils.xmrToAtomicUnits(1.0)));
|
||||||
return feePerXmrAsDecimal.multiply(amountMultiplier).toBigInteger();
|
return feePerXmrAsDecimal.multiply(amountMultiplier).toBigInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1658,7 +1658,7 @@ public abstract class Trade implements Tradable, Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigInteger getFrozenAmount() {
|
public BigInteger getFrozenAmount() {
|
||||||
BigInteger sum = BigInteger.valueOf(0);
|
BigInteger sum = BigInteger.ZERO;
|
||||||
for (String keyImage : getSelf().getReserveTxKeyImages()) {
|
for (String keyImage : getSelf().getReserveTxKeyImages()) {
|
||||||
List<MoneroOutputWallet> outputs = xmrWalletService.getWallet().getOutputs(new MoneroOutputQuery().setIsFrozen(true).setIsSpent(false).setKeyImage(new MoneroKeyImage(keyImage))); // TODO: will this check tx pool? avoid
|
List<MoneroOutputWallet> outputs = xmrWalletService.getWallet().getOutputs(new MoneroOutputQuery().setIsFrozen(true).setIsSpent(false).setKeyImage(new MoneroKeyImage(keyImage))); // TODO: will this check tx pool? avoid
|
||||||
if (!outputs.isEmpty()) sum = sum.add(outputs.get(0).getAmount());
|
if (!outputs.isEmpty()) sum = sum.add(outputs.get(0).getAmount());
|
||||||
|
@ -1667,7 +1667,7 @@ public abstract class Trade implements Tradable, Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigInteger getReservedAmount() {
|
public BigInteger getReservedAmount() {
|
||||||
if (isArbitrator() || !isDepositsPublished() || isPayoutPublished()) return BigInteger.valueOf(0);
|
if (isArbitrator() || !isDepositsPublished() || isPayoutPublished()) return BigInteger.ZERO;
|
||||||
return isBuyer() ? getBuyer().getSecurityDeposit() : getAmount().add(getSeller().getSecurityDeposit());
|
return isBuyer() ? getBuyer().getSecurityDeposit() : getAmount().add(getSeller().getSecurityDeposit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class ArbitratorProcessDepositRequest extends TradeTask {
|
||||||
boolean isFromTaker = trader == trade.getTaker();
|
boolean isFromTaker = trader == trade.getTaker();
|
||||||
boolean isFromBuyer = trader == trade.getBuyer();
|
boolean isFromBuyer = trader == trade.getBuyer();
|
||||||
BigInteger tradeFee = isFromTaker ? trade.getTakerFee() : trade.getMakerFee();
|
BigInteger tradeFee = isFromTaker ? trade.getTakerFee() : trade.getMakerFee();
|
||||||
BigInteger sendAmount = isFromBuyer ? BigInteger.valueOf(0) : trade.getAmount();
|
BigInteger sendAmount = isFromBuyer ? BigInteger.ZERO : trade.getAmount();
|
||||||
BigInteger securityDeposit = isFromBuyer ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
|
BigInteger securityDeposit = isFromBuyer ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
|
||||||
String depositAddress = processModel.getMultisigAddress();
|
String depositAddress = processModel.getMultisigAddress();
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ArbitratorProcessReserveTx extends TradeTask {
|
||||||
|
|
||||||
// process reserve tx with expected values
|
// process reserve tx with expected values
|
||||||
BigInteger tradeFee = isFromMaker ? trade.getMakerFee() : trade.getTakerFee();
|
BigInteger tradeFee = isFromMaker ? trade.getMakerFee() : trade.getTakerFee();
|
||||||
BigInteger sendAmount = isFromBuyer ? BigInteger.valueOf(0) : isFromMaker ? offer.getAmount() : trade.getAmount(); // maker reserve tx is for offer amount
|
BigInteger sendAmount = isFromBuyer ? BigInteger.ZERO : isFromMaker ? offer.getAmount() : trade.getAmount(); // maker reserve tx is for offer amount
|
||||||
BigInteger securityDeposit = isFromMaker ? isFromBuyer ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit() : isFromBuyer ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
|
BigInteger securityDeposit = isFromMaker ? isFromBuyer ? offer.getMaxBuyerSecurityDeposit() : offer.getMaxSellerSecurityDeposit() : isFromBuyer ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
|
||||||
Tuple2<MoneroTx, BigInteger> txResult;
|
Tuple2<MoneroTx, BigInteger> txResult;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class TakerReserveTradeFunds extends TradeTask {
|
||||||
|
|
||||||
// create reserve tx
|
// create reserve tx
|
||||||
BigInteger takerFee = trade.getTakerFee();
|
BigInteger takerFee = trade.getTakerFee();
|
||||||
BigInteger sendAmount = trade.getOffer().getDirection() == OfferDirection.BUY ? trade.getAmount() : BigInteger.valueOf(0);
|
BigInteger sendAmount = trade.getOffer().getDirection() == OfferDirection.BUY ? trade.getAmount() : BigInteger.ZERO;
|
||||||
BigInteger securityDeposit = trade.getOffer().getDirection() == OfferDirection.BUY ? trade.getSellerSecurityDepositBeforeMiningFee() : trade.getBuyerSecurityDepositBeforeMiningFee();
|
BigInteger securityDeposit = trade.getOffer().getDirection() == OfferDirection.BUY ? trade.getSellerSecurityDepositBeforeMiningFee() : trade.getBuyerSecurityDepositBeforeMiningFee();
|
||||||
String returnAddress = model.getXmrWalletService().getOrCreateAddressEntry(trade.getOffer().getId(), XmrAddressEntry.Context.TRADE_PAYOUT).getAddressString();
|
String returnAddress = model.getXmrWalletService().getOrCreateAddressEntry(trade.getOffer().getId(), XmrAddressEntry.Context.TRADE_PAYOUT).getAddressString();
|
||||||
MoneroTxWallet reserveTx = model.getXmrWalletService().createReserveTx(takerFee, sendAmount, securityDeposit, returnAddress, false, null);
|
MoneroTxWallet reserveTx = model.getXmrWalletService().createReserveTx(takerFee, sendAmount, securityDeposit, returnAddress, false, null);
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class CoinUtil {
|
||||||
* @return The percentage value as double (e.g. 1% is 0.01)
|
* @return The percentage value as double (e.g. 1% is 0.01)
|
||||||
*/
|
*/
|
||||||
public static double getAsPercentPerBtc(BigInteger part, BigInteger total) {
|
public static double getAsPercentPerBtc(BigInteger part, BigInteger total) {
|
||||||
return MathUtils.roundDouble(HavenoUtils.divide(part == null ? BigInteger.valueOf(0) : part, total == null ? BigInteger.valueOf(1) : total), 4);
|
return MathUtils.roundDouble(HavenoUtils.divide(part == null ? BigInteger.ZERO : part, total == null ? BigInteger.valueOf(1) : total), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +71,7 @@ public class CoinUtil {
|
||||||
* @return The percentage as atomic units (e.g. 1% of 1 BTC is 0.01 BTC)
|
* @return The percentage as atomic units (e.g. 1% of 1 BTC is 0.01 BTC)
|
||||||
*/
|
*/
|
||||||
public static BigInteger getPercentOfAmount(double percent, BigInteger amount) {
|
public static BigInteger getPercentOfAmount(double percent, BigInteger amount) {
|
||||||
if (amount == null) amount = BigInteger.valueOf(0);
|
if (amount == null) amount = BigInteger.ZERO;
|
||||||
return BigDecimal.valueOf(percent).multiply(new BigDecimal(amount)).setScale(8, RoundingMode.DOWN).toBigInteger();
|
return BigDecimal.valueOf(percent).multiply(new BigDecimal(amount)).setScale(8, RoundingMode.DOWN).toBigInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ public class CoinUtil {
|
||||||
// 10 EUR in case of HalCash.
|
// 10 EUR in case of HalCash.
|
||||||
Volume smallestUnitForVolume = Volume.parse(String.valueOf(factor), price.getCurrencyCode());
|
Volume smallestUnitForVolume = Volume.parse(String.valueOf(factor), price.getCurrencyCode());
|
||||||
if (smallestUnitForVolume.getValue() <= 0)
|
if (smallestUnitForVolume.getValue() <= 0)
|
||||||
return BigInteger.valueOf(0);
|
return BigInteger.ZERO;
|
||||||
|
|
||||||
BigInteger smallestUnitForAmount = price.getAmountByVolume(smallestUnitForVolume);
|
BigInteger smallestUnitForAmount = price.getAmountByVolume(smallestUnitForVolume);
|
||||||
long minTradeAmount = Restrictions.getMinTradeAmount().longValueExact();
|
long minTradeAmount = Restrictions.getMinTradeAmount().longValueExact();
|
||||||
|
@ -152,7 +152,7 @@ public class CoinUtil {
|
||||||
? getAdjustedVolumeUnit(price.getVolumeByAmount(smallestUnitForAmount), factor)
|
? getAdjustedVolumeUnit(price.getVolumeByAmount(smallestUnitForAmount), factor)
|
||||||
: getAdjustedVolumeUnit(price.getVolumeByAmount(amount), factor);
|
: getAdjustedVolumeUnit(price.getVolumeByAmount(amount), factor);
|
||||||
if (volume.getValue() <= 0)
|
if (volume.getValue() <= 0)
|
||||||
return BigInteger.valueOf(0);
|
return BigInteger.ZERO;
|
||||||
|
|
||||||
// From that adjusted volume we calculate back the amount. It might be a bit different as
|
// From that adjusted volume we calculate back the amount. It might be a bit different as
|
||||||
// the amount used as input before due rounding.
|
// the amount used as input before due rounding.
|
||||||
|
|
|
@ -101,12 +101,12 @@ public class Balances {
|
||||||
// TODO (woodser): converting to long should generally be avoided since can lose precision, but in practice these amounts are below max value
|
// TODO (woodser): converting to long should generally be avoided since can lose precision, but in practice these amounts are below max value
|
||||||
|
|
||||||
private void updateAvailableBalance() {
|
private void updateAvailableBalance() {
|
||||||
availableBalance.set(xmrWalletService.getWallet() == null ? BigInteger.valueOf(0) : xmrWalletService.getWallet().getUnlockedBalance(0));
|
availableBalance.set(xmrWalletService.getWallet() == null ? BigInteger.ZERO : xmrWalletService.getWallet().getUnlockedBalance(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePendingBalance() {
|
private void updatePendingBalance() {
|
||||||
BigInteger balance = xmrWalletService.getWallet() == null ? BigInteger.valueOf(0) : xmrWalletService.getWallet().getBalance(0);
|
BigInteger balance = xmrWalletService.getWallet() == null ? BigInteger.ZERO : xmrWalletService.getWallet().getBalance(0);
|
||||||
BigInteger unlockedBalance = xmrWalletService.getWallet() == null ? BigInteger.valueOf(0) : xmrWalletService.getWallet().getUnlockedBalance(0);
|
BigInteger unlockedBalance = xmrWalletService.getWallet() == null ? BigInteger.ZERO : xmrWalletService.getWallet().getUnlockedBalance(0);
|
||||||
BigInteger pendingBalanceSum = balance.subtract(unlockedBalance);
|
BigInteger pendingBalanceSum = balance.subtract(unlockedBalance);
|
||||||
|
|
||||||
// add frozen trade balances - reserved amounts
|
// add frozen trade balances - reserved amounts
|
||||||
|
@ -122,7 +122,7 @@ public class Balances {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateReservedOfferBalance() {
|
private void updateReservedOfferBalance() {
|
||||||
BigInteger sum = BigInteger.valueOf(0);
|
BigInteger sum = BigInteger.ZERO;
|
||||||
if (xmrWalletService.getWallet() != null) {
|
if (xmrWalletService.getWallet() != null) {
|
||||||
List<MoneroOutputWallet> frozenOutputs = xmrWalletService.getWallet().getOutputs(new MoneroOutputQuery().setIsFrozen(true).setIsSpent(false));
|
List<MoneroOutputWallet> frozenOutputs = xmrWalletService.getWallet().getOutputs(new MoneroOutputQuery().setIsFrozen(true).setIsSpent(false));
|
||||||
for (MoneroOutputWallet frozenOutput : frozenOutputs) sum = sum.add(frozenOutput.getAmount());
|
for (MoneroOutputWallet frozenOutput : frozenOutputs) sum = sum.add(frozenOutput.getAmount());
|
||||||
|
@ -138,7 +138,7 @@ public class Balances {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateReservedTradeBalance() {
|
private void updateReservedTradeBalance() {
|
||||||
BigInteger sum = BigInteger.valueOf(0);
|
BigInteger sum = BigInteger.ZERO;
|
||||||
List<Trade> trades = tradeManager.getTradesStreamWithFundsLockedIn().collect(Collectors.toList());
|
List<Trade> trades = tradeManager.getTradesStreamWithFundsLockedIn().collect(Collectors.toList());
|
||||||
for (Trade trade : trades) {
|
for (Trade trade : trades) {
|
||||||
sum = sum.add(trade.getReservedAmount());
|
sum = sum.add(trade.getReservedAmount());
|
||||||
|
|
|
@ -424,7 +424,7 @@ public class XmrWalletService {
|
||||||
// create deposit tx
|
// create deposit tx
|
||||||
String multisigAddress = trade.getProcessModel().getMultisigAddress();
|
String multisigAddress = trade.getProcessModel().getMultisigAddress();
|
||||||
BigInteger tradeFee = trade instanceof MakerTrade ? trade.getOffer().getMakerFee() : trade.getTakerFee();
|
BigInteger tradeFee = trade instanceof MakerTrade ? trade.getOffer().getMakerFee() : trade.getTakerFee();
|
||||||
BigInteger sendAmount = trade instanceof BuyerTrade ? BigInteger.valueOf(0) : trade.getAmount();
|
BigInteger sendAmount = trade instanceof BuyerTrade ? BigInteger.ZERO : trade.getAmount();
|
||||||
BigInteger securityDeposit = trade instanceof BuyerTrade ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
|
BigInteger securityDeposit = trade instanceof BuyerTrade ? trade.getBuyerSecurityDepositBeforeMiningFee() : trade.getSellerSecurityDepositBeforeMiningFee();
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
log.info("Creating deposit tx with multisig address={}", multisigAddress);
|
log.info("Creating deposit tx with multisig address={}", multisigAddress);
|
||||||
|
@ -449,7 +449,7 @@ public class XmrWalletService {
|
||||||
subaddressIndices.addAll(subaddressIndicesWithExactInput);
|
subaddressIndices.addAll(subaddressIndicesWithExactInput);
|
||||||
}
|
}
|
||||||
if (preferredSubaddressIndex != null) {
|
if (preferredSubaddressIndex != null) {
|
||||||
if (wallet.getBalance(0, preferredSubaddressIndex).compareTo(BigInteger.valueOf(0)) > 0) {
|
if (wallet.getBalance(0, preferredSubaddressIndex).compareTo(BigInteger.ZERO) > 0) {
|
||||||
subaddressIndices.add(0, preferredSubaddressIndex); // try preferred subaddress first if funded
|
subaddressIndices.add(0, preferredSubaddressIndex); // try preferred subaddress first if funded
|
||||||
} else if (reserveExactAmount) {
|
} else if (reserveExactAmount) {
|
||||||
subaddressIndices.add(preferredSubaddressIndex); // otherwise only try preferred subaddress if using exact output
|
subaddressIndices.add(preferredSubaddressIndex); // otherwise only try preferred subaddress if using exact output
|
||||||
|
@ -532,7 +532,7 @@ public class XmrWalletService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify unlock height
|
// verify unlock height
|
||||||
if (!BigInteger.valueOf(0).equals(tx.getUnlockTime())) throw new RuntimeException("Unlock height must be 0");
|
if (!BigInteger.ZERO.equals(tx.getUnlockTime())) throw new RuntimeException("Unlock height must be 0");
|
||||||
|
|
||||||
// verify miner fee
|
// verify miner fee
|
||||||
BigInteger feeEstimate = getElevatedFeeEstimate(tx.getWeight());
|
BigInteger feeEstimate = getElevatedFeeEstimate(tx.getWeight());
|
||||||
|
@ -603,7 +603,7 @@ public class XmrWalletService {
|
||||||
// round up to multiple of quantization mask
|
// round up to multiple of quantization mask
|
||||||
BigInteger[] quotientAndRemainder = baseFee.divideAndRemainder(qmask);
|
BigInteger[] quotientAndRemainder = baseFee.divideAndRemainder(qmask);
|
||||||
BigInteger feeEstimate = qmask.multiply(quotientAndRemainder[0]);
|
BigInteger feeEstimate = qmask.multiply(quotientAndRemainder[0]);
|
||||||
if (quotientAndRemainder[1].compareTo(BigInteger.valueOf(0)) > 0) feeEstimate = feeEstimate.add(qmask);
|
if (quotientAndRemainder[1].compareTo(BigInteger.ZERO) > 0) feeEstimate = feeEstimate.add(qmask);
|
||||||
return feeEstimate;
|
return feeEstimate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1105,7 +1105,7 @@ public class XmrWalletService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<XmrAddressEntry> getFundedAvailableAddressEntries() {
|
public List<XmrAddressEntry> getFundedAvailableAddressEntries() {
|
||||||
return getAvailableAddressEntries().stream().filter(addressEntry -> getBalanceForSubaddress(addressEntry.getSubaddressIndex()).compareTo(BigInteger.valueOf(0)) > 0).collect(Collectors.toList());
|
return getAvailableAddressEntries().stream().filter(addressEntry -> getBalanceForSubaddress(addressEntry.getSubaddressIndex()).compareTo(BigInteger.ZERO) > 0).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<XmrAddressEntry> getAddressEntryListAsImmutableList() {
|
public List<XmrAddressEntry> getAddressEntryListAsImmutableList() {
|
||||||
|
@ -1147,7 +1147,7 @@ public class XmrWalletService {
|
||||||
//if (tx.getTransfers(new MoneroTransferQuery().setSubaddressIndex(subaddressIndex)).isEmpty()) continue; // TODO monero-project: transfers are occluded by transfers from/to same account, so this will return unused when used
|
//if (tx.getTransfers(new MoneroTransferQuery().setSubaddressIndex(subaddressIndex)).isEmpty()) continue; // TODO monero-project: transfers are occluded by transfers from/to same account, so this will return unused when used
|
||||||
numUnspentOutputs += tx.isConfirmed() ? tx.getOutputsWallet(new MoneroOutputQuery().setAccountIndex(0).setSubaddressIndex(subaddressIndex)).size() : 1; // TODO: monero-project does not provide outputs for unconfirmed txs
|
numUnspentOutputs += tx.isConfirmed() ? tx.getOutputsWallet(new MoneroOutputQuery().setAccountIndex(0).setSubaddressIndex(subaddressIndex)).size() : 1; // TODO: monero-project does not provide outputs for unconfirmed txs
|
||||||
}
|
}
|
||||||
boolean positiveBalance = wallet.getBalance(0, subaddressIndex).compareTo(BigInteger.valueOf(0)) > 0;
|
boolean positiveBalance = wallet.getBalance(0, subaddressIndex).compareTo(BigInteger.ZERO) > 0;
|
||||||
if (positiveBalance && numUnspentOutputs == 0) return 1; // outputs do not appear until confirmed and internal transfers are occluded, so report 1 if positive balance
|
if (positiveBalance && numUnspentOutputs == 0) return 1; // outputs do not appear until confirmed and internal transfers are occluded, so report 1 if positive balance
|
||||||
return numUnspentOutputs;
|
return numUnspentOutputs;
|
||||||
}
|
}
|
||||||
|
@ -1228,7 +1228,7 @@ public class XmrWalletService {
|
||||||
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.ARBITRATOR).stream());
|
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.ARBITRATOR).stream());
|
||||||
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.OFFER_FUNDING).stream().filter(entry -> !tradeManager.getOpenOfferManager().getOpenOfferById(entry.getOfferId()).isPresent()));
|
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.OFFER_FUNDING).stream().filter(entry -> !tradeManager.getOpenOfferManager().getOpenOfferById(entry.getOfferId()).isPresent()));
|
||||||
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.TRADE_PAYOUT).stream().filter(entry -> tradeManager.getTrade(entry.getOfferId()) == null || tradeManager.getTrade(entry.getOfferId()).isPayoutUnlocked()));
|
available = Stream.concat(available, getAddressEntries(XmrAddressEntry.Context.TRADE_PAYOUT).stream().filter(entry -> tradeManager.getTrade(entry.getOfferId()) == null || tradeManager.getTrade(entry.getOfferId()).isPayoutUnlocked()));
|
||||||
return available.filter(addressEntry -> getBalanceForSubaddress(addressEntry.getSubaddressIndex()).compareTo(BigInteger.valueOf(0)) > 0);
|
return available.filter(addressEntry -> getBalanceForSubaddress(addressEntry.getSubaddressIndex()).compareTo(BigInteger.ZERO) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWalletListener(MoneroWalletListenerI listener) {
|
public void addWalletListener(MoneroWalletListenerI listener) {
|
||||||
|
|
|
@ -353,7 +353,7 @@ public class SignedWitnessServiceTest {
|
||||||
when(keyRing.getSignatureKeyPair()).thenReturn(signerKeyPair);
|
when(keyRing.getSignatureKeyPair()).thenReturn(signerKeyPair);
|
||||||
|
|
||||||
AccountAgeWitness accountAgeWitness = new AccountAgeWitness(account1DataHash, accountCreationTime);
|
AccountAgeWitness accountAgeWitness = new AccountAgeWitness(account1DataHash, accountCreationTime);
|
||||||
signedWitnessService.signAndPublishAccountAgeWitness(BigInteger.valueOf(0), accountAgeWitness, peerKeyPair.getPublic());
|
signedWitnessService.signAndPublishAccountAgeWitness(BigInteger.ZERO, accountAgeWitness, peerKeyPair.getPublic());
|
||||||
|
|
||||||
verify(p2pService, never()).addPersistableNetworkPayload(any(PersistableNetworkPayload.class), anyBoolean());
|
verify(p2pService, never()).addPersistableNetworkPayload(any(PersistableNetworkPayload.class), anyBoolean());
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class CoinUtilTest {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CoinUtil.getAdjustedAmount(
|
CoinUtil.getAdjustedAmount(
|
||||||
BigInteger.valueOf(0),
|
BigInteger.ZERO,
|
||||||
Price.valueOf("USD", 1000_0000),
|
Price.valueOf("USD", 1000_0000),
|
||||||
HavenoUtils.xmrToAtomicUnits(0.2).longValueExact(),
|
HavenoUtils.xmrToAtomicUnits(0.2).longValueExact(),
|
||||||
1);
|
1);
|
||||||
|
|
|
@ -151,9 +151,9 @@ public class AddressTextField extends AnchorPane {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private String getMoneroURI() {
|
private String getMoneroURI() {
|
||||||
if (amount.get().compareTo(BigInteger.valueOf(0)) < 0) {
|
if (amount.get().compareTo(BigInteger.ZERO) < 0) {
|
||||||
log.warn("Amount must not be negative");
|
log.warn("Amount must not be negative");
|
||||||
setAmount(BigInteger.valueOf(0));
|
setAmount(BigInteger.ZERO);
|
||||||
}
|
}
|
||||||
return GUIUtil.getMoneroURI(
|
return GUIUtil.getMoneroURI(
|
||||||
address.get(),
|
address.get(),
|
||||||
|
|
|
@ -53,7 +53,7 @@ class TransactionsListItem {
|
||||||
private String direction = "";
|
private String direction = "";
|
||||||
private boolean received;
|
private boolean received;
|
||||||
private boolean detailsAvailable;
|
private boolean detailsAvailable;
|
||||||
private BigInteger amount = BigInteger.valueOf(0);
|
private BigInteger amount = BigInteger.ZERO;
|
||||||
private String memo = "";
|
private String memo = "";
|
||||||
private long confirmations = 0;
|
private long confirmations = 0;
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -88,8 +88,8 @@ class TransactionsListItem {
|
||||||
Optional<Tradable> optionalTradable = Optional.ofNullable(transactionAwareTradable)
|
Optional<Tradable> optionalTradable = Optional.ofNullable(transactionAwareTradable)
|
||||||
.map(TransactionAwareTradable::asTradable);
|
.map(TransactionAwareTradable::asTradable);
|
||||||
|
|
||||||
BigInteger valueSentToMe = tx.getIncomingAmount() == null ? BigInteger.valueOf(0) : tx.getIncomingAmount();
|
BigInteger valueSentToMe = tx.getIncomingAmount() == null ? BigInteger.ZERO : tx.getIncomingAmount();
|
||||||
BigInteger valueSentFromMe = tx.getOutgoingAmount() == null ? BigInteger.valueOf(0) : tx.getOutgoingAmount();
|
BigInteger valueSentFromMe = tx.getOutgoingAmount() == null ? BigInteger.ZERO : tx.getOutgoingAmount();
|
||||||
|
|
||||||
if (tx.getTransfers().get(0).isIncoming()) {
|
if (tx.getTransfers().get(0).isIncoming()) {
|
||||||
addressString = ((MoneroIncomingTransfer) tx.getTransfers().get(0)).getAddress();
|
addressString = ((MoneroIncomingTransfer) tx.getTransfers().get(0)).getAddress();
|
||||||
|
@ -99,7 +99,7 @@ class TransactionsListItem {
|
||||||
else addressString = "unavailable";
|
else addressString = "unavailable";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valueSentFromMe.compareTo(BigInteger.valueOf(0)) == 0) {
|
if (valueSentFromMe.compareTo(BigInteger.ZERO) == 0) {
|
||||||
amount = valueSentToMe;
|
amount = valueSentToMe;
|
||||||
direction = Res.get("funds.tx.direction.receivedWith");
|
direction = Res.get("funds.tx.direction.receivedWith");
|
||||||
received = true;
|
received = true;
|
||||||
|
@ -125,13 +125,13 @@ class TransactionsListItem {
|
||||||
} else if (trade.getPayoutTxId() != null &&
|
} else if (trade.getPayoutTxId() != null &&
|
||||||
trade.getPayoutTxId().equals(txId)) {
|
trade.getPayoutTxId().equals(txId)) {
|
||||||
details = Res.get("funds.tx.multiSigPayout", tradeId);
|
details = Res.get("funds.tx.multiSigPayout", tradeId);
|
||||||
if (amount.compareTo(BigInteger.valueOf(0)) == 0) {
|
if (amount.compareTo(BigInteger.ZERO) == 0) {
|
||||||
initialTxConfidenceVisibility = false;
|
initialTxConfidenceVisibility = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Trade.DisputeState disputeState = trade.getDisputeState();
|
Trade.DisputeState disputeState = trade.getDisputeState();
|
||||||
if (disputeState == Trade.DisputeState.DISPUTE_CLOSED) {
|
if (disputeState == Trade.DisputeState.DISPUTE_CLOSED) {
|
||||||
if (valueSentToMe.compareTo(BigInteger.valueOf(0)) > 0) {
|
if (valueSentToMe.compareTo(BigInteger.ZERO) > 0) {
|
||||||
details = Res.get("funds.tx.disputePayout", tradeId);
|
details = Res.get("funds.tx.disputePayout", tradeId);
|
||||||
} else {
|
} else {
|
||||||
details = Res.get("funds.tx.disputeLost", tradeId);
|
details = Res.get("funds.tx.disputeLost", tradeId);
|
||||||
|
@ -139,7 +139,7 @@ class TransactionsListItem {
|
||||||
} else if (disputeState == Trade.DisputeState.REFUND_REQUEST_CLOSED ||
|
} else if (disputeState == Trade.DisputeState.REFUND_REQUEST_CLOSED ||
|
||||||
disputeState == Trade.DisputeState.REFUND_REQUESTED ||
|
disputeState == Trade.DisputeState.REFUND_REQUESTED ||
|
||||||
disputeState == Trade.DisputeState.REFUND_REQUEST_STARTED_BY_PEER) {
|
disputeState == Trade.DisputeState.REFUND_REQUEST_STARTED_BY_PEER) {
|
||||||
if (valueSentToMe.compareTo(BigInteger.valueOf(0)) > 0) {
|
if (valueSentToMe.compareTo(BigInteger.ZERO) > 0) {
|
||||||
details = Res.get("funds.tx.refund", tradeId);
|
details = Res.get("funds.tx.refund", tradeId);
|
||||||
} else {
|
} else {
|
||||||
// We have spent the deposit tx outputs to the Haveno donation address to enable
|
// We have spent the deposit tx outputs to the Haveno donation address to enable
|
||||||
|
@ -147,7 +147,7 @@ class TransactionsListItem {
|
||||||
// already when funding the deposit tx we show 0 BTC as amount.
|
// already when funding the deposit tx we show 0 BTC as amount.
|
||||||
// Confirmation is not known from the BitcoinJ side (not 100% clear why) as no funds
|
// Confirmation is not known from the BitcoinJ side (not 100% clear why) as no funds
|
||||||
// left our wallet nor we received funds. So we set indicator invisible.
|
// left our wallet nor we received funds. So we set indicator invisible.
|
||||||
amount = BigInteger.valueOf(0);
|
amount = BigInteger.ZERO;
|
||||||
details = Res.get("funds.tx.collateralForRefund", tradeId);
|
details = Res.get("funds.tx.collateralForRefund", tradeId);
|
||||||
initialTxConfidenceVisibility = false;
|
initialTxConfidenceVisibility = false;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ class TransactionsListItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (amount.compareTo(BigInteger.valueOf(0)) == 0) {
|
if (amount.compareTo(BigInteger.ZERO) == 0) {
|
||||||
details = Res.get("funds.tx.noFundsFromDispute");
|
details = Res.get("funds.tx.noFundsFromDispute");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
private final P2PService p2PService;
|
private final P2PService p2PService;
|
||||||
private final WalletPasswordWindow walletPasswordWindow;
|
private final WalletPasswordWindow walletPasswordWindow;
|
||||||
private XmrBalanceListener balanceListener;
|
private XmrBalanceListener balanceListener;
|
||||||
private BigInteger amount = BigInteger.valueOf(0);
|
private BigInteger amount = BigInteger.ZERO;
|
||||||
private ChangeListener<String> amountListener;
|
private ChangeListener<String> amountListener;
|
||||||
private ChangeListener<Boolean> amountFocusListener;
|
private ChangeListener<Boolean> amountFocusListener;
|
||||||
private ChangeListener<Toggle> feeToggleGroupListener;
|
private ChangeListener<Toggle> feeToggleGroupListener;
|
||||||
|
@ -148,7 +148,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
};
|
};
|
||||||
amountFocusListener = (observable, oldValue, newValue) -> {
|
amountFocusListener = (observable, oldValue, newValue) -> {
|
||||||
if (oldValue && !newValue) {
|
if (oldValue && !newValue) {
|
||||||
if (amount.compareTo(BigInteger.valueOf(0)) > 0)
|
if (amount.compareTo(BigInteger.ZERO) > 0)
|
||||||
amountTextField.setText(HavenoUtils.formatXmr(amount));
|
amountTextField.setText(HavenoUtils.formatXmr(amount));
|
||||||
else
|
else
|
||||||
amountTextField.setText("");
|
amountTextField.setText("");
|
||||||
|
@ -200,7 +200,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
final String withdrawToAddress = withdrawToTextField.getText();
|
final String withdrawToAddress = withdrawToTextField.getText();
|
||||||
|
|
||||||
// create tx
|
// create tx
|
||||||
if (amount.compareTo(BigInteger.valueOf(0)) <= 0) throw new RuntimeException(Res.get("portfolio.pending.step5_buyer.amountTooLow"));
|
if (amount.compareTo(BigInteger.ZERO) <= 0) throw new RuntimeException(Res.get("portfolio.pending.step5_buyer.amountTooLow"));
|
||||||
MoneroTxWallet tx = xmrWalletService.getWallet().createTx(new MoneroTxConfig()
|
MoneroTxWallet tx = xmrWalletService.getWallet().createTx(new MoneroTxConfig()
|
||||||
.setAccountIndex(0)
|
.setAccountIndex(0)
|
||||||
.setAmount(amount)
|
.setAmount(amount)
|
||||||
|
@ -262,7 +262,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
.filter(Trade::isPayoutPublished)
|
.filter(Trade::isPayoutPublished)
|
||||||
.forEach(trade -> xmrWalletService.getAddressEntry(trade.getId(), XmrAddressEntry.Context.TRADE_PAYOUT)
|
.forEach(trade -> xmrWalletService.getAddressEntry(trade.getId(), XmrAddressEntry.Context.TRADE_PAYOUT)
|
||||||
.ifPresent(addressEntry -> {
|
.ifPresent(addressEntry -> {
|
||||||
if (xmrWalletService.getBalanceForAddress(addressEntry.getAddressString()).compareTo(BigInteger.valueOf(0)) == 0)
|
if (xmrWalletService.getBalanceForAddress(addressEntry.getAddressString()).compareTo(BigInteger.ZERO) == 0)
|
||||||
tradeManager.onTradeCompleted(trade);
|
tradeManager.onTradeCompleted(trade);
|
||||||
}));
|
}));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -276,7 +276,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void reset() {
|
private void reset() {
|
||||||
amount = BigInteger.valueOf(0);
|
amount = BigInteger.ZERO;
|
||||||
amountTextField.setText("");
|
amountTextField.setText("");
|
||||||
amountTextField.setPromptText(Res.get("funds.withdrawal.setAmount"));
|
amountTextField.setPromptText(Res.get("funds.withdrawal.setAmount"));
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class SpreadView extends ActivatableViewAndModel<GridPane, SpreadViewMode
|
||||||
int numberOfBuyOffers = sortedList.stream().mapToInt(item -> item.numberOfBuyOffers).sum();
|
int numberOfBuyOffers = sortedList.stream().mapToInt(item -> item.numberOfBuyOffers).sum();
|
||||||
int numberOfSellOffers = sortedList.stream().mapToInt(item -> item.numberOfSellOffers).sum();
|
int numberOfSellOffers = sortedList.stream().mapToInt(item -> item.numberOfSellOffers).sum();
|
||||||
|
|
||||||
BigInteger totalAmount = BigInteger.valueOf(0);
|
BigInteger totalAmount = BigInteger.ZERO;
|
||||||
for (SpreadItem item : sortedList) totalAmount = totalAmount.add(item.totalAmount);
|
for (SpreadItem item : sortedList) totalAmount = totalAmount.add(item.totalAmount);
|
||||||
String total = HavenoUtils.formatXmr(totalAmount);
|
String total = HavenoUtils.formatXmr(totalAmount);
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ class SpreadViewModel extends ActivatableViewModel {
|
||||||
}
|
}
|
||||||
spreadItems.clear();
|
spreadItems.clear();
|
||||||
|
|
||||||
BigInteger totalAmount = BigInteger.valueOf(0);
|
BigInteger totalAmount = BigInteger.ZERO;
|
||||||
|
|
||||||
for (String key : offersByCurrencyMap.keySet()) {
|
for (String key : offersByCurrencyMap.keySet()) {
|
||||||
List<Offer> offers = offersByCurrencyMap.get(key);
|
List<Offer> offers = offersByCurrencyMap.get(key);
|
||||||
|
|
|
@ -121,7 +121,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
|
||||||
protected boolean allowAmountUpdate = true;
|
protected boolean allowAmountUpdate = true;
|
||||||
private final TradeStatisticsManager tradeStatisticsManager;
|
private final TradeStatisticsManager tradeStatisticsManager;
|
||||||
|
|
||||||
private final Predicate<ObjectProperty<BigInteger>> isNonZeroAmount = (c) -> c.get() != null && c.get().compareTo(BigInteger.valueOf(0)) != 0;
|
private final Predicate<ObjectProperty<BigInteger>> isNonZeroAmount = (c) -> c.get() != null && c.get().compareTo(BigInteger.ZERO) != 0;
|
||||||
private final Predicate<ObjectProperty<Price>> isNonZeroPrice = (p) -> p.get() != null && !p.get().isZero();
|
private final Predicate<ObjectProperty<Price>> isNonZeroPrice = (p) -> p.get() != null && !p.get().isZero();
|
||||||
private final Predicate<ObjectProperty<Volume>> isNonZeroVolume = (v) -> v.get() != null && !v.get().isZero();
|
private final Predicate<ObjectProperty<Volume>> isNonZeroVolume = (v) -> v.get() != null && !v.get().isZero();
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -642,7 +642,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
|
||||||
private BigInteger getSellerSecurityDeposit() {
|
private BigInteger getSellerSecurityDeposit() {
|
||||||
BigInteger amount = this.amount.get();
|
BigInteger amount = this.amount.get();
|
||||||
if (amount == null)
|
if (amount == null)
|
||||||
amount = BigInteger.valueOf(0);
|
amount = BigInteger.ZERO;
|
||||||
|
|
||||||
BigInteger percentOfAmount = CoinUtil.getPercentOfAmount(
|
BigInteger percentOfAmount = CoinUtil.getPercentOfAmount(
|
||||||
createOfferService.getSellerSecurityDepositAsDouble(buyerSecurityDepositPct.get()), amount);
|
createOfferService.getSellerSecurityDepositAsDouble(buyerSecurityDepositPct.get()), amount);
|
||||||
|
|
|
@ -330,7 +330,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||||
// called from parent as the view does not get notified when the tab is closed
|
// called from parent as the view does not get notified when the tab is closed
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
// we use model.placeOfferCompleted to not react on close which was triggered by a successful placeOffer
|
// we use model.placeOfferCompleted to not react on close which was triggered by a successful placeOffer
|
||||||
if (model.getDataModel().getBalance().get().compareTo(BigInteger.valueOf(0)) > 0 && !model.placeOfferCompleted.get()) {
|
if (model.getDataModel().getBalance().get().compareTo(BigInteger.ZERO) > 0 && !model.placeOfferCompleted.get()) {
|
||||||
model.getDataModel().swapTradeToSavings();
|
model.getDataModel().swapTradeToSavings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public abstract class OfferDataModel extends ActivatableDataModel {
|
||||||
@Getter
|
@Getter
|
||||||
protected final ObjectProperty<BigInteger> availableBalance = new SimpleObjectProperty<>();
|
protected final ObjectProperty<BigInteger> availableBalance = new SimpleObjectProperty<>();
|
||||||
@Getter
|
@Getter
|
||||||
protected final ObjectProperty<BigInteger> missingCoin = new SimpleObjectProperty<>(BigInteger.valueOf(0));
|
protected final ObjectProperty<BigInteger> missingCoin = new SimpleObjectProperty<>(BigInteger.ZERO);
|
||||||
@Getter
|
@Getter
|
||||||
protected final BooleanProperty showWalletFundedNotification = new SimpleBooleanProperty();
|
protected final BooleanProperty showWalletFundedNotification = new SimpleBooleanProperty();
|
||||||
@Getter
|
@Getter
|
||||||
|
|
|
@ -353,7 +353,7 @@ class TakeOfferDataModel extends OfferDataModel {
|
||||||
void calculateVolume() {
|
void calculateVolume() {
|
||||||
if (tradePrice != null && offer != null &&
|
if (tradePrice != null && offer != null &&
|
||||||
amount.get() != null &&
|
amount.get() != null &&
|
||||||
amount.get().compareTo(BigInteger.valueOf(0)) != 0) {
|
amount.get().compareTo(BigInteger.ZERO) != 0) {
|
||||||
Volume volumeByAmount = tradePrice.getVolumeByAmount(amount.get());
|
Volume volumeByAmount = tradePrice.getVolumeByAmount(amount.get());
|
||||||
volumeByAmount = VolumeUtil.getAdjustedVolume(volumeByAmount, offer.getPaymentMethod().getId());
|
volumeByAmount = VolumeUtil.getAdjustedVolume(volumeByAmount, offer.getPaymentMethod().getId());
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||||
// Called from parent as the view does not get notified when the tab is closed
|
// Called from parent as the view does not get notified when the tab is closed
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
BigInteger availableBalance = model.dataModel.getAvailableBalance().get();
|
BigInteger availableBalance = model.dataModel.getAvailableBalance().get();
|
||||||
if (availableBalance != null && availableBalance.compareTo(BigInteger.valueOf(0)) > 0 && !model.takeOfferCompleted.get() && !DevEnv.isDevMode()) {
|
if (availableBalance != null && availableBalance.compareTo(BigInteger.ZERO) > 0 && !model.takeOfferCompleted.get() && !DevEnv.isDevMode()) {
|
||||||
model.dataModel.swapTradeToSavings();
|
model.dataModel.swapTradeToSavings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||||
// be made
|
// be made
|
||||||
return totalAmount.compareTo(available) <= 0;
|
return totalAmount.compareTo(available) <= 0;
|
||||||
} else {
|
} else {
|
||||||
if (totalAmount.compareTo(BigInteger.valueOf(0)) <= 0) {
|
if (totalAmount.compareTo(BigInteger.ZERO) <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return totalAmount.compareTo(available) == 0;
|
return totalAmount.compareTo(available) == 0;
|
||||||
|
@ -612,23 +612,23 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||||
String sellerPayoutAddressString = contract.getSellerPayoutAddressString();
|
String sellerPayoutAddressString = contract.getSellerPayoutAddressString();
|
||||||
List<MoneroDestination> destinations = payoutTx.getOutgoingTransfer().getDestinations();
|
List<MoneroDestination> destinations = payoutTx.getOutgoingTransfer().getDestinations();
|
||||||
boolean buyerFirst = destinations.get(0).getAddress().equals(buyerPayoutAddressString);
|
boolean buyerFirst = destinations.get(0).getAddress().equals(buyerPayoutAddressString);
|
||||||
BigInteger buyerPayoutAmount = buyerFirst ? destinations.get(0).getAmount() : destinations.size() == 2 ? destinations.get(1).getAmount() : BigInteger.valueOf(0);
|
BigInteger buyerPayoutAmount = buyerFirst ? destinations.get(0).getAmount() : destinations.size() == 2 ? destinations.get(1).getAmount() : BigInteger.ZERO;
|
||||||
BigInteger sellerPayoutAmount = buyerFirst ? (destinations.size() == 2 ? destinations.get(1).getAmount() : BigInteger.valueOf(0)) : destinations.get(0).getAmount();
|
BigInteger sellerPayoutAmount = buyerFirst ? (destinations.size() == 2 ? destinations.get(1).getAmount() : BigInteger.ZERO) : destinations.get(0).getAmount();
|
||||||
|
|
||||||
String buyerDetails = "";
|
String buyerDetails = "";
|
||||||
if (buyerPayoutAmount.compareTo(BigInteger.valueOf(0)) > 0) {
|
if (buyerPayoutAmount.compareTo(BigInteger.ZERO) > 0) {
|
||||||
buyerDetails = Res.get("disputeSummaryWindow.close.txDetails.buyer",
|
buyerDetails = Res.get("disputeSummaryWindow.close.txDetails.buyer",
|
||||||
HavenoUtils.formatXmr(buyerPayoutAmount, true),
|
HavenoUtils.formatXmr(buyerPayoutAmount, true),
|
||||||
buyerPayoutAddressString);
|
buyerPayoutAddressString);
|
||||||
}
|
}
|
||||||
String sellerDetails = "";
|
String sellerDetails = "";
|
||||||
if (sellerPayoutAmount.compareTo(BigInteger.valueOf(0)) > 0) {
|
if (sellerPayoutAmount.compareTo(BigInteger.ZERO) > 0) {
|
||||||
sellerDetails = Res.get("disputeSummaryWindow.close.txDetails.seller",
|
sellerDetails = Res.get("disputeSummaryWindow.close.txDetails.seller",
|
||||||
HavenoUtils.formatXmr(sellerPayoutAmount, true),
|
HavenoUtils.formatXmr(sellerPayoutAmount, true),
|
||||||
sellerPayoutAddressString);
|
sellerPayoutAddressString);
|
||||||
}
|
}
|
||||||
BigInteger outputAmount = buyerPayoutAmount.add(sellerPayoutAmount).add(payoutTx.getFee());
|
BigInteger outputAmount = buyerPayoutAmount.add(sellerPayoutAmount).add(payoutTx.getFee());
|
||||||
if (outputAmount.compareTo(BigInteger.valueOf(0)) > 0) {
|
if (outputAmount.compareTo(BigInteger.ZERO) > 0) {
|
||||||
new Popup().width(900)
|
new Popup().width(900)
|
||||||
.headLine(Res.get("disputeSummaryWindow.close.txDetails.headline"))
|
.headLine(Res.get("disputeSummaryWindow.close.txDetails.headline"))
|
||||||
.confirmation(Res.get("disputeSummaryWindow.close.txDetails",
|
.confirmation(Res.get("disputeSummaryWindow.close.txDetails",
|
||||||
|
@ -728,13 +728,13 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||||
sellerPayoutAmount.equals(sellerSecurityDeposit)) {
|
sellerPayoutAmount.equals(sellerSecurityDeposit)) {
|
||||||
buyerGetsTradeAmountRadioButton.setSelected(true);
|
buyerGetsTradeAmountRadioButton.setSelected(true);
|
||||||
} else if (buyerPayoutAmount.equals(tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit)) &&
|
} else if (buyerPayoutAmount.equals(tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit)) &&
|
||||||
sellerPayoutAmount.equals(BigInteger.valueOf(0))) {
|
sellerPayoutAmount.equals(BigInteger.ZERO)) {
|
||||||
buyerGetsAllRadioButton.setSelected(true);
|
buyerGetsAllRadioButton.setSelected(true);
|
||||||
} else if (sellerPayoutAmount.equals(tradeAmount.add(sellerSecurityDeposit))
|
} else if (sellerPayoutAmount.equals(tradeAmount.add(sellerSecurityDeposit))
|
||||||
&& buyerPayoutAmount.equals(buyerSecurityDeposit)) {
|
&& buyerPayoutAmount.equals(buyerSecurityDeposit)) {
|
||||||
sellerGetsTradeAmountRadioButton.setSelected(true);
|
sellerGetsTradeAmountRadioButton.setSelected(true);
|
||||||
} else if (sellerPayoutAmount.equals(tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit))
|
} else if (sellerPayoutAmount.equals(tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit))
|
||||||
&& buyerPayoutAmount.equals(BigInteger.valueOf(0))) {
|
&& buyerPayoutAmount.equals(BigInteger.ZERO)) {
|
||||||
sellerGetsAllRadioButton.setSelected(true);
|
sellerGetsAllRadioButton.setSelected(true);
|
||||||
} else {
|
} else {
|
||||||
customRadioButton.setSelected(true);
|
customRadioButton.setSelected(true);
|
||||||
|
|
|
@ -276,14 +276,14 @@ public class PendingTradesDataModel extends ActivatableDataModel {
|
||||||
return offer.getMakerFee();
|
return offer.getMakerFee();
|
||||||
} else {
|
} else {
|
||||||
log.error("offer is null");
|
log.error("offer is null");
|
||||||
return BigInteger.valueOf(0);
|
return BigInteger.ZERO;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return trade.getTakerFee();
|
return trade.getTakerFee();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.error("Trade is null at getTotalFees");
|
log.error("Trade is null at getTotalFees");
|
||||||
return BigInteger.valueOf(0);
|
return BigInteger.ZERO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,6 @@ public class GUIUtilTest {
|
||||||
BigInteger fee = BigInteger.valueOf(100000000L);
|
BigInteger fee = BigInteger.valueOf(100000000L);
|
||||||
|
|
||||||
assertEquals(" (0.01% of trade amount)",
|
assertEquals(" (0.01% of trade amount)",
|
||||||
GUIUtil.getPercentageOfTradeAmount(fee, HavenoUtils.xmrToAtomicUnits(1.0), BigInteger.valueOf(0)));
|
GUIUtil.getPercentageOfTradeAmount(fee, HavenoUtils.xmrToAtomicUnits(1.0), BigInteger.ZERO));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue