Merge branch 'Development' of https://github.com/WildCryptoICO/exchange into WildCryptoICO-Development

This commit is contained in:
Manfred Karrer 2018-01-09 21:34:18 +01:00
commit 516d130a5c
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
3 changed files with 21 additions and 0 deletions

View File

@ -149,6 +149,7 @@ public class CurrencyUtil {
result.add(new CryptoCurrency("XZC", "Zcoin"));
result.add(new CryptoCurrency("ZEC", "Zcash"));
result.add(new CryptoCurrency("ZEN", "ZenCash"));
result.add(new CryptoCurrency("WILD", "WILD Token", true));
result.sort(TradeCurrency::compareTo);
// Util for printing all altcoins for adding to FAQ page

View File

@ -391,6 +391,12 @@ public final class AltCoinAddressValidator extends InputValidator {
} catch (AddressFormatException e) {
return new ValidationResult(false, getErrorMessage(e));
}
case "WILD":
// https://github.com/ethereum/web3.js/blob/master/lib/utils/utils.js#L403
if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
return regexTestFailed;
else
return new ValidationResult(true);
// Add new coins at the end...
default:
log.debug("Validation for AltCoinAddress not implemented yet. currencyCode: " + currencyCode);

View File

@ -457,4 +457,18 @@ public class AltCoinAddressValidatorTest {
assertFalse(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#").isValid);
assertFalse(validator.validate("").isValid);
}
@Test
public void testWILD() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("WILD");
assertTrue(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
assertTrue(validator.validate("2a65Aca4D5fC5B5C859090a6c34d164135398226").isValid);
assertFalse(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266").isValid);
assertFalse(validator.validate("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g").isValid);
assertFalse(validator.validate("2a65Aca4D5fC5B5C859090a6c34d16413539822g").isValid);
assertFalse(validator.validate("").isValid);
}
}