Skip to content

Commit

Permalink
rename MakerFeeMaker => MakerFeeProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
christophsturm committed Aug 14, 2019
1 parent 9b41cb8 commit 5579c30
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import org.bitcoinj.core.Coin;

public class MakerFeeMaker {
public class MakerFeeProvider {
public Coin getMakerFee(BsqWalletService bsqWalletService, Preferences preferences, Coin amount) {
return OfferUtil.getMakerFee(bsqWalletService, preferences, amount);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
private final TxFeeEstimationService txFeeEstimationService;
private final ReferralIdService referralIdService;
private final BSFormatter btcFormatter;
private MakerFeeMaker makerFeeMaker;
private MakerFeeProvider makerFeeProvider;
private final String offerId;
private final BalanceListener btcBalanceListener;
private final SetChangeListener<PaymentAccount> paymentAccountsChangeListener;
Expand Down Expand Up @@ -159,7 +159,7 @@ public MutableOfferDataModel(OpenOfferManager openOfferManager,
TxFeeEstimationService txFeeEstimationService,
ReferralIdService referralIdService,
BSFormatter btcFormatter,
MakerFeeMaker makerFeeMaker) {
MakerFeeProvider makerFeeProvider) {
super(btcWalletService);

this.openOfferManager = openOfferManager;
Expand All @@ -175,7 +175,7 @@ public MutableOfferDataModel(OpenOfferManager openOfferManager,
this.txFeeEstimationService = txFeeEstimationService;
this.referralIdService = referralIdService;
this.btcFormatter = btcFormatter;
this.makerFeeMaker = makerFeeMaker;
this.makerFeeProvider = makerFeeProvider;

offerId = Utilities.getRandomPrefix(5, 8) + "-" +
UUID.randomUUID().toString() + "-" +
Expand Down Expand Up @@ -805,7 +805,7 @@ public Coin getMakerFee(boolean isCurrencyForMakerFeeBtc) {
}

public Coin getMakerFee() {
return makerFeeMaker.getMakerFee(bsqWalletService, preferences, amount.get());
return makerFeeProvider.getMakerFee(bsqWalletService, preferences, amount.get());
}

public Coin getMakerFeeInBtc() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package bisq.desktop.main.offer.createoffer;

import bisq.desktop.main.offer.MakerFeeMaker;
import bisq.desktop.main.offer.MakerFeeProvider;
import bisq.desktop.main.offer.MutableOfferDataModel;

import bisq.core.account.witness.AccountAgeWitnessService;
Expand Down Expand Up @@ -65,7 +65,7 @@ public CreateOfferDataModel(OpenOfferManager openOfferManager,
TxFeeEstimationService txFeeEstimationService,
ReferralIdService referralIdService,
BSFormatter btcFormatter,
MakerFeeMaker makerFeeMaker) {
MakerFeeProvider makerFeeProvider) {
super(openOfferManager,
btcWalletService,
bsqWalletService,
Expand All @@ -80,6 +80,6 @@ public CreateOfferDataModel(OpenOfferManager openOfferManager,
txFeeEstimationService,
referralIdService,
btcFormatter,
makerFeeMaker);
makerFeeProvider);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package bisq.desktop.main.portfolio.editoffer;


import bisq.desktop.main.offer.MakerFeeMaker;
import bisq.desktop.main.offer.MakerFeeProvider;
import bisq.desktop.main.offer.MutableOfferDataModel;

import bisq.core.account.witness.AccountAgeWitnessService;
Expand Down Expand Up @@ -75,7 +75,7 @@ class EditOfferDataModel extends MutableOfferDataModel {
ReferralIdService referralIdService,
BSFormatter btcFormatter,
CorePersistenceProtoResolver corePersistenceProtoResolver,
MakerFeeMaker makerFeeMaker) {
MakerFeeProvider makerFeeProvider) {
super(openOfferManager,
btcWalletService,
bsqWalletService,
Expand All @@ -90,7 +90,7 @@ class EditOfferDataModel extends MutableOfferDataModel {
txFeeEstimationService,
referralIdService,
btcFormatter,
makerFeeMaker);
makerFeeProvider);
this.corePersistenceProtoResolver = corePersistenceProtoResolver;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bisq.desktop.main.offer.createoffer;

import bisq.desktop.main.offer.MakerFeeMaker;
import bisq.desktop.main.offer.MakerFeeProvider;

import bisq.core.btc.TxFeeEstimationService;
import bisq.core.btc.model.AddressEntry;
Expand Down Expand Up @@ -36,7 +36,7 @@ public class CreateOfferDataModelTest {
private CreateOfferDataModel model;
private User user;
private Preferences preferences;
private MakerFeeMaker makerFeeMaker;
private MakerFeeProvider makerFeeProvider;

@Before
public void setUp() {
Expand All @@ -56,12 +56,12 @@ public void setUp() {
when(preferences.isUsePercentageBasedPrice()).thenReturn(true);
when(preferences.getBuyerSecurityDepositAsPercent(null)).thenReturn(0.01);

makerFeeMaker = mock(MakerFeeMaker.class);
makerFeeProvider = mock(MakerFeeProvider.class);
model = new CreateOfferDataModel(null, btcWalletService,
null, preferences, user, null,
null, priceFeedService, null,
null, feeService, feeEstimationService,
null, null, makerFeeMaker);
null, null, makerFeeProvider);
}

@Test
Expand All @@ -78,7 +78,7 @@ public void testUseTradeCurrencySetInOfferViewWhenInPaymentAccountAvailable() {

when(user.getPaymentAccounts()).thenReturn(paymentAccounts);
when(preferences.getSelectedPaymentAccountForCreateOffer()).thenReturn(revolutAccount);
when(makerFeeMaker.getMakerFee(any(), any(), any())).thenReturn(Coin.ZERO);
when(makerFeeProvider.getMakerFee(any(), any(), any())).thenReturn(Coin.ZERO);

model.initWithData(OfferPayload.Direction.BUY, new FiatCurrency("USD"));
assertEquals("USD", model.getTradeCurrencyCode().get());
Expand All @@ -98,7 +98,7 @@ public void testUseTradeAccountThatMatchesTradeCurrencySetInOffer() {
when(user.getPaymentAccounts()).thenReturn(paymentAccounts);
when(user.findFirstPaymentAccountWithCurrency(new FiatCurrency("USD"))).thenReturn(zelleAccount);
when(preferences.getSelectedPaymentAccountForCreateOffer()).thenReturn(revolutAccount);
when(makerFeeMaker.getMakerFee(any(), any(), any())).thenReturn(Coin.ZERO);
when(makerFeeProvider.getMakerFee(any(), any(), any())).thenReturn(Coin.ZERO);

model.initWithData(OfferPayload.Direction.BUY, new FiatCurrency("USD"));
assertEquals("USD", model.getTradeCurrencyCode().get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package bisq.desktop.main.offer.createoffer;

import bisq.desktop.main.offer.MakerFeeMaker;
import bisq.desktop.main.offer.MakerFeeProvider;
import bisq.desktop.util.validation.AltcoinValidator;
import bisq.desktop.util.validation.BtcValidator;
import bisq.desktop.util.validation.FiatPriceValidator;
Expand Down Expand Up @@ -104,7 +104,7 @@ public void setUp() {
when(bsqFormatter.formatCoin(any())).thenReturn("0");
when(bsqWalletService.getAvailableConfirmedBalance()).thenReturn(Coin.ZERO);

CreateOfferDataModel dataModel = new CreateOfferDataModel(null, btcWalletService, bsqWalletService, empty, user, null, null, priceFeedService, null, accountAgeWitnessService, feeService, txFeeEstimationService, null, bsFormatter, mock(MakerFeeMaker.class));
CreateOfferDataModel dataModel = new CreateOfferDataModel(null, btcWalletService, bsqWalletService, empty, user, null, null, priceFeedService, null, accountAgeWitnessService, feeService, txFeeEstimationService, null, bsFormatter, mock(MakerFeeProvider.class));
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin"));
dataModel.activate();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bisq.desktop.main.portfolio.editoffer;

import bisq.desktop.main.offer.MakerFeeMaker;
import bisq.desktop.main.offer.MakerFeeProvider;
import bisq.desktop.util.validation.SecurityDepositValidator;

import bisq.core.account.witness.AccountAgeWitnessService;
Expand Down Expand Up @@ -93,7 +93,7 @@ public void setUp() {
btcWalletService, bsqWalletService, empty, user,
null, null, priceFeedService, null,
accountAgeWitnessService, feeService, null, null,
null, null, mock(MakerFeeMaker.class));
null, null, mock(MakerFeeProvider.class));
}

@Test
Expand Down

0 comments on commit 5579c30

Please sign in to comment.