DataSpecs Registry
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
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:
Now we finally have a query type registered.
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.
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.
Install Dependencies:
npm i
Compile Smart Contracts:
npx hardhat compile
Test Locally:
npx hardhat test
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 .
Check out our issues log here on Github, join our or feel free to reach out anytime at info@tellor.io.