Search in sources :

Example 11 with Dispute

use of bisq.core.arbitration.Dispute in project bisq-desktop by bisq-network.

the class DisputeSummaryWindow method addButtons.

private void addButtons(Contract contract) {
    Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.close.button"), Res.get("shared.cancel"));
    Button closeTicketButton = tuple.first;
    closeTicketButton.disableProperty().bind(Bindings.createBooleanBinding(() -> tradeAmountToggleGroup.getSelectedToggle() == null || summaryNotesTextArea.getText() == null || summaryNotesTextArea.getText().length() == 0 || !isPayoutAmountValid(), tradeAmountToggleGroup.selectedToggleProperty(), summaryNotesTextArea.textProperty(), buyerPayoutAmountInputTextField.textProperty(), sellerPayoutAmountInputTextField.textProperty()));
    Button cancelButton = tuple.second;
    final Dispute finalPeersDispute = peersDisputeOptional.get();
    closeTicketButton.setOnAction(e -> {
        if (dispute.getDepositTxSerialized() != null) {
            try {
                AddressEntry arbitratorAddressEntry = walletService.getOrCreateAddressEntry(AddressEntry.Context.ARBITRATOR);
                disputeResult.setArbitratorPubKey(walletService.getOrCreateAddressEntry(AddressEntry.Context.ARBITRATOR).getPubKey());
                /* byte[] depositTxSerialized,
                    Coin buyerPayoutAmount,
                    Coin sellerPayoutAmount,
                    Coin arbitratorPayoutAmount,
                    String buyerAddressString,
                    String sellerAddressString,
                    AddressEntry arbitratorAddressEntry,
                    byte[] buyerPubKey,
                    byte[] sellerPubKey,
                    byte[] arbitratorPubKey)
                    */
                byte[] arbitratorSignature = tradeWalletService.arbitratorSignsDisputedPayoutTx(dispute.getDepositTxSerialized(), disputeResult.getBuyerPayoutAmount(), disputeResult.getSellerPayoutAmount(), contract.getBuyerPayoutAddressString(), contract.getSellerPayoutAddressString(), arbitratorAddressEntry.getKeyPair(), contract.getBuyerMultiSigPubKey(), contract.getSellerMultiSigPubKey(), arbitratorAddressEntry.getPubKey());
                disputeResult.setArbitratorSignature(arbitratorSignature);
                closeTicketButton.disableProperty().unbind();
                dispute.setDisputeResult(disputeResult);
                disputeResult.setLoserPublisher(isLoserPublisherCheckBox.isSelected());
                disputeResult.setCloseDate(new Date());
                String text = Res.get("disputeSummaryWindow.close.msg", formatter.formatDateTime(disputeResult.getCloseDate()), role, formatter.booleanToYesNo(disputeResult.tamperProofEvidenceProperty().get()), role, formatter.booleanToYesNo(disputeResult.idVerificationProperty().get()), role, formatter.booleanToYesNo(disputeResult.screenCastProperty().get()), formatter.formatCoinWithCode(disputeResult.getBuyerPayoutAmount()), formatter.formatCoinWithCode(disputeResult.getSellerPayoutAmount()), disputeResult.summaryNotesProperty().get());
                dispute.setIsClosed(true);
                disputeManager.sendDisputeResultMessage(disputeResult, dispute, text);
                if (!finalPeersDispute.isClosed())
                    UserThread.runAfter(() -> new Popup<>().attention(Res.get("disputeSummaryWindow.close.closePeer")).show(), Transitions.DEFAULT_DURATION, TimeUnit.MILLISECONDS);
                hide();
                finalizeDisputeHandlerOptional.ifPresent(Runnable::run);
            } catch (AddressFormatException | TransactionVerificationException e2) {
                e2.printStackTrace();
            }
        } else {
            log.warn("dispute.getDepositTxSerialized is null");
        }
    });
    cancelButton.setOnAction(e -> {
        dispute.setDisputeResult(disputeResult);
        hide();
    });
}
Also used : AddressFormatException(org.bitcoinj.core.AddressFormatException) Button(javafx.scene.control.Button) AutoTooltipRadioButton(bisq.desktop.components.AutoTooltipRadioButton) RadioButton(javafx.scene.control.RadioButton) AddressEntry(bisq.core.btc.AddressEntry) TransactionVerificationException(bisq.core.btc.exceptions.TransactionVerificationException) Popup(bisq.desktop.main.overlays.popups.Popup) Dispute(bisq.core.arbitration.Dispute) Date(java.util.Date)

Aggregations

Dispute (bisq.core.arbitration.Dispute)11 Popup (bisq.desktop.main.overlays.popups.Popup)9 HashMap (java.util.HashMap)8 List (java.util.List)8 ObservableList (javafx.collections.ObservableList)8 PubKeyRing (bisq.common.crypto.PubKeyRing)7 Trade (bisq.core.trade.Trade)7 ArrayList (java.util.ArrayList)7 FilteredList (javafx.collections.transformation.FilteredList)7 SortedList (javafx.collections.transformation.SortedList)7 Timer (bisq.common.Timer)6 UserThread (bisq.common.UserThread)6 Version (bisq.common.app.Version)6 KeyRing (bisq.common.crypto.KeyRing)6 PrivateNotificationManager (bisq.core.alert.PrivateNotificationManager)6 AppOptionKeys (bisq.core.app.AppOptionKeys)6 DisputeManager (bisq.core.arbitration.DisputeManager)6 Res (bisq.core.locale.Res)6 TradeManager (bisq.core.trade.TradeManager)6 Date (java.util.Date)6