mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
Change base networks from btc to xmr, e.g. BTC_REGTEST -> XMR_STAGENET (#55)
change base networks from btc to xmr, e.g. BTC_REGTEST -> XMR_STAGENET add xmr seed node files
This commit is contained in:
parent
de5bbf4a85
commit
9903821b18
14
Makefile
14
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 \
|
||||
|
@ -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)
|
||||
|
@ -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')
|
||||
}
|
||||
}
|
||||
|
@ -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."
|
||||
|
@ -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(),
|
||||
|
@ -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";
|
||||
|
@ -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}.
|
||||
* <p>
|
||||
* 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;
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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";
|
||||
|
@ -52,6 +52,8 @@ public class CurrencyFormat {
|
||||
|
||||
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) {
|
||||
return BTC_FORMAT.format(BigDecimal.valueOf(sats).divide(SATOSHI_DIVISOR));
|
||||
|
@ -30,19 +30,19 @@ import static protobuf.OfferPayload.Direction.SELL;
|
||||
class DirectionFormat {
|
||||
|
||||
static int getLongestDirectionColWidth(List<OfferInfo> 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<OfferInfo, String> 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<String, String> mixedCase = (word) -> word.charAt(0) + word.substring(1).toLowerCase();
|
||||
|
@ -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<OfferInfo> getCryptoCurrencyOffers(String direction, String currencyCode) {
|
||||
return getOffers(direction, "BTC").stream()
|
||||
return getOffers(direction, "XMR").stream()
|
||||
.filter(o -> o.getBaseCurrencyCode().equalsIgnoreCase(currencyCode))
|
||||
.collect(toList());
|
||||
}
|
||||
|
@ -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<PaymentAccount> 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);
|
||||
}
|
||||
|
@ -135,13 +135,13 @@ public class TradeFormat {
|
||||
bsqReceiveAddress.apply(tradeInfo, showBsqBuyerAddress));
|
||||
}
|
||||
|
||||
private static final Function<TradeInfo, String> priceHeader = (t) -> // TODO (woodser): update these to XMR
|
||||
t.getOffer().getBaseCurrencyCode().equals("BTC")
|
||||
private static final Function<TradeInfo, String> priceHeader = (t) ->
|
||||
t.getOffer().getBaseCurrencyCode().equals("XMR")
|
||||
? COL_HEADER_PRICE
|
||||
: COL_HEADER_PRICE_OF_ALTCOIN;
|
||||
|
||||
private static final Function<TradeInfo, String> 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<TradeInfo, String> paymentStatusHeaderCurrencyCode = (t) ->
|
||||
t.getOffer().getBaseCurrencyCode().equals("BTC")
|
||||
t.getOffer().getBaseCurrencyCode().equals("XMR")
|
||||
? t.getOffer().getCounterCurrencyCode()
|
||||
: t.getOffer().getBaseCurrencyCode();
|
||||
|
||||
private static final Function<TradeInfo, String> priceFormat = (t) ->
|
||||
t.getOffer().getBaseCurrencyCode().equals("BTC")
|
||||
t.getOffer().getBaseCurrencyCode().equals("XMR")
|
||||
? formatPrice(t.getTradePrice())
|
||||
: formatCryptoCurrencyPrice(t.getOffer().getPrice());
|
||||
|
||||
private static final Function<TradeInfo, String> 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<TradeInfo, Boolean, String> makerTakerMinerTxFeeFormat = (t, isTaker) -> {
|
||||
@ -177,15 +177,15 @@ public class TradeFormat {
|
||||
};
|
||||
|
||||
private static final Function<TradeInfo, String> 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<TradeInfo, Boolean, String> 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;
|
||||
|
@ -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) {
|
||||
|
@ -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() {
|
||||
|
@ -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<Boolean> ignoreLocalBtcNodeOpt =
|
||||
parser.accepts(IGNORE_LOCAL_BTC_NODE,
|
||||
@ -348,7 +348,7 @@ public class Config {
|
||||
.defaultsTo(false);
|
||||
|
||||
ArgumentAcceptingOptionSpec<String> 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<Boolean> 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
|
||||
|
@ -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);
|
||||
|
@ -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" +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
84
core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java
Normal file
84
core/src/main/java/bisq/core/api/model/XmrBalanceInfo.java
Normal file
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -112,6 +112,7 @@ public class DefaultSeedNodeRepository implements SeedNodeRepository {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NodeAddress> 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();
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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<BlockChainExplorer> XMR_MAIN_NET_EXPLORERS = new ArrayList<>(Arrays.asList(
|
||||
new BlockChainExplorer("xmrchain.net", "https://xmrchain.net/tx/", "")
|
||||
));
|
||||
private static final ArrayList<BlockChainExplorer> XMR_TEST_NET_EXPLORERS = new ArrayList<>(Arrays.asList(
|
||||
new BlockChainExplorer("testnet.xmrchain.net", "https://testnet.xmrchain.net/tx/", "")
|
||||
));
|
||||
|
||||
private static final ArrayList<String> 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<BlockChainExplorer> 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;
|
||||
|
@ -18,7 +18,7 @@ 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?
|
||||
*/
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
2
core/src/main/resources/xmr_mainnet.seednodes
Normal file
2
core/src/main/resources/xmr_mainnet.seednodes
Normal file
@ -0,0 +1,2 @@
|
||||
# nodeaddress.onion:port [(@owner,@backup)]
|
||||
placeholder.onion:8000 (@placeholder)
|
3
core/src/main/resources/xmr_stagenet.seednodes
Normal file
3
core/src/main/resources/xmr_stagenet.seednodes
Normal file
@ -0,0 +1,3 @@
|
||||
# nodeaddress.onion:port [(@owner,@backup)]
|
||||
localhost:2002 (@devtest1)
|
||||
localhost:3002 (@devtest2)
|
2
core/src/main/resources/xmr_testnet.seednodes
Normal file
2
core/src/main/resources/xmr_testnet.seednodes
Normal file
@ -0,0 +1,2 @@
|
||||
# nodeaddress.onion:port [(@owner)]
|
||||
placeholder.onion:8001
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
@ -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.
|
||||
|
@ -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")
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user