mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 19:55:54 +00:00
Add protocol refs for Permissioned DEXes
This commit is contained in:
@@ -6,14 +6,14 @@ labels:
|
||||
- Decentralized Exchange
|
||||
---
|
||||
# DirectoryNode
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/f64cf9187affd69650907d0d92e097eb29693945/include/xrpl/protocol/detail/ledger_entries.macro#L165-L179 "Source")
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/7e24adbdd0b61fb50967c4c6d4b27cc6d81b33f3/include/xrpl/protocol/detail/ledger_entries.macro#L177-L192 "Source")
|
||||
|
||||
The `DirectoryNode` ledger entry type provides a list of links to other entries in the ledger's state data. A single conceptual _Directory_ takes the form of a doubly linked list, with one or more DirectoryNode entries each containing up to 32 [IDs of other entries](../common-fields.md). The first DirectoryNode entry is called the root of the directory, and all entries other than the root can be added or deleted as necessary.
|
||||
|
||||
There are three kinds of directory:
|
||||
|
||||
* _Owner directories_ list other entries owned by an account, such as [`RippleState` (trust line)](ripplestate.md) or [`Offer`](offer.md) entries.
|
||||
* _Offer directories_ list the offers available in the [decentralized exchange](../../../../concepts/tokens/decentralized-exchange/index.md). A single Offer directory contains all the offers that have the same exchange rate for the same token (currency code and issuer).
|
||||
* _Offer directories_ list the offers available in the [decentralized exchange](../../../../concepts/tokens/decentralized-exchange/index.md). A single offer directory contains all the offers that have the same exchange rate for the same token (currency code and issuer).
|
||||
* _NFT Offer directories_ list buy and sell offers for NFTs. Each NFT has up to two directories, one for buy offers, the other for sell offers.
|
||||
|
||||
All types of directories are automatically updated by the protocol as necessary.
|
||||
@@ -97,6 +97,7 @@ All types of directories are automatically updated by the protocol as necessary.
|
||||
|
||||
| Name | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:--------------------|:----------|:------------------|:----------|:------------|
|
||||
| `DomainID` | String | Hash256 | No | (Offer directories only) The ledger entry ID of a permissioned domain. If present, this order book belongs to the corresponding [Permissioned DEX](../permissioned-dexes.md). Otherwise, this order book is part of the open DEX. _(Requires the [PermissionedDEX amendment][] {% not-enabled /%})_ |
|
||||
| `ExchangeRate` | String | UInt64 | No | (Offer directories only) **DEPRECATED**. Do not use. |
|
||||
| `Flags` | Number | UInt32 | Yes | A bit-map of boolean flags enabled for this object. Currently, the protocol defines no flags for `DirectoryNode` objects. The value is always `0`. |
|
||||
| `Indexes` | Array | Vector256 | Yes | The contents of this directory: an array of IDs of other objects. |
|
||||
@@ -136,8 +137,8 @@ Owner directories and offer directories for fungible tokens do not use flags; th
|
||||
There are three different formulas for creating the ID of a DirectoryNode, depending on which of the following the DirectoryNode represents:
|
||||
|
||||
* The first page (also called the root) of an Owner or NFT Offer directory
|
||||
* The first page of an Offer directory
|
||||
* Later pages of either type
|
||||
* The first page of an Offer directory, with variants for the open DEX and permissioned DEX _(Requires the [PermissionedDEX amendment][] {% not-enabled /%})_
|
||||
* Later pages of any type
|
||||
|
||||
The first page of an Owner directory or NFT Offer directory has an ID that is the [SHA-512Half][] of the following values, concatenated in order:
|
||||
|
||||
@@ -151,6 +152,7 @@ The first page of an Offer directory has a special ID: the higher 192 bits defin
|
||||
* The 160-bit currency code from the `TakerGetsCurrency`
|
||||
* The AccountID from the `TakerPaysIssuer`
|
||||
* The AccountID from the `TakerGetsIssuer`
|
||||
* The `DomainID` of the permissioned domain this order book belongs to, if part of a permissioned DEX. Omitted for order books in the open DEX.
|
||||
|
||||
The lower 64 bits of an Offer directory's ID represent the `TakerPays` amount divided by `TakerGets` amount from the offer(s) in that directory as a 64-bit number in the XRP Ledger's internal amount format.
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ labels:
|
||||
- Decentralized Exchange
|
||||
---
|
||||
# Offer
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/f64cf9187affd69650907d0d92e097eb29693945/include/xrpl/protocol/detail/ledger_entries.macro#L229-L240 "Source")
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/7e24adbdd0b61fb50967c4c6d4b27cc6d81b33f3/include/xrpl/protocol/detail/ledger_entries.macro#L242-L255 "Source")
|
||||
|
||||
An `Offer` ledger entry describes an [Offer](../../../../concepts/tokens/decentralized-exchange/offers.md) to exchange currencies in the XRP Ledger's [decentralized exchange](../../../../concepts/tokens/decentralized-exchange/index.md). (In finance, this is more traditionally known as an _order_.) You an create a new Offer entry by sending an [OfferCreate transaction][] that is not fully executed immediately.
|
||||
An `Offer` ledger entry describes an [offer](../../../../concepts/tokens/decentralized-exchange/offers.md) to exchange currencies in the XRP Ledger's [decentralized exchange](../../../../concepts/tokens/decentralized-exchange/index.md). (In finance, this is more traditionally known as an _order_.) You an create a new offer entry by sending an [OfferCreate transaction][] that is not fully executed immediately.
|
||||
|
||||
An Offer can become unfunded through other activities in the network, while remaining in the ledger. When processing transactions, the network automatically removes any unfunded Offers that those transactions come across. (Otherwise, unfunded Offers remain, because _only_ transactions can change the ledger state.)
|
||||
An offer can become unfunded through other activities in the network, while remaining in the ledger. When processing transactions, the network automatically removes any unfunded Offers that those transactions come across. (Otherwise, unfunded Offers remain, because _only_ transactions can change the ledger state.)
|
||||
|
||||
|
||||
## Example {% $frontmatter.seo.title %} JSON
|
||||
@@ -39,19 +39,21 @@ An Offer can become unfunded through other activities in the network, while rema
|
||||
|
||||
In addition to the [common fields](../common-fields.md), {% code-page-name /%} entries have the following fields:
|
||||
|
||||
| Name | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:--------------------|:-----------------|:------------------|:----------|:------------|
|
||||
| `Account` | String | AccountID | Yes | The address of the account that owns this Offer. |
|
||||
| `BookDirectory` | String | Hash256 | Yes | The ID of the [Offer Directory](directorynode.md) that links to this Offer. |
|
||||
| `BookNode` | String | UInt64 | Yes | A hint indicating which page of the offer directory links to this entry, in case the directory consists of multiple pages. |
|
||||
| `Expiration` | Number | UInt32 | No | Indicates the time after which this Offer is considered unfunded. See [Specifying Time][] for details. |
|
||||
| `LedgerEntryType` | String | UInt16 | Yes | The value `0x006F`, mapped to the string `Offer`, indicates that this is an Offer entry. |
|
||||
| `OwnerNode` | String | UInt64 | Yes | A hint indicating which page of the owner directory links to this entry, in case the directory consists of multiple pages. |
|
||||
| `PreviousTxnID` | String | Hash256 | Yes | The identifying hash of the transaction that most recently modified this entry. |
|
||||
| `PreviousTxnLgrSeq` | Number | UInt32 | Yes | The [index of the ledger][Ledger Index] that contains the transaction that most recently modified this object. |
|
||||
| `Sequence` | Number | UInt32 | Yes | The `Sequence` value of the [OfferCreate][] transaction that created this offer. Used in combination with the `Account` to identify this offer. |
|
||||
| `TakerPays` | [Currency Amount][] | Amount | Yes | The remaining amount and type of currency requested by the Offer creator. |
|
||||
| `TakerGets` | [Currency Amount][] | Amount | Yes | The remaining amount and type of currency being provided by the Offer creator. |
|
||||
| Name | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:--------------------|:---------------------|:------------------|:----------|:------------|
|
||||
| `Account` | String - [Address][] | AccountID | Yes | The account that owns this offer. |
|
||||
| `AdditionalBooks` | Array | Array | No | A list of additional offer directories that link to this offer. This field must be present if this is a hybrid offer in a [permissioned DEX](../permissioned-dexes.md) and if it is not a hybrid offer. The array always contains exactly 1 entry. _(Requires the [PermissionedDEX amendment][] {% not-enabled /%})_ |
|
||||
| `BookDirectory` | String - [Hash][] | Hash256 | Yes | The ID of the [offer directory](directorynode.md) that links to this offer. |
|
||||
| `BookNode` | String | UInt64 | Yes | A hint indicating which page of the offer directory links to this entry, in case the directory consists of multiple pages. |
|
||||
| `DomainID` | String - [Hash][] | Hash256 | No | The ledger entry ID of a [permissioned domain](/docs/concepts/tokens/decentralized-exchange/permissioned-domains). If present, this offer belongs to the corresponding [Permissioned DEX](/docs/concepts/tokens/decentralized-exchange/permissioned-dexes.md). _(Requires the [PermissionedDEX amendment][] {% not-enabled /%})_ |
|
||||
| `Expiration` | Number | UInt32 | No | Indicates the time after which this offer is considered unfunded. See [Specifying Time][] for details. |
|
||||
| `LedgerEntryType` | String | UInt16 | Yes | The value `0x006F`, mapped to the string `Offer`, indicates that this is an offer entry. |
|
||||
| `OwnerNode` | String | UInt64 | Yes | A hint indicating which page of the owner directory links to this entry, in case the directory consists of multiple pages. |
|
||||
| `PreviousTxnID` | String - [Hash][] | Hash256 | Yes | The identifying hash of the transaction that most recently modified this entry. |
|
||||
| `PreviousTxnLgrSeq` | Number | UInt32 | Yes | The [index of the ledger][Ledger Index] that contains the transaction that most recently modified this object. |
|
||||
| `Sequence` | Number | UInt32 | Yes | The `Sequence` value of the [OfferCreate][] transaction that created this offer. Used in combination with the `Account` to identify this offer. |
|
||||
| `TakerPays` | [Currency Amount][] | Amount | Yes | The remaining amount and type of currency requested by the offer creator. |
|
||||
| `TakerGets` | [Currency Amount][] | Amount | Yes | The remaining amount and type of currency being provided by the offer creator. |
|
||||
|
||||
## Offer Flags
|
||||
|
||||
@@ -59,9 +61,9 @@ In addition to the [common fields](../common-fields.md), {% code-page-name /%} e
|
||||
|
||||
| Flag Name | Hex Value | Decimal Value | Corresponding [OfferCreate Flag](../../transactions/types/offercreate.md#offercreate-flags) | Description |
|
||||
|--------------|--------------|---------------|-------------|------------------------|
|
||||
| `lsfPassive` | `0x00010000` | 65536 | `tfPassive` | The offer was placed as "passive". This has no effect after the offer is placed into the ledger. |
|
||||
| `lsfSell` | `0x00020000` | 131072 | `tfSell` | The offer was placed as a "Sell" offer. This has no effect after the offer is placed in the ledger, because `tfSell` only matters if you get a better rate than you asked for, which can only happen when the offer is initially placed. |
|
||||
|
||||
| `lsfPassive` | `0x00010000` | 65536 | `tfPassive` | The offer was placed as passive. This has no effect after the offer is placed into the ledger. |
|
||||
| `lsfSell` | `0x00020000` | 131072 | `tfSell` | The offer was placed as a sell offer. This has no effect after the offer is placed in the ledger, because `tfSell` only matters if you get a better rate than you asked for, which can only happen when the offer is initially placed. |
|
||||
| `lsfHybrid` | `0x00040000` | 262144 | `tfHybrid` | The offer was placed as a hybrid offer, which means it is listed in a [permissioned DEX](/docs/concepts/tokens/decentralized-exchange/permissioned-dexes.md) and the open DEX. _(Requires the [PermissionedDEX amendment][] {% not-enabled /%})_ |
|
||||
|
||||
## {% $frontmatter.seo.title %} Reserve
|
||||
|
||||
@@ -73,9 +75,9 @@ In addition to the [common fields](../common-fields.md), {% code-page-name /%} e
|
||||
The ID of an `Offer` entry is the [SHA-512Half][] of the following values, concatenated in order:
|
||||
|
||||
* The Offer space key (`0x006F`)
|
||||
* The AccountID of the account placing the Offer
|
||||
* The Sequence number of the [OfferCreate transaction][] that created the Offer.
|
||||
* The AccountID of the account placing the offer
|
||||
* The Sequence number of the [OfferCreate transaction][] that created the offer.
|
||||
|
||||
If the OfferCreate transaction used a [Ticket](../../../../concepts/accounts/tickets.md), use the `TicketSequence` value instead.
|
||||
If the OfferCreate transaction used a [ticket](../../../../concepts/accounts/tickets.md), use the `TicketSequence` value instead.
|
||||
|
||||
{% raw-partial file="/docs/_snippets/common-links.md" /%}
|
||||
|
||||
Reference in New Issue
Block a user