mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
make configurable if arbitrator assigns trade fee address
This commit is contained in:
parent
7aebc7bc31
commit
a9f7a06e1f
3 changed files with 22 additions and 6 deletions
|
@ -72,6 +72,7 @@ public class HavenoUtils {
|
|||
public static final int ARBITRATOR_ACK_TIMEOUT_SECONDS = 30;
|
||||
|
||||
// configure fees
|
||||
public static final boolean ARBITRATOR_ASSIGNS_TRADE_FEE_ADDRESS = true;
|
||||
public static final double MAKER_FEE_PCT = 0.0015; // 0.15%
|
||||
public static final double TAKER_FEE_PCT = 0.0075; // 0.75%
|
||||
public static final double PENALTY_FEE_PCT = 0.02; // 2%
|
||||
|
@ -432,8 +433,17 @@ public class HavenoUtils {
|
|||
|
||||
// ----------------------------- OTHER UTILS ------------------------------
|
||||
|
||||
public static String getTradeFeeAddress() {
|
||||
return xmrWalletService.getBaseAddressEntry().getAddressString();
|
||||
public static String getGlobalTradeFeeAddress() {
|
||||
switch (Config.baseCurrencyNetwork()) {
|
||||
case XMR_LOCAL:
|
||||
return "Bd37nTGHjL3RvPxc9dypzpWiXQrPzxxG4RsWAasD9CV2iZ1xfFZ7mzTKNDxWBfsqQSUimctAsGtTZ8c8bZJy35BYL9jYj88";
|
||||
case XMR_STAGENET:
|
||||
return "5B11hTJdG2XDNwjdKGLRxwSLwDhkbGg7C7UEAZBxjE6FbCeRMjudrpNACmDNtWPiSnNfjDQf39QRjdtdgoL69txv81qc2Mc";
|
||||
case XMR_MAINNET:
|
||||
throw new RuntimeException("Mainnet fee address not implemented");
|
||||
default:
|
||||
throw new RuntimeException("Unhandled base currency network: " + Config.baseCurrencyNetwork());
|
||||
}
|
||||
}
|
||||
|
||||
public static String getBurnAddress() {
|
||||
|
|
|
@ -126,8 +126,9 @@ public class ArbitratorSendInitTradeOrMultisigRequests extends TradeTask {
|
|||
trade.getSelf().setPreparedMultisigHex(preparedHex);
|
||||
|
||||
// set trade fee address
|
||||
String address = HavenoUtils.ARBITRATOR_ASSIGNS_TRADE_FEE_ADDRESS ? trade.getXmrWalletService().getBaseAddressEntry().getAddressString() : HavenoUtils.getGlobalTradeFeeAddress();
|
||||
if (trade.getProcessModel().getTradeFeeAddress() == null) {
|
||||
trade.getProcessModel().setTradeFeeAddress(HavenoUtils.getTradeFeeAddress());
|
||||
trade.getProcessModel().setTradeFeeAddress(address);
|
||||
}
|
||||
|
||||
// create message to initialize multisig
|
||||
|
|
|
@ -21,6 +21,7 @@ import haveno.common.app.Version;
|
|||
import haveno.common.crypto.PubKeyRing;
|
||||
import haveno.common.taskrunner.TaskRunner;
|
||||
import haveno.core.trade.ArbitratorTrade;
|
||||
import haveno.core.trade.HavenoUtils;
|
||||
import haveno.core.trade.MakerTrade;
|
||||
import haveno.core.trade.TakerTrade;
|
||||
import haveno.core.trade.Trade;
|
||||
|
@ -65,9 +66,13 @@ public class ProcessInitMultisigRequest extends TradeTask {
|
|||
// get sender
|
||||
TradePeer sender = trade.getTradePeer(processModel.getTempTradePeerNodeAddress());
|
||||
|
||||
// set trade fee address from arbitrator
|
||||
if (request.getTradeFeeAddress() != null && sender == trade.getArbitrator()) {
|
||||
trade.getProcessModel().setTradeFeeAddress(request.getTradeFeeAddress());
|
||||
// set trade fee address
|
||||
if (HavenoUtils.ARBITRATOR_ASSIGNS_TRADE_FEE_ADDRESS) {
|
||||
if (request.getTradeFeeAddress() != null && sender == trade.getArbitrator()) {
|
||||
trade.getProcessModel().setTradeFeeAddress(request.getTradeFeeAddress());
|
||||
}
|
||||
} else {
|
||||
trade.getProcessModel().setTradeFeeAddress(HavenoUtils.getGlobalTradeFeeAddress());
|
||||
}
|
||||
|
||||
// reconcile peer's established multisig hex with message
|
||||
|
|
Loading…
Reference in a new issue