An app calling Goracle feeds generally is compromised of 2 key methods:
- Request Method
- Destination Callback
The Goracle template defines a send_request
method that encodes a standard Goracle API request. The Key components of the request include:
- The parameters of the API call
- The GORA asset and main contract references
The template sets the above up for you. If you would like to call a specific feed, take a look at the Feed Examples which will show you examples of the type of data returned by each feed. You may modify this file to receive the type of specific data you would like. To explore the types of data available on testnet and mainnet, you may use the Goracle Data Explorer to browse feeds and returned values.
Note: For a full understanding of making requests, please visit the API Documentation.
When making a call to the Goracle network, a smart contract must specify the callback method (and any option user data that will be passed back).
In the Goracle template, the write_to_data_box
defines the callback method, and does some basic checks (e.g. verifying it is being called by the Goracle voting contracts). The call back method allows you to write trigger any logic you want to do with the returned data.
In localnet, a dummy node network is provided that will always reach consensus, and always return the data in the Feed Examples file.
In testnet and beyond, smart contract will make calls to a network of nodes, and Gas will be required to be paid.
For any questions on implementing the Goracle data feeds, reach out in the discord developer channel