Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vdrg committed Nov 22, 2024
1 parent 2704687 commit b08c183
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
55 changes: 55 additions & 0 deletions docs/pages/world/reference/internal/systemcall.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,61 @@ function call(
| `success` | `bool` | A flag indicating whether the system call was successful. |
| `data` | `bytes` | The return data from the system call. |

#### staticcall

Makes a staticcall to a system identified by its Resource ID while ensuring necessary access controls.

_This function does not revert if the system staticcall fails. Instead, it returns a success flag._

```solidity
function staticcall(
address caller,
ResourceId systemId,
bytes memory callData
) internal view returns (bool success, bytes memory data);
```

**Parameters**

| Name | Type | Description |
| ---------- | ------------ | -------------------------------------------------- |
| `caller` | `address` | The address initiating the system staticcall. |
| `systemId` | `ResourceId` | The unique Resource ID of the system being called. |
| `callData` | `bytes` | The calldata to be executed in the system. |

**Returns**

| Name | Type | Description |
| --------- | ------- | --------------------------------------------------------------- |
| `success` | `bool` | A flag indicating whether the system staticcall was successful. |
| `data` | `bytes` | The return data from the system staticcall. |

#### staticcallOrRevert

Makes a staticcall to a system identified by its Resource ID, ensures access controls, and reverts on failure.

```solidity
function staticcallOrRevert(
address caller,
ResourceId systemId,
bytes memory callData
) internal view returns (bytes memory data);
```

**Parameters**

| Name | Type | Description |
| ---------- | ------------ | -------------------------------------------------- |
| `caller` | `address` | The address initiating the system staticcall. |
| `systemId` | `ResourceId` | The unique Resource ID of the system being called. |
| `callData` | `bytes` | The calldata to be executed in the system. |

**Returns**

| Name | Type | Description |
| ------ | ------- | ------------------------------------------- |
| `data` | `bytes` | The return data from the system staticcall. |

#### callWithHooks

Calls a system identified by its Resource ID, ensuring access controls, and triggers associated system hooks.
Expand Down
27 changes: 27 additions & 0 deletions docs/pages/world/reference/world-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,33 @@ function callWithContext(
| `success` | `bool` | A boolean indicating whether the call was successful or not. |
| `data` | `bytes` | The abi encoded return data from the call. |

#### staticcallWithContext

Makes a staticcall to the target contract with context values appended to the calldata.

```solidity
function staticcallWithContext(
address msgSender,
address target,
bytes memory callData
) internal view returns (bool success, bytes memory data);
```

**Parameters**

| Name | Type | Description |
| ----------- | --------- | -------------------------------------- |
| `msgSender` | `address` | The address of the transaction sender. |
| `target` | `address` | The address of the contract to call. |
| `callData` | `bytes` | The calldata for the staticcall. |

**Returns**

| Name | Type | Description |
| --------- | ------- | ------------------------------------------------------------------ |
| `success` | `bool` | A boolean indicating whether the staticcall was successful or not. |
| `data` | `bytes` | The abi encoded return data from the staticcall. |

#### delegatecallWithContext

Makes a delegatecall to the target contract with context values appended to the calldata.
Expand Down

0 comments on commit b08c183

Please sign in to comment.