mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-10 23:50:10 -04:00
fix fiat trades by changing base currency to xmr #7
This commit is contained in:
parent
69ee113dae
commit
01f183b7a7
38 changed files with 106 additions and 102 deletions
|
@ -51,8 +51,8 @@ public class ComponentsDemo extends Application {
|
|||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
|
||||
GlobalSettings.setDefaultTradeCurrency(btc);
|
||||
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
|
||||
GlobalSettings.setDefaultTradeCurrency(xmr);
|
||||
GlobalSettings.setLocale(Locale.US);
|
||||
Res.setup();
|
||||
|
||||
|
@ -85,9 +85,9 @@ public class ComponentsDemo extends Application {
|
|||
|
||||
final Button buttonEnabled = FormBuilder.addButton(gridPane, rowIndex++, "Hello World");
|
||||
buttonEnabled.setOnMouseClicked((click) -> {
|
||||
//bar.enqueue(new JFXSnackbar.SnackbarEvent(Res.get("notification.walletUpdate.msg", "0.345 BTC"), "CLOSE", 3000, true, b -> bar.close()));
|
||||
//bar.enqueue(new JFXSnackbar.SnackbarEvent(Res.get("notification.walletUpdate.msg", "0.345 XMR"), "CLOSE", 3000, true, b -> bar.close()));
|
||||
// new Popup<>().headLine(Res.get("popup.roundedFiatValues.headline"))
|
||||
// .message(Res.get("popup.roundedFiatValues.msg", "BTC"))
|
||||
// .message(Res.get("popup.roundedFiatValues.msg", "XMR"))
|
||||
// .show();
|
||||
// new Notification().headLine(Res.get("notification.tradeCompleted.headline"))
|
||||
// .notification(Res.get("notification.tradeCompleted.msg"))
|
||||
|
|
|
@ -40,7 +40,7 @@ public class MarketsPrintTool {
|
|||
final Collection<FiatCurrency> allSortedFiatCurrencies = CurrencyUtil.getAllSortedFiatCurrencies();
|
||||
final Stream<MarketCurrency> fiatStream = allSortedFiatCurrencies.stream()
|
||||
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BSQ"))
|
||||
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BTC"))
|
||||
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BTC")) // TODO (woodser): update to XMR
|
||||
.map(e -> new MarketCurrency("btc_" + e.getCode().toLowerCase(), e.getName(), e.getCode()))
|
||||
.distinct();
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ public class DaoStateBlockListItemTest {
|
|||
@Before
|
||||
public void setup() {
|
||||
Locale.setDefault(new Locale("en", "US"));
|
||||
Res.setBaseCurrencyCode("BTC");
|
||||
Res.setBaseCurrencyName("Bitcoin");
|
||||
Res.setBaseCurrencyCode("XMR");
|
||||
Res.setBaseCurrencyName("Monero");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -70,7 +70,7 @@ public class TradesChartsViewModelTest {
|
|||
false,
|
||||
0,
|
||||
0,
|
||||
"BTC",
|
||||
"XMR",
|
||||
"EUR",
|
||||
null,
|
||||
null,
|
||||
|
|
|
@ -43,8 +43,8 @@ public class CreateOfferDataModelTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
|
||||
GlobalSettings.setDefaultTradeCurrency(btc);
|
||||
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
|
||||
GlobalSettings.setDefaultTradeCurrency(xmr);
|
||||
Res.setup();
|
||||
|
||||
XmrAddressEntry addressEntry = mock(XmrAddressEntry.class);
|
||||
|
|
|
@ -78,7 +78,7 @@ public class CreateOfferViewModelTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
|
||||
final CryptoCurrency btc = new CryptoCurrency("XMR", "monero");
|
||||
GlobalSettings.setDefaultTradeCurrency(btc);
|
||||
Res.setup();
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class CreateOfferViewModelTest {
|
|||
coinFormatter,
|
||||
tradeStats,
|
||||
null);
|
||||
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin"));
|
||||
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("XMR", "monero"));
|
||||
dataModel.activate();
|
||||
|
||||
model = new CreateOfferViewModel(dataModel,
|
||||
|
|
|
@ -51,7 +51,7 @@ public class OfferBookListItemMaker {
|
|||
with(OfferMaker.direction, lookup.valueOf(direction, OfferPayload.Direction.BUY)),
|
||||
with(OfferMaker.useMarketBasedPrice, lookup.valueOf(useMarketBasedPrice, false)),
|
||||
with(OfferMaker.marketPriceMargin, lookup.valueOf(marketPriceMargin, 0.0)),
|
||||
with(OfferMaker.baseCurrencyCode, lookup.valueOf(baseCurrencyCode, "BTC")),
|
||||
with(OfferMaker.baseCurrencyCode, lookup.valueOf(baseCurrencyCode, "XMR")),
|
||||
with(OfferMaker.counterCurrencyCode, lookup.valueOf(counterCurrencyCode, "USD")),
|
||||
with(OfferMaker.id, lookup.valueOf(id, "1234"))
|
||||
)));
|
||||
|
|
|
@ -594,7 +594,7 @@ public class OfferBookViewModelTest {
|
|||
false,
|
||||
0,
|
||||
0,
|
||||
"BTC",
|
||||
"XMR",
|
||||
tradeCurrencyCode,
|
||||
null,
|
||||
null,
|
||||
|
|
|
@ -61,8 +61,8 @@ public class EditOfferDataModelTest {
|
|||
@Before
|
||||
public void setUp() {
|
||||
|
||||
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
|
||||
GlobalSettings.setDefaultTradeCurrency(btc);
|
||||
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
|
||||
GlobalSettings.setDefaultTradeCurrency(xmr);
|
||||
Res.setup();
|
||||
|
||||
FeeService feeService = mock(FeeService.class);
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.natpryce.makeiteasy.Instantiator;
|
|||
import com.natpryce.makeiteasy.Maker;
|
||||
import com.natpryce.makeiteasy.Property;
|
||||
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.monero;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
||||
|
@ -36,7 +36,7 @@ public class CurrencyListItemMakers {
|
|||
public static final Property<CurrencyListItem, Integer> numberOfTrades = new Property<>();
|
||||
|
||||
public static final Instantiator<CurrencyListItem> CurrencyListItem = lookup ->
|
||||
new CurrencyListItem(lookup.valueOf(tradeCurrency, bitcoin), lookup.valueOf(numberOfTrades, 0));
|
||||
new CurrencyListItem(lookup.valueOf(tradeCurrency, monero), lookup.valueOf(numberOfTrades, 0));
|
||||
|
||||
public static final Maker<CurrencyListItem> bitcoinItem = a(CurrencyListItem);
|
||||
public static final Maker<CurrencyListItem> euroItem = a(CurrencyListItem, with(tradeCurrency, euro));
|
||||
|
|
|
@ -50,7 +50,7 @@ public class OfferMaker {
|
|||
lookup.valueOf(useMarketBasedPrice, false),
|
||||
lookup.valueOf(amount, 100000L),
|
||||
lookup.valueOf(minAmount, 100000L),
|
||||
lookup.valueOf(baseCurrencyCode, "BTC"),
|
||||
lookup.valueOf(baseCurrencyCode, "XMR"),
|
||||
lookup.valueOf(counterCurrencyCode, "USD"),
|
||||
null,
|
||||
null,
|
||||
|
|
|
@ -34,12 +34,12 @@ public class TradeCurrencyMakers {
|
|||
public static final Property<TradeCurrency, String> currencyName = new Property<>();
|
||||
|
||||
public static final Instantiator<bisq.core.locale.CryptoCurrency> CryptoCurrency = lookup ->
|
||||
new CryptoCurrency(lookup.valueOf(currencyCode, "BTC"), lookup.valueOf(currencyName, "Bitcoin"));
|
||||
new CryptoCurrency(lookup.valueOf(currencyCode, "XMR"), lookup.valueOf(currencyName, "Monero"));
|
||||
|
||||
public static final Instantiator<bisq.core.locale.FiatCurrency> FiatCurrency = lookup ->
|
||||
new FiatCurrency(lookup.valueOf(currencyCode, "EUR"));
|
||||
|
||||
public static final CryptoCurrency bitcoin = make(a(CryptoCurrency));
|
||||
public static final CryptoCurrency monero = make(a(CryptoCurrency));
|
||||
public static final FiatCurrency euro = make(a(FiatCurrency));
|
||||
public static final FiatCurrency usd = make(a(FiatCurrency).but(with(currencyCode, "USD")));
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ public class DisplayUtilsTest {
|
|||
@Before
|
||||
public void setUp() {
|
||||
Locale.setDefault(new Locale("en", "US"));
|
||||
Res.setBaseCurrencyCode("BTC");
|
||||
Res.setBaseCurrencyName("Bitcoin");
|
||||
Res.setBaseCurrencyCode("XMR");
|
||||
Res.setBaseCurrencyName("Monero");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -57,9 +57,9 @@ public class DisplayUtilsTest {
|
|||
@Test
|
||||
public void testFormatSameVolume() {
|
||||
Offer offer = mock(Offer.class);
|
||||
Volume btc = Volume.parse("0.10", "BTC");
|
||||
when(offer.getMinVolume()).thenReturn(btc);
|
||||
when(offer.getVolume()).thenReturn(btc);
|
||||
Volume xmr = Volume.parse("0.10", "XMR");
|
||||
when(offer.getMinVolume()).thenReturn(xmr);
|
||||
when(offer.getVolume()).thenReturn(xmr);
|
||||
|
||||
assertEquals("0.10000000", DisplayUtils.formatVolume(offer.getVolume()));
|
||||
}
|
||||
|
@ -67,11 +67,11 @@ public class DisplayUtilsTest {
|
|||
@Test
|
||||
public void testFormatDifferentVolume() {
|
||||
Offer offer = mock(Offer.class);
|
||||
Volume btcMin = Volume.parse("0.10", "BTC");
|
||||
Volume btcMax = Volume.parse("0.25", "BTC");
|
||||
Volume xmrMin = Volume.parse("0.10", "XMR");
|
||||
Volume xmrMax = Volume.parse("0.25", "XMR");
|
||||
when(offer.isRange()).thenReturn(true);
|
||||
when(offer.getMinVolume()).thenReturn(btcMin);
|
||||
when(offer.getVolume()).thenReturn(btcMax);
|
||||
when(offer.getMinVolume()).thenReturn(xmrMin);
|
||||
when(offer.getVolume()).thenReturn(xmrMax);
|
||||
|
||||
assertEquals("0.10000000 - 0.25000000", DisplayUtils.formatVolume(offer, false, 0));
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ import java.util.Map;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.monero;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.make;
|
||||
|
@ -57,14 +57,14 @@ public class GUIUtilTest {
|
|||
public void setup() {
|
||||
Locale.setDefault(new Locale("en", "US"));
|
||||
GlobalSettings.setLocale(new Locale("en", "US"));
|
||||
Res.setBaseCurrencyCode("BTC");
|
||||
Res.setBaseCurrencyName("Bitcoin");
|
||||
Res.setBaseCurrencyCode("XMR");
|
||||
Res.setBaseCurrencyName("Monero");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTradeCurrencyConverter() {
|
||||
Map<String, Integer> offerCounts = new HashMap<>() {{
|
||||
put("BTC", 11);
|
||||
put("XMR", 11);
|
||||
put("EUR", 10);
|
||||
}};
|
||||
StringConverter<TradeCurrency> tradeCurrencyConverter = GUIUtil.getTradeCurrencyConverter(
|
||||
|
@ -73,7 +73,7 @@ public class GUIUtilTest {
|
|||
offerCounts
|
||||
);
|
||||
|
||||
assertEquals("✦ Bitcoin (BTC) - 11 offers", tradeCurrencyConverter.toString(bitcoin));
|
||||
assertEquals("✦ Monero (XMR) - 11 offers", tradeCurrencyConverter.toString(monero));
|
||||
assertEquals("★ Euro (EUR) - 10 offers", tradeCurrencyConverter.toString(euro));
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ public class ImmutableCoinFormatterTest {
|
|||
@Before
|
||||
public void setUp() {
|
||||
Locale.setDefault(new Locale("en", "US"));
|
||||
Res.setBaseCurrencyCode("BTC");
|
||||
Res.setBaseCurrencyName("Bitcoin");
|
||||
Res.setBaseCurrencyCode("XMR");
|
||||
Res.setBaseCurrencyName("Monero");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -14,8 +14,8 @@ public class AccountNrValidatorTest {
|
|||
@Before
|
||||
public void setup() {
|
||||
Locale.setDefault(new Locale("en", "US"));
|
||||
Res.setBaseCurrencyCode("BTC");
|
||||
Res.setBaseCurrencyName("Bitcoin");
|
||||
Res.setBaseCurrencyCode("XMR");
|
||||
Res.setBaseCurrencyName("Monero");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -15,8 +15,8 @@ public class BranchIdValidatorTest {
|
|||
@Before
|
||||
public void setup() {
|
||||
Locale.setDefault(new Locale("en", "US"));
|
||||
Res.setBaseCurrencyCode("BTC");
|
||||
Res.setBaseCurrencyName("Bitcoin");
|
||||
Res.setBaseCurrencyCode("XMR");
|
||||
Res.setBaseCurrencyName("Monero");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -15,8 +15,8 @@ public class NationalAccountIdValidatorTest {
|
|||
@Before
|
||||
public void setup() {
|
||||
Locale.setDefault(new Locale("en", "US"));
|
||||
Res.setBaseCurrencyCode("BTC");
|
||||
Res.setBaseCurrencyName("Bitcoin");
|
||||
Res.setBaseCurrencyCode("XMR");
|
||||
Res.setBaseCurrencyName("Monero");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue