World
Reference
Internals
SystemCall

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

Usage Sample

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

NameTypeDescription
calleraddressThe address initiating the system call.
valueuint256The amount of Ether to be sent with the call.
systemIdResourceIdThe unique Resource ID of the system being called.
callDatabytesThe calldata to be executed in the system.

Returns

NameTypeDescription
successboolA flag indicating whether the system call was successful.
databytesThe return data from the system call.

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

NameTypeDescription
calleraddressThe address initiating the system call.
systemIdResourceIdThe unique Resource ID of the system being called.
callDatabytesThe calldata to be executed in the system.
valueuint256The amount of Ether to be sent with the call.

Returns

NameTypeDescription
successboolA flag indicating whether the system call was successful.
databytesThe 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

NameTypeDescription
calleraddressThe address initiating the system call.
systemIdResourceIdThe unique Resource ID of the system being called.
callDatabytesThe calldata to be executed in the system.
valueuint256The amount of Ether to be sent with the call.

Returns

NameTypeDescription
databytesThe return data from the system call.