Skip to content

Commit 36acf43

Browse files
authored
Merge pull request #3011 from XRPLF/3007_MPTs_are_basic_data_types
Add MPTs to basic data types and currency formats
2 parents 45faea2 + 492fb46 commit 36acf43

File tree

2 files changed

+62
-15
lines changed

2 files changed

+62
-15
lines changed

docs/references/protocol/data-types/basic-data-types.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ XRP is specified as a string containing an integer number of "drops" of XRP, whe
129129
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
130130
}
131131
```
132+
133+
- **MPT** - Use `Amount` to specify the value of an MPT. Assuming an `AssetScale` of *1*, you would specify a value of 13.1 units of an MPT as follows:
134+
135+
```
136+
"Amount": {
137+
"mpt_issuance_id":
138+
"0000012FFD9EE5DA93AC614B4DB94D7E0FCE415CA51BED47",
139+
"value": "131"
140+
}
141+
```
132142
133143
For more information, see [Currency Formats](currency-formats.md).
134144

docs/references/protocol/data-types/currency-formats.md

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,40 @@ seo:
66
label:
77
- XRP
88
- Tokens
9+
- MPTs
910
---
1011
# Currency Formats
1112

12-
The XRP Ledger has two kinds of digital asset: XRP and [tokens](../../../concepts/tokens/index.md). Both types have high precision, although their formats are different.
13+
The XRP Ledger has three kinds of digital asset: XRP, [tokens](../../../concepts/tokens/index.md), and [Multi-purpose Tokens (MPTs)](../../../concepts/tokens/fungible-tokens/multi-purpose-tokens.md). All three types have high precision, although their formats are different.
14+
15+
_(Requires the [MPToken amendment][] {% not-enabled /%})_
1316

1417
## Comparison
1518

16-
The following table summarizes some of the differences between XRP and tokens in the XRP Ledger:
19+
The following table summarizes some of the differences XRP, tokens, and MPTs in the XRP Ledger:
1720

18-
| XRP | Tokens |
19-
|:---------------------------------------------------------|:------------------|
20-
| Has no issuer. | Always issued by an XRP Ledger account. |
21-
| Specified as a string. | Specified as an object. |
22-
| Tracked in [accounts](../ledger-data/ledger-entry-types/accountroot.md). | Tracked in [trust lines](../ledger-data/ledger-entry-types/ripplestate.md). |
23-
| Can never be created; can only be destroyed. | Can be issued or redeemed freely. |
24-
| Minimum value: `0`. (Cannot be negative.) | Minimum value: `-9999999999999999e80`. Minimum nonzero absolute value: `1000000000000000e-96`.
25-
| Maximum value `100000000000` (10<sup>11</sup>) XRP. That's `100000000000000000` (10<sup>17</sup>) "drops". | Maximum value `9999999999999999e80`. |
21+
| XRP | Tokens | MPTs |
22+
|:---------------------------------------------------------|:------------------|:---------------------|
23+
| Has no issuer. | Always issued by an XRP Ledger account. | Always issued by an XRP Ledger account. |
24+
| Specified as a string. | Specified as an object. | Specified as an object. |
25+
| Tracked in [accounts](../ledger-data/ledger-entry-types/accountroot.md). | Tracked in [trust lines](../ledger-data/ledger-entry-types/ripplestate.md). | Tracked in holder's account. |
26+
| Can never be created; can only be destroyed. | Can be issued or redeemed freely. | Can be issued or redeemed freely. |
27+
| Minimum value: `0`. (Cannot be negative.) | Minimum value: `-9999999999999999e80`. Minimum nonzero absolute value: `1000000000000000e-96`. | Minimum value: `0`. (Cannot be negative.) |
28+
| Maximum value `100000000000` (10<sup>11</sup>) XRP. That's `100000000000000000` (10<sup>17</sup>) "drops". | Maximum value `9999999999999999e80`. | Maximum value `0x7FFFFFFFFFFFFFFF`. |
2629
| Precise to the nearest "drop" (0.000001 XRP) | 15 decimal digits of precision. |
27-
| Can't be [frozen](../../../concepts/tokens/fungible-tokens/freezes.md). | The issuer can [freeze](../../../concepts/tokens/fungible-tokens/freezes.md) balances. |
28-
| No transfer fees; XRP-to-XRP payments are always direct. | Can take indirect [paths](../../../concepts/tokens/fungible-tokens/paths.md) with each issuer charging a percentage [transfer fee](../../../concepts/tokens/transfer-fees.md). |
29-
| Can be used in [Payment Channels](../../../concepts/payment-types/payment-channels.md) and [Escrow](../../../concepts/payment-types/escrow.md). | Not compatible with Payment Channels or Escrow. |
30+
| Can't be [frozen](../../../concepts/tokens/fungible-tokens/freezes.md). | The issuer can [freeze](../../../concepts/tokens/fungible-tokens/freezes.md) balances. | The issuer can lock balances individually and globally. |
31+
| No transfer fees; XRP-to-XRP payments are always direct. | Can take indirect [paths](../../../concepts/tokens/fungible-tokens/paths.md) with each issuer charging a percentage [transfer fee](../../../concepts/tokens/transfer-fees.md). | Can charge a transfer fee for secondary sales of the token. |
32+
| Can be used in [Payment Channels](../../../concepts/payment-types/payment-channels.md) and [Escrow](../../../concepts/payment-types/escrow.md). | Not compatible with Payment Channels or Escrow. | Not compatible with Payment Channels or Escrow. |
3033

31-
For more information, see [What is XRP?](../../../introduction/what-is-xrp.md) and [Tokens](../../../concepts/tokens/index.md).
34+
See [What is XRP?](../../../introduction/what-is-xrp.md), [Tokens](../../../concepts/tokens/index.md), and [Multi-purpose Tokens](../../../concepts/tokens/fungible-tokens/multi-purpose-tokens.md).
3235

3336
## Specifying Currency Amounts
3437

3538
Use the appropriate format for the type of currency you want to specify:
3639

3740
- [XRP Amounts](#xrp-amounts)
3841
- [Token Amounts](#token-amounts)
42+
- [MPT Amounts](#mpt-amounts)
3943

4044
### XRP Amounts
4145

@@ -51,7 +55,7 @@ XRP amounts cannot be negative.
5155

5256
### Token Amounts
5357

54-
To specify an amount of a [(fungible) token](../../../concepts/tokens/index.md), use an Amount object. This is a JSON object with three fields:
58+
To specify an amount of a [(fungible) token](../../../concepts/tokens/index.md), use an `Amount` object. Tokens use the `currency`, `value`, and `issuer` fields.
5559

5660
| `Field` | Type | Description |
5761
|:-----------|:---------------------------|:-----------------------------------|
@@ -72,6 +76,25 @@ For example, to represent $153.75 US dollars issued by account `r9cZA1mLK5R5Am25
7276
"issuer": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
7377
}
7478
```
79+
### MPT Amounts
80+
81+
Specify the amount of MPTs using the `value` field.
82+
83+
| `Field` | Type | Description |
84+
|:-----------|:---------------------------|:-----------------------------------|
85+
| `mpt_issuance_id` | String | Arbitrary unique identifier for a Multi-purpose Token. |
86+
| `value` | [String Number][] | A string representing a positive integer value. Valid values for this field are between 0x0 and 0x7FFFFFFFFFFFFFFF. Use `AssetScale` to enable values as fractions of the MPT value. See [MPT Precision](#mpt-precision). |
87+
88+
For example, to specify 1 million units of an MPT you would specify:
89+
90+
```json
91+
{
92+
"mpt_issuance_id":
93+
"0000012FFD9EE5DA93AC614B4DB94D7E0FCE415CA51BED47",
94+
"value": "1000000"
95+
}
96+
```
97+
7598

7699
### Specifying Without Amounts
77100

@@ -111,6 +134,20 @@ When sending token amounts in the XRP Ledger's peer-to-peer network, servers [se
111134

112135
{% admonition type="success" name="Tip" %}For tokens that should not be divisible at all, see [Non-Fungible Tokens (NFTs)](../../../concepts/tokens/nfts/index.md).{% /admonition %}
113136

137+
## MPT Precision
138+
139+
MPTs are always expressed in whole integers. You can change the `AssetScale` of your MPT to express the basic unit as a fraction of an MPT. The XRP Ledger doesn't use the `AssetScale` on-chain: this is for your convenience in specifying the basic unit.
140+
141+
For example, to express a value of 13.1 MPT, the MPT would require that the `AssetScale` be set to 1, and the `value` of the MPT set to 131.
142+
143+
```json
144+
"Amount": {
145+
"mpt_issuance_id":
146+
"0000012FFD9EE5DA93AC614B4DB94D7E0FCE415CA51BED47",
147+
"value": "131"
148+
}
149+
```
150+
114151
## Currency Codes
115152
[Currency Code]: #currency-codes
116153

0 commit comments

Comments
 (0)