From b08c183d2a04596beba1a2055ec1c69c08f231bb Mon Sep 17 00:00:00 2001 From: Vicente Dragicevic <3252614+vdrg@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:07:00 +0900 Subject: [PATCH] Update docs --- .../world/reference/internal/systemcall.mdx | 55 +++++++++++++++++++ docs/pages/world/reference/world-context.mdx | 27 +++++++++ 2 files changed, 82 insertions(+) diff --git a/docs/pages/world/reference/internal/systemcall.mdx b/docs/pages/world/reference/internal/systemcall.mdx index 2dafd8a466..f442c3ad21 100644 --- a/docs/pages/world/reference/internal/systemcall.mdx +++ b/docs/pages/world/reference/internal/systemcall.mdx @@ -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. diff --git a/docs/pages/world/reference/world-context.mdx b/docs/pages/world/reference/world-context.mdx index 512d8a7253..aca58289d0 100644 --- a/docs/pages/world/reference/world-context.mdx +++ b/docs/pages/world/reference/world-context.mdx @@ -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.