This repository has been archived by the owner on Sep 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87036ca
commit 72084bb
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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.AddressValidationResult; | ||
import bisq.asset.Base58BitcoinAddressValidator; | ||
import bisq.asset.Coin; | ||
import bisq.asset.NetworkParametersAdapter; | ||
|
||
public class BitCloud extends Coin { | ||
|
||
public BitCloud() { | ||
super("BitCloud", "BTDX", new BitCloudAddressValidator()); | ||
} | ||
|
||
|
||
public static class BitCloudAddressValidator extends Base58BitcoinAddressValidator { | ||
|
||
public BitCloudAddressValidator() { | ||
super(new BitCloudParams()); | ||
} | ||
|
||
@Override | ||
public AddressValidationResult validate(String address) { | ||
if (!address.matches("^[B][a-km-zA-HJ-NP-Z1-9]{25,34}$")) | ||
return AddressValidationResult.invalidStructure(); | ||
|
||
return super.validate(address); | ||
} | ||
} | ||
|
||
public static class BitCloudParams extends NetworkParametersAdapter { | ||
|
||
public BitCloudParams() { | ||
addressHeader = 25; | ||
p2shHeader = 5; | ||
acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 BitCloudTest extends AbstractAssetTest { | ||
|
||
public BitCloudTest() { | ||
super(new BitCloud()); | ||
} | ||
|
||
@Test | ||
public void testValidAddresses() { | ||
assertValidAddress("B7dtuCkeYcQQiTdr9wAK7HZtmvvrM24jEH"); | ||
assertValidAddress("BGp8DmF5wwpaDUsK9Mi3SByTDuvgy6XJGS"); | ||
assertValidAddress("BDL6jpyNge8VB8LL8dEDX1bxfZ3jHGYzS3"); | ||
assertValidAddress("BKuvEvMrXmPFPC3YGGHHnZoTVYxeddxAjC"); | ||
} | ||
|
||
@Test | ||
public void testInvalidAddresses() { | ||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhemqq"); | ||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYheO"); | ||
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhek#"); | ||
} | ||
} |