Git Source

Author: @mpetersoCode55, @ShaneDuncan602, @TJ-Everett, @VoR0220

SPDX-License-Identifier: BUSL-1.1

This library is a critical component for handling foreign call return values in the Rules Engine.

This library provides utility functions for decoding foreign call return values into their respective data types. It ensures that the return values are properly decoded based on their parameter types (PT) as defined in the Rules Engine Storage Structure. The library is designed to work with the Rules Engine’s foreign call functionality.

Functions

getFCAddress

Decodes a foreign call return value into an address.

Ensures that the parameter type is PT.ADDR before decoding.

function getFCAddress(ForeignCallReturnValue memory retVal) internal pure returns (address);

Parameters

NameTypeDescription
retValForeignCallReturnValueThe foreign call return value to decode.

Returns

NameTypeDescription
<none>addressaddress The decoded address.

getFCString

Decodes a foreign call return value into a string.

Ensures that the parameter type is PT.STR before decoding.

function getFCString(ForeignCallReturnValue memory retVal) internal pure returns (string memory);

Parameters

NameTypeDescription
retValForeignCallReturnValueThe foreign call return value to decode.

Returns

NameTypeDescription
<none>stringstring The decoded string.

getFCUint

Decodes a foreign call return value into a uint256.

Ensures that the parameter type is PT.UINT before decoding.

function getFCUint(ForeignCallReturnValue memory retVal) internal pure returns (uint256);

Parameters

NameTypeDescription
retValForeignCallReturnValueThe foreign call return value to decode.

Returns

NameTypeDescription
<none>uint256uint256 The decoded unsigned integer.

getFCBool

Decodes a foreign call return value into a boolean.

Ensures that the parameter type is PT.BOOL before decoding.

function getFCBool(ForeignCallReturnValue memory retVal) internal pure returns (bool);

Parameters

NameTypeDescription
retValForeignCallReturnValueThe foreign call return value to decode.

Returns

NameTypeDescription
<none>boolbool The decoded boolean value.