-
Notifications
You must be signed in to change notification settings - Fork 128
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
[ANCHOR-749] Add SEP-38 validation documentation #943
Merged
lijamie98
merged 6 commits into
stellar:main
from
lijamie98:ap/anchor-749-update-sep38-quote-validation-v2
Aug 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
160f230
Add SEP-38 validation rules
lijamie98 c6b96f2
Fix typo
lijamie98 8e5b4d1
Generate mdx
lijamie98 ac63eba
revert dispersment changes
lijamie98 b7a4063
Revert sdp changes
lijamie98 2db8ec7
Merge branch 'main' of github.com:stellar/stellar-docs into ap/anchor…
ElliotFriend File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,26 @@ paths: | |
Either `sell_amount` or `buy_amount` will be included in requests as parameters, but never both. In the same way, | ||
either `sell_delivery_method` and `buy_delivery_method` may be included in requests, but never both, since either | ||
`sell_asset` or `buy_asset` is a Stellar asset. | ||
|
||
|
||
Upon receiving the response, the Anchor Platform will validate the amount and price of the response. | ||
|
||
If the validation fails, the Platform will respond to the client application's request with a HTTP status | ||
code of `502 Bad Gateway`. | ||
|
||
The `sell_mount`, `buy_amount`, `price`, and `fee` are validated as follows: | ||
|
||
- if `rate.fee` exists, | ||
- `rate.fee.asset` must be defined with proper `significant_decimals` in the asset configuration. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does proper mean here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exists and positive. |
||
- `rate.fee.total` must equal to the sum of `rate.fee.details.amount`. | ||
- if the `rate.fee.asset == rate.sell_asset`, `sell_amount ~= price * buy_amount + fee` must hold true. | ||
- if the `rate.fee.asset == rate.buy_asset`, `sell_amount ~= price * (buy_amount + fee)` must hold true. | ||
- if `rate.fee` does not exist, `sell_amount ~= price * buy_amount` must hold true. | ||
|
||
The `~=` is defined as equality within rounding error. | ||
The rounding error is defined as `10^(-significant_decimals)` | ||
|
||
|
||
tags: | ||
- Rates | ||
x-seps: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:
sell_amount