mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-12 22:23:42 +01:00
loser pays mining fee on resolve dispute with custom amount
This commit is contained in:
parent
51d5f0e1d3
commit
e2369480b2
@ -14,6 +14,7 @@ import haveno.core.support.dispute.Dispute;
|
|||||||
import haveno.core.support.dispute.DisputeManager;
|
import haveno.core.support.dispute.DisputeManager;
|
||||||
import haveno.core.support.dispute.DisputeResult;
|
import haveno.core.support.dispute.DisputeResult;
|
||||||
import haveno.core.support.dispute.DisputeSummaryVerification;
|
import haveno.core.support.dispute.DisputeSummaryVerification;
|
||||||
|
import haveno.core.support.dispute.DisputeResult.SubtractFeeFrom;
|
||||||
import haveno.core.support.dispute.arbitration.ArbitrationManager;
|
import haveno.core.support.dispute.arbitration.ArbitrationManager;
|
||||||
import haveno.core.support.messages.ChatMessage;
|
import haveno.core.support.messages.ChatMessage;
|
||||||
import haveno.core.trade.Contract;
|
import haveno.core.trade.Contract;
|
||||||
@ -161,7 +162,6 @@ public class CoreDisputesService {
|
|||||||
throw new IllegalStateException("Unexpected DisputeResult.Winner: " + winner);
|
throw new IllegalStateException("Unexpected DisputeResult.Winner: " + winner);
|
||||||
}
|
}
|
||||||
applyPayoutAmountsToDisputeResult(payout, winningDispute, winnerDisputeResult, customWinnerAmount);
|
applyPayoutAmountsToDisputeResult(payout, winningDispute, winnerDisputeResult, customWinnerAmount);
|
||||||
winnerDisputeResult.setSubtractFeeFrom(customWinnerAmount == 0 ? DisputeResult.SubtractFeeFrom.BUYER_AND_SELLER : winner == DisputeResult.Winner.BUYER ? DisputeResult.SubtractFeeFrom.SELLER_ONLY : DisputeResult.SubtractFeeFrom.BUYER_ONLY);
|
|
||||||
|
|
||||||
// create dispute payout tx
|
// create dispute payout tx
|
||||||
trade.getProcessModel().setUnsignedPayoutTx(arbitrationManager.createDisputePayoutTx(trade, winningDispute.getContract(), winnerDisputeResult, false));
|
trade.getProcessModel().setUnsignedPayoutTx(arbitrationManager.createDisputePayoutTx(trade, winningDispute.getContract(), winnerDisputeResult, false));
|
||||||
@ -215,6 +215,7 @@ public class CoreDisputesService {
|
|||||||
BigInteger buyerSecurityDeposit = trade.getBuyer().getSecurityDeposit();
|
BigInteger buyerSecurityDeposit = trade.getBuyer().getSecurityDeposit();
|
||||||
BigInteger sellerSecurityDeposit = trade.getSeller().getSecurityDeposit();
|
BigInteger sellerSecurityDeposit = trade.getSeller().getSecurityDeposit();
|
||||||
BigInteger tradeAmount = contract.getTradeAmount();
|
BigInteger tradeAmount = contract.getTradeAmount();
|
||||||
|
disputeResult.setSubtractFeeFrom(DisputeResult.SubtractFeeFrom.BUYER_AND_SELLER);
|
||||||
if (payout == DisputePayout.BUYER_GETS_TRADE_AMOUNT) {
|
if (payout == DisputePayout.BUYER_GETS_TRADE_AMOUNT) {
|
||||||
disputeResult.setBuyerPayoutAmount(tradeAmount.add(buyerSecurityDeposit));
|
disputeResult.setBuyerPayoutAmount(tradeAmount.add(buyerSecurityDeposit));
|
||||||
disputeResult.setSellerPayoutAmount(sellerSecurityDeposit);
|
disputeResult.setSellerPayoutAmount(sellerSecurityDeposit);
|
||||||
@ -241,8 +242,8 @@ public class CoreDisputesService {
|
|||||||
}
|
}
|
||||||
disputeResult.setBuyerPayoutAmount(BigInteger.valueOf(disputeResult.getWinner() == DisputeResult.Winner.BUYER ? customWinnerAmount : loserAmount));
|
disputeResult.setBuyerPayoutAmount(BigInteger.valueOf(disputeResult.getWinner() == DisputeResult.Winner.BUYER ? customWinnerAmount : loserAmount));
|
||||||
disputeResult.setSellerPayoutAmount(BigInteger.valueOf(disputeResult.getWinner() == DisputeResult.Winner.BUYER ? loserAmount : customWinnerAmount));
|
disputeResult.setSellerPayoutAmount(BigInteger.valueOf(disputeResult.getWinner() == DisputeResult.Winner.BUYER ? loserAmount : customWinnerAmount));
|
||||||
|
disputeResult.setSubtractFeeFrom(disputeResult.getWinner() == DisputeResult.Winner.BUYER ? SubtractFeeFrom.SELLER_ONLY : SubtractFeeFrom.BUYER_ONLY); // winner gets exact amount, loser pays mining fee
|
||||||
}
|
}
|
||||||
disputeResult.setSubtractFeeFrom(DisputeResult.SubtractFeeFrom.BUYER_AND_SELLER); // TODO: can extend UI to specify who pays mining fee
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeDisputeTicket(DisputeManager disputeManager, Dispute dispute, DisputeResult disputeResult, ResultHandler resultHandler, FaultHandler faultHandler) {
|
public void closeDisputeTicket(DisputeManager disputeManager, Dispute dispute, DisputeResult disputeResult, ResultHandler resultHandler, FaultHandler faultHandler) {
|
||||||
|
@ -404,9 +404,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
|||||||
|
|
||||||
disputeResult.setBuyerPayoutAmount(buyerAmount);
|
disputeResult.setBuyerPayoutAmount(buyerAmount);
|
||||||
disputeResult.setSellerPayoutAmount(sellerAmount);
|
disputeResult.setSellerPayoutAmount(sellerAmount);
|
||||||
disputeResult.setWinner(buyerAmount.compareTo(sellerAmount) > 0 ? // TODO: UI should allow selection of receiver of exact custom amount, otherwise defaulting to bigger receiver. could extend API to specify who pays payout tx fee: buyer, seller, or both
|
disputeResult.setWinner(buyerAmount.compareTo(sellerAmount) > 0 ? DisputeResult.Winner.BUYER : DisputeResult.Winner.SELLER); // TODO: UI should allow selection of receiver of exact custom amount, otherwise defaulting to bigger receiver. could extend API to specify who pays payout tx fee: buyer, seller, or both
|
||||||
DisputeResult.Winner.BUYER :
|
disputeResult.setSubtractFeeFrom(buyerAmount.compareTo(sellerAmount) > 0 ? DisputeResult.SubtractFeeFrom.SELLER_ONLY : DisputeResult.SubtractFeeFrom.BUYER_ONLY);
|
||||||
DisputeResult.Winner.SELLER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPayoutAmountTextFields() {
|
private void addPayoutAmountTextFields() {
|
||||||
|
Loading…
Reference in New Issue
Block a user