Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

List Compass (CSS) #75

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/main/java/bisq/asset/coins/Compass.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 <http://www.gnu.org/licenses/>.
*/

package bisq.asset.coins;

import bisq.asset.Base58BitcoinAddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;

public class Compass extends Coin {

public Compass() {
super("Compass", "CSS", new Base58BitcoinAddressValidator(new CompassParams()));
}


public static class CompassParams extends NetworkParametersAdapter {

public CompassParams() {
addressHeader = 0x57;
p2shHeader = 0x1b;
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/META-INF/services/bisq.asset.Asset
Expand Up @@ -25,6 +25,7 @@ bisq.asset.coins.Burstcoin
bisq.asset.coins.Byteball
bisq.asset.coins.Cagecoin
bisq.asset.coins.CassubianDetk
bisq.asset.coins.Compass
bisq.asset.coins.Counterparty
bisq.asset.coins.Creativecoin
bisq.asset.coins.Credits
Expand Down
44 changes: 44 additions & 0 deletions src/test/java/bisq/asset/coins/CompassTest.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 <http://www.gnu.org/licenses/>.
*/

package bisq.asset.coins;

import bisq.asset.AbstractAssetTest;

import org.junit.Test;

public class CompassTest extends AbstractAssetTest {

public CompassTest() {
super(new Compass());
}

@Test
public void testValidAddresses() {
assertValidAddress("cBHPUpKgLsPSS2BUgchhLps6DAjXTSGWoo");
assertValidAddress("BvQpKvb1SswwxVTuyZocHWCVsUeGq7MwoR");
}

@Test
public void testInvalidAddresses() {
assertInvalidAddress("cBHPUpKgLsPSS2BUgchhLps6DAjXTSGWooX");
assertInvalidAddress("cBHPUpKgLsPSS2BUgchhLps6DAjXTSGWo");
assertInvalidAddress("cBHPUpKgLsPSS2BUgchhLps6DAjXTSGWoo#");
assertInvalidAddress("bvQpKvb1SswwxVTuyZocHWCVsUeGq7MwoR");
assertInvalidAddress("yidkVmR8GaT3oQthbm6jVxG5R7LnLVAvKwX");
}
}