-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add -Inf case #196
Add -Inf case #196
Conversation
scripts/utility/uni_values.txt
Outdated
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.
remove this please 🙏
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.
Should we add the .txt
to the gitignore
file? So we can avoid this happening in the future
# Input of the script | ||
# Object { | ||
# "amount0Before": "2000000000000000000", | ||
# "amount0Delta": "1000", | ||
# "amount1Before": "2000000000000000000", | ||
# "amount1Delta": "-998", | ||
# "executionPrice": "0.99800", | ||
# "feeGrowthGlobal0X128Delta": "170141183460469231731", | ||
# "amount0Before": "1994009290088178439", | ||
# "amount0Delta": "1000000000000000000", | ||
# "amount1Before": "1994009290088178439", | ||
# "amount1Delta": "-662011820624678025", | ||
# "executionPrice": "0.66201", | ||
# "feeGrowthGlobal0X128Delta": "510423550381407695195061911147652317", | ||
# "feeGrowthGlobal1X128Delta": "0", | ||
# "poolPriceAfter": "1.0000", | ||
# "poolPriceAfter": "0.44355", | ||
# "poolPriceBefore": "1.0000", | ||
# "tickAfter": -1, | ||
# "tickAfter": -8130, | ||
# "tickBefore": 0, | ||
# } | ||
# `; | ||
|
||
# Output of the script | ||
# let swap_expected_result = SwapExpectedResults { | ||
# amount_0_before: 2000000000000000000, | ||
# amount_0_delta: IntegerTrait::<i256>::new(1000, false), | ||
# amount_1_before: 2000000000000000000, | ||
# amount_1_delta: IntegerTrait::<i256>::new(998, true), | ||
# execution_price: 99800, // original executionPrice * 10**5 | ||
# fee_growth_global_0_X128_delta: 170141183460469231731, | ||
# fee_growth_global_1_X128_delta: 0, | ||
# pool_price_after: 79228162514264337593543950336, // after applying parse_price from test_to_cairo | ||
# pool_price_before: 79228162514264337593543950336, // after applying parse_price from test_to_cairo | ||
# tick_after: IntegerTrait::<i32>::new(1, true), | ||
# tick_before: IntegerTrait::<i32>::new(0, false), | ||
# } | ||
# SwapExpectedResults { | ||
# amount_0_before: 1994009290088178439, | ||
# amount_0_delta: IntegerTrait::<i256>::new(1000000000000000000, false), | ||
# amount_1_before: 1994009290088178439, | ||
# amount_1_delta: IntegerTrait::<i256>::new(662011820624678025, true), | ||
# execution_price: 52449980110816002175186131547, | ||
# fee_growth_global_0_X128_delta: 510423550381407695195061911147652317, | ||
# fee_growth_global_1_X128_delta: 0, | ||
# pool_price_after: 52765855989621530048506654453, | ||
# pool_price_before: 79228162514264337593543950336, | ||
# tick_after: IntegerTrait::<i32>::new(8130, true), | ||
# tick_before: IntegerTrait::<i32>::new(0, false), | ||
# }, |
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.
why are we changing this in this PR? 🤔
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.
Had to update parse.py in this PR and realized it needed some freshing up. Those values don't really matter, it's just about the format of the input and output files.
The PR description also clarifies that this file was cleaned
} else if token_0_swapped_amount == 0 { | ||
'-Infinity'.into() |
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.
Can you add a comment describing how this works? Something similar to what you mentioned in Slack.
Describing the different cases and the output for each one
This PR adds execution_price: -Infinity case
This PR also cleans and adds this to the .py parser