You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we use felts for cases where the results of dividing amount_delta_0 and amount_delta_1 are border cases (0/0 or -x/0).
# file /tests/utils/swap_helper.cairo (line 178-190)
fn calculate_execution_price(
token_0_swapped_amount: u256, token_1_swapped_amount: u256
) -> u256 {
if token_0_swapped_amount == 0
&& token_1_swapped_amount == 0 { xxxxxxxxxxxxx
'NaN'.into()
} else if token_0_swapped_amount == 0 {
// Since uniswap divides deltas to calculate exec_price, all prices are multiplied by -1 so that all prices are > 0.
// Therefore, this value ends up as -Infinity
'-Infinity'.into()
} else { //this is every other case, price = 0/x = 0, or price = x/y = z
(token_1_swapped_amount * pow(2, 96)) / token_0_swapped_amount
}
}
We should change what this function returns, and the obtained value should be an enum ExecutionPriceEdgeCases.
The modifications should be made in the previously mentioned function and in the SwapExpectedResults files wherever 'NaN' and '-Infinity' are found.
Pool N°
Error type
Pool 8
NaN
Pool 9
NaN
Pool 10
-Infinity
Pool 11
NaN
Pool 12
-Infinity & NaN
Pool 14
NaN
The text was updated successfully, but these errors were encountered:
Description
Currently, we use felts for cases where the results of dividing amount_delta_0 and amount_delta_1 are border cases (
0/0
or-x/0
).We should change what this function returns, and the obtained value should be an enum
ExecutionPriceEdgeCases
.The modifications should be made in the previously mentioned function and in the
SwapExpectedResults
files wherever 'NaN' and '-Infinity' are found.Pool N°
Error type
Pool 8
NaN
Pool 9
NaN
Pool 10
-Infinity
Pool 11
NaN
Pool 12
-Infinity
&NaN
Pool 14
NaN
The text was updated successfully, but these errors were encountered: