Skip to content
This repository has been archived by the owner on Jun 17, 2020. It is now read-only.

Commit

Permalink
Extract Ubiq
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernard Labno committed Mar 29, 2018
1 parent 0fc1a38 commit 97584a7
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 6 deletions.
29 changes: 29 additions & 0 deletions src/main/java/bisq/asset/coins/Ubiq.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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.asset.coins;

import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;

public class Ubiq extends Coin {

public Ubiq() {
super("Ubiq", "UBQ", new RegexAddressValidator("^(0x)?[0-9a-fA-F]{40}$"));
}

}
1 change: 0 additions & 1 deletion src/main/java/bisq/core/locale/CurrencyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ private static List<CryptoCurrency> createAllSortedCryptoCurrenciesList() {
result.add(new CryptoCurrency("XZC", "Zcoin"));

// Added 0.7.0
result.add(new CryptoCurrency("UBQ", "Ubiq"));
result.add(new CryptoCurrency("QWARK", "Qwark", true));
result.add(new CryptoCurrency("GEO", "GeoCoin", true));
result.add(new CryptoCurrency("GRANS", "10grans", true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ public ValidationResult validate(String input) {
}

switch (currencyCode) {
case "UBQ":
if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
return regexTestFailed;
else
return new ValidationResult(true);
case "QWARK":
if (!input.matches("^(0x)?[0-9a-fA-F]{40}$"))
return regexTestFailed;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/services/bisq.asset.Asset
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ bisq.asset.coins.SpeedCash
bisq.asset.coins.Stellite
bisq.asset.coins.Strayacoin
bisq.asset.coins.Terracoin
bisq.asset.coins.Ubiq
bisq.asset.coins.VDinar
bisq.asset.coins.Wacoin
bisq.asset.coins.WorldMobileCoin
Expand Down
42 changes: 42 additions & 0 deletions src/test/java/bisq/asset/coins/UbiqTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.asset.coins;

import bisq.asset.AbstractAssetTest;

import org.junit.Test;

public class UbiqTest extends AbstractAssetTest {

public UbiqTest() {
super(new Ubiq());
}

@Test
public void testValidAddresses() {
assertValidAddress("0x2a65Aca4D5fC5B5C859090a6c34d164135398226");
assertValidAddress("2a65Aca4D5fC5B5C859090a6c34d164135398226");
}

@Test
public void testInvalidAddresses() {
assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d1641353982266");
assertInvalidAddress("0x2a65Aca4D5fC5B5C859090a6c34d16413539822g");
assertInvalidAddress("2a65Aca4D5fC5B5C859090a6c34d16413539822g");
}
}

0 comments on commit 97584a7

Please sign in to comment.