Skip to content

Commit

Permalink
Merge branch '7-more-grpcproto-comments' into 8-remove-trdstats-service
Browse files Browse the repository at this point in the history
  • Loading branch information
ghubstan committed Feb 26, 2022
2 parents 2e9e51e + 3d33aa2 commit a1f059d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/bisq/core/api/CoreApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public void createAndPlaceOffer(String currencyCode,
Consumer<Offer> resultHandler) {
coreOffersService.createAndPlaceOffer(currencyCode,
directionAsString,
price,
useMarketBasedPrice ? "0" : price,
useMarketBasedPrice,
marketPriceMargin,
amountAsLong,
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/bisq/core/api/CoreOffersService.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void createAndPlaceBsqSwapOffer(String directionAsString,
String offerId = getRandomOfferId();
OfferDirection direction = OfferDirection.valueOf(directionAsString.toUpperCase());
Coin amount = Coin.valueOf(amountAsLong);
Coin minAmount = Coin.valueOf(minAmountAsLong);
Coin minAmount = minAmountAsLong == 0 ? amount : Coin.valueOf(minAmountAsLong);
Price price = Price.valueOf(currencyCode, priceStringToLong(priceAsString, currencyCode));
openBsqSwapOfferService.requestNewOffer(offerId,
direction,
Expand Down Expand Up @@ -294,7 +294,7 @@ void createAndPlaceOffer(String currencyCode,
OfferDirection direction = OfferDirection.valueOf(directionAsString.toUpperCase());
Price price = Price.valueOf(upperCaseCurrencyCode, priceStringToLong(priceAsString, upperCaseCurrencyCode));
Coin amount = Coin.valueOf(amountAsLong);
Coin minAmount = Coin.valueOf(minAmountAsLong);
Coin minAmount = minAmountAsLong == 0 ? amount : Coin.valueOf(minAmountAsLong);
Coin useDefaultTxFee = Coin.ZERO;

// Almost ready to call createOfferService.createAndGetOffer(), but first:
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/bisq/core/api/EditOfferValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class EditOfferValidator {
int newEnable,
EditOfferRequest.EditType editType) {
this.currentlyOpenOffer = currentlyOpenOffer;
this.newPrice = newPrice;
this.newPrice = newPrice.isBlank() ? "0" : newPrice;
// The client cannot determine what offer.isUseMarketBasedPrice should be
// when editType = ACTIVATION_STATE_ONLY. Override newIsUseMarketBasedPrice
// param for the ACTIVATION_STATE_ONLY case.
Expand All @@ -78,12 +78,12 @@ class EditOfferValidator {
? currentlyOpenOffer.getOffer().isUseMarketBasedPrice()
: newIsUseMarketBasedPrice;
this.newMarketPriceMargin = newMarketPriceMargin;
this.newTriggerPrice = newTriggerPrice;
this.newTriggerPrice = newTriggerPrice.isBlank() ? "0" : newTriggerPrice;
this.newEnable = newEnable;
this.editType = editType;

this.isZeroEditedFixedPriceString = new BigDecimal(newPrice).doubleValue() == 0;
this.isZeroEditedTriggerPrice = new BigDecimal(newTriggerPrice).equals(ZERO);
this.isZeroEditedFixedPriceString = new BigDecimal(this.newPrice).doubleValue() == 0;
this.isZeroEditedTriggerPrice = new BigDecimal(this.newTriggerPrice).equals(ZERO);
}

EditOfferValidator validate() {
Expand Down

0 comments on commit a1f059d

Please sign in to comment.