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

Put the V3 style oracle into a hook #53

Closed
moodysalem opened this issue Apr 18, 2022 · 0 comments · Fixed by #54
Closed

Put the V3 style oracle into a hook #53

moodysalem opened this issue Apr 18, 2022 · 0 comments · Fixed by #54

Comments

@moodysalem
Copy link
Contributor

moodysalem commented Apr 18, 2022

since hooks can affect price or liquidity "between" blocks, e.g. add liquidity based on time, or execute swaps based on time, the oracle feature is incompatible with pools that have these kinds of hooks

we should consider externalizing any time based features to hooks (e.g. seconds per liquidity and tick/seconds per liquidity accumulators)

the nice benefit is that since these can be opt-in via hooks, pools that don't need the features will be cheaper to use. it also removes all references to time from the pool manager, which makes the code more portable to networks where time is unreliable or more manipulable

@moodysalem moodysalem self-assigned this Apr 18, 2022
moodysalem added a commit that referenced this issue Apr 27, 2022
#54)

* move the oracle into a hook, remove time based stuff from pool manager

fixes #53

* partially complete implementation of the v3 oracle hook

* partially complete implementation of the v3 oracle hook

* rename, plus some documentation, plus the idea about forcing the geomean oracle to be a single pool with locked liquidity

* working on unit tests

* finish merge

* get the test to pass!

* add a mock time geomean oracle

* some #afterInitialize tests

* add an #afterInitialize tests, limit max tick spacing

* more beforeSwap tests

* use the MAX_TICK_SPACING on the pool manager, add to interface

* inheritdoc

* afterModifyPosition tests

* remove unused variables

* force max range liquidity in the oracle

* address comments
moodysalem added a commit that referenced this issue Apr 27, 2022
#65)

* move the oracle into a hook, remove time based stuff from pool manager

fixes #53

* partially complete implementation of the v3 oracle hook

* partially complete implementation of the v3 oracle hook

* rename, plus some documentation, plus the idea about forcing the geomean oracle to be a single pool with locked liquidity

* working on unit tests

* finish merge

* get the test to pass!

* add a mock time geomean oracle

* some #afterInitialize tests

* add an #afterInitialize tests, limit max tick spacing

* more beforeSwap tests

* use the MAX_TICK_SPACING on the pool manager, add to interface

* inheritdoc

* afterModifyPosition tests

* remove unused variables

* nit: move the max liquidity invariant to the pool since it's a pool property and not a tick property

* fix redundant sloads

* can skip tick liquidity checks on burns

* force max range liquidity in the oracle

* add gas tests

* use a cheaper formula to compute the max liquidity per tick since we call it more often

* add tests for the invariant that the new formula for
tickSpacingToMaxLiquidityPerTick relies on

* add a comment
@moodysalem moodysalem removed their assignment May 12, 2023
EnigmaGlimmer pushed a commit to EnigmaGlimmer/Uniswap_V4 that referenced this issue Aug 8, 2024
…r (#54)

* move the oracle into a hook, remove time based stuff from pool manager

fixes Uniswap/v4-core#53

* partially complete implementation of the v3 oracle hook

* partially complete implementation of the v3 oracle hook

* rename, plus some documentation, plus the idea about forcing the geomean oracle to be a single pool with locked liquidity

* working on unit tests

* finish merge

* get the test to pass!

* add a mock time geomean oracle

* some #afterInitialize tests

* add an #afterInitialize tests, limit max tick spacing

* more beforeSwap tests

* use the MAX_TICK_SPACING on the pool manager, add to interface

* inheritdoc

* afterModifyPosition tests

* remove unused variables

* force max range liquidity in the oracle

* address comments
EnigmaGlimmer pushed a commit to EnigmaGlimmer/Uniswap_V4 that referenced this issue Aug 8, 2024
…… (#65)

* move the oracle into a hook, remove time based stuff from pool manager

fixes Uniswap/v4-core#53

* partially complete implementation of the v3 oracle hook

* partially complete implementation of the v3 oracle hook

* rename, plus some documentation, plus the idea about forcing the geomean oracle to be a single pool with locked liquidity

* working on unit tests

* finish merge

* get the test to pass!

* add a mock time geomean oracle

* some #afterInitialize tests

* add an #afterInitialize tests, limit max tick spacing

* more beforeSwap tests

* use the MAX_TICK_SPACING on the pool manager, add to interface

* inheritdoc

* afterModifyPosition tests

* remove unused variables

* nit: move the max liquidity invariant to the pool since it's a pool property and not a tick property

* fix redundant sloads

* can skip tick liquidity checks on burns

* force max range liquidity in the oracle

* add gas tests

* use a cheaper formula to compute the max liquidity per tick since we call it more often

* add tests for the invariant that the new formula for
tickSpacingToMaxLiquidityPerTick relies on

* add a comment
treeMan0301 added a commit to treeMan0301/uniswap-v4-core that referenced this issue Oct 28, 2024
…r (#54)

* move the oracle into a hook, remove time based stuff from pool manager

fixes Uniswap/v4-core#53

* partially complete implementation of the v3 oracle hook

* partially complete implementation of the v3 oracle hook

* rename, plus some documentation, plus the idea about forcing the geomean oracle to be a single pool with locked liquidity

* working on unit tests

* finish merge

* get the test to pass!

* add a mock time geomean oracle

* some #afterInitialize tests

* add an #afterInitialize tests, limit max tick spacing

* more beforeSwap tests

* use the MAX_TICK_SPACING on the pool manager, add to interface

* inheritdoc

* afterModifyPosition tests

* remove unused variables

* force max range liquidity in the oracle

* address comments
treeMan0301 added a commit to treeMan0301/uniswap-v4-core that referenced this issue Oct 28, 2024
…… (#65)

* move the oracle into a hook, remove time based stuff from pool manager

fixes Uniswap/v4-core#53

* partially complete implementation of the v3 oracle hook

* partially complete implementation of the v3 oracle hook

* rename, plus some documentation, plus the idea about forcing the geomean oracle to be a single pool with locked liquidity

* working on unit tests

* finish merge

* get the test to pass!

* add a mock time geomean oracle

* some #afterInitialize tests

* add an #afterInitialize tests, limit max tick spacing

* more beforeSwap tests

* use the MAX_TICK_SPACING on the pool manager, add to interface

* inheritdoc

* afterModifyPosition tests

* remove unused variables

* nit: move the max liquidity invariant to the pool since it's a pool property and not a tick property

* fix redundant sloads

* can skip tick liquidity checks on burns

* force max range liquidity in the oracle

* add gas tests

* use a cheaper formula to compute the max liquidity per tick since we call it more often

* add tests for the invariant that the new formula for
tickSpacingToMaxLiquidityPerTick relies on

* add a comment
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 a pull request may close this issue.

1 participant