mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #6593 from jmacxx/limit_min_max_deviation
Limit offer min/max amount deviation to 50%.
This commit is contained in:
commit
b88cd58f24
@ -522,6 +522,8 @@ createOffer.resetToDefault=No, reset to the default value
|
|||||||
createOffer.useLowerValue=Yes, use my lower value
|
createOffer.useLowerValue=Yes, use my lower value
|
||||||
createOffer.priceOutSideOfDeviation=The price you have entered is outside the max. allowed deviation from the market price.\nThe max. allowed deviation is {0} and can be adjusted in the preferences.
|
createOffer.priceOutSideOfDeviation=The price you have entered is outside the max. allowed deviation from the market price.\nThe max. allowed deviation is {0} and can be adjusted in the preferences.
|
||||||
createOffer.changePrice=Change price
|
createOffer.changePrice=Change price
|
||||||
|
createOffer.amountsOutSideOfDeviation=The BTC amounts ({0} - {1}) are out of range.\nThe minimum amount cannot be less than 50% of the max.
|
||||||
|
createOffer.changeAmount=Change amount
|
||||||
createOffer.tac=With publishing this offer I agree to trade with any trader who fulfills the conditions as defined in this screen.
|
createOffer.tac=With publishing this offer I agree to trade with any trader who fulfills the conditions as defined in this screen.
|
||||||
createOffer.setDeposit=Set buyer's security deposit (%)
|
createOffer.setDeposit=Set buyer's security deposit (%)
|
||||||
createOffer.setDepositAsBuyer=Set my security deposit as buyer (%)
|
createOffer.setDepositAsBuyer=Set my security deposit as buyer (%)
|
||||||
|
@ -1149,7 +1149,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
|||||||
});
|
});
|
||||||
|
|
||||||
nextButton.setOnAction(e -> {
|
nextButton.setOnAction(e -> {
|
||||||
if (model.isPriceInRange()) {
|
if (model.isPriceInRange() && model.areAmountsInRange()) {
|
||||||
if (DevEnv.isDaoTradingActivated())
|
if (DevEnv.isDaoTradingActivated())
|
||||||
showFeeOption();
|
showFeeOption();
|
||||||
else
|
else
|
||||||
|
@ -965,6 +965,27 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
|||||||
// Getters
|
// Getters
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public boolean areAmountsInRange() {
|
||||||
|
// Limit the minimum trade amount when creating an offer to 50% of the max amount.
|
||||||
|
// github.com/bisq-network/projects/issues/67
|
||||||
|
if (dataModel.getMinAmount().get().isLessThan(dataModel.getAmount().get().divide(2))) {
|
||||||
|
displayAmountsOutOfRangePopup();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayAmountsOutOfRangePopup() {
|
||||||
|
Popup popup = new Popup();
|
||||||
|
popup.warning(Res.get("createOffer.amountsOutSideOfDeviation",
|
||||||
|
dataModel.getMinAmount().get().toPlainString(),
|
||||||
|
dataModel.getAmount().get().toPlainString()))
|
||||||
|
.actionButtonText(Res.get("createOffer.changeAmount"))
|
||||||
|
.onAction(popup::hide)
|
||||||
|
.hideCloseButton()
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isPriceInRange() {
|
public boolean isPriceInRange() {
|
||||||
if (marketPriceMargin.get() != null && !marketPriceMargin.get().isEmpty()) {
|
if (marketPriceMargin.get() != null && !marketPriceMargin.get().isEmpty()) {
|
||||||
if (Math.abs(ParsingUtils.parsePercentStringToDouble(marketPriceMargin.get())) > preferences.getMaxPriceDistanceInPercent()) {
|
if (Math.abs(ParsingUtils.parsePercentStringToDouble(marketPriceMargin.get())) > preferences.getMaxPriceDistanceInPercent()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user