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-module-erc20): new ERC20 World Module #3300

Merged
merged 25 commits into from
Oct 21, 2024
Merged

feat(world-module-erc20): new ERC20 World Module #3300

merged 25 commits into from
Oct 21, 2024

Conversation

vdrg
Copy link
Contributor

@vdrg vdrg commented Oct 16, 2024

No description provided.

Copy link

changeset-bot bot commented Oct 16, 2024

🦋 Changeset detected

Latest commit: e44b98b

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

This PR includes changesets to release 25 packages
Name Type
@latticexyz/world-module-erc20 Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/cli Patch
@latticexyz/common Patch
@latticexyz/config Patch
create-mud Patch
@latticexyz/dev-tools Patch
@latticexyz/explorer Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/protocol-parser Patch
@latticexyz/react Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/stash Patch
@latticexyz/store-indexer Patch
@latticexyz/store-sync Patch
@latticexyz/store Patch
@latticexyz/utils Patch
@latticexyz/world-module-metadata Patch
@latticexyz/world-modules Patch
@latticexyz/world Patch

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

Copy link
Member

@alvrs alvrs left a comment

Choose a reason for hiding this comment

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

overall very nice, very excited about this!

.changeset/giant-birds-argue.md Outdated Show resolved Hide resolved
packages/world-module-erc20/README.md Outdated Show resolved Hide resolved
packages/world-module-erc20/README.md Outdated Show resolved Hide resolved
packages/world-module-erc20/README.md Outdated Show resolved Hide resolved
packages/world-module-erc20/ts/exports/index.ts Outdated Show resolved Hide resolved
packages/world-module-erc20/src/Pausable.sol Outdated Show resolved Hide resolved
packages/world-module-erc20/src/Pausable.sol Outdated Show resolved Hide resolved
packages/world-module-erc20/src/StoreConsumer.sol Outdated Show resolved Hide resolved
Comment on lines 55 to 54
if (!ResourceAccess.get(getNamespaceId(), sender)) {
revert CallerHasNoNamespaceAccess();
}
Copy link
Member

Choose a reason for hiding this comment

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

could technically reuse the AccessControl library here:

function requireAccess(ResourceId resourceId, address caller) internal view {
// Check if the given caller has access to the given namespace or name
if (!hasAccess(resourceId, caller)) {
revert IWorldErrors.World_AccessDenied(resourceId.toString(), caller);
}
}

Copy link
Contributor Author

@vdrg vdrg Oct 18, 2024

Choose a reason for hiding this comment

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

but this would make it harder to see where the error comes from 🤔 I'm fine with either, which ever is more standard across the codebase

packages/world-module-erc20/src/StoreConsumer.sol Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview – explorer October 18, 2024 12:05 Inactive
@vercel vercel bot temporarily deployed to Preview – explorer October 18, 2024 12:05 Inactive
@vercel vercel bot temporarily deployed to Preview – explorer October 18, 2024 12:06 Inactive
@vercel vercel bot temporarily deployed to Preview – explorer October 18, 2024 12:07 Inactive
@vercel vercel bot temporarily deployed to Preview – explorer October 18, 2024 12:09 Inactive
@vercel vercel bot temporarily deployed to Preview – explorer October 18, 2024 12:10 Inactive
@vdrg vdrg changed the title feat(world-module-erc20): New ERC20 World Module feat(world-module-erc20): new ERC20 World Module Oct 18, 2024
@vdrg vdrg marked this pull request as ready for review October 18, 2024 14:09
@vercel vercel bot temporarily deployed to Preview – explorer October 18, 2024 14:10 Inactive
.changeset/giant-birds-argue.md Outdated Show resolved Hide resolved
packages/world-module-erc20/README.md Show resolved Hide resolved
packages/world-module-erc20/gas-report.json Outdated Show resolved Hide resolved
Comment on lines +11 to +17
function namespaceId() internal pure returns (ResourceId) {
return WorldResourceIdLib.encodeNamespace(NAMESPACE);
}

function registryTableId() internal pure returns (ResourceId) {
return WorldResourceIdLib.encode(RESOURCE_TABLE, NAMESPACE, REGISTRY_TABLE_NAME);
}
Copy link
Member

Choose a reason for hiding this comment

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

If these are only used during the installation leaving and not when interacting with the token it's fine to leave as is!

packages/world-module-erc20/src/StoreConsumer.sol Outdated Show resolved Hide resolved
…s report depending on internal store vs world
@vercel vercel bot temporarily deployed to Preview – explorer October 21, 2024 19:48 Inactive
@vdrg vdrg merged commit 23e6a6c into main Oct 21, 2024
13 checks passed
@vdrg vdrg deleted the vdrg/erc20-module branch October 21, 2024 20:53
symbol: string;
};

export function defineERC20Config({ namespace, name, symbol }: DefineERC20ConfigInput) {
Copy link
Member

@holic holic Oct 22, 2024

Choose a reason for hiding this comment

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

how about defineERC20Module since it returns module input?

and can we specify the return type here so we know we're always getting config-compatible module input

export function defineERC20Module(...): Module

Copy link
Member

@holic holic Oct 22, 2024

Choose a reason for hiding this comment

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

we should save this file for doing the exports, not where the logic lives

so I would move this file to ts/defineERC20Module.ts then this file becomes

export { defineERC20Module } from "../defineERC20Module";

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.

3 participants