diff --git a/assets/src/main/java/bisq/asset/coins/HelpTheHomeless.java b/assets/src/main/java/bisq/asset/coins/HelpTheHomeless.java new file mode 100644 index 00000000000..d1b140f07fd --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/HelpTheHomeless.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 HelpTheHomeless extends Coin { + + public HelpTheHomeless() { + super("HelpTheHomeless", "HTH", new Base58BitcoinAddressValidator(new HelpTheHomelessParams())); + } + + + public static class HelpTheHomelessParams extends NetworkParametersAdapter { + + public HelpTheHomelessParams() { + addressHeader = 40; + p2shHeader = 16; + 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 96349c48e36..3b817b785ff 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -59,6 +59,7 @@ bisq.asset.coins.EtherClassic bisq.asset.coins.FuturoCoin bisq.asset.coins.Graft bisq.asset.coins.Gridcoin +bisq.asset.coins.HelpTheHomeless bisq.asset.coins.InfinityEconomics bisq.asset.coins.Instacash bisq.asset.coins.InternetOfPeople diff --git a/assets/src/test/java/bisq/asset/coins/HelpTheHomelessTest.java b/assets/src/test/java/bisq/asset/coins/HelpTheHomelessTest.java new file mode 100644 index 00000000000..24c35615caf --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/HelpTheHomelessTest.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 HelpTheHomelessTest extends AbstractAssetTest { + + public HelpTheHomelessTest() { + super(new HelpTheHomeless()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("HNbhe1Pfm2eH8d5NthFTzEZNwdzDJFKw6V"); + assertValidAddress("HErzbap76Sn6dWWCVhVcCbdhsVyHEjVYNy"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("Fnbhe1Pfm2eH8d5NthFTzEZNwdzDJHKw6V"); + assertInvalidAddress("HNBhe1Pfm2eh8d5NthFTzEZNwdzDJFKw6V"); + assertInvalidAddress("Kw6Ve1Pfm2eH8d5NthFTzEZNwdzDJFHNbh"); + assertInvalidAddress("Nbhe1Pfm2eH8d5NthFTzEZNwdzDJVKw6F#"); + assertInvalidAddress("VNbhe6Pfz2eH8d5NthFTmEZNwdzDJFKw1H"); + } +}