1use std::{
34 collections::HashMap,
35 sync::{LazyLock, Mutex, OnceLock},
36};
37
38use ustr::Ustr;
39
40use crate::{enums::CurrencyType, types::Currency};
41
42static AUD_LOCK: OnceLock<Currency> = OnceLock::new();
46static BRL_LOCK: OnceLock<Currency> = OnceLock::new();
47static CAD_LOCK: OnceLock<Currency> = OnceLock::new();
48static CHF_LOCK: OnceLock<Currency> = OnceLock::new();
49static CNY_LOCK: OnceLock<Currency> = OnceLock::new();
50static CNH_LOCK: OnceLock<Currency> = OnceLock::new();
51static CZK_LOCK: OnceLock<Currency> = OnceLock::new();
52static DKK_LOCK: OnceLock<Currency> = OnceLock::new();
53static EUR_LOCK: OnceLock<Currency> = OnceLock::new();
54static GBP_LOCK: OnceLock<Currency> = OnceLock::new();
55static HKD_LOCK: OnceLock<Currency> = OnceLock::new();
56static HUF_LOCK: OnceLock<Currency> = OnceLock::new();
57static ILS_LOCK: OnceLock<Currency> = OnceLock::new();
58static INR_LOCK: OnceLock<Currency> = OnceLock::new();
59static JPY_LOCK: OnceLock<Currency> = OnceLock::new();
60static KRW_LOCK: OnceLock<Currency> = OnceLock::new();
61static MXN_LOCK: OnceLock<Currency> = OnceLock::new();
62static NOK_LOCK: OnceLock<Currency> = OnceLock::new();
63static NZD_LOCK: OnceLock<Currency> = OnceLock::new();
64static PLN_LOCK: OnceLock<Currency> = OnceLock::new();
65static RUB_LOCK: OnceLock<Currency> = OnceLock::new();
66static SAR_LOCK: OnceLock<Currency> = OnceLock::new();
67static SEK_LOCK: OnceLock<Currency> = OnceLock::new();
68static SGD_LOCK: OnceLock<Currency> = OnceLock::new();
69static THB_LOCK: OnceLock<Currency> = OnceLock::new();
70static TRY_LOCK: OnceLock<Currency> = OnceLock::new();
71static TWD_LOCK: OnceLock<Currency> = OnceLock::new();
72static USD_LOCK: OnceLock<Currency> = OnceLock::new();
73static ZAR_LOCK: OnceLock<Currency> = OnceLock::new();
74
75static XAG_LOCK: OnceLock<Currency> = OnceLock::new();
79static XAU_LOCK: OnceLock<Currency> = OnceLock::new();
80static XPT_LOCK: OnceLock<Currency> = OnceLock::new();
81
82static ONEINCH_LOCK: OnceLock<Currency> = OnceLock::new();
86static AAVE_LOCK: OnceLock<Currency> = OnceLock::new();
87static ACA_LOCK: OnceLock<Currency> = OnceLock::new();
88static ADA_LOCK: OnceLock<Currency> = OnceLock::new();
89static APT_LOCK: OnceLock<Currency> = OnceLock::new();
90static ARB_LOCK: OnceLock<Currency> = OnceLock::new();
91static AVAX_LOCK: OnceLock<Currency> = OnceLock::new();
92static BCH_LOCK: OnceLock<Currency> = OnceLock::new();
93static BIO_LOCK: OnceLock<Currency> = OnceLock::new();
94static BTC_LOCK: OnceLock<Currency> = OnceLock::new();
95static BTTC_LOCK: OnceLock<Currency> = OnceLock::new();
96static BNB_LOCK: OnceLock<Currency> = OnceLock::new();
97static BRZ_LOCK: OnceLock<Currency> = OnceLock::new();
98static BSV_LOCK: OnceLock<Currency> = OnceLock::new();
99static BUSD_LOCK: OnceLock<Currency> = OnceLock::new();
100static CAKE_LOCK: OnceLock<Currency> = OnceLock::new();
101static CRV_LOCK: OnceLock<Currency> = OnceLock::new();
102static DASH_LOCK: OnceLock<Currency> = OnceLock::new();
103static DOGE_LOCK: OnceLock<Currency> = OnceLock::new();
104static DOT_LOCK: OnceLock<Currency> = OnceLock::new();
105static ENA_LOCK: OnceLock<Currency> = OnceLock::new();
106static EOS_LOCK: OnceLock<Currency> = OnceLock::new();
107static ETH_LOCK: OnceLock<Currency> = OnceLock::new();
108static ETHW_LOCK: OnceLock<Currency> = OnceLock::new();
109static FDUSD_LOCK: OnceLock<Currency> = OnceLock::new();
110static GWEI_LOCK: OnceLock<Currency> = OnceLock::new();
111static HYPE_LOCK: OnceLock<Currency> = OnceLock::new();
112static JOE_LOCK: OnceLock<Currency> = OnceLock::new();
113static LINK_LOCK: OnceLock<Currency> = OnceLock::new();
114static LTC_LOCK: OnceLock<Currency> = OnceLock::new();
115static LUNA_LOCK: OnceLock<Currency> = OnceLock::new();
116static MAMUSD_LOCK: OnceLock<Currency> = OnceLock::new();
117static NBT_LOCK: OnceLock<Currency> = OnceLock::new();
118static POL_LOCK: OnceLock<Currency> = OnceLock::new();
119static PROVE_LOCK: OnceLock<Currency> = OnceLock::new();
120static RLUSD_LOCK: OnceLock<Currency> = OnceLock::new();
121static SOL_LOCK: OnceLock<Currency> = OnceLock::new();
122static SUI_LOCK: OnceLock<Currency> = OnceLock::new();
123static TON_LOCK: OnceLock<Currency> = OnceLock::new();
124static TRX_LOCK: OnceLock<Currency> = OnceLock::new();
125static TRYB_LOCK: OnceLock<Currency> = OnceLock::new();
126static TUSD_LOCK: OnceLock<Currency> = OnceLock::new();
127static SHIB_LOCK: OnceLock<Currency> = OnceLock::new();
128static UNI_LOCK: OnceLock<Currency> = OnceLock::new();
129static VTC_LOCK: OnceLock<Currency> = OnceLock::new();
130static WBTC_LOCK: OnceLock<Currency> = OnceLock::new();
131static WSB_LOCK: OnceLock<Currency> = OnceLock::new();
132static XBT_LOCK: OnceLock<Currency> = OnceLock::new();
133static XEC_LOCK: OnceLock<Currency> = OnceLock::new();
134static XLM_LOCK: OnceLock<Currency> = OnceLock::new();
135static XMR_LOCK: OnceLock<Currency> = OnceLock::new();
136static XRP_LOCK: OnceLock<Currency> = OnceLock::new();
137static XTZ_LOCK: OnceLock<Currency> = OnceLock::new();
138static USDC_LOCK: OnceLock<Currency> = OnceLock::new();
139static USDC_POS_LOCK: OnceLock<Currency> = OnceLock::new();
140static USDP_LOCK: OnceLock<Currency> = OnceLock::new();
141static USDT_LOCK: OnceLock<Currency> = OnceLock::new();
142static ZEC_LOCK: OnceLock<Currency> = OnceLock::new();
143
144impl Currency {
145 #[allow(non_snake_case)]
149 #[must_use]
150 pub fn AUD() -> Self {
151 *AUD_LOCK.get_or_init(|| Self {
152 code: Ustr::from("AUD"),
153 precision: 2,
154 iso4217: 36,
155 name: Ustr::from("Australian dollar"),
156 currency_type: CurrencyType::Fiat,
157 })
158 }
159 #[allow(non_snake_case)]
160 #[must_use]
161 pub fn BRL() -> Self {
162 *BRL_LOCK.get_or_init(|| Self {
163 code: Ustr::from("BRL"),
164 precision: 2,
165 iso4217: 986,
166 name: Ustr::from("Brazilian real"),
167 currency_type: CurrencyType::Fiat,
168 })
169 }
170
171 #[allow(non_snake_case)]
172 #[must_use]
173 pub fn CAD() -> Self {
174 *CAD_LOCK.get_or_init(|| Self {
175 code: Ustr::from("CAD"),
176 precision: 2,
177 iso4217: 124,
178 name: Ustr::from("Canadian dollar"),
179 currency_type: CurrencyType::Fiat,
180 })
181 }
182
183 #[allow(non_snake_case)]
184 #[must_use]
185 pub fn CHF() -> Self {
186 *CHF_LOCK.get_or_init(|| Self {
187 code: Ustr::from("CHF"),
188 precision: 2,
189 iso4217: 756,
190 name: Ustr::from("Swiss franc"),
191 currency_type: CurrencyType::Fiat,
192 })
193 }
194
195 #[allow(non_snake_case)]
196 #[must_use]
197 pub fn CNY() -> Self {
198 *CNY_LOCK.get_or_init(|| Self {
199 code: Ustr::from("CNY"),
200 precision: 2,
201 iso4217: 156,
202 name: Ustr::from("Chinese yuan"),
203 currency_type: CurrencyType::Fiat,
204 })
205 }
206
207 #[allow(non_snake_case)]
208 #[must_use]
209 pub fn CNH() -> Self {
210 *CNH_LOCK.get_or_init(|| Self {
211 code: Ustr::from("CNH"),
212 precision: 2,
213 iso4217: 0,
214 name: Ustr::from("Chinese yuan (offshore)"),
215 currency_type: CurrencyType::Fiat,
216 })
217 }
218
219 #[allow(non_snake_case)]
220 #[must_use]
221 pub fn CZK() -> Self {
222 *CZK_LOCK.get_or_init(|| Self {
223 code: Ustr::from("CZK"),
224 precision: 2,
225 iso4217: 203,
226 name: Ustr::from("Czech koruna"),
227 currency_type: CurrencyType::Fiat,
228 })
229 }
230
231 #[allow(non_snake_case)]
232 #[must_use]
233 pub fn DKK() -> Self {
234 *DKK_LOCK.get_or_init(|| Self {
235 code: Ustr::from("DKK"),
236 precision: 2,
237 iso4217: 208,
238 name: Ustr::from("Danish krone"),
239 currency_type: CurrencyType::Fiat,
240 })
241 }
242
243 #[allow(non_snake_case)]
244 #[must_use]
245 pub fn EUR() -> Self {
246 *EUR_LOCK.get_or_init(|| Self {
247 code: Ustr::from("EUR"),
248 precision: 2,
249 iso4217: 978,
250 name: Ustr::from("Euro"),
251 currency_type: CurrencyType::Fiat,
252 })
253 }
254
255 #[allow(non_snake_case)]
256 #[must_use]
257 pub fn GBP() -> Self {
258 *GBP_LOCK.get_or_init(|| Self {
259 code: Ustr::from("GBP"),
260 precision: 2,
261 iso4217: 826,
262 name: Ustr::from("British Pound"),
263 currency_type: CurrencyType::Fiat,
264 })
265 }
266
267 #[allow(non_snake_case)]
268 #[must_use]
269 pub fn HKD() -> Self {
270 *HKD_LOCK.get_or_init(|| Self {
271 code: Ustr::from("HKD"),
272 precision: 2,
273 iso4217: 344,
274 name: Ustr::from("Hong Kong dollar"),
275 currency_type: CurrencyType::Fiat,
276 })
277 }
278
279 #[allow(non_snake_case)]
280 #[must_use]
281 pub fn HUF() -> Self {
282 *HUF_LOCK.get_or_init(|| Self {
283 code: Ustr::from("HUF"),
284 precision: 2,
285 iso4217: 348,
286 name: Ustr::from("Hungarian forint"),
287 currency_type: CurrencyType::Fiat,
288 })
289 }
290
291 #[allow(non_snake_case)]
292 #[must_use]
293 pub fn ILS() -> Self {
294 *ILS_LOCK.get_or_init(|| Self {
295 code: Ustr::from("ILS"),
296 precision: 2,
297 iso4217: 376,
298 name: Ustr::from("Israeli new shekel"),
299 currency_type: CurrencyType::Fiat,
300 })
301 }
302
303 #[allow(non_snake_case)]
304 #[must_use]
305 pub fn INR() -> Self {
306 *INR_LOCK.get_or_init(|| Self {
307 code: Ustr::from("INR"),
308 precision: 2,
309 iso4217: 356,
310 name: Ustr::from("Indian rupee"),
311 currency_type: CurrencyType::Fiat,
312 })
313 }
314
315 #[allow(non_snake_case)]
316 #[must_use]
317 pub fn JPY() -> Self {
318 *JPY_LOCK.get_or_init(|| Self {
319 code: Ustr::from("JPY"),
320 precision: 0,
321 iso4217: 392,
322 name: Ustr::from("Japanese yen"),
323 currency_type: CurrencyType::Fiat,
324 })
325 }
326 #[allow(non_snake_case)]
327 #[must_use]
328 pub fn KRW() -> Self {
329 *KRW_LOCK.get_or_init(|| Self {
330 code: Ustr::from("KRW"),
331 precision: 0,
332 iso4217: 410,
333 name: Ustr::from("South Korean won"),
334 currency_type: CurrencyType::Fiat,
335 })
336 }
337
338 #[allow(non_snake_case)]
339 #[must_use]
340 pub fn MXN() -> Self {
341 *MXN_LOCK.get_or_init(|| Self {
342 code: Ustr::from("MXN"),
343 precision: 2,
344 iso4217: 484,
345 name: Ustr::from("Mexican peso"),
346 currency_type: CurrencyType::Fiat,
347 })
348 }
349
350 #[allow(non_snake_case)]
351 #[must_use]
352 pub fn NOK() -> Self {
353 *NOK_LOCK.get_or_init(|| Self {
354 code: Ustr::from("NOK"),
355 precision: 2,
356 iso4217: 578,
357 name: Ustr::from("Norwegian krone"),
358 currency_type: CurrencyType::Fiat,
359 })
360 }
361
362 #[allow(non_snake_case)]
363 #[must_use]
364 pub fn NZD() -> Self {
365 *NZD_LOCK.get_or_init(|| Self {
366 code: Ustr::from("NZD"),
367 precision: 2,
368 iso4217: 554,
369 name: Ustr::from("New Zealand dollar"),
370 currency_type: CurrencyType::Fiat,
371 })
372 }
373
374 #[allow(non_snake_case)]
375 #[must_use]
376 pub fn PLN() -> Self {
377 *PLN_LOCK.get_or_init(|| Self {
378 code: Ustr::from("PLN"),
379 precision: 2,
380 iso4217: 985,
381 name: Ustr::from("Polish złoty"),
382 currency_type: CurrencyType::Fiat,
383 })
384 }
385
386 #[allow(non_snake_case)]
387 #[must_use]
388 pub fn RUB() -> Self {
389 *RUB_LOCK.get_or_init(|| Self {
390 code: Ustr::from("RUB"),
391 precision: 2,
392 iso4217: 643,
393 name: Ustr::from("Russian ruble"),
394 currency_type: CurrencyType::Fiat,
395 })
396 }
397
398 #[allow(non_snake_case)]
399 #[must_use]
400 pub fn SAR() -> Self {
401 *SAR_LOCK.get_or_init(|| Self {
402 code: Ustr::from("SAR"),
403 precision: 2,
404 iso4217: 682,
405 name: Ustr::from("Saudi riyal"),
406 currency_type: CurrencyType::Fiat,
407 })
408 }
409
410 #[allow(non_snake_case)]
411 #[must_use]
412 pub fn SEK() -> Self {
413 *SEK_LOCK.get_or_init(|| Self {
414 code: Ustr::from("SEK"),
415 precision: 2,
416 iso4217: 752,
417 name: Ustr::from("Swedish krona"),
418 currency_type: CurrencyType::Fiat,
419 })
420 }
421
422 #[allow(non_snake_case)]
423 #[must_use]
424 pub fn SGD() -> Self {
425 *SGD_LOCK.get_or_init(|| Self {
426 code: Ustr::from("SGD"),
427 precision: 2,
428 iso4217: 702,
429 name: Ustr::from("Singapore dollar"),
430 currency_type: CurrencyType::Fiat,
431 })
432 }
433
434 #[allow(non_snake_case)]
435 #[must_use]
436 pub fn THB() -> Self {
437 *THB_LOCK.get_or_init(|| Self {
438 code: Ustr::from("THB"),
439 precision: 2,
440 iso4217: 764,
441 name: Ustr::from("Thai baht"),
442 currency_type: CurrencyType::Fiat,
443 })
444 }
445
446 #[allow(non_snake_case)]
447 #[must_use]
448 pub fn TRY() -> Self {
449 *TRY_LOCK.get_or_init(|| Self {
450 code: Ustr::from("TRY"),
451 precision: 2,
452 iso4217: 949,
453 name: Ustr::from("Turkish lira"),
454 currency_type: CurrencyType::Fiat,
455 })
456 }
457
458 #[allow(non_snake_case)]
459 #[must_use]
460 pub fn TWD() -> Self {
461 *TWD_LOCK.get_or_init(|| Self {
462 code: Ustr::from("TWD"),
463 precision: 2,
464 iso4217: 901,
465 name: Ustr::from("New Taiwan dollar"),
466 currency_type: CurrencyType::Fiat,
467 })
468 }
469
470 #[allow(non_snake_case)]
471 #[must_use]
472 pub fn USD() -> Self {
473 *USD_LOCK.get_or_init(|| Self {
474 code: Ustr::from("USD"),
475 precision: 2,
476 iso4217: 840,
477 name: Ustr::from("United States dollar"),
478 currency_type: CurrencyType::Fiat,
479 })
480 }
481 #[allow(non_snake_case)]
482 #[must_use]
483 pub fn ZAR() -> Self {
484 *ZAR_LOCK.get_or_init(|| Self {
485 code: Ustr::from("ZAR"),
486 precision: 2,
487 iso4217: 710,
488 name: Ustr::from("South African rand"),
489 currency_type: CurrencyType::Fiat,
490 })
491 }
492
493 #[allow(non_snake_case)]
494 #[must_use]
495 pub fn XAG() -> Self {
496 *XAG_LOCK.get_or_init(|| Self {
497 code: Ustr::from("XAG"),
498 precision: 2,
499 iso4217: 961,
500 name: Ustr::from("Silver (one troy ounce)"),
501 currency_type: CurrencyType::CommodityBacked,
502 })
503 }
504
505 #[allow(non_snake_case)]
506 #[must_use]
507 pub fn XAU() -> Self {
508 *XAU_LOCK.get_or_init(|| Self {
509 code: Ustr::from("XAU"),
510 precision: 2,
511 iso4217: 959,
512 name: Ustr::from("Gold (one troy ounce)"),
513 currency_type: CurrencyType::CommodityBacked,
514 })
515 }
516
517 #[allow(non_snake_case)]
518 #[must_use]
519 pub fn XPT() -> Self {
520 *XPT_LOCK.get_or_init(|| Self {
521 code: Ustr::from("XPT"),
522 precision: 2,
523 iso4217: 962,
524 name: Ustr::from("Platinum (one troy ounce)"),
525 currency_type: CurrencyType::CommodityBacked,
526 })
527 }
528
529 #[allow(non_snake_case)]
533 #[must_use]
534 pub fn ONEINCH() -> Self {
535 *ONEINCH_LOCK.get_or_init(|| Self {
536 code: Ustr::from("1INCH"),
537 precision: 8,
538 iso4217: 0,
539 name: Ustr::from("1inch Network"),
540 currency_type: CurrencyType::Crypto,
541 })
542 }
543
544 #[allow(non_snake_case)]
545 #[must_use]
546 pub fn AAVE() -> Self {
547 *AAVE_LOCK.get_or_init(|| Self {
548 code: Ustr::from("AAVE"),
549 precision: 8,
550 iso4217: 0,
551 name: Ustr::from("Aave"),
552 currency_type: CurrencyType::Crypto,
553 })
554 }
555
556 #[allow(non_snake_case)]
557 #[must_use]
558 pub fn ACA() -> Self {
559 *ACA_LOCK.get_or_init(|| Self {
560 code: Ustr::from("ACA"),
561 precision: 8,
562 iso4217: 0,
563 name: Ustr::from("Acala Token"),
564 currency_type: CurrencyType::Crypto,
565 })
566 }
567
568 #[allow(non_snake_case)]
569 #[must_use]
570 pub fn ADA() -> Self {
571 *ADA_LOCK.get_or_init(|| Self {
572 code: Ustr::from("ADA"),
573 precision: 6,
574 iso4217: 0,
575 name: Ustr::from("Cardano"),
576 currency_type: CurrencyType::Crypto,
577 })
578 }
579
580 #[allow(non_snake_case)]
581 #[must_use]
582 pub fn APT() -> Self {
583 *APT_LOCK.get_or_init(|| Self {
584 code: Ustr::from("APT"),
585 precision: 8,
586 iso4217: 0,
587 name: Ustr::from("Aptos"),
588 currency_type: CurrencyType::Crypto,
589 })
590 }
591
592 #[allow(non_snake_case)]
593 #[must_use]
594 pub fn ARB() -> Self {
595 *ARB_LOCK.get_or_init(|| Self {
596 code: Ustr::from("ARB"),
597 precision: 8,
598 iso4217: 0,
599 name: Ustr::from("Arbitrum"),
600 currency_type: CurrencyType::Crypto,
601 })
602 }
603
604 #[allow(non_snake_case)]
605 #[must_use]
606 pub fn AVAX() -> Self {
607 *AVAX_LOCK.get_or_init(|| Self {
608 code: Ustr::from("AVAX"),
609 precision: 8,
610 iso4217: 0,
611 name: Ustr::from("Avalanche"),
612 currency_type: CurrencyType::Crypto,
613 })
614 }
615
616 #[allow(non_snake_case)]
617 #[must_use]
618 pub fn BCH() -> Self {
619 *BCH_LOCK.get_or_init(|| Self {
620 code: Ustr::from("BCH"),
621 precision: 8,
622 iso4217: 0,
623 name: Ustr::from("Bitcoin Cash"),
624 currency_type: CurrencyType::Crypto,
625 })
626 }
627
628 #[allow(non_snake_case)]
629 #[must_use]
630 pub fn BIO() -> Self {
631 *BIO_LOCK.get_or_init(|| Self {
632 code: Ustr::from("BIO"),
633 precision: 8,
634 iso4217: 0,
635 name: Ustr::from("BioPassport"),
636 currency_type: CurrencyType::Crypto,
637 })
638 }
639
640 #[allow(non_snake_case)]
641 #[must_use]
642 pub fn BTC() -> Self {
643 *BTC_LOCK.get_or_init(|| Self {
644 code: Ustr::from("BTC"),
645 precision: 8,
646 iso4217: 0,
647 name: Ustr::from("Bitcoin"),
648 currency_type: CurrencyType::Crypto,
649 })
650 }
651
652 #[allow(non_snake_case)]
653 #[must_use]
654 pub fn BTTC() -> Self {
655 *BTTC_LOCK.get_or_init(|| Self {
656 code: Ustr::from("BTTC"),
657 precision: 8,
658 iso4217: 0,
659 name: Ustr::from("BitTorrent"),
660 currency_type: CurrencyType::Crypto,
661 })
662 }
663
664 #[allow(non_snake_case)]
665 #[must_use]
666 pub fn BNB() -> Self {
667 *BNB_LOCK.get_or_init(|| Self {
668 code: Ustr::from("BNB"),
669 precision: 8,
670 iso4217: 0,
671 name: Ustr::from("Binance Coin"),
672 currency_type: CurrencyType::Crypto,
673 })
674 }
675
676 #[allow(non_snake_case)]
677 #[must_use]
678 pub fn BRZ() -> Self {
679 *BRZ_LOCK.get_or_init(|| Self {
680 code: Ustr::from("BRZ"),
681 precision: 8,
682 iso4217: 0,
683 name: Ustr::from("Brazilian Digital Token"),
684 currency_type: CurrencyType::Crypto,
685 })
686 }
687
688 #[allow(non_snake_case)]
689 #[must_use]
690 pub fn BSV() -> Self {
691 *BSV_LOCK.get_or_init(|| Self {
692 code: Ustr::from("BSV"),
693 precision: 8,
694 iso4217: 0,
695 name: Ustr::from("Bitcoin SV"),
696 currency_type: CurrencyType::Crypto,
697 })
698 }
699
700 #[allow(non_snake_case)]
701 #[must_use]
702 pub fn BUSD() -> Self {
703 *BUSD_LOCK.get_or_init(|| Self {
704 code: Ustr::from("BUSD"),
705 precision: 8,
706 iso4217: 0,
707 name: Ustr::from("Binance USD"),
708 currency_type: CurrencyType::Crypto,
709 })
710 }
711
712 #[allow(non_snake_case)]
713 #[must_use]
714 pub fn CAKE() -> Self {
715 *CAKE_LOCK.get_or_init(|| Self {
716 code: Ustr::from("CAKE"),
717 precision: 8,
718 iso4217: 0,
719 name: Ustr::from("PancakeSwap"),
720 currency_type: CurrencyType::Crypto,
721 })
722 }
723
724 #[allow(non_snake_case)]
725 #[must_use]
726 pub fn CRV() -> Self {
727 *CRV_LOCK.get_or_init(|| Self {
728 code: Ustr::from("CRV"),
729 precision: 8,
730 iso4217: 0,
731 name: Ustr::from("Curve DAO Token"),
732 currency_type: CurrencyType::Crypto,
733 })
734 }
735
736 #[allow(non_snake_case)]
737 #[must_use]
738 pub fn DASH() -> Self {
739 *DASH_LOCK.get_or_init(|| Self {
740 code: Ustr::from("DASH"),
741 precision: 8,
742 iso4217: 0,
743 name: Ustr::from("Dash"),
744 currency_type: CurrencyType::Crypto,
745 })
746 }
747
748 #[allow(non_snake_case)]
749 #[must_use]
750 pub fn DOT() -> Self {
751 *DOT_LOCK.get_or_init(|| Self {
752 code: Ustr::from("DOT"),
753 precision: 8,
754 iso4217: 0,
755 name: Ustr::from("Polkadot"),
756 currency_type: CurrencyType::Crypto,
757 })
758 }
759
760 #[allow(non_snake_case)]
761 #[must_use]
762 pub fn DOGE() -> Self {
763 *DOGE_LOCK.get_or_init(|| Self {
764 code: Ustr::from("DOGE"),
765 precision: 8,
766 iso4217: 0,
767 name: Ustr::from("Dogecoin"),
768 currency_type: CurrencyType::Crypto,
769 })
770 }
771
772 #[allow(non_snake_case)]
773 #[must_use]
774 pub fn ENA() -> Self {
775 *ENA_LOCK.get_or_init(|| Self {
776 code: Ustr::from("ENA"),
777 precision: 8,
778 iso4217: 0,
779 name: Ustr::from("Ethena"),
780 currency_type: CurrencyType::Crypto,
781 })
782 }
783
784 #[allow(non_snake_case)]
785 #[must_use]
786 pub fn EOS() -> Self {
787 *EOS_LOCK.get_or_init(|| Self {
788 code: Ustr::from("EOS"),
789 precision: 8,
790 iso4217: 0,
791 name: Ustr::from("EOS"),
792 currency_type: CurrencyType::Crypto,
793 })
794 }
795
796 #[allow(non_snake_case)]
797 #[must_use]
798 pub fn ETH() -> Self {
799 *ETH_LOCK.get_or_init(|| Self {
800 code: Ustr::from("ETH"),
801 precision: 8,
802 iso4217: 0,
803 name: Ustr::from("Ethereum"),
804 currency_type: CurrencyType::Crypto,
805 })
806 }
807
808 #[allow(non_snake_case)]
809 #[must_use]
810 pub fn ETHW() -> Self {
811 *ETHW_LOCK.get_or_init(|| Self {
812 code: Ustr::from("ETHW"),
813 precision: 8,
814 iso4217: 0,
815 name: Ustr::from("EthereumPoW"),
816 currency_type: CurrencyType::Crypto,
817 })
818 }
819
820 #[allow(non_snake_case)]
821 #[must_use]
822 pub fn FDUSD() -> Self {
823 *FDUSD_LOCK.get_or_init(|| Self {
824 code: Ustr::from("FDUSD"),
825 precision: 8,
826 iso4217: 0,
827 name: Ustr::from("First Digital USD"),
828 currency_type: CurrencyType::Crypto,
829 })
830 }
831
832 #[allow(non_snake_case)]
833 #[must_use]
834 pub fn GWEI() -> Self {
835 *GWEI_LOCK.get_or_init(|| Self {
836 code: Ustr::from("GWEI"),
837 precision: 8,
838 iso4217: 0,
839 name: Ustr::from("Gwei"),
840 currency_type: CurrencyType::Crypto,
841 })
842 }
843
844 #[allow(non_snake_case)]
845 #[must_use]
846 pub fn HYPE() -> Self {
847 *HYPE_LOCK.get_or_init(|| Self {
848 code: Ustr::from("HYPE"),
849 precision: 8,
850 iso4217: 0,
851 name: Ustr::from("Hyperliquid"),
852 currency_type: CurrencyType::Crypto,
853 })
854 }
855
856 #[allow(non_snake_case)]
857 #[must_use]
858 pub fn JOE() -> Self {
859 *JOE_LOCK.get_or_init(|| Self {
860 code: Ustr::from("JOE"),
861 precision: 8,
862 iso4217: 0,
863 name: Ustr::from("JOE"),
864 currency_type: CurrencyType::Crypto,
865 })
866 }
867
868 #[allow(non_snake_case)]
869 #[must_use]
870 pub fn LINK() -> Self {
871 *LINK_LOCK.get_or_init(|| Self {
872 code: Ustr::from("LINK"),
873 precision: 8,
874 iso4217: 0,
875 name: Ustr::from("Chainlink"),
876 currency_type: CurrencyType::Crypto,
877 })
878 }
879
880 #[allow(non_snake_case)]
881 #[must_use]
882 pub fn LTC() -> Self {
883 *LTC_LOCK.get_or_init(|| Self {
884 code: Ustr::from("LTC"),
885 precision: 8,
886 iso4217: 0,
887 name: Ustr::from("Litecoin"),
888 currency_type: CurrencyType::Crypto,
889 })
890 }
891
892 #[allow(non_snake_case)]
893 #[must_use]
894 pub fn LUNA() -> Self {
895 *LUNA_LOCK.get_or_init(|| Self {
896 code: Ustr::from("LUNA"),
897 precision: 8,
898 iso4217: 0,
899 name: Ustr::from("Terra"),
900 currency_type: CurrencyType::Crypto,
901 })
902 }
903
904 #[allow(non_snake_case)]
905 #[must_use]
906 pub fn MAMUSD() -> Self {
907 *MAMUSD_LOCK.get_or_init(|| Self {
908 code: Ustr::from("MAMUSD"),
909 precision: 8,
910 iso4217: 0,
911 name: Ustr::from("MAMUSD"),
912 currency_type: CurrencyType::Crypto,
913 })
914 }
915
916 #[allow(non_snake_case)]
917 #[must_use]
918 pub fn NBT() -> Self {
919 *NBT_LOCK.get_or_init(|| Self {
920 code: Ustr::from("NBT"),
921 precision: 8,
922 iso4217: 0,
923 name: Ustr::from("NanoByte Token"),
924 currency_type: CurrencyType::Crypto,
925 })
926 }
927
928 #[allow(non_snake_case)]
929 #[must_use]
930 pub fn POL() -> Self {
931 *POL_LOCK.get_or_init(|| Self {
932 code: Ustr::from("POL"),
933 precision: 8,
934 iso4217: 0,
935 name: Ustr::from("Polygon"),
936 currency_type: CurrencyType::Crypto,
937 })
938 }
939
940 #[allow(non_snake_case)]
941 #[must_use]
942 pub fn PROVE() -> Self {
943 *PROVE_LOCK.get_or_init(|| Self {
944 code: Ustr::from("PROVE"),
945 precision: 8,
946 iso4217: 0,
947 name: Ustr::from("Prove AI"),
948 currency_type: CurrencyType::Crypto,
949 })
950 }
951
952 #[allow(non_snake_case)]
953 #[must_use]
954 pub fn RLUSD() -> Self {
955 *RLUSD_LOCK.get_or_init(|| Self {
956 code: Ustr::from("RLUSD"),
957 precision: 8,
958 iso4217: 0,
959 name: Ustr::from("Ripple USD"),
960 currency_type: CurrencyType::Crypto,
961 })
962 }
963
964 #[allow(non_snake_case)]
965 #[must_use]
966 pub fn SOL() -> Self {
967 *SOL_LOCK.get_or_init(|| Self {
968 code: Ustr::from("SOL"),
969 precision: 8,
970 iso4217: 0,
971 name: Ustr::from("Solana"),
972 currency_type: CurrencyType::Crypto,
973 })
974 }
975
976 #[allow(non_snake_case)]
977 #[must_use]
978 pub fn SHIB() -> Self {
979 *SHIB_LOCK.get_or_init(|| Self {
980 code: Ustr::from("SHIB"),
981 precision: 8,
982 iso4217: 0,
983 name: Ustr::from("Shiba Inu"),
984 currency_type: CurrencyType::Crypto,
985 })
986 }
987
988 #[allow(non_snake_case)]
989 #[must_use]
990 pub fn SUI() -> Self {
991 *SUI_LOCK.get_or_init(|| Self {
992 code: Ustr::from("SUI"),
993 precision: 8,
994 iso4217: 0,
995 name: Ustr::from("Sui"),
996 currency_type: CurrencyType::Crypto,
997 })
998 }
999
1000 #[allow(non_snake_case)]
1001 #[must_use]
1002 pub fn TON() -> Self {
1003 *TON_LOCK.get_or_init(|| Self {
1004 code: Ustr::from("TON"),
1005 precision: 8,
1006 iso4217: 0,
1007 name: Ustr::from("Toncoin"),
1008 currency_type: CurrencyType::Crypto,
1009 })
1010 }
1011
1012 #[allow(non_snake_case)]
1013 #[must_use]
1014 pub fn TRX() -> Self {
1015 *TRX_LOCK.get_or_init(|| Self {
1016 code: Ustr::from("TRX"),
1017 precision: 8,
1018 iso4217: 0,
1019 name: Ustr::from("TRON"),
1020 currency_type: CurrencyType::Crypto,
1021 })
1022 }
1023
1024 #[allow(non_snake_case)]
1025 #[must_use]
1026 pub fn TRYB() -> Self {
1027 *TRYB_LOCK.get_or_init(|| Self {
1028 code: Ustr::from("TRYB"),
1029 precision: 8,
1030 iso4217: 0,
1031 name: Ustr::from("BiLira"),
1032 currency_type: CurrencyType::Crypto,
1033 })
1034 }
1035
1036 #[allow(non_snake_case)]
1037 #[must_use]
1038 pub fn TUSD() -> Self {
1039 *TUSD_LOCK.get_or_init(|| Self {
1040 code: Ustr::from("TUSD"),
1041 precision: 8,
1042 iso4217: 0,
1043 name: Ustr::from("TrueUSD"),
1044 currency_type: CurrencyType::Crypto,
1045 })
1046 }
1047
1048 #[allow(non_snake_case)]
1049 #[must_use]
1050 pub fn UNI() -> Self {
1051 *UNI_LOCK.get_or_init(|| Self {
1052 code: Ustr::from("UNI"),
1053 precision: 8,
1054 iso4217: 0,
1055 name: Ustr::from("Uniswap"),
1056 currency_type: CurrencyType::Crypto,
1057 })
1058 }
1059
1060 #[allow(non_snake_case)]
1061 #[must_use]
1062 pub fn VTC() -> Self {
1063 *VTC_LOCK.get_or_init(|| Self {
1064 code: Ustr::from("VTC"),
1065 precision: 8,
1066 iso4217: 0,
1067 name: Ustr::from("Vertcoin"),
1068 currency_type: CurrencyType::Crypto,
1069 })
1070 }
1071
1072 #[allow(non_snake_case)]
1073 #[must_use]
1074 pub fn WBTC() -> Self {
1075 *WBTC_LOCK.get_or_init(|| Self {
1076 code: Ustr::from("WBTC"),
1077 precision: 8,
1078 iso4217: 0,
1079 name: Ustr::from("Wrapped Bitcoin"),
1080 currency_type: CurrencyType::Crypto,
1081 })
1082 }
1083
1084 #[allow(non_snake_case)]
1085 #[must_use]
1086 pub fn WSB() -> Self {
1087 *WSB_LOCK.get_or_init(|| Self {
1088 code: Ustr::from("WSB"),
1089 precision: 8,
1090 iso4217: 0,
1091 name: Ustr::from("WallStreetBets DApp"),
1092 currency_type: CurrencyType::Crypto,
1093 })
1094 }
1095
1096 #[allow(non_snake_case)]
1097 #[must_use]
1098 pub fn XBT() -> Self {
1099 *XBT_LOCK.get_or_init(|| Self {
1100 code: Ustr::from("XBT"),
1101 precision: 8,
1102 iso4217: 0,
1103 name: Ustr::from("Bitcoin"),
1104 currency_type: CurrencyType::Crypto,
1105 })
1106 }
1107
1108 #[allow(non_snake_case)]
1109 #[must_use]
1110 pub fn XEC() -> Self {
1111 *XEC_LOCK.get_or_init(|| Self {
1112 code: Ustr::from("XEC"),
1113 precision: 8,
1114 iso4217: 0,
1115 name: Ustr::from("eCash"),
1116 currency_type: CurrencyType::Crypto,
1117 })
1118 }
1119
1120 #[allow(non_snake_case)]
1121 #[must_use]
1122 pub fn XLM() -> Self {
1123 *XLM_LOCK.get_or_init(|| Self {
1124 code: Ustr::from("XLM"),
1125 precision: 8,
1126 iso4217: 0,
1127 name: Ustr::from("Stellar Lumen"),
1128 currency_type: CurrencyType::Crypto,
1129 })
1130 }
1131
1132 #[allow(non_snake_case)]
1133 #[must_use]
1134 pub fn XMR() -> Self {
1135 *XMR_LOCK.get_or_init(|| Self {
1136 code: Ustr::from("XMR"),
1137 precision: 8,
1138 iso4217: 0,
1139 name: Ustr::from("Monero"),
1140 currency_type: CurrencyType::Crypto,
1141 })
1142 }
1143
1144 #[allow(non_snake_case)]
1145 #[must_use]
1146 pub fn USDT() -> Self {
1147 *USDT_LOCK.get_or_init(|| Self {
1148 code: Ustr::from("USDT"),
1149 precision: 8,
1150 iso4217: 0,
1151 name: Ustr::from("Tether"),
1152 currency_type: CurrencyType::Crypto,
1153 })
1154 }
1155
1156 #[allow(non_snake_case)]
1157 #[must_use]
1158 pub fn XRP() -> Self {
1159 *XRP_LOCK.get_or_init(|| Self {
1160 code: Ustr::from("XRP"),
1161 precision: 6,
1162 iso4217: 0,
1163 name: Ustr::from("XRP"),
1164 currency_type: CurrencyType::Crypto,
1165 })
1166 }
1167
1168 #[allow(non_snake_case)]
1169 #[must_use]
1170 pub fn XTZ() -> Self {
1171 *XTZ_LOCK.get_or_init(|| Self {
1172 code: Ustr::from("XTZ"),
1173 precision: 6,
1174 iso4217: 0,
1175 name: Ustr::from("Tezos"),
1176 currency_type: CurrencyType::Crypto,
1177 })
1178 }
1179
1180 #[must_use]
1181 #[allow(non_snake_case)]
1182 pub fn USDC() -> Self {
1183 *USDC_LOCK.get_or_init(|| Self {
1184 code: Ustr::from("USDC"),
1185 precision: 8,
1186 iso4217: 0,
1187 name: Ustr::from("USD Coin"),
1188 currency_type: CurrencyType::Crypto,
1189 })
1190 }
1191
1192 #[must_use]
1193 #[allow(non_snake_case)]
1194 pub fn USDC_POS() -> Self {
1195 *USDC_POS_LOCK.get_or_init(|| Self {
1196 code: Ustr::from("USDC.e"),
1197 precision: 6,
1198 iso4217: 0,
1199 name: Ustr::from("USD Coin (PoS)"),
1200 currency_type: CurrencyType::Crypto,
1201 })
1202 }
1203
1204 #[allow(non_snake_case)]
1205 #[must_use]
1206 pub fn USDP() -> Self {
1207 *USDP_LOCK.get_or_init(|| Self {
1208 code: Ustr::from("USDP"),
1209 precision: 8,
1210 iso4217: 0,
1211 name: Ustr::from("Pax Dollar"),
1212 currency_type: CurrencyType::Crypto,
1213 })
1214 }
1215
1216 #[allow(non_snake_case)]
1217 #[must_use]
1218 pub fn ZEC() -> Self {
1219 *ZEC_LOCK.get_or_init(|| Self {
1220 code: Ustr::from("ZEC"),
1221 precision: 8,
1222 iso4217: 0,
1223 name: Ustr::from("Zcash"),
1224 currency_type: CurrencyType::Crypto,
1225 })
1226 }
1227}
1228
1229pub static CURRENCY_MAP: LazyLock<Mutex<HashMap<String, Currency>>> = LazyLock::new(|| {
1231 let mut map = HashMap::new();
1232 map.insert(Currency::AUD().code.to_string(), Currency::AUD());
1236 map.insert(Currency::BRL().code.to_string(), Currency::BRL());
1237 map.insert(Currency::CAD().code.to_string(), Currency::CAD());
1238 map.insert(Currency::CHF().code.to_string(), Currency::CHF());
1239 map.insert(Currency::CNY().code.to_string(), Currency::CNY());
1240 map.insert(Currency::CNH().code.to_string(), Currency::CNH());
1241 map.insert(Currency::CZK().code.to_string(), Currency::CZK());
1242 map.insert(Currency::DKK().code.to_string(), Currency::DKK());
1243 map.insert(Currency::EUR().code.to_string(), Currency::EUR());
1244 map.insert(Currency::GBP().code.to_string(), Currency::GBP());
1245 map.insert(Currency::HKD().code.to_string(), Currency::HKD());
1246 map.insert(Currency::HUF().code.to_string(), Currency::HUF());
1247 map.insert(Currency::ILS().code.to_string(), Currency::ILS());
1248 map.insert(Currency::INR().code.to_string(), Currency::INR());
1249 map.insert(Currency::JPY().code.to_string(), Currency::JPY());
1250 map.insert(Currency::KRW().code.to_string(), Currency::KRW());
1251 map.insert(Currency::MXN().code.to_string(), Currency::MXN());
1252 map.insert(Currency::NOK().code.to_string(), Currency::NOK());
1253 map.insert(Currency::NZD().code.to_string(), Currency::NZD());
1254 map.insert(Currency::PLN().code.to_string(), Currency::PLN());
1255 map.insert(Currency::RUB().code.to_string(), Currency::RUB());
1256 map.insert(Currency::SAR().code.to_string(), Currency::SAR());
1257 map.insert(Currency::SEK().code.to_string(), Currency::SEK());
1258 map.insert(Currency::SGD().code.to_string(), Currency::SGD());
1259 map.insert(Currency::THB().code.to_string(), Currency::THB());
1260 map.insert(Currency::TRY().code.to_string(), Currency::TRY());
1261 map.insert(Currency::USD().code.to_string(), Currency::USD());
1262 map.insert(Currency::XAG().code.to_string(), Currency::XAG());
1263 map.insert(Currency::XAU().code.to_string(), Currency::XAU());
1264 map.insert(Currency::XPT().code.to_string(), Currency::XPT());
1265 map.insert(Currency::ZAR().code.to_string(), Currency::ZAR());
1266 map.insert(Currency::AAVE().code.to_string(), Currency::AAVE());
1270 map.insert(Currency::ACA().code.to_string(), Currency::ACA());
1271 map.insert(Currency::ADA().code.to_string(), Currency::ADA());
1272 map.insert(Currency::APT().code.to_string(), Currency::APT());
1273 map.insert(Currency::ARB().code.to_string(), Currency::ARB());
1274 map.insert(Currency::AVAX().code.to_string(), Currency::AVAX());
1275 map.insert(Currency::BCH().code.to_string(), Currency::BCH());
1276 map.insert(Currency::BIO().code.to_string(), Currency::BIO());
1277 map.insert(Currency::BTC().code.to_string(), Currency::BTC());
1278 map.insert(Currency::BTTC().code.to_string(), Currency::BTTC());
1279 map.insert(Currency::BNB().code.to_string(), Currency::BNB());
1280 map.insert(Currency::BRZ().code.to_string(), Currency::BRZ());
1281 map.insert(Currency::BSV().code.to_string(), Currency::BSV());
1282 map.insert(Currency::BUSD().code.to_string(), Currency::BUSD());
1283 map.insert(Currency::CRV().code.to_string(), Currency::CRV());
1284 map.insert(Currency::DASH().code.to_string(), Currency::DASH());
1285 map.insert(Currency::DOGE().code.to_string(), Currency::DOGE());
1286 map.insert(Currency::DOT().code.to_string(), Currency::DOT());
1287 map.insert(Currency::ENA().code.to_string(), Currency::ENA());
1288 map.insert(Currency::EOS().code.to_string(), Currency::EOS());
1289 map.insert(Currency::ETH().code.to_string(), Currency::ETH());
1290 map.insert(Currency::ETHW().code.to_string(), Currency::ETHW());
1291 map.insert(Currency::FDUSD().code.to_string(), Currency::FDUSD());
1292 map.insert(Currency::GWEI().code.to_string(), Currency::GWEI());
1293 map.insert(Currency::HYPE().code.to_string(), Currency::HYPE());
1294 map.insert(Currency::JOE().code.to_string(), Currency::JOE());
1295 map.insert(Currency::LINK().code.to_string(), Currency::LINK());
1296 map.insert(Currency::LTC().code.to_string(), Currency::LTC());
1297 map.insert(Currency::LUNA().code.to_string(), Currency::LUNA());
1298 map.insert(Currency::MAMUSD().code.to_string(), Currency::MAMUSD());
1299 map.insert(Currency::NBT().code.to_string(), Currency::NBT());
1300 map.insert(Currency::POL().code.to_string(), Currency::POL());
1301 map.insert(Currency::PROVE().code.to_string(), Currency::PROVE());
1302 map.insert(Currency::RLUSD().code.to_string(), Currency::RLUSD());
1303 map.insert(Currency::SOL().code.to_string(), Currency::SOL());
1304 map.insert(Currency::SUI().code.to_string(), Currency::SUI());
1305 map.insert(Currency::TON().code.to_string(), Currency::TON());
1306 map.insert(Currency::TRX().code.to_string(), Currency::TRX());
1307 map.insert(Currency::TRYB().code.to_string(), Currency::TRYB());
1308 map.insert(Currency::TUSD().code.to_string(), Currency::TUSD());
1309 map.insert(Currency::UNI().code.to_string(), Currency::UNI());
1310 map.insert(Currency::VTC().code.to_string(), Currency::VTC());
1311 map.insert(Currency::WBTC().code.to_string(), Currency::WBTC());
1312 map.insert(Currency::WSB().code.to_string(), Currency::WSB());
1313 map.insert(Currency::XBT().code.to_string(), Currency::XBT());
1314 map.insert(Currency::XEC().code.to_string(), Currency::XEC());
1315 map.insert(Currency::XLM().code.to_string(), Currency::XLM());
1316 map.insert(Currency::XMR().code.to_string(), Currency::XMR());
1317 map.insert(Currency::XRP().code.to_string(), Currency::XRP());
1318 map.insert(Currency::XTZ().code.to_string(), Currency::XTZ());
1319 map.insert(Currency::USDC().code.to_string(), Currency::USDC());
1320 map.insert(Currency::USDC_POS().code.to_string(), Currency::USDC_POS());
1321 map.insert(Currency::USDP().code.to_string(), Currency::USDP());
1322 map.insert(Currency::USDT().code.to_string(), Currency::USDT());
1323 map.insert(Currency::ZEC().code.to_string(), Currency::ZEC());
1324 Mutex::new(map)
1325});