Adaptor
The Adaptor is a critical parameter for off-chain inference that acts as a template, dictating the structure and content of inference requests. Users define the specific parameters for the schema used in off-chain inference as follows:
Request Instructions: This contains detailed guidelines about the nature of the request, including various parameters such as variables, consumer contracts, event requests, and required user fees.
Reference Data: The data that the inference should reference or utilize, including any necessary context or historical data.
Response Format: The expected structure of the inference response, which ensures the output is formatted correctly for subsequent workflows. This could be a boolean, JSON, or Integer format depending on the use case.
Users can define multiple Adaptor, each tailored to specific requirements, with each adaptor being uniquely identified by a randomly generated jobID during the creation process. These jobIDs serve as crucial identifiers in Consumer contracts, ensuring accurate referencing.
How to create an Adaptor
1. Parameter Specification
To create an adaptor, you need to specify several essential parameters that define its functionality, capabilities, and communication requirements. These parameters ensure that the adapter is correctly configured to facilitate interactions between different systems, particularly between on-chain and off-chain environments. Here are the critical parameters:
Name (String): Name of the adaptor.
Provider: Choose a data provider (Currently, We provide a list of providers. You can choose one that fits your requirements).
Network: The network you wish to deploy on (Base, Rivalz, Arbitrum).
Description(String): Provides a brief description of what the adapter does.
Variables (String): Defines the adapter’s variables in a comma-separated string format for easy processing and validation.
Category ID(Number): The ID of the category this adaptor belongs to.
Output Type ID(Number): Specifies the ID of the output type that the adapter will produce. ( Currently, We support four different types of output: Bool, Bytes, Uint256, StringAndBool )
Prompt: Describe the specific actions or functionality you want your consumer contract to perform.
During the generation process, the system will automatically create a unique JobID in a format compatible with Solidity's bytes32
type. This JobID serves as a unique identifier and must be generated before the creation of the adaptor.
For example jobID: 0x1b364865ca3e6bb5ada098d0ea96f9e9369b5693cacede79d1352334c4213ac2
2. Step-by-step guide on how to approach building an adaptor
Visit the Rivalz ADCS at https://adcsdev.rivalz.ai/ . Next, select "Connect Wallet" in the header to login the website.
Click "Your Adaptor" and then Click the "Create Adaptor" button.
Create your adaptor
In this example, I would like to build a simple application designed to gather real-time token price data. From this foundation, you can expand the functionality by integrating AI agents to analyze the data, providing users with actionable insights.
For example, by leveraging AI-driven models, you can develop PriceIntel, an advanced system that evaluates current and historical token price trends to help predict future movements. Based on this analysis, the AI agent can assess whether the price of a specific token is likely to increase or decrease, offering actionable predictions for users in the context of:
Trading: Deciding when to buy or sell tokens based on predictive trends.
After defining all the necessary information for your adaptor, click the 'Create Adaptor' button.
Congratulations! You have successfully created an adaptor !
Last updated