From b30f166e92adebecee8d30822c75e1a03120fea0 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 4 Apr 2019 13:19:30 +0200 Subject: [PATCH] Add information of Satoshis needed for coloring --- .../resources/i18n/displayStrings.properties | 7 ++++ .../dao/governance/make/MakeProposalView.java | 7 +++- .../main/java/bisq/desktop/util/GUIUtil.java | 37 +++++++++++++++---- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 2b73c65e42..0c98012ec9 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1854,6 +1854,13 @@ dao.feeTx.confirm.details={0} fee: {1}\n\ Transaction size: {4} Kb\n\n\ Are you sure you want to publish the {5} transaction? +dao.feeTx.issuanceProposal.confirm.details={0} fee: {1}\n\ + BTC needed for BSQ issuance: {2} ({3} Satoshis/BSQ)\n\ + On acceptance, the proposal fee will be deducted from the issued BSQ.\n\n\ + Mining fee: {4} ({5} Satoshis/byte)\n\ + Transaction size: {6} Kb\n\n\ + Are you sure you want to publish the {7} transaction? + dao.news.bisqDAO.title=THE BISQ DAO dao.news.bisqDAO.description=Just as the Bisq exchange is decentralized and censorship-resistant, so is its \ governance model - and the Bisq DAO and BSQ token are the tools that make it possible. diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java index 134cab5101..8c7916d8bf 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java @@ -35,6 +35,7 @@ import bisq.core.btc.wallet.BsqWalletService; import bisq.core.dao.DaoFacade; import bisq.core.dao.governance.bond.Bond; import bisq.core.dao.governance.param.Param; +import bisq.core.dao.governance.proposal.IssuanceProposal; import bisq.core.dao.governance.proposal.ProposalType; import bisq.core.dao.governance.proposal.ProposalValidationException; import bisq.core.dao.governance.proposal.ProposalWithTransaction; @@ -334,7 +335,11 @@ public class MakeProposalView extends ActivatableView implements private void showFeeInfoAndPublishMyProposal(Proposal proposal, Transaction transaction, Coin miningFee, int txSize, Coin fee) { if (!DevEnv.isDevMode()) { - GUIUtil.showBsqFeeInfoPopup(fee, miningFee, txSize, bsqFormatter, btcFormatter, + Coin btcForIssuance = null; + + if (proposal instanceof IssuanceProposal) btcForIssuance = ((IssuanceProposal) proposal).getRequestedBsq(); + + GUIUtil.showBsqFeeInfoPopup(fee, miningFee, btcForIssuance, txSize, bsqFormatter, btcFormatter, Res.get("dao.proposal"), () -> doPublishMyProposal(proposal, transaction)); } else { doPublishMyProposal(proposal, transaction); diff --git a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java index 18e3757a8e..508c6cd4d5 100644 --- a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java @@ -849,23 +849,44 @@ public class GUIUtil { } } - public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, int txSize, BsqFormatter bsqFormatter, + public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, Coin btcForIssuance, int txSize, BsqFormatter bsqFormatter, BSFormatter btcFormatter, String type, Runnable actionHandler) { + String confirmationMessage; + + if (btcForIssuance != null) { + confirmationMessage = Res.get("dao.feeTx.issuanceProposal.confirm.details", + StringUtils.capitalize(type), + bsqFormatter.formatCoinWithCode(fee), + bsqFormatter.formatBTCWithCode(btcForIssuance), + 100, + btcFormatter.formatCoinWithCode(miningFee), + CoinUtil.getFeePerByte(miningFee, txSize), + txSize / 1000d, + type); + } else { + confirmationMessage = Res.get("dao.feeTx.confirm.details", + StringUtils.capitalize(type), + bsqFormatter.formatCoinWithCode(fee), + btcFormatter.formatCoinWithCode(miningFee), + CoinUtil.getFeePerByte(miningFee, txSize), + txSize / 1000d, + type); + } new Popup<>().headLine(Res.get("dao.feeTx.confirm", type)) - .confirmation(Res.get("dao.feeTx.confirm.details", - StringUtils.capitalize(type), - bsqFormatter.formatCoinWithCode(fee), - btcFormatter.formatCoinWithCode(miningFee), - CoinUtil.getFeePerByte(miningFee, txSize), - txSize / 1000d, - type)) + .confirmation(confirmationMessage) .actionButtonText(Res.get("shared.yes")) .onAction(actionHandler) .closeButtonText(Res.get("shared.cancel")) .show(); } + public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, int txSize, BsqFormatter bsqFormatter, + BSFormatter btcFormatter, String type, + Runnable actionHandler) { + showBsqFeeInfoPopup(fee, miningFee, null, txSize, bsqFormatter, btcFormatter, type, actionHandler); + } + public static void setFitToRowsForTableView(TableView tableView, int rowHeight, int headerHeight, int minNumRows, int maxNumRows) { int size = tableView.getItems().size(); int minHeight = rowHeight * minNumRows + headerHeight;