mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Rename BondedRole to Role
This is the first of a series of renaming commits. We want to use role for the immutable class and BondedRole for the wrapper which contains role and the mutable state.
This commit is contained in:
parent
e41be44e9c
commit
8b3c06fb81
16 changed files with 96 additions and 96 deletions
|
@ -49,7 +49,7 @@ import bisq.core.dao.governance.proposal.reimbursement.ReimbursementConsensus;
|
|||
import bisq.core.dao.governance.proposal.reimbursement.ReimbursementProposalService;
|
||||
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.Role;
|
||||
import bisq.core.dao.governance.role.BondedRoleState;
|
||||
import bisq.core.dao.governance.role.BondedRolesService;
|
||||
import bisq.core.dao.state.DaoStateListener;
|
||||
|
@ -263,9 +263,9 @@ public class DaoFacade implements DaoSetupService {
|
|||
hash);
|
||||
}
|
||||
|
||||
public ProposalWithTransaction getBondedRoleProposalWithTransaction(BondedRole bondedRole)
|
||||
public ProposalWithTransaction getBondedRoleProposalWithTransaction(Role role)
|
||||
throws ValidationException, InsufficientMoneyException, TxException {
|
||||
return bondedRoleProposalService.createProposalWithTransaction(bondedRole);
|
||||
return bondedRoleProposalService.createProposalWithTransaction(role);
|
||||
}
|
||||
|
||||
public ProposalWithTransaction getGenericProposalWithTransaction(String name,
|
||||
|
@ -512,7 +512,7 @@ public class DaoFacade implements DaoSetupService {
|
|||
return daoStateService.getLockTime(txId);
|
||||
}
|
||||
|
||||
public List<BondedRole> getActiveBondedRoles() {
|
||||
public List<Role> getActiveBondedRoles() {
|
||||
return bondedRolesService.getActiveBondedRoles();
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ public class DaoFacade implements DaoSetupService {
|
|||
return daoStateService.isUnspent(key);
|
||||
}
|
||||
|
||||
public Optional<BondedRole> getBondedRoleFromHash(byte[] hash) {
|
||||
public Optional<Role> getBondedRoleFromHash(byte[] hash) {
|
||||
return bondedRolesService.getBondedRoleFromHash(hash);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import bisq.core.btc.wallet.TxBroadcaster;
|
|||
import bisq.core.btc.wallet.WalletsManager;
|
||||
import bisq.core.dao.bonding.BondingConsensus;
|
||||
import bisq.core.dao.bonding.bond.BondWithHash;
|
||||
import bisq.core.dao.governance.role.BondedRole;
|
||||
import bisq.core.dao.governance.role.Role;
|
||||
import bisq.core.dao.governance.role.BondedRolesService;
|
||||
|
||||
import bisq.common.handlers.ExceptionHandler;
|
||||
|
@ -73,9 +73,9 @@ public class LockupService {
|
|||
checkArgument(lockTime <= BondingConsensus.getMaxLockTime() &&
|
||||
lockTime >= BondingConsensus.getMinLockTime(), "lockTime not in rage");
|
||||
|
||||
if (bondWithHash instanceof BondedRole) {
|
||||
BondedRole bondedRole = (BondedRole) bondWithHash;
|
||||
if (bondedRolesService.wasRoleAlreadyBonded(bondedRole)) {
|
||||
if (bondWithHash instanceof Role) {
|
||||
Role role = (Role) bondWithHash;
|
||||
if (bondedRolesService.wasRoleAlreadyBonded(role)) {
|
||||
exceptionHandler.handleException(new RuntimeException("The role has been used already for a lockup tx."));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package bisq.core.dao.governance.proposal.role;
|
|||
|
||||
import bisq.core.dao.governance.proposal.Proposal;
|
||||
import bisq.core.dao.governance.proposal.ProposalType;
|
||||
import bisq.core.dao.governance.role.BondedRole;
|
||||
import bisq.core.dao.governance.role.Role;
|
||||
import bisq.core.dao.state.blockchain.TxType;
|
||||
import bisq.core.dao.state.governance.Param;
|
||||
|
||||
|
@ -40,12 +40,12 @@ import javax.annotation.concurrent.Immutable;
|
|||
@EqualsAndHashCode(callSuper = true)
|
||||
@Value
|
||||
public final class BondedRoleProposal extends Proposal {
|
||||
private final BondedRole bondedRole;
|
||||
private final Role role;
|
||||
|
||||
BondedRoleProposal(BondedRole bondedRole) {
|
||||
this(bondedRole.getName(),
|
||||
bondedRole.getLink(),
|
||||
bondedRole,
|
||||
BondedRoleProposal(Role role) {
|
||||
this(role.getName(),
|
||||
role.getLink(),
|
||||
role,
|
||||
Version.PROPOSAL,
|
||||
new Date().getTime(),
|
||||
"");
|
||||
|
@ -58,7 +58,7 @@ public final class BondedRoleProposal extends Proposal {
|
|||
|
||||
private BondedRoleProposal(String name,
|
||||
String link,
|
||||
BondedRole bondedRole,
|
||||
Role role,
|
||||
byte version,
|
||||
long creationDate,
|
||||
String txId) {
|
||||
|
@ -68,13 +68,13 @@ public final class BondedRoleProposal extends Proposal {
|
|||
creationDate,
|
||||
txId);
|
||||
|
||||
this.bondedRole = bondedRole;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PB.Proposal.Builder getProposalBuilder() {
|
||||
final PB.BondedRoleProposal.Builder builder = PB.BondedRoleProposal.newBuilder()
|
||||
.setBondedRole(bondedRole.toProtoMessage());
|
||||
.setBondedRole(role.toProtoMessage());
|
||||
return super.getProposalBuilder().setBondedRoleProposal(builder);
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public final class BondedRoleProposal extends Proposal {
|
|||
final PB.BondedRoleProposal proposalProto = proto.getBondedRoleProposal();
|
||||
return new BondedRoleProposal(proto.getName(),
|
||||
proto.getLink(),
|
||||
BondedRole.fromProto(proposalProto.getBondedRole()),
|
||||
Role.fromProto(proposalProto.getBondedRole()),
|
||||
(byte) proto.getVersion(),
|
||||
proto.getCreationDate(),
|
||||
proto.getTxId());
|
||||
|
@ -117,7 +117,7 @@ public final class BondedRoleProposal extends Proposal {
|
|||
public Proposal cloneProposalAndAddTxId(String txId) {
|
||||
return new BondedRoleProposal(getName(),
|
||||
getLink(),
|
||||
getBondedRole(),
|
||||
this.getRole(),
|
||||
getVersion(),
|
||||
getCreationDate().getTime(),
|
||||
txId);
|
||||
|
@ -126,7 +126,7 @@ public final class BondedRoleProposal extends Proposal {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "BondedRoleProposal{" +
|
||||
"\n bondedRole=" + bondedRole +
|
||||
"\n role=" + role +
|
||||
"\n} " + super.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import bisq.core.dao.exceptions.ValidationException;
|
|||
import bisq.core.dao.governance.proposal.BaseProposalService;
|
||||
import bisq.core.dao.governance.proposal.ProposalWithTransaction;
|
||||
import bisq.core.dao.governance.proposal.TxException;
|
||||
import bisq.core.dao.governance.role.BondedRole;
|
||||
import bisq.core.dao.governance.role.Role;
|
||||
import bisq.core.dao.state.DaoStateService;
|
||||
|
||||
import org.bitcoinj.core.InsufficientMoneyException;
|
||||
|
@ -37,7 +37,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
*/
|
||||
@Slf4j
|
||||
public class BondedRoleProposalService extends BaseProposalService<BondedRoleProposal> {
|
||||
private BondedRole bondedRole;
|
||||
private Role role;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -55,15 +55,15 @@ public class BondedRoleProposalService extends BaseProposalService<BondedRolePro
|
|||
proposalValidator);
|
||||
}
|
||||
|
||||
public ProposalWithTransaction createProposalWithTransaction(BondedRole bondedRole)
|
||||
public ProposalWithTransaction createProposalWithTransaction(Role role)
|
||||
throws ValidationException, InsufficientMoneyException, TxException {
|
||||
this.bondedRole = bondedRole;
|
||||
this.role = role;
|
||||
|
||||
return super.createProposalWithTransaction(bondedRole.getName(), bondedRole.getLink());
|
||||
return super.createProposalWithTransaction(role.getName(), role.getLink());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BondedRoleProposal createProposalWithoutTxId() {
|
||||
return new BondedRoleProposal(bondedRole);
|
||||
return new BondedRoleProposal(role);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package bisq.core.dao.governance.proposal.role;
|
|||
import bisq.core.dao.exceptions.ValidationException;
|
||||
import bisq.core.dao.governance.proposal.Proposal;
|
||||
import bisq.core.dao.governance.proposal.ProposalValidator;
|
||||
import bisq.core.dao.governance.role.BondedRole;
|
||||
import bisq.core.dao.governance.role.Role;
|
||||
import bisq.core.dao.state.DaoStateService;
|
||||
import bisq.core.dao.state.period.PeriodService;
|
||||
|
||||
|
@ -44,10 +44,10 @@ public class BondedRoleValidator extends ProposalValidator {
|
|||
super.validateDataFields(proposal);
|
||||
|
||||
BondedRoleProposal bondedRoleProposal = (BondedRoleProposal) proposal;
|
||||
BondedRole bondedRole = bondedRoleProposal.getBondedRole();
|
||||
Role role = bondedRoleProposal.getRole();
|
||||
|
||||
//TODO
|
||||
notEmpty(bondedRole.getName(), "bondedRole.name must not be empty");
|
||||
notEmpty(role.getName(), "role.name must not be empty");
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
throw new ValidationException(throwable);
|
||||
|
|
|
@ -27,7 +27,7 @@ import javax.annotation.Nullable;
|
|||
*/
|
||||
@Getter
|
||||
public class BondedRoleState {
|
||||
private final BondedRole bondedRole;
|
||||
private final Role role;
|
||||
|
||||
@Setter
|
||||
private long startDate;
|
||||
|
@ -45,8 +45,8 @@ public class BondedRoleState {
|
|||
@Setter
|
||||
private boolean isUnlocking;
|
||||
|
||||
BondedRoleState(BondedRole bondedRole) {
|
||||
this.bondedRole = bondedRole;
|
||||
BondedRoleState(Role role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public boolean isLockedUp() {
|
||||
|
|
|
@ -90,7 +90,7 @@ public class BondedRolesService implements DaoStateListener {
|
|||
// We used the hash of th bonded role object as our hash in OpReturn of the lock up tx to have a
|
||||
// unique binding of the tx to the data object.
|
||||
byte[] hash = BondingConsensus.getHashFromOpReturnData(opReturnData);
|
||||
Optional<BondedRole> candidate = getBondedRoleFromHash(hash);
|
||||
Optional<Role> candidate = getBondedRoleFromHash(hash);
|
||||
if (candidate.isPresent() && bondedRole.equals(candidate.get())) {
|
||||
if (bondedRoleState.getLockupTxId() == null) {
|
||||
bondedRoleState.setLockupTxId(lockupTxId);
|
||||
|
@ -149,7 +149,7 @@ public class BondedRolesService implements DaoStateListener {
|
|||
}
|
||||
|
||||
|
||||
public List<BondedRole> getBondedRoleList() {
|
||||
public List<Role> getBondedRoleList() {
|
||||
return getBondedRoleStream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
@ -158,12 +158,12 @@ public class BondedRolesService implements DaoStateListener {
|
|||
}
|
||||
|
||||
// bonded roles which are active and can be confiscated
|
||||
public List<BondedRole> getActiveBondedRoles() {
|
||||
public List<Role> getActiveBondedRoles() {
|
||||
//TODO
|
||||
return getBondedRoleList();
|
||||
}
|
||||
|
||||
public Optional<BondedRole> getBondedRoleFromHash(byte[] hash) {
|
||||
public Optional<Role> getBondedRoleFromHash(byte[] hash) {
|
||||
return getBondedRoleStream()
|
||||
.filter(bondedRole -> {
|
||||
byte[] candidateHash = bondedRole.getHash();
|
||||
|
@ -186,8 +186,8 @@ public class BondedRolesService implements DaoStateListener {
|
|||
|
||||
public Optional<BondedRoleType> getBondedRoleType(String lockUpTxId) {
|
||||
return getBondedRoleStateFromLockupTxId(lockUpTxId)
|
||||
.map(BondedRoleState::getBondedRole)
|
||||
.map(BondedRole::getBondedRoleType);
|
||||
.map(BondedRoleState::getRole)
|
||||
.map(Role::getBondedRoleType);
|
||||
}
|
||||
|
||||
|
||||
|
@ -196,10 +196,10 @@ public class BondedRolesService implements DaoStateListener {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
private Stream<BondedRole> getBondedRoleStream() {
|
||||
private Stream<Role> getBondedRoleStream() {
|
||||
return daoStateService.getEvaluatedProposalList().stream()
|
||||
.filter(evaluatedProposal -> evaluatedProposal.getProposal() instanceof BondedRoleProposal)
|
||||
.map(e -> ((BondedRoleProposal) e.getProposal()).getBondedRole());
|
||||
.map(e -> ((BondedRoleProposal) e.getProposal()).getRole());
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,8 +207,8 @@ public class BondedRolesService implements DaoStateListener {
|
|||
return daoStateService.getLockupOpReturnTxOutput(lockUpTxId).map(BaseTxOutput::getOpReturnData);
|
||||
}
|
||||
|
||||
public boolean wasRoleAlreadyBonded(BondedRole bondedRole) {
|
||||
BondedRoleState bondedRoleState = bondedRoleStateMap.get(bondedRole.getUid());
|
||||
public boolean wasRoleAlreadyBonded(Role role) {
|
||||
BondedRoleState bondedRoleState = bondedRoleStateMap.get(role.getUid());
|
||||
return bondedRoleState != null && bondedRoleState.getLockupTxId() != null;
|
||||
}
|
||||
|
||||
|
@ -218,13 +218,13 @@ public class BondedRolesService implements DaoStateListener {
|
|||
.flatMap(BondingConsensus::getLockupType);
|
||||
}*/
|
||||
|
||||
/*public static Optional<BondedRole> getBondedRoleByLockupTxId(String lockupTxId) {
|
||||
/*public static Optional<Role> getBondedRoleByLockupTxId(String lockupTxId) {
|
||||
return bondedRoles.stream()
|
||||
.filter(bondedRole -> bondedRole.getLockupTxId().equals(lockupTxId)).
|
||||
findAny();
|
||||
}*/
|
||||
/*
|
||||
public static Optional<BondedRole> getBondedRoleByHashOfBondId(byte[] hash) {
|
||||
public static Optional<Role> getBondedRoleByHashOfBondId(byte[] hash) {
|
||||
return Optional.empty();
|
||||
*//* bondedRoles.stream()
|
||||
.filter(bondedRole -> Arrays.equals(bondedRole.getHash(), hash))
|
||||
|
|
|
@ -40,7 +40,7 @@ import javax.annotation.concurrent.Immutable;
|
|||
@Immutable
|
||||
@Slf4j
|
||||
@Value
|
||||
public final class BondedRole implements PersistablePayload, NetworkPayload, BondWithHash {
|
||||
public final class Role implements PersistablePayload, NetworkPayload, BondWithHash {
|
||||
private final String uid;
|
||||
private final String name;
|
||||
private final String link;
|
||||
|
@ -51,9 +51,9 @@ public final class BondedRole implements PersistablePayload, NetworkPayload, Bon
|
|||
* @param link Github account or forum account of user
|
||||
* @param bondedRoleType BondedRoleType
|
||||
*/
|
||||
public BondedRole(String name,
|
||||
String link,
|
||||
BondedRoleType bondedRoleType) {
|
||||
public Role(String name,
|
||||
String link,
|
||||
BondedRoleType bondedRoleType) {
|
||||
this(UUID.randomUUID().toString(),
|
||||
name,
|
||||
link,
|
||||
|
@ -66,10 +66,10 @@ public final class BondedRole implements PersistablePayload, NetworkPayload, Bon
|
|||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public BondedRole(String uid,
|
||||
String name,
|
||||
String link,
|
||||
BondedRoleType bondedRoleType) {
|
||||
public Role(String uid,
|
||||
String name,
|
||||
String link,
|
||||
BondedRoleType bondedRoleType) {
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.link = link;
|
||||
|
@ -86,8 +86,8 @@ public final class BondedRole implements PersistablePayload, NetworkPayload, Bon
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
public static BondedRole fromProto(PB.BondedRole proto) {
|
||||
return new BondedRole(proto.getUid(),
|
||||
public static Role fromProto(PB.BondedRole proto) {
|
||||
return new Role(proto.getUid(),
|
||||
proto.getName(),
|
||||
proto.getLink(),
|
||||
ProtoUtil.enumFromProto(BondedRoleType.class, proto.getBondedRoleType()));
|
||||
|
@ -121,7 +121,7 @@ public final class BondedRole implements PersistablePayload, NetworkPayload, Bon
|
|||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
BondedRole that = (BondedRole) o;
|
||||
Role that = (Role) o;
|
||||
return Objects.equals(uid, that.uid) &&
|
||||
Objects.equals(name, that.name) &&
|
||||
Objects.equals(link, that.link) &&
|
||||
|
@ -135,7 +135,7 @@ public final class BondedRole implements PersistablePayload, NetworkPayload, Bon
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BondedRole{" +
|
||||
return "Role{" +
|
||||
"\n uid='" + uid + '\'' +
|
||||
",\n name='" + name + '\'' +
|
||||
",\n link='" + link + '\'' +
|
|
@ -37,7 +37,7 @@ 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.role.Role;
|
||||
import bisq.core.dao.governance.role.BondedRolesService;
|
||||
import bisq.core.dao.governance.voteresult.issuance.IssuanceService;
|
||||
import bisq.core.dao.governance.votereveal.VoteRevealConsensus;
|
||||
|
@ -643,11 +643,11 @@ public class VoteResultService implements DaoStateListener, DaoSetupService {
|
|||
acceptedEvaluatedProposals.forEach(evaluatedProposal -> {
|
||||
if (evaluatedProposal.getProposal() instanceof BondedRoleProposal) {
|
||||
BondedRoleProposal bondedRoleProposal = (BondedRoleProposal) evaluatedProposal.getProposal();
|
||||
BondedRole bondedRole = bondedRoleProposal.getBondedRole();
|
||||
Role role = bondedRoleProposal.getRole();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("\n################################################################################\n");
|
||||
sb.append("We added a bonded role. ProposalTxId=").append(bondedRoleProposal.getTxId())
|
||||
.append("\nBondedRole: ").append(bondedRole.getDisplayString())
|
||||
.append("\nRole: ").append(role.getDisplayString())
|
||||
.append("\n################################################################################\n");
|
||||
log.info(sb.toString());
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import bisq.core.dao.DaoFacade;
|
|||
import bisq.core.dao.bonding.bond.BondWithHash;
|
||||
import bisq.core.dao.bonding.bond.BondedReputation;
|
||||
import bisq.core.dao.bonding.lockup.LockupType;
|
||||
import bisq.core.dao.governance.role.BondedRole;
|
||||
import bisq.core.dao.governance.role.Role;
|
||||
import bisq.core.dao.governance.role.BondedRoleType;
|
||||
import bisq.core.dao.state.blockchain.TxOutput;
|
||||
import bisq.core.locale.Res;
|
||||
|
@ -104,11 +104,11 @@ public class BondingViewUtils {
|
|||
resultHandler.handleResult();
|
||||
}
|
||||
|
||||
public void lockupBondForBondedRole(BondedRole bondedRole, ResultHandler resultHandler) {
|
||||
BondedRoleType bondedRoleType = bondedRole.getBondedRoleType();
|
||||
public void lockupBondForBondedRole(Role role, ResultHandler resultHandler) {
|
||||
BondedRoleType bondedRoleType = role.getBondedRoleType();
|
||||
Coin lockupAmount = Coin.valueOf(bondedRoleType.getRequiredBond());
|
||||
int lockupTime = bondedRoleType.getUnlockTimeInBlocks();
|
||||
lockupBond(bondedRole, lockupAmount, lockupTime, LockupType.BONDED_ROLE, resultHandler);
|
||||
lockupBond(role, lockupAmount, lockupTime, LockupType.BONDED_ROLE, resultHandler);
|
||||
}
|
||||
|
||||
public void lockupBondForReputation(Coin lockupAmount, int lockupTime, ResultHandler resultHandler) {
|
||||
|
|
|
@ -32,7 +32,7 @@ import bisq.core.btc.wallet.BsqWalletService;
|
|||
import bisq.core.dao.DaoFacade;
|
||||
import bisq.core.dao.bonding.BondingConsensus;
|
||||
import bisq.core.dao.bonding.lockup.LockupType;
|
||||
import bisq.core.dao.governance.role.BondedRole;
|
||||
import bisq.core.dao.governance.role.Role;
|
||||
import bisq.core.dao.governance.role.BondedRoleState;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.BsqFormatter;
|
||||
|
@ -166,7 +166,7 @@ public class LockupView extends ActivatableView<GridPane, Void> implements BsqBa
|
|||
bondedRolesComboBox.setConverter(new StringConverter<>() {
|
||||
@Override
|
||||
public String toString(BondedRoleState bondedRoleState) {
|
||||
return bondedRoleState.getBondedRole().getDisplayString();
|
||||
return bondedRoleState.getRole().getDisplayString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,9 +176,9 @@ public class LockupView extends ActivatableView<GridPane, Void> implements BsqBa
|
|||
});
|
||||
bondedRoleStateListener = (observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
BondedRole bondedRole = newValue.getBondedRole();
|
||||
amountInputTextField.setText(bsqFormatter.formatCoin(Coin.valueOf(bondedRole.getBondedRoleType().getRequiredBond())));
|
||||
timeInputTextField.setText(String.valueOf(bondedRole.getBondedRoleType().getUnlockTimeInBlocks()));
|
||||
Role role = newValue.getRole();
|
||||
amountInputTextField.setText(bsqFormatter.formatCoin(Coin.valueOf(role.getBondedRoleType().getRequiredBond())));
|
||||
timeInputTextField.setText(String.valueOf(role.getBondedRoleType().getUnlockTimeInBlocks()));
|
||||
amountInputTextField.resetValidation();
|
||||
timeInputTextField.resetValidation();
|
||||
amountInputTextField.setEditable(false);
|
||||
|
@ -198,7 +198,7 @@ public class LockupView extends ActivatableView<GridPane, Void> implements BsqBa
|
|||
switch (lockupTypeComboBox.getValue()) {
|
||||
case BONDED_ROLE:
|
||||
if (bondedRolesComboBox.getValue() != null) {
|
||||
bondingViewUtils.lockupBondForBondedRole(bondedRolesComboBox.getValue().getBondedRole(),
|
||||
bondingViewUtils.lockupBondForBondedRole(bondedRolesComboBox.getValue().getRole(),
|
||||
() -> bondedRolesComboBox.getSelectionModel().clearSelection());
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -20,7 +20,7 @@ package bisq.desktop.main.dao.bonding.roles;
|
|||
import bisq.desktop.components.AutoTooltipButton;
|
||||
|
||||
import bisq.core.dao.DaoFacade;
|
||||
import bisq.core.dao.governance.role.BondedRole;
|
||||
import bisq.core.dao.governance.role.Role;
|
||||
import bisq.core.dao.governance.role.BondedRoleState;
|
||||
import bisq.core.dao.state.DaoStateListener;
|
||||
import bisq.core.dao.state.blockchain.Block;
|
||||
|
@ -44,7 +44,7 @@ class BondedRolesListItem implements DaoStateListener {
|
|||
private final BsqFormatter bsqFormatter;
|
||||
private final AutoTooltipButton button;
|
||||
private final Label label;
|
||||
private final BondedRole bondedRole;
|
||||
private final Role role;
|
||||
|
||||
BondedRolesListItem(BondedRoleState bondedRoleState,
|
||||
DaoFacade daoFacade,
|
||||
|
@ -53,7 +53,7 @@ class BondedRolesListItem implements DaoStateListener {
|
|||
this.daoFacade = daoFacade;
|
||||
this.bsqFormatter = bsqFormatter;
|
||||
|
||||
bondedRole = bondedRoleState.getBondedRole();
|
||||
role = bondedRoleState.getRole();
|
||||
|
||||
daoFacade.addBsqStateListener(this);
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ public class BondedRolesView extends ActivatableView<GridPane, Void> implements
|
|||
public void updateItem(final BondedRolesListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && !empty) {
|
||||
setText(item.getBondedRole().getName());
|
||||
setText(item.getRole().getName());
|
||||
} else
|
||||
setText("");
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public class BondedRolesView extends ActivatableView<GridPane, Void> implements
|
|||
public void updateItem(final BondedRolesListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && !empty) {
|
||||
String link = item.getBondedRole().getLink();
|
||||
String link = item.getRole().getLink();
|
||||
hyperlinkWithIcon = new HyperlinkWithIcon(link, AwesomeIcon.EXTERNAL_LINK);
|
||||
hyperlinkWithIcon.setOnAction(event -> GUIUtil.openWebPage(link));
|
||||
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("shared.openURL", link)));
|
||||
|
@ -246,7 +246,7 @@ public class BondedRolesView extends ActivatableView<GridPane, Void> implements
|
|||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
BondedRoleType bondedRoleType = item.getBondedRole().getBondedRoleType();
|
||||
BondedRoleType bondedRoleType = item.getRole().getBondedRoleType();
|
||||
String type = bondedRoleType.getDisplayString();
|
||||
hyperlink = new Hyperlink(type);
|
||||
hyperlink.setOnAction(event -> {
|
||||
|
@ -455,7 +455,7 @@ public class BondedRolesView extends ActivatableView<GridPane, Void> implements
|
|||
button.setDisable(true);
|
||||
});
|
||||
else
|
||||
bondingViewUtils.lockupBondForBondedRole(item.getBondedRole(), null);
|
||||
bondingViewUtils.lockupBondForBondedRole(item.getRole(), null);
|
||||
});
|
||||
setGraphic(button);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ import bisq.core.dao.governance.proposal.param.ChangeParamValidator;
|
|||
import bisq.core.dao.governance.proposal.reimbursement.ReimbursementProposal;
|
||||
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.Role;
|
||||
import bisq.core.dao.governance.role.BondedRoleType;
|
||||
import bisq.core.dao.governance.voteresult.EvaluatedProposal;
|
||||
import bisq.core.dao.governance.voteresult.ProposalVoteResult;
|
||||
|
@ -111,7 +111,7 @@ public class ProposalDisplay {
|
|||
@Nullable
|
||||
public ComboBox<Param> paramComboBox;
|
||||
@Nullable
|
||||
public ComboBox<BondedRole> confiscateBondComboBox;
|
||||
public ComboBox<Role> confiscateBondComboBox;
|
||||
@Nullable
|
||||
public ComboBox<BondedRoleType> bondedRoleTypeComboBox;
|
||||
@Nullable
|
||||
|
@ -299,19 +299,19 @@ public class ProposalDisplay {
|
|||
|
||||
break;
|
||||
case CONFISCATE_BOND:
|
||||
confiscateBondComboBox = FormBuilder.<BondedRole>addComboBox(gridPane, ++gridRow,
|
||||
confiscateBondComboBox = FormBuilder.<Role>addComboBox(gridPane, ++gridRow,
|
||||
Res.get("dao.proposal.display.confiscateBondComboBox.label"));
|
||||
comboBoxValueTextFieldIndex = gridRow;
|
||||
checkNotNull(confiscateBondComboBox, "confiscateBondComboBox must not be null");
|
||||
confiscateBondComboBox.setItems(FXCollections.observableArrayList(daoFacade.getActiveBondedRoles()));
|
||||
confiscateBondComboBox.setConverter(new StringConverter<>() {
|
||||
@Override
|
||||
public String toString(BondedRole bondedRole) {
|
||||
return bondedRole != null ? bondedRole.getDisplayString() : "";
|
||||
public String toString(Role role) {
|
||||
return role != null ? role.getDisplayString() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public BondedRole fromString(String string) {
|
||||
public Role fromString(String string) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
@ -473,10 +473,10 @@ public class ProposalDisplay {
|
|||
} else if (proposal instanceof BondedRoleProposal) {
|
||||
BondedRoleProposal bondedRoleProposal = (BondedRoleProposal) proposal;
|
||||
checkNotNull(bondedRoleTypeComboBox, "bondedRoleComboBox must not be null");
|
||||
BondedRole bondedRole = bondedRoleProposal.getBondedRole();
|
||||
bondedRoleTypeComboBox.getSelectionModel().select(bondedRole.getBondedRoleType());
|
||||
comboBoxValueTextField.setText(bondedRoleTypeComboBox.getConverter().toString(bondedRole.getBondedRoleType()));
|
||||
requiredBondForRoleTextField.setText(bsqFormatter.formatCoin(Coin.valueOf(bondedRole.getBondedRoleType().getRequiredBond())));
|
||||
Role role = bondedRoleProposal.getRole();
|
||||
bondedRoleTypeComboBox.getSelectionModel().select(role.getBondedRoleType());
|
||||
comboBoxValueTextField.setText(bondedRoleTypeComboBox.getConverter().toString(role.getBondedRoleType()));
|
||||
requiredBondForRoleTextField.setText(bsqFormatter.formatCoin(Coin.valueOf(role.getBondedRoleType().getRequiredBond())));
|
||||
} else if (proposal instanceof ConfiscateBondProposal) {
|
||||
ConfiscateBondProposal confiscateBondProposal = (ConfiscateBondProposal) proposal;
|
||||
checkNotNull(confiscateBondComboBox, "confiscateBondComboBox must not be null");
|
||||
|
|
|
@ -37,7 +37,7 @@ import bisq.core.dao.governance.proposal.ProposalType;
|
|||
import bisq.core.dao.governance.proposal.ProposalWithTransaction;
|
||||
import bisq.core.dao.governance.proposal.TxException;
|
||||
import bisq.core.dao.governance.proposal.param.ChangeParamValidator;
|
||||
import bisq.core.dao.governance.role.BondedRole;
|
||||
import bisq.core.dao.governance.role.Role;
|
||||
import bisq.core.dao.state.DaoStateListener;
|
||||
import bisq.core.dao.state.blockchain.Block;
|
||||
import bisq.core.dao.state.governance.Param;
|
||||
|
@ -254,7 +254,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
|
|||
private ProposalWithTransaction getProposalWithTransaction(ProposalType type)
|
||||
throws InsufficientMoneyException, ValidationException, TxException {
|
||||
|
||||
BondedRole bondedRole;
|
||||
Role role;
|
||||
switch (type) {
|
||||
case COMPENSATION_REQUEST:
|
||||
checkNotNull(proposalDisplay.requestedBsqTextField,
|
||||
|
@ -297,17 +297,17 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
|
|||
case BONDED_ROLE:
|
||||
checkNotNull(proposalDisplay.bondedRoleTypeComboBox,
|
||||
"proposalDisplay.bondedRoleTypeComboBox must not be null");
|
||||
bondedRole = new BondedRole(proposalDisplay.nameTextField.getText(),
|
||||
role = new Role(proposalDisplay.nameTextField.getText(),
|
||||
proposalDisplay.linkInputTextField.getText(),
|
||||
proposalDisplay.bondedRoleTypeComboBox.getSelectionModel().getSelectedItem());
|
||||
return daoFacade.getBondedRoleProposalWithTransaction(bondedRole);
|
||||
return daoFacade.getBondedRoleProposalWithTransaction(role);
|
||||
case CONFISCATE_BOND:
|
||||
checkNotNull(proposalDisplay.confiscateBondComboBox,
|
||||
"proposalDisplay.confiscateBondComboBox must not be null");
|
||||
bondedRole = proposalDisplay.confiscateBondComboBox.getSelectionModel().getSelectedItem();
|
||||
role = proposalDisplay.confiscateBondComboBox.getSelectionModel().getSelectedItem();
|
||||
return daoFacade.getConfiscateBondProposalWithTransaction(proposalDisplay.nameTextField.getText(),
|
||||
proposalDisplay.linkInputTextField.getText(),
|
||||
bondedRole.getHash());
|
||||
role.getHash());
|
||||
case GENERIC:
|
||||
return daoFacade.getGenericProposalWithTransaction(proposalDisplay.nameTextField.getText(),
|
||||
proposalDisplay.linkInputTextField.getText());
|
||||
|
|
|
@ -28,7 +28,7 @@ import bisq.core.dao.governance.proposal.param.ChangeParamProposal;
|
|||
import bisq.core.dao.governance.proposal.reimbursement.ReimbursementProposal;
|
||||
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.Role;
|
||||
import bisq.core.dao.governance.voteresult.EvaluatedProposal;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
@ -120,8 +120,8 @@ public class ProposalListItem {
|
|||
return changeParamProposal.getParam().getDisplayString();
|
||||
case BONDED_ROLE:
|
||||
BondedRoleProposal bondedRoleProposal = (BondedRoleProposal) proposal;
|
||||
BondedRole bondedRole = bondedRoleProposal.getBondedRole();
|
||||
return Res.get("dao.bond.bondedRoleType." + bondedRole.getBondedRoleType().name());
|
||||
Role role = bondedRoleProposal.getRole();
|
||||
return Res.get("dao.bond.bondedRoleType." + role.getBondedRoleType().name());
|
||||
case CONFISCATE_BOND:
|
||||
ConfiscateBondProposal confiscateBondProposal = (ConfiscateBondProposal) proposal;
|
||||
// TODO add info to bond
|
||||
|
|
Loading…
Add table
Reference in a new issue