-
Notifications
You must be signed in to change notification settings - Fork 203
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
refactor(store-consumer): adapt WithWorld to be a System #3546
Conversation
🦋 Changeset detectedLatest commit: 46645e3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -4,7 +4,7 @@ pragma solidity >=0.8.24; | |||
// @dev Provides information about the current execution context | |||
// We only use it in these contracts in case we want to extend it in the future | |||
abstract contract Context { | |||
function _msgSender() internal view virtual returns (address) { | |||
function _msgSender() public view virtual returns (address) { |
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.
ooc why public?
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.
because _msgSender
in WorldContext.sol
is public so we need to be able to override
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.
for context: it's public to have a unique interface id we can check for in supportsInterface
so only contracts that are intended to be used as systems can be registered as systems
This means you can use stuff like |
Yeah I think those should work, but also so that you can restrict access to systems within the same namespace. |
2bb16a5
to
33f8b2c
Compare
// We use WorldContextConsumer directly as we already know the world is the caller | ||
if (!_callerIsWorld() || !ResourceAccess.get(getNamespaceId(), WorldContextConsumer._msgSender())) { |
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.
so if my EOA has access to the namespace I still have to call the token system through the world correct?
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.
yeah, I thought about checking for supporting it for both EOAs and world, but I felt it was more consistent this way.
23af1f9
to
c913341
Compare
62473ad
to
6403c30
Compare
Now
WithWorld
is also a System, and we modify theonlyNamespace
modifier so that protected functions can only be called by calling the system through the world.