-
Notifications
You must be signed in to change notification settings - Fork 488
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
View-only quoter #296
base: main
Are you sure you want to change the base?
View-only quoter #296
Conversation
function nextInitializedTickWithinOneWord( | ||
IPoolManager poolManager, | ||
PoolId poolId, | ||
int24 tickSpacing, | ||
int24 tick, | ||
bool lte | ||
) internal view returns (int24 next, bool initialized) { |
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.
it bothers me that we need to re-implement this again in periphery. Here's a draft PR on core which makes the library usable by periphery
/// @param poolKey The poolKey identifying the pool traded against | ||
/// currency0 | ||
/// currency1 | ||
/// fee | ||
/// tickSpacing | ||
/// hooks | ||
/// @param swapParams The parameters used for the swap | ||
/// zeroForOne | ||
/// amountSpecified | ||
/// sqrtPriceLimitX96 |
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.
have we conventionally done natspec like this for struct params :thonk:
function quote(IPoolManager poolManager, PoolKey calldata poolKey, IPoolManager.SwapParams calldata swapParams) | ||
internal | ||
view | ||
returns (int256 amount0, int256 amount1, uint160 sqrtPriceAfterX96, uint32 initializedTicksCrossed) |
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.
optional but I like the idea of making the return type a BalanceDelta 😎
Related Issue
Current quoter simulates a swap and reverts, using a lot of gas.
Description of changes
This view-only quoter aims to quote a v4 pool cheaper by removing the revert and the unused state updates. Currently, this can only quote swaps without hook executions that change the output of a swap.
This code is adapted from view-quoter-v3.