This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
fix sample calc in library, add getTradeDiffs #10
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.
Deployed here https://optimistic.etherscan.io/address/0x82959edf06499c3c931c39ebca8737f0b5551bec and being used in nightride UI
Makes _getAmountOut account for differences in the amount of decimals for tokenA and tokenB, instead of just assuming both tokenA and tokenB have the same amount of decimals.
In getTradeDiff(uint,address,address,bool), sample was rounding to 0 in certain cases incorrectly, e.g. if the pool had 0.1 WBTC and 1e9 OptiDoge, sample would be 0, because 0.1 * 1e8 * 1e18/ ( 1e9 * 1e18 ) rounds to 0, so we just directly calculate the derivative instead for volatile pairs in getTradeDiff.
Added a getTradeDiffs function just for convenience to be able to bundle many getTradeDiff calls at once (used by v2 UI).