From c9cf5351c02111b0d99961b4a5d4f9bbec54002d Mon Sep 17 00:00:00 2001 From: woodser Date: Mon, 25 Nov 2024 10:48:27 -0500 Subject: [PATCH] support usdc (#1439) --- .../haveno/asset/tokens/{USDCoin.java => USDCoinERC20.java} | 6 +++--- .../src/main/resources/META-INF/services/haveno.asset.Asset | 3 ++- core/src/main/java/haveno/core/locale/CurrencyUtil.java | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) rename assets/src/main/java/haveno/asset/tokens/{USDCoin.java => USDCoinERC20.java} (85%) diff --git a/assets/src/main/java/haveno/asset/tokens/USDCoin.java b/assets/src/main/java/haveno/asset/tokens/USDCoinERC20.java similarity index 85% rename from assets/src/main/java/haveno/asset/tokens/USDCoin.java rename to assets/src/main/java/haveno/asset/tokens/USDCoinERC20.java index b3e5c121e5..a65c021df9 100644 --- a/assets/src/main/java/haveno/asset/tokens/USDCoin.java +++ b/assets/src/main/java/haveno/asset/tokens/USDCoinERC20.java @@ -19,9 +19,9 @@ package haveno.asset.tokens; import haveno.asset.Erc20Token; -public class USDCoin extends Erc20Token { +public class USDCoinERC20 extends Erc20Token { - public USDCoin() { - super("USD Coin", "USDC"); + public USDCoinERC20() { + super("USD Coin (ERC20)", "USDC-ERC20"); } } diff --git a/assets/src/main/resources/META-INF/services/haveno.asset.Asset b/assets/src/main/resources/META-INF/services/haveno.asset.Asset index 350f6f1501..709b951227 100644 --- a/assets/src/main/resources/META-INF/services/haveno.asset.Asset +++ b/assets/src/main/resources/META-INF/services/haveno.asset.Asset @@ -8,4 +8,5 @@ haveno.asset.coins.Ether haveno.asset.coins.Litecoin haveno.asset.coins.Monero haveno.asset.tokens.TetherUSDERC20 -haveno.asset.tokens.TetherUSDTRC20 \ No newline at end of file +haveno.asset.tokens.TetherUSDTRC20 +haveno.asset.tokens.USDCoinERC20 \ No newline at end of file diff --git a/core/src/main/java/haveno/core/locale/CurrencyUtil.java b/core/src/main/java/haveno/core/locale/CurrencyUtil.java index 93f579f413..bd66667da5 100644 --- a/core/src/main/java/haveno/core/locale/CurrencyUtil.java +++ b/core/src/main/java/haveno/core/locale/CurrencyUtil.java @@ -201,6 +201,7 @@ public class CurrencyUtil { result.add(new CryptoCurrency("ETH", "Ether")); result.add(new CryptoCurrency("LTC", "Litecoin")); result.add(new CryptoCurrency("USDT-ERC20", "Tether USD (ERC20)")); + result.add(new CryptoCurrency("USDC-ERC20", "USD Coin (ERC20)")); result.sort(TradeCurrency::compareTo); return result; } @@ -328,13 +329,14 @@ public class CurrencyUtil { private static boolean isCryptoCurrencyBase(String currencyCode) { if (currencyCode == null) return false; currencyCode = currencyCode.toUpperCase(); - return currencyCode.equals("USDT"); + return currencyCode.equals("USDT") || currencyCode.equals("USDC"); } public static String getCurrencyCodeBase(String currencyCode) { if (currencyCode == null) return null; currencyCode = currencyCode.toUpperCase(); if (currencyCode.contains("USDT")) return "USDT"; + if (currencyCode.contains("USDC")) return "USDC"; return currencyCode; }