Protocol Documentation
Table of Contents
Top
job_schemas.proto
JobPosting
The schema Oracle nodes receive when they are notified to fulfill a job.
Field |
Type |
Label |
Description |
aggregator_state_pubkey |
bytes |
optional |
Pubkey of the aggregator to fulfill the job for. |
node_pubkeys |
bytes |
repeated |
The pubkey of the nodes this job is assigned to. |
slot |
uint64 |
optional |
Slot number of the job posting. |
JobResult
This schema Oracle nodes respond with when fulfilling a job.
Field |
Type |
Label |
Description |
node_pubkey |
bytes |
optional |
The public key of the responding node. |
result |
double |
optional |
The median value of the jobs the node has fulfilled successfully. |
error |
bool |
optional |
True if the node failed to decide on an answer to the job. |
OracleJob
Represnts a list of tasks to be performed by a switchboard oracle.
Field |
Type |
Label |
Description |
tasks |
OracleJob.Task |
repeated |
The chain of tasks to perform for this OracleJob. |
OracleJob.AddTask
This task will add a numerical input by a scalar value or by another
aggregate.
Field |
Type |
Label |
Description |
scalar |
double |
optional |
Specifies a scalar to add by. |
aggregator_pubkey |
string |
optional |
Specifies an aggregator to add by. |
job |
OracleJob |
optional |
A job whose result is computed before adding our numerical input by that result. |
OracleJob.AnchorFetchTask
Load a parse an Anchor based solana account.
Field |
Type |
Label |
Description |
program_id |
string |
optional |
Owning program of the account to parse. |
account_address |
string |
optional |
The account to parse. |
OracleJob.CacheTask
OracleJob.ConditionalTask
This task will run the attempt
subtasks in an effort to produce a valid numerical result. If
attempt
fails to produce an acceptable result, on_failure
subtasks will be run instead.
Field |
Type |
Label |
Description |
attempt |
OracleJob.Task |
repeated |
A list of subtasks to process in an attempt to produce a valid numerical result. |
on_failure |
OracleJob.Task |
repeated |
A list of subtasks that will be run if attempt subtasks are unable to produce an acceptable result. |
OracleJob.DefiKingdomsTask
OracleJob.DefiKingdomsTask.Token
Field |
Type |
Label |
Description |
address |
string |
optional |
|
decimals |
int32 |
optional |
|
OracleJob.DivideTask
This task will divide a numerical input by a scalar value or by another
aggregate.
Field |
Type |
Label |
Description |
scalar |
double |
optional |
Specifies a basic scalar denominator to divide by. |
aggregator_pubkey |
string |
optional |
Specifies another aggregator resut to divide by. |
job |
OracleJob |
optional |
A job whose result is computed before dividing our numerical input by that result. |
OracleJob.HttpTask
The adapter will report the text body of a successful HTTP request to the specified url,
or return an error if the response status code is greater than or equal to 400.
@return string representation of it's output.
Field |
Type |
Label |
Description |
url |
string |
optional |
A string containing the URL to direct this HTTP request to. |
method |
OracleJob.HttpTask.Method |
optional |
The type of HTTP request to make. |
headers |
OracleJob.HttpTask.Header |
repeated |
A list of headers to add to this HttpTask. |
body |
string |
optional |
A stringified body (if any) to add to this HttpTask. |
An object that represents a header to add to an HTTP request.
Field |
Type |
Label |
Description |
key |
string |
optional |
|
value |
string |
optional |
|
OracleJob.JsonParseTask
The adapter walks the path specified and returns the value found at that result. If returning
JSON data from the HttpGet or HttpPost adapters, you must use this adapter to parse the
response.
OracleJob.JupiterSwapTask
Field |
Type |
Label |
Description |
in_token_address |
string |
optional |
|
out_token_address |
string |
optional |
|
base_amount |
double |
optional |
|
OracleJob.LendingRateTask
Fetch the lending rates for various Solana protocols
Field |
Type |
Label |
Description |
protocol |
string |
optional |
01, apricot, francium, jet, larix, mango, port, solend, tulip |
asset_mint |
string |
optional |
A token mint address supported by the chosen protocol |
field |
OracleJob.LendingRateTask.Field |
optional |
|
OracleJob.LpExchangeRateTask
Fetch the current swap price for a given liquidity pool
OracleJob.LpTokenPriceTask
Fetch LP token price info from a number of supported exchanges.
OracleJob.MangoPerpMarketTask
Fetch the current price for a Mango perpetual market
OracleJob.MaxTask
Returns the maximum value of all the results returned by the provided subtasks and subjobs.
Field |
Type |
Label |
Description |
tasks |
OracleJob.Task |
repeated |
A list of subtasks to process and produce a list of result values. |
jobs |
OracleJob |
repeated |
A list of subjobs to process and produce a list of result values. |
OracleJob.MeanTask
Returns the mean of all the results returned by the provided subtasks and subjobs.
Field |
Type |
Label |
Description |
tasks |
OracleJob.Task |
repeated |
A list of subtasks to process and produce a list of result values. |
jobs |
OracleJob |
repeated |
A list of subjobs to process and produce a list of result values. |
OracleJob.MedianTask
Returns the median of all the results returned by the provided subtasks and subjobs. Nested
tasks must return a Number.
Field |
Type |
Label |
Description |
tasks |
OracleJob.Task |
repeated |
A list of subtasks to process and produce a list of result values. |
jobs |
OracleJob |
repeated |
A list of subjobs to process and produce a list of result values. |
min_successful_required |
int32 |
optional |
|
OracleJob.MultiplyTask
This task will multiply a numerical input by a scalar value or by another
aggregate.
Field |
Type |
Label |
Description |
scalar |
double |
optional |
Specifies a scalar to multiply by. |
aggregator_pubkey |
string |
optional |
Specifies an aggregator to multiply by. |
job |
OracleJob |
optional |
A job whose result is computed before multiplying our numerical input by that result. |
OracleJob.OracleTask
Fetch the current price of a Solana oracle protocol
Field |
Type |
Label |
Description |
switchboard_address |
string |
optional |
Mainnet address of a Switchboard V2 feed. Switchboard is decentralized and allows anyone to build their own feed. A small subset of feeds is available here: https://switchboard.xyz/explorer |
pyth_address |
string |
optional |
Mainnet address for a Pyth feed. A full list can be found here: https://pyth.network/markets/ |
chainlink_address |
string |
optional |
Devnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana |
pyth_allowed_confidence_interval |
double |
optional |
Value (as a percentage) that the lower bound confidence interval is of the actual value. Confidence intervals that are larger that this treshold are rejected. |
OracleJob.PancakeswapExchangeRateTask
Field |
Type |
Label |
Description |
in_token_address |
string |
optional |
|
out_token_address |
string |
optional |
|
in_token_amount |
double |
optional |
|
slippage |
double |
optional |
|
provider |
string |
optional |
|
OracleJob.PerpMarketTask
Fetch the current price of a perpetual market
OracleJob.PowTask
Take the power of the working value.
Field |
Type |
Label |
Description |
scalar |
double |
optional |
Take the working value to the exponent of value. |
aggregator_pubkey |
string |
optional |
Take the working value to the exponent of the aggregators value. |
Find a pattern within a string of a previous task and extract a group number.
Field |
Type |
Label |
Description |
pattern |
string |
optional |
Regex pattern to find. |
group_number |
int32 |
optional |
Group number to extract. |
OracleJob.SerumSwapTask
Fetch the latest swap price on Serum's orderbook
Field |
Type |
Label |
Description |
serum_pool_address |
string |
optional |
The serum pool to fetch swap price for |
OracleJob.SplStakePoolTask
Field |
Type |
Label |
Description |
pubkey |
string |
optional |
The pubkey of the SPL Stake Pool.`` |
OracleJob.SplTokenParseTask
Field |
Type |
Label |
Description |
token_account_address |
string |
optional |
|
mint_address |
string |
optional |
|
OracleJob.SubtractTask
This task will subtract a numerical input by a scalar value or by another
aggregate.
Field |
Type |
Label |
Description |
scalar |
double |
optional |
Specifies a scalar to subtract by. |
aggregator_pubkey |
string |
optional |
Specifies an aggregator to subtract by. |
job |
OracleJob |
optional |
A job whose result is computed before subtracting our numerical input by that result. |
OracleJob.SushiswapExchangeRateTask
Field |
Type |
Label |
Description |
in_token_address |
string |
optional |
|
out_token_address |
string |
optional |
|
in_token_amount |
double |
optional |
|
slippage |
double |
optional |
|
provider |
string |
optional |
|
OracleJob.SysclockOffsetTask
OracleJob.Task
OracleJob.TpsTask
OracleJob.TwapTask
Takes a twap over a set period for a certain aggregator.
Field |
Type |
Label |
Description |
aggregator_pubkey |
string |
optional |
The target aggregator for the TWAP. |
period |
int32 |
optional |
Period, in seconds, the twap should account for |
weight_by_propagation_time |
bool |
optional |
Weight samples by their propagation time |
min_samples |
uint32 |
optional |
Minimum number of samples in the history to calculate a valid result |
ending_unix_timestamp |
int32 |
optional |
Ending unix timestamp to collect values up to |
OracleJob.UniswapExchangeRateTask
Field |
Type |
Label |
Description |
in_token_address |
string |
optional |
|
out_token_address |
string |
optional |
|
in_token_amount |
double |
optional |
|
slippage |
double |
optional |
|
provider |
string |
optional |
|
OracleJob.ValueTask
Returns a specified value.
Field |
Type |
Label |
Description |
value |
double |
optional |
The value that will be returned from this task. |
aggregator_pubkey |
string |
optional |
Specifies an aggregatorr to pull the value of. |
OracleJob.WebsocketTask
Opens and maintains a websocket for light speed data retrieval.
Field |
Type |
Label |
Description |
url |
string |
optional |
The websocket url. |
subscription |
string |
optional |
The websocket message to notify of a new subscription. |
max_data_age_seconds |
int32 |
optional |
Minimum amount of time required between when the horses are taking out. |
filter |
string |
optional |
Incoming message JSONPath filter. Example: "$[?(@.channel == 'ticker' && @.market == 'BTC/USD')]" |
OracleJob.XStepPriceTask
Field |
Type |
Label |
Description |
step_job |
OracleJob.MedianTask |
optional |
median task containing the job definitions to fetch the STEP/USD price |
step_aggregator_pubkey |
string |
optional |
existing aggregator pubkey for STEP/USD |
OracleJob.CacheTask.Method
Name |
Number |
Description |
METHOD_GET |
0 |
|
METHOD_SET |
1 |
|
OracleJob.HttpTask.Method
An enumeration representing the types of HTTP requests available to make.
Name |
Number |
Description |
METHOD_UNKOWN |
0 |
Unset HTTP method will default to METHOD_GET |
METHOD_GET |
1 |
Perform an HTTP 'GET' request. |
METHOD_POST |
2 |
Perform an HTTP 'POST' request. |
OracleJob.JsonParseTask.AggregationMethod
The methods of combining a list of numerical results.
Name |
Number |
Description |
NONE |
0 |
|
MIN |
1 |
Grab the minimum value of the results. |
MAX |
2 |
Grab the maximum value of the results. |
SUM |
3 |
Sum up all of the results. |
OracleJob.LendingRateTask.Field
Name |
Number |
Description |
FIELD_DEPOSIT_RATE |
0 |
deposit lending rate |
FIELD_BORROW_RATE |
1 |
borrow lending rate |
Scalar Value Types
.proto Type |
Notes |
C++ |
Java |
Python |
Go |
C# |
PHP |
Ruby |
double |
|
double |
double |
float |
float64 |
double |
float |
Float |
float |
|
float |
float |
float |
float32 |
float |
float |
Float |
int32 |
Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. |
int32 |
int |
int |
int32 |
int |
integer |
Bignum or Fixnum (as required) |
int64 |
Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. |
int64 |
long |
int/long |
int64 |
long |
integer/string |
Bignum |
uint32 |
Uses variable-length encoding. |
uint32 |
int |
int/long |
uint32 |
uint |
integer |
Bignum or Fixnum (as required) |
uint64 |
Uses variable-length encoding. |
uint64 |
long |
int/long |
uint64 |
ulong |
integer/string |
Bignum or Fixnum (as required) |
sint32 |
Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. |
int32 |
int |
int |
int32 |
int |
integer |
Bignum or Fixnum (as required) |
sint64 |
Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. |
int64 |
long |
int/long |
int64 |
long |
integer/string |
Bignum |
fixed32 |
Always four bytes. More efficient than uint32 if values are often greater than 2^28. |
uint32 |
int |
int |
uint32 |
uint |
integer |
Bignum or Fixnum (as required) |
fixed64 |
Always eight bytes. More efficient than uint64 if values are often greater than 2^56. |
uint64 |
long |
int/long |
uint64 |
ulong |
integer/string |
Bignum |
sfixed32 |
Always four bytes. |
int32 |
int |
int |
int32 |
int |
integer |
Bignum or Fixnum (as required) |
sfixed64 |
Always eight bytes. |
int64 |
long |
int/long |
int64 |
long |
integer/string |
Bignum |
bool |
|
bool |
boolean |
boolean |
bool |
bool |
boolean |
TrueClass/FalseClass |
string |
A string must always contain UTF-8 encoded or 7-bit ASCII text. |
string |
String |
str/unicode |
string |
string |
string |
String (UTF-8) |
bytes |
May contain any arbitrary sequence of bytes. |
string |
ByteString |
str |
[]byte |
ByteString |
string |
String (ASCII-8BIT) |