Skip to content

feat(world-modules): add ERC20 module#1789

Merged
alvrs merged 17 commits intomainfrom
alvrs/erc20
Nov 1, 2023
Merged

feat(world-modules): add ERC20 module#1789
alvrs merged 17 commits intomainfrom
alvrs/erc20

Conversation

@alvrs
Copy link
Member

@alvrs alvrs commented Oct 17, 2023

MUD-native ERC20 token

  • anyone can register a new ERC20 token into a world. The new token will be registered into a new namespace.
  • The "puppet" implements the ERC20 interface and emits the ERC20 events
  • All logic lives in the ERC20System
  • The ERC20System can be interacted with like a normal MUD system, including all MUD features (hooks, callFrom, access control, etc)

CleanShot 2023-10-18 at 21 31 59

@changeset-bot
Copy link

changeset-bot bot commented Oct 17, 2023

🦋 Changeset detected

Latest commit: b5dddc8

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

return MODULE_NAME;
}

function install(bytes memory args) public {
Copy link
Member

Choose a reason for hiding this comment

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

do we need an "already installed" check here?

@alvrs alvrs changed the title [WIP] ERC20 module feat(world-modules): add ERC20 module Oct 18, 2023
@alvrs alvrs changed the base branch from main to alvrs/puppet October 18, 2023 20:57
}

// Emit Transfer event on puppet
puppet().log(IERC20Events.Transfer.selector, _toBytes32(from), _toBytes32(to), abi.encode(value));
Copy link
Member

Choose a reason for hiding this comment

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

wtb solidity native encodeLog like encodeCall

Copy link
Member Author

Choose a reason for hiding this comment

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

we should open an EIP for that, would be nice for sure


function _requireDependencies() internal view {
// If the PuppetModule is not installed yet, install it
if (InstalledModules.get(PUPPET_MODULE_NAME, keccak256(new bytes(0))) == address(0)) {
Copy link
Member

@frolic frolic Nov 1, 2023

Choose a reason for hiding this comment

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

side note/not blocking: since we're starting to use this more, might be nice to lift this into Module as a helper function e.g. isInstalled() or isInstalled(module) and requireNotInstalled()

Copy link
Member Author

Choose a reason for hiding this comment

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

frolic
frolic previously approved these changes Nov 1, 2023
@alvrs alvrs mentioned this pull request Nov 1, 2023
Base automatically changed from alvrs/puppet to main November 1, 2023 14:08
@alvrs alvrs dismissed frolic’s stale review November 1, 2023 14:08

The base branch was changed.

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