From 0966cfaceeaff1bdc7bd87babd360fc6a9e6bb23 Mon Sep 17 00:00:00 2001 From: Romano Date: Fri, 3 Aug 2018 16:13:59 +0200 Subject: [PATCH] List Viacoin (VIA) --- src/main/java/bisq/asset/coins/Viacoin.java | 40 +++++++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../java/bisq/asset/coins/ViacoinTest.java | 43 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 src/main/java/bisq/asset/coins/Viacoin.java create mode 100644 src/test/java/bisq/asset/coins/ViacoinTest.java diff --git a/src/main/java/bisq/asset/coins/Viacoin.java b/src/main/java/bisq/asset/coins/Viacoin.java new file mode 100644 index 0000000..c6feafb --- /dev/null +++ b/src/main/java/bisq/asset/coins/Viacoin.java @@ -0,0 +1,40 @@ +/* + * 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.Base58BitcoinAddressValidator; +import bisq.asset.Coin; +import bisq.asset.NetworkParametersAdapter; + +public class Viacoin extends Coin { + + public Viacoin() { + super("Viacoin", "VIA", new Base58BitcoinAddressValidator(new ViacoinParams())); + } + + + public static class ViacoinParams extends NetworkParametersAdapter { + + public ViacoinParams() { + super(); + addressHeader = 71; + p2shHeader = 33; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } +} diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset index ea8a817..c5ac9c7 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -112,6 +112,7 @@ bisq.asset.coins.Triton bisq.asset.coins.Ubiq bisq.asset.coins.Unobtanium bisq.asset.coins.VDinar +bisq.asset.coins.Viacoin bisq.asset.coins.Wacoin bisq.asset.coins.Wavi bisq.asset.coins.WorldMobileCoin diff --git a/src/test/java/bisq/asset/coins/ViacoinTest.java b/src/test/java/bisq/asset/coins/ViacoinTest.java new file mode 100644 index 0000000..626d0a8 --- /dev/null +++ b/src/test/java/bisq/asset/coins/ViacoinTest.java @@ -0,0 +1,43 @@ +/* + * 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 ViacoinTest extends AbstractAssetTest { + + public ViacoinTest() { + super(new Viacoin()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("VdMPvn7vUTSzbYjiMDs1jku9wAh1Ri2Y1A"); + assertValidAddress("EPt5g6LookySkqUNTwky24wTvzNrmKDP7r"); + assertValidAddress("EVt5ypcAfiCccFrdHxPbFwnEo5WDevawM7"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("1LgfapHEPhZbRF9pMd5WPT35hFXcZS1USrW"); + assertInvalidAddress("VgfapHEPhZbdRF9pMd5WPT35hFXcZS1USrW"); + assertInvalidAddress("EgfapHEPhZbRF9pMd5WPT35hFXcZS1USrW#"); + } +}