> For the complete documentation index, see [llms.txt](https://docs.fabriq.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fabriq.network/the-protocol/architecture/oracles.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
