SystemCall
Git Source (opens in a new tab)
The SystemCall library provides functions for interacting with systems using their unique Resource IDs. It ensures the necessary access control checks, handles system hooks, and performs system calls.
Functions
call
Calls a system identified by its Resource ID while ensuring necessary access controls.
This function does not revert if the system call fails. Instead, it returns a success flag.
function call(
address caller,
uint256 value,
ResourceId systemId,
bytes memory callData
) internal returns (bool success, bytes memory data);
Parameters
Name | Type | Description |
---|---|---|
caller | address | The address initiating the system call. |
value | uint256 | The amount of Ether to be sent with the call. |
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 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.
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.
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.
This function does not revert if the system call fails. Instead, it returns a success flag.
function callWithHooks(
address caller,
ResourceId systemId,
bytes memory callData,
uint256 value
) internal returns (bool success, bytes memory data);
Parameters
Name | Type | Description |
---|---|---|
caller | address | The address initiating the system call. |
systemId | ResourceId | The unique Resource ID of the system being called. |
callData | bytes | The calldata to be executed in the system. |
value | uint256 | The amount of Ether to be sent with the call. |
Returns
Name | Type | Description |
---|---|---|
success | bool | A flag indicating whether the system call was successful. |
data | bytes | The return data from the system call. |
callWithHooksOrRevert
Calls a system identified by its Resource ID, ensures access controls, triggers associated system hooks, and reverts on failure.
function callWithHooksOrRevert(
address caller,
ResourceId systemId,
bytes memory callData,
uint256 value
) internal returns (bytes memory data);
Parameters
Name | Type | Description |
---|---|---|
caller | address | The address initiating the system call. |
systemId | ResourceId | The unique Resource ID of the system being called. |
callData | bytes | The calldata to be executed in the system. |
value | uint256 | The amount of Ether to be sent with the call. |
Returns
Name | Type | Description |
---|---|---|
data | bytes | The return data from the system call. |