diff --git a/Makefile b/Makefile index 9fac1408c9..33da5878e6 100644 --- a/Makefile +++ b/Makefile @@ -132,8 +132,8 @@ desktop/build: unzip docs/dao-setup.zip mv dao-setup .localnet mv .localnet/Bitcoin-regtest .localnet/bitcoind - mv .localnet/bisq-BTC_REGTEST_Alice_dao .localnet/alice - mv .localnet/bisq-BTC_REGTEST_Bob_dao .localnet/bob + mv .localnet/bisq-XMR_STAGENET_Alice_dao .localnet/alice + mv .localnet/bisq-XMR_STAGENET_Bob_dao .localnet/bob # Remove the preconfigured bitcoin.conf in favor of explicitly # parameterizing the invocation of bitcoind in the target below rm -v .localnet/bitcoind/bitcoin.conf @@ -190,7 +190,7 @@ bitcoind: .localnet seednode: seednode/build ./bisq-seednode \ - --baseCurrencyNetwork=BTC_REGTEST \ + --baseCurrencyNetwork=XMR_STAGENET \ --useLocalhostForP2P=true \ --useDevPrivilegeKeys=true \ --fullDaoNode=true \ @@ -203,7 +203,7 @@ seednode: seednode/build seednode2: seednode/build ./bisq-seednode \ - --baseCurrencyNetwork=BTC_REGTEST \ + --baseCurrencyNetwork=XMR_STAGENET \ --useLocalhostForP2P=true \ --useDevPrivilegeKeys=true \ --fullDaoNode=true \ @@ -216,7 +216,7 @@ seednode2: seednode/build mediator: desktop/build ./bisq-desktop \ - --baseCurrencyNetwork=BTC_REGTEST \ + --baseCurrencyNetwork=XMR_STAGENET \ --useLocalhostForP2P=true \ --useDevPrivilegeKeys=true \ --nodePort=4444 \ @@ -225,7 +225,7 @@ mediator: desktop/build alice: setup ./bisq-desktop \ - --baseCurrencyNetwork=BTC_REGTEST \ + --baseCurrencyNetwork=XMR_STAGENET \ --useLocalhostForP2P=true \ --useDevPrivilegeKeys=true \ --nodePort=5555 \ @@ -240,7 +240,7 @@ alice: setup bob: setup ./bisq-desktop \ - --baseCurrencyNetwork=BTC_REGTEST \ + --baseCurrencyNetwork=XMR_STAGENET \ --useLocalhostForP2P=true \ --useDevPrivilegeKeys=true \ --nodePort=6666 \ diff --git a/README.md b/README.md index 278d05e6e0..01ad982294 100644 --- a/README.md +++ b/README.md @@ -58,10 +58,10 @@ See the [FAQ in the wiki](https://github.com/haveno-dex/haveno/wiki/FAQ). 11. `cd haveno` 12. `./gradlew build` 13. Start seed node, arbitrator, Alice, and Bob: - 1. `./bisq-seednode --baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=2002 --appName=bisq-BTC_REGTEST_Seed_2002 --daoActivated=false` - 2. `./bisq-desktop --baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=4444 --appName=bisq-BTC_REGTEST_arbitrator --daoActivated=false --apiPassword=apitest --apiPort=9998` - 3. `./bisq-desktop --baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=5555 --appName=bisq-BTC_REGTEST_Alice --daoActivated=false --apiPassword=apitest --apiPort=9999` - 4. `./bisq-desktop --baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=6666 --appName=bisq-BTC_REGTEST_Bob --daoActivated=false --apiPassword=apitest --apiPort=10000` + 1. `./bisq-seednode --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=2002 --appName=bisq-XMR_STAGENET_Seed_2002 --daoActivated=false` + 2. `./bisq-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=4444 --appName=bisq-XMR_STAGENET_arbitrator --daoActivated=false --apiPassword=apitest --apiPort=9998` + 3. `./bisq-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=5555 --appName=bisq-XMR_STAGENET_Alice --daoActivated=false --apiPassword=apitest --apiPort=9999` + 4. `./bisq-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=6666 --appName=bisq-XMR_STAGENET_Bob --daoActivated=false --apiPassword=apitest --apiPort=10000` 14. Arbitrator window > Account > cmd+n to register a new arbitrator 15. Arbitrator window > Account > cmd+d to register a new mediator 16. Deposit stagenet XMR to Alice and Bob's Haveno wallets (wallet address printed to terminal) diff --git a/apitest/dao-setup.gradle b/apitest/dao-setup.gradle index 5f55ce72e5..833f5e7355 100644 --- a/apitest/dao-setup.gradle +++ b/apitest/dao-setup.gradle @@ -59,10 +59,10 @@ task installDaoSetup(dependsOn: 'cleanDaoSetup') { // Move dao-setup files from build/resources/main/dao-setup to build/resources/main file(buildResourcesDir + '/dao-setup/Bitcoin-regtest') .renameTo(file(buildResourcesDir + '/Bitcoin-regtest')) - file(buildResourcesDir + '/dao-setup/bisq-BTC_REGTEST_Alice_dao') - .renameTo(file(buildResourcesDir + '/bisq-BTC_REGTEST_Alice_dao')) - file(buildResourcesDir + '/dao-setup/bisq-BTC_REGTEST_Bob_dao') - .renameTo(file(buildResourcesDir + '/bisq-BTC_REGTEST_Bob_dao')) + file(buildResourcesDir + '/dao-setup/bisq-XMR_STAGENET_Alice_dao') + .renameTo(file(buildResourcesDir + '/bisq-XMR_STAGENET_Alice_dao')) + file(buildResourcesDir + '/dao-setup/bisq-XMR_STAGENET_Bob_dao') + .renameTo(file(buildResourcesDir + '/bisq-XMR_STAGENET_Bob_dao')) delete file(buildResourcesDir + '/dao-setup') } } @@ -75,9 +75,9 @@ task cleanDaoSetup { // re-compile any code. println "Deleting dao-setup directories in build dir $buildResourcesDir ..." delete file(buildResourcesDir + '/Bitcoin-regtest') - delete file(buildResourcesDir + '/bisq-BTC_REGTEST_Seed_2002') - delete file(buildResourcesDir + '/bisq-BTC_REGTEST_Arb_dao') - delete file(buildResourcesDir + '/bisq-BTC_REGTEST_Alice_dao') - delete file(buildResourcesDir + '/bisq-BTC_REGTEST_Bob_dao') + delete file(buildResourcesDir + '/bisq-XMR_STAGENET_Seed_2002') + delete file(buildResourcesDir + '/bisq-XMR_STAGENET_Arb_dao') + delete file(buildResourcesDir + '/bisq-XMR_STAGENET_Alice_dao') + delete file(buildResourcesDir + '/bisq-XMR_STAGENET_Bob_dao') } } diff --git a/apitest/scripts/trade-simulation-env.sh b/apitest/scripts/trade-simulation-env.sh index 45fc385e07..c8d4bfa312 100755 --- a/apitest/scripts/trade-simulation-env.sh +++ b/apitest/scripts/trade-simulation-env.sh @@ -226,14 +226,14 @@ checkseednoderunning() { checkarbnoderunning() { if [[ "$LINUX" == "TRUE" ]]; then - if pgrep -f "bisq.daemon.app.BisqDaemonMain --appName=bisq-BTC_REGTEST_Arb_dao" > /dev/null ; then + if pgrep -f "bisq.daemon.app.BisqDaemonMain --appName=bisq-XMR_STAGENET_Arb_dao" > /dev/null ; then printdate "The arbitration node is running on host." else printdate "Error: arbitration node is not running on host, exiting." apitestusage fi elif [[ "$DARWIN" == "TRUE" ]]; then - if ps -A | awk '/[b]isq.daemon.app.BisqDaemonMain --appName=bisq-BTC_REGTEST_Arb_dao/ {print $1}' > /dev/null ; then + if ps -A | awk '/[b]isq.daemon.app.BisqDaemonMain --appName=bisq-XMR_STAGENET_Arb_dao/ {print $1}' > /dev/null ; then printdate "The arbitration node is running on host." else printdate "Error: arbitration node is not running on host, exiting." @@ -247,14 +247,14 @@ checkarbnoderunning() { checkalicenoderunning() { if [[ "$LINUX" == "TRUE" ]]; then - if pgrep -f "bisq.daemon.app.BisqDaemonMain --appName=bisq-BTC_REGTEST_Alice_dao" > /dev/null ; then + if pgrep -f "bisq.daemon.app.BisqDaemonMain --appName=bisq-XMR_STAGENET_Alice_dao" > /dev/null ; then printdate "Alice's node is running on host." else printdate "Error: Alice's node is not running on host, exiting." apitestusage fi elif [[ "$DARWIN" == "TRUE" ]]; then - if ps -A | awk '/[b]isq.daemon.app.BisqDaemonMain --appName=bisq-BTC_REGTEST_Alice_dao/ {print $1}' > /dev/null ; then + if ps -A | awk '/[b]isq.daemon.app.BisqDaemonMain --appName=bisq-XMR_STAGENET_Alice_dao/ {print $1}' > /dev/null ; then printdate "Alice's node node is running on host." else printdate "Error: Alice's node is not running on host, exiting." @@ -268,14 +268,14 @@ checkalicenoderunning() { checkbobnoderunning() { if [[ "$LINUX" == "TRUE" ]]; then - if pgrep -f "bisq.daemon.app.BisqDaemonMain --appName=bisq-BTC_REGTEST_Alice_dao" > /dev/null ; then + if pgrep -f "bisq.daemon.app.BisqDaemonMain --appName=bisq-XMR_STAGENET_Alice_dao" > /dev/null ; then printdate "Bob's node is running on host." else printdate "Error: Bob's node is not running on host, exiting." apitestusage fi elif [[ "$DARWIN" == "TRUE" ]]; then - if ps -A | awk '/[b]isq.daemon.app.BisqDaemonMain --appName=bisq-BTC_REGTEST_Alice_dao/ {print $1}' > /dev/null ; then + if ps -A | awk '/[b]isq.daemon.app.BisqDaemonMain --appName=bisq-XMR_STAGENET_Alice_dao/ {print $1}' > /dev/null ; then printdate "Bob's node node is running on host." else printdate "Error: Bob's node is not running on host, exiting." diff --git a/apitest/src/main/java/bisq/apitest/config/BisqAppConfig.java b/apitest/src/main/java/bisq/apitest/config/BisqAppConfig.java index 08a7531ca3..a34c7e7a2d 100644 --- a/apitest/src/main/java/bisq/apitest/config/BisqAppConfig.java +++ b/apitest/src/main/java/bisq/apitest/config/BisqAppConfig.java @@ -32,7 +32,7 @@ import bisq.daemon.app.BisqDaemonMain; */ public enum BisqAppConfig { - seednode("bisq-BTC_REGTEST_Seed_2002", + seednode("bisq-XMR_STAGENET_Seed_2002", "bisq-seednode", "-XX:MaxRAM=2g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml", SeedNodeMain.class.getName(), @@ -40,7 +40,7 @@ public enum BisqAppConfig { 5120, -1, 49996), - arbdaemon("bisq-BTC_REGTEST_Arb_dao", + arbdaemon("bisq-XMR_STAGENET_Arb_dao", "bisq-daemon", "-XX:MaxRAM=2g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml", BisqDaemonMain.class.getName(), @@ -48,7 +48,7 @@ public enum BisqAppConfig { 5121, 9997, 49997), - arbdesktop("bisq-BTC_REGTEST_Arb_dao", + arbdesktop("bisq-XMR_STAGENET_Arb_dao", "bisq-desktop", "-XX:MaxRAM=3g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml", BisqAppMain.class.getName(), @@ -56,7 +56,7 @@ public enum BisqAppConfig { 5121, -1, 49997), - alicedaemon("bisq-BTC_REGTEST_Alice_dao", + alicedaemon("bisq-XMR_STAGENET_Alice_dao", "bisq-daemon", "-XX:MaxRAM=2g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml", BisqDaemonMain.class.getName(), @@ -64,7 +64,7 @@ public enum BisqAppConfig { 5122, 9998, 49998), - alicedesktop("bisq-BTC_REGTEST_Alice_dao", + alicedesktop("bisq-XMR_STAGENET_Alice_dao", "bisq-desktop", "-XX:MaxRAM=4g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml", BisqAppMain.class.getName(), @@ -72,7 +72,7 @@ public enum BisqAppConfig { 5122, -1, 49998), - bobdaemon("bisq-BTC_REGTEST_Bob_dao", + bobdaemon("bisq-XMR_STAGENET_Bob_dao", "bisq-daemon", "-XX:MaxRAM=2g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml", BisqDaemonMain.class.getName(), @@ -80,7 +80,7 @@ public enum BisqAppConfig { 5123, 9999, 49999), - bobdesktop("bisq-BTC_REGTEST_Bob_dao", + bobdesktop("bisq-XMR_STAGENET_Bob_dao", "bisq-desktop", "-XX:MaxRAM=4g -Dlogback.configurationFile=apitest/build/resources/main/logback.xml", BisqAppMain.class.getName(), diff --git a/apitest/src/main/java/bisq/apitest/linux/BisqProcess.java b/apitest/src/main/java/bisq/apitest/linux/BisqProcess.java index f6c2e7f22b..04bbd38a38 100644 --- a/apitest/src/main/java/bisq/apitest/linux/BisqProcess.java +++ b/apitest/src/main/java/bisq/apitest/linux/BisqProcess.java @@ -58,7 +58,7 @@ public class BisqProcess extends AbstractLinuxProcess implements LinuxProcess { public BisqProcess(BisqAppConfig bisqAppConfig, ApiTestConfig config) { super(bisqAppConfig.appName, config); this.bisqAppConfig = bisqAppConfig; - this.baseCurrencyNetwork = "BTC_REGTEST"; + this.baseCurrencyNetwork = "XMR_STAGENET"; this.genesisTxId = "30af0050040befd8af25068cc697e418e09c2d8ebd8d411d2240591b9ec203cf"; this.genesisBlockHeight = 111; this.seedNodes = "localhost:2002"; diff --git a/assets/src/main/java/bisq/asset/Coin.java b/assets/src/main/java/bisq/asset/Coin.java index 5eb596e471..ab158206b5 100644 --- a/assets/src/main/java/bisq/asset/Coin.java +++ b/assets/src/main/java/bisq/asset/Coin.java @@ -19,16 +19,13 @@ package bisq.asset; /** * Abstract base class for {@link Asset}s with their own dedicated blockchain, such as - * {@link bisq.asset.coins.Bitcoin} itself or one of its many derivatives, competitors and - * alternatives, often called "altcoins", such as {@link bisq.asset.coins.Litecoin}, - * {@link bisq.asset.coins.Ether}, {@link bisq.asset.coins.Monero} and - * {@link bisq.asset.coins.Zcash}. + * {@link bisq.asset.coins.Bitcoin}, {@link bisq.asset.coins.Ether}, and {@link bisq.asset.coins.Monero}. *

* In addition to the usual {@code Asset} properties, a {@code Coin} maintains information * about which {@link Network} it may be used on. By default, coins are constructed with * the assumption they are for use on that coin's "main network", or "main blockchain", * i.e. that they are "real" coins for use in a production environment. In testing - * scenarios, however, a coin may be constructed for use only on "testnet" or "regtest" + * scenarios, however, a coin may be constructed for use only on "testnet" or "stagenet" * networks. * * @author Chris Beams @@ -36,7 +33,7 @@ package bisq.asset; */ public abstract class Coin extends AbstractAsset { - public enum Network { MAINNET, TESTNET, REGTEST } + public enum Network { MAINNET, TESTNET, STAGENET } private final Network network; diff --git a/assets/src/main/java/bisq/asset/coins/BSQ.java b/assets/src/main/java/bisq/asset/coins/BSQ.java index f769a582e3..47a1966666 100644 --- a/assets/src/main/java/bisq/asset/coins/BSQ.java +++ b/assets/src/main/java/bisq/asset/coins/BSQ.java @@ -52,7 +52,7 @@ public class BSQ extends Coin { public static class Regtest extends BSQ { public Regtest() { - super(Network.REGTEST, RegTestParams.get()); + super(Network.STAGENET, RegTestParams.get()); } } diff --git a/assets/src/main/java/bisq/asset/coins/Bitcoin.java b/assets/src/main/java/bisq/asset/coins/Bitcoin.java index 74b9986966..950ffc9091 100644 --- a/assets/src/main/java/bisq/asset/coins/Bitcoin.java +++ b/assets/src/main/java/bisq/asset/coins/Bitcoin.java @@ -51,7 +51,7 @@ public abstract class Bitcoin extends Coin { public static class Regtest extends Bitcoin { public Regtest() { - super(Network.REGTEST, RegTestParams.get()); + super(Network.STAGENET, RegTestParams.get()); } } } diff --git a/cli/src/main/java/bisq/cli/CliMain.java b/cli/src/main/java/bisq/cli/CliMain.java index 95bfd0d7b8..a08065269a 100644 --- a/cli/src/main/java/bisq/cli/CliMain.java +++ b/cli/src/main/java/bisq/cli/CliMain.java @@ -174,6 +174,9 @@ public class CliMain { case "BTC": out.println(formatBtcBalanceInfoTbl(balances.getBtc())); break; + case "XMR": + out.println(formatXmrBalanceInfoTbl(balances.getXmr())); + break; case "": default: out.println(formatBalancesTbls(balances)); diff --git a/cli/src/main/java/bisq/cli/ColumnHeaderConstants.java b/cli/src/main/java/bisq/cli/ColumnHeaderConstants.java index 775221b5ed..b5ab08bc00 100644 --- a/cli/src/main/java/bisq/cli/ColumnHeaderConstants.java +++ b/cli/src/main/java/bisq/cli/ColumnHeaderConstants.java @@ -31,6 +31,7 @@ class ColumnHeaderConstants { // lengths are expected to be greater than any column value length. static final String COL_HEADER_ADDRESS = padEnd("%-3s Address", 52, ' '); static final String COL_HEADER_AMOUNT = "BTC(min - max)"; + static final String COL_HEADER_BALANCE = "Balance"; static final String COL_HEADER_AVAILABLE_BALANCE = "Available Balance"; static final String COL_HEADER_AVAILABLE_CONFIRMED_BALANCE = "Available Confirmed Balance"; static final String COL_HEADER_UNCONFIRMED_CHANGE_BALANCE = "Unconfirmed Change Balance"; diff --git a/cli/src/main/java/bisq/cli/CurrencyFormat.java b/cli/src/main/java/bisq/cli/CurrencyFormat.java index c3070a9826..22022ceb58 100644 --- a/cli/src/main/java/bisq/cli/CurrencyFormat.java +++ b/cli/src/main/java/bisq/cli/CurrencyFormat.java @@ -51,6 +51,8 @@ public class CurrencyFormat { static final DecimalFormat SEND_BSQ_FORMAT = new DecimalFormat("###########0.00"); static final BigDecimal SECURITY_DEPOSIT_MULTIPLICAND = new BigDecimal("0.01"); + + // TODO: (woodser): replace formatSatoshis(), formatBsq() with formatXmr() @SuppressWarnings("BigDecimalMethodWithoutRoundingCalled") public static String formatSatoshis(long sats) { diff --git a/cli/src/main/java/bisq/cli/DirectionFormat.java b/cli/src/main/java/bisq/cli/DirectionFormat.java index ac0e5b6c55..73c2444c96 100644 --- a/cli/src/main/java/bisq/cli/DirectionFormat.java +++ b/cli/src/main/java/bisq/cli/DirectionFormat.java @@ -30,19 +30,19 @@ import static protobuf.OfferPayload.Direction.SELL; class DirectionFormat { static int getLongestDirectionColWidth(List offers) { - if (offers.isEmpty() || offers.get(0).getBaseCurrencyCode().equals("BTC")) + if (offers.isEmpty() || offers.get(0).getBaseCurrencyCode().equals("XMR")) return COL_HEADER_DIRECTION.length(); else - return 18; // .e.g., "Sell BSQ (Buy BTC)".length() + return 18; // .e.g., "Sell BSQ (Buy XMR)".length() } static final Function directionFormat = (offer) -> { String baseCurrencyCode = offer.getBaseCurrencyCode(); - boolean isCryptoCurrencyOffer = !baseCurrencyCode.equals("BTC"); + boolean isCryptoCurrencyOffer = !baseCurrencyCode.equals("XMR"); if (!isCryptoCurrencyOffer) { return baseCurrencyCode; } else { - // Return "Sell BSQ (Buy BTC)", or "Buy BSQ (Sell BTC)". + // Return "Sell BSQ (Buy XMR)", or "Buy BSQ (Sell XMR)". String direction = offer.getDirection(); String mirroredDirection = getMirroredDirection(direction); Function mixedCase = (word) -> word.charAt(0) + word.substring(1).toLowerCase(); diff --git a/cli/src/main/java/bisq/cli/GrpcClient.java b/cli/src/main/java/bisq/cli/GrpcClient.java index 92784e8829..a14a753120 100644 --- a/cli/src/main/java/bisq/cli/GrpcClient.java +++ b/cli/src/main/java/bisq/cli/GrpcClient.java @@ -64,6 +64,7 @@ import bisq.proto.grpc.UnlockWalletRequest; import bisq.proto.grpc.UnsetTxFeeRatePreferenceRequest; import bisq.proto.grpc.VerifyBsqSentToAddressRequest; import bisq.proto.grpc.WithdrawFundsRequest; +import bisq.proto.grpc.XmrBalanceInfo; import protobuf.PaymentAccount; import protobuf.PaymentMethod; @@ -107,6 +108,10 @@ public final class GrpcClient { return getBalances("BTC").getBtc(); } + public XmrBalanceInfo getXmrBalances() { + return getBalances("XMR").getXmr(); + } + public BalancesInfo getBalances(String currencyCode) { var request = GetBalancesRequest.newBuilder() .setCurrencyCode(currencyCode) @@ -299,7 +304,7 @@ public final class GrpcClient { } public List getCryptoCurrencyOffers(String direction, String currencyCode) { - return getOffers(direction, "BTC").stream() + return getOffers(direction, "XMR").stream() .filter(o -> o.getBaseCurrencyCode().equalsIgnoreCase(currencyCode)) .collect(toList()); } diff --git a/cli/src/main/java/bisq/cli/TableFormat.java b/cli/src/main/java/bisq/cli/TableFormat.java index 5c123184e9..032264e3d8 100644 --- a/cli/src/main/java/bisq/cli/TableFormat.java +++ b/cli/src/main/java/bisq/cli/TableFormat.java @@ -22,6 +22,7 @@ import bisq.proto.grpc.BalancesInfo; import bisq.proto.grpc.BsqBalanceInfo; import bisq.proto.grpc.BtcBalanceInfo; import bisq.proto.grpc.OfferInfo; +import bisq.proto.grpc.XmrBalanceInfo; import protobuf.PaymentAccount; @@ -56,7 +57,7 @@ public class TableFormat { + COL_HEADER_AVAILABLE_BALANCE + COL_HEADER_DELIMITER + COL_HEADER_CONFIRMATIONS + COL_HEADER_DELIMITER + COL_HEADER_IS_USED_ADDRESS + COL_HEADER_DELIMITER + "\n"; - String headerLine = format(headerFormatString, "BTC"); + String headerLine = format(headerFormatString, "XMR"); String colDataFormat = "%-" + COL_HEADER_ADDRESS.length() + "s" // lt justify + " %" + (COL_HEADER_AVAILABLE_BALANCE.length() - 1) + "s" // rt justify @@ -73,7 +74,7 @@ public class TableFormat { } public static String formatBalancesTbls(BalancesInfo balancesInfo) { - return "BTC" + "\n" + return "XMR" + "\n" + formatBtcBalanceInfoTbl(balancesInfo.getBtc()) + "\n" + "BSQ" + "\n" + formatBsqBalanceInfoTbl(balancesInfo.getBsq()); @@ -117,6 +118,24 @@ public class TableFormat { formatSatoshis(btcBalanceInfo.getLockedBalance())); } + public static String formatXmrBalanceInfoTbl(XmrBalanceInfo xmrBalanceInfo) { + String headerLine = COL_HEADER_BALANCE + COL_HEADER_DELIMITER + + COL_HEADER_AVAILABLE_BALANCE + COL_HEADER_DELIMITER + + COL_HEADER_RESERVED_BALANCE + COL_HEADER_DELIMITER + + COL_HEADER_TOTAL_AVAILABLE_BALANCE + COL_HEADER_DELIMITER // TODO (woodser): column names are not quite right for XMR (balance, available balance, locked balance, reserved balance, total balance) + + COL_HEADER_LOCKED_BALANCE + COL_HEADER_DELIMITER + "\n"; + String colDataFormat = "%" + COL_HEADER_BALANCE.length() + "s" // rt justify + + " %" + (COL_HEADER_AVAILABLE_BALANCE.length() + 1) + "s" // rt justify + + " %" + (COL_HEADER_RESERVED_BALANCE.length() + 1) + "s" // rt justify + + " %" + (COL_HEADER_TOTAL_AVAILABLE_BALANCE.length() + 1) + "s" // rt justify + + " %" + (COL_HEADER_LOCKED_BALANCE.length() + 1) + "s"; // rt justify + return headerLine + format(colDataFormat, + formatSatoshis(xmrBalanceInfo.getAvailableBalance()), + formatSatoshis(xmrBalanceInfo.getReservedBalance()), + formatSatoshis(xmrBalanceInfo.getTotalBalance()), + formatSatoshis(xmrBalanceInfo.getLockedBalance())); + } + public static String formatPaymentAcctTbl(List paymentAccounts) { // Some column values might be longer than header, so we need to calculate them. int nameColWidth = getLongestColumnSize( @@ -150,7 +169,7 @@ public class TableFormat { throw new IllegalArgumentException(format("%s offers argument is empty", currencyCode.toLowerCase())); String baseCurrencyCode = offers.get(0).getBaseCurrencyCode(); - return baseCurrencyCode.equalsIgnoreCase("BTC") + return baseCurrencyCode.equalsIgnoreCase("XMR") ? formatFiatOfferTable(offers, currencyCode) : formatCryptoCurrencyOfferTable(offers, baseCurrencyCode); } diff --git a/cli/src/main/java/bisq/cli/TradeFormat.java b/cli/src/main/java/bisq/cli/TradeFormat.java index ded61548c3..f076c58d46 100644 --- a/cli/src/main/java/bisq/cli/TradeFormat.java +++ b/cli/src/main/java/bisq/cli/TradeFormat.java @@ -135,13 +135,13 @@ public class TradeFormat { bsqReceiveAddress.apply(tradeInfo, showBsqBuyerAddress)); } - private static final Function priceHeader = (t) -> // TODO (woodser): update these to XMR - t.getOffer().getBaseCurrencyCode().equals("BTC") + private static final Function priceHeader = (t) -> + t.getOffer().getBaseCurrencyCode().equals("XMR") ? COL_HEADER_PRICE : COL_HEADER_PRICE_OF_ALTCOIN; private static final Function priceHeaderCurrencyCode = (t) -> - t.getOffer().getBaseCurrencyCode().equals("BTC") + t.getOffer().getBaseCurrencyCode().equals("XMR") ? t.getOffer().getCounterCurrencyCode() : t.getOffer().getBaseCurrencyCode(); @@ -150,18 +150,18 @@ public class TradeFormat { }; private static final Function paymentStatusHeaderCurrencyCode = (t) -> - t.getOffer().getBaseCurrencyCode().equals("BTC") + t.getOffer().getBaseCurrencyCode().equals("XMR") ? t.getOffer().getCounterCurrencyCode() : t.getOffer().getBaseCurrencyCode(); private static final Function priceFormat = (t) -> - t.getOffer().getBaseCurrencyCode().equals("BTC") + t.getOffer().getBaseCurrencyCode().equals("XMR") ? formatPrice(t.getTradePrice()) : formatCryptoCurrencyPrice(t.getOffer().getPrice()); private static final Function amountFormat = (t) -> - t.getOffer().getBaseCurrencyCode().equals("BTC") - ? formatSatoshis(t.getTradeAmountAsLong()) // TODO (woodser): delete formatSatoshis(), formatBsq() and change base currency code to XMR + t.getOffer().getBaseCurrencyCode().equals("XMR") + ? formatXmr(ParsingUtils.satoshisToXmrAtomicUnits(t.getTradeAmountAsLong())) : formatCryptoCurrencyOfferVolume(t.getOffer().getVolume()); private static final BiFunction makerTakerMinerTxFeeFormat = (t, isTaker) -> { @@ -177,15 +177,15 @@ public class TradeFormat { }; private static final Function tradeCostFormat = (t) -> - t.getOffer().getBaseCurrencyCode().equals("BTC") + t.getOffer().getBaseCurrencyCode().equals("XMR") ? formatOfferVolume(t.getOffer().getVolume()) - : formatSatoshis(t.getTradeAmountAsLong()); + : formatXmr(ParsingUtils.satoshisToXmrAtomicUnits(t.getTradeAmountAsLong())); private static final BiFunction bsqReceiveAddress = (t, showBsqBuyerAddress) -> { if (showBsqBuyerAddress) { ContractInfo contract = t.getContract(); boolean isBuyerMakerAndSellerTaker = contract.getIsBuyerMakerAndSellerTaker(); - return isBuyerMakerAndSellerTaker // (is BTC buyer / maker) + return isBuyerMakerAndSellerTaker // (is XMR buyer / maker) ? contract.getTakerPaymentAccountPayload().getAddress() : contract.getMakerPaymentAccountPayload().getAddress(); } else { @@ -194,12 +194,12 @@ public class TradeFormat { }; private static boolean shouldShowBsqBuyerAddress(TradeInfo tradeInfo, boolean isTaker) { - if (tradeInfo.getOffer().getBaseCurrencyCode().equals("BTC")) { + if (tradeInfo.getOffer().getBaseCurrencyCode().equals("XMR")) { return false; } else { ContractInfo contract = tradeInfo.getContract(); - // Do not forget buyer and seller refer to BTC buyer and seller, not BSQ - // buyer and seller. If you are buying BSQ, you are the (BTC) seller. + // Do not forget buyer and seller refer to XMR buyer and seller, not BSQ + // buyer and seller. If you are buying BSQ, you are the XMR seller. boolean isBuyerMakerAndSellerTaker = contract.getIsBuyerMakerAndSellerTaker(); if (isTaker) { return !isBuyerMakerAndSellerTaker; diff --git a/common/src/main/java/bisq/common/app/Version.java b/common/src/main/java/bisq/common/app/Version.java index 9d3bc83a94..68ad28ed10 100644 --- a/common/src/main/java/bisq/common/app/Version.java +++ b/common/src/main/java/bisq/common/app/Version.java @@ -108,7 +108,7 @@ public class Version { return p2pMessageVersion; } - // The version for the crypto network (BTC_Mainnet = 0, BTC_TestNet = 1, BTC_Regtest = 2, ...) + // The version for the crypto network (XMR_Mainnet = 0, XMR_Testnet = 1, XMR_Regtest = 2, ...) private static int BASE_CURRENCY_NETWORK; public static void setBaseCryptoNetworkId(int baseCryptoNetworkId) { diff --git a/common/src/main/java/bisq/common/config/BaseCurrencyNetwork.java b/common/src/main/java/bisq/common/config/BaseCurrencyNetwork.java index 7836855a34..f35b9ffb16 100644 --- a/common/src/main/java/bisq/common/config/BaseCurrencyNetwork.java +++ b/common/src/main/java/bisq/common/config/BaseCurrencyNetwork.java @@ -25,12 +25,12 @@ import org.bitcoinj.params.TestNet3Params; import lombok.Getter; public enum BaseCurrencyNetwork { - BTC_MAINNET(MainNetParams.get(), "BTC", "MAINNET", "Bitcoin"), - BTC_TESTNET(TestNet3Params.get(), "BTC", "TESTNET", "Bitcoin"), - BTC_REGTEST(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin"), - BTC_DAO_TESTNET(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin"), // server side regtest until v0.9.5 - BTC_DAO_BETANET(MainNetParams.get(), "BTC", "MAINNET", "Bitcoin"), // mainnet test genesis - BTC_DAO_REGTEST(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin"); // server side regtest after v0.9.5, had breaking code changes so we started over again + XMR_MAINNET(MainNetParams.get(), "XMR", "MAINNET", "Monero"), + XMR_TESTNET(TestNet3Params.get(), "XMR", "TESTNET", "Monero"), + XMR_STAGENET(RegTestParams.get(), "XMR", "STAGENET", "Monero"), + BTC_DAO_TESTNET(RegTestParams.get(), "XMR", "STAGENET", "Monero"), + BTC_DAO_BETANET(MainNetParams.get(), "XMR", "MAINNET", "Monero"), // mainnet test genesis + BTC_DAO_REGTEST(RegTestParams.get(), "XMR", "STAGENET", "Monero"); @Getter private final NetworkParameters parameters; @@ -49,11 +49,11 @@ public enum BaseCurrencyNetwork { } public boolean isMainnet() { - return "BTC_MAINNET".equals(name()); + return "XMR_MAINNET".equals(name()); } public boolean isTestnet() { - return "BTC_TESTNET".equals(name()); + return "XMR_TESTNET".equals(name()); } public boolean isDaoTestNet() { @@ -68,8 +68,8 @@ public enum BaseCurrencyNetwork { return "BTC_DAO_BETANET".equals(name()); } - public boolean isRegtest() { - return "BTC_REGTEST".equals(name()); + public boolean isStagenet() { + return "XMR_STAGENET".equals(name()); } public long getDefaultMinFeePerVbyte() { diff --git a/common/src/main/java/bisq/common/config/Config.java b/common/src/main/java/bisq/common/config/Config.java index bc21c70a13..f03bd2537c 100644 --- a/common/src/main/java/bisq/common/config/Config.java +++ b/common/src/main/java/bisq/common/config/Config.java @@ -136,7 +136,7 @@ public class Config { // Static fields that provide access to Config properties in locations where injecting // a Config instance is not feasible. See Javadoc for corresponding static accessors. private static File APP_DATA_DIR_VALUE; - private static BaseCurrencyNetwork BASE_CURRENCY_NETWORK_VALUE = BaseCurrencyNetwork.BTC_MAINNET; + private static BaseCurrencyNetwork BASE_CURRENCY_NETWORK_VALUE = BaseCurrencyNetwork.XMR_MAINNET; // Default "data dir properties", i.e. properties that can determine the location of // Bisq's application data directory (appDataDir) @@ -338,7 +338,7 @@ public class Config { .withRequiredArg() .ofType(BaseCurrencyNetwork.class) .withValuesConvertedBy(new EnumValueConverter(BaseCurrencyNetwork.class)) - .defaultsTo(BaseCurrencyNetwork.BTC_MAINNET); + .defaultsTo(BaseCurrencyNetwork.XMR_MAINNET); ArgumentAcceptingOptionSpec ignoreLocalBtcNodeOpt = parser.accepts(IGNORE_LOCAL_BTC_NODE, @@ -348,7 +348,7 @@ public class Config { .defaultsTo(false); ArgumentAcceptingOptionSpec bitcoinRegtestHostOpt = - parser.accepts(BITCOIN_REGTEST_HOST, "Bitcoin Core node when using BTC_REGTEST network") + parser.accepts(BITCOIN_REGTEST_HOST, "Bitcoin Core node when using XMR_STAGENET network") .withRequiredArg() .ofType(String.class) .describedAs("host[:port]") @@ -416,7 +416,7 @@ public class Config { .describedAs("host:port[,...]"); ArgumentAcceptingOptionSpec useLocalhostForP2POpt = - parser.accepts(USE_LOCALHOST_FOR_P2P, "Use localhost P2P network for development. Only available for non-BTC_MAINNET configuration.") + parser.accepts(USE_LOCALHOST_FOR_P2P, "Use localhost P2P network for development. Only available for non-XMR_MAINNET configuration.") .availableIf(BASE_CURRENCY_NETWORK) .withRequiredArg() .ofType(boolean.class) @@ -919,7 +919,7 @@ public class Config { /** * Static accessor that returns either the default base currency network value of - * {@link BaseCurrencyNetwork#BTC_MAINNET} or the value assigned via the + * {@link BaseCurrencyNetwork#XMR_MAINNET} or the value assigned via the * {@value BASE_CURRENCY_NETWORK} option. The non-static * {@link #baseCurrencyNetwork} property should be favored whenever possible and * this static accessor should be used only in code locations where it is infeasible diff --git a/core/src/main/java/bisq/core/api/CoreWalletsService.java b/core/src/main/java/bisq/core/api/CoreWalletsService.java index 69b113e3c3..d1687b1d4b 100644 --- a/core/src/main/java/bisq/core/api/CoreWalletsService.java +++ b/core/src/main/java/bisq/core/api/CoreWalletsService.java @@ -22,6 +22,7 @@ import bisq.core.api.model.BalancesInfo; import bisq.core.api.model.BsqBalanceInfo; import bisq.core.api.model.BtcBalanceInfo; import bisq.core.api.model.TxFeeRateInfo; +import bisq.core.api.model.XmrBalanceInfo; import bisq.core.app.AppStartupState; import bisq.core.btc.Balances; import bisq.core.btc.exceptions.AddressEntryException; @@ -160,11 +161,13 @@ class CoreWalletsService { switch (currencyCode.trim().toUpperCase()) { case "BSQ": - return new BalancesInfo(getBsqBalances(), BtcBalanceInfo.EMPTY); + return new BalancesInfo(getBsqBalances(), BtcBalanceInfo.EMPTY, XmrBalanceInfo.EMPTY); case "BTC": - return new BalancesInfo(BsqBalanceInfo.EMPTY, getBtcBalances()); + return new BalancesInfo(BsqBalanceInfo.EMPTY, getBtcBalances(), XmrBalanceInfo.EMPTY); + case "XMR": + return new BalancesInfo(BsqBalanceInfo.EMPTY, BtcBalanceInfo.EMPTY, getXmrBalances()); default: - return new BalancesInfo(getBsqBalances(), getBtcBalances()); + return new BalancesInfo(getBsqBalances(), getBtcBalances(), getXmrBalances()); } } @@ -602,6 +605,7 @@ class CoreWalletsService { unlockingBondsBalance.value); } + // TODO (woodser): delete this since it's serving XMR balances private BtcBalanceInfo getBtcBalances() { verifyWalletsAreAvailable(); verifyEncryptedWalletIsUnlocked(); @@ -624,6 +628,29 @@ class CoreWalletsService { lockedBalance.value); } + private XmrBalanceInfo getXmrBalances() { + verifyWalletsAreAvailable(); + verifyEncryptedWalletIsUnlocked(); + + var availableBalance = balances.getAvailableBalance().get(); + if (availableBalance == null) + throw new IllegalStateException("available balance is not yet available"); + + var reservedBalance = balances.getReservedBalance().get(); + if (reservedBalance == null) + throw new IllegalStateException("reserved balance is not yet available"); + + var lockedBalance = balances.getLockedBalance().get(); + if (lockedBalance == null) + throw new IllegalStateException("locked balance is not yet available"); + + return new XmrBalanceInfo(availableBalance.add(lockedBalance).value, + availableBalance.value, + lockedBalance.value, + reservedBalance.value, + availableBalance.add(lockedBalance).add(reservedBalance).value); + } + // Returns a Coin for the transfer amount string, or a RuntimeException if invalid. private Coin getValidTransferAmount(String amount, CoinFormatter coinFormatter) { Coin amountAsCoin = parseToCoin(amount, coinFormatter); diff --git a/core/src/main/java/bisq/core/api/model/BalancesInfo.java b/core/src/main/java/bisq/core/api/model/BalancesInfo.java index 3b063bc0d2..fb15b0a7e9 100644 --- a/core/src/main/java/bisq/core/api/model/BalancesInfo.java +++ b/core/src/main/java/bisq/core/api/model/BalancesInfo.java @@ -12,10 +12,12 @@ public class BalancesInfo implements Payload { // balancesInfo.getBtcBalanceInfo().getAvailableBalance(). private final BsqBalanceInfo bsq; private final BtcBalanceInfo btc; + private final XmrBalanceInfo xmr; - public BalancesInfo(BsqBalanceInfo bsq, BtcBalanceInfo btc) { + public BalancesInfo(BsqBalanceInfo bsq, BtcBalanceInfo btc, XmrBalanceInfo xmr) { this.bsq = bsq; this.btc = btc; + this.xmr = xmr; } /////////////////////////////////////////////////////////////////////////////////////////// @@ -27,12 +29,14 @@ public class BalancesInfo implements Payload { return bisq.proto.grpc.BalancesInfo.newBuilder() .setBsq(bsq.toProtoMessage()) .setBtc(btc.toProtoMessage()) + .setXmr(xmr.toProtoMessage()) .build(); } public static BalancesInfo fromProto(bisq.proto.grpc.BalancesInfo proto) { return new BalancesInfo(BsqBalanceInfo.fromProto(proto.getBsq()), - BtcBalanceInfo.fromProto(proto.getBtc())); + BtcBalanceInfo.fromProto(proto.getBtc()), + XmrBalanceInfo.fromProto(proto.getXmr())); } @Override @@ -40,6 +44,7 @@ public class BalancesInfo implements Payload { return "BalancesInfo{" + "\n" + " " + bsq.toString() + "\n" + ", " + btc.toString() + "\n" + + ", " + xmr.toString() + "\n" + '}'; } } diff --git a/core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java b/core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java new file mode 100644 index 0000000000..4c2c84d07f --- /dev/null +++ b/core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java @@ -0,0 +1,84 @@ +package bisq.core.api.model; + +import bisq.common.Payload; + +import com.google.common.annotations.VisibleForTesting; + +import lombok.Getter; + +@Getter +public class XmrBalanceInfo implements Payload { + + public static final XmrBalanceInfo EMPTY = new XmrBalanceInfo(-1, + -1, + -1, + -1, + -1); + + // All balances are in XMR centineros: https://www.getmonero.org/resources/moneropedia/denominations.html + private final long balance; + private final long availableBalance; + private final long lockedBalance; + private final long reservedBalance; + private final long totalBalance; // balance + reserved + + public XmrBalanceInfo(long balance, + long availableBalance, + long lockedBalance, + long reservedBalance, + long totalBalance) { + this.balance = balance; + this.availableBalance = availableBalance; + this.lockedBalance = lockedBalance; + this.reservedBalance = reservedBalance; + this.totalBalance = totalBalance; + } + + @VisibleForTesting + public static XmrBalanceInfo valueOf(long balance, + long availableBalance, + long lockedBalance, + long reservedBalance, + long totalBalance) { + // Convenience for creating a model instance instead of a proto. + return new XmrBalanceInfo(balance, + availableBalance, + lockedBalance, + reservedBalance, + totalBalance); + } + + /////////////////////////////////////////////////////////////////////////////////////////// + // PROTO BUFFER + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public bisq.proto.grpc.XmrBalanceInfo toProtoMessage() { + return bisq.proto.grpc.XmrBalanceInfo.newBuilder() + .setBalance(balance) + .setAvailableBalance(availableBalance) + .setLockedBalance(lockedBalance) + .setReservedBalance(reservedBalance) + .setTotalBalance(totalBalance) + .build(); + } + + public static XmrBalanceInfo fromProto(bisq.proto.grpc.XmrBalanceInfo proto) { + return new XmrBalanceInfo(proto.getBalance(), + proto.getAvailableBalance(), + proto.getLockedBalance(), + proto.getReservedBalance(), + proto.getTotalBalance()); + } + + @Override + public String toString() { + return "BtcBalanceInfo{" + + "balance=" + balance + + ", availableBalance=" + availableBalance + + ", lockedBalance=" + lockedBalance + + ", reservedBalance=" + reservedBalance + + ", totalBalance=" + totalBalance + + '}'; + } +} diff --git a/core/src/main/java/bisq/core/app/BisqExecutable.java b/core/src/main/java/bisq/core/app/BisqExecutable.java index 355483cee0..0016b68dab 100644 --- a/core/src/main/java/bisq/core/app/BisqExecutable.java +++ b/core/src/main/java/bisq/core/app/BisqExecutable.java @@ -88,6 +88,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet System.exit(EXIT_SUCCESS); } } catch (ConfigException ex) { + ex.printStackTrace(); System.err.println("error: " + ex.getMessage()); System.exit(EXIT_FAILURE); } catch (Throwable ex) { @@ -205,6 +206,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet bisqSetup.start(); } + @Override public abstract void onSetupComplete(); diff --git a/core/src/main/java/bisq/core/app/BisqSetup.java b/core/src/main/java/bisq/core/app/BisqSetup.java index c697e2f71e..8045a7b6cf 100644 --- a/core/src/main/java/bisq/core/app/BisqSetup.java +++ b/core/src/main/java/bisq/core/app/BisqSetup.java @@ -290,7 +290,7 @@ public class BisqSetup { public void start() { // If user tried to downgrade we require a shutdown - if (Config.baseCurrencyNetwork() == BaseCurrencyNetwork.BTC_MAINNET && + if (Config.baseCurrencyNetwork() == BaseCurrencyNetwork.XMR_MAINNET && hasDowngraded(downGradePreventionHandler)) { return; } diff --git a/core/src/main/java/bisq/core/dao/governance/blindvote/MyBlindVoteListService.java b/core/src/main/java/bisq/core/dao/governance/blindvote/MyBlindVoteListService.java index d0edacc099..70cac97634 100644 --- a/core/src/main/java/bisq/core/dao/governance/blindvote/MyBlindVoteListService.java +++ b/core/src/main/java/bisq/core/dao/governance/blindvote/MyBlindVoteListService.java @@ -374,7 +374,7 @@ public class MyBlindVoteListService implements PersistedDataHost, DaoStateListen // Only payloads received from seed nodes would ignore that date check. int minPeers = Config.baseCurrencyNetwork().isMainnet() ? 4 : 1; if ((p2PService.getNumConnectedPeers().get() >= minPeers && p2PService.isBootstrapped()) || - Config.baseCurrencyNetwork().isRegtest()) { + Config.baseCurrencyNetwork().isStagenet()) { myBlindVoteList.stream() .filter(blindVote -> periodService.isTxInPhaseAndCycle(blindVote.getTxId(), DaoPhase.Phase.BLIND_VOTE, diff --git a/core/src/main/java/bisq/core/dao/governance/param/Param.java b/core/src/main/java/bisq/core/dao/governance/param/Param.java index 7202c414aa..b20e7784b7 100644 --- a/core/src/main/java/bisq/core/dao/governance/param/Param.java +++ b/core/src/main/java/bisq/core/dao/governance/param/Param.java @@ -138,7 +138,7 @@ public enum Param { PHASE_UNDEFINED("0", ParamType.BLOCK), PHASE_PROPOSAL(Config.baseCurrencyNetwork().isMainnet() ? "3601" : // mainnet; 24 days - Config.baseCurrencyNetwork().isRegtest() ? + Config.baseCurrencyNetwork().isStagenet() ? "4" : // regtest Config.baseCurrencyNetwork().isDaoBetaNet() ? "144" : // daoBetaNet; 1 day @@ -148,7 +148,7 @@ public enum Param { ParamType.BLOCK, 2, 2), PHASE_BREAK1(Config.baseCurrencyNetwork().isMainnet() ? "149" : // mainnet; 1 day - Config.baseCurrencyNetwork().isRegtest() ? + Config.baseCurrencyNetwork().isStagenet() ? "1" : // regtest Config.baseCurrencyNetwork().isDaoBetaNet() ? "10" : // daoBetaNet @@ -158,7 +158,7 @@ public enum Param { ParamType.BLOCK, 2, 2), PHASE_BLIND_VOTE(Config.baseCurrencyNetwork().isMainnet() ? "451" : // mainnet; 3 days - Config.baseCurrencyNetwork().isRegtest() ? + Config.baseCurrencyNetwork().isStagenet() ? "2" : // regtest Config.baseCurrencyNetwork().isDaoBetaNet() ? "144" : // daoBetaNet; 1 day @@ -168,7 +168,7 @@ public enum Param { ParamType.BLOCK, 2, 2), PHASE_BREAK2(Config.baseCurrencyNetwork().isMainnet() ? "9" : // mainnet - Config.baseCurrencyNetwork().isRegtest() ? + Config.baseCurrencyNetwork().isStagenet() ? "1" : // regtest Config.baseCurrencyNetwork().isDaoBetaNet() ? "10" : // daoBetaNet @@ -178,7 +178,7 @@ public enum Param { ParamType.BLOCK, 2, 2), PHASE_VOTE_REVEAL(Config.baseCurrencyNetwork().isMainnet() ? "451" : // mainnet; 3 days - Config.baseCurrencyNetwork().isRegtest() ? + Config.baseCurrencyNetwork().isStagenet() ? "2" : // regtest Config.baseCurrencyNetwork().isDaoBetaNet() ? "144" : // daoBetaNet; 1 day @@ -188,7 +188,7 @@ public enum Param { ParamType.BLOCK, 2, 2), PHASE_BREAK3(Config.baseCurrencyNetwork().isMainnet() ? "9" : // mainnet - Config.baseCurrencyNetwork().isRegtest() ? + Config.baseCurrencyNetwork().isStagenet() ? "1" : // regtest Config.baseCurrencyNetwork().isDaoBetaNet() ? "10" : // daoBetaNet @@ -198,7 +198,7 @@ public enum Param { ParamType.BLOCK, 2, 2), PHASE_RESULT(Config.baseCurrencyNetwork().isMainnet() ? "10" : // mainnet - Config.baseCurrencyNetwork().isRegtest() ? + Config.baseCurrencyNetwork().isStagenet() ? "2" : // regtest Config.baseCurrencyNetwork().isDaoBetaNet() ? "10" : // daoBetaNet diff --git a/core/src/main/java/bisq/core/dao/governance/proposal/MyProposalListService.java b/core/src/main/java/bisq/core/dao/governance/proposal/MyProposalListService.java index 96ab94ed66..8bb83c54a4 100644 --- a/core/src/main/java/bisq/core/dao/governance/proposal/MyProposalListService.java +++ b/core/src/main/java/bisq/core/dao/governance/proposal/MyProposalListService.java @@ -226,7 +226,7 @@ public class MyProposalListService implements PersistedDataHost, DaoStateListene // of that cycle so it is 1 blind vote getting rebroadcast at each startup to my neighbors. int minPeers = Config.baseCurrencyNetwork().isMainnet() ? 4 : 1; if ((p2PService.getNumConnectedPeers().get() >= minPeers && p2PService.isBootstrapped()) || - Config.baseCurrencyNetwork().isRegtest()) { + Config.baseCurrencyNetwork().isStagenet()) { myProposalList.stream() .filter(proposal -> periodService.isTxInPhaseAndCycle(proposal.getTxId(), DaoPhase.Phase.PROPOSAL, diff --git a/core/src/main/java/bisq/core/dao/state/GenesisTxInfo.java b/core/src/main/java/bisq/core/dao/state/GenesisTxInfo.java index 94a056afdd..f1c696ca41 100644 --- a/core/src/main/java/bisq/core/dao/state/GenesisTxInfo.java +++ b/core/src/main/java/bisq/core/dao/state/GenesisTxInfo.java @@ -112,7 +112,7 @@ public class GenesisTxInfo { boolean isDaoTestNet = baseCurrencyNetwork.isDaoTestNet(); boolean isDaoBetaNet = baseCurrencyNetwork.isDaoBetaNet(); boolean isDaoRegTest = baseCurrencyNetwork.isDaoRegTest(); - boolean isRegtest = baseCurrencyNetwork.isRegtest(); + boolean isRegtest = baseCurrencyNetwork.isStagenet(); if (!genesisTxId.isEmpty()) { this.genesisTxId = genesisTxId; } else if (isMainnet) { diff --git a/core/src/main/java/bisq/core/dao/state/model/governance/BondedRoleType.java b/core/src/main/java/bisq/core/dao/state/model/governance/BondedRoleType.java index 2f93bc7947..1f53a587a2 100644 --- a/core/src/main/java/bisq/core/dao/state/model/governance/BondedRoleType.java +++ b/core/src/main/java/bisq/core/dao/state/model/governance/BondedRoleType.java @@ -95,7 +95,7 @@ public enum BondedRoleType { this.requiredBondUnit = requiredBondUnit; this.unlockTimeInBlocks = Config.baseCurrencyNetwork().isMainnet() ? unlockTimeInDays * 144 : // mainnet (144 blocks per day) - Config.baseCurrencyNetwork().isRegtest() ? + Config.baseCurrencyNetwork().isStagenet() ? 5 : // regtest (arbitrarily low value for dev testing) 144; // testnet (relatively short time for testing purposes) this.link = link; diff --git a/core/src/main/java/bisq/core/locale/Res.java b/core/src/main/java/bisq/core/locale/Res.java index 6d102ccdd2..1ed773d24e 100644 --- a/core/src/main/java/bisq/core/locale/Res.java +++ b/core/src/main/java/bisq/core/locale/Res.java @@ -46,8 +46,8 @@ import org.jetbrains.annotations.NotNull; public class Res { public static void setup() { BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork(); - setBaseCurrencyCode("XMR"); - setBaseCurrencyName("Monero"); + setBaseCurrencyCode(baseCurrencyNetwork.getCurrencyCode()); + setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName()); } @SuppressWarnings("CanBeFinal") @@ -78,20 +78,20 @@ public class Res { private static String baseCurrencyNameLowerCase; public static void setBaseCurrencyCode(String baseCurrencyCode) { - Res.baseCurrencyCode = "XMR"; + Res.baseCurrencyCode = baseCurrencyCode; } public static void setBaseCurrencyName(String baseCurrencyName) { - Res.baseCurrencyName = "Monero"; + Res.baseCurrencyName = baseCurrencyName; baseCurrencyNameLowerCase = baseCurrencyName.toLowerCase(); } public static String getBaseCurrencyCode() { - return "XMR"; + return baseCurrencyCode; } public static String getBaseCurrencyName() { - return "Monero"; + return baseCurrencyName; } // Capitalize first character diff --git a/core/src/main/java/bisq/core/network/p2p/seed/DefaultSeedNodeRepository.java b/core/src/main/java/bisq/core/network/p2p/seed/DefaultSeedNodeRepository.java index 4c52456fb6..14c458a959 100644 --- a/core/src/main/java/bisq/core/network/p2p/seed/DefaultSeedNodeRepository.java +++ b/core/src/main/java/bisq/core/network/p2p/seed/DefaultSeedNodeRepository.java @@ -112,6 +112,7 @@ public class DefaultSeedNodeRepository implements SeedNodeRepository { return list; } + @Override public Collection getSeedNodeAddresses() { if (cache.isEmpty()) reload(); @@ -119,6 +120,7 @@ public class DefaultSeedNodeRepository implements SeedNodeRepository { return cache; } + @Override public boolean isSeedNode(NodeAddress nodeAddress) { if (cache.isEmpty()) reload(); diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/maker/MakerSetsLockTime.java b/core/src/main/java/bisq/core/trade/protocol/tasks/maker/MakerSetsLockTime.java index fde4359bec..82c9ddc146 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/maker/MakerSetsLockTime.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/maker/MakerSetsLockTime.java @@ -39,7 +39,7 @@ public class MakerSetsLockTime extends TradeTask { // 10 days for altcoins, 20 days for other payment methods // For regtest dev environment we use 5 blocks - int delay = Config.baseCurrencyNetwork().isRegtest() ? + int delay = Config.baseCurrencyNetwork().isStagenet() ? 5 : Restrictions.getLockTime(processModel.getOffer().getPaymentMethod().isAsset()); diff --git a/core/src/main/java/bisq/core/user/Preferences.java b/core/src/main/java/bisq/core/user/Preferences.java index 156a83f9ea..adce4e4c6d 100644 --- a/core/src/main/java/bisq/core/user/Preferences.java +++ b/core/src/main/java/bisq/core/user/Preferences.java @@ -120,6 +120,12 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid new BlockChainExplorer("mempool.emzy.de (@emzy)", "https://mempool.emzy.de/bisq/tx/", "https://mempool.emzy.de/bisq/address/"), new BlockChainExplorer("mempool.bisq.services (@devinbileck)", "https://mempool.bisq.services/bisq/tx/", "https://mempool.bisq.services/bisq/address/") )); + private static final ArrayList XMR_MAIN_NET_EXPLORERS = new ArrayList<>(Arrays.asList( + new BlockChainExplorer("xmrchain.net", "https://xmrchain.net/tx/", "") + )); + private static final ArrayList XMR_TEST_NET_EXPLORERS = new ArrayList<>(Arrays.asList( + new BlockChainExplorer("testnet.xmrchain.net", "https://testnet.xmrchain.net/tx/", "") + )); private static final ArrayList XMR_TX_PROOF_SERVICES_CLEAR_NET = new ArrayList<>(Arrays.asList( "xmrblocks.monero.emzy.de", // @emzy @@ -284,9 +290,12 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid setCryptoCurrencies(CurrencyUtil.getMainCryptoCurrencies()); BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork(); - if ("BTC".equals(baseCurrencyNetwork.getCurrencyCode())) { // TODO (woodser): change to XMR when --baseCurrencyNetwork=XMR_REGTEST supported + if ("BTC".equals(baseCurrencyNetwork.getCurrencyCode())) { setBlockChainExplorerMainNet(BTC_MAIN_NET_EXPLORERS.get(0)); setBlockChainExplorerTestNet(BTC_TEST_NET_EXPLORERS.get(0)); + } else if ("XMR".equals(baseCurrencyNetwork.getCurrencyCode())) { + setBlockChainExplorerMainNet(XMR_MAIN_NET_EXPLORERS.get(0)); + setBlockChainExplorerTestNet(XMR_TEST_NET_EXPLORERS.get(0)); } else { throw new RuntimeException("BaseCurrencyNetwork not defined. BaseCurrencyNetwork=" + baseCurrencyNetwork); } @@ -829,10 +838,10 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid public BlockChainExplorer getBlockChainExplorer() { BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork(); switch (baseCurrencyNetwork) { - case BTC_MAINNET: + case XMR_MAINNET: return prefPayload.getBlockChainExplorerMainNet(); - case BTC_TESTNET: - case BTC_REGTEST: + case XMR_TESTNET: + case XMR_STAGENET: return prefPayload.getBlockChainExplorerTestNet(); case BTC_DAO_TESTNET: return BTC_DAO_TEST_NET_EXPLORERS.get(0); @@ -848,10 +857,10 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid public ArrayList getBlockChainExplorers() { BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork(); switch (baseCurrencyNetwork) { - case BTC_MAINNET: + case XMR_MAINNET: return BTC_MAIN_NET_EXPLORERS; - case BTC_TESTNET: - case BTC_REGTEST: + case XMR_TESTNET: + case XMR_STAGENET: return BTC_TEST_NET_EXPLORERS; case BTC_DAO_TESTNET: return BTC_DAO_TEST_NET_EXPLORERS; diff --git a/core/src/main/java/bisq/core/util/ParsingUtils.java b/core/src/main/java/bisq/core/util/ParsingUtils.java index 30743888d8..f24eeb47c1 100644 --- a/core/src/main/java/bisq/core/util/ParsingUtils.java +++ b/core/src/main/java/bisq/core/util/ParsingUtils.java @@ -18,22 +18,22 @@ import lombok.extern.slf4j.Slf4j; public class ParsingUtils { /** - * Temporary multiplier to convert Coin satoshis to XMR atomic units. + * Temporary multiplier to convert Coin satoshis (denominating XMR centineros) to XMR atomic units. * * TODO (woodser): replace bitcoinj/Coin entirely? */ private static BigInteger XMR_SATOSHI_MULTIPLIER = BigInteger.valueOf(10000); // TODO (woodser): make this private and expose satoshisToXmrAtomicUnits() - + /** * Converts Coin satoshis (the base unit throughout Bisq) to XMR atomic units. - * + * * @param satoshis represents an amount in XMR atomic units scaled to a long * @return BigInteger is the equivalent amount in XMR atomic units */ public static BigInteger satoshisToXmrAtomicUnits(long satoshis) { return BigInteger.valueOf(satoshis).multiply(ParsingUtils.XMR_SATOSHI_MULTIPLIER); } - + public static Coin parseToCoin(String input, CoinFormatter coinFormatter) { return parseToCoin(input, coinFormatter.getMonetaryFormat()); } diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index d8ea38c85f..05ca704c34 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -3149,11 +3149,11 @@ formatter.asTaker={0} {1} as taker # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Monero Mainnet +XMR_MAINNET=Monero Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=Monero Testnet +XMR_TESTNET=Monero Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=Monero Regtest +XMR_STAGENET=Monero Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Monero DAO Testnet (deprecated) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_cs.properties b/core/src/main/resources/i18n/displayStrings_cs.properties index 35785f4713..04314d4ca3 100644 --- a/core/src/main/resources/i18n/displayStrings_cs.properties +++ b/core/src/main/resources/i18n/displayStrings_cs.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} jako příjemce # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Bitcoin Mainnet +XMR_MAINNET=Monero Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=Bitcoin Testnet +XMR_TESTNET=Monero Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=Bitcoin Regtest +XMR_STAGENET=Monero Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Bitcoin DAO Testnet (zastaralé) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_de.properties b/core/src/main/resources/i18n/displayStrings_de.properties index 6c32bcb766..0e5118326d 100644 --- a/core/src/main/resources/i18n/displayStrings_de.properties +++ b/core/src/main/resources/i18n/displayStrings_de.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} als Abnehmer # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Bitcoin-Hauptnetzwerk +XMR_MAINNET=Bitcoin-Hauptnetzwerk # suppress inspection "UnusedProperty" -BTC_TESTNET=Bitcoin-Testnetzwerk +XMR_TESTNET=Bitcoin-Testnetzwerk # suppress inspection "UnusedProperty" -BTC_REGTEST=Bitcoin-Regtest +XMR_STAGENET=Bitcoin-Regtest # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Bitcoin-DAO-Testnetzwerk (veraltet) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_es.properties b/core/src/main/resources/i18n/displayStrings_es.properties index b27dd7dda7..70d218a4e5 100644 --- a/core/src/main/resources/i18n/displayStrings_es.properties +++ b/core/src/main/resources/i18n/displayStrings_es.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} como tomador # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Red principal de Bitcoin +XMR_MAINNET=Red principal de Monero # suppress inspection "UnusedProperty" -BTC_TESTNET=Red de prueba de Bitcoin +XMR_TESTNET=Red de prueba de Monero # suppress inspection "UnusedProperty" -BTC_REGTEST=Regtest Bitcoin +XMR_STAGENET=Stagenet Monero # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Testnet de Bitcoin DAO (depreciada) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_fa.properties b/core/src/main/resources/i18n/displayStrings_fa.properties index 2c317ac24d..cf6b877f41 100644 --- a/core/src/main/resources/i18n/displayStrings_fa.properties +++ b/core/src/main/resources/i18n/displayStrings_fa.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} به عنوان پذیرنده # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Bitcoin Mainnet +XMR_MAINNET=Monero Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=Bitcoin Testnet +XMR_TESTNET=Monero Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=Bitcoin Regtest +XMR_STAGENET=Monero Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Bitcoin DAO Testnet (deprecated) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_fr.properties b/core/src/main/resources/i18n/displayStrings_fr.properties index dac91f2031..0bb5a2d755 100644 --- a/core/src/main/resources/i18n/displayStrings_fr.properties +++ b/core/src/main/resources/i18n/displayStrings_fr.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} en tant que taker # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Bitcoin Mainnet +XMR_MAINNET=Monero Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=Bitcoin Testnet +XMR_TESTNET=Monero Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=Bitcoin Regtest +XMR_STAGENET=Monero Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Bitcoin DAO Testnet (obsolète) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_it.properties b/core/src/main/resources/i18n/displayStrings_it.properties index e38c5f7482..588d7443ce 100644 --- a/core/src/main/resources/i18n/displayStrings_it.properties +++ b/core/src/main/resources/i18n/displayStrings_it.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} come taker # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Mainnet Bitcoin +XMR_MAINNET=Mainnet Bitcoin # suppress inspection "UnusedProperty" -BTC_TESTNET=Testnet Bitcoin +XMR_TESTNET=Testnet Bitcoin # suppress inspection "UnusedProperty" -BTC_REGTEST=Regtest Bitcoin +XMR_STAGENET=Regtest Bitcoin # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Testnet DAO Bitcoin (deprecata) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_ja.properties b/core/src/main/resources/i18n/displayStrings_ja.properties index 150e2817d5..1e2edf8cb0 100644 --- a/core/src/main/resources/i18n/displayStrings_ja.properties +++ b/core/src/main/resources/i18n/displayStrings_ja.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1}のテイカー # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=ビットコイン メインネット +XMR_MAINNET=Monero Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=ビットコイン テストネット +XMR_TESTNET=Monero Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=ビットコイン(Regtest) +XMR_STAGENET=Monero Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=ビットコインDAOテストネット(非推奨) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_pt-br.properties b/core/src/main/resources/i18n/displayStrings_pt-br.properties index 0d23599450..fdf18602e2 100644 --- a/core/src/main/resources/i18n/displayStrings_pt-br.properties +++ b/core/src/main/resources/i18n/displayStrings_pt-br.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} como aceitador # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Mainnet do Bitcoin +XMR_MAINNET=Mainnet do Monero # suppress inspection "UnusedProperty" -BTC_TESTNET=Testnet do Bitcoin +XMR_TESTNET=Testnet do Monero # suppress inspection "UnusedProperty" -BTC_REGTEST=Regtest do Bitcoin +XMR_STAGENET=Stagenet do Monero # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Testnet da DAO do Bitcoin (descontinuada) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_pt.properties b/core/src/main/resources/i18n/displayStrings_pt.properties index a997b20804..3438967e14 100644 --- a/core/src/main/resources/i18n/displayStrings_pt.properties +++ b/core/src/main/resources/i18n/displayStrings_pt.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} como aceitador # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Mainnet de Bitcoin +XMR_MAINNET=Mainnet de Monero # suppress inspection "UnusedProperty" -BTC_TESTNET=Testnet de Bitcoin +XMR_TESTNET=Testnet de Monero # suppress inspection "UnusedProperty" -BTC_REGTEST=Regtest Bitcoin +XMR_STAGENET=Stagenet Monero # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Testnet da OAD do Bitcoin (discontinuada) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_ru.properties b/core/src/main/resources/i18n/displayStrings_ru.properties index 20e0c55c07..216331fec9 100644 --- a/core/src/main/resources/i18n/displayStrings_ru.properties +++ b/core/src/main/resources/i18n/displayStrings_ru.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} как тейкер # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Осн. сеть Биткойн +XMR_MAINNET=XMR Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=Тестовая сеть Биткойн +XMR_TESTNET=XMR Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=Режим регрессионного тестирования в сети Биткойн +XMR_STAGENET=XMR Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Тестовая сеть ДАО Биткойн (устаревшая) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_th.properties b/core/src/main/resources/i18n/displayStrings_th.properties index 56c62c4087..da2ed99f51 100644 --- a/core/src/main/resources/i18n/displayStrings_th.properties +++ b/core/src/main/resources/i18n/displayStrings_th.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} ในฐานะคนรับ # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Bitcoin Mainnet +XMR_MAINNET=Monero Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=Bitcoin Testnet +XMR_TESTNET=Monero Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=Bitcoin Regtest +XMR_STAGENET=Monero Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Bitcoin DAO Testnet (deprecated) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_vi.properties b/core/src/main/resources/i18n/displayStrings_vi.properties index cbd2297740..819cce63a8 100644 --- a/core/src/main/resources/i18n/displayStrings_vi.properties +++ b/core/src/main/resources/i18n/displayStrings_vi.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} như người nhận # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=Bitcoin Mainnet +XMR_MAINNET=Bitcoin Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=Bitcoin Testnet +XMR_TESTNET=Bitcoin Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=Bitcoin Regtest +XMR_STAGENET=Bitcoin Regtest # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=Bitcoin DAO Testnet (không tán thành) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_zh-hans.properties b/core/src/main/resources/i18n/displayStrings_zh-hans.properties index d3fb458957..d3c4ebbf4c 100644 --- a/core/src/main/resources/i18n/displayStrings_zh-hans.properties +++ b/core/src/main/resources/i18n/displayStrings_zh-hans.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} 是买家 # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=比特币主干网络 +XMR_MAINNET=XMR Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=比特币测试网络 +XMR_TESTNET=XMR Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=比特币回归测试 +XMR_STAGENET=XMR Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=比特币 DAO 测试网络(弃用) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/i18n/displayStrings_zh-hant.properties b/core/src/main/resources/i18n/displayStrings_zh-hant.properties index adfa8b137c..a4d64b8f39 100644 --- a/core/src/main/resources/i18n/displayStrings_zh-hant.properties +++ b/core/src/main/resources/i18n/displayStrings_zh-hant.properties @@ -2553,11 +2553,11 @@ formatter.asTaker={0} {1} 是買家 # we use enum values here # dynamic values are not recognized by IntelliJ # suppress inspection "UnusedProperty" -BTC_MAINNET=比特幣主幹網絡 +XMR_MAINNET=XMR Mainnet # suppress inspection "UnusedProperty" -BTC_TESTNET=比特幣測試網絡 +XMR_TESTNET=XMR Testnet # suppress inspection "UnusedProperty" -BTC_REGTEST=比特幣迴歸測試 +XMR_STAGENET=XMR Stagenet # suppress inspection "UnusedProperty" BTC_DAO_TESTNET=比特幣 DAO 測試網絡(棄用) # suppress inspection "UnusedProperty" diff --git a/core/src/main/resources/xmr_mainnet.seednodes b/core/src/main/resources/xmr_mainnet.seednodes new file mode 100644 index 0000000000..3f81fa0483 --- /dev/null +++ b/core/src/main/resources/xmr_mainnet.seednodes @@ -0,0 +1,2 @@ +# nodeaddress.onion:port [(@owner,@backup)] +placeholder.onion:8000 (@placeholder) \ No newline at end of file diff --git a/core/src/main/resources/xmr_stagenet.seednodes b/core/src/main/resources/xmr_stagenet.seednodes new file mode 100644 index 0000000000..44cd4ec296 --- /dev/null +++ b/core/src/main/resources/xmr_stagenet.seednodes @@ -0,0 +1,3 @@ +# nodeaddress.onion:port [(@owner,@backup)] +localhost:2002 (@devtest1) +localhost:3002 (@devtest2) diff --git a/core/src/main/resources/xmr_testnet.seednodes b/core/src/main/resources/xmr_testnet.seednodes new file mode 100644 index 0000000000..93f8c13fb1 --- /dev/null +++ b/core/src/main/resources/xmr_testnet.seednodes @@ -0,0 +1,2 @@ +# nodeaddress.onion:port [(@owner)] +placeholder.onion:8001 diff --git a/core/src/test/java/bisq/core/locale/CurrencyUtilTest.java b/core/src/test/java/bisq/core/locale/CurrencyUtilTest.java index baa66cb245..4ed5c5d232 100644 --- a/core/src/test/java/bisq/core/locale/CurrencyUtilTest.java +++ b/core/src/test/java/bisq/core/locale/CurrencyUtilTest.java @@ -68,28 +68,28 @@ public class CurrencyUtilTest { boolean daoTradingActivated = false; // Test if BSQ on mainnet is failing Assert.assertFalse(CurrencyUtil.findAsset(assetRegistry, "BSQ", - BaseCurrencyNetwork.BTC_MAINNET, daoTradingActivated).isPresent()); + BaseCurrencyNetwork.XMR_MAINNET, daoTradingActivated).isPresent()); // on testnet/regtest it is allowed assertEquals(CurrencyUtil.findAsset(assetRegistry, "BSQ", - BaseCurrencyNetwork.BTC_TESTNET, daoTradingActivated).get().getTickerSymbol(), "BSQ"); + BaseCurrencyNetwork.XMR_TESTNET, daoTradingActivated).get().getTickerSymbol(), "BSQ"); daoTradingActivated = true; // With daoTradingActivated we can request BSQ assertEquals(CurrencyUtil.findAsset(assetRegistry, "BSQ", - BaseCurrencyNetwork.BTC_MAINNET, daoTradingActivated).get().getTickerSymbol(), "BSQ"); + BaseCurrencyNetwork.XMR_MAINNET, daoTradingActivated).get().getTickerSymbol(), "BSQ"); // Test if not matching ticker is failing Assert.assertFalse(CurrencyUtil.findAsset(assetRegistry, "BSQ1", - BaseCurrencyNetwork.BTC_MAINNET, daoTradingActivated).isPresent()); + BaseCurrencyNetwork.XMR_MAINNET, daoTradingActivated).isPresent()); // Add a mock coin which has no mainnet version, needs to fail if we are on mainnet MockTestnetCoin.Testnet mockTestnetCoin = new MockTestnetCoin.Testnet(); try { assetRegistry.addAsset(mockTestnetCoin); CurrencyUtil.findAsset(assetRegistry, "MOCK_COIN", - BaseCurrencyNetwork.BTC_MAINNET, daoTradingActivated); + BaseCurrencyNetwork.XMR_MAINNET, daoTradingActivated); Assert.fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException e) { String wantMessage = "We are on mainnet and we could not find an asset with network type mainnet"; @@ -99,34 +99,34 @@ public class CurrencyUtilTest { // For testnet its ok assertEquals(CurrencyUtil.findAsset(assetRegistry, "MOCK_COIN", - BaseCurrencyNetwork.BTC_TESTNET, daoTradingActivated).get().getTickerSymbol(), "MOCK_COIN"); + BaseCurrencyNetwork.XMR_TESTNET, daoTradingActivated).get().getTickerSymbol(), "MOCK_COIN"); assertEquals(Coin.Network.TESTNET, mockTestnetCoin.getNetwork()); // For regtest its still found assertEquals(CurrencyUtil.findAsset(assetRegistry, "MOCK_COIN", - BaseCurrencyNetwork.BTC_REGTEST, daoTradingActivated).get().getTickerSymbol(), "MOCK_COIN"); + BaseCurrencyNetwork.XMR_STAGENET, daoTradingActivated).get().getTickerSymbol(), "MOCK_COIN"); // We test if we are not on mainnet to get the mainnet coin Coin ether = new Ether(); assertEquals(CurrencyUtil.findAsset(assetRegistry, "ETH", - BaseCurrencyNetwork.BTC_TESTNET, daoTradingActivated).get().getTickerSymbol(), "ETH"); + BaseCurrencyNetwork.XMR_TESTNET, daoTradingActivated).get().getTickerSymbol(), "ETH"); assertEquals(CurrencyUtil.findAsset(assetRegistry, "ETH", - BaseCurrencyNetwork.BTC_REGTEST, daoTradingActivated).get().getTickerSymbol(), "ETH"); + BaseCurrencyNetwork.XMR_STAGENET, daoTradingActivated).get().getTickerSymbol(), "ETH"); assertEquals(Coin.Network.MAINNET, ether.getNetwork()); // We test if network matches exactly if there are distinct network types defined like with BSQ - Coin bsq = (Coin) CurrencyUtil.findAsset(assetRegistry, "BSQ", BaseCurrencyNetwork.BTC_MAINNET, daoTradingActivated).get(); + Coin bsq = (Coin) CurrencyUtil.findAsset(assetRegistry, "BSQ", BaseCurrencyNetwork.XMR_MAINNET, daoTradingActivated).get(); assertEquals("BSQ", bsq.getTickerSymbol()); assertEquals(Coin.Network.MAINNET, bsq.getNetwork()); - bsq = (Coin) CurrencyUtil.findAsset(assetRegistry, "BSQ", BaseCurrencyNetwork.BTC_TESTNET, daoTradingActivated).get(); + bsq = (Coin) CurrencyUtil.findAsset(assetRegistry, "BSQ", BaseCurrencyNetwork.XMR_TESTNET, daoTradingActivated).get(); assertEquals("BSQ", bsq.getTickerSymbol()); assertEquals(Coin.Network.TESTNET, bsq.getNetwork()); - bsq = (Coin) CurrencyUtil.findAsset(assetRegistry, "BSQ", BaseCurrencyNetwork.BTC_REGTEST, daoTradingActivated).get(); + bsq = (Coin) CurrencyUtil.findAsset(assetRegistry, "BSQ", BaseCurrencyNetwork.XMR_STAGENET, daoTradingActivated).get(); assertEquals("BSQ", bsq.getTickerSymbol()); - assertEquals(Coin.Network.REGTEST, bsq.getNetwork()); + assertEquals(Coin.Network.STAGENET, bsq.getNetwork()); } @Test diff --git a/core/src/test/java/bisq/core/locale/MockTestnetCoin.java b/core/src/test/java/bisq/core/locale/MockTestnetCoin.java index 8ed0e85e9e..7b80a4cfb3 100644 --- a/core/src/test/java/bisq/core/locale/MockTestnetCoin.java +++ b/core/src/test/java/bisq/core/locale/MockTestnetCoin.java @@ -51,7 +51,7 @@ public class MockTestnetCoin extends Coin { public static class Regtest extends MockTestnetCoin { public Regtest() { - super(Network.REGTEST, RegTestParams.get()); + super(Network.STAGENET, RegTestParams.get()); } } diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java index edf96413c8..3368ac3b3f 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java @@ -584,7 +584,7 @@ public class ProposalDisplay { } else if (proposal instanceof RemoveAssetProposal) { RemoveAssetProposal removeAssetProposal = (RemoveAssetProposal) proposal; checkNotNull(assetComboBox, "assetComboBox must not be null"); - CurrencyUtil.findAsset(removeAssetProposal.getTickerSymbol(), BaseCurrencyNetwork.BTC_MAINNET) + CurrencyUtil.findAsset(removeAssetProposal.getTickerSymbol(), BaseCurrencyNetwork.XMR_MAINNET) .ifPresent(asset -> { assetComboBox.getSelectionModel().select(asset); comboBoxValueTextField.setText(assetComboBox.getConverter().toString(asset)); diff --git a/inventory/src/main/java/bisq/inventory/InventoryMonitorMain.java b/inventory/src/main/java/bisq/inventory/InventoryMonitorMain.java index 67925b6fc0..635bc5ef30 100644 --- a/inventory/src/main/java/bisq/inventory/InventoryMonitorMain.java +++ b/inventory/src/main/java/bisq/inventory/InventoryMonitorMain.java @@ -51,12 +51,12 @@ public class InventoryMonitorMain { private static InventoryMonitor inventoryMonitor; private static boolean stopped; - // prog args for regtest: 10 1 BTC_REGTEST + // prog args for regtest: 10 1 XMR_STAGENET public static void main(String[] args) { // Default values int intervalSec = 120; boolean useLocalhostForP2P = false; - BaseCurrencyNetwork network = BaseCurrencyNetwork.BTC_MAINNET; + BaseCurrencyNetwork network = BaseCurrencyNetwork.XMR_MAINNET; int port = 80; if (args.length > 0) { diff --git a/monitor/README.md b/monitor/README.md index f2ed142b89..ccd54f6287 100644 --- a/monitor/README.md +++ b/monitor/README.md @@ -34,7 +34,7 @@ A sample configuration file looks like follows: # true overwrites the reporters picked by the developers (for debugging for example) (defaults to false) System.useConsoleReporter=true -# 0 -> BTC_MAINNET, 1 -> BTC_TESTNET (default) +# 0 -> XMR_MAINNET, 1 -> XMR_TESTNET (default) System.baseCurrencyNetwork=0 ## Each Metric is configured via a set of properties. diff --git a/monitor/src/main/java/bisq/monitor/Metric.java b/monitor/src/main/java/bisq/monitor/Metric.java index 08598e1e9c..30ef9df016 100644 --- a/monitor/src/main/java/bisq/monitor/Metric.java +++ b/monitor/src/main/java/bisq/monitor/Metric.java @@ -91,7 +91,7 @@ public abstract class Metric extends Configurable implements Runnable { super.configure(properties); reporter.configure(properties); - Version.setBaseCryptoNetworkId(Integer.parseInt(properties.getProperty("System." + BASE_CURRENCY_NETWORK, "1"))); // defaults to BTC_TESTNET + Version.setBaseCryptoNetworkId(Integer.parseInt(properties.getProperty("System." + BASE_CURRENCY_NETWORK, "1"))); // defaults to XMR_TESTNET // decide whether to enable or disable the task if (configuration.isEmpty() || !configuration.getProperty("enabled", "false").equals("true") diff --git a/monitor/src/main/resources/metrics.properties b/monitor/src/main/resources/metrics.properties index 83a66920ca..4387cde544 100644 --- a/monitor/src/main/resources/metrics.properties +++ b/monitor/src/main/resources/metrics.properties @@ -3,7 +3,7 @@ # true overwrites the reporters picked by the developers (for debugging for example) (defaults to false) System.useConsoleReporter=true -# 0 -> BTC_MAINNET, 1 -> BTC_TESTNET (default) +# 0 -> XMR_MAINNET, 1 -> XMR_TESTNET (default) System.baseCurrencyNetwork=0 ## Each Metric is configured via a set of properties. diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto index e387aa90d1..e1c641597d 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -586,6 +586,7 @@ message BalancesInfo { // balancesInfo.getBtcBalanceInfo().getAvailableBalance(). BsqBalanceInfo bsq = 1; BtcBalanceInfo btc = 2; + XmrBalanceInfo xmr = 3; } message BsqBalanceInfo { @@ -604,6 +605,14 @@ message BtcBalanceInfo { uint64 lockedBalance = 4; } +message XmrBalanceInfo { + uint64 balance = 1; + uint64 availableBalance = 2; + uint64 lockedBalance = 3; + uint64 reservedBalance = 4; + uint64 totalBalance = 5; // balance + reserved +} + message AddressBalanceInfo { string address = 1; int64 balance = 2; diff --git a/seednode/docker-compose.yml b/seednode/docker-compose.yml index ff7ae6e744..7f7fc2ead7 100644 --- a/seednode/docker-compose.yml +++ b/seednode/docker-compose.yml @@ -10,7 +10,7 @@ services: - 8000:8000 environment: - NODE_PORT=8000 - - BASE_CURRENCY_NETWORK=BTC_REGTEST + - BASE_CURRENCY_NETWORK=XMR_STAGENET - SEED_NODES=seednode:8000 - MY_ADDRESS=seednode:8000 - USE_LOCALHOST_FOR_P2P=true diff --git a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java index e6e1172ac7..8161fe0e1a 100644 --- a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java +++ b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java @@ -176,9 +176,9 @@ public class SeedNodeMain extends ExecutableForAppWithP2p { } private void setupConnectionLossCheck() { - // For dev testing (usually on BTC_REGTEST) we don't want to get the seed shut + // For dev testing (usually on XMR_STAGENET) we don't want to get the seed shut // down as it is normal that the seed is the only actively running node. - if (Config.baseCurrencyNetwork() == BaseCurrencyNetwork.BTC_REGTEST) { + if (Config.baseCurrencyNetwork() == BaseCurrencyNetwork.XMR_STAGENET) { return; }