From e29fbee12aa1433c8c447ffb226d3d783f7ccf9a Mon Sep 17 00:00:00 2001 From: Technohacker Date: Sun, 8 Jul 2018 18:58:22 +0530 Subject: [PATCH 1/2] List Ryo (RYO) --- src/main/java/bisq/asset/coins/Ryo.java | 28 +++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + src/test/java/bisq/asset/coins/RyoTest.java | 49 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 src/main/java/bisq/asset/coins/Ryo.java create mode 100644 src/test/java/bisq/asset/coins/RyoTest.java diff --git a/src/main/java/bisq/asset/coins/Ryo.java b/src/main/java/bisq/asset/coins/Ryo.java new file mode 100644 index 0000000..94ad77e --- /dev/null +++ b/src/main/java/bisq/asset/coins/Ryo.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 Ryo extends Coin { + + public Ryo() { + super("Ryo", "RYO", new RegexAddressValidator("^((RYoL|RYoS)[0-9A-Za-z]{95}|(RYoK)[0-9A-Za-z]{51})$")); + } +} diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset index ea8a817..504d492 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -96,6 +96,7 @@ bisq.asset.coins.PRiVCY bisq.asset.coins.ReddCoin bisq.asset.coins.Ringo bisq.asset.coins.Roicoin +bisq.asset.coins.Ryo bisq.asset.coins.SafeFileSystemCoin bisq.asset.coins.Semux bisq.asset.coins.Siacoin diff --git a/src/test/java/bisq/asset/coins/RyoTest.java b/src/test/java/bisq/asset/coins/RyoTest.java new file mode 100644 index 0000000..516cfe2 --- /dev/null +++ b/src/test/java/bisq/asset/coins/RyoTest.java @@ -0,0 +1,49 @@ +/* + * 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 RyoTest extends AbstractAssetTest { + + public RyoTest() { + super(new Ryo()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("RYoLsinT9duNEtHGqAUicJKD2cmGiB9gB6sqHqWvV6suB4TtPSR8ynyh2vVVvNyDE6g7WEaBxCG8GD1KM2ffWP7FLXgeJbNYrp2"); + assertValidAddress("RYoSrJ7ES1wGsikGHFm69SU6dTTKt8Vi6V7BoC3wsLcc1Y2CXgQkW7vHSe5uArGU9TjUC5RtvzhCycVDnPPbThTmZA8VqDzTPeM"); + assertValidAddress("RYoKst8YBCucSywKDshsywbjc5uCi8ybSUtWgvM3LfzaYe93d4qqpsJ"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress(""); + assertInvalidAddress("RYoLsinT9duNEtHGqAUicJKD2cmGiB9gB6sqHqWvV6suB4TtPSR8ynyh2vVVvNyDE6g7WEaBxCG8GD1KM2ffWP7FLXgeJbNYrp"); + assertInvalidAddress("RYoLsjCoYrxag2pPoDDTB4cRriKCNn8WjhY99kqjYuNTfE4MU2Yo1CPdpyK7PXpxDcAd5YDNerE6WCc4cVQvEbxLaHk4UcvbRp23"); + assertInvalidAddress("RYoLsinT9duNEtHGqAUicJKD2cmGiB9gB6sqHqWvV6suB4TtPSR8ynyh2vVVvNyDE6g7W!!!xCG8GD1KM2ffWP7FLXgeJbNYrp2"); + assertInvalidAddress("RYoSrJ7ES1wGsikGHFm69SU6dTTKt8Vi6V7BoC3wsLcc1Y2CXgQkW7vHSe5uArGU9TjUC5RtvzhCycVDnPPbThTmZA8VqDzTPe"); + assertInvalidAddress("RYoSrJ7ES1wGsikGHFm69SU6dTTKt8Vi6V7BoC3wsLcc1Y2CXgQkW7vHSe5uArGU9TjUC5RtvzhCycVDnPPbThTmZA8VqDzTPeM1"); + assertInvalidAddress("RYoNsBB18NdcSywKDshsywbjc5uCi8ybSUtWgvM3LfzaYe93d6DEu3PcSywKDshsywbjc5uCi8ybSUtWgvM3LfzaYe93d96NjjvBCYU2SZD2of"); + assertInvalidAddress("RYoKst8YBCucSywKDshsywbjc5uCi8ybSUtWgvM3LfzaYe93d4qqpsJC"); + assertInvalidAddress("RYoKst8YBCucSywKDshsywbjc5uCi8ybSUtWgvM3LfzaYe93d4qqps"); + assertInvalidAddress("RYost8YBCucSywKDshsywbjc5uCi8ybSUtWgvM3LfzaYe93d4qqpsJ"); + } +} From 8176ae2301cdd6238b7604469ec295496c7e00a7 Mon Sep 17 00:00:00 2001 From: Bernard Labno Date: Fri, 27 Jul 2018 12:50:24 +0200 Subject: [PATCH 2/2] Apply bisq code style --- src/test/java/bisq/asset/coins/RyoTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/bisq/asset/coins/RyoTest.java b/src/test/java/bisq/asset/coins/RyoTest.java index 516cfe2..4eafe6c 100644 --- a/src/test/java/bisq/asset/coins/RyoTest.java +++ b/src/test/java/bisq/asset/coins/RyoTest.java @@ -18,6 +18,7 @@ package bisq.asset.coins; import bisq.asset.AbstractAssetTest; + import org.junit.Test; public class RyoTest extends AbstractAssetTest {