diff --git a/core/src/main/java/haveno/core/api/CoreDisputesService.java b/core/src/main/java/haveno/core/api/CoreDisputesService.java index 6e28c38f90..7b4b5bf961 100644 --- a/core/src/main/java/haveno/core/api/CoreDisputesService.java +++ b/core/src/main/java/haveno/core/api/CoreDisputesService.java @@ -212,8 +212,8 @@ public class CoreDisputesService { public void applyPayoutAmountsToDisputeResult(DisputePayout payout, Dispute dispute, DisputeResult disputeResult, long customWinnerAmount) { Contract contract = dispute.getContract(); Trade trade = tradeManager.getTrade(dispute.getTradeId()); - BigInteger buyerSecurityDeposit = trade.getBuyerSecurityDeposit(); - BigInteger sellerSecurityDeposit = trade.getSellerSecurityDeposit(); + BigInteger buyerSecurityDeposit = trade.getBuyer().getSecurityDeposit(); + BigInteger sellerSecurityDeposit = trade.getSeller().getSecurityDeposit(); BigInteger tradeAmount = contract.getTradeAmount(); if (payout == DisputePayout.BUYER_GETS_TRADE_AMOUNT) { disputeResult.setBuyerPayoutAmount(tradeAmount.add(buyerSecurityDeposit)); diff --git a/core/src/main/java/haveno/core/api/model/TradeInfo.java b/core/src/main/java/haveno/core/api/model/TradeInfo.java index bcbc4b2cb3..c4486aeda5 100644 --- a/core/src/main/java/haveno/core/api/model/TradeInfo.java +++ b/core/src/main/java/haveno/core/api/model/TradeInfo.java @@ -159,8 +159,8 @@ public class TradeInfo implements Payload { .withTakerDepositTxId(trade.getTaker().getDepositTxHash()) .withPayoutTxId(trade.getPayoutTxId()) .withAmount(trade.getAmount().longValueExact()) - .withBuyerSecurityDeposit(trade.getBuyerSecurityDeposit() == null ? -1 : trade.getBuyerSecurityDeposit().longValueExact()) - .withSellerSecurityDeposit(trade.getSellerSecurityDeposit() == null ? -1 : trade.getSellerSecurityDeposit().longValueExact()) + .withBuyerSecurityDeposit(trade.getBuyer().getSecurityDeposit() == null ? -1 : trade.getBuyer().getSecurityDeposit().longValueExact()) + .withSellerSecurityDeposit(trade.getSeller().getSecurityDeposit() == null ? -1 : trade.getSeller().getSecurityDeposit().longValueExact()) .withPrice(toPreciseTradePrice.apply(trade)) .withVolume(toRoundedVolume.apply(trade)) .withArbitratorNodeAddress(toArbitratorNodeAddress.apply(trade)) diff --git a/core/src/main/java/haveno/core/trade/Trade.java b/core/src/main/java/haveno/core/trade/Trade.java index 5246842b6b..267556f665 100644 --- a/core/src/main/java/haveno/core/trade/Trade.java +++ b/core/src/main/java/haveno/core/trade/Trade.java @@ -1105,7 +1105,7 @@ public abstract class Trade implements Tradable, Model { // by mediators and we keep the confirm disabled to avoid that the seller can complete the trade // without the penalty. long payoutAmountFromMediation = processModel.getSellerPayoutAmountFromMediation(); - long normalPayoutAmount = getSellerSecurityDeposit().longValueExact(); + long normalPayoutAmount = getSeller().getSecurityDeposit().longValueExact(); return payoutAmountFromMediation < normalPayoutAmount; } @@ -1637,16 +1637,6 @@ public abstract class Trade implements Tradable, Model { return BigInteger.valueOf(totalTxFee); } - public BigInteger getBuyerSecurityDeposit() { - if (getBuyer().getDepositTxHash() == null) return null; - return getBuyer().getSecurityDeposit(); - } - - public BigInteger getSellerSecurityDeposit() { - if (getSeller().getDepositTxHash() == null) return null; - return getSeller().getSecurityDeposit(); - } - @Nullable public MoneroTx getPayoutTx() { if (payoutTx == null) { diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/DisputeSummaryWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/DisputeSummaryWindow.java index 3c38a1c056..c5bd1c93eb 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/DisputeSummaryWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/DisputeSummaryWindow.java @@ -286,11 +286,11 @@ public class DisputeSummaryWindow extends Overlay { addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeFee"), tradeFee); String securityDeposit = Res.getWithColAndCap("shared.buyer") + " " + - HavenoUtils.formatXmr(trade.getBuyerSecurityDeposit(), true) + + HavenoUtils.formatXmr(trade.getBuyer().getSecurityDeposit(), true) + " / " + Res.getWithColAndCap("shared.seller") + " " + - HavenoUtils.formatXmr(trade.getSellerSecurityDeposit(), true); + HavenoUtils.formatXmr(trade.getSeller().getSecurityDeposit(), true); addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); } @@ -354,8 +354,8 @@ public class DisputeSummaryWindow extends Overlay { Contract contract = dispute.getContract(); BigInteger tradeAmount = contract.getTradeAmount(); BigInteger available = tradeAmount - .add(trade.getBuyerSecurityDeposit()) - .add(trade.getSellerSecurityDeposit()); + .add(trade.getBuyer().getSecurityDeposit()) + .add(trade.getSeller().getSecurityDeposit()); BigInteger totalAmount = buyerAmount.add(sellerAmount); boolean isRefundAgent = getDisputeManager(dispute) instanceof RefundManager; @@ -380,8 +380,8 @@ public class DisputeSummaryWindow extends Overlay { Contract contract = dispute.getContract(); BigInteger available = contract.getTradeAmount() - .add(trade.getBuyerSecurityDeposit()) - .add(trade.getSellerSecurityDeposit()); + .add(trade.getBuyer().getSecurityDeposit()) + .add(trade.getSeller().getSecurityDeposit()); BigInteger enteredAmount = HavenoUtils.parseXmr(inputTextField.getText()); if (enteredAmount.compareTo(available) > 0) { enteredAmount = available; @@ -716,8 +716,8 @@ public class DisputeSummaryWindow extends Overlay { private void applyTradeAmountRadioButtonStates() { Contract contract = dispute.getContract(); - BigInteger buyerSecurityDeposit = trade.getBuyerSecurityDeposit(); - BigInteger sellerSecurityDeposit = trade.getSellerSecurityDeposit(); + BigInteger buyerSecurityDeposit = trade.getBuyer().getSecurityDeposit(); + BigInteger sellerSecurityDeposit = trade.getSeller().getSecurityDeposit(); BigInteger tradeAmount = contract.getTradeAmount(); BigInteger buyerPayoutAmount = disputeResult.getBuyerPayoutAmount();