# Oracles

\[Note: code to be released]

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:

```solidity
interface IFabriqOracle {
  // expected to return true if and only if the order has been filled 
  // correctly on its target chain
  function isFilled(bytes32 intentHash) external returns (bool);
  
  // called by the CCD when the order is first initialized
  // can be used to implement an optimistic oracle with a challenge period
  function initIntent(bytes32 intentHash) external;
}
```

The current oracle contract implementation:

```solidity
import { AccessControl } from "@openzeppelin-contracts-4.9.6/access/AccessControl.sol";
import { IFabriqOracle } from "./interfaces/IFabriqOracle.sol";

contract PermissionedOracle is IFabriqOracle, AccessControl {
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR");
    mapping(bytes32 => bool) public filledOrders;

    constructor(
        address admin,
        address operator
    ) {
        _setupRole(DEFAULT_ADMIN_ROLE, admin);
        _setupRole(OPERATOR_ROLE, operator);
    }

    function isFilled(bytes32 intentHash) public view returns (bool) {
        return filledOrders[intentHash];
    }

    function update(bytes32 intentHash) public onlyRole(OPERATOR_ROLE) {
        filledOrders[intentHash] = true;
    }

    // not needed here because there is no challenge period
    function initIntent(bytes32) public pure {}
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fabriq.network/the-protocol/architecture/oracles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
