mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-03 18:56:59 +01:00
Merge pull request #6362 from jmacxx/dispute_min_payout
Set the minimum payout at mediation to be 2.5% of trade amount
This commit is contained in:
commit
75e030f541
3 changed files with 9 additions and 6 deletions
|
@ -85,10 +85,13 @@ public class Restrictions {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This value must be lower than MIN_BUYER_SECURITY_DEPOSIT and SELLER_SECURITY_DEPOSIT
|
// This value must be lower than MIN_BUYER_SECURITY_DEPOSIT and SELLER_SECURITY_DEPOSIT
|
||||||
public static Coin getMinRefundAtMediatedDispute() {
|
public static Coin getMinRefundAtMediatedDispute(Coin tradeAmount) {
|
||||||
if (MIN_REFUND_AT_MEDIATED_DISPUTE == null)
|
if (MIN_REFUND_AT_MEDIATED_DISPUTE == null)
|
||||||
MIN_REFUND_AT_MEDIATED_DISPUTE = Coin.parseCoin("0.0005"); // 0.0005 BTC is 30 USD @ 60000 USD/BTC
|
MIN_REFUND_AT_MEDIATED_DISPUTE = Coin.parseCoin("0.0005"); // 0.0005 BTC is 30 USD @ 60000 USD/BTC
|
||||||
return MIN_REFUND_AT_MEDIATED_DISPUTE;
|
Coin twoPointFivePercentOfTradeAmount = tradeAmount.div(40);
|
||||||
|
if (twoPointFivePercentOfTradeAmount.isLessThan(MIN_REFUND_AT_MEDIATED_DISPUTE))
|
||||||
|
return MIN_REFUND_AT_MEDIATED_DISPUTE;
|
||||||
|
return twoPointFivePercentOfTradeAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getLockTime(boolean isAsset) {
|
public static int getLockTime(boolean isAsset) {
|
||||||
|
|
|
@ -928,7 +928,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
||||||
// The amount we would get if we do a new trade with current price
|
// The amount we would get if we do a new trade with current price
|
||||||
Coin potentialAmountAtDisputeOpening = priceAtDisputeOpening.getAmountByVolume(contract.getTradeVolume());
|
Coin potentialAmountAtDisputeOpening = priceAtDisputeOpening.getAmountByVolume(contract.getTradeVolume());
|
||||||
Coin buyerSecurityDeposit = Coin.valueOf(offerPayload.getBuyerSecurityDeposit());
|
Coin buyerSecurityDeposit = Coin.valueOf(offerPayload.getBuyerSecurityDeposit());
|
||||||
Coin minRefundAtMediatedDispute = Restrictions.getMinRefundAtMediatedDispute();
|
Coin minRefundAtMediatedDispute = Restrictions.getMinRefundAtMediatedDispute(contract.getTradeAmount());
|
||||||
// minRefundAtMediatedDispute is always larger as buyerSecurityDeposit at mediated payout, we ignore refund agent case here as there it can be 0.
|
// minRefundAtMediatedDispute is always larger as buyerSecurityDeposit at mediated payout, we ignore refund agent case here as there it can be 0.
|
||||||
Coin maxLossSecDeposit = buyerSecurityDeposit.subtract(minRefundAtMediatedDispute);
|
Coin maxLossSecDeposit = buyerSecurityDeposit.subtract(minRefundAtMediatedDispute);
|
||||||
Coin tradeAmount = contract.getTradeAmount();
|
Coin tradeAmount = contract.getTradeAmount();
|
||||||
|
|
|
@ -438,7 +438,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||||
boolean isMediationDispute = getDisputeManager(dispute) instanceof MediationManager;
|
boolean isMediationDispute = getDisputeManager(dispute) instanceof MediationManager;
|
||||||
// At mediation we require a min. payout to the losing party to keep incentive for the trader to accept the
|
// At mediation we require a min. payout to the losing party to keep incentive for the trader to accept the
|
||||||
// mediated payout. For Refund agent cases we do not have that restriction.
|
// mediated payout. For Refund agent cases we do not have that restriction.
|
||||||
Coin minRefundAtDispute = isMediationDispute ? Restrictions.getMinRefundAtMediatedDispute() : Coin.ZERO;
|
Coin minRefundAtDispute = isMediationDispute ? Restrictions.getMinRefundAtMediatedDispute(contract.getTradeAmount()) : Coin.ZERO;
|
||||||
|
|
||||||
Offer offer = new Offer(contract.getOfferPayload());
|
Offer offer = new Offer(contract.getOfferPayload());
|
||||||
Coin totalAvailable = contract.getTradeAmount()
|
Coin totalAvailable = contract.getTradeAmount()
|
||||||
|
@ -973,7 +973,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||||
Coin totalPot = tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit);
|
Coin totalPot = tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit);
|
||||||
// At mediation we require a min. payout to the losing party to keep incentive for the trader to accept the
|
// At mediation we require a min. payout to the losing party to keep incentive for the trader to accept the
|
||||||
// mediated payout. For Refund agent cases we do not have that restriction.
|
// mediated payout. For Refund agent cases we do not have that restriction.
|
||||||
Coin minRefundAtDispute = isMediationDispute() ? Restrictions.getMinRefundAtMediatedDispute() : Coin.ZERO;
|
Coin minRefundAtDispute = isMediationDispute() ? Restrictions.getMinRefundAtMediatedDispute(tradeAmount) : Coin.ZERO;
|
||||||
|
|
||||||
Coin penalizedPortionOfTradeAmount = Coin.ZERO;
|
Coin penalizedPortionOfTradeAmount = Coin.ZERO;
|
||||||
try {
|
try {
|
||||||
|
@ -1062,7 +1062,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||||
Coin sellerSecurityDeposit = offer.getSellerSecurityDeposit();
|
Coin sellerSecurityDeposit = offer.getSellerSecurityDeposit();
|
||||||
Coin tradeAmount = contract.getTradeAmount();
|
Coin tradeAmount = contract.getTradeAmount();
|
||||||
Coin totalPot = tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit);
|
Coin totalPot = tradeAmount.add(buyerSecurityDeposit).add(sellerSecurityDeposit);
|
||||||
Coin minRefundAtDispute = isMediationDispute() ? Restrictions.getMinRefundAtMediatedDispute() : Coin.ZERO;
|
Coin minRefundAtDispute = isMediationDispute() ? Restrictions.getMinRefundAtMediatedDispute(tradeAmount) : Coin.ZERO;
|
||||||
Coin maxPayoutAmount = totalPot.subtract(minRefundAtDispute);
|
Coin maxPayoutAmount = totalPot.subtract(minRefundAtDispute);
|
||||||
if (disputeResult.getBuyerPayoutAmount().equals(tradeAmount.add(buyerSecurityDeposit)) &&
|
if (disputeResult.getBuyerPayoutAmount().equals(tradeAmount.add(buyerSecurityDeposit)) &&
|
||||||
disputeResult.getSellerPayoutAmount().equals(sellerSecurityDeposit)) {
|
disputeResult.getSellerPayoutAmount().equals(sellerSecurityDeposit)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue