FCT_Controller

FCT_Controller.sol is a single, non-upgradable, non-replaceable, smart contract that act as a proxy for FCT engines.
It supports multiple implementations of the same interface by enabling interface versioning:
  • The controller is agnostic to the content and structure of the FCT (except the selector and version calldata)
  • The controller passes activation requests to the right FCT_Engine and the return values to the FCT_Actuator
FCT_Controller supports multiple actuators defined by the ACTUATOR_ROLE
The first 24 bytes of an activation call acts as an Id of the engine's function as follows: 4 bytes (function selector), 3 bytes (version), 25 bytes (reserved)
FCT_Controller.sol keeps track of executed FCTs, protects against double spending and enables recurrent execution.
FCT_Controller.sol secures the platform by checking the authenticity of an FCT_Engine implementation when FCT_Runner is getting requests to execute calls.

call id

The first 32 bytes of an activation call received from the FCT_Actuator. Structure: function_selector(4 bytes), version(3 bytes), reserved(25 bytes), not used(4 bytes)

activation id

Structure: function_selector(4 bytes), version(3 byte), reserved(25 bytes), nonce (4 bytes)

Main Functions

fallback

fallback() external
Implements the enhanced proxy and generates unique activation id for every FCT execution.
Nonce is a sequence number that represents activation per major version of a selector.

purge

function purge(bytes32 id, bytes32[] calldata messageHashes) external
Used by the FCT_Engine to delete old FCTs from the blockchain storage in order to save gas.

register

function register(
bytes32 id,
bytes32 dataHash,
MetaInput calldata meta
)
external
returns (bytes32 messageHash, uint256 newMeta, bytes32 newActivationId)
Used by the FCT_Engine to keep information about the executed FCT.

addTarget

function addEngine(address _engine) external onlyRole(TARGET_ROLE)
Used by the DAO to add a new version to one of the FCT_Engine implementations.

setEnsManager

function setEnsManager(address ensManager) external onlyRole(ENS_ROLE)
Used by the DAO to replace the FCT_ENS smart contract.

version

function version(bytes32 id) external view returns (bytes3)
Returns the engine version from an activation id.

engine

function engine(bytes32 id) public view returns (address)
Returns the address of the FCT_Engine for an activation id.

activationId

function activationId(bytes32 id) public view returns (bytes32)
Returns the activation id for a given call id

isExecuting

function isExecuting(bytes32 id) public view returns (bool)
Returns true when an activation id belongs to the current running FCT.

isExecutingFCT

function isExecutingFCT(bytes32 messageHash) external view returns (bool)
Returns true when a fct id (messageHash) belongs to the current running FCT.
​