Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move utility logic from desktop offer models to OfferUtil (2) #4666

Closed

Conversation

ghubstan
Copy link
Member

This is the second preliminary refactoring to prepare for a new core.api takeoffer impl. This effort is restrained by desktop models' dependencies on JFX properties, which cannot be used as arguments to the core OfferUtil.

#4654 has to be reviewed & merged before this PR.

Changes include:

  • Moving utility logic into OfferUtil from OfferDataModel and MutableOfferDataModel.

  • Injecting OfferUtil into TakeOfferDataModel, for parent OfferDataModel.

  • Removing unused TradeManager from OfferBook.

  • Moving isHalCashAccount acct type check to abstract PaymentAccount.

  • Moving getTradeCurrency logic to abstract PaymentAccount from MutableOfferDataModel's setTradeCurrencyFromPaymentAccount, and changing affected classes: MutableOfferView, MutableOfferViewModel.

This is a preliminary refactoring for a new core TakeOfferModel, which
is going to need logic (for api 'takeoffer') currently located in the
unaccessible desktop module's offer package.

This change injects service dependencies into the OfferUtil instance and
removes those service dependency arguments from formerly static method
signatures.

Other changes include:

- Moving some Volume calc methods from OfferUtil to VolumeUtil.

- Moving some Coin calc methods from OfferUtil to CoinUtil.

- Injecting OfferUtil into CreateOfferService and relevant
  offer data & view models.

- Minor changes to TradeStatistics2, Trade, Offer & Contract, to use
  static methods moved from OfferUtil to the new VolumeUtil class.

- Deletion of bisq.desktop.main.offer.MakerFeeProvider,
  and bisq.core.offer.MakerFeeProvider.  They were unnecessary
  wrappers around a single OfferUtil method.

- Renaming OfferUtilTest -> CoinUtilTest.

- Moving tests in CoinCryptoUtilsTest to CoinUtilTest, and deleting
  CoinCryptoUtilsTest.

- Adjusting affected offer data & view model tests.
This is the second prelimiary refactoring to prepare for a new
core.api takeoffer impl.  This effort is restrained by the desktop
models' dependency on JFX properties, which could not be passed
as arguments to the core OfferUtil.

Changes include:

- Moving utility logic into OfferUtil from OfferDataModel and
  MutableOfferDataModel.

- Injecting OfferUtil into TakeOfferDataModel, for parent OfferDataModel.

- Removing unused TradeManager from OfferBook.

- Moving 'isHalCashAccount' acct type check to abstract PaymentAccount.

- Moving 'getTradeCurrency' logic to abstract PaymentAccount from
  MutableOfferDataModel's 'setTradeCurrencyFromPaymentAccount',
  and changing affected classes:  MutableOfferView, MutableOfferViewModel.
@ghubstan ghubstan added this to In progress in Ship Bisq Daemon and API Oct 17, 2020
@ghubstan
Copy link
Member Author

Closing, too many file conflicts in this PR chain, after 1.4.x merge into main, will redo.

@ghubstan ghubstan closed this Oct 20, 2020
Ship Bisq Daemon and API automation moved this from In progress to Done Oct 20, 2020
@ghubstan ghubstan deleted the refactor-offer-models-2 branch October 22, 2020 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant