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

add state view contract #187

Merged
merged 6 commits into from
Jul 24, 2024
Merged

add state view contract #187

merged 6 commits into from
Jul 24, 2024

Conversation

snreynolds
Copy link
Member

A lot of offchain services will want to read core state. This is a lens contract we can deploy to expose that to integrators

saucepoint
saucepoint previously approved these changes Jul 23, 2024
src/lens/StateView.sol Outdated Show resolved Hide resolved
broadcast/DeployStateView.s.sol/11155111/run-latest.json Outdated Show resolved Hide resolved
view
returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)
{
return StateLibrary.getSlot0(poolManager, poolId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it would be nicer to have poolManager.getX(...) for each of these

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I do that separately? i'd like this commit to show the deploy broadcast info with the same bytecode 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe its not that important tho..

src/lens/StateView.sol Outdated Show resolved Hide resolved
src/lens/StateView.sol Outdated Show resolved Hide resolved

/**
* @notice Live calculate the fee growth inside a tick range of a pool
* @dev pools[poolId].feeGrowthInside0LastX128 in Position.Info is cached and can become stale. This function will live calculate the feeGrowthInside
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @dev pools[poolId].feeGrowthInside0LastX128 in Position.Info is cached and can become stale. This function will live calculate the feeGrowthInside
* @dev pools[poolId].feeGrowthInside0LastX128 in Position.Info is cached and can become stale. This function will calculate the up to date feeGrowthInside

@snreynolds snreynolds merged commit d3ee037 into main Jul 24, 2024
3 checks passed
@snreynolds snreynolds deleted the state-view branch July 24, 2024 18:55
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 this pull request may close these issues.

3 participants