replace trade.getBuyerSecurityDeposit() w/ getBuyer().getSecurityDeposit()

This commit is contained in:
woodser 2023-10-28 10:31:37 -04:00
parent 7592d8fbca
commit 8f8d653871
4 changed files with 13 additions and 23 deletions

View File

@ -212,8 +212,8 @@ public class CoreDisputesService {
public void applyPayoutAmountsToDisputeResult(DisputePayout payout, Dispute dispute, DisputeResult disputeResult, long customWinnerAmount) { public void applyPayoutAmountsToDisputeResult(DisputePayout payout, Dispute dispute, DisputeResult disputeResult, long customWinnerAmount) {
Contract contract = dispute.getContract(); Contract contract = dispute.getContract();
Trade trade = tradeManager.getTrade(dispute.getTradeId()); Trade trade = tradeManager.getTrade(dispute.getTradeId());
BigInteger buyerSecurityDeposit = trade.getBuyerSecurityDeposit(); BigInteger buyerSecurityDeposit = trade.getBuyer().getSecurityDeposit();
BigInteger sellerSecurityDeposit = trade.getSellerSecurityDeposit(); BigInteger sellerSecurityDeposit = trade.getSeller().getSecurityDeposit();
BigInteger tradeAmount = contract.getTradeAmount(); BigInteger tradeAmount = contract.getTradeAmount();
if (payout == DisputePayout.BUYER_GETS_TRADE_AMOUNT) { if (payout == DisputePayout.BUYER_GETS_TRADE_AMOUNT) {
disputeResult.setBuyerPayoutAmount(tradeAmount.add(buyerSecurityDeposit)); disputeResult.setBuyerPayoutAmount(tradeAmount.add(buyerSecurityDeposit));

View File

@ -159,8 +159,8 @@ public class TradeInfo implements Payload {
.withTakerDepositTxId(trade.getTaker().getDepositTxHash()) .withTakerDepositTxId(trade.getTaker().getDepositTxHash())
.withPayoutTxId(trade.getPayoutTxId()) .withPayoutTxId(trade.getPayoutTxId())
.withAmount(trade.getAmount().longValueExact()) .withAmount(trade.getAmount().longValueExact())
.withBuyerSecurityDeposit(trade.getBuyerSecurityDeposit() == null ? -1 : trade.getBuyerSecurityDeposit().longValueExact()) .withBuyerSecurityDeposit(trade.getBuyer().getSecurityDeposit() == null ? -1 : trade.getBuyer().getSecurityDeposit().longValueExact())
.withSellerSecurityDeposit(trade.getSellerSecurityDeposit() == null ? -1 : trade.getSellerSecurityDeposit().longValueExact()) .withSellerSecurityDeposit(trade.getSeller().getSecurityDeposit() == null ? -1 : trade.getSeller().getSecurityDeposit().longValueExact())
.withPrice(toPreciseTradePrice.apply(trade)) .withPrice(toPreciseTradePrice.apply(trade))
.withVolume(toRoundedVolume.apply(trade)) .withVolume(toRoundedVolume.apply(trade))
.withArbitratorNodeAddress(toArbitratorNodeAddress.apply(trade)) .withArbitratorNodeAddress(toArbitratorNodeAddress.apply(trade))

View File

@ -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 // by mediators and we keep the confirm disabled to avoid that the seller can complete the trade
// without the penalty. // without the penalty.
long payoutAmountFromMediation = processModel.getSellerPayoutAmountFromMediation(); long payoutAmountFromMediation = processModel.getSellerPayoutAmountFromMediation();
long normalPayoutAmount = getSellerSecurityDeposit().longValueExact(); long normalPayoutAmount = getSeller().getSecurityDeposit().longValueExact();
return payoutAmountFromMediation < normalPayoutAmount; return payoutAmountFromMediation < normalPayoutAmount;
} }
@ -1637,16 +1637,6 @@ public abstract class Trade implements Tradable, Model {
return BigInteger.valueOf(totalTxFee); 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 @Nullable
public MoneroTx getPayoutTx() { public MoneroTx getPayoutTx() {
if (payoutTx == null) { if (payoutTx == null) {

View File

@ -286,11 +286,11 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeFee"), tradeFee); addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeFee"), tradeFee);
String securityDeposit = Res.getWithColAndCap("shared.buyer") + String securityDeposit = Res.getWithColAndCap("shared.buyer") +
" " + " " +
HavenoUtils.formatXmr(trade.getBuyerSecurityDeposit(), true) + HavenoUtils.formatXmr(trade.getBuyer().getSecurityDeposit(), true) +
" / " + " / " +
Res.getWithColAndCap("shared.seller") + Res.getWithColAndCap("shared.seller") +
" " + " " +
HavenoUtils.formatXmr(trade.getSellerSecurityDeposit(), true); HavenoUtils.formatXmr(trade.getSeller().getSecurityDeposit(), true);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit);
} }
@ -354,8 +354,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
Contract contract = dispute.getContract(); Contract contract = dispute.getContract();
BigInteger tradeAmount = contract.getTradeAmount(); BigInteger tradeAmount = contract.getTradeAmount();
BigInteger available = tradeAmount BigInteger available = tradeAmount
.add(trade.getBuyerSecurityDeposit()) .add(trade.getBuyer().getSecurityDeposit())
.add(trade.getSellerSecurityDeposit()); .add(trade.getSeller().getSecurityDeposit());
BigInteger totalAmount = buyerAmount.add(sellerAmount); BigInteger totalAmount = buyerAmount.add(sellerAmount);
boolean isRefundAgent = getDisputeManager(dispute) instanceof RefundManager; boolean isRefundAgent = getDisputeManager(dispute) instanceof RefundManager;
@ -380,8 +380,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
Contract contract = dispute.getContract(); Contract contract = dispute.getContract();
BigInteger available = contract.getTradeAmount() BigInteger available = contract.getTradeAmount()
.add(trade.getBuyerSecurityDeposit()) .add(trade.getBuyer().getSecurityDeposit())
.add(trade.getSellerSecurityDeposit()); .add(trade.getSeller().getSecurityDeposit());
BigInteger enteredAmount = HavenoUtils.parseXmr(inputTextField.getText()); BigInteger enteredAmount = HavenoUtils.parseXmr(inputTextField.getText());
if (enteredAmount.compareTo(available) > 0) { if (enteredAmount.compareTo(available) > 0) {
enteredAmount = available; enteredAmount = available;
@ -716,8 +716,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
private void applyTradeAmountRadioButtonStates() { private void applyTradeAmountRadioButtonStates() {
Contract contract = dispute.getContract(); Contract contract = dispute.getContract();
BigInteger buyerSecurityDeposit = trade.getBuyerSecurityDeposit(); BigInteger buyerSecurityDeposit = trade.getBuyer().getSecurityDeposit();
BigInteger sellerSecurityDeposit = trade.getSellerSecurityDeposit(); BigInteger sellerSecurityDeposit = trade.getSeller().getSecurityDeposit();
BigInteger tradeAmount = contract.getTradeAmount(); BigInteger tradeAmount = contract.getTradeAmount();
BigInteger buyerPayoutAmount = disputeResult.getBuyerPayoutAmount(); BigInteger buyerPayoutAmount = disputeResult.getBuyerPayoutAmount();