mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Merge pull request #2929 from a123b/fix-low-volume-offer-edit
Fix offer editing for low volume offers
This commit is contained in:
commit
6e1f5ef203
1 changed files with 11 additions and 1 deletions
|
@ -23,6 +23,7 @@ import bisq.desktop.main.offer.MutableOfferDataModel;
|
|||
import bisq.core.btc.TxFeeEstimationService;
|
||||
import bisq.core.btc.wallet.BsqWalletService;
|
||||
import bisq.core.btc.wallet.BtcWalletService;
|
||||
import bisq.core.btc.wallet.Restrictions;
|
||||
import bisq.core.filter.FilterManager;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
@ -114,7 +115,6 @@ class EditOfferDataModel extends MutableOfferDataModel {
|
|||
CurrencyUtil.getTradeCurrency(offer.getCurrencyCode())
|
||||
.ifPresent(c -> this.tradeCurrency = c);
|
||||
tradeCurrencyCode.set(offer.getCurrencyCode());
|
||||
buyerSecurityDeposit.set(CoinUtil.getAsPercentPerBtc(offer.getBuyerSecurityDeposit(), offer.getAmount()));
|
||||
|
||||
this.initialState = openOffer.getState();
|
||||
PaymentAccount tmpPaymentAccount = user.getPaymentAccount(openOffer.getOffer().getMakerPaymentAccountId());
|
||||
|
@ -128,6 +128,16 @@ class EditOfferDataModel extends MutableOfferDataModel {
|
|||
paymentAccount.setSelectedTradeCurrency(selectedTradeCurrency);
|
||||
}
|
||||
|
||||
// If the security deposit got bounded because it was below the coin amount limit, it can be bigger
|
||||
// by percentage than the restriction. We can't determine the percentage originally entered at offer
|
||||
// creation, so just use the default value as it doesn't matter anyway.
|
||||
double buyerSecurityDepositPercent = CoinUtil.getAsPercentPerBtc(offer.getBuyerSecurityDeposit(), offer.getAmount());
|
||||
if (buyerSecurityDepositPercent > Restrictions.getMaxBuyerSecurityDepositAsPercent(this.paymentAccount)
|
||||
&& offer.getBuyerSecurityDeposit().value == Restrictions.getMinBuyerSecurityDepositAsCoin().value)
|
||||
buyerSecurityDeposit.set(Restrictions.getDefaultBuyerSecurityDepositAsPercent(this.paymentAccount));
|
||||
else
|
||||
buyerSecurityDeposit.set(buyerSecurityDepositPercent);
|
||||
|
||||
allowAmountUpdate = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue