[bisq-network/bisq] Refactor OfferUtil into an injected service (#4654)

Stan notifications at github.com
Thu Oct 15 21:00:01 UTC 2020


This is a preliminary refactoring for a new core `TakeOfferModel` to be included in the next PR, which is going to need logic currently located in the inaccessible desktop module's offer package.    (A new api `takeoffer` method will depend on core `TakeOfferModel`.)

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.
You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/4654

-- Commit Summary --

  * Refactor OfferUtil into an injected service
  * Reformat, tidy up OfferUtil
  * Add license comment, reformat CoinUtilTest
  * Reformat desktop createoffer view & data model tests
  * Reformat desktop EditOfferDataModelTest

-- File Changes --

    M core/src/main/java/bisq/core/offer/CreateOfferService.java (22)
    D core/src/main/java/bisq/core/offer/MakerFeeProvider.java (29)
    M core/src/main/java/bisq/core/offer/Offer.java (5)
    M core/src/main/java/bisq/core/offer/OfferUtil.java (288)
    M core/src/main/java/bisq/core/trade/Contract.java (6)
    M core/src/main/java/bisq/core/trade/Trade.java (6)
    M core/src/main/java/bisq/core/trade/statistics/TradeStatistics2.java (4)
    A core/src/main/java/bisq/core/util/VolumeUtil.java (50)
    M core/src/main/java/bisq/core/util/coin/CoinUtil.java (108)
    D core/src/test/java/bisq/core/util/CoinCryptoUtilsTest.java (60)
    R core/src/test/java/bisq/core/util/coin/CoinUtilTest.java (56)
    D desktop/src/main/java/bisq/desktop/main/offer/MakerFeeProvider.java (13)
    M desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java (29)
    M desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java (25)
    M desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java (6)
    M desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java (6)
    M desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java (18)
    M desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferViewModel.java (22)
    M desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java (6)
    M desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java (6)
    M desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModelTest.java (36)
    M desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java (44)
    M desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java (29)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/4654.patch
https://github.com/bisq-network/bisq/pull/4654.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4654
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201015/3b99f41d/attachment.html>


More information about the bisq-github mailing list