From ee4119b2e682d2dd7fd1c4e01cfe07f3a22c4d8d Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Wed, 16 Mar 2016 22:34:17 +0100 Subject: [PATCH] Fix take offer fee (was using create offer fee) --- core/src/main/java/io/bitsquare/btc/FeePolicy.java | 11 ++++++----- .../gui/main/offer/takeoffer/TakeOfferDataModel.java | 12 ++++++------ .../gui/main/offer/takeoffer/TakeOfferView.java | 2 +- .../gui/main/offer/takeoffer/TakeOfferViewModel.java | 4 ++-- .../main/resources/i18n/displayStrings.properties | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/io/bitsquare/btc/FeePolicy.java b/core/src/main/java/io/bitsquare/btc/FeePolicy.java index 70ed50fef5..a1261dda00 100644 --- a/core/src/main/java/io/bitsquare/btc/FeePolicy.java +++ b/core/src/main/java/io/bitsquare/btc/FeePolicy.java @@ -70,15 +70,16 @@ public class FeePolicy { } - // 0.001 BTC 0.1% of 1 BTC about 0.4 EUR @ 400 EUR/BTC + // 0.0005 BTC 0.05% of 1 BTC about 0.2 EUR @ 400 EUR/BTC public static Coin getCreateOfferFee() { - // We cannot reduce it more for alpha testing as we need to pay the quite high miner fee of 30_000 - return Coin.valueOf(100_000); + // We need to pay the quite high miner fee of 30_000 from the trading fee tx so 30_000 us our lower limit + // The arbitrator receive only 0.0002 BTC - less than the miners + return Coin.valueOf(50_000); } - // Currently we use the same fee for both offerer and taker + // 0.001 BTC 0.1% of 1 BTC about 0.4 EUR @ 400 EUR/BTC public static Coin getTakeOfferFee() { - return getCreateOfferFee(); + return Coin.valueOf(100_000); } diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferDataModel.java b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferDataModel.java index 6bd0ae16b4..c271dfb0cb 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferDataModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferDataModel.java @@ -72,7 +72,7 @@ class TakeOfferDataModel extends ActivatableDataModel { private final BlockchainService blockchainService; private final BSFormatter formatter; - private final Coin offerFeeAsCoin; + private final Coin takerFeeAsCoin; private final Coin networkFeeAsCoin; private final Coin securityDepositAsCoin; @@ -112,7 +112,7 @@ class TakeOfferDataModel extends ActivatableDataModel { this.blockchainService = blockchainService; this.formatter = formatter; - offerFeeAsCoin = FeePolicy.getCreateOfferFee(); + takerFeeAsCoin = FeePolicy.getTakeOfferFee(); networkFeeAsCoin = FeePolicy.getFixedTxFeeForTrades(); securityDepositAsCoin = FeePolicy.getSecurityDeposit(); } @@ -316,9 +316,9 @@ class TakeOfferDataModel extends ActivatableDataModel { void calculateTotalToPay() { if (getDirection() == Offer.Direction.SELL) - totalToPayAsCoin.set(offerFeeAsCoin.add(networkFeeAsCoin).add(securityDepositAsCoin)); + totalToPayAsCoin.set(takerFeeAsCoin.add(networkFeeAsCoin).add(securityDepositAsCoin)); else - totalToPayAsCoin.set(offerFeeAsCoin.add(networkFeeAsCoin).add(securityDepositAsCoin).add(amountAsCoin.get())); + totalToPayAsCoin.set(takerFeeAsCoin.add(networkFeeAsCoin).add(securityDepositAsCoin).add(amountAsCoin.get())); } private void updateBalance(@NotNull Coin balance) { @@ -369,8 +369,8 @@ class TakeOfferDataModel extends ActivatableDataModel { return securityDepositAsCoin; } - public Coin getOfferFeeAsCoin() { - return offerFeeAsCoin; + public Coin getTakerFeeAsCoin() { + return takerFeeAsCoin; } public Coin getNetworkFeeAsCoin() { diff --git a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java index 4c3361c59c..d149e81562 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/offer/takeoffer/TakeOfferView.java @@ -816,7 +816,7 @@ public class TakeOfferView extends ActivatableViewAndModel im return formatter.formatCoinWithCode(dataModel.amountAsCoin.get()); } - String getOfferFee() { - return formatter.formatCoinWithCode(dataModel.getOfferFeeAsCoin()); + String getTakerFee() { + return formatter.formatCoinWithCode(dataModel.getTakerFeeAsCoin()); } String getNetworkFee() { diff --git a/gui/src/main/resources/i18n/displayStrings.properties b/gui/src/main/resources/i18n/displayStrings.properties index 2e5894b7ea..46215a0f94 100644 --- a/gui/src/main/resources/i18n/displayStrings.properties +++ b/gui/src/main/resources/i18n/displayStrings.properties @@ -57,7 +57,7 @@ createOffer.fundsBox.balance=Trade wallet balance: createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment. createOffer.fundsBox.tradeAmount=Trade amount: createOffer.fundsBox.securityDeposit=Security deposit: -createOffer.fundsBox.offerFee=Offer fee: +createOffer.fundsBox.offerFee=Create offer fee: createOffer.fundsBox.networkFee=Mining fee: createOffer.fundsBox.total=Total: createOffer.fundsBox.showAdvanced=Show advanced settings @@ -116,7 +116,7 @@ takeOffer.fundsBox.sell.info=For every offer there is a dedicated trade wallet. funds will be paid in to a locked deposit address. At the end of a successful trade you will get back your security deposit. takeOffer.fundsBox.tradeAmount=Amount to sell: takeOffer.fundsBox.securityDeposit=Security deposit: -takeOffer.fundsBox.offerFee=Offer fee: +takeOffer.fundsBox.offerFee=Take offer fee: takeOffer.fundsBox.networkFee=Mining fee: takeOffer.fundsBox.total=Total: takeOffer.fundsBox.showAdvanced=Show advanced settings