Oracles provide attestation to the system to facilitate unlocking of funds when intended conditions are met. The oracle is currently run as a TEE based service with decentralized oracles being currently developed.
Implementation
The oracle implements the following oracle interface, expected by the CCD:
interface IFabriqOracle {// expected to return true if and only if the order has been filled // correctly on its target chainfunctionisFilled(bytes32 intentHash) externalreturns (bool);// called by the CCD when the order is first initialized// can be used to implement an optimistic oracle with a challenge periodfunctioninitIntent(bytes32 intentHash) external;}
The current oracle contract implementation:
import { AccessControl } from"@openzeppelin-contracts-4.9.6/access/AccessControl.sol";import { IFabriqOracle } from"./interfaces/IFabriqOracle.sol";contractPermissionedOracleisIFabriqOracle, AccessControl {bytes32publicconstant OPERATOR_ROLE =keccak256("OPERATOR");mapping(bytes32=>bool) public filledOrders;constructor(address admin,address operator ) {_setupRole(DEFAULT_ADMIN_ROLE, admin);_setupRole(OPERATOR_ROLE, operator); }functionisFilled(bytes32 intentHash) publicviewreturns (bool) {return filledOrders[intentHash]; }functionupdate(bytes32 intentHash) publiconlyRole(OPERATOR_ROLE) { filledOrders[intentHash] =true; }// not needed here because there is no challenge periodfunctioninitIntent(bytes32) publicpure {}}