mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-12 16:35:37 -04:00
remove DAO
Co-authored-by: premek <1145361+premek@users.noreply.github.com>
This commit is contained in:
parent
f9f2cd07c3
commit
cefba8e4b5
621 changed files with 583 additions and 68805 deletions
|
@ -4,7 +4,6 @@ import bisq.desktop.app.BisqAppModule;
|
|||
import bisq.desktop.common.view.CachingViewLoader;
|
||||
import bisq.desktop.common.view.ViewLoader;
|
||||
import bisq.desktop.common.view.guice.InjectorViewFactory;
|
||||
import bisq.desktop.main.dao.bonding.BondingViewUtils;
|
||||
import bisq.desktop.main.funds.transactions.DisplayedTransactionsFactory;
|
||||
import bisq.desktop.main.funds.transactions.TradableRepository;
|
||||
import bisq.desktop.main.funds.transactions.TransactionAwareTradableFactory;
|
||||
|
@ -12,7 +11,6 @@ import bisq.desktop.main.funds.transactions.TransactionListItemFactory;
|
|||
import bisq.desktop.main.offer.offerbook.OfferBook;
|
||||
import bisq.desktop.main.overlays.notifications.NotificationCenter;
|
||||
import bisq.desktop.main.overlays.windows.TorNetworkSettingsWindow;
|
||||
import bisq.desktop.main.presentation.DaoPresentation;
|
||||
import bisq.desktop.main.presentation.MarketPricePresentation;
|
||||
import bisq.desktop.util.Transitions;
|
||||
|
||||
|
@ -46,7 +44,6 @@ import bisq.core.support.dispute.mediation.mediator.MediatorService;
|
|||
import bisq.core.support.traderchat.TraderChatManager;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.user.User;
|
||||
import bisq.core.util.coin.BsqFormatter;
|
||||
|
||||
import bisq.network.p2p.network.BridgeAddressProvider;
|
||||
import bisq.network.p2p.seed.SeedNodeRepository;
|
||||
|
@ -92,17 +89,14 @@ public class GuiceSetupTest {
|
|||
assertSingleton(Navigation.class);
|
||||
assertSingleton(InjectorViewFactory.class);
|
||||
assertSingleton(NotificationCenter.class);
|
||||
assertSingleton(BsqFormatter.class);
|
||||
assertSingleton(TorNetworkSettingsWindow.class);
|
||||
assertSingleton(MarketPricePresentation.class);
|
||||
assertSingleton(ViewLoader.class);
|
||||
assertSingleton(DaoPresentation.class);
|
||||
assertSingleton(Transitions.class);
|
||||
assertSingleton(TradableRepository.class);
|
||||
assertSingleton(TransactionListItemFactory.class);
|
||||
assertSingleton(TransactionAwareTradableFactory.class);
|
||||
assertSingleton(DisplayedTransactionsFactory.class);
|
||||
assertSingleton(BondingViewUtils.class);
|
||||
|
||||
// core module
|
||||
// assertSingleton(BisqSetup.class); // this is a can of worms
|
||||
|
|
|
@ -39,7 +39,6 @@ public class MarketsPrintTool {
|
|||
|
||||
final Collection<FiatCurrency> allSortedFiatCurrencies = CurrencyUtil.getAllSortedFiatCurrencies();
|
||||
final Stream<MarketCurrency> fiatStream = allSortedFiatCurrencies.stream()
|
||||
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BSQ"))
|
||||
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BTC")) // TODO (woodser): update to XMR
|
||||
.map(e -> new MarketCurrency("btc_" + e.getCode().toLowerCase(), e.getName(), e.getCode()))
|
||||
.distinct();
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bisq is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.main.dao.monitor.daostate;
|
||||
|
||||
import bisq.core.dao.monitoring.model.DaoStateBlock;
|
||||
import bisq.core.dao.monitoring.model.DaoStateHash;
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
public class DaoStateBlockListItemTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
Locale.setDefault(new Locale("en", "US"));
|
||||
Res.setBaseCurrencyCode("XMR");
|
||||
Res.setBaseCurrencyName("Monero");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsAndHashCode() {
|
||||
var block = new DaoStateBlock(new DaoStateHash(0, new byte[0], new byte[0]));
|
||||
var item1 = new DaoStateBlockListItem(block, newSupplier(1));
|
||||
var item2 = new DaoStateBlockListItem(block, newSupplier(2));
|
||||
var item3 = new DaoStateBlockListItem(block, newSupplier(1));
|
||||
assertNotEquals(item1, item2);
|
||||
assertNotEquals(item2, item3);
|
||||
assertEquals(item1, item3);
|
||||
assertEquals(item1.hashCode(), item3.hashCode());
|
||||
}
|
||||
|
||||
private IntSupplier newSupplier(int i) {
|
||||
//noinspection Convert2Lambda
|
||||
return new IntSupplier() {
|
||||
@Override
|
||||
public int getAsInt() {
|
||||
return i;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -83,7 +83,6 @@ public class TradesChartsViewModelTest {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
|
|
@ -67,7 +67,6 @@ public class CreateOfferDataModelTest {
|
|||
null,
|
||||
offerUtil,
|
||||
btcWalletService,
|
||||
null,
|
||||
preferences,
|
||||
user,
|
||||
null,
|
||||
|
|
|
@ -24,7 +24,6 @@ import bisq.desktop.util.validation.SecurityDepositValidator;
|
|||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.btc.model.XmrAddressEntry;
|
||||
import bisq.core.btc.wallet.BsqWalletService;
|
||||
import bisq.core.btc.wallet.XmrWalletService;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CryptoCurrency;
|
||||
|
@ -41,7 +40,6 @@ import bisq.core.provider.price.PriceFeedService;
|
|||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.user.User;
|
||||
import bisq.core.util.coin.BsqFormatter;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.coin.ImmutableCoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
@ -93,8 +91,6 @@ public class CreateOfferViewModelTest {
|
|||
User user = mock(User.class);
|
||||
PaymentAccount paymentAccount = mock(PaymentAccount.class);
|
||||
Preferences preferences = mock(Preferences.class);
|
||||
BsqFormatter bsqFormatter = mock(BsqFormatter.class);
|
||||
BsqWalletService bsqWalletService = mock(BsqWalletService.class);
|
||||
SecurityDepositValidator securityDepositValidator = mock(SecurityDepositValidator.class);
|
||||
AccountAgeWitnessService accountAgeWitnessService = mock(AccountAgeWitnessService.class);
|
||||
CreateOfferService createOfferService = mock(CreateOfferService.class);
|
||||
|
@ -116,8 +112,6 @@ public class CreateOfferViewModelTest {
|
|||
when(securityDepositValidator.validate(any())).thenReturn(new InputValidator.ValidationResult(false));
|
||||
when(accountAgeWitnessService.getMyTradeLimit(any(), any(), any())).thenReturn(100000000L);
|
||||
when(preferences.getUserCountry()).thenReturn(new Country("ES", "Spain", null));
|
||||
when(bsqFormatter.formatCoin(any())).thenReturn("0");
|
||||
when(bsqWalletService.getAvailableConfirmedBalance()).thenReturn(Coin.ZERO);
|
||||
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
|
||||
when(tradeStats.getObservableTradeStatisticsSet()).thenReturn(FXCollections.observableSet());
|
||||
|
||||
|
@ -125,7 +119,6 @@ public class CreateOfferViewModelTest {
|
|||
null,
|
||||
offerUtil,
|
||||
xmrWalletService,
|
||||
bsqWalletService,
|
||||
empty,
|
||||
user,
|
||||
null,
|
||||
|
@ -143,14 +136,12 @@ public class CreateOfferViewModelTest {
|
|||
fiatPriceValidator,
|
||||
altcoinValidator,
|
||||
btcValidator,
|
||||
null,
|
||||
securityDepositValidator,
|
||||
priceFeedService,
|
||||
null,
|
||||
null,
|
||||
preferences,
|
||||
coinFormatter,
|
||||
bsqFormatter,
|
||||
offerUtil);
|
||||
model.activate();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ import bisq.core.payment.payload.SpecificBanksAccountPayload;
|
|||
import bisq.core.provider.price.MarketPrice;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
import bisq.core.util.coin.BsqFormatter;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.coin.ImmutableCoinFormatter;
|
||||
|
||||
|
@ -239,7 +238,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
assertEquals(0, model.maxPlacesForAmount.intValue());
|
||||
}
|
||||
|
||||
|
@ -253,7 +252,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
model.activate();
|
||||
|
||||
assertEquals(6, model.maxPlacesForAmount.intValue());
|
||||
|
@ -271,7 +270,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
model.activate();
|
||||
|
||||
assertEquals(15, model.maxPlacesForAmount.intValue());
|
||||
|
@ -290,7 +289,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
assertEquals(0, model.maxPlacesForVolume.intValue());
|
||||
}
|
||||
|
||||
|
@ -304,7 +303,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
model.activate();
|
||||
|
||||
assertEquals(5, model.maxPlacesForVolume.intValue());
|
||||
|
@ -322,7 +321,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
model.activate();
|
||||
|
||||
assertEquals(9, model.maxPlacesForVolume.intValue());
|
||||
|
@ -341,7 +340,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
assertEquals(0, model.maxPlacesForPrice.intValue());
|
||||
}
|
||||
|
||||
|
@ -355,7 +354,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
model.activate();
|
||||
|
||||
assertEquals(7, model.maxPlacesForPrice.intValue());
|
||||
|
@ -373,7 +372,7 @@ public class OfferBookViewModelTest {
|
|||
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
assertEquals(0, model.maxPlacesForMarketPriceMargin.intValue());
|
||||
}
|
||||
|
||||
|
@ -401,7 +400,7 @@ public class OfferBookViewModelTest {
|
|||
offerBookListItems.addAll(item1, item2);
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, priceFeedService,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
model.activate();
|
||||
|
||||
assertEquals(8, model.maxPlacesForMarketPriceMargin.intValue()); //" (1.97%)"
|
||||
|
@ -422,7 +421,7 @@ public class OfferBookViewModelTest {
|
|||
when(priceFeedService.getMarketPrice(anyString())).thenReturn(new MarketPrice("USD", 12684.0450, Instant.now().getEpochSecond(), true));
|
||||
|
||||
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null,
|
||||
null, null, null, getPriceUtil(), null, coinFormatter, new BsqFormatter());
|
||||
null, null, null, getPriceUtil(), null, coinFormatter);
|
||||
|
||||
final OfferBookListItem item = make(btcBuyItem.but(
|
||||
with(useMarketBasedPrice, true),
|
||||
|
@ -607,7 +606,6 @@ public class OfferBookViewModelTest {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
|
|
@ -4,7 +4,6 @@ import bisq.desktop.util.validation.SecurityDepositValidator;
|
|||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.btc.model.XmrAddressEntry;
|
||||
import bisq.core.btc.wallet.BsqWalletService;
|
||||
import bisq.core.btc.wallet.XmrWalletService;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CryptoCurrency;
|
||||
|
@ -22,7 +21,6 @@ import bisq.core.provider.price.PriceFeedService;
|
|||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.user.User;
|
||||
import bisq.core.util.coin.BsqFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
@ -72,8 +70,6 @@ public class EditOfferDataModelTest {
|
|||
user = mock(User.class);
|
||||
PaymentAccount paymentAccount = mock(PaymentAccount.class);
|
||||
Preferences preferences = mock(Preferences.class);
|
||||
BsqFormatter bsqFormatter = mock(BsqFormatter.class);
|
||||
BsqWalletService bsqWalletService = mock(BsqWalletService.class);
|
||||
SecurityDepositValidator securityDepositValidator = mock(SecurityDepositValidator.class);
|
||||
AccountAgeWitnessService accountAgeWitnessService = mock(AccountAgeWitnessService.class);
|
||||
CreateOfferService createOfferService = mock(CreateOfferService.class);
|
||||
|
@ -93,15 +89,12 @@ public class EditOfferDataModelTest {
|
|||
when(securityDepositValidator.validate(any())).thenReturn(new InputValidator.ValidationResult(false));
|
||||
when(accountAgeWitnessService.getMyTradeLimit(any(), any(), any())).thenReturn(100000000L);
|
||||
when(preferences.getUserCountry()).thenReturn(new Country("US", "United States", null));
|
||||
when(bsqFormatter.formatCoin(any())).thenReturn("0");
|
||||
when(bsqWalletService.getAvailableConfirmedBalance()).thenReturn(Coin.ZERO);
|
||||
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
|
||||
|
||||
model = new EditOfferDataModel(createOfferService,
|
||||
null,
|
||||
offerUtil,
|
||||
xmrWalletService,
|
||||
bsqWalletService,
|
||||
empty,
|
||||
user,
|
||||
null,
|
||||
|
|
|
@ -63,7 +63,6 @@ public class OfferMaker {
|
|||
0L,
|
||||
0L,
|
||||
0L,
|
||||
false,
|
||||
0L,
|
||||
0L,
|
||||
0L,
|
||||
|
|
|
@ -45,9 +45,7 @@ public class PreferenceMakers {
|
|||
lookup.valueOf(config, new SameValueDonor<Config>(null)),
|
||||
lookup.valueOf(feeService, new SameValueDonor<FeeService>(null)),
|
||||
lookup.valueOf(localBitcoinNode, new SameValueDonor<LocalBitcoinNode>(null)),
|
||||
lookup.valueOf(useTorFlagFromOptions, new SameValueDonor<String>(null)),
|
||||
lookup.valueOf(referralID, new SameValueDonor<String>(null)),
|
||||
Config.DEFAULT_FULL_DAO_NODE, null, null, Config.UNSPECIFIED_PORT);
|
||||
lookup.valueOf(useTorFlagFromOptions, new SameValueDonor<String>(null)));
|
||||
|
||||
public static final Preferences empty = make(a(Preferences));
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ public class CurrencyListTest {
|
|||
private static final TradeCurrency RUR = new FiatCurrency(Currency.getInstance("RUR"), locale);
|
||||
private static final TradeCurrency BTC = new CryptoCurrency("BTC", "Bitcoin");
|
||||
private static final TradeCurrency ETH = new CryptoCurrency("ETH", "Ether");
|
||||
private static final TradeCurrency BSQ = new CryptoCurrency("BSQ", "Bisq Token");
|
||||
|
||||
private Preferences preferences;
|
||||
private List<CurrencyListItem> delegate;
|
||||
|
@ -106,7 +105,7 @@ public class CurrencyListTest {
|
|||
when(preferences.isSortMarketCurrenciesNumerically()).thenReturn(true);
|
||||
|
||||
List<TradeCurrency> currencies = Lists.newArrayList(USD, RUR, USD, ETH, ETH, BTC);
|
||||
CurrencyListItem first = new CurrencyListItem(BSQ, 5);
|
||||
CurrencyListItem first = new CurrencyListItem(BTC, 5);
|
||||
testedEntity.updateWithCurrencies(currencies, first);
|
||||
|
||||
List<CurrencyListItem> expected = Lists.newArrayList(
|
||||
|
|
|
@ -25,7 +25,6 @@ import bisq.core.provider.price.MarketPrice;
|
|||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.user.DontShowAgainLookup;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.coin.BsqFormatter;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.CoinMaker;
|
||||
|
@ -114,18 +113,6 @@ public class GUIUtilTest {
|
|||
*/
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBsqInUsd() {
|
||||
PriceFeedService priceFeedService = mock(PriceFeedService.class);
|
||||
when(priceFeedService.getMarketPrice("USD"))
|
||||
.thenReturn(new MarketPrice("USD", 12345.6789, 0, true));
|
||||
|
||||
Coin oneBsq = Coin.valueOf(100);
|
||||
Price avgPrice = Price.valueOf("BSQ", 10000);
|
||||
|
||||
assertEquals("1.23 USD", GUIUtil.getBsqInUsd(avgPrice, oneBsq, priceFeedService, new BsqFormatter()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void percentageOfTradeAmount_higherFeeAsMin() {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue