[bisq-network/bisq] Use min. refund at mediated payout (#3827)

sqrrm notifications at github.com
Thu Jan 2 12:33:49 UTC 2020


sqrrm requested changes on this pull request.

Overall good but please have a look at the comments.

Also, should we add a note to the users that the offer given during mediation includes some refund of deposit and that all might be lost if taken to refund agent?

> @@ -93,4 +96,10 @@ public static Coin getMinSellerSecurityDepositAsCoin() {
             SELLER_SECURITY_DEPOSIT = Coin.parseCoin("0.005"); // 0.005 BTC about 20 USD @ 4000 USD/BTC
         return SELLER_SECURITY_DEPOSIT;
     }
+
+    public static Coin getMinRefundAtMediatedDispute() {
+        if (MIN_REFUND_AT_MEDIATED_DISPUTE == null)
+            MIN_REFUND_AT_MEDIATED_DISPUTE = Coin.parseCoin("0.003"); // 0.003 BTC about 21 USD @ 7000 USD/BTC

This implicitly depends on the min deposit. If we change the min deposit in the future to something less than 0.003 we should also change this one. Would be good if they were related to each other, or at least made obvious that they can't be changed independently.

> -        Coin sellerAmount;
-        if (inputTextField == buyerPayoutAmountInputTextField) {
-            buyerAmount = enteredAmount;
-            sellerAmount = counterPartAsCoin;
-            Coin sellerAmountFromField = ParsingUtils.parseToCoin(sellerPayoutAmountInputTextField.getText(), formatter);
-            Coin totalAmountFromFields = enteredAmount.add(sellerAmountFromField);
-            // RefundAgent can enter less then available
-            if (getDisputeManager(dispute) instanceof MediationManager ||
-                    totalAmountFromFields.compareTo(available) > 0) {
-                sellerPayoutAmountInputTextField.setText(formattedCounterPartAmount);
-            } else {
-                sellerAmount = sellerAmountFromField;
+    private void applyCustomAmounts(InputTextField inputTextField, boolean oldFocusValue, boolean newFocusValue) {
+        // We only apply adjustments at focus out, otherwise we cannot enter certain values if we update at each
+        // keystroke.
+        if (oldFocusValue && !newFocusValue) {

It's harder to read the code when the whole function is within the if block. How about returning early with
```
if (!oldFocusValue || newFocusValue) {
    return;
}
```
or
```
boolean applyAmounts = oldFocusValue && !newFocusValue;
if (!applyAmounts) {
    return;
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3827#pullrequestreview-337623688
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200102/dd56ba1c/attachment.html>


More information about the bisq-github mailing list