Tellor Docs
Search…
Getting Paid
Listening for tips and checking for recurring payments.
The payments for tellor feeds are not held in the main tellor contract. Technically you can pay for Tellor feeds however you want (off-chain, recurring, hand shake agreements, etc.), however the trustless way to do this on-chain is to use the Autopay contract.
The autopay contract allows parties to fund Tellor data feeds or submit one-time tips to Tellor queryID's. For information on how to fund a queryID once or as a feed, check out the docs.
For most Tellor queryID's, the tellor token on the network will be the tipped token.

One time tips

Finding - Autopay contracts will emit an event:
1
event TipAdded(bytes32 _queryId, uint256 _amount, bytes _queryData, address _tipper);
Copied!
To see the current tip for any queryId, check:
1
/**
2
* @dev Getter function to current oneTime tip by queryId
3
* @param _queryId id of reported data
4
* @return amount of tip
5
*/
6
function getCurrentTip(bytes32 _queryId)
7
external
8
view
9
returns (uint256)
10
{
Copied!
Getting Payment - To get the payment for a one time tip, run:
1
/**
2
* @dev Function to claim singular tip
3
* @param _queryId id of reported data
4
* @param _timestamps ID of timestamps you reported for
5
*/
6
function claimOneTimeTip(
7
bytes32 _queryId,
8
uint256[] calldata _timestamps
9
) external {
Copied!
Note the timestamp array is so you can submit for many one time tips and just claim all of those tips at once.

Recurring data feeds

Finding - When a new feed is funded, the following event will emit:
1
event DataFeedFunded(bytes32 _queryId, bytes32 _feedId, uint256 _amount, address _feedFunder);
Copied!
To see all data feeds for a given queryID, check:
1
/**
2
* @dev Getter function to read current data feeds
3
* @param _queryId id of reported data
4
* @return feedIds array for queryId
5
*/
6
function getCurrentFeeds(bytes32 _queryId)
7
external
8
view
9
returns (bytes32[] memory)
10
{
Copied!
Getting Payment - to submit for payments from a data feed, run:
1
/**
2
* @dev Internal function which allows Tellor reporters to claim their autopay tips
3
* @param _feedId of dataFeed
4
* @param _queryId id of reported data
5
* @param _timestamp timestamp of reported data eligible for reward
6
* @return uint256 reward amount
7
*/
8
function _claimTip(
9
bytes32 _feedId,
10
bytes32 _queryId,
11
uint256 _timestamp
12
)
Copied!
*Note- The _feedId is simply the keccak256 has of the variables defined in setupFeed:
1
bytes32 _feedId = keccak256(
2
abi.encode(_queryId, _reward, _startTime, _interval, _window, _priceThreshold)
3
);
Copied!
Copy link
Contents