Fix take offer fee (was using create offer fee)

This commit is contained in:
Manfred Karrer 2016-03-16 22:34:17 +01:00
parent ec62d5bc38
commit ee4119b2e6
5 changed files with 17 additions and 16 deletions

View file

@ -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);
}

View file

@ -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() {

View file

@ -816,7 +816,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
addPayInfoEntry(infoGridPane, i++, BSResources.get("takeOffer.fundsBox.tradeAmount"), model.getAmount());
addPayInfoEntry(infoGridPane, i++, BSResources.get("takeOffer.fundsBox.securityDeposit"), model.getSecurityDeposit());
addPayInfoEntry(infoGridPane, i++, BSResources.get("takeOffer.fundsBox.offerFee"), model.getOfferFee());
addPayInfoEntry(infoGridPane, i++, BSResources.get("takeOffer.fundsBox.offerFee"), model.getTakerFee());
addPayInfoEntry(infoGridPane, i++, BSResources.get("takeOffer.fundsBox.networkFee"), model.getNetworkFee());
Separator separator = new Separator();
separator.setOrientation(Orientation.HORIZONTAL);

View file

@ -555,8 +555,8 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
return formatter.formatCoinWithCode(dataModel.amountAsCoin.get());
}
String getOfferFee() {
return formatter.formatCoinWithCode(dataModel.getOfferFeeAsCoin());
String getTakerFee() {
return formatter.formatCoinWithCode(dataModel.getTakerFeeAsCoin());
}
String getNetworkFee() {

View file

@ -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