Merge pull request #2322 from adeptio-project/list-adeptio-asset

List Adeptio (ADE)
This commit is contained in:
Christoph Atteneder 2019-02-07 09:23:00 +01:00 committed by GitHub
commit 4cdc933360
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,56 @@
/*
* 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 Adeptio extends Coin {
public Adeptio() {
super("Adeptio", "ADE", new AdeptioAddressValidator());
}
public static class AdeptioAddressValidator extends Base58BitcoinAddressValidator {
public AdeptioAddressValidator() {
super(new AdeptioParams());
}
@Override
public AddressValidationResult validate(String address) {
if (!address.matches("^[A][a-km-zA-HJ-NP-Z1-9]{24,33}$"))
return AddressValidationResult.invalidStructure();
return super.validate(address);
}
}
public static class AdeptioParams extends NetworkParametersAdapter {
public AdeptioParams() {
addressHeader = 23;
p2shHeader = 16;
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
}
}
}

View file

@ -3,6 +3,7 @@
# See bisq.asset.Asset and bisq.asset.AssetRegistry for further details. # See bisq.asset.Asset and bisq.asset.AssetRegistry for further details.
# See https://bisq.network/list-asset for complete instructions. # See https://bisq.network/list-asset for complete instructions.
bisq.asset.coins.Actinium bisq.asset.coins.Actinium
bisq.asset.coins.Adeptio
bisq.asset.coins.Aeon bisq.asset.coins.Aeon
bisq.asset.coins.Australiacash bisq.asset.coins.Australiacash
bisq.asset.coins.Beam bisq.asset.coins.Beam

View file

@ -0,0 +1,47 @@
/*
* 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 AdeptioTest extends AbstractAssetTest {
public AdeptioTest() {
super(new Adeptio());
}
@Test
public void testValidAddresses() {
assertValidAddress("AP7rSyQMZRek9HGy9QB1bpung69xViesN7");
assertValidAddress("AWVXtnMo4pS2vBSNrBPLVvMgYvJGD6gSXk");
assertValidAddress("AHq8sM8DEeFoZXeDkaimfCLtnMuuSWXFE7");
assertValidAddress("ANG52tPNJuVknLQiLUdzVFoZ3vyo8UzkDL");
}
@Test
public void testInvalidAddresses() {
assertInvalidAddress("aP7rSyQMZRek9HGy9QB1bpung69xViesN7");
assertInvalidAddress("DAeiBSH4nudXgoxS4kY6uhTPobc7AlrWDA");
assertInvalidAddress("BGhVYBXk511m8TPvQA6YokzxdpdhRE3sG6");
assertInvalidAddress("AZt2Kuy9cWFbTc888HNphppkuCTNyqu5PY");
assertInvalidAddress("AbosH98t3TRKzyNb8pPQV9boupVcBAX6of");
assertInvalidAddress("DTPAqTryNRCE2FgsxzohTtJXfCBIDnG6Rc");
}
}