Ask or search…
K

DataSpecs Registry

DataSpecsRegistry is an on-chain registry for tellor oracle query types. Users register a query type name and pay a fee which determines the registration duration. The user then sets the IPFS document hash of the dataspec document in the registry contract. This provides an on-chain, tamperproof record of all Tellor query type definitions.
See the official frontend to view and manage query type registrations.

Deployed Contracts

Polygon - Official Deployment

Sepolia Testnet

Contract Interactions

Register a Query Type

Registering a query type requires some TRB tokens and a unique query type name string. The minimum registration time is one year, and registrations cost $1000 per year in TRB. To find the current cost per year in TRB, we'll call getCostperYearInTRB:
Now we know the minimum amount of TRB we need to register our query type.

Next, we will approve the token transfer in the token contract by inputting the registry contract address and an amount for one year's worth of tokens.

Now we can register our query type in the registry contract. For the name of our query type, we'll use ExampleQueryType, and again we'll input a token fee amount for a one year registration:

We have officially registered a query type, but now we need to set our IPFS data specs document hash. There are many ways to get a document on IPFS, but one quick solution can be found at nft.storage.
Now we finally have a query type registered.

Manage a Query Type

There are a few actions you can take to manage your query type. The extendRegistration function can be used to extend the registration time for an existing query type. It can be called by anyone, and any amount of tokens can be paid.
Each query type registration has a manager role and an owner role. The manager can set the document hash, and the owner can change the manager address and the owner address. The manager and owner addresses can be changed using these functions.

Query the Registry

Function Name
Function Purpose
getAllRegisteredQueryTypes()
Get a list of all registered query type names:
getCostPerYearInTRB()
Get the registration cost per year in TRB tokens
getRegistration("ExampleQueryType")
Get all info for a given query type registration.
getRegistrationreturns a struct in this form:
struct Spec {
address owner; // sets the manager and owner addresses
address manager; // sets the document hash and lock time
string documentHash; // IPFS hash of data specs document (ex: ipfs://bafybeic6nwiuutq2fs3wq7qg5t5xcqghg6bnv65atis3aphjtatb26nc5u)
uint256 expirationTime; // timestamp when spec registration expires
bool registered; // registered at some point in time
}
Install Dependencies:
npm i
Compile Smart Contracts:
npx hardhat compile
Test Locally:
npx hardhat test

How to Contribute

Check out our issues log here on Github, join our discord or feel free to reach out anytime at [email protected].