Normalize remaining tags/networks

Also rename Cake `C-CHAIN` tag to `AVAXC`, which will result in a clearer situation for user if we later add USDT (AVAXC), for example.

Justin Ehrenhofer committed Feb 9, 2023 at 10:52 UTC 6711d9530f7ed89dd9e767b948470f5b2b620c72
2 files changed +13 -4
cw_core/lib/crypto_currency.dart
+1 -1
@@ -117,7 +117,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> {
117 static const xusd = CryptoCurrency(title: 'XUSD', tag: 'XHV', raw: 29, name: 'xusd');
118
119 static const ape = CryptoCurrency(title: 'APE', tag: 'ETH', fullName: 'ApeCoin', raw: 30, name: 'ape', iconPath: 'assets/images/ape_icon.png');
120 - static const avaxc = CryptoCurrency(title: 'AVAX', tag: 'C-CHAIN', raw: 31, name: 'avaxc', iconPath: 'assets/images/avaxc_icon.png');
120 + static const avaxc = CryptoCurrency(title: 'AVAX', tag: 'AVAXC', raw: 31, name: 'avaxc', iconPath: 'assets/images/avaxc_icon.png');
121 static const btt = CryptoCurrency(title: 'BTT', tag: 'ETH', fullName: 'BitTorrent', raw: 32, name: 'btt', iconPath: 'assets/images/btt_icon.png');
122 static const bttc = CryptoCurrency(title: 'BTTC', tag: 'TRX', fullName: 'BitTorrent-NEW', raw: 33, name: 'bttc', iconPath: 'assets/images/bttbsc_icon.png');
123 static const doge = CryptoCurrency(title: 'DOGE', fullName: 'Dogecoin', raw: 34, name: 'doge', iconPath: 'assets/images/doge_icon.png');
lib/exchange/trocador/trocador_exchange_provider.dart
+12 -3
@@ -26,8 +26,6 @@ class TrocadorExchangeProvider extends ExchangeProvider {
26 CryptoCurrency.stx,
27 CryptoCurrency.bttc,
28 CryptoCurrency.zaddr,
29 - CryptoCurrency.usdcpoly,
30 - CryptoCurrency.maticpoly,
29 ];
30
31 static List<ExchangePair> _supportedPairs() {
@@ -252,7 +250,18 @@ class TrocadorExchangeProvider extends ExchangeProvider {
250 String get title => 'Trocador';
251
252 String _networkFor(CryptoCurrency currency) {
255 - return currency.tag != null ? _normalizeTag(currency.tag!) : 'Mainnet';
253 + switch (currency) {
254 + case CryptoCurrency.eth:
255 + return 'ERC20';
256 + case CryptoCurrency.maticpoly:
257 + return 'Mainnet';
258 + case CryptoCurrency.usdcpoly:
259 + return 'MATIC';
260 + case CryptoCurrency.zec:
261 + return 'Mainnet';
262 + default:
263 + return currency.tag != null ? _normalizeTag(currency.tag!) : 'Mainnet';
264 + }
265 }
266
267 String _normalizeTag(String tag) {