1use crate::types::{AssetType, Link};
4use crate::blockchain::Blockchain;
5use crate::asset::Asset;
6
7pub struct BinanceBlockchain;
9
10const LOGO_SVG: &str = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
11<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
12<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"
13 viewBox=\"0 0 2496 2496\" style=\"enable-background:new 0 0 2496 2496;\" xml:space=\"preserve\">
14<g>
15 <path style=\"fill-rule:evenodd;clip-rule:evenodd;fill:#F0B90B;\" d=\"M1248,0c689.3,0,1248,558.7,1248,1248s-558.7,1248-1248,1248
16 S0,1937.3,0,1248S558.7,0,1248,0L1248,0z\"/>
17 <path style=\"fill:#FFFFFF;\" d=\"M685.9,1248l0.9,330l280.4,165v193.2l-444.5-260.7v-524L685.9,1248L685.9,1248z M685.9,918v192.3
18 l-163.3-96.6V821.4l163.3-96.6l164.1,96.6L685.9,918L685.9,918z M1084.3,821.4l163.3-96.6l164.1,96.6L1247.6,918L1084.3,821.4
19 L1084.3,821.4z\"/>
20 <path style=\"fill:#FFFFFF;\" d=\"M803.9,1509.6v-193.2l163.3,96.6v192.3L803.9,1509.6L803.9,1509.6z M1084.3,1812.2l163.3,96.6
21 l164.1-96.6v192.3l-164.1,96.6l-163.3-96.6V1812.2L1084.3,1812.2z M1645.9,821.4l163.3-96.6l164.1,96.6v192.3l-164.1,96.6V918
22 L1645.9,821.4L1645.9,821.4L1645.9,821.4z M1809.2,1578l0.9-330l163.3-96.6v524l-444.5,260.7v-193.2L1809.2,1578L1809.2,1578
23 L1809.2,1578z\"/>
24 <polygon style=\"fill:#FFFFFF;\" points=\"1692.1,1509.6 1528.8,1605.3 1528.8,1413 1692.1,1316.4 1692.1,1509.6 \"/>
25 <path style=\"fill:#FFFFFF;\" d=\"M1692.1,986.4l0.9,193.2l-281.2,165v330.8l-163.3,95.7l-163.3-95.7v-330.8l-281.2-165V986.4
26 L968,889.8l279.5,165.8l281.2-165.8l164.1,96.6H1692.1L1692.1,986.4z M803.9,656.5l443.7-261.6l444.5,261.6l-163.3,96.6
27 l-281.2-165.8L967.2,753.1L803.9,656.5L803.9,656.5z\"/>
28</g>
29</svg>
30";
31
32impl Blockchain for BinanceBlockchain {
33 fn name(&self) -> &str {
34 "Binance Smart Chain"
35 }
36
37 fn description(&self) -> &str {
38 "Fast and secure decentralized digital asset exchange. The new crypto currency trading standard is here.
39"
40 }
41
42 fn website(&self) -> &str {
43 "https://binance.org/"
44 }
45
46 fn explorer(&self) -> &str {
47 "https://explorer.binance.org/"
48 }
49
50 fn links(&self) -> Vec<Link> {
51 vec![
52 Link { name: "github".to_string(), url: "https://github.com/binance-chain/".to_string() },
53 Link { name: "twitter".to_string(), url: "https://twitter.com/binance_dex".to_string() },
54 Link { name: "reddit".to_string(), url: "https://reddit.com/r/BinanceExchange".to_string() },
55 Link { name: "whitepaper".to_string(), url: "https://www.binance.com/resources/ico/Binance_WhitePaper_en.pdf".to_string() },
56 ]
57 }
58
59 fn assets(&self) -> Vec<Box<dyn Asset>> {
60 vec![
61 Box::new(BinanceBNBAsset),
62 Box::new(BinanceUSDTAsset),
63 ]
64 }
65
66 fn asset(&self, id: &str) -> Option<Box<dyn Asset>> {
67 match id {
68 "binance_bnb" => Some(Box::new(BinanceBNBAsset)),
69 "binance_usdt" => Some(Box::new(BinanceUSDTAsset)),
70 _ => None,
71 }
72 }
73
74 fn logo(&self) -> &str {
75 LOGO_SVG
76 }
77}
78
79pub struct BinanceBNBAsset;
81
82const ICON_BINANCEBNBASSET: &str = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
83<!-- Generator: Adobe Illustrator 26.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
84<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"
85 viewBox=\"0 0 2496 2496\" style=\"enable-background:new 0 0 2496 2496;\" xml:space=\"preserve\">
86<g>
87 <path style=\"fill-rule:evenodd;clip-rule:evenodd;fill:#F0B90B;\" d=\"M1248,0c689.3,0,1248,558.7,1248,1248s-558.7,1248-1248,1248
88 S0,1937.3,0,1248S558.7,0,1248,0L1248,0z\"/>
89 <path style=\"fill:#FFFFFF;\" d=\"M685.9,1248l0.9,330l280.4,165v193.2l-444.5-260.7v-524L685.9,1248L685.9,1248z M685.9,918v192.3
90 l-163.3-96.6V821.4l163.3-96.6l164.1,96.6L685.9,918L685.9,918z M1084.3,821.4l163.3-96.6l164.1,96.6L1247.6,918L1084.3,821.4
91 L1084.3,821.4z\"/>
92 <path style=\"fill:#FFFFFF;\" d=\"M803.9,1509.6v-193.2l163.3,96.6v192.3L803.9,1509.6L803.9,1509.6z M1084.3,1812.2l163.3,96.6
93 l164.1-96.6v192.3l-164.1,96.6l-163.3-96.6V1812.2L1084.3,1812.2z M1645.9,821.4l163.3-96.6l164.1,96.6v192.3l-164.1,96.6V918
94 L1645.9,821.4L1645.9,821.4L1645.9,821.4z M1809.2,1578l0.9-330l163.3-96.6v524l-444.5,260.7v-193.2L1809.2,1578L1809.2,1578
95 L1809.2,1578z\"/>
96 <polygon style=\"fill:#FFFFFF;\" points=\"1692.1,1509.6 1528.8,1605.3 1528.8,1413 1692.1,1316.4 1692.1,1509.6 \"/>
97 <path style=\"fill:#FFFFFF;\" d=\"M1692.1,986.4l0.9,193.2l-281.2,165v330.8l-163.3,95.7l-163.3-95.7v-330.8l-281.2-165V986.4
98 L968,889.8l279.5,165.8l281.2-165.8l164.1,96.6H1692.1L1692.1,986.4z M803.9,656.5l443.7-261.6l444.5,261.6l-163.3,96.6
99 l-281.2-165.8L967.2,753.1L803.9,656.5L803.9,656.5z\"/>
100</g>
101</svg>
102";
103
104impl Asset for BinanceBNBAsset {
105 fn id(&self) -> &str {
106 "binance_bnb"
107 }
108
109 fn name(&self) -> &str {
110 "Binance"
111 }
112
113 fn address(&self) -> &str {
114 ""
115 }
116
117 fn symbol(&self) -> &str {
118 "BNB"
119 }
120
121 fn asset_type(&self) -> AssetType {
122 "coin"
123 }
124
125 fn asset_kind(&self) -> &str {
126 "NATIVE"
127 }
128
129 fn bip44_coin_type(&self) -> isize {
130 714
131 }
132
133 fn description(&self) -> &str {
134 "Fast and secure decentralized digital asset exchange. The new crypto currency trading standard is here.
135"
136 }
137
138 fn website(&self) -> &str {
139 "https://binance.org"
140 }
141
142 fn explorer(&self) -> &str {
143 "https://explorer.binance.org/"
144 }
145
146 fn decimals(&self) -> u32 {
147 18
148 }
149
150 fn icon(&self) -> &str {
151 ICON_BINANCEBNBASSET
152 }
153}
154pub struct BinanceUSDTAsset;
156
157const ICON_BINANCEUSDTASSET: &str = "<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 339.43 295.27\"><title>tether-usdt-logo</title><path d=\"M62.15,1.45l-61.89,130a2.52,2.52,0,0,0,.54,2.94L167.95,294.56a2.55,2.55,0,0,0,3.53,0L338.63,134.4a2.52,2.52,0,0,0,.54-2.94l-61.89-130A2.5,2.5,0,0,0,275,0H64.45a2.5,2.5,0,0,0-2.3,1.45h0Z\" style=\"fill:#50af95;fill-rule:evenodd\"/><path d=\"M191.19,144.8v0c-1.2.09-7.4,0.46-21.23,0.46-11,0-18.81-.33-21.55-0.46v0c-42.51-1.87-74.24-9.27-74.24-18.13s31.73-16.25,74.24-18.15v28.91c2.78,0.2,10.74.67,21.74,0.67,13.2,0,19.81-.55,21-0.66v-28.9c42.42,1.89,74.08,9.29,74.08,18.13s-31.65,16.24-74.08,18.12h0Zm0-39.25V79.68h59.2V40.23H89.21V79.68H148.4v25.86c-48.11,2.21-84.29,11.74-84.29,23.16s36.18,20.94,84.29,23.16v82.9h42.78V151.83c48-2.21,84.12-11.73,84.12-23.14s-36.09-20.93-84.12-23.15h0Zm0,0h0Z\" style=\"fill:#fff;fill-rule:evenodd\"/></svg>";
158
159impl Asset for BinanceUSDTAsset {
160 fn id(&self) -> &str {
161 "binance_usdt"
162 }
163
164 fn name(&self) -> &str {
165 "Tether USD"
166 }
167
168 fn address(&self) -> &str {
169 "0x55d398326f99059fF775485246999027B3197955"
170 }
171
172 fn symbol(&self) -> &str {
173 "USDT"
174 }
175
176 fn asset_type(&self) -> AssetType {
177 "token"
178 }
179
180 fn asset_kind(&self) -> &str {
181 "BEP20"
182 }
183
184 fn bip44_coin_type(&self) -> isize {
185 -1
186 }
187
188 fn description(&self) -> &str {
189 "Tether gives you the joint benefits of open blockchain technology and traditional currency by converting your cash into a stable digital currency equivalent.
190"
191 }
192
193 fn website(&self) -> &str {
194 "https://tether.to"
195 }
196
197 fn explorer(&self) -> &str {
198 "https://bscscan.com/token/0x55d398326f99059fF775485246999027B3197955"
199 }
200
201 fn decimals(&self) -> u32 {
202 18
203 }
204
205 fn icon(&self) -> &str {
206 ICON_BINANCEUSDTASSET
207 }
208}