Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XLS-81d: Permissioned DEX #256

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

XLS-81d: Permissioned DEX #256

wants to merge 4 commits into from

Conversation

mvadari
Copy link
Collaborator

@mvadari mvadari commented Dec 6, 2024

Discussion thread can be found here: #229

|`TakerGets`|✔️|`object`|`Amount`|The remaining amount and type of currency being provided by the offer creator.|
</details>

This spec proposes deprecating the `BookDirectory` and `BookNode` fields and adding the following:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how is this possible? what about the existing offers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would only apply to new offers, and old offers could be lazily updated.

Comment on lines +110 to +111
|`BookDirectories`|✔️|`string`|`Vector256`|The IDs of the offer directories that link to this offer.|
|`BookNodes`|✔️|`string`|`STArray`|Hints indicating which pages of the offer directory links to this entry, in case the directories consist of multiple pages.|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the use cases of this? when is an offer included in multiple directories?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's going to a lot of dirty work to deprecate BookDirectory, not sure if the effort is worth it if there's not strong reasoning for this

* The 160-bit currency code from the `TakerGetsCurrency`
* The AccountID from the `TakerPaysIssuer`
* The AccountID from the `TakerGetsIssuer`
* **The `DomainID` of the orderbook, if applicable**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just want to confirm, the use i can think of this is to allow iteration of offers for particular domainID, which is going to be used by cross currency payment and liquidity calculation in pathfinding

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The book directories need to exist, and have distinct hashes from the unpermissioned directories, so what makes the most sense in differentiating those is the DomainID.


| Field Name | Required? | JSON Type | Description |
|------------|-----------|-----------|-------------|
|`domain`| |`string`|The object ID of a `PermissionedDomain` object. If this field is included, then the paths will be filtered to only show the valid paths for that domain.|
Copy link
Collaborator

@shawnxie999 shawnxie999 Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would potentially introduce fundamental changes to the OrderBookDB that fetches currency pair using hash map. At this point i'm not sure of the feasibility and effort to add a "third" param to the OrderBookDB. But I think Pathfinding would be more efficient if this can be implemented.

However another option(also to be confirmed if this is viable) is to leave OrderBookDB as it is, and then filter out paths during liquidity calculation using DomainID. This is less efficient because we will be calculating liquidity for paths that don't have a domainID.


### A.1: How are AMMs handled?

AMMs are not explicitly supported within permissioned DEXes in this proposal. They could be added to permissioned DEXes in a future proposal.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it mean that Payment transactions that specified DomainID cannot consume AMM pools?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. That's intentional.


| Field Name | Required? | JSON Type | Internal Type | Description |
|------------|-----------|-----------|---------------|-------------|
|`DomainID`| |`string`|`Hash256`|The domain that the offer must be a part of.|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what kind of validations do we need to allow someone create an offer with a domainID? can everyone create it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only domain members can create it.

There will also be the following in addition, if the `DomainID` is included:
* The payment isn't a cross-currency payment.
* The domain doesn't exist.
* The `Account` is not a domain member.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we check if an account is a domain member?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it work like:

  1. look up the PermissionedDomain object
  2. iterate through the AcceptedCredentials array
  3. check if the Subject of the Credential object matches the account submitting the Payment tx?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Look up the PermissionedDomain object
  2. Iterate through the AcceptedCredentials array (which only contains issuer-credential type pairs)
  3. Check if the (subject, issuer, credential type) credential exists (where the Subject is the account submitting the Payment tx)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants