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

UniswapV2Pair: reserves are using three different slots, not a single one #29

Open
Maksandre opened this issue Oct 27, 2024 · 0 comments

Comments

@Maksandre
Copy link

🐞 Bug Report

💻 Describe the bug

Because of the uint256 type, storage variables reserve0, reserve1, and blockTimestampLast are stored in three different slots, not a single one, as the comments state.

uint256 private reserve0; // uses single storage slot, accessible via getReserves
uint256 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves


    uint256 private reserve0; // uses single storage slot, accessible via getReserves
    uint256 private reserve1; // uses single storage slot, accessible via getReserves
    uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves

💡 Possible Solution

Change types for reserve0 and reserve1 to uint112 or remove misleading comments

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

No branches or pull requests

1 participant