-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Add EIP: Token Mapping Slot Retrieval Extension #6830
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
Conversation
✅ All reviewers have approved. |
Not sure I understand why @eth-bot failed, do you have any clues? |
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.
LGTM
Moved the EIP from the |
This proposal suggests an extension to the ERC-20/ERC-721/ERC-1155 standards that allows retrieving the reserved storage slot of the mapping responsible for tracking ownership of compliant tokens. The proposed extension enables accurate off-chain simulations, eliminates the reliance on events, and enhances the precision of data access from storage. The proposed extension is a single function named getTokenLocationRoot() that returns the reserved storage slot for the mapping type in any ERC-20/ERC-721/ERC-1155 compliant smart-contract implementation. The proposed extension does not have any additional cost for the caller, and there is a negligible increase in the deployment cost of the contract.
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.
All Reviewers Have Approved; Performing Automatic Merge...
This proposal suggests an approach to improving the accuracy of off-chain transaction simulations that involve contracts that comply with the
ERC-20
/ERC-721
/ERC-1155
standards. The proposal provides a standardized entry point to obtain the reserved storage slot of a mapping responsible for tracking ownership of tokens in a contract. This approach not only helps capture state changes more precisely but also enables external tools and services to do so without requiring expertise in specific implementation details.Due to the unique storage layout for different contracts, it is challenging to simulate transactions that involve smart contracts, specifically due to the use of mappings. The storage location of a value in a mapping depends on a specific storage slot, which can only be determined through knowledge of the contract’s implementation. This prevents external platforms and tools from capturing/validating changes made to a contract’s state with certainty.
This proposal introduces a function named getTokenLocationRoot as an extension to
ERC-20
/ERC-721
/ERC-1155
contracts, allowing off-chain callers to retrieve the reserved storage slot for the mapping type. This approach eliminates the reliance on events, enhances the precision of data access from storage, and improves the accuracy of off-chain simulations.Reopen as suggested here due to a problem with the bot.