forked from latticexyz/mud
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add example for multiple namespaces (latticexyz#2891)
- Loading branch information
Showing
23 changed files
with
1,588 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This .env file is for demonstration purposes only. | ||
# | ||
# This should usually be excluded via .gitignore and the env vars attached to | ||
# your deployment enviroment, but we're including this here for ease of local | ||
# development. Please do not commit changes to this file! | ||
# | ||
# Anvil default private key: | ||
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | ||
FAUCET_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | ||
RPC_HTTP_URL=http://127.0.0.1:8545 | ||
DEBUG=mud:* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
out/ | ||
cache/ | ||
node_modules/ | ||
bindings/ | ||
artifacts/ | ||
broadcast/ | ||
|
||
# Ignore MUD deploy artifacts | ||
deploys/**/*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": ["solhint:recommended", "mud"], | ||
"plugins": ["mud"], | ||
"rules": { | ||
"compiler-version": ["error", ">=0.8.0"], | ||
"avoid-low-level-calls": "off", | ||
"no-inline-assembly": "off", | ||
"func-visibility": ["warn", { "ignoreConstructors": true }], | ||
"no-empty-blocks": "off", | ||
"no-complex-fallback": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[profile.default] | ||
solc = "0.8.24" | ||
ffi = false | ||
fuzz_runs = 256 | ||
optimizer = true | ||
optimizer_runs = 3000 | ||
verbosity = 2 | ||
src = "src" | ||
test = "test" | ||
out = "out" | ||
allow_paths = [ | ||
# pnpm symlinks to the project root's node_modules | ||
"../../node_modules", | ||
# we're also using linked mud packages from the monorepo | ||
"../../../../packages" | ||
] | ||
extra_output_files = [ | ||
"abi", | ||
"evm.bytecode" | ||
] | ||
fs_permissions = [{ access = "read", path = "./"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { defineWorld } from "@latticexyz/world"; | ||
|
||
export default defineWorld({ | ||
namespace: "game", | ||
codegen: { namespaceDirectories: true }, | ||
tables: { | ||
Health: { | ||
schema: { | ||
player: "address", | ||
value: "uint32", | ||
}, | ||
key: ["player"], | ||
}, | ||
Position: { | ||
schema: { | ||
player: "address", | ||
x: "int32", | ||
y: "int32", | ||
}, | ||
key: ["player"], | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "mud-example-multiple-namespaces", | ||
"private": true, | ||
"scripts": { | ||
"build": "mud build", | ||
"clean": "forge clean && rimraf src/codegen", | ||
"deploy:local": "mud deploy", | ||
"dev": "mud dev-contracts", | ||
"faucet": "DEBUG=mud:faucet faucet-server", | ||
"lint": "pnpm run prettier && pnpm run solhint", | ||
"prettier": "prettier --write 'src/**/*.sol'", | ||
"solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix", | ||
"test": "mud test" | ||
}, | ||
"devDependencies": { | ||
"@latticexyz/cli": "link:../../packages/cli", | ||
"@latticexyz/faucet": "link:../../packages/faucet", | ||
"@latticexyz/schema-type": "link:../../packages/schema-type", | ||
"@latticexyz/store": "link:../../packages/store", | ||
"@latticexyz/world": "link:../../packages/world", | ||
"@latticexyz/world-modules": "link:../../packages/world-modules", | ||
"@solidstate/contracts": "^0.0.52", | ||
"@types/node": "^18.15.11", | ||
"ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", | ||
"forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", | ||
"prettier": "3.2.5", | ||
"prettier-plugin-solidity": "1.3.1", | ||
"rimraf": "^3.0.2", | ||
"solhint": "^3.4.1", | ||
"solhint-config-mud": "file:../../packages/solhint-config-mud", | ||
"solhint-plugin-mud": "file:../../packages/solhint-plugin-mud", | ||
"ts-node": "^10.9.1", | ||
"typescript": "5.4.2" | ||
} | ||
} |
Oops, something went wrong.