Skip to content

Commit

Permalink
docs: add author to natspec (#2333)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <[email protected]>
  • Loading branch information
yonadaaa and holic authored Feb 28, 2024
1 parent 771fa4a commit a2e9932
Show file tree
Hide file tree
Showing 118 changed files with 207 additions and 62 deletions.
4 changes: 2 additions & 2 deletions docs/pages/store/reference/misc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1618,9 +1618,9 @@ bytes2 constant RESOURCE_OFFCHAIN_TABLE = "ot";

#### STORE_VERSION

Contains a constant representing the version of the store.
Contains a constant representing the version of the Store.

_Identifier for the current store version._
_Identifier for the current Store version._

```solidity
bytes32 constant STORE_VERSION = "1.0.0-unaudited";
Expand Down
4 changes: 1 addition & 3 deletions docs/pages/store/reference/store.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,7 @@ function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple) external;

[Git Source](https://github.com/latticexyz/mud/blob/main/packages/store/src/IStoreRegistration.sol)

The IStoreRegistration interface includes methods for managing table field layouts,
metadata, and hooks, which are usually called once in the setup phase of an application,
making them less performance critical than the methods.
_This interface includes methods for managing table field layouts, metadata, and hooks, which are usually called once in the setup phase of an application, making them less performance critical than the methods._

### Functions

Expand Down
4 changes: 0 additions & 4 deletions docs/pages/world/reference/internal/erc165.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,8 @@ function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) i

[Git Source](https://github.com/latticexyz/mud/blob/main/packages/world/src/requireInterface.sol)

Utility function to validate interface support on a given contract using ERC-165.

Checks if a given contract at `contractAddress` supports the interface with ID `interfaceId`.

_This function uses the ERC-165 standard's `supportsInterface` to check if a given contract supports a specific interface._

_Uses the ERC-165 `supportsInterface` method. If the contract doesn't support the interface or doesn't implement ERC-165, the function will revert with a relevant error message._

```solidity
Expand Down
10 changes: 3 additions & 7 deletions docs/pages/world/reference/misc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,8 @@ ResourceId constant UNLIMITED_DELEGATION = ResourceId.wrap(

[Git Source](https://github.com/latticexyz/mud/blob/main/packages/world/src/revertWithBytes.sol)

Utility function to revert transactions with raw bytes.

Reverts the transaction using the provided raw bytes as the revert reason.

_This can be especially useful when reverting with a message obtained from a low-level call or a pre-encoded error._

_Uses assembly to perform the revert operation with the raw bytes._

```solidity
Expand All @@ -103,9 +99,9 @@ function revertWithBytes(bytes memory reason) pure;

#### WORLD_VERSION

_World Version Constant
Defines the version identifier for the World contract or module.
This version identifier can be used for version checks, logging, and more._
Contains a constant representing the version of the World.

_Identifier for the current World version._

```solidity
bytes32 constant WORLD_VERSION = "1.0.0-unaudited";
Expand Down
6 changes: 1 addition & 5 deletions docs/pages/world/reference/resource-ids.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,7 @@ function toTrimmedString(bytes16 paddedString) internal pure returns (string mem

#### RESOURCE_NAMESPACE

_World Resource Types_

_Constants related to World Resource Types and Masks._

_These constants are used to represent various resource types within the system._
_Constants used to work with world resource types._

```solidity
bytes2 constant RESOURCE_NAMESPACE = "ns";
Expand Down
5 changes: 0 additions & 5 deletions docs/pages/world/reference/world-context-external.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ This contract is designed to extract trusted context values (like msg.sender and
from the appended calldata. It provides mechanisms similar to EIP-2771 (https://eips.ethereum.org/EIPS/eip-2771),
but allowing any contract to be the trusted forwarder.

_World Context Consumer Interface
This interface defines the functions a contract needs to consume the world context.
It includes helper functions to retrieve the message sender, value, and world address.
Additionally, it integrates with the ERC-165 standard for interface detection._

_This contract should only be used for contracts without their own storage, like Systems._

### Functions
Expand Down
2 changes: 2 additions & 0 deletions docs/pages/world/reference/world-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ uint256 constant CONTEXT_BYTES = 20 + 32;

[Git Source](https://github.com/latticexyz/mud/blob/main/packages/world/src/WorldContext.sol)

Helpers for working with data in the context of calling a World

### Functions

#### \_msgSender
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions e2e/packages/contracts/src/codegen/world/INumberSystem.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions e2e/packages/contracts/src/codegen/world/IVectorSystem.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions e2e/packages/contracts/src/codegen/world/IWorld.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/store/src/Bytes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity >=0.8.24;

/**
* @title Bytes
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @notice Utility functions for bytes.
*/
library Bytes {
Expand Down
3 changes: 3 additions & 0 deletions packages/store/src/FieldLayout.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { WORD_SIZE, WORD_LAST_INDEX, BYTE_TO_BITS, MAX_TOTAL_FIELDS, MAX_DYNAMIC

/**
* @title FieldLayout
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev Represents a field layout encoded into a single bytes32.
* From left to right, the bytes are laid out as follows:
* - 2 bytes for total length of all static fields
Expand All @@ -20,6 +21,7 @@ using FieldLayoutInstance for FieldLayout global;

/**
* @title FieldLayoutLib
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev A library for handling field layout encoding into a single bytes32.
* It provides a function to encode static and dynamic fields and ensure
* various constraints regarding the length and size of the fields.
Expand Down Expand Up @@ -82,6 +84,7 @@ library FieldLayoutLib {

/**
* @title FieldLayoutInstance
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev Provides instance functions for obtaining information from an encoded FieldLayout.
*/
library FieldLayoutInstance {
Expand Down
2 changes: 2 additions & 0 deletions packages/store/src/Hook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ using HookInstance for Hook global;

/**
* @title HookLib
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev Library for encoding hooks and filtering hooks from a list by address.
*/
library HookLib {
Expand Down Expand Up @@ -67,6 +68,7 @@ library HookLib {

/**
* @title HookInstance
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev Library for interacting with Hook instances.
**/
library HookInstance {
Expand Down
8 changes: 7 additions & 1 deletion packages/store/src/IStore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ import { IStoreErrors } from "./IStoreErrors.sol";
import { IStoreData } from "./IStoreData.sol";
import { IStoreRegistration } from "./IStoreRegistration.sol";

interface IStore is IStoreData, IStoreRegistration, IStoreErrors {}
/**
* @title IStore
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
*/
interface IStore is IStoreData, IStoreRegistration, IStoreErrors {

}
1 change: 1 addition & 0 deletions packages/store/src/IStoreData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { IStoreWrite } from "./IStoreWrite.sol";

/**
* @title IStoreData
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @notice The IStoreData interface includes methods for reading and writing table values.
* @dev These methods are frequently invoked during runtime, so it is essential to prioritize optimizing their gas cost.
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/store/src/IStoreEvents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pragma solidity >=0.8.24;
import { ResourceId } from "./ResourceId.sol";
import { PackedCounter } from "./PackedCounter.sol";

/**
* @title IStoreEvents
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
*/
interface IStoreEvents {
/**
* @notice Emitted when a new record is set in the store.
Expand Down
4 changes: 4 additions & 0 deletions packages/store/src/IStoreHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { IERC165 } from "./IERC165.sol";
import { PackedCounter } from "./PackedCounter.sol";
import { ResourceId } from "./ResourceId.sol";

/**
* @title IStoreHook
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
*/
interface IStoreHook is IERC165 {
/// @notice Error emitted when a function is not implemented.
error StoreHook_NotImplemented();
Expand Down
4 changes: 4 additions & 0 deletions packages/store/src/IStoreRead.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { FieldLayout } from "./FieldLayout.sol";
import { Schema } from "./Schema.sol";
import { ResourceId } from "./ResourceId.sol";

/**
* @title IStoreRead
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
*/
interface IStoreRead {
function getFieldLayout(ResourceId tableId) external view returns (FieldLayout fieldLayout);

Expand Down
6 changes: 3 additions & 3 deletions packages/store/src/IStoreRegistration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { IStoreHook } from "./IStoreHook.sol";
import { ResourceId } from "./ResourceId.sol";

/**
* The IStoreRegistration interface includes methods for managing table field layouts,
* metadata, and hooks, which are usually called once in the setup phase of an application,
* making them less performance critical than the methods.
* @title IStoreRegistration
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev This interface includes methods for managing table field layouts, metadata, and hooks, which are usually called once in the setup phase of an application, making them less performance critical than the methods.
*/
interface IStoreRegistration {
function registerTable(
Expand Down
4 changes: 4 additions & 0 deletions packages/store/src/IStoreWrite.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { PackedCounter } from "./PackedCounter.sol";
import { FieldLayout } from "./FieldLayout.sol";
import { ResourceId } from "./ResourceId.sol";

/**
* @title IStoreWrite
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
*/
interface IStoreWrite is IStoreEvents {
// Set full record (including full dynamic data)
function setRecord(
Expand Down
1 change: 1 addition & 0 deletions packages/store/src/Memory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { rightMask } from "./rightMask.sol";

/**
* @title Memory Operations
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @notice A library for performing low-level memory operations.
* @dev This library provides low-level memory operations with safety checks.
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/store/src/PackedCounter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { BYTE_TO_BITS } from "./constants.sol";

/**
* @title PackedCounter Type Definition
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev Describes how the packed counter is structured.
* - 0x00-0x06 The least significant 7 bytes (uint56) represent the total byte length of dynamic (variable length) data.
* - 0x07-0xB The next five bytes (uint40) represent the length of the first dynamic field.
Expand All @@ -28,6 +29,7 @@ uint256 constant MAX_VAL = type(uint40).max;

/**
* @title PackedCounter Library
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @notice Static functions for handling PackedCounter type.
* @dev Provides utility functions to pack values into a PackedCounter.
* The caller must ensure that the value arguments are <= MAX_VAL.
Expand Down Expand Up @@ -132,6 +134,7 @@ library PackedCounterLib {

/**
* @title PackedCounter Instance Library
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @notice Instance functions for handling a PackedCounter.
* @dev Offers decoding, extracting, and setting functionalities for a PackedCounter.
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/store/src/ResourceId.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity >=0.8.24;

/**
* @title ResourceId type definition and related utilities
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev A ResourceId is a bytes32 data structure that consists of a
* type and a name
*/
Expand All @@ -15,6 +16,7 @@ uint256 constant TYPE_BITS = 2 * 8; // 2 bytes * 8 bits per byte

/**
* @title ResourceIdLib Library
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev Provides functions to encode data into the ResourceId
*/
library ResourceIdLib {
Expand All @@ -31,6 +33,7 @@ library ResourceIdLib {

/**
* @title ResourceIdInstance Library
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev Provides functions to extract data from a ResourceId.
*/
library ResourceIdInstance {
Expand Down
Loading

0 comments on commit a2e9932

Please sign in to comment.