feat(exchange): add TRX and USDT-on-Tron to Chainflip (#3341)
Chainflip added Tron support with asset ids trx.tron and usdt.tron. Enable both for swaps in the Chainflip provider. Tron needs explicit handling because Chainflip's network slug is 'tron', while Cake uses the 'TRX' tag (and null for native TRX), so the generic title.tag normalization can't produce the right ids: - _supported: add trx, usdttrc20 - _normalizeCurrency: map trx -> trx.tron, usdttrc20 -> usdt.tron - _normalizeNetworkName: TRON -> Tron (status lookup in findTradeById) - _toCurrency: reverse-map trx.tron/usdt.tron for trade resolution Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
David Cumps committed
Jul 9, 2026 at 15:55 UTC
c9e0ac85d4c3e78428d650c2dc73f32aee02c3a7
1 file changed
+10
lib/exchange/provider/chainflip_exchange_provider.dart
+10
@@ -29,6 +29,8 @@ class ChainflipExchangeProvider extends ExchangeProvider {
29
CryptoCurrency.arbEth,
30
CryptoCurrency.usdcArb,
31
CryptoCurrency.usdtArb,
32
+ CryptoCurrency.trx,
33
+ CryptoCurrency.usdttrc20,
34
];
35
36
static const _baseURL = 'chainflip-broker.io';
@@ -315,6 +317,11 @@ class ChainflipExchangeProvider extends ExchangeProvider {
317
}
318
319
String _normalizeCurrency(CryptoCurrency currency) {
320
+ // Chainflip uses 'tron' as the network slug, but Cake uses tag 'TRX' (and null
321
+ // for native TRX), so these can't go through the generic title.tag logic below.
322
+ if (currency == CryptoCurrency.trx) return 'trx.tron';
323
+ if (currency == CryptoCurrency.usdttrc20) return 'usdt.tron';
324
+
325
final tag = currency.tag?.toLowerCase();
326
final title = currency.title.toLowerCase();
327
@@ -330,6 +337,7 @@ class ChainflipExchangeProvider extends ExchangeProvider {
337
'ETHEREUM' => 'Ethereum',
338
'ARBITRUM' => 'Arbitrum',
339
'SOLANA' => 'Solana',
340
+ 'TRON' => 'Tron',
341
_ => name
342
};
343
@@ -350,6 +358,8 @@ class ChainflipExchangeProvider extends ExchangeProvider {
358
'eth.arb' => CryptoCurrency.arbEth,
359
'usdc.arb' => CryptoCurrency.usdcArb,
360
'usdt.arb' => CryptoCurrency.usdtArb,
361
+ 'trx.tron' => CryptoCurrency.trx,
362
+ 'usdt.tron' => CryptoCurrency.usdttrc20,
363
_ => null
364
};
365