-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add swap() tests #152
Conversation
scripts/utility/README.md
Outdated
@@ -0,0 +1 @@ | |||
This Readme explains the structure and process of passing the pool test cases from .sol to .cairo |
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.
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', |
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.
// description: 'low fee, 1:1 price, 2e18 max range liquidity', |
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.
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', |
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.
// description: 'medium fee, 1:1 price, 2e18 max range liquidity', |
], | ||
}, | ||
PoolTestCase { | ||
// description: 'high fee, 1:1 price, 2e18 max range liquidity', |
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.
// description: 'high fee, 1:1 price, 2e18 max range liquidity', |
], | ||
}, | ||
PoolTestCase { | ||
// description: 'medium fee, 10:1 price, 2e18 max range liquidity', |
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.
// description: 'medium fee, 10:1 price, 2e18 max range liquidity', |
], | ||
}, | ||
PoolTestCase { | ||
// description: 'medium fee, 1:10 price, 2e18 max range liquidity', |
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.
// description: 'medium fee, 1:10 price, 2e18 max range liquidity', |
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.
🔥 🔥
|
||
fn SWAP_EXPECTED_RESULTS_POOL_1() -> Array<SwapExpectedResults> { | ||
array![ | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(8090, true), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(8089, false), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(13864, true), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(13863, false), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(1, true), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(0, false), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(1, true), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(0, false), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
tick_after: IntegerTrait::<i32>::new(9163, false), | ||
tick_before: IntegerTrait::<i32>::new(0, false), | ||
}, | ||
SwapExpectedResults { |
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.
ok
Co-authored-by: Damián Piñones <[email protected]>
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