# Tellor Functions

### Available Tellor Functions

When your contract inherits the [usingtellor](https://github.com/tellor-io/usingtellor) helper contract, it has access to the following functions:

```solidity
function retrieveData(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (bytes memory);
```

* Retrieves a specific value by queryId and timestamp

```solidity
function isInDispute(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (bool);
```

* Determines whether a specific value with a given queryId and timestamp has been disputed

```solidity
function getNewValueCountbyQueryId(bytes32 _queryId)
        public
        view
        returns (uint256);
```

* Returns the total number of values submitted for a given queryId

```solidity
function getTimestampbyQueryIdandIndex(bytes32 _queryId, uint256 _index)
        public
        view
        returns (uint256);
```

* Returns the timestamp at a specific index for a given queryId.&#x20;
* Values start at the 0 index.

```solidity
function getCurrentValue(bytes32 _queryId)
        public
        view
        returns (
            bool _ifRetrieve,
            bytes memory _value,
            uint256 _timestampRetrieved
        );
```

* Finds the most recent submission for a given queryId and returns three things: a boolean for whether a value was found, the value itself, and the timestamp of the value
* Note that this function should not be used in most cases since it does not include a dispute buffer time. See below.

```solidity
function getDataBefore(bytes32 _queryId, uint256 _timestamp)
        public
        view
        returns (
            bool _ifRetrieve,
            bytes memory _value,
            uint256 _timestampRetrieved
        );
```

* Finds the most recent submission for a given queryId **before** a specific timestamp
* It is recommended that you use this function with a buffer time when retrieving oracle values. This [allows time](https://tellor.io/security-201/) for bad values to be disputed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tellor.io/tellor-docs-v2/getting-data/tellor-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
