From 458426fc474b796e49a0ded313b4c8603dfae932 Mon Sep 17 00:00:00 2001 From: Evydder Date: Thu, 31 May 2018 01:20:30 +1000 Subject: [PATCH 1/2] List ZeroOneCoin (ZOC) --- .../java/bisq/asset/coins/ZeroOneCoin.java | 38 +++++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../bisq/asset/coins/ZeroOneCoinTest.java | 46 +++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/main/java/bisq/asset/coins/ZeroOneCoin.java create mode 100644 src/test/java/bisq/asset/coins/ZeroOneCoinTest.java diff --git a/src/main/java/bisq/asset/coins/ZeroOneCoin.java b/src/main/java/bisq/asset/coins/ZeroOneCoin.java new file mode 100644 index 0000000..d7a8678 --- /dev/null +++ b/src/main/java/bisq/asset/coins/ZeroOneCoin.java @@ -0,0 +1,38 @@ +/* + * 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.Base58BitcoinAddressValidator; +import bisq.asset.NetworkParametersAdapter; + +public class ZeroOneCoin extends Coin { + + public ZeroOneCoin() { + super("01coin", "ZOC", new Base58BitcoinAddressValidator(new ZeroOneCoinAddressParams())); + } + + public static class ZeroOneCoinAddressParams extends NetworkParametersAdapter { + + public ZeroOneCoinAddressParams() { + addressHeader = 80; + p2shHeader = 10; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } +} \ No newline at end of file diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset index 6f35640..4de32cb 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -102,6 +102,7 @@ bisq.asset.coins.Yenten bisq.asset.coins.Zcash bisq.asset.coins.Zcoin bisq.asset.coins.ZenCash +bisq.asset.coins.ZeroOneCoin bisq.asset.tokens.BetterBetting bisq.asset.tokens.DaiStablecoin bisq.asset.tokens.Ellaism diff --git a/src/test/java/bisq/asset/coins/ZeroOneCoinTest.java b/src/test/java/bisq/asset/coins/ZeroOneCoinTest.java new file mode 100644 index 0000000..0dfdac6 --- /dev/null +++ b/src/test/java/bisq/asset/coins/ZeroOneCoinTest.java @@ -0,0 +1,46 @@ +/* + * 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 ZeroOneCoinTest extends AbstractAssetTest { + + public ZeroOneCoinTest() { + super(new ZeroOneCoin()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("ZN17ww22Kg1cqM2VykoDwZW4fCTCvxGQMb"); + assertValidAddress("ZZJG1oqJ9VWHAy5AuE7bAugqoYvcGtPJcH"); + assertValidAddress("ZaUSzTWurWuaBw4zr8E4oEN25DzJK9vwbR"); + assertValidAddress("5AchYc7iQS7ynce7hNZ6Ya8djsbm5N9JBS"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("ZaUSzTWurWuaBw4zr8E4oEN25DzJK9vqqe"); + assertInvalidAddress("ZN17ww22Kg1cqM2VykoDwZW4fCTCvxGQM"); + assertInvalidAddress("ZaUSzTWurWuaBw4zr8E4oEN25DzJK9vwbb"); + assertInvalidAddress("Zb17ww22Kg1cqM2VykoDwZW4fCTCvxGQMb"); + } + +} \ No newline at end of file From a1dd4a09af359f346d82e650ac7dd32bedb32ef4 Mon Sep 17 00:00:00 2001 From: Bernard Labno Date: Tue, 26 Jun 2018 10:14:39 +0200 Subject: [PATCH 2/2] Apply Bisq code style --- src/main/java/bisq/asset/coins/ZeroOneCoin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/bisq/asset/coins/ZeroOneCoin.java b/src/main/java/bisq/asset/coins/ZeroOneCoin.java index d7a8678..0889fb5 100644 --- a/src/main/java/bisq/asset/coins/ZeroOneCoin.java +++ b/src/main/java/bisq/asset/coins/ZeroOneCoin.java @@ -17,8 +17,8 @@ package bisq.asset.coins; -import bisq.asset.Coin; import bisq.asset.Base58BitcoinAddressValidator; +import bisq.asset.Coin; import bisq.asset.NetworkParametersAdapter; public class ZeroOneCoin extends Coin { @@ -26,7 +26,7 @@ public class ZeroOneCoin extends Coin { public ZeroOneCoin() { super("01coin", "ZOC", new Base58BitcoinAddressValidator(new ZeroOneCoinAddressParams())); } - + public static class ZeroOneCoinAddressParams extends NetworkParametersAdapter { public ZeroOneCoinAddressParams() { @@ -35,4 +35,4 @@ public ZeroOneCoinAddressParams() { acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; } } -} \ No newline at end of file +}