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.
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
|
|
||
| + // ...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.
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.
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 |
| - 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. |