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

feat(world-modules): add SystemSwitch util #1665

Merged
merged 8 commits into from Oct 3, 2023
Merged

Conversation

alvrs
Copy link
Member

@alvrs alvrs commented Sep 29, 2023

  • util for better ergonomics of calling systems from other systems

@changeset-bot
Copy link

changeset-bot bot commented Sep 29, 2023

🦋 Changeset detected

Latest commit: 19e1ef2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@latticexyz/world-modules Major
@latticexyz/cli Major
@latticexyz/abi-ts Major
@latticexyz/block-logs-stream Major
@latticexyz/common Major
@latticexyz/config Major
create-mud Major
@latticexyz/dev-tools Major
@latticexyz/ecs-browser Major
@latticexyz/faucet Major
@latticexyz/gas-report Major
@latticexyz/network Major
@latticexyz/noise Major
@latticexyz/phaserx Major
@latticexyz/protocol-parser Major
@latticexyz/react Major
@latticexyz/recs Major
@latticexyz/schema-type Major
@latticexyz/services Major
@latticexyz/solecs Major
solhint-config-mud Major
solhint-plugin-mud Major
@latticexyz/std-client Major
@latticexyz/std-contracts Major
@latticexyz/store-cache Major
@latticexyz/store-indexer Major
@latticexyz/store-sync Major
@latticexyz/store Major
@latticexyz/utils Major
@latticexyz/world Major

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;
Copy link
Member

@holic holic Sep 29, 2023

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

Base automatically changed from alvrs/world-context-consumer to main September 30, 2023 22:01
@vercel
Copy link

vercel bot commented Oct 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mud-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2023 1:01pm


+ // ...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, ());
Copy link
Member

@holic holic Oct 3, 2023

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

Copy link
Member Author

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.

holic
holic previously approved these changes Oct 3, 2023
@holic
Copy link
Member

holic commented Oct 3, 2023

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.
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo! should be +

@alvrs alvrs merged commit 9352648 into main Oct 3, 2023
11 checks passed
@alvrs alvrs deleted the alvrs/subsystem-call branch October 3, 2023 16:25
@github-actions github-actions bot mentioned this pull request Oct 3, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants