From 31f0481e211fb665d8b061912f4c9c6f43ecbb51 Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Tue, 28 Jan 2020 16:48:19 -0800 Subject: [PATCH] Currency Formatting edits --- .../rippled-api/api-conventions/basic-data-types.md | 2 +- .../rippled-api/api-conventions/currency-formats.md | 8 +++++--- .../rippled-api/api-conventions/serialization.md | 6 +++--- .../subscription-methods/subscribe.md | 10 +++++----- dactyl-config.yml | 3 +++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/content/references/rippled-api/api-conventions/basic-data-types.md b/content/references/rippled-api/api-conventions/basic-data-types.md index bf08cce75c..a8e2d7eab3 100644 --- a/content/references/rippled-api/api-conventions/basic-data-types.md +++ b/content/references/rippled-api/api-conventions/basic-data-types.md @@ -83,7 +83,7 @@ If you do not specify a ledger, the `current` (in-progress) ledger is chosen by ## Specifying Currency Amounts -There are two kinds of currencies in the XRP Ledger: XRP, and issued currencies. These two types of currencies are specified in different formats, and they have different amounts of precision and different rounding behavior. +There are two kinds of currencies in the XRP Ledger: XRP, and issued currencies. These two types of currencies are specified in different formats, with different precision and rounding behavior. Some fields, such as the destination `Amount` of a [Payment transaction][], can be either type. Some fields only accept XRP specifically, such as the `Fee` field ([transaction cost](transaction-cost.html)). diff --git a/content/references/rippled-api/api-conventions/currency-formats.md b/content/references/rippled-api/api-conventions/currency-formats.md index 07b4ce5aa6..0cbb67cf25 100644 --- a/content/references/rippled-api/api-conventions/currency-formats.md +++ b/content/references/rippled-api/api-conventions/currency-formats.md @@ -8,12 +8,12 @@ The following table summarizes some of the differences between XRP and [issued c | XRP | Issued Currencies | |:---------------------------------------------------------|:------------------| -| Has no issuer. | Always issued by an XRP Ledger account | -| Specified as a string. | Specified as an object | +| Has no issuer. | Always issued by an XRP Ledger account. | +| Specified as a string. | Specified as an object. | | Tracked in [accounts](accountroot.html). | Tracked in [trust lines](ripplestate.html). | | Can never be created; can only be destroyed. | Can be issued or redeemed freely. | | Minimum value: `0`. (Cannot be negative.) | Minimum value: `-9999999999999999e80`. Minimum nonzero absolute value: `1000000000000000e-96`. -| Maximum value `100000000000` (111) XRP. That's `100000000000000000` (1017) "drops". | Maximum value `9999999999999999e80` | +| Maximum value `100000000000` (111) XRP. That's `100000000000000000` (1017) "drops". | Maximum value `9999999999999999e80`. | | Precise to the nearest "drop" (0.000001 XRP) | 15 decimal digits of precision. | | Can't be [frozen](freezes.html). | The issuer can [freeze](freezes.html) balances. | | No transfer fees; XRP-to-XRP payments are always direct. | Can take indirect [paths](paths.html) with each issuer charging a percentage [transfer fee](transfer-fees.html). | @@ -88,6 +88,8 @@ The issued currency format can store a wide variety of assets, including those t When sending issued currency amounts in the XRP Ledger's peer-to-peer network, servers [serialize](serialization.html) the amount to a 64-bit binary value. +**Note:** The XRP Ledger does not support issued currencies that are not [fungible](https://en.wikipedia.org/wiki/Fungibility). It also does not support limiting an issued currency to whole number amounts only. All issued currencies in the XRP Ledger are always divisible down to the minimum amount. + ## Currency Codes [Currency Code]: #currency-codes diff --git a/content/references/rippled-api/api-conventions/serialization.md b/content/references/rippled-api/api-conventions/serialization.md index 14a2beff70..e439b5d778 100644 --- a/content/references/rippled-api/api-conventions/serialization.md +++ b/content/references/rippled-api/api-conventions/serialization.md @@ -224,12 +224,12 @@ The following diagram shows the serialization formats for both XRP amounts and i ![Issued Currency Amount Format diagram](img/currency-number-format.png) -The XRP Ledger uses 64 bits to serialize the numeric amount of an issued currency. (This is the `value` field of a currency amount object in JSON format.) This consists of a "not XRP" bit, a sign bit, significant digits, and an exponent, in order: +The XRP Ledger uses 64 bits to serialize the numeric amount of an issued currency. (In JSON format, the numeric amount is the `value` field of a currency amount object.) In binary format, the numeric amount consists of a "not XRP" bit, a sign bit, significant digits, and an exponent, in order: 1. The first (most significant) bit for an issued currency amount is `1` to indicate that it is not an XRP amount. (XRP amounts always have the most significant bit set to `0` to distinguish them from this format.) 2. The sign bit indicates whether the amount is positive or negative. Unlike standard [two's complement](https://en.wikipedia.org/wiki/Two%27s_complement) integers, `1` indicates **positive** in the XRP Ledger format, and `0` indicates negative. 3. The next 8 bits represent the exponent as an unsigned integer. The exponent indicates the scale (what power of 10 the significant digits should be multiplied by) in the range -96 to +80 (inclusive). However, when serializing, we add 97 to the exponent to make it possible to serialize as an unsigned integer. Thus, a serialized value of `1` indicates an exponent of `-96`, a serialized value of `177` indicates an exponent of 80, and so on. -4. The remaining 54 bits represent the significant digits as an unsigned integer. When serializing, this value is normalized to the range 1015 (`1000000000000000`) to 1016-1 (`9999999999999999`) inclusive, except for the special case of the value 0. There is a special case for the value 0. In this case, the sign bit, exponent, and mantissa are all zeroes, so the 64-bit value is serialized as `0x8000000000000000000000000000000000000000`. +4. The remaining 54 bits represent the significant digits as an unsigned integer. When serializing, this value is normalized to the range 1015 (`1000000000000000`) to 1016-1 (`9999999999999999`) inclusive, except for the special case of the value 0. In the special case for 0, the sign bit, exponent, and mantissa are all zeroes, so the 64-bit value is serialized as `0x8000000000000000000000000000000000000000`. The numeric amount is serialized alongside the [currency code][] and issuer to form a full [issued currency amount](#amount-fields). @@ -240,7 +240,7 @@ At a protocol level, currency codes in the XRP Ledger are arbitrary 160-bit valu - The currency code `0x0000000000000000000000005852500000000000` is **always disallowed**. (This is the "standard format" for an issued currency with code "XRP".) - The currency code `0x0000000000000000000000000000000000000000` (all zeroes) is **generally disallowed**. Usually, XRP amounts are not specified with currency codes. However, this code is used to indicate XRP in rare cases where a field must specify a currency code for XRP. -The [`rippled` APIs](rippled-apis.html) support a **standard format** for translating three-character ASCII codes to 160-bit hex values as follows: +The [`rippled` APIs](rippled-api.html) support a **standard format** for translating three-character ASCII codes to 160-bit hex values as follows: ![Standard Currency Code Format](img/currency-code-format.png) diff --git a/content/references/rippled-api/public-rippled-methods/subscription-methods/subscribe.md b/content/references/rippled-api/public-rippled-methods/subscription-methods/subscribe.md index 4cea7578fe..0fb65d10c4 100644 --- a/content/references/rippled-api/public-rippled-methods/subscription-methods/subscribe.md +++ b/content/references/rippled-api/public-rippled-methods/subscription-methods/subscribe.md @@ -82,11 +82,11 @@ Each member of the `books` array, if provided, is an object with the following f | `Field` | Type | Description | |:-------------|:--------|:----------------------------------------------------| -| `taker_gets` | Object | Specification of which currency the account taking the offer would receive, as a [currency object with no amount](basic-data-types.html#specifying-currencies-without-amounts). | -| `taker_pays` | Object | Specification of which currency the account taking the offer would pay, as a [currency object with no amount](basic-data-types.html#specifying-currencies-without-amounts). | -| `taker` | String | Unique account address to use as a perspective for viewing offers, in the XRP Ledger's [base58][] format. (This affects the funding status and fees of offers.) | -| `snapshot` | Boolean | (Optional, defaults to false) If true, return the current state of the order book once when you subscribe before sending updates | -| `both` | Boolean | (Optional, defaults to false) If true, return both sides of the order book. | +| `taker_gets` | Object | Specification of which currency the account taking the Offer would receive, as a [currency object with no amount](currency-formats.html#specifying-currencies-without-amounts). | +| `taker_pays` | Object | Specification of which currency the account taking the Offer would pay, as a [currency object with no amount](currency-formats.html#specifying-currencies-without-amounts). | +| `taker` | String | Unique [account address](accounts.html) to use as a perspective for viewing offers, in the XRP Ledger's [base58][] format. (This affects the funding status and fees of [Offers](offers.html).) | +| `snapshot` | Boolean | _(Optional)_ If `true`, return the current state of the order book once when you subscribe before sending updates. The default is `false`. | +| `both` | Boolean | _(Optional)_ If `true`, return both sides of the order book. The default is `false`. | ## Response Format diff --git a/dactyl-config.yml b/dactyl-config.yml index c6764a4975..e542c325e2 100644 --- a/dactyl-config.yml +++ b/dactyl-config.yml @@ -278,6 +278,9 @@ targets: "rippled-server-modes.html#public-hubs": "rippled-server-modes.html#公開ハブ" "peer-protocol.html#peer-discovery": "peer-protocol.html#ピア発見" "ledgers.html#tree-format": "ledgers.html#ツリーの形式" + # Fix links from untranslated currency_codes snippet + "currency-formats.html#standard-currency-codes": "currency-formats.html#標準通貨コード" + "currency-formats.html#nonstandard-currency-codes": "currency-formats.html#非標準通貨コード" - name: xrp-api-only