Skip to content
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 swap() tests #152

Merged
merged 33 commits into from
Nov 21, 2023
Merged

Add swap() tests #152

merged 33 commits into from
Nov 21, 2023

Conversation

uri-99
Copy link
Collaborator

@uri-99 uri-99 commented Oct 27, 2023

This PR resolves issue #149, adding a suite of tests for the swap() functionality.

This PR also solves issue #162 , as a pool test case was necesary to build the structure for testing the different pools

This PR also solves a minor bug found on scripts/local.rs , where the BUILD_PATH_PREFIX was incomplete

@uri-99 uri-99 self-assigned this Oct 27, 2023
@uri-99 uri-99 marked this pull request as ready for review November 6, 2023 20:16
@@ -0,0 +1 @@
This Readme explains the structure and process of passing the pool test cases from .sol to .cairo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This Readme explains the structure and process of passing the pool test cases from .sol to .cairo
This Readme explains the structure and process of passing the pool test cases from the original Uniswap Protocol to a compatible and more readable cairo structure.

Also add a short explanation on why we are doing this.

fn POOL_CASES() -> Array<PoolTestCase> {
array![
PoolTestCase {
// description: 'low fee, 1:1 price, 2e18 max range liquidity',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// description: 'low fee, 1:1 price, 2e18 max range liquidity',

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these are the pool case description, are we sure we want to delete them?

],
},
PoolTestCase {
// description: 'medium fee, 1:1 price, 2e18 max range liquidity',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// description: 'medium fee, 1:1 price, 2e18 max range liquidity',

],
},
PoolTestCase {
// description: 'high fee, 1:1 price, 2e18 max range liquidity',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// description: 'high fee, 1:1 price, 2e18 max range liquidity',

],
},
PoolTestCase {
// description: 'medium fee, 10:1 price, 2e18 max range liquidity',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// description: 'medium fee, 10:1 price, 2e18 max range liquidity',

],
},
PoolTestCase {
// description: 'medium fee, 1:10 price, 2e18 max range liquidity',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// description: 'medium fee, 1:10 price, 2e18 max range liquidity',

@uri-99 uri-99 requested review from rcatalan98 and dubzn November 8, 2023 14:08
Copy link
Contributor

@dubzn dubzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 🔥


fn SWAP_EXPECTED_RESULTS_POOL_1() -> Array<SwapExpectedResults> {
array![
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(8090, true),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(8089, false),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(13864, true),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(13863, false),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(1, true),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(0, false),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(1, true),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(0, false),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

tick_after: IntegerTrait::<i32>::new(9163, false),
tick_before: IntegerTrait::<i32>::new(0, false),
},
SwapExpectedResults {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@uri-99 uri-99 merged commit 333d906 into main Nov 21, 2023
@uri-99 uri-99 deleted the tests/swap branch November 21, 2023 16:43
@rcatalan98 rcatalan98 mentioned this pull request Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants