Open
Conversation
79a71d6 to
84d010b
Compare
sander2
reviewed
Feb 23, 2023
| path: Vec<TradingPath>, | ||
| ) -> Self { | ||
| let execution_price = | ||
| FixedU128::checked_from_rational(output_amount.value, input_amount.value).unwrap_or_default(); |
Member
There was a problem hiding this comment.
Won't this limit the precision of the comparisons? Why don't we just compare input/output amounts directly, rather than constructing the ratio?
Comment on lines
+267
to
+270
| token0: CurrencyId, | ||
| token1: CurrencyId, | ||
| reserve0: u128, | ||
| reserve1: u128, |
Member
There was a problem hiding this comment.
Would be slightly cleaner if this just holds 2 Amounts
Comment on lines
+246
to
+247
| input_amount: T::Balance, | ||
| input_currency: T::CurrencyId, |
Member
There was a problem hiding this comment.
Take Amount? In general, when you have a (Balance, Currency) pair, I think it's best to construct the Amount as soon as possible
| } | ||
| } | ||
|
|
||
| fn get_output_amount( |
Member
There was a problem hiding this comment.
This function is not very well tested. I think only rpc_find_best_trade hits this code code at all
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
84d010b to
29548ee
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ported from https://github.com/zenlinkpro/dex-sdk
Closes #927