Return correct security deposit percentage size when cloning an offer

This commit is contained in:
BtcContributor 2021-05-11 17:39:18 +02:00
parent 993f9b4e29
commit 1ba42e0d91
No known key found for this signature in database
GPG Key ID: DA582457496C7F6D
2 changed files with 8 additions and 1 deletions

View File

@ -639,7 +639,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
this.volume.set(volume);
}
void setBuyerSecurityDeposit(double value) {
protected void setBuyerSecurityDeposit(double value) {
this.buyerSecurityDeposit.set(value);
}

View File

@ -24,6 +24,7 @@ import bisq.desktop.main.offer.MutableOfferDataModel;
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.Restrictions;
import bisq.core.offer.CreateOfferService;
import bisq.core.offer.Offer;
import bisq.core.offer.OfferUtil;
@ -35,6 +36,7 @@ import bisq.core.user.Preferences;
import bisq.core.user.User;
import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.coin.CoinUtil;
import bisq.network.p2p.P2PService;
@ -84,7 +86,12 @@ class DuplicateOfferDataModel extends MutableOfferDataModel {
setAmount(offer.getAmount());
setPrice(offer.getPrice());
setVolume(offer.getVolume());
if (offer.getBuyerSecurityDeposit().value == Restrictions.getMinBuyerSecurityDepositAsCoin().getValue())
setBuyerSecurityDeposit(Restrictions.getMinBuyerSecurityDepositAsPercent());
else
setBuyerSecurityDeposit(CoinUtil.getAsPercentPerBtc(offer.getBuyerSecurityDeposit(), offer.getAmount()));
setUseMarketBasedPrice(offer.isUseMarketBasedPrice());
if (offer.isUseMarketBasedPrice()) {
setMarketPriceMargin(offer.getMarketPriceMargin());
}