Skip to content

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

Merged
alvrs merged 8 commits into
mainfrom
alvrs/subsystem-call
Oct 3, 2023
Merged

feat(world-modules): add SystemSwitch util#1665
alvrs merged 8 commits into
mainfrom
alvrs/subsystem-call

Conversation

@alvrs

@alvrs alvrs commented Sep 29, 2023

Copy link
Copy Markdown
Member
  • util for better ergonomics of calling systems from other systems

@changeset-bot

changeset-bot Bot commented Sep 29, 2023

Copy link
Copy Markdown

🦋 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;

@frolic frolic Sep 29, 2023

Copy link
Copy Markdown
Member

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

vercel Bot commented Oct 3, 2023

Copy link
Copy Markdown

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

@alvrs
alvrs marked this pull request as ready for review October 3, 2023 11:54
Comment thread .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, ());

@frolic frolic Oct 3, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

frolic
frolic previously approved these changes Oct 3, 2023
@frolic

frolic commented Oct 3, 2023

Copy link
Copy Markdown
Member

since we've had a few folks ask about this, we should prob get @qbzzt to add a docs page about systems-calling-systems

Comment thread .changeset/modern-stingrays-kneel.md Outdated
Comment thread .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.

Copy link
Copy Markdown
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
Copy Markdown
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 +

Comment thread .changeset/modern-stingrays-kneel.md Outdated
@alvrs
alvrs merged commit 9352648 into main Oct 3, 2023
@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.

2 participants