Search in sources :

Example 1 with ValidationException

use of bisq.core.dao.exceptions.ValidationException in project bisq-core by bisq-network.

the class BlindVoteValidator method validateDataFields.

private void validateDataFields(BlindVote blindVote) throws ValidationException {
    try {
        checkNotNull(blindVote.getEncryptedVotes(), "encryptedProposalList must not be null");
        checkArgument(blindVote.getEncryptedVotes().length > 0, "encryptedProposalList must not be empty");
        checkNotNull(blindVote.getTxId(), "txId must not be null");
        checkArgument(blindVote.getTxId().length() > 0, "txId must not be empty");
        checkArgument(blindVote.getStake() > 0, "stake must be positive");
        checkNotNull(blindVote.getEncryptedMeritList(), "getEncryptedMeritList must not be null");
        checkArgument(blindVote.getEncryptedMeritList().length > 0, "getEncryptedMeritList must not be empty");
    // TODO should we use a min/max for stake, atm its just dust limit as the min. value
    } catch (Throwable e) {
        log.warn(e.toString());
        throw new ValidationException(e);
    }
}
Also used : ValidationException(bisq.core.dao.exceptions.ValidationException)

Example 2 with ValidationException

use of bisq.core.dao.exceptions.ValidationException in project bisq-core by bisq-network.

the class CompensationValidator method validateDataFields.

@Override
public void validateDataFields(Proposal proposal) throws ValidationException {
    try {
        super.validateDataFields(proposal);
        CompensationProposal compensationProposal = (CompensationProposal) proposal;
        String bsqAddress = compensationProposal.getBsqAddress();
        notEmpty(bsqAddress, "bsqAddress must not be empty");
        checkArgument(bsqAddress.substring(0, 1).equals("B"), "bsqAddress must start with B");
        // throws AddressFormatException if wrong address
        compensationProposal.getAddress();
        Coin requestedBsq = compensationProposal.getRequestedBsq();
        checkArgument(requestedBsq.compareTo(getMaxCompensationRequestAmount()) <= 0, "Requested BSQ must not exceed MaxCompensationRequestAmount");
        checkArgument(requestedBsq.compareTo(getMinCompensationRequestAmount()) >= 0, "Requested BSQ must not be less than MinCompensationRequestAmount");
    } catch (Throwable throwable) {
        throw new ValidationException(throwable);
    }
}
Also used : Coin(org.bitcoinj.core.Coin) ValidationException(bisq.core.dao.exceptions.ValidationException)

Example 3 with ValidationException

use of bisq.core.dao.exceptions.ValidationException in project bisq-core by bisq-network.

the class ChangeParamValidator method validateDataFields.

@Override
public void validateDataFields(Proposal proposal) throws ValidationException {
    try {
        super.validateDataFields(proposal);
        ChangeParamProposal changeParamProposal = (ChangeParamProposal) proposal;
    // TODO
    } catch (Throwable throwable) {
        throw new ValidationException(throwable);
    }
}
Also used : ValidationException(bisq.core.dao.exceptions.ValidationException)

Example 4 with ValidationException

use of bisq.core.dao.exceptions.ValidationException in project bisq-core by bisq-network.

the class BondedRoleValidator method validateDataFields.

@Override
public void validateDataFields(Proposal proposal) throws ValidationException {
    try {
        super.validateDataFields(proposal);
        BondedRoleProposal bondedRoleProposal = (BondedRoleProposal) proposal;
        BondedRole bondedRole = bondedRoleProposal.getBondedRole();
        // TODO
        notEmpty(bondedRole.getName(), "bondedRole.name must not be empty");
    } catch (Throwable throwable) {
        throw new ValidationException(throwable);
    }
}
Also used : ValidationException(bisq.core.dao.exceptions.ValidationException) BondedRole(bisq.core.dao.governance.role.BondedRole)

Example 5 with ValidationException

use of bisq.core.dao.exceptions.ValidationException in project bisq-core by bisq-network.

the class ConfiscateBondValidator method validateDataFields.

@Override
public void validateDataFields(Proposal proposal) throws ValidationException {
    try {
        super.validateDataFields(proposal);
        ConfiscateBondProposal confiscateBondProposal = (ConfiscateBondProposal) proposal;
    // TODO
    } catch (Throwable throwable) {
        throw new ValidationException(throwable);
    }
}
Also used : ValidationException(bisq.core.dao.exceptions.ValidationException)

Aggregations

ValidationException (bisq.core.dao.exceptions.ValidationException)6 BondedRole (bisq.core.dao.governance.role.BondedRole)1 Coin (org.bitcoinj.core.Coin)1