Add more bonded roles

This commit is contained in:
Manfred Karrer 2018-10-31 12:59:08 -05:00
parent 2d3269a07a
commit 3e81c6008b
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
4 changed files with 38 additions and 20 deletions

View file

@ -24,35 +24,53 @@ import lombok.Getter;
// Data here must not be changed as it would break backward compatibility! In case we need to change we need to add a new // Data here must not be changed as it would break backward compatibility! In case we need to change we need to add a new
// entry and maintain the old one. Once all the role holders of an old deprecated role have revoked the role might get removed. // entry and maintain the old one. Once all the role holders of an old deprecated role have revoked the role might get removed.
public enum BondedRoleType { public enum BondedRoleType {
ARBITRATOR(10000000, 5, "https://github.com/bisq-network/roles/issues/13", true), // 100 000 BSQ, 30 days unlock time // admins
DOMAIN_NAME_HOLDER(5000000, 20, "https://github.com/bisq-network/roles/issues/15", false), // 50 000 BSQ, 20 days unlock time //TODO no link yet GITHUB_ADMIN(50_000, 60, "https://github.com/bisq-network/roles/issues/16", true),
SEED_NODE_OPERATOR(2000000, 50, "https://github.com/bisq-network/roles/issues/15", true); // 20 000 BSQ, 30 days unlock time FORUM_ADMIN(20_000, 60, "https://github.com/bisq-network/roles/issues/19", true),
/* TWITTER_ADMIN(20_000, 60, "https://github.com/bisq-network/roles/issues/21", true),
ARBITRATOR(10000000, 144 * 30, "https://github.com/bisq-network/roles/issues/13", true), // 100 000 BSQ, 30 days unlock time SLACK_ADMIN(20_000, 60, "https://github.com/bisq-network/roles/issues/23", true),
DOMAIN_NAME_HOLDER(5000000, 144 * 20, "https://github.com/bisq-network/roles/issues/15", false), // 50 000 BSQ, 20 days unlock time //TODO no link yet YOUTUBE_ADMIN(5_000, 60, "https://github.com/bisq-network/roles/issues/56", true),
SEED_NODE_OPERATOR(2000000, 144 * 30, "https://github.com/bisq-network/roles/issues/15", true); // 20 000 BSQ, 30 days unlock time
*/ // maintainers
BISQ_MAINTAINER(50_000, 60, "https://github.com/bisq-network/roles/issues/63", true),
// operators
WEBSITE_OPERATOR(50_000, 60, "https://github.com/bisq-network/roles/issues/12", true),
FORUM_OPERATOR(50_000, 60, "https://github.com/bisq-network/roles/issues/19", true),
SEED_NODE_OPERATOR(20_000, 60, "https://github.com/bisq-network/roles/issues/15", true),
PRICE_NODE_OPERATOR(20_000, 60, "https://github.com/bisq-network/roles/issues/14", true),
BTC_NODE_OPERATOR(5_000, 60, "https://github.com/bisq-network/roles/issues/67", true),
MARKETS_OPERATOR(20_000, 60, "https://github.com/bisq-network/roles/issues/9", true),
BSQ_EXPLORER_OPERATOR(20_000, 60, "https://github.com/bisq-network/roles/issues/11", true),
// other
DOMAIN_NAME_HOLDER(50_000, 60, "https://github.com/bisq-network/roles/issues/77", false),
DNS_ADMIN(50_000, 60, "https://github.com/bisq-network/roles/issues/18", false),
MEDIATOR(10_000, 60, "N/A", true),
ARBITRATOR(200_000, 60, "https://github.com/bisq-network/roles/issues/13", true);
// Satoshi value of BSQ bond
@Getter @Getter
private final long requiredBond; private final long requiredBond;
// Unlock time in blocks
@Getter @Getter
private final int unlockTime; private final int unlockTimeInBlocks;
@Getter @Getter
private final String link; private final String link;
@Getter @Getter
private final boolean allowMultipleHolders; private final boolean allowMultipleHolders;
/** /**
* * @param requiredBondInBsq // requiredBond in BSQ for lockup tx
* @param requiredBond // requiredBond in BSQ for lockup tx * @param unlockTimeInDays // unlockTime in days
* @param unlockTime // unlockTime in blocks
* @param link // Link to Github for role description * @param link // Link to Github for role description
* @param allowMultipleHolders // If role can be held by multiple persons (e.g. seed nodes in contrary to domain name) * @param allowMultipleHolders // If role can be held by multiple persons (e.g. seed nodes vs. domain name)
*/ */
BondedRoleType(long requiredBond, int unlockTime, String link, boolean allowMultipleHolders) { BondedRoleType(long requiredBondInBsq, int unlockTimeInDays, String link, boolean allowMultipleHolders) {
this.requiredBond = requiredBond; this.requiredBond = requiredBondInBsq * 100;
this.unlockTime = unlockTime; this.unlockTimeInBlocks = unlockTimeInDays * 144;
this.link = link; this.link = link;
this.allowMultipleHolders = allowMultipleHolders; this.allowMultipleHolders = allowMultipleHolders;
} }
@ -65,7 +83,7 @@ public enum BondedRoleType {
public String toString() { public String toString() {
return "BondedRoleType{" + return "BondedRoleType{" +
"\n requiredBond=" + requiredBond + "\n requiredBond=" + requiredBond +
",\n unlockTime=" + unlockTime + ",\n unlockTime=" + unlockTimeInBlocks +
",\n link='" + link + '\'' + ",\n link='" + link + '\'' +
",\n allowMultipleHolders=" + allowMultipleHolders + ",\n allowMultipleHolders=" + allowMultipleHolders +
"\n} " + super.toString(); "\n} " + super.toString();

View file

@ -69,7 +69,7 @@ public class BondingViewUtils {
if (GUIUtil.isReadyForTxBroadcast(p2PService, walletsSetup)) { if (GUIUtil.isReadyForTxBroadcast(p2PService, walletsSetup)) {
BondedRoleType bondedRoleType = bondedRole.getBondedRoleType(); BondedRoleType bondedRoleType = bondedRole.getBondedRoleType();
Coin lockupAmount = Coin.valueOf(bondedRoleType.getRequiredBond()); Coin lockupAmount = Coin.valueOf(bondedRoleType.getRequiredBond());
int lockupTime = bondedRoleType.getUnlockTime(); int lockupTime = bondedRoleType.getUnlockTimeInBlocks();
LockupType lockupType = LockupType.BONDED_ROLE; LockupType lockupType = LockupType.BONDED_ROLE;
new Popup<>().headLine(Res.get("dao.bonding.lock.sendFunds.headline")) new Popup<>().headLine(Res.get("dao.bonding.lock.sendFunds.headline"))
.confirmation(Res.get("dao.bonding.lock.sendFunds.details", .confirmation(Res.get("dao.bonding.lock.sendFunds.details",

View file

@ -154,7 +154,7 @@ public class LockupView extends ActivatableView<GridPane, Void> implements BsqBa
bondedRolesListener = (observable, oldValue, newValue) -> { bondedRolesListener = (observable, oldValue, newValue) -> {
if (newValue != null) { if (newValue != null) {
amountInputTextField.setText(bsqFormatter.formatCoin(Coin.valueOf(newValue.getBondedRoleType().getRequiredBond()))); amountInputTextField.setText(bsqFormatter.formatCoin(Coin.valueOf(newValue.getBondedRoleType().getRequiredBond())));
timeInputTextField.setText(String.valueOf(newValue.getBondedRoleType().getUnlockTime())); timeInputTextField.setText(String.valueOf(newValue.getBondedRoleType().getUnlockTimeInBlocks()));
amountInputTextField.resetValidation(); amountInputTextField.resetValidation();
timeInputTextField.resetValidation(); timeInputTextField.resetValidation();
amountInputTextField.setEditable(false); amountInputTextField.setEditable(false);

View file

@ -81,7 +81,7 @@ class BondedRoleTypeWindow extends Overlay<BondedRoleTypeWindow> {
bsqFormatter.formatCoinWithCode(Coin.valueOf(bondedRoleType.getRequiredBond()))); bsqFormatter.formatCoinWithCode(Coin.valueOf(bondedRoleType.getRequiredBond())));
FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.getWithCol("dao.bond.bondedRoleType.details.unlockTime"), FormBuilder.addTopLabelTextField(gridPane, ++rowIndex, Res.getWithCol("dao.bond.bondedRoleType.details.unlockTime"),
Res.get("dao.bond.bondedRoleType.details.blocks", bondedRoleType.getUnlockTime())); Res.get("dao.bond.bondedRoleType.details.blocks", bondedRoleType.getUnlockTimeInBlocks()));
FormBuilder.addLabelHyperlinkWithIcon(gridPane, ++rowIndex, Res.getWithCol("dao.bond.bondedRoleType.details.link"), FormBuilder.addLabelHyperlinkWithIcon(gridPane, ++rowIndex, Res.getWithCol("dao.bond.bondedRoleType.details.link"),
bondedRoleType.getLink(), bondedRoleType.getLink()); bondedRoleType.getLink(), bondedRoleType.getLink());