1use std::{
19 collections::HashMap,
20 sync::{Mutex, OnceLock},
21};
22
23use once_cell::sync::Lazy;
24use ustr::Ustr;
25
26use crate::{enums::CurrencyType, types::Currency};
27
28static AUD_LOCK: OnceLock<Currency> = OnceLock::new();
32static BRL_LOCK: OnceLock<Currency> = OnceLock::new();
33static CAD_LOCK: OnceLock<Currency> = OnceLock::new();
34static CHF_LOCK: OnceLock<Currency> = OnceLock::new();
35static CNY_LOCK: OnceLock<Currency> = OnceLock::new();
36static CNH_LOCK: OnceLock<Currency> = OnceLock::new();
37static CZK_LOCK: OnceLock<Currency> = OnceLock::new();
38static DKK_LOCK: OnceLock<Currency> = OnceLock::new();
39static EUR_LOCK: OnceLock<Currency> = OnceLock::new();
40static GBP_LOCK: OnceLock<Currency> = OnceLock::new();
41static HKD_LOCK: OnceLock<Currency> = OnceLock::new();
42static HUF_LOCK: OnceLock<Currency> = OnceLock::new();
43static ILS_LOCK: OnceLock<Currency> = OnceLock::new();
44static INR_LOCK: OnceLock<Currency> = OnceLock::new();
45static JPY_LOCK: OnceLock<Currency> = OnceLock::new();
46static KRW_LOCK: OnceLock<Currency> = OnceLock::new();
47static MXN_LOCK: OnceLock<Currency> = OnceLock::new();
48static NOK_LOCK: OnceLock<Currency> = OnceLock::new();
49static NZD_LOCK: OnceLock<Currency> = OnceLock::new();
50static PLN_LOCK: OnceLock<Currency> = OnceLock::new();
51static RUB_LOCK: OnceLock<Currency> = OnceLock::new();
52static SAR_LOCK: OnceLock<Currency> = OnceLock::new();
53static SEK_LOCK: OnceLock<Currency> = OnceLock::new();
54static SGD_LOCK: OnceLock<Currency> = OnceLock::new();
55static THB_LOCK: OnceLock<Currency> = OnceLock::new();
56static TRY_LOCK: OnceLock<Currency> = OnceLock::new();
57static TWD_LOCK: OnceLock<Currency> = OnceLock::new();
58static USD_LOCK: OnceLock<Currency> = OnceLock::new();
59static ZAR_LOCK: OnceLock<Currency> = OnceLock::new();
60
61static XAG_LOCK: OnceLock<Currency> = OnceLock::new();
65static XAU_LOCK: OnceLock<Currency> = OnceLock::new();
66static XPT_LOCK: OnceLock<Currency> = OnceLock::new();
67
68static ONEINCH_LOCK: OnceLock<Currency> = OnceLock::new();
72static AAVE_LOCK: OnceLock<Currency> = OnceLock::new();
73static ACA_LOCK: OnceLock<Currency> = OnceLock::new();
74static ADA_LOCK: OnceLock<Currency> = OnceLock::new();
75static AVAX_LOCK: OnceLock<Currency> = OnceLock::new();
76static BCH_LOCK: OnceLock<Currency> = OnceLock::new();
77static BTC_LOCK: OnceLock<Currency> = OnceLock::new();
78static BTTC_LOCK: OnceLock<Currency> = OnceLock::new();
79static BNB_LOCK: OnceLock<Currency> = OnceLock::new();
80static BRZ_LOCK: OnceLock<Currency> = OnceLock::new();
81static BSV_LOCK: OnceLock<Currency> = OnceLock::new();
82static BUSD_LOCK: OnceLock<Currency> = OnceLock::new();
83static CAKE_LOCK: OnceLock<Currency> = OnceLock::new();
84static DASH_LOCK: OnceLock<Currency> = OnceLock::new();
85static DOGE_LOCK: OnceLock<Currency> = OnceLock::new();
86static DOT_LOCK: OnceLock<Currency> = OnceLock::new();
87static EOS_LOCK: OnceLock<Currency> = OnceLock::new();
88static ETH_LOCK: OnceLock<Currency> = OnceLock::new();
89static ETHW_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)]
500 #[must_use]
501 pub fn ONEINCH() -> Self {
502 *ONEINCH_LOCK.get_or_init(|| Self {
503 code: Ustr::from("1INCH"),
504 precision: 8,
505 iso4217: 0,
506 name: Ustr::from("1inch Network"),
507 currency_type: CurrencyType::Crypto,
508 })
509 }
510
511 #[allow(non_snake_case)]
512 #[must_use]
513 pub fn AAVE() -> Self {
514 *AAVE_LOCK.get_or_init(|| Self {
515 code: Ustr::from("AAVE"),
516 precision: 8,
517 iso4217: 0,
518 name: Ustr::from("Aave"),
519 currency_type: CurrencyType::Crypto,
520 })
521 }
522
523 #[allow(non_snake_case)]
524 #[must_use]
525 pub fn ACA() -> Self {
526 *ACA_LOCK.get_or_init(|| Self {
527 code: Ustr::from("ACA"),
528 precision: 8,
529 iso4217: 0,
530 name: Ustr::from("Acala Token"),
531 currency_type: CurrencyType::Crypto,
532 })
533 }
534
535 #[allow(non_snake_case)]
536 #[must_use]
537 pub fn ADA() -> Self {
538 *ADA_LOCK.get_or_init(|| Self {
539 code: Ustr::from("ADA"),
540 precision: 6,
541 iso4217: 0,
542 name: Ustr::from("Cardano"),
543 currency_type: CurrencyType::Crypto,
544 })
545 }
546
547 #[allow(non_snake_case)]
548 #[must_use]
549 pub fn AVAX() -> Self {
550 *AVAX_LOCK.get_or_init(|| Self {
551 code: Ustr::from("AVAX"),
552 precision: 8,
553 iso4217: 0,
554 name: Ustr::from("Avalanche"),
555 currency_type: CurrencyType::Crypto,
556 })
557 }
558
559 #[allow(non_snake_case)]
560 #[must_use]
561 pub fn BCH() -> Self {
562 *BCH_LOCK.get_or_init(|| Self {
563 code: Ustr::from("BCH"),
564 precision: 8,
565 iso4217: 0,
566 name: Ustr::from("Bitcoin Cash"),
567 currency_type: CurrencyType::Crypto,
568 })
569 }
570
571 #[allow(non_snake_case)]
572 #[must_use]
573 pub fn BTC() -> Self {
574 *BTC_LOCK.get_or_init(|| Self {
575 code: Ustr::from("BTC"),
576 precision: 8,
577 iso4217: 0,
578 name: Ustr::from("Bitcoin"),
579 currency_type: CurrencyType::Crypto,
580 })
581 }
582
583 #[allow(non_snake_case)]
584 #[must_use]
585 pub fn BTTC() -> Self {
586 *BTTC_LOCK.get_or_init(|| Self {
587 code: Ustr::from("BTTC"),
588 precision: 8,
589 iso4217: 0,
590 name: Ustr::from("BitTorrent"),
591 currency_type: CurrencyType::Crypto,
592 })
593 }
594
595 #[allow(non_snake_case)]
596 #[must_use]
597 pub fn BNB() -> Self {
598 *BNB_LOCK.get_or_init(|| Self {
599 code: Ustr::from("BNB"),
600 precision: 8,
601 iso4217: 0,
602 name: Ustr::from("Binance Coin"),
603 currency_type: CurrencyType::Crypto,
604 })
605 }
606
607 #[allow(non_snake_case)]
608 #[must_use]
609 pub fn BRZ() -> Self {
610 *BRZ_LOCK.get_or_init(|| Self {
611 code: Ustr::from("BRZ"),
612 precision: 6,
613 iso4217: 0,
614 name: Ustr::from("Brazilian Digital Token"),
615 currency_type: CurrencyType::Crypto,
616 })
617 }
618
619 #[allow(non_snake_case)]
620 #[must_use]
621 pub fn BSV() -> Self {
622 *BSV_LOCK.get_or_init(|| Self {
623 code: Ustr::from("BSV"),
624 precision: 8,
625 iso4217: 0,
626 name: Ustr::from("Bitcoin SV"),
627 currency_type: CurrencyType::Crypto,
628 })
629 }
630
631 #[allow(non_snake_case)]
632 #[must_use]
633 pub fn BUSD() -> Self {
634 *BUSD_LOCK.get_or_init(|| Self {
635 code: Ustr::from("BUSD"),
636 precision: 8,
637 iso4217: 0,
638 name: Ustr::from("Binance USD"),
639 currency_type: CurrencyType::Crypto,
640 })
641 }
642
643 #[allow(non_snake_case)]
644 #[must_use]
645 pub fn CAKE() -> Self {
646 *CAKE_LOCK.get_or_init(|| Self {
647 code: Ustr::from("CAKE"),
648 precision: 8,
649 iso4217: 0,
650 name: Ustr::from("PancakeSwap"),
651 currency_type: CurrencyType::Crypto,
652 })
653 }
654
655 #[allow(non_snake_case)]
656 #[must_use]
657 pub fn DASH() -> Self {
658 *DASH_LOCK.get_or_init(|| Self {
659 code: Ustr::from("DASH"),
660 precision: 8,
661 iso4217: 0,
662 name: Ustr::from("Dash"),
663 currency_type: CurrencyType::Crypto,
664 })
665 }
666
667 #[allow(non_snake_case)]
668 #[must_use]
669 pub fn DOT() -> Self {
670 *DOT_LOCK.get_or_init(|| Self {
671 code: Ustr::from("DOT"),
672 precision: 8,
673 iso4217: 0,
674 name: Ustr::from("Polkadot"),
675 currency_type: CurrencyType::Crypto,
676 })
677 }
678
679 #[allow(non_snake_case)]
680 #[must_use]
681 pub fn DOGE() -> Self {
682 *DOGE_LOCK.get_or_init(|| Self {
683 code: Ustr::from("DOGE"),
684 precision: 8,
685 iso4217: 0,
686 name: Ustr::from("Dogecoin"),
687 currency_type: CurrencyType::Crypto,
688 })
689 }
690
691 #[allow(non_snake_case)]
692 #[must_use]
693 pub fn EOS() -> Self {
694 *EOS_LOCK.get_or_init(|| Self {
695 code: Ustr::from("EOS"),
696 precision: 8,
697 iso4217: 0,
698 name: Ustr::from("EOS"),
699 currency_type: CurrencyType::Crypto,
700 })
701 }
702
703 #[allow(non_snake_case)]
704 #[must_use]
705 pub fn ETH() -> Self {
706 *ETH_LOCK.get_or_init(|| Self {
707 code: Ustr::from("ETH"),
708 precision: 8,
709 iso4217: 0,
710 name: Ustr::from("Ethereum"),
711 currency_type: CurrencyType::Crypto,
712 })
713 }
714
715 #[allow(non_snake_case)]
716 #[must_use]
717 pub fn ETHW() -> Self {
718 *ETHW_LOCK.get_or_init(|| Self {
719 code: Ustr::from("ETHW"),
720 precision: 8,
721 iso4217: 0,
722 name: Ustr::from("EthereumPoW"),
723 currency_type: CurrencyType::Crypto,
724 })
725 }
726
727 #[allow(non_snake_case)]
728 #[must_use]
729 pub fn JOE() -> Self {
730 *JOE_LOCK.get_or_init(|| Self {
731 code: Ustr::from("JOE"),
732 precision: 8,
733 iso4217: 0,
734 name: Ustr::from("JOE"),
735 currency_type: CurrencyType::Crypto,
736 })
737 }
738
739 #[allow(non_snake_case)]
740 #[must_use]
741 pub fn LINK() -> Self {
742 *LINK_LOCK.get_or_init(|| Self {
743 code: Ustr::from("LINK"),
744 precision: 8,
745 iso4217: 0,
746 name: Ustr::from("Chainlink"),
747 currency_type: CurrencyType::Crypto,
748 })
749 }
750
751 #[allow(non_snake_case)]
752 #[must_use]
753 pub fn LTC() -> Self {
754 *LTC_LOCK.get_or_init(|| Self {
755 code: Ustr::from("LTC"),
756 precision: 8,
757 iso4217: 0,
758 name: Ustr::from("Litecoin"),
759 currency_type: CurrencyType::Crypto,
760 })
761 }
762
763 #[allow(non_snake_case)]
764 #[must_use]
765 pub fn LUNA() -> Self {
766 *LUNA_LOCK.get_or_init(|| Self {
767 code: Ustr::from("LUNA"),
768 precision: 8,
769 iso4217: 0,
770 name: Ustr::from("Terra"),
771 currency_type: CurrencyType::Crypto,
772 })
773 }
774
775 #[allow(non_snake_case)]
776 #[must_use]
777 pub fn NBT() -> Self {
778 *NBT_LOCK.get_or_init(|| Self {
779 code: Ustr::from("NBT"),
780 precision: 8,
781 iso4217: 0,
782 name: Ustr::from("NanoByte Token"),
783 currency_type: CurrencyType::Crypto,
784 })
785 }
786
787 #[allow(non_snake_case)]
788 #[must_use]
789 pub fn SOL() -> Self {
790 *SOL_LOCK.get_or_init(|| Self {
791 code: Ustr::from("SOL"),
792 precision: 8,
793 iso4217: 0,
794 name: Ustr::from("Solana"),
795 currency_type: CurrencyType::Crypto,
796 })
797 }
798
799 #[allow(non_snake_case)]
800 #[must_use]
801 pub fn SHIB() -> Self {
802 *SHIB_LOCK.get_or_init(|| Self {
803 code: Ustr::from("SHIB"),
804 precision: 8,
805 iso4217: 0,
806 name: Ustr::from("Shiba Inu"),
807 currency_type: CurrencyType::Crypto,
808 })
809 }
810
811 #[allow(non_snake_case)]
812 #[must_use]
813 pub fn TRX() -> Self {
814 *TRX_LOCK.get_or_init(|| Self {
815 code: Ustr::from("TRX"),
816 precision: 8,
817 iso4217: 0,
818 name: Ustr::from("TRON"),
819 currency_type: CurrencyType::Crypto,
820 })
821 }
822
823 #[allow(non_snake_case)]
824 #[must_use]
825 pub fn TRYB() -> Self {
826 *TRYB_LOCK.get_or_init(|| Self {
827 code: Ustr::from("TRYB"),
828 precision: 8,
829 iso4217: 0,
830 name: Ustr::from("BiLibra"),
831 currency_type: CurrencyType::Crypto,
832 })
833 }
834
835 #[allow(non_snake_case)]
836 #[must_use]
837 pub fn TUSD() -> Self {
838 *TUSD_LOCK.get_or_init(|| Self {
839 code: Ustr::from("TUSD"),
840 precision: 8,
841 iso4217: 0,
842 name: Ustr::from("TrueUSD"),
843 currency_type: CurrencyType::Crypto,
844 })
845 }
846
847 #[allow(non_snake_case)]
848 #[must_use]
849 pub fn VTC() -> Self {
850 *VTC_LOCK.get_or_init(|| Self {
851 code: Ustr::from("VTC"),
852 precision: 8,
853 iso4217: 0,
854 name: Ustr::from("Vertcoin"),
855 currency_type: CurrencyType::Crypto,
856 })
857 }
858
859 #[allow(non_snake_case)]
860 #[must_use]
861 pub fn WSB() -> Self {
862 *WSB_LOCK.get_or_init(|| Self {
863 code: Ustr::from("WSB"),
864 precision: 8,
865 iso4217: 0,
866 name: Ustr::from("WallStreetBets DApp"),
867 currency_type: CurrencyType::Crypto,
868 })
869 }
870
871 #[allow(non_snake_case)]
872 #[must_use]
873 pub fn XBT() -> Self {
874 *XBT_LOCK.get_or_init(|| Self {
875 code: Ustr::from("XBT"),
876 precision: 8,
877 iso4217: 0,
878 name: Ustr::from("Bitcoin"),
879 currency_type: CurrencyType::Crypto,
880 })
881 }
882
883 #[allow(non_snake_case)]
884 #[must_use]
885 pub fn XEC() -> Self {
886 *XEC_LOCK.get_or_init(|| Self {
887 code: Ustr::from("XEC"),
888 precision: 8,
889 iso4217: 0,
890 name: Ustr::from("eCash"),
891 currency_type: CurrencyType::Crypto,
892 })
893 }
894
895 #[allow(non_snake_case)]
896 #[must_use]
897 pub fn XLM() -> Self {
898 *XLM_LOCK.get_or_init(|| Self {
899 code: Ustr::from("XLM"),
900 precision: 8,
901 iso4217: 0,
902 name: Ustr::from("Stellar Lumen"),
903 currency_type: CurrencyType::Crypto,
904 })
905 }
906
907 #[allow(non_snake_case)]
908 #[must_use]
909 pub fn XMR() -> Self {
910 *XMR_LOCK.get_or_init(|| Self {
911 code: Ustr::from("XMR"),
912 precision: 8,
913 iso4217: 0,
914 name: Ustr::from("Monero"),
915 currency_type: CurrencyType::Crypto,
916 })
917 }
918
919 #[allow(non_snake_case)]
920 #[must_use]
921 pub fn USDT() -> Self {
922 *USDT_LOCK.get_or_init(|| Self {
923 code: Ustr::from("USDT"),
924 precision: 8,
925 iso4217: 0,
926 name: Ustr::from("Tether"),
927 currency_type: CurrencyType::Crypto,
928 })
929 }
930
931 #[allow(non_snake_case)]
932 #[must_use]
933 pub fn XRP() -> Self {
934 *XRP_LOCK.get_or_init(|| Self {
935 code: Ustr::from("XRP"),
936 precision: 6,
937 iso4217: 0,
938 name: Ustr::from("XRP"),
939 currency_type: CurrencyType::Crypto,
940 })
941 }
942
943 #[allow(non_snake_case)]
944 #[must_use]
945 pub fn XTZ() -> Self {
946 *XTZ_LOCK.get_or_init(|| Self {
947 code: Ustr::from("XTZ"),
948 precision: 6,
949 iso4217: 0,
950 name: Ustr::from("Tezos"),
951 currency_type: CurrencyType::Crypto,
952 })
953 }
954
955 #[must_use]
956 #[allow(non_snake_case)]
957 pub fn USDC() -> Self {
958 *USDC_LOCK.get_or_init(|| Self {
959 code: Ustr::from("USDC"),
960 precision: 8,
961 iso4217: 0,
962 name: Ustr::from("USD Coin"),
963 currency_type: CurrencyType::Crypto,
964 })
965 }
966
967 #[must_use]
968 #[allow(non_snake_case)]
969 pub fn USDC_POS() -> Self {
970 *USDC_POS_LOCK.get_or_init(|| Self {
971 code: Ustr::from("USDC.e"),
972 precision: 6,
973 iso4217: 0,
974 name: Ustr::from("USD Coin (PoS)"),
975 currency_type: CurrencyType::Crypto,
976 })
977 }
978
979 #[allow(non_snake_case)]
980 #[must_use]
981 pub fn USDP() -> Self {
982 *USDP_LOCK.get_or_init(|| Self {
983 code: Ustr::from("USDP"),
984 precision: 4,
985 iso4217: 0,
986 name: Ustr::from("Pax Dollar"),
987 currency_type: CurrencyType::Crypto,
988 })
989 }
990
991 #[allow(non_snake_case)]
992 #[must_use]
993 pub fn ZEC() -> Self {
994 *ZEC_LOCK.get_or_init(|| Self {
995 code: Ustr::from("ZEC"),
996 precision: 8,
997 iso4217: 0,
998 name: Ustr::from("Zcash"),
999 currency_type: CurrencyType::Crypto,
1000 })
1001 }
1002}
1003
1004pub static CURRENCY_MAP: Lazy<Mutex<HashMap<String, Currency>>> = Lazy::new(|| {
1006 let mut map = HashMap::new();
1007 map.insert(Currency::AUD().code.to_string(), Currency::AUD());
1011 map.insert(Currency::BRL().code.to_string(), Currency::BRL());
1012 map.insert(Currency::CAD().code.to_string(), Currency::CAD());
1013 map.insert(Currency::CHF().code.to_string(), Currency::CHF());
1014 map.insert(Currency::CNY().code.to_string(), Currency::CNY());
1015 map.insert(Currency::CNH().code.to_string(), Currency::CNH());
1016 map.insert(Currency::CZK().code.to_string(), Currency::CZK());
1017 map.insert(Currency::DKK().code.to_string(), Currency::DKK());
1018 map.insert(Currency::EUR().code.to_string(), Currency::EUR());
1019 map.insert(Currency::GBP().code.to_string(), Currency::GBP());
1020 map.insert(Currency::HKD().code.to_string(), Currency::HKD());
1021 map.insert(Currency::HUF().code.to_string(), Currency::HUF());
1022 map.insert(Currency::ILS().code.to_string(), Currency::ILS());
1023 map.insert(Currency::INR().code.to_string(), Currency::INR());
1024 map.insert(Currency::JPY().code.to_string(), Currency::JPY());
1025 map.insert(Currency::KRW().code.to_string(), Currency::KRW());
1026 map.insert(Currency::MXN().code.to_string(), Currency::MXN());
1027 map.insert(Currency::NOK().code.to_string(), Currency::NOK());
1028 map.insert(Currency::NZD().code.to_string(), Currency::NZD());
1029 map.insert(Currency::PLN().code.to_string(), Currency::PLN());
1030 map.insert(Currency::RUB().code.to_string(), Currency::RUB());
1031 map.insert(Currency::SAR().code.to_string(), Currency::SAR());
1032 map.insert(Currency::SEK().code.to_string(), Currency::SEK());
1033 map.insert(Currency::SGD().code.to_string(), Currency::SGD());
1034 map.insert(Currency::THB().code.to_string(), Currency::THB());
1035 map.insert(Currency::TRY().code.to_string(), Currency::TRY());
1036 map.insert(Currency::USD().code.to_string(), Currency::USD());
1037 map.insert(Currency::XAG().code.to_string(), Currency::XAG());
1038 map.insert(Currency::XAU().code.to_string(), Currency::XAU());
1039 map.insert(Currency::XPT().code.to_string(), Currency::XPT());
1040 map.insert(Currency::ZAR().code.to_string(), Currency::ZAR());
1041 map.insert(Currency::AAVE().code.to_string(), Currency::AAVE());
1045 map.insert(Currency::ACA().code.to_string(), Currency::ACA());
1046 map.insert(Currency::ADA().code.to_string(), Currency::ADA());
1047 map.insert(Currency::AVAX().code.to_string(), Currency::AVAX());
1048 map.insert(Currency::BCH().code.to_string(), Currency::BCH());
1049 map.insert(Currency::BTC().code.to_string(), Currency::BTC());
1050 map.insert(Currency::BTTC().code.to_string(), Currency::BTTC());
1051 map.insert(Currency::BNB().code.to_string(), Currency::BNB());
1052 map.insert(Currency::BRZ().code.to_string(), Currency::BRZ());
1053 map.insert(Currency::BSV().code.to_string(), Currency::BSV());
1054 map.insert(Currency::BUSD().code.to_string(), Currency::BUSD());
1055 map.insert(Currency::DASH().code.to_string(), Currency::DASH());
1056 map.insert(Currency::DOGE().code.to_string(), Currency::DOGE());
1057 map.insert(Currency::DOT().code.to_string(), Currency::DOT());
1058 map.insert(Currency::EOS().code.to_string(), Currency::EOS());
1059 map.insert(Currency::ETH().code.to_string(), Currency::ETH());
1060 map.insert(Currency::ETHW().code.to_string(), Currency::ETHW());
1061 map.insert(Currency::JOE().code.to_string(), Currency::JOE());
1062 map.insert(Currency::LINK().code.to_string(), Currency::LINK());
1063 map.insert(Currency::LTC().code.to_string(), Currency::LTC());
1064 map.insert(Currency::LUNA().code.to_string(), Currency::LUNA());
1065 map.insert(Currency::NBT().code.to_string(), Currency::NBT());
1066 map.insert(Currency::SOL().code.to_string(), Currency::SOL());
1067 map.insert(Currency::TRX().code.to_string(), Currency::TRX());
1068 map.insert(Currency::TRYB().code.to_string(), Currency::TRYB());
1069 map.insert(Currency::TUSD().code.to_string(), Currency::TUSD());
1070 map.insert(Currency::VTC().code.to_string(), Currency::VTC());
1071 map.insert(Currency::WSB().code.to_string(), Currency::WSB());
1072 map.insert(Currency::XBT().code.to_string(), Currency::XBT());
1073 map.insert(Currency::XEC().code.to_string(), Currency::XEC());
1074 map.insert(Currency::XLM().code.to_string(), Currency::XLM());
1075 map.insert(Currency::XMR().code.to_string(), Currency::XMR());
1076 map.insert(Currency::XRP().code.to_string(), Currency::XRP());
1077 map.insert(Currency::XTZ().code.to_string(), Currency::XTZ());
1078 map.insert(Currency::USDC().code.to_string(), Currency::USDC());
1079 map.insert(Currency::USDC_POS().code.to_string(), Currency::USDC_POS());
1080 map.insert(Currency::USDP().code.to_string(), Currency::USDP());
1081 map.insert(Currency::USDT().code.to_string(), Currency::USDT());
1082 map.insert(Currency::ZEC().code.to_string(), Currency::ZEC());
1083 Mutex::new(map)
1084});