FCEncodingLib
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.
Parameters
Name | Type | Description |
---|---|---|
retVal | ForeignCallReturnValue | The foreign call return value to decode. |
Returns
Name | Type | Description |
---|---|---|
<none> | address | address The decoded address. |
getFCString
Decodes a foreign call return value into a string.
Ensures that the parameter type is PT.STR
before decoding.
Parameters
Name | Type | Description |
---|---|---|
retVal | ForeignCallReturnValue | The foreign call return value to decode. |
Returns
Name | Type | Description |
---|---|---|
<none> | string | string The decoded string. |
getFCUint
Decodes a foreign call return value into a uint256.
Ensures that the parameter type is PT.UINT
before decoding.
Parameters
Name | Type | Description |
---|---|---|
retVal | ForeignCallReturnValue | The foreign call return value to decode. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | uint256 The decoded unsigned integer. |
getFCBool
Decodes a foreign call return value into a boolean.
Ensures that the parameter type is PT.BOOL
before decoding.
Parameters
Name | Type | Description |
---|---|---|
retVal | ForeignCallReturnValue | The foreign call return value to decode. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool The decoded boolean value. |