Configure Results
  • 04 Apr 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Configure Results

  • Dark
    Light
  • PDF

Article summary

In this step, you add the information of the Blockchain in which to publish the result of the job.

To complete this section, you need a Callback contract address and method. So you need a deployed Smart Contract.
If you want guidance on "how to generate" one, please use the contract generator on the job page in the results section. Remember to copy the contract and deploy it with your preferred IDE. Once deployed, you will have the contract address, and you can fill in all the required fields.

Every user can specify what to do in case of failure or success. By default, Silent Data [Oracle] will publish on the chain only in the case of success of the attestation steps. See mandatory fields in the picture below.

Screenshot 2024-03-21 at 14.27.08.png

Figure 1 Create a job - Job details page - Results


In Silent Data [Oracle], the users can define and configure the behavior of the results of their job. This follows the information to provide, how to be interpreted by the enclave and what direction the Smart Contract will receive.

The mandatory fields are the behaviour of the success of the job, and what should happen if the job arrives at the end. As previously mentioned, the user can also define the Failure behaviour, but this is completely optional.


The fields to fill in are:

Blockchain: Polygon or Sepolia
Success:
Contract address: set your deployed Callback contract address. Example of a smart contract address: "0x1c8c6ffd8896a2d39a9e33ac10c1d5c4623bc236" ( Do not use it)
Contract Method: here add the method defined on the contract for the callback. Example:"CallBack".

Tip: if you add the contract method and arguments of the callback contract and click on "GENERATE SMART CONTRACT CALLBACK EXAMPLE" the system will show you the smart contract to copy and deploy to receive the result of Silent Data Directly on your dApp.

Screenshot 2024-03-21 at 14.33.02.png

The Smart Callback contract generated is the following:

//Example of callback smart contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

// Use openzeppelin library to improve contract security
import "@openzeppelin/contracts/access/Ownable.sol";

contract CallbackContract is Ownable {
  address public resultsContract;

  // Modifier to ensure only resultsContract can call the method
  modifier onlyResultsContract() {
    require(msg.sender == resultsContract, "Caller is not the Results contract");
    _;
  }

  // Edit the funding contract address, callable by the contract deployer
  function setResultsContract(address _resultsContract) external onlyOwner {
    resultsContract = _resultsContract;
  }

  // Implement logic to be executed as the result of the SilentData Job
  function CallBack(address arg1) public onlyResultsContract {
    // Your implementation here
  }
}

For your Callback contract, you will need to set the Result contract address, look into the dedicated page Smart Contracts Addresses per Network for the list of addresses per network and environment (please carefully select the one you need).

For the failure panel, you can also optionally add arguments that they want to see on the chain. Be aware, this information will be shared on the selected public chain, so do not add sensitive data that should not be visible to the public.


Was this article helpful?

What's Next