Search
Executes a job upon receipt of an explicit request made by a user. The request is detected via a log emitted by an Oracle or Operator contract. This is similar to the legacy ethlog/runlog style of jobs.
Topics
type = "directrequest"
schemaVersion = 1
evmChainID = 1
name = "example eth request event spec"
contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C"
# Optional fields:
# requesters = [
# "0xaaaa1F8ee20f5565510B84f9353F1E333E753B7a",
# "0xbbbb70F0e81C6F3430dfdC9fa02fB22BdD818C4e"
# ]
# minContractPaymentLinkJuels = "100000000000000"
# externalJobID = "0EEC7E1D-D0D2-476C-A1A8-72DFB6633F02"
# minIncomingConfirmations = 10
observationSource = """
ds [type="http" method=GET url="http://example.com"]
ds_parse [type="jsonparse" path="USD"]
ds_multiply [type="multiply" times=100]
ds -> ds_parse -> ds_multiply
"""
See shared fields.
contractAddress
: The Oracle or Operator contract to monitor for requestsrequesters
: Optional - Allows whitelisting requestersminContractPaymentLinkJuels
Optional - Allows you to specify a job-specific minimum contract paymentminIncomingConfirmations
Optional - Allows you to specify a job-specific MIN_INCOMING_CONFIRMATIONS
value, must be greater than or equal to 1$(jobSpec.databaseID)
: the ID of the job spec in the local database. You shouldn't need this in 99% of cases.$(jobSpec.externalJobID)
: the globally-unique job ID for this job. Used to coordinate between node operators in certain cases.$(jobSpec.name)
: the local name of the job.$(jobRun.meta)
: a map of metadata that can be sent to a bridge, etc.$(jobRun.logBlockHash)
: the block hash in which the initiating log was received.$(jobRun.logBlockNumber)
: the block number in which the initiating log was received.$(jobRun.logTxHash)
: the transaction hash that generated the initiating log.$(jobRun.logAddress)
: the address of the contract to which the initiating transaction was sent.$(jobRun.logTopics)
: the log's topics (indexed
fields).$(jobRun.logData)
: the log's data (non-indexed
fields).$(jobRun.blockReceiptsRoot)
: the root of the receipts trie of the block (hash).$(jobRun.blockTransactionsRoot)
: the root of the transaction trie of the block (hash).$(jobRun.blockStateRoot)
: the root of the final state trie of the block (hash).Let's assume that a user makes a request to an oracle to call a public API, retrieve a number from the response, remove any decimals and return uint256.
Let's assume that a user makes a request to an oracle to call a public API, retrieve a number from the response, remove any decimals and return int256.
Let's assume that a user makes a request to an oracle to call a public API, retrieve a boolean from the response and return bool.
Let's assume that a user makes a request to an oracle and would like to fetch a string from the response.
Let's assume that a user makes a request to an oracle and would like to fetch bytes from the response (meaning a response that contains an arbitrary-length raw byte data).
Let's assume that a user makes a request to an oracle and would like to fetch multiple words in one single request.
Using an existing Oracle Job makes your smart contract code more succinct. Let's assume that a user makes a request to an oracle that leverages Etherscan External Adapter to retrieve the gas price.