From 7615c87a1d8a8dd516ffa15750a127095eae040e Mon Sep 17 00:00:00 2001
From: dpinones <pinonesdamian@gmail.com>
Date: Thu, 28 Dec 2023 15:25:45 -0300
Subject: [PATCH] revert 'NaN' in test swap

---
 crates/yas_core/src/tests/utils/pool_8.cairo      | 14 +++++++-------
 crates/yas_core/src/tests/utils/pool_9.cairo      | 14 +++++++-------
 crates/yas_core/src/tests/utils/swap_helper.cairo |  2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/crates/yas_core/src/tests/utils/pool_8.cairo b/crates/yas_core/src/tests/utils/pool_8.cairo
index 68ecd82a..8e0d14f8 100644
--- a/crates/yas_core/src/tests/utils/pool_8.cairo
+++ b/crates/yas_core/src/tests/utils/pool_8.cairo
@@ -16,7 +16,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_8() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 0,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 4295128740,
@@ -42,7 +42,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_8() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 0,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 4295128740,
@@ -68,7 +68,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_8() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 0,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 56022770974786139918731938227,
@@ -94,7 +94,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_8() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 0,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 56022770974786139918731938227,
@@ -120,7 +120,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_8() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 0,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 4295128740,
@@ -146,7 +146,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_8() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 0,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 4295128740,
@@ -185,7 +185,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_8() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 0,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 50108289675009586237282760313,
diff --git a/crates/yas_core/src/tests/utils/pool_9.cairo b/crates/yas_core/src/tests/utils/pool_9.cairo
index 7af9cc05..74704e08 100644
--- a/crates/yas_core/src/tests/utils/pool_9.cairo
+++ b/crates/yas_core/src/tests/utils/pool_9.cairo
@@ -29,7 +29,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_9() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 1995041008271423675,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 1461446703485210103287273052203988822378723970341,
@@ -55,7 +55,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_9() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 1995041008271423675,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 1461446703485210103287273052203988822378723970341,
@@ -81,7 +81,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_9() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 1995041008271423675,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 112045541949572279837463876454,
@@ -107,7 +107,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_9() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 1995041008271423675,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 112045541949572279837463876454,
@@ -133,7 +133,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_9() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 1995041008271423675,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 1461446703485210103287273052203988822378723970341,
@@ -159,7 +159,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_9() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 1995041008271423675,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 1461446703485210103287273052203988822378723970341,
@@ -172,7 +172,7 @@ fn SWAP_EXPECTED_RESULTS_POOL_9() -> Array<SwapExpectedResults> {
             amount_0_delta: IntegerTrait::<i256>::new(0, false),
             amount_1_before: 1995041008271423675,
             amount_1_delta: IntegerTrait::<i256>::new(0, false),
-            execution_price: 'NaN'.into(),
+            execution_price: 0,
             fee_growth_global_0_X128_delta: 0,
             fee_growth_global_1_X128_delta: 0,
             pool_price_after: 125270724187523965593206900784,
diff --git a/crates/yas_core/src/tests/utils/swap_helper.cairo b/crates/yas_core/src/tests/utils/swap_helper.cairo
index b0aef397..133f3a7a 100644
--- a/crates/yas_core/src/tests/utils/swap_helper.cairo
+++ b/crates/yas_core/src/tests/utils/swap_helper.cairo
@@ -180,7 +180,7 @@ mod SwapTestHelper {
     ) -> u256 {
         if token_0_swapped_amount == 0
             && token_1_swapped_amount == 0 { //this avoids 0/0 , if no tokens swapped: exec_price = 0
-            'NaN'.into()
+            0
         } else if token_0_swapped_amount == 0 { //this avoids x/0 , case that makes price tend to Infinity
             // 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