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