Add Generic- and removeAsset proposals

This commit is contained in:
Manfred Karrer 2018-10-04 23:24:14 -05:00
parent 072cedc29b
commit 3e7eba8f04
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
33 changed files with 788 additions and 175 deletions

View file

@ -1470,11 +1470,11 @@ message Proposal {
string tx_id = 5;
oneof message {
CompensationProposal compensation_proposal = 6;
GenericProposal generic_proposal = 7;
ChangeParamProposal change_param_proposal = 8;
RemoveAltcoinProposal remove_altcoin_proposal = 9;
ConfiscateBondProposal confiscate_bond_proposal = 10;
BondedRoleProposal bonded_role_proposal = 11;
ChangeParamProposal change_param_proposal = 7;
BondedRoleProposal bonded_role_proposal = 8;
ConfiscateBondProposal confiscate_bond_proposal = 9;
GenericProposal generic_proposal = 10;
RemoveAssetProposal remove_asset_proposal = 11;
}
}
@ -1483,24 +1483,24 @@ message CompensationProposal {
string bsq_address = 2;
}
message GenericProposal {
}
message ChangeParamProposal {
string param = 1; // name of enum
int64 param_value = 2;
}
message RemoveAltcoinProposal {
string currency_code = 1;
message BondedRoleProposal {
BondedRole bonded_role = 1;
}
message ConfiscateBondProposal {
bytes hash = 1;
}
message BondedRoleProposal {
BondedRole bonded_role = 1;
message GenericProposal {
}
message RemoveAssetProposal {
string ticker_symbol = 1;
}
message BondedRole {

View file

@ -40,7 +40,9 @@ import bisq.core.dao.governance.proposal.TxException;
import bisq.core.dao.governance.proposal.compensation.CompensationConsensus;
import bisq.core.dao.governance.proposal.compensation.CompensationProposalService;
import bisq.core.dao.governance.proposal.confiscatebond.ConfiscateBondProposalService;
import bisq.core.dao.governance.proposal.generic.GenericProposalService;
import bisq.core.dao.governance.proposal.param.ChangeParamProposalService;
import bisq.core.dao.governance.proposal.removeAsset.RemoveAssetProposalService;
import bisq.core.dao.governance.proposal.role.BondedRoleProposalService;
import bisq.core.dao.governance.role.BondedRole;
import bisq.core.dao.governance.role.BondedRolesService;
@ -79,6 +81,10 @@ import java.util.Set;
import javax.annotation.Nullable;
import bisq.asset.Asset;
/**
* Provides a facade to interact with the Dao domain. Hides complexity and domain details to clients (e.g. UI or APIs)
* by providing a reduced API and/or aggregating subroutines.
@ -96,6 +102,8 @@ public class DaoFacade implements DaoSetupService {
private final ChangeParamProposalService changeParamProposalService;
private final ConfiscateBondProposalService confiscateBondProposalService;
private final BondedRoleProposalService bondedRoleProposalService;
private final GenericProposalService genericProposalService;
private final RemoveAssetProposalService removeAssetProposalService;
private final BondedRolesService bondedRolesService;
private final LockupService lockupService;
private final UnlockService unlockService;
@ -116,6 +124,8 @@ public class DaoFacade implements DaoSetupService {
ChangeParamProposalService changeParamProposalService,
ConfiscateBondProposalService confiscateBondProposalService,
BondedRoleProposalService bondedRoleProposalService,
GenericProposalService genericProposalService,
RemoveAssetProposalService removeAssetProposalService,
BondedRolesService bondedRolesService,
LockupService lockupService,
UnlockService unlockService,
@ -132,6 +142,8 @@ public class DaoFacade implements DaoSetupService {
this.changeParamProposalService = changeParamProposalService;
this.confiscateBondProposalService = confiscateBondProposalService;
this.bondedRoleProposalService = bondedRoleProposalService;
this.genericProposalService = genericProposalService;
this.removeAssetProposalService = removeAssetProposalService;
this.bondedRolesService = bondedRolesService;
this.lockupService = lockupService;
this.unlockService = unlockService;
@ -233,6 +245,19 @@ public class DaoFacade implements DaoSetupService {
return bondedRoleProposalService.createProposalWithTransaction(bondedRole);
}
public ProposalWithTransaction getGenericProposalWithTransaction(String name,
String link)
throws ValidationException, InsufficientMoneyException, TxException {
return genericProposalService.createProposalWithTransaction(name, link);
}
public ProposalWithTransaction getRemoveAssetProposalWithTransaction(String name,
String link,
Asset asset)
throws ValidationException, InsufficientMoneyException, TxException {
return removeAssetProposalService.createProposalWithTransaction(name, link, asset);
}
public List<BondedRole> getBondedRoleList() {
return bondedRolesService.getBondedRoleList();
}

View file

@ -37,8 +37,12 @@ import bisq.core.dao.governance.proposal.compensation.CompensationProposalServic
import bisq.core.dao.governance.proposal.compensation.CompensationValidator;
import bisq.core.dao.governance.proposal.confiscatebond.ConfiscateBondProposalService;
import bisq.core.dao.governance.proposal.confiscatebond.ConfiscateBondValidator;
import bisq.core.dao.governance.proposal.generic.GenericProposalService;
import bisq.core.dao.governance.proposal.generic.GenericProposalValidator;
import bisq.core.dao.governance.proposal.param.ChangeParamProposalService;
import bisq.core.dao.governance.proposal.param.ChangeParamValidator;
import bisq.core.dao.governance.proposal.removeAsset.RemoveAssetProposalService;
import bisq.core.dao.governance.proposal.removeAsset.RemoveAssetValidator;
import bisq.core.dao.governance.proposal.role.BondedRoleProposalService;
import bisq.core.dao.governance.proposal.role.BondedRoleValidator;
import bisq.core.dao.governance.proposal.storage.appendonly.ProposalStorageService;
@ -134,6 +138,12 @@ public class DaoModule extends AppModule {
bind(ConfiscateBondValidator.class).in(Singleton.class);
bind(ConfiscateBondProposalService.class).in(Singleton.class);
bind(GenericProposalValidator.class).in(Singleton.class);
bind(GenericProposalService.class).in(Singleton.class);
bind(RemoveAssetValidator.class).in(Singleton.class);
bind(RemoveAssetProposalService.class).in(Singleton.class);
// Ballot
bind(BallotListService.class).in(Singleton.class);

View file

@ -20,7 +20,9 @@ package bisq.core.dao.governance.proposal;
import bisq.core.dao.governance.ConsensusCritical;
import bisq.core.dao.governance.proposal.compensation.CompensationProposal;
import bisq.core.dao.governance.proposal.confiscatebond.ConfiscateBondProposal;
import bisq.core.dao.governance.proposal.generic.GenericProposal;
import bisq.core.dao.governance.proposal.param.ChangeParamProposal;
import bisq.core.dao.governance.proposal.removeAsset.RemoveAssetProposal;
import bisq.core.dao.governance.proposal.role.BondedRoleProposal;
import bisq.core.dao.state.blockchain.TxType;
import bisq.core.dao.state.governance.Param;
@ -91,16 +93,16 @@ public abstract class Proposal implements PersistablePayload, NetworkPayload, Co
switch (proto.getMessageCase()) {
case COMPENSATION_PROPOSAL:
return CompensationProposal.fromProto(proto);
case GENERIC_PROPOSAL:
throw new ProtobufferRuntimeException("Not implemented yet: " + proto);
case CHANGE_PARAM_PROPOSAL:
return ChangeParamProposal.fromProto(proto);
case REMOVE_ALTCOIN_PROPOSAL:
throw new ProtobufferRuntimeException("Not implemented yet: " + proto);
case CONFISCATE_BOND_PROPOSAL:
return ConfiscateBondProposal.fromProto(proto);
case BONDED_ROLE_PROPOSAL:
return BondedRoleProposal.fromProto(proto);
case CONFISCATE_BOND_PROPOSAL:
return ConfiscateBondProposal.fromProto(proto);
case GENERIC_PROPOSAL:
return GenericProposal.fromProto(proto);
case REMOVE_ASSET_PROPOSAL:
return RemoveAssetProposal.fromProto(proto);
case MESSAGE_NOT_SET:
default:
throw new ProtobufferRuntimeException("Unknown message case: " + proto);

View file

@ -21,11 +21,11 @@ import bisq.core.locale.Res;
public enum ProposalType {
COMPENSATION_REQUEST,
BONDED_ROLE,
REMOVE_ALTCOIN,
CHANGE_PARAM,
BONDED_ROLE,
CONFISCATE_BOND,
GENERIC,
CONFISCATE_BOND;
REMOVE_ASSET;
public String getDisplayName() {
return Res.get("dao.proposal.type." + name());

View file

@ -0,0 +1,122 @@
/*
* 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.core.dao.governance.proposal.generic;
import bisq.core.dao.governance.proposal.Proposal;
import bisq.core.dao.governance.proposal.ProposalType;
import bisq.core.dao.state.blockchain.TxType;
import bisq.core.dao.state.governance.Param;
import bisq.common.app.Version;
import io.bisq.generated.protobuffer.PB;
import java.util.Date;
import lombok.EqualsAndHashCode;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.concurrent.Immutable;
@Immutable
@Slf4j
@EqualsAndHashCode(callSuper = true)
@Value
public final class GenericProposal extends Proposal {
GenericProposal(String name,
String link) {
this(name,
link,
Version.PROPOSAL,
new Date().getTime(),
"");
}
///////////////////////////////////////////////////////////////////////////////////////////
// PROTO BUFFER
///////////////////////////////////////////////////////////////////////////////////////////
private GenericProposal(String name,
String link,
byte version,
long creationDate,
String txId) {
super(name,
link,
version,
creationDate,
txId);
}
@Override
public PB.Proposal.Builder getProposalBuilder() {
final PB.GenericProposal.Builder builder = PB.GenericProposal.newBuilder();
return super.getProposalBuilder().setGenericProposal(builder);
}
public static GenericProposal fromProto(PB.Proposal proto) {
return new GenericProposal(proto.getName(),
proto.getLink(),
(byte) proto.getVersion(),
proto.getCreationDate(),
proto.getTxId());
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public ProposalType getType() {
return ProposalType.GENERIC;
}
@Override
public Param getQuorumParam() {
return Param.QUORUM_GENERIC;
}
@Override
public Param getThresholdParam() {
return Param.THRESHOLD_GENERIC;
}
@Override
public TxType getTxType() {
return TxType.PROPOSAL;
}
@Override
public Proposal cloneProposalAndAddTxId(String txId) {
return new GenericProposal(getName(),
getLink(),
getVersion(),
getCreationDate().getTime(),
txId);
}
@Override
public String toString() {
return "GenericProposal{" +
"\n} " + super.toString();
}
}

View file

@ -0,0 +1,69 @@
/*
* 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.core.dao.governance.proposal.generic;
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.dao.exceptions.ValidationException;
import bisq.core.dao.governance.proposal.BaseProposalService;
import bisq.core.dao.governance.proposal.ProposalConsensus;
import bisq.core.dao.governance.proposal.ProposalWithTransaction;
import bisq.core.dao.governance.proposal.TxException;
import bisq.core.dao.state.BsqStateService;
import org.bitcoinj.core.InsufficientMoneyException;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
/**
* Creates GenericProposal and transaction.
*/
@Slf4j
public class GenericProposalService extends BaseProposalService<GenericProposal> {
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public GenericProposalService(BsqWalletService bsqWalletService,
BtcWalletService btcWalletService,
BsqStateService bsqStateService,
ProposalConsensus proposalConsensus,
GenericProposalValidator proposalValidator) {
super(bsqWalletService,
btcWalletService,
bsqStateService,
proposalConsensus,
proposalValidator);
}
public ProposalWithTransaction createProposalWithTransaction(String name, String link)
throws ValidationException, InsufficientMoneyException, TxException {
return super.createProposalWithTransaction(name, link);
}
@Override
protected GenericProposal createProposalWithoutTxId() {
return new GenericProposal(name, link);
}
}

View file

@ -0,0 +1,49 @@
/*
* 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.core.dao.governance.proposal.generic;
import bisq.core.dao.exceptions.ValidationException;
import bisq.core.dao.governance.proposal.Proposal;
import bisq.core.dao.governance.proposal.ProposalValidator;
import bisq.core.dao.state.BsqStateService;
import bisq.core.dao.state.period.PeriodService;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class GenericProposalValidator extends ProposalValidator {
@Inject
public GenericProposalValidator(BsqStateService bsqStateService, PeriodService periodService) {
super(bsqStateService, periodService);
}
@Override
public void validateDataFields(Proposal proposal) throws ValidationException {
try {
super.validateDataFields(proposal);
GenericProposal genericProposalProposal = (GenericProposal) proposal;
//TODO
} catch (Throwable throwable) {
throw new ValidationException(throwable);
}
}
}

View file

@ -67,6 +67,7 @@ public class ChangeParamValidator extends ProposalValidator {
switch (param) {
case UNDEFINED:
break;
case BSQ_MAKER_FEE_IN_PERCENT:
break;
case BSQ_TAKER_FEE_IN_PERCENT:
@ -75,41 +76,47 @@ public class ChangeParamValidator extends ProposalValidator {
break;
case BTC_TAKER_FEE_IN_PERCENT:
break;
case PROPOSAL_FEE:
break;
case BLIND_VOTE_FEE:
break;
case COMPENSATION_REQUEST_MIN_AMOUNT:
if (paramValue < Restrictions.getMinNonDustOutput().value)
throw new ChangeParamValidationException(Res.get("validation.amountBelowDust", Restrictions.getMinNonDustOutput().value));
checkMinMax(param, paramValue, 100, -50);
break;
case COMPENSATION_REQUEST_MAX_AMOUNT:
checkMinMax(param, paramValue, 100, -50);
break;
break;
case QUORUM_PROPOSAL:
break;
case QUORUM_COMP_REQUEST:
break;
case QUORUM_CHANGE_PARAM:
break;
case QUORUM_REMOVE_ASSET:
case QUORUM_ROLE:
break;
case QUORUM_CONFISCATION:
break;
case THRESHOLD_PROPOSAL:
case QUORUM_GENERIC:
break;
case QUORUM_REMOVE_ASSET:
break;
case THRESHOLD_COMP_REQUEST:
break;
case THRESHOLD_CHANGE_PARAM:
break;
case THRESHOLD_REMOVE_ASSET:
case THRESHOLD_ROLE:
break;
case THRESHOLD_CONFISCATION:
break;
case THRESHOLD_GENERIC:
break;
case THRESHOLD_REMOVE_ASSET:
break;
case PHASE_UNDEFINED:
break;
case PHASE_PROPOSAL:

View file

@ -0,0 +1,133 @@
/*
* 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.core.dao.governance.proposal.removeAsset;
import bisq.core.dao.governance.proposal.Proposal;
import bisq.core.dao.governance.proposal.ProposalType;
import bisq.core.dao.state.blockchain.TxType;
import bisq.core.dao.state.governance.Param;
import bisq.common.app.Version;
import io.bisq.generated.protobuffer.PB;
import java.util.Date;
import lombok.EqualsAndHashCode;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.concurrent.Immutable;
@Immutable
@Slf4j
@EqualsAndHashCode(callSuper = true)
@Value
public final class RemoveAssetProposal extends Proposal {
private final String tickerSymbol;
RemoveAssetProposal(String name,
String link,
String tickerSymbol) {
this(name,
link,
tickerSymbol,
Version.PROPOSAL,
new Date().getTime(),
"");
}
///////////////////////////////////////////////////////////////////////////////////////////
// PROTO BUFFER
///////////////////////////////////////////////////////////////////////////////////////////
private RemoveAssetProposal(String name,
String link,
String tickerSymbol,
byte version,
long creationDate,
String txId) {
super(name,
link,
version,
creationDate,
txId);
this.tickerSymbol = tickerSymbol;
}
@Override
public PB.Proposal.Builder getProposalBuilder() {
final PB.RemoveAssetProposal.Builder builder = PB.RemoveAssetProposal.newBuilder()
.setTickerSymbol(tickerSymbol);
return super.getProposalBuilder().setRemoveAssetProposal(builder);
}
public static RemoveAssetProposal fromProto(PB.Proposal proto) {
final PB.RemoveAssetProposal proposalProto = proto.getRemoveAssetProposal();
return new RemoveAssetProposal(proto.getName(),
proto.getLink(),
proposalProto.getTickerSymbol(),
(byte) proto.getVersion(),
proto.getCreationDate(),
proto.getTxId());
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public ProposalType getType() {
return ProposalType.REMOVE_ASSET;
}
@Override
public Param getQuorumParam() {
return Param.QUORUM_REMOVE_ASSET;
}
@Override
public Param getThresholdParam() {
return Param.THRESHOLD_REMOVE_ASSET;
}
@Override
public TxType getTxType() {
return TxType.PROPOSAL;
}
@Override
public Proposal cloneProposalAndAddTxId(String txId) {
return new RemoveAssetProposal(getName(),
getLink(),
getTickerSymbol(),
getVersion(),
getCreationDate().getTime(),
txId);
}
@Override
public String toString() {
return "GenericProposal{" +
"\n tickerSymbol=" + tickerSymbol +
"\n} " + super.toString();
}
}

View file

@ -0,0 +1,80 @@
/*
* 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.core.dao.governance.proposal.removeAsset;
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.dao.exceptions.ValidationException;
import bisq.core.dao.governance.proposal.BaseProposalService;
import bisq.core.dao.governance.proposal.ProposalConsensus;
import bisq.core.dao.governance.proposal.ProposalWithTransaction;
import bisq.core.dao.governance.proposal.TxException;
import bisq.core.dao.state.BsqStateService;
import org.bitcoinj.core.InsufficientMoneyException;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import bisq.asset.Asset;
/**
* Creates RemoveAssetProposal and transaction.
*/
@Slf4j
public class RemoveAssetProposalService extends BaseProposalService<RemoveAssetProposal> {
private Asset asset;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public RemoveAssetProposalService(BsqWalletService bsqWalletService,
BtcWalletService btcWalletService,
BsqStateService bsqStateService,
ProposalConsensus proposalConsensus,
RemoveAssetValidator proposalValidator) {
super(bsqWalletService,
btcWalletService,
bsqStateService,
proposalConsensus,
proposalValidator);
}
public ProposalWithTransaction createProposalWithTransaction(String name,
String link,
Asset asset)
throws ValidationException, InsufficientMoneyException, TxException {
this.asset = asset;
return super.createProposalWithTransaction(name, link);
}
@Override
protected RemoveAssetProposal createProposalWithoutTxId() {
return new RemoveAssetProposal(
name,
link,
asset.getTickerSymbol());
}
}

View file

@ -0,0 +1,49 @@
/*
* 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.core.dao.governance.proposal.removeAsset;
import bisq.core.dao.exceptions.ValidationException;
import bisq.core.dao.governance.proposal.Proposal;
import bisq.core.dao.governance.proposal.ProposalValidator;
import bisq.core.dao.state.BsqStateService;
import bisq.core.dao.state.period.PeriodService;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class RemoveAssetValidator extends ProposalValidator {
@Inject
public RemoveAssetValidator(BsqStateService bsqStateService, PeriodService periodService) {
super(bsqStateService, periodService);
}
@Override
public void validateDataFields(Proposal proposal) throws ValidationException {
try {
super.validateDataFields(proposal);
RemoveAssetProposal removeAssetProposal = (RemoveAssetProposal) proposal;
//TODO
} catch (Throwable throwable) {
throw new ValidationException(throwable);
}
}
}

View file

@ -100,12 +100,12 @@ public final class BondedRoleProposal extends Proposal {
@Override
public Param getQuorumParam() {
return Param.QUORUM_PROPOSAL;
return Param.QUORUM_ROLE;
}
@Override
public Param getThresholdParam() {
return Param.THRESHOLD_PROPOSAL;
return Param.THRESHOLD_ROLE;
}
@Override

View file

@ -59,18 +59,21 @@ public enum Param {
COMPENSATION_REQUEST_MAX_AMOUNT(10_000_000), // 100 000 BSQ
// Quorum for voting in BSQ stake
QUORUM_PROPOSAL(100), // 10 000 BSQ TODO change low dev value
QUORUM_COMP_REQUEST(100), // 10 000 BSQ TODO change low dev value
QUORUM_CHANGE_PARAM(300), // 100 000 BSQ TODO change low dev value
QUORUM_REMOVE_ASSET(400), // 10 000 BSQ TODO change low dev value
QUORUM_ROLE(500), // 10 000 BSQ TODO change low dev value
QUORUM_CONFISCATION(500), // 10 000 BSQ TODO change low dev value
QUORUM_GENERIC(100), // 10 000 BSQ TODO change low dev value
QUORUM_REMOVE_ASSET(400), // 10 000 BSQ TODO change low dev value
// Threshold for voting in % with precision of 2 (e.g. 5000 -> 50.00%)
THRESHOLD_PROPOSAL(5_000), // 50%
THRESHOLD_COMP_REQUEST(5_000), // 50%
THRESHOLD_CHANGE_PARAM(7_500), // 75% -> that might change the THRESHOLD_CHANGE_PARAM and QUORUM_CHANGE_PARAM!
THRESHOLD_REMOVE_ASSET(5_000), // 50%
THRESHOLD_ROLE(5_000), // 50%
THRESHOLD_CONFISCATION(8_500), // 85%
THRESHOLD_GENERIC(5_000), // 50%
THRESHOLD_REMOVE_ASSET(5_000), // 50%
// Period phase (16 blocks atm)
PHASE_UNDEFINED(0),

View file

@ -33,6 +33,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkArgument;
@ -52,6 +53,7 @@ public class CurrencyUtil {
setBaseCurrencyCode(BisqEnvironment.getBaseCurrencyNetwork().getCurrencyCode());
}
@Getter
private static final AssetRegistry assetRegistry = new AssetRegistry();
private static String baseCurrencyCode = "BTC";
@ -437,4 +439,11 @@ public class CurrencyUtil {
// If we are in mainnet we need have a mainet asset defined.
throw new IllegalArgumentException("We are on mainnet and we could not find an asset with network type mainnet");
}
public static Optional<Asset> findAsset(String tickerSymbol, BaseCurrencyNetwork baseCurrencyNetwork) {
return getAssetRegistry().stream()
.filter(asset -> asset.getTickerSymbol().equals(tickerSymbol))
.filter(asset -> assetMatchesNetwork(asset, baseCurrencyNetwork))
.findAny();
}
}

View file

@ -135,18 +135,20 @@ public class BsqFormatter extends BSFormatter {
case COMPENSATION_REQUEST_MAX_AMOUNT:
return formatCoinWithCode(Coin.valueOf(value));
case QUORUM_PROPOSAL:
case QUORUM_COMP_REQUEST:
case QUORUM_CHANGE_PARAM:
case QUORUM_REMOVE_ASSET:
case QUORUM_ROLE:
case QUORUM_CONFISCATION:
case QUORUM_GENERIC:
case QUORUM_REMOVE_ASSET:
return formatCoinWithCode(Coin.valueOf(value));
case THRESHOLD_PROPOSAL:
case THRESHOLD_COMP_REQUEST:
case THRESHOLD_CHANGE_PARAM:
case THRESHOLD_REMOVE_ASSET:
case THRESHOLD_ROLE:
case THRESHOLD_CONFISCATION:
case THRESHOLD_GENERIC:
case THRESHOLD_REMOVE_ASSET:
return formatToPercentWithSymbol(value / 10000d);
case PHASE_UNDEFINED:
@ -183,18 +185,22 @@ public class BsqFormatter extends BSFormatter {
case COMPENSATION_REQUEST_MAX_AMOUNT:
return parseToCoin(inputValue).value;
case QUORUM_PROPOSAL:
case QUORUM_COMP_REQUEST:
case QUORUM_CHANGE_PARAM:
case QUORUM_REMOVE_ASSET:
case QUORUM_ROLE:
case QUORUM_CONFISCATION:
case QUORUM_GENERIC:
case QUORUM_REMOVE_ASSET:
return parseToCoin(inputValue).value;
case THRESHOLD_PROPOSAL:
case THRESHOLD_COMP_REQUEST:
case THRESHOLD_CHANGE_PARAM:
case THRESHOLD_REMOVE_ASSET:
case THRESHOLD_ROLE:
case THRESHOLD_CONFISCATION:
case THRESHOLD_GENERIC:
case THRESHOLD_REMOVE_ASSET:
return (long) (parsePercentStringToDouble(inputValue) * 10000);
case PHASE_UNDEFINED:

View file

@ -1211,26 +1211,32 @@ dao.param.COMPENSATION_REQUEST_MIN_AMOUNT=Compensation request min. BSQ amount
dao.param.COMPENSATION_REQUEST_MAX_AMOUNT=Compensation request max. BSQ amount
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum in BSQ for proposal
dao.param.QUORUM_GENERIC=Required quorum in BSQ for generic proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum in BSQ for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum in BSQ for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum in BSQ for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum in BSQ for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum in BSQ for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.QUORUM_ROLE=Required quorum in BSQ for taking a bonded role
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold in % for proposal
dao.param.THRESHOLD_GENERIC=Required threshold in % for generic proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold in % for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold in % for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold in % for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold in % for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold in % for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_ROLE=Required threshold in % for taking a bonded role
dao.param.currentValue=Current value: {0}
dao.param.blocks={0} blocks
@ -1360,7 +1366,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Compensation request
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Proposal for removing an altcoin
dao.proposal.type.REMOVE_ASSET=Proposal for removing an asset
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Proposal for changing a parameter
# suppress inspection "UnusedProperty"
@ -1373,7 +1379,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Compensation request
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"
@ -1413,6 +1419,7 @@ dao.proposal.display.proposalFee=Proposal fee:
dao.proposal.display.myVote=My vote:
dao.proposal.display.voteResult=Vote result summary:
dao.proposal.display.bondedRoleComboBox.label=Choose bonded role type
dao.proposal.display.tickerSymbol.label=Ticker Symbol
dao.proposal.table.header.proposalType=Proposal type
dao.proposal.table.header.link=Link
@ -1430,6 +1437,7 @@ dao.proposal.display.paramComboBox.label=Choose parameter
dao.proposal.display.paramValue=Parameter value:
dao.proposal.display.confiscateBondComboBox.label=Choose bond
dao.proposal.display.assetComboBox.label=Asset to remove
dao.blindVote=blind vote

View file

@ -1065,7 +1065,7 @@ dao.param.PROPOSAL_FEE=Vorschlag-Gebühr
dao.param.BLIND_VOTE_FEE=Stimm-Gebühr
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Benötigtes Quorum für Vorschlag
dao.param.QUORUM_GENERIC=Benötigtes Quorum für Vorschlag
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Benötigtes Quorum für Entlohnungsanfrage
# suppress inspection "UnusedProperty"
@ -1076,7 +1076,7 @@ dao.param.QUORUM_REMOVE_ASSET=Benötigtes Quorum um einen Altcoin zu entfernen
dao.param.QUORUM_CONFISCATION=Benötigtes Quorum für Kopplung Konfiszierung
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Benötigter Schwellwert für Vorschlag
dao.param.THRESHOLD_GENERIC=Benötigter Schwellwert für Vorschlag
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Benötigter Schwellwert für Entlohnungsanfrage
# suppress inspection "UnusedProperty"
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Entlohnungsanfrage
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Vorschlag für Gekoppelte Rolle
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Vorschlag einen Altcoin zu entfernen
dao.proposal.type.REMOVE_ASSET=Vorschlag einen Altcoin zu entfernen
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Vorschlag einen Parameter zu ändern
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Entlohnungsanfrage
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Gekoppelte Rolle
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Einen Altcoin entfernen
dao.proposal.type.short.REMOVE_ASSET=Einen Altcoin entfernen
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Einen Parameter ändern
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Αίτημα αποζημίωσης
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Πρόταση για απόσυρση εναλλακτικού νομίσματος
dao.proposal.type.REMOVE_ASSET=Πρόταση για απόσυρση εναλλακτικού νομίσματος
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Πρόταση για αλλαγή παραμέτρου
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Αίτημα αποζημίωσης
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Petición de compensación
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Propuesta para eliminar una altcoin
dao.proposal.type.REMOVE_ASSET=Propuesta para eliminar una altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Propuesta para cambiar un parámetro
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Petición de compensación
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=درخواست خسارت
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=پیشنهاد برای حذف یک آلت کوین
dao.proposal.type.REMOVE_ASSET=پیشنهاد برای حذف یک آلت کوین
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=پیشنهاد برای تغییر یک پارامتر
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=درخواست خسارت
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -975,7 +975,7 @@ dao.phase.short.BREAK4=Break
dao.proposal.type.COMPENSATION_REQUEST=Requête de compensation
dao.proposal.type.GENERIC=Generic proposal
dao.proposal.type.CHANGE_PARAM=Proposal for changing a parameter
dao.proposal.type.REMOVE_ALTCOIN=Proposal for removing an altcoin
dao.proposal.type.REMOVE_ASSET=Proposal for removing an asset
dao.proposal.details=Proposal details
dao.proposal.selectedProposal=Selected proposal
dao.proposal.active.header=Active proposals

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Kártérítési kérelem
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Proposal for removing an altcoin
dao.proposal.type.REMOVE_ASSET=Proposal for removing an asset
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Proposal for changing a parameter
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Kártérítési kérelem
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Pedido de compensação
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Proposal for removing an altcoin
dao.proposal.type.REMOVE_ASSET=Proposal for removing an asset
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Proposal for changing a parameter
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Pedido de compensação
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Solicitare de despăgubire
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Proposal for removing an altcoin
dao.proposal.type.REMOVE_ASSET=Proposal for removing an asset
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Proposal for changing a parameter
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Solicitare de despăgubire
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -1065,7 +1065,7 @@ dao.param.PROPOSAL_FEE=Сбор за предложение
dao.param.BLIND_VOTE_FEE=Сбор за голосование
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Необходимый кворум для предложения
dao.param.QUORUM_GENERIC=Необходимый кворум для предложения
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Необходимый кворум для запроса компенсации
# suppress inspection "UnusedProperty"
@ -1076,7 +1076,7 @@ dao.param.QUORUM_REMOVE_ASSET=Необходимый кворум для уда
dao.param.QUORUM_CONFISCATION=Необходимый кворум для конфискации гарантийного депозита
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Необходимый порог для предложения
dao.param.THRESHOLD_GENERIC=Необходимый порог для предложения
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Необходимый порог для запроса компенсации
# suppress inspection "UnusedProperty"
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Запрос компенсации
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Предложение учредить обеспеченную роль
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Предложение удалить алткойн
dao.proposal.type.REMOVE_ASSET=Предложение удалить алткойн
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Предложение по изменению параметра
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Запрос компенсации
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Обеспеченная роль
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Удаление алткойна
dao.proposal.type.short.REMOVE_ASSET=Удаление алткойна
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Изменение параметра
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Zahtev za nadoknadu
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Proposal for removing an altcoin
dao.proposal.type.REMOVE_ASSET=Proposal for removing an asset
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Proposal for changing a parameter
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Zahtev za nadoknadu
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=คำขอชดเชย
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=ข้อเสนอสำหรับการลบ altcoin
dao.proposal.type.REMOVE_ASSET=ข้อเสนอสำหรับการลบ altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=ข้อเสนอสำหรับการเปลี่ยนข้อจำกัด
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=คำขอชดเชย
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=Yêu cầu bồi thường
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Đề xuất gỡ bỏ một altcoin
dao.proposal.type.REMOVE_ASSET=Đề xuất gỡ bỏ một altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=Đề xuất thay đổi một thông số
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=Yêu cầu bồi thường
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -1065,24 +1065,24 @@ dao.param.PROPOSAL_FEE=Proposal fee
dao.param.BLIND_VOTE_FEE=Voting fee
# suppress inspection "UnusedProperty"
dao.param.QUORUM_PROPOSAL=Required quorum for proposal
dao.param.QUORUM_GENERIC=Required quorum for proposal
# suppress inspection "UnusedProperty"
dao.param.QUORUM_COMP_REQUEST=Required quorum for compensation request
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CHANGE_PARAM=Required quorum for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an altcoin
dao.param.QUORUM_REMOVE_ASSET=Required quorum for removing an asset
# suppress inspection "UnusedProperty"
dao.param.QUORUM_CONFISCATION=Required quorum for bond confiscation
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_PROPOSAL=Required threshold for proposal
dao.param.THRESHOLD_GENERIC=Required threshold for proposal
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_COMP_REQUEST=Required threshold for compensation request
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CHANGE_PARAM=Required threshold for changing a parameter
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an altcoin
dao.param.THRESHOLD_REMOVE_ASSET=Required threshold for removing an asset
# suppress inspection "UnusedProperty"
dao.param.THRESHOLD_CONFISCATION=Required threshold for bond confiscation
@ -1211,7 +1211,7 @@ dao.proposal.type.COMPENSATION_REQUEST=赔偿要求
# suppress inspection "UnusedProperty"
dao.proposal.type.BONDED_ROLE=Proposal for a bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.REMOVE_ALTCOIN=Proposal for removing an altcoin
dao.proposal.type.REMOVE_ASSET=Proposal for removing an asset
# suppress inspection "UnusedProperty"
dao.proposal.type.CHANGE_PARAM=修改参数的提议
# suppress inspection "UnusedProperty"
@ -1224,7 +1224,7 @@ dao.proposal.type.short.COMPENSATION_REQUEST=赔偿要求
# suppress inspection "UnusedProperty"
dao.proposal.type.short.BONDED_ROLE=Bonded role
# suppress inspection "UnusedProperty"
dao.proposal.type.short.REMOVE_ALTCOIN=Removing an altcoin
dao.proposal.type.short.REMOVE_ASSET=Removing an altcoin
# suppress inspection "UnusedProperty"
dao.proposal.type.short.CHANGE_PARAM=Changing a parameter
# suppress inspection "UnusedProperty"

View file

@ -26,6 +26,7 @@ import bisq.desktop.util.Layout;
import bisq.desktop.util.validation.BsqAddressValidator;
import bisq.desktop.util.validation.BsqValidator;
import bisq.core.btc.BaseCurrencyNetwork;
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.dao.DaoFacade;
import bisq.core.dao.governance.ballot.Ballot;
@ -34,7 +35,9 @@ import bisq.core.dao.governance.proposal.Proposal;
import bisq.core.dao.governance.proposal.ProposalType;
import bisq.core.dao.governance.proposal.compensation.CompensationProposal;
import bisq.core.dao.governance.proposal.confiscatebond.ConfiscateBondProposal;
import bisq.core.dao.governance.proposal.generic.GenericProposal;
import bisq.core.dao.governance.proposal.param.ChangeParamProposal;
import bisq.core.dao.governance.proposal.removeAsset.RemoveAssetProposal;
import bisq.core.dao.governance.proposal.role.BondedRoleProposal;
import bisq.core.dao.governance.role.BondedRole;
import bisq.core.dao.governance.role.BondedRoleType;
@ -42,6 +45,7 @@ import bisq.core.dao.governance.voteresult.EvaluatedProposal;
import bisq.core.dao.governance.voteresult.ProposalVoteResult;
import bisq.core.dao.state.blockchain.Tx;
import bisq.core.dao.state.governance.Param;
import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.core.util.BsqFormatter;
import bisq.core.util.validation.InputValidator;
@ -82,6 +86,10 @@ import javax.annotation.Nullable;
import static bisq.desktop.util.FormBuilder.*;
import static com.google.common.base.Preconditions.checkNotNull;
import bisq.asset.Asset;
@SuppressWarnings("ConstantConditions")
@Slf4j
public class ProposalDisplay {
@ -104,6 +112,8 @@ public class ProposalDisplay {
public ComboBox<BondedRole> confiscateBondComboBox;
@Nullable
public ComboBox<BondedRoleType> bondedRoleTypeComboBox;
@Nullable
public ComboBox<Asset> assetComboBox;
@Getter
private int gridRow;
@ -155,18 +165,20 @@ public class ProposalDisplay {
case COMPENSATION_REQUEST:
titledGroupBgRowSpan += 1;
break;
case BONDED_ROLE:
break;
case REMOVE_ALTCOIN:
break;
case CHANGE_PARAM:
titledGroupBgRowSpan += 1;
break;
case GENERIC:
case BONDED_ROLE:
break;
case CONFISCATE_BOND:
break;
case GENERIC:
titledGroupBgRowSpan -= 1;
break;
case REMOVE_ASSET:
break;
}
// at isMakeProposalScreen we show fee but no uid and txID (+1)
// otherwise we don't show fee but show uid and txID (+2)
if (isMakeProposalScreen)
@ -217,26 +229,6 @@ public class ProposalDisplay {
bsqAddressTextField.setValidator(new BsqAddressValidator(bsqFormatter));
inputControls.add(bsqAddressTextField);
break;
case BONDED_ROLE:
bondedRoleTypeComboBox = FormBuilder.<BondedRoleType>addLabelComboBox(gridPane, ++gridRow,
Res.getWithCol("dao.proposal.display.bondedRoleComboBox.label")).second;
checkNotNull(bondedRoleTypeComboBox, "bondedRoleTypeComboBox must not be null");
bondedRoleTypeComboBox.setItems(FXCollections.observableArrayList(BondedRoleType.values()));
bondedRoleTypeComboBox.setConverter(new StringConverter<>() {
@Override
public String toString(BondedRoleType bondedRoleType) {
return bondedRoleType != null ? bondedRoleType.getDisplayString() : "";
}
@Override
public BondedRoleType fromString(String string) {
return null;
}
});
comboBoxes.add(bondedRoleTypeComboBox);
break;
case REMOVE_ALTCOIN:
break;
case CHANGE_PARAM:
checkNotNull(gridPane, "gridPane must not be null");
paramComboBox = FormBuilder.<Param>addLabelComboBox(gridPane, ++gridRow,
@ -276,7 +268,23 @@ public class ProposalDisplay {
};
paramComboBox.getSelectionModel().selectedItemProperty().addListener(paramChangeListener);
break;
case GENERIC:
case BONDED_ROLE:
bondedRoleTypeComboBox = FormBuilder.<BondedRoleType>addLabelComboBox(gridPane, ++gridRow,
Res.getWithCol("dao.proposal.display.bondedRoleComboBox.label")).second;
checkNotNull(bondedRoleTypeComboBox, "bondedRoleTypeComboBox must not be null");
bondedRoleTypeComboBox.setItems(FXCollections.observableArrayList(BondedRoleType.values()));
bondedRoleTypeComboBox.setConverter(new StringConverter<>() {
@Override
public String toString(BondedRoleType bondedRoleType) {
return bondedRoleType != null ? bondedRoleType.getDisplayString() : "";
}
@Override
public BondedRoleType fromString(String string) {
return null;
}
});
comboBoxes.add(bondedRoleTypeComboBox);
break;
case CONFISCATE_BOND:
confiscateBondComboBox = FormBuilder.<BondedRole>addLabelComboBox(gridPane, ++gridRow,
@ -296,6 +304,31 @@ public class ProposalDisplay {
});
comboBoxes.add(confiscateBondComboBox);
break;
case GENERIC:
break;
case REMOVE_ASSET:
assetComboBox = FormBuilder.<Asset>addLabelComboBox(gridPane, ++gridRow,
Res.getWithCol("dao.proposal.display.assetComboBox.label")).second;
checkNotNull(assetComboBox, "assetComboBox must not be null");
List<Asset> assetList = CurrencyUtil.getAssetRegistry().stream()
.filter(e -> !e.getTickerSymbol().equals("BSQ"))
.filter(e -> !e.getTickerSymbol().equals("BTC"))
.filter(e -> CurrencyUtil.assetMatchesNetwork(e, BaseCurrencyNetwork.BTC_MAINNET))
.collect(Collectors.toList());
assetComboBox.setItems(FXCollections.observableArrayList(assetList));
assetComboBox.setConverter(new StringConverter<>() {
@Override
public String toString(Asset asset) {
return asset != null ? CurrencyUtil.getNameAndCode(asset.getTickerSymbol()) : "";
}
@Override
public Asset fromString(String string) {
return null;
}
});
comboBoxes.add(assetComboBox);
break;
}
if (!isMakeProposalScreen) {
@ -420,12 +453,18 @@ public class ProposalDisplay {
checkNotNull(bondedRoleTypeComboBox, "bondedRoleComboBox must not be null");
BondedRole bondedRole = bondedRoleProposal.getBondedRole();
bondedRoleTypeComboBox.getSelectionModel().select(bondedRole.getBondedRoleType());
} else if (proposal instanceof ConfiscateBondProposal) {
ConfiscateBondProposal confiscateBondProposal = (ConfiscateBondProposal) proposal;
checkNotNull(confiscateBondComboBox, "confiscateBondComboBox must not be null");
daoFacade.getBondedRoleFromHash(confiscateBondProposal.getHash())
.ifPresent(bondedRole -> confiscateBondComboBox.getSelectionModel().select(bondedRole));
} else if (proposal instanceof GenericProposal) {
// do nothing
} else if (proposal instanceof RemoveAssetProposal) {
RemoveAssetProposal removeAssetProposal = (RemoveAssetProposal) proposal;
checkNotNull(assetComboBox, "assetComboBox must not be null");
CurrencyUtil.findAsset(removeAssetProposal.getTickerSymbol(), BaseCurrencyNetwork.BTC_MAINNET)
.ifPresent(asset -> assetComboBox.getSelectionModel().select(asset));
}
int chainHeight;
if (txIdTextField != null) {

View file

@ -43,7 +43,6 @@ import bisq.core.dao.state.blockchain.Block;
import bisq.core.dao.state.governance.Param;
import bisq.core.dao.state.period.DaoPhase;
import bisq.core.locale.Res;
import bisq.core.provider.fee.FeeService;
import bisq.core.util.BSFormatter;
import bisq.core.util.BsqFormatter;
@ -71,7 +70,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
@ -79,6 +77,10 @@ import static bisq.desktop.util.FormBuilder.addButtonAfterGroup;
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
import static com.google.common.base.Preconditions.checkNotNull;
import bisq.asset.Asset;
@FxmlView
public class MakeProposalView extends ActivatableView<GridPane, Void> implements BsqStateListener {
private final DaoFacade daoFacade;
@ -109,7 +111,6 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
BsqWalletService bsqWalletService,
WalletsSetup walletsSetup,
P2PService p2PService,
FeeService feeService,
PhasesView phasesView,
ChangeParamValidator changeParamValidator,
BSFormatter btcFormatter,
@ -150,11 +151,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
};
alwaysVisibleGridRowIndex = gridRow + 1;
//TODO remove filter once all are implemented
List<ProposalType> proposalTypes = Arrays.stream(ProposalType.values())
.filter(proposalType -> proposalType != ProposalType.GENERIC &&
proposalType != ProposalType.REMOVE_ALTCOIN)
.collect(Collectors.toList());
List<ProposalType> proposalTypes = Arrays.asList(ProposalType.values());
proposalTypeComboBox.setItems(FXCollections.observableArrayList(proposalTypes));
}
@ -269,16 +266,6 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
proposalDisplay.linkInputTextField.getText(),
bsqFormatter.parseToCoin(proposalDisplay.requestedBsqTextField.getText()),
proposalDisplay.bsqAddressTextField.getText());
case BONDED_ROLE:
checkNotNull(proposalDisplay.bondedRoleTypeComboBox,
"proposalDisplay.bondedRoleTypeComboBox must not be null");
bondedRole = new BondedRole(proposalDisplay.nameTextField.getText(),
proposalDisplay.linkInputTextField.getText(),
proposalDisplay.bondedRoleTypeComboBox.getSelectionModel().getSelectedItem());
return daoFacade.getBondedRoleProposalWithTransaction(bondedRole);
case REMOVE_ALTCOIN:
//TODO
throw new RuntimeException("Not implemented yet");
case CHANGE_PARAM:
checkNotNull(proposalDisplay.paramComboBox,
"proposalDisplay.paramComboBox must no tbe null");
@ -304,9 +291,13 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
new Popup<>().warning(e.getMessage()).show();
return null;
}
case GENERIC:
//TODO
throw new RuntimeException("Not implemented yet");
case BONDED_ROLE:
checkNotNull(proposalDisplay.bondedRoleTypeComboBox,
"proposalDisplay.bondedRoleTypeComboBox must not be null");
bondedRole = new BondedRole(proposalDisplay.nameTextField.getText(),
proposalDisplay.linkInputTextField.getText(),
proposalDisplay.bondedRoleTypeComboBox.getSelectionModel().getSelectedItem());
return daoFacade.getBondedRoleProposalWithTransaction(bondedRole);
case CONFISCATE_BOND:
checkNotNull(proposalDisplay.confiscateBondComboBox,
"proposalDisplay.confiscateBondComboBox must not be null");
@ -314,6 +305,16 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
return daoFacade.getConfiscateBondProposalWithTransaction(proposalDisplay.nameTextField.getText(),
proposalDisplay.linkInputTextField.getText(),
bondedRole.getHash());
case GENERIC:
return daoFacade.getGenericProposalWithTransaction(proposalDisplay.nameTextField.getText(),
proposalDisplay.linkInputTextField.getText());
case REMOVE_ASSET:
checkNotNull(proposalDisplay.assetComboBox,
"proposalDisplay.assetComboBox must not be null");
Asset asset = proposalDisplay.assetComboBox.getSelectionModel().getSelectedItem();
return daoFacade.getRemoveAssetProposalWithTransaction(proposalDisplay.nameTextField.getText(),
proposalDisplay.linkInputTextField.getText(),
asset);
default:
final String msg = "Undefined ProposalType " + selectedProposalType;
log.error(msg);

View file

@ -23,9 +23,11 @@ import bisq.core.dao.governance.proposal.Proposal;
import bisq.core.dao.governance.proposal.compensation.CompensationProposal;
import bisq.core.dao.governance.proposal.confiscatebond.ConfiscateBondProposal;
import bisq.core.dao.governance.proposal.param.ChangeParamProposal;
import bisq.core.dao.governance.proposal.removeAsset.RemoveAssetProposal;
import bisq.core.dao.governance.proposal.role.BondedRoleProposal;
import bisq.core.dao.governance.role.BondedRole;
import bisq.core.dao.governance.voteresult.EvaluatedProposal;
import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.core.util.BsqFormatter;
@ -107,23 +109,22 @@ public class ProposalListItem {
CompensationProposal compensationProposal = (CompensationProposal) proposal;
Coin requestedBsq = evaluatedProposal.isAccepted() ? compensationProposal.getRequestedBsq() : Coin.ZERO;
return bsqFormatter.formatCoinWithCode(requestedBsq);
case CHANGE_PARAM:
ChangeParamProposal changeParamProposal = (ChangeParamProposal) proposal;
return changeParamProposal.getParam().getDisplayString();
case BONDED_ROLE:
BondedRoleProposal bondedRoleProposal = (BondedRoleProposal) proposal;
BondedRole bondedRole = bondedRoleProposal.getBondedRole();
return Res.get("dao.bond.bondedRoleType." + bondedRole.getBondedRoleType().name());
case REMOVE_ALTCOIN:
// TODO
return "N/A";
case CHANGE_PARAM:
ChangeParamProposal changeParamProposal = (ChangeParamProposal) proposal;
return changeParamProposal.getParam().getDisplayString();
case GENERIC:
// TODO
return "N/A";
case CONFISCATE_BOND:
ConfiscateBondProposal confiscateBondProposal = (ConfiscateBondProposal) proposal;
// TODO add info to bond
return confiscateBondProposal.getTxId();
case GENERIC:
return proposal.getName();
case REMOVE_ASSET:
RemoveAssetProposal removeAssetProposal = (RemoveAssetProposal) proposal;
return CurrencyUtil.getNameAndCode(removeAssetProposal.getTickerSymbol());
}
return "-";
}