From 406c0989a1abd19127316ce3d548984a49c4bbe2 Mon Sep 17 00:00:00 2001 From: John Salatas Date: Wed, 2 Oct 2019 19:02:54 -0700 Subject: [PATCH] List Faircoin (FAIR) --- .../main/java/bisq/asset/coins/Faircoin.java | 39 ++++++++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../java/bisq/asset/coins/FaircoinTest.java | 41 +++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 assets/src/main/java/bisq/asset/coins/Faircoin.java create mode 100644 assets/src/test/java/bisq/asset/coins/FaircoinTest.java diff --git a/assets/src/main/java/bisq/asset/coins/Faircoin.java b/assets/src/main/java/bisq/asset/coins/Faircoin.java new file mode 100644 index 00000000000..d94efa3a9a4 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/Faircoin.java @@ -0,0 +1,39 @@ +/* + * 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 Faircoin extends Coin { + + public Faircoin() { + super("Faircoin", "FAIR", new Base58BitcoinAddressValidator(new Faircoin.FaircoinParams())); + } + + public static class FaircoinParams extends NetworkParametersAdapter { + + public FaircoinParams() { + addressHeader = 95; + p2shHeader = 36; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } + +} diff --git a/assets/src/main/resources/META-INF/services/bisq.asset.Asset b/assets/src/main/resources/META-INF/services/bisq.asset.Asset index f1c7e0b0dae..1e398d994c0 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -43,6 +43,7 @@ bisq.asset.coins.Emercoin bisq.asset.coins.Ergo bisq.asset.coins.Ether bisq.asset.coins.EtherClassic +bisq.asset.coins.Faircoin bisq.asset.coins.FourtyTwo bisq.asset.coins.Fujicoin bisq.asset.coins.Galilel diff --git a/assets/src/test/java/bisq/asset/coins/FaircoinTest.java b/assets/src/test/java/bisq/asset/coins/FaircoinTest.java new file mode 100644 index 00000000000..4f4b85186f8 --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/FaircoinTest.java @@ -0,0 +1,41 @@ +/* + * 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; + +public class FaircoinTest extends AbstractAssetTest { + + public FaircoinTest() { + super(new Faircoin()); + } + + @Override + public void testValidAddresses() { + assertValidAddress("fLsJC1Njap5NxSArYr5wCJbKBbTQfWikY6"); + assertValidAddress("FZHzHraqjty2Co7TinwcsBtPKoz5ANvgRd"); + assertValidAddress("fHbXBBBjU1xxEVmWEtAEwXnoBDxxsxfvxg"); + } + + @Override + public void testInvalidAddresses() { + assertInvalidAddress("FLsJC1Njap5NxSArYr5wCJbKBbTQfWikY6"); + assertInvalidAddress("fZHzHraqjty2Co7TinwcsBtPKoz5ANvgRd"); + assertInvalidAddress("1HbXBBBjU1xxEVmWEtAEwXnoBDxxsxfvxg"); + } +}