From 5c547c2994cdd4d6364367d8a0732e9528a1e1fa Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Tue, 14 Jan 2025 23:52:23 +0700 Subject: [PATCH 1/2] Implements: https://github.com/bisq-network/proposals/issues/469Change MIN_BUYER_SECURITY_DEPOSIT and SELLER_SECURITY_DEPOSIT values to 0.0003 BTC after activation date of 1.3.2025 Signed-off-by: HenrikJannsen --- .../bisq/core/btc/wallet/Restrictions.java | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/bisq/core/btc/wallet/Restrictions.java b/core/src/main/java/bisq/core/btc/wallet/Restrictions.java index 9394fa283f7..27720f39b8e 100644 --- a/core/src/main/java/bisq/core/btc/wallet/Restrictions.java +++ b/core/src/main/java/bisq/core/btc/wallet/Restrictions.java @@ -18,10 +18,16 @@ package bisq.core.btc.wallet; import bisq.common.config.Config; +import bisq.common.util.Utilities; import org.bitcoinj.core.Coin; +import java.util.Date; +import java.util.GregorianCalendar; + public class Restrictions { + private static final Date MIN_SECURITY_DEPOSIT_CHANGE_ACTIVATION_DATE = Utilities.getUTCDate(2025, GregorianCalendar.MARCH, 1); + private static Coin MIN_TRADE_AMOUNT; private static Coin MIN_BUYER_SECURITY_DEPOSIT; // For the seller we use a fixed one as there is no way the seller can cancel the trade @@ -66,10 +72,17 @@ public static double getMaxBuyerSecurityDepositAsPercent() { } // We use MIN_BUYER_SECURITY_DEPOSIT as well as lower bound in case of small trade amounts. - // So 0.0005 BTC is the min. buyer security deposit even with amount of 0.0001 BTC and 0.05% percentage value. public static Coin getMinBuyerSecurityDepositAsCoin() { - if (MIN_BUYER_SECURITY_DEPOSIT == null) - MIN_BUYER_SECURITY_DEPOSIT = Coin.parseCoin("0.001"); // 0.001 BTC is 60 USD @ 60000 USD/BTC + Date now = new Date(); + if (now.after(MIN_SECURITY_DEPOSIT_CHANGE_ACTIVATION_DATE)) { + if (MIN_BUYER_SECURITY_DEPOSIT == null || MIN_BUYER_SECURITY_DEPOSIT.equals(Coin.parseCoin("0.001"))) { + MIN_BUYER_SECURITY_DEPOSIT = Coin.parseCoin("0.0003"); // 0.0003 BTC is 27 USD @ 90000 USD/BTC + } + } else { + if (MIN_BUYER_SECURITY_DEPOSIT == null) { + MIN_BUYER_SECURITY_DEPOSIT = Coin.parseCoin("0.001"); // 0.001 BTC is 60 USD @ 60000 USD/BTC + } + } return MIN_BUYER_SECURITY_DEPOSIT; } @@ -83,9 +96,18 @@ public static double getMinSellerSecurityDepositAsPercent() { } public static Coin getMinSellerSecurityDepositAsCoin() { - if (SELLER_SECURITY_DEPOSIT == null) - SELLER_SECURITY_DEPOSIT = Coin.parseCoin("0.001"); // 0.001 BTC is 60 USD @ 60000 USD/BTC - return SELLER_SECURITY_DEPOSIT; + Date now = new Date(); + if (now.after(MIN_SECURITY_DEPOSIT_CHANGE_ACTIVATION_DATE)) { + if (SELLER_SECURITY_DEPOSIT == null || SELLER_SECURITY_DEPOSIT.equals(Coin.parseCoin("0.001"))) { + SELLER_SECURITY_DEPOSIT = Coin.parseCoin("0.0003"); // 0.0003 BTC is 27 USD @ 90000 USD/BTC + } + return SELLER_SECURITY_DEPOSIT; + } else { + if (SELLER_SECURITY_DEPOSIT == null) { + SELLER_SECURITY_DEPOSIT = Coin.parseCoin("0.001"); // 0.001 BTC is 60 USD @ 60000 USD/BTC + } + return SELLER_SECURITY_DEPOSIT; + } } // This value must be lower than MIN_BUYER_SECURITY_DEPOSIT and SELLER_SECURITY_DEPOSIT From 6473071ebabfd5fd2ab9d97760d9beeeb70614a4 Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Tue, 14 Jan 2025 23:52:38 +0700 Subject: [PATCH 2/2] Refactor: rename Signed-off-by: HenrikJannsen --- .../java/bisq/core/btc/wallet/Restrictions.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/bisq/core/btc/wallet/Restrictions.java b/core/src/main/java/bisq/core/btc/wallet/Restrictions.java index 27720f39b8e..5c875278b94 100644 --- a/core/src/main/java/bisq/core/btc/wallet/Restrictions.java +++ b/core/src/main/java/bisq/core/btc/wallet/Restrictions.java @@ -32,7 +32,7 @@ public class Restrictions { private static Coin MIN_BUYER_SECURITY_DEPOSIT; // For the seller we use a fixed one as there is no way the seller can cancel the trade // To make it editable would just increase complexity. - private static Coin SELLER_SECURITY_DEPOSIT; + private static Coin MIN_SELLER_SECURITY_DEPOSIT; // At mediation we require a min. payout to the losing party to keep incentive for the trader to accept the // mediated payout. For Refund agent cases we do not have that restriction. private static Coin MIN_REFUND_AT_MEDIATED_DISPUTE; @@ -98,15 +98,15 @@ public static double getMinSellerSecurityDepositAsPercent() { public static Coin getMinSellerSecurityDepositAsCoin() { Date now = new Date(); if (now.after(MIN_SECURITY_DEPOSIT_CHANGE_ACTIVATION_DATE)) { - if (SELLER_SECURITY_DEPOSIT == null || SELLER_SECURITY_DEPOSIT.equals(Coin.parseCoin("0.001"))) { - SELLER_SECURITY_DEPOSIT = Coin.parseCoin("0.0003"); // 0.0003 BTC is 27 USD @ 90000 USD/BTC + if (MIN_SELLER_SECURITY_DEPOSIT == null || MIN_SELLER_SECURITY_DEPOSIT.equals(Coin.parseCoin("0.001"))) { + MIN_SELLER_SECURITY_DEPOSIT = Coin.parseCoin("0.0003"); // 0.0003 BTC is 27 USD @ 90000 USD/BTC } - return SELLER_SECURITY_DEPOSIT; + return MIN_SELLER_SECURITY_DEPOSIT; } else { - if (SELLER_SECURITY_DEPOSIT == null) { - SELLER_SECURITY_DEPOSIT = Coin.parseCoin("0.001"); // 0.001 BTC is 60 USD @ 60000 USD/BTC + if (MIN_SELLER_SECURITY_DEPOSIT == null) { + MIN_SELLER_SECURITY_DEPOSIT = Coin.parseCoin("0.001"); // 0.001 BTC is 60 USD @ 60000 USD/BTC } - return SELLER_SECURITY_DEPOSIT; + return MIN_SELLER_SECURITY_DEPOSIT; } }