diff --git a/src/main/java/bisq/asset/coins/MicroCoin.java b/src/main/java/bisq/asset/coins/MicroCoin.java new file mode 100644 index 0000000..b62dae0 --- /dev/null +++ b/src/main/java/bisq/asset/coins/MicroCoin.java @@ -0,0 +1,28 @@ +/* + * 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 . + */ + +package bisq.asset.coins; + +import bisq.asset.Coin; +import bisq.asset.RegexAddressValidator; + +public class MicroCoin extends Coin { + + public MicroCoin() { + super("MicroCoin", "MCC", new RegexAddressValidator("([0-9]+\\-[0-9]{2})")); + } +} diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset index 20da1e0..006b136 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -59,6 +59,7 @@ bisq.asset.coins.Madcoin bisq.asset.coins.MaidSafeCoin bisq.asset.coins.Mazacoin bisq.asset.coins.MFCoin +bisq.asset.coins.MicroCoin bisq.asset.coins.Monero bisq.asset.coins.Namecoin bisq.asset.coins.NavCoin diff --git a/src/test/java/bisq/asset/coins/MicroCoinTest.java b/src/test/java/bisq/asset/coins/MicroCoinTest.java new file mode 100644 index 0000000..567816e --- /dev/null +++ b/src/test/java/bisq/asset/coins/MicroCoinTest.java @@ -0,0 +1,44 @@ +/* + * 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 . + */ + +package bisq.asset.coins; + +import bisq.asset.AbstractAssetTest; + +import org.junit.Test; + +public class MicroCoinTest extends AbstractAssetTest { + + public MicroCoinTest() { + super(new MicroCoin()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("0-10"); + assertValidAddress("80-80"); + assertValidAddress("5502-18"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("1QbFeFc3iqRYhemqq7VZNX1SN5NtKa8UQFxw"); + assertInvalidAddress("5502"); + assertInvalidAddress("24-1234"); + assertInvalidAddress("555-6"); + } +}