Add check for DAO (presale date)

This commit is contained in:
Manfred Karrer 2016-05-25 00:08:38 +02:00
parent 30c568af8b
commit 7b2f90cfd6
3 changed files with 22 additions and 15 deletions

View File

@ -73,11 +73,7 @@ public class CurrencyUtil {
public static List<CryptoCurrency> createAllSortedCryptoCurrenciesList() {
final List<CryptoCurrency> 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<CryptoCurrency> getMainCryptoCurrencies() {
final List<CryptoCurrency> 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"));

View File

@ -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();
});
}

View File

@ -136,6 +136,7 @@ public class AltCoinAccountsView extends ActivatableViewAndModel<GridPane, AltCo
.closeButtonText("I understand and confirm that I know which wallet I need to use.")
.show();
}
if (!model.getPaymentAccounts().stream().filter(e -> {
if (e.getAccountName() != null)
return e.getAccountName().equals(paymentAccount.getAccountName());