v4-periphery icon indicating copy to clipboard operation
v4-periphery copied to clipboard

[Bug]: VolatilityOracle is broken after update to latest v4-core

Open haardikk21 opened this issue 4 months ago • 0 comments

Describe the bug

With v4-core getting updated to latest, the Pool Manager no longer calls getFee on the hook contract to determine swap fees. Instead, fees need to be updated in the pool manager directly with poolManager.updateDynamicSwapFee

The VolatilityOracle hook calculates the fee based on how much time has elapsed since the contract was deployed, and was dependent on the fact that getFee would return a different value each time.

Now, getFee has been replaced with setFee - which is only called once in afterInitialize - at which point fee will be set to the initial 0.30% - and is never updated again ever

Expected Behavior

The fee should be updated inside of beforeSwap or afterSwap every time. If there is a preference for one over the other, I can open a pull request.

To Reproduce

No response

Additional context

No response

haardikk21 avatar Mar 19 '24 11:03 haardikk21