mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 11:39:29 +00:00
desktop app creates offers with floating market price
This commit is contained in:
parent
369e562362
commit
f91db182d8
3 changed files with 7 additions and 4 deletions
|
@ -133,6 +133,12 @@ public class CreateOfferService {
|
|||
minAmount,
|
||||
buyerSecurityDepositAsDouble);
|
||||
|
||||
// verify fixed price xor market price with margin
|
||||
if (price != null) {
|
||||
if (useMarketBasedPrice) throw new IllegalArgumentException("Can create offer with fixed price or floating market price but not both");
|
||||
if (marketPriceMargin != 0) throw new IllegalArgumentException("Cannot set market price margin with fixed price");
|
||||
}
|
||||
|
||||
long creationTime = new Date().getTime();
|
||||
NodeAddress makerAddress = p2PService.getAddress();
|
||||
boolean useMarketBasedPriceValue = price == null &&
|
||||
|
|
|
@ -293,7 +293,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
|
|||
tradeCurrencyCode.get(),
|
||||
amount.get(),
|
||||
minAmount.get(),
|
||||
price.get(),
|
||||
useMarketBasedPrice.get() ? null : price.get(),
|
||||
Coin.ZERO,
|
||||
useMarketBasedPrice.get(),
|
||||
marketPriceMargin,
|
||||
|
|
|
@ -676,11 +676,8 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
|||
// On focus out we do validation and apply the data to the model
|
||||
void onFocusOutAmountTextField(boolean oldValue, boolean newValue) {
|
||||
if (oldValue && !newValue) {
|
||||
System.out.println("Checking if input valid: " + amount.get());
|
||||
InputValidator.ValidationResult result = isXmrInputValid(amount.get());
|
||||
amountValidationResult.set(result);
|
||||
System.out.println("Result is valid: " + result.isValid);
|
||||
System.out.println("Result error: " + result.errorMessage);
|
||||
if (result.isValid) {
|
||||
setAmountToModel();
|
||||
ignoreAmountStringListener = true;
|
||||
|
|
Loading…
Reference in a new issue