-
Notifications
You must be signed in to change notification settings - Fork 1k
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
POC: amountSpecified matches deltas #491
Conversation
4af1124
to
6403b3d
Compare
test/PoolManager.t.sol
Outdated
@@ -464,7 +464,7 @@ contract PoolManagerTest is Test, Deployers, GasSnapshot { | |||
modifyLiquidityRouter.modifyLiquidity{value: 1 ether}(nativeKey, liqParams, ZERO_BYTES); | |||
|
|||
IPoolManager.SwapParams memory params = | |||
IPoolManager.SwapParams({zeroForOne: true, amountSpecified: 100, sqrtPriceLimitX96: SQRT_RATIO_1_2}); | |||
IPoolManager.SwapParams({zeroForOne: true, amountSpecified: -100, sqrtPriceLimitX96: SQRT_RATIO_1_2}); |
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 identical struct is used all over this file, and DynamicFees.t.sol. I wonder if we should just save it as our default SWAP_PARAMS
in Deployers.sol
like we have LIQ_PARAMS
etc in there. And then al these files can just use that constant defined in 1 place?
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.
or SWAP_EXACT_IN_PARAMS
or something
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.
I added this to our #390
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.
good call
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.
Looking great, much simpler than i thought it was going to be lol
* Remove access lock * remove current hook * Remove nested locking * Locker library tests * Rename empty lock test * Test skeleton * Test for a nested swap * Tests for nested function calls * snapshots * Separate libs, rename error * Remove lock caller * merge errors * Flipping the sign of deltas * update comments * remove unnecessary read of result * move delta flip to sqrtprice lib * remove duplicate test * amountSpecified matches deltas (#491) Co-authored-by: hensha256 <[email protected]> * PR nits --------- Co-authored-by: Emily Williams <[email protected]>
* Remove access lock * remove current hook * Remove nested locking * Locker library tests * Rename empty lock test * Test skeleton * Test for a nested swap * Tests for nested function calls * snapshots * Separate libs, rename error * Remove lock caller * merge errors * Flipping the sign of deltas * update comments * refactor hook callsite * linting * first draft of swap impl * Compiling and tests passing * first test passing * Add todo * other TODO * reduce calls to account delta * check delta modification in callsite * fix error and compiler warnings * skeleton for modify position * Test * Add liquidity check in modify router * add liq test * linting * remove unnecessary read of result * move delta flip to sqrtprice lib * remove duplicate test * amountSpecified matches deltas (#491) Co-authored-by: hensha256 <[email protected]> * common var, and custom error * refactor of hook callsites and perms * PR comments, clean up swap comments * Allow noop on the pool * Update src/PoolManager.sol Co-authored-by: saucepoint <[email protected]> * correct delta taken from user * PR comments * liq to liquidity * refactor logic into hook contract * move all delta settling to the end * Factor out swap logic into helper * small refactor mdoify liq * amountToSwap variable * more tests * beginning of fuzz work * full fuzz test of beforeSwap return * rename * split comments on multiple lines * Update src/libraries/Hooks.sol Co-authored-by: Sara Reynolds <[email protected]> * refactor processing hook deltas * remove console imports * nit PR comments * remove unneeded check * refactor logic into hook contract * modifyLiquidity to match swap * remove unneeded check * PR comments * fix fuzz test * remove extra check and add comments * correct gas snaps * Natspec updates * natspec * PR comments * comment protocol fee clearer * PR comments --------- Co-authored-by: Emily Williams <[email protected]> Co-authored-by: saucepoint <[email protected]> Co-authored-by: Sara Reynolds <[email protected]>
Related Issue
Which issue does this pull request resolve?
Description of changes