Funding a Feed

Quickstart

  1. Use our fund-a-feed tool to specify your pair, and fund the request

  2. Chill

Funding a one time request

To tip a queryID for an instant report (whoever submits the value next gets the reward), you just need to run one function:

/**
 * @dev Function to run a single tip
 * @param _queryId id of tipped data
 * @param _amount amount to tip
 * @param _queryData the data used by reporters to fulfill the query
*/
function tip(
    bytes32 _queryId,
    uint256 _amount,
    bytes calldata _queryData
) external 

be sure to approve the transfer of TRB before you call the function.

Funding a recurring data feed

To fund a data feed, you will need to run two functions, one to set up the feed and the other to fund it. If a fund is already set up with your specifications, you can simply call the function to fund it.

To set up your data feed:

As an example, if on Polygon you want to tip 1 TRB token each hour for the spot BTC price. You need it every hour, starting tomorrow, and you need it updated within 5 minutes of the hour.

To fund the feed:

The _feedId is simply the keccak256 has of the variables defined in setupFeed:

The _amount is the amount of the token you would want to fund it with. For example, if you are tipping 1 TRB per hour, if you fund the feed with 24 TRB, it would pay out for the next 24 hours.

Be sure to approve the token transfer before calling this function.

Last updated