From 7b2f90cfd626960e99edf0c688a5fb945ed62797 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Wed, 25 May 2016 00:08:38 +0200 Subject: [PATCH] Add check for DAO (presale date) --- .../io/bitsquare/locale/CurrencyUtil.java | 16 ++------------- .../paymentmethods/CryptoCurrencyForm.java | 20 ++++++++++++++++++- .../altcoinaccounts/AltCoinAccountsView.java | 1 + 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/io/bitsquare/locale/CurrencyUtil.java b/core/src/main/java/io/bitsquare/locale/CurrencyUtil.java index 1bb0f2af04..089fe86c12 100644 --- a/core/src/main/java/io/bitsquare/locale/CurrencyUtil.java +++ b/core/src/main/java/io/bitsquare/locale/CurrencyUtil.java @@ -73,11 +73,7 @@ public class CurrencyUtil { public static List createAllSortedCryptoCurrenciesList() { final List result = new ArrayList<>(); result.add(new CryptoCurrency("ETH", "Ether")); - - // TODO DAO will be open for sale on 28.5. Check can be removed at next release. - if (new GregorianCalendar().after(new GregorianCalendar(2016, Calendar.MAY, 28))) - result.add(new CryptoCurrency("DAO", "DAO")); - + result.add(new CryptoCurrency("DAO", "DAO")); result.add(new CryptoCurrency("LTC", "Litecoin")); result.add(new CryptoCurrency("NMC", "Namecoin")); result.add(new CryptoCurrency("DASH", "Dash")); @@ -127,10 +123,6 @@ public class CurrencyUtil { result.add(new CryptoCurrency("ERC", "Europecoin")); result.add(new CryptoCurrency("POST", "PostCoin")); - // For MKR we need a extra info box: - // It's very important that users only use EIP-20 compliant contract wallets. - // Modern mist wallets should be able to do it but there are some older mist versions that can't. - // result.add(new CryptoCurrency("XMR", "Monero")); // result.add(new CryptoCurrency("BCN", "Bytecoin")); return result; @@ -139,11 +131,7 @@ public class CurrencyUtil { public static List getMainCryptoCurrencies() { final List result = new ArrayList<>(); result.add(new CryptoCurrency("ETH", "Ether")); - - // TODO DAO will be open for sale on 28.5. Check can be removed at next release. - if (new GregorianCalendar().after(new GregorianCalendar(2016, Calendar.MAY, 28))) - result.add(new CryptoCurrency("DAO", "DAO")); - + result.add(new CryptoCurrency("DAO", "DAO")); result.add(new CryptoCurrency("LTC", "Litecoin")); result.add(new CryptoCurrency("DASH", "Dash")); result.add(new CryptoCurrency("SDC", "ShadowCash")); diff --git a/gui/src/main/java/io/bitsquare/gui/components/paymentmethods/CryptoCurrencyForm.java b/gui/src/main/java/io/bitsquare/gui/components/paymentmethods/CryptoCurrencyForm.java index 20efa33b4a..a603528be2 100644 --- a/gui/src/main/java/io/bitsquare/gui/components/paymentmethods/CryptoCurrencyForm.java +++ b/gui/src/main/java/io/bitsquare/gui/components/paymentmethods/CryptoCurrencyForm.java @@ -19,6 +19,7 @@ package io.bitsquare.gui.components.paymentmethods; import io.bitsquare.common.util.Tuple2; import io.bitsquare.gui.components.InputTextField; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.Layout; import io.bitsquare.gui.util.validation.AltCoinAddressValidator; @@ -40,6 +41,8 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Calendar; +import java.util.GregorianCalendar; import java.util.Optional; import static io.bitsquare.gui.util.FormBuilder.*; @@ -151,7 +154,22 @@ public class CryptoCurrencyForm extends PaymentMethodForm { } }); currencyComboBox.setOnAction(e -> { - paymentAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem()); + TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem(); + if (selectedItem != null) { + String code = selectedItem.getCode(); + // TODO DAO will be open for sale on 28.5. Check can be removed at next release. + if (code.equals("DAO") && new GregorianCalendar().before(new GregorianCalendar(2016, Calendar.MAY, 28))) { + new Popup().information("The DAO tokens are not tradable before the pre-sale is over (28th of May).\n" + + "From the 28th of May on you can setup a DAO account and trade DAO tokens in Bitsquare.") + .closeButtonText("I understand") + .onClose(() -> currencyComboBox.getSelectionModel().clearSelection()) + .show(); + + return; + } + } + + paymentAccount.setSingleTradeCurrency(selectedItem); updateFromInputs(); }); } diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java b/gui/src/main/java/io/bitsquare/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java index 22c3f274ab..68859d5e1b 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/content/altcoinaccounts/AltCoinAccountsView.java @@ -136,6 +136,7 @@ public class AltCoinAccountsView extends ActivatableViewAndModel { if (e.getAccountName() != null) return e.getAccountName().equals(paymentAccount.getAccountName());