support usdc (#1439)

This commit is contained in:
woodser 2024-11-25 10:48:27 -05:00 committed by GitHub
parent bf452c91da
commit c9cf5351c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 5 deletions

View file

@ -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");
}
}

View file

@ -9,3 +9,4 @@ haveno.asset.coins.Litecoin
haveno.asset.coins.Monero
haveno.asset.tokens.TetherUSDERC20
haveno.asset.tokens.TetherUSDTRC20
haveno.asset.tokens.USDCoinERC20

View file

@ -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;
}