From bd9de9e0c230971aefd134d815b03aedb96071b3 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Tue, 29 May 2018 17:46:19 +0200 Subject: [PATCH] List CryptoTari (TARI) --- src/main/java/bisq/asset/tokens/Tari.java | 32 ++++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + src/test/java/bisq/asset/tokens/TariTest.java | 43 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/main/java/bisq/asset/tokens/Tari.java create mode 100644 src/test/java/bisq/asset/tokens/TariTest.java diff --git a/src/main/java/bisq/asset/tokens/Tari.java b/src/main/java/bisq/asset/tokens/Tari.java new file mode 100644 index 0000000..dfc6b31 --- /dev/null +++ b/src/main/java/bisq/asset/tokens/Tari.java @@ -0,0 +1,32 @@ +/* + * 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 . + * + * CryptoTari is a stellar token issued by account: + * GD7UVDDJHJYKUXB4SJFIC6VJDQ4YADQCMRN3KLHJFV4H6NIUAEREVCO7 + * block explorer: https://stellarchain.io/ + */ + +package bisq.asset.tokens; + +import bisq.asset.RegexAddressValidator; +import bisq.asset.Token; + +public class Tari extends Token { + + public Tari() { + super("CryptoTari", "TARI", new RegexAddressValidator("^[a-zA-Z0-9]{56}$")); + } +} diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset index 20da1e0..e23dc39 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -115,5 +115,6 @@ bisq.asset.tokens.PiedPiperCoin bisq.asset.tokens.Qwark bisq.asset.tokens.RefToken bisq.asset.tokens.SosCoin +bisq.asset.tokens.Tari bisq.asset.tokens.Verify bisq.asset.tokens.WildToken diff --git a/src/test/java/bisq/asset/tokens/TariTest.java b/src/test/java/bisq/asset/tokens/TariTest.java new file mode 100644 index 0000000..7704f83 --- /dev/null +++ b/src/test/java/bisq/asset/tokens/TariTest.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.tokens; + +import bisq.asset.AbstractAssetTest; + +import org.junit.Test; + +public class TariTest extends AbstractAssetTest { + + public TariTest() { + super(new Tari()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("GCQQRNVHDV5JGDLK7XNVF5HAULPQIPOAAEXOT3Y6LXU6GGAGMN2QAE35"); + assertValidAddress("GBCDXRHIHVEUXXA6ZWCLXRSR3M6SJKHZOSOWMQIFM3ONXNJY2F3QY34K"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress(""); + assertInvalidAddress("/../evil/GBCDXRHIHVEUXXA6ZWCLXRSR3M6SJKHZOSOWMQIFM3ONXDK"); + assertInvalidAddress("GCQQRNVHDV5JGDLK7XNVF5HAULPQIPOAAEXOT3Y6LXU6GGAGMN2QAE3"); + assertInvalidAddress("GCQQRNVHDV5JGDLK7XNVF5HAULPQIPOAAEXOT3Y6LXU6GGAGMN2QAE333"); + } +}