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

docs: prettier #1213

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/pages/world/world-101.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,19 @@ Now we can import our new table, and write something to it. Let’s write a func
pragma solidity >=0.8.0;
import { System } from "@latticexyz/world/src/System.sol";
import { Dog, DogData } from "../codegen/tables/Dog.sol"; // import table we created

contract MySystem is System {
function addEntry(string memory name, string memory color) public returns (bytes32) {
bytes32 key = bytes32(abi.encodePacked(block.number, msg.sender, gasleft())); // creating a random key for the record
address owner = _msgSender(); // IMPORTANT: always refer to the msg.sender using the _msgSender() function
Dog.set(key, DogData({owner: owner, name: name, color: color})); // creating our record!
Dog.set(key, DogData({ owner: owner, name: name, color: color })); // creating our record!
return key;
}
}
```

That’s it! `MySystem`, just like `IncrementSystem`, will have access to Dog given they are in the same namespace.


We can run `pnpm mud worldgen` in the contract folder to recreate the systems.

```bash
Expand Down