rosetta_types/currency.rs
1/*
2 * Rosetta
3 *
4 * Build Once. Integrate Your Blockchain Everywhere.
5 *
6 * The version of the OpenAPI document: 1.4.13
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// Currency : Currency is composed of a canonical Symbol and Decimals. This Decimals value is used to convert an Amount.Value from atomic units (Satoshis) to standard units (Bitcoins).
12
13#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
14pub struct Currency {
15 /// Canonical symbol associated with a currency.
16 #[serde(rename = "symbol")]
17 pub symbol: String,
18 /// Number of decimal places in the standard unit representation of the amount. For example, BTC has 8 decimals. Note that it is not possible to represent the value of some currency in atomic units that is not base 10.
19 #[serde(rename = "decimals")]
20 pub decimals: u32,
21 /// Any additional information related to the currency itself. For example, it would be useful to populate this object with the contract address of an ERC-20 token.
22 #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
23 pub metadata: Option<serde_json::Value>,
24}
25
26impl Currency {
27 /// Currency is composed of a canonical Symbol and Decimals. This Decimals value is used to convert an Amount.Value from atomic units (Satoshis) to standard units (Bitcoins).
28 pub fn new(symbol: String, decimals: u32) -> Currency {
29 Currency {
30 symbol,
31 decimals,
32 metadata: None,
33 }
34 }
35}