Merge pull request #3324 from ctscoin/list-ctsc-asset

List CTSCoin (CTSC)
This commit is contained in:
Christoph Atteneder 2019-10-04 12:10:49 +02:00 committed by GitHub
commit bae6e7ab33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,36 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58BitcoinAddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class CTSCoin extends Coin {
public CTSCoin() {
super("CTSCoin", "CTSC", new Base58BitcoinAddressValidator(new CtscMainNetParams()));
}
public static class CtscMainNetParams extends NetworkParametersAdapter {
public CtscMainNetParams() {
this.addressHeader = 66;
this.p2shHeader = 16;
this.acceptableAddressCodes = new int[]{this.addressHeader, this.p2shHeader};
}
}
}

View file

@ -29,6 +29,7 @@ bisq.asset.coins.Counterparty
bisq.asset.coins.Credits
bisq.asset.coins.Croat
bisq.asset.coins.CRowdCLassic
bisq.asset.coins.CTSCoin
bisq.asset.coins.DarkPay
bisq.asset.coins.Dash
bisq.asset.coins.Decred

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AbstractAssetTest;
import org.junit.Test;
public class CTSCoinTest extends AbstractAssetTest {
public CTSCoinTest() {
super(new CTSCoin());
}
@Test
public void testValidAddresses() {
assertValidAddress("Ti6S7JhtxKjSytZDmyMV4pVNVAPeiVsnpT");
assertValidAddress("TwzRDeNSPcJvquuGu7WxxH3RhXBR1VPYHZ");
assertValidAddress("TgYGQJd5TEzDRkyXt1tCvUnrbWBu38C8YK");
}
@Test
public void testInvalidAddresses() {
assertInvalidAddress("ti6S7JhtxKjSytZDmyMV4pVNVAPeiVsnpT");
assertInvalidAddress("2i6S7JhtxKjSytZDmyMV4pVNVAPeiVsnpT");
assertInvalidAddress("Ti6S7JhtxKjSytZDmyMV4pVNVAPeiVsnp#");
}
}