Ethereum Data Oracle

Fetch arbitrary data from other chains.

This feature is in beta, so please fill out this form to get in touch with the Succinct team about using it.

The Telepathy Ethereum data oracle allows developers to trustlessly request data from Ethereum Mainnet on **** any other chain. This can be useful, for example, to obtain data that makes cross-chain airdrops or cross-chain ENS name usage possible.

Requesting Data

1) To request data from a different chain, you simply call the oracle.requestCrossChain function. Here is an example of requesting the ERC721.ownerOf function for mainnet.

telepathyOracle.requestCrossChain(
    address(mainnetContractAddress),
    abi.encodeWithSelector(IERC721.ownerOf.selector, _tokenId),
    address(myCallbackAddress)
);

2) To process the data that the oracle returns, you will want to extend the OracleCallbackBase contract and implement the handleOracleResponse function. The base contract ensures that the function is only called on a valid response message.

abstract contract OracleCallbackBase is IOracleCallbackReceiver {
    error NotFromOracle(address sender);

    address private _oracle;

    constructor(address oracle) {
        _oracle = oracle;
    }

    function rawHandleOracleResponse(
        uint256 nonce,
        bytes memory responseData,
        bool responseSuccess
    ) external override {
        if (msg.sender != _oracle) {
            revert NotFromOracle(msg.sender);
        }
        handleOracleResponse(nonce, responseData, responseSuccess);
    }

    function handleOracleResponse(
        uint256 nonce,
        bytes memory responseData,
        bool responseSuccess
    ) internal virtual;
}

Ethereum Data Oracle is currently in an experimental state. For updates and assistence, please join our Discord.

Last updated