Merge pull request #1342 from reverendus/list-dai-token

Add DAI Token
This commit is contained in:
Manfred Karrer 2018-02-13 20:11:56 -05:00 committed by GitHub
commit 2f04d1ca89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 0 deletions

View File

@ -102,6 +102,7 @@ public class CurrencyUtil {
result.add(new CryptoCurrency("XCP", "Counterparty"));
result.add(new CryptoCurrency("CREA", "Creativecoin"));
result.add(new CryptoCurrency("XCN", "Cryptonite"));
result.add(new CryptoCurrency("DAI", "Dai Stablecoin", true));
result.add(new CryptoCurrency("DNET", "DarkNet"));
if (!baseCurrencyCode.equals("DASH"))
result.add(new CryptoCurrency("DASH", "Dash"));

View File

@ -251,6 +251,7 @@ public class TradeStatisticsManager {
newlyAdded.add("BETR");
newlyAdded.add("MVT");
newlyAdded.add("REF");
newlyAdded.add("DAI");
coinsWithValidator.addAll(newlyAdded);

View File

@ -196,6 +196,12 @@ public final class AltCoinAddressValidator extends InputValidator {
return regexTestFailed;
else
return new ValidationResult(true);
case "DAI":
// 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);
case "PIVX":
if (input.matches("^[D][a-km-zA-HJ-NP-Z1-9]{25,34}$")) {
//noinspection ConstantConditions

View File

@ -128,6 +128,20 @@ public class AltCoinAddressValidatorTest {
assertFalse(validator.validate("").isValid);
}
@Test
public void testDAI() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();
validator.setCurrencyCode("DAI");
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);
}
@Test
public void testPIVX() {
AltCoinAddressValidator validator = new AltCoinAddressValidator();