-
Notifications
You must be signed in to change notification settings - Fork 196
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
feat(world-modules): add SystemSwitch util #1665
Conversation
alvrs
commented
Sep 29, 2023
- util for better ergonomics of calling systems from other systems
🦋 Changeset detectedLatest commit: 19e1ef2 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 |
@@ -0,0 +1,80 @@ | |||
// SPDX-License-Identifier: MIT | |||
pragma solidity >=0.8.21; |
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.
talked IRL but can we move this to src/utils
instead of stc/modules/utils
since it's not a module?
in the future we can consider renaming this package to world-std
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
8aeceb8
to
f9d0d36
Compare
.changeset/modern-stingrays-kneel.md
Outdated
|
||
+ // ...you can now use the `SystemSwitch` util. | ||
* // This works independent of whether used in a root system or non-root system. | ||
+ SystemSwitch.call(abi.encodeCall(IBaseWorld.callMySystem, ()); |
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.
do we want to show how this is used with return values? since this requires abi.decode
now, whereas the former didn't
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.
yes, if the call returns a value. Will change in the changeset example.
since we've had a few folks ask about this, we should prob get @qbzzt to add a docs page about systems-calling-systems |
.changeset/modern-stingrays-kneel.md
Outdated
- uint256 value = IBaseWorld(_world()).callMySystem(); | ||
|
||
+ // ...you can now use the `SystemSwitch` util. | ||
* // This works independent of whether used in a root system or non-root system. |
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.
what's the * here for?
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.
typo! should be +