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) {
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));

View file

@ -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))

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
// 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) {

View file

@ -286,11 +286,11 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
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<DisputeSummaryWindow> {
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<DisputeSummaryWindow> {
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<DisputeSummaryWindow> {
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();