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

Commit

Permalink
List FuturoCoin (FTO)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsikora authored and dalijolijo committed Jun 25, 2018
1 parent de8d1e1 commit 4b19213
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/main/java/bisq/asset/coins/FuturoCoin.java
@@ -0,0 +1,54 @@
/*
* 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 FuturoCoin extends Coin {

public FuturoCoin() {
super("FuturoCoin", "FTO", new FuturoCoinValidator());
}

public static class FuturoCoinValidator extends Base58BitcoinAddressValidator {

public FuturoCoinValidator() {
super(new FuturoCoin.FuturoCoinParams());
}

@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[F][a-km-zA-HJ-NP-Z1-9]{25,34}$"))
return AddressValidationResult.invalidStructure();

return super.validate(address);
}
}

public static class FuturoCoinParams extends NetworkParametersAdapter {

public FuturoCoinParams() {
addressHeader = 36;
p2shHeader = 13;
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/META-INF/services/bisq.asset.Asset
Expand Up @@ -45,6 +45,7 @@ bisq.asset.coins.DynamicCoin
bisq.asset.coins.Espers
bisq.asset.coins.Ether
bisq.asset.coins.EtherClassic
bisq.asset.coins.FuturoCoin
bisq.asset.coins.Graft
bisq.asset.coins.Gridcoin
bisq.asset.coins.InfinityEconomics
Expand Down
50 changes: 50 additions & 0 deletions src/test/java/bisq/asset/coins/FuturoCoinTest.java
@@ -0,0 +1,50 @@
/*
* 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;

public class FuturoCoinTest extends AbstractAssetTest {

public FuturoCoinTest() {
super(new FuturoCoin());
}

@Override
public void testValidAddresses() {
assertValidAddress("FkWEKpguPvG3CbaLpg46Fka4ZCCh2zuUCZ");
assertValidAddress("FZ6UhtneD6AciLywYWJSwmN3XgdoDGEjjF");
assertValidAddress("FYjkqH1XVp4oF5PvFK5JJdC1Mb2eZAbGDk");
assertValidAddress("FheRu8mY47PpUCx4kvjgsRQcLtoG9uDbT8");
assertValidAddress("FYdmbRBJ3LBRATvj8E8CwjW7v1EkngTCDa");
assertValidAddress("FaKWCQ662qG3nmy6bjWV5a4Mse6wfMFde6");
assertValidAddress("FcXEfdEPj7BLnSGUjBTHFZomxEwWAo9nyv");
assertValidAddress("Fd7gZ7dNJ1toY6TeWy3rf2dUvyRudggTLv");
assertValidAddress("FbRXmJUDgf5URuVGyM223P8R2JArXSSm6u");
}

@Override
public void testInvalidAddresses() {
assertInvalidAddress("FkWEKpguPvG3CbaLpg46Fka4ZCCh2zuUC2");
assertInvalidAddress("FZ6UhtneD6AciLywYWJSwmN3XgdoDGEjjFdd");
assertInvalidAddress("FYjkqH1XVp4oF5PvFK5JJdC1Mb2eZAb");
assertInvalidAddress("FheRu8mY47PpUCx4kvjgsRQcLtoG9uDbT9");
assertInvalidAddress("Fd7gZ7dNJ1toY6TeWy3rf2dUvyRudggTL");
assertInvalidAddress("FbRXmJUDgf5URuVGyM223P8R2JArXSSm61");
}
}

0 comments on commit 4b19213

Please sign in to comment.