-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoracle_adapter_job.toml
More file actions
30 lines (25 loc) · 1.93 KB
/
oracle_adapter_job.toml
File metadata and controls
30 lines (25 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
type = "directrequest"
schemaVersion = 1
name = "Get Uint256 Hash and Metadata CID by URL"
contractAddress = "0x4244456D81DeFE91a00d735fA57A699FdaAd747e"
minContractPaymentLinkJuels = "0"
observationSource = """
decode_log [type="ethabidecodelog"
abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)"
data="$(jobRun.logData)"
topics="$(jobRun.logTopics)"]
decode_cbor [type="cborparse" data="$(decode_log.data)"]
send_to_bridge [type="bridge" name="get-sha256sum" requestData="{\\"data\\": \\{ \\"url\\": $(decode_cbor.get) \\}}"]
parseHash [type="jsonparse" path="data,sha256sum" data="$(send_to_bridge)"]
parseCid [type="jsonparse" path="data,metadataCid" data="$(send_to_bridge)"]
encode_data [type="ethabiencode" abi="(uint256 value, string cid)" data="{ \\"value\\": $(parseHash) , \\"cid\\": $(parseCid) }}"]
encode_tx [type="ethabiencode"
abi="fulfillOracleRequest(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data)"
data="{\\"requestId\\": $(decode_log.requestId), \\"payment\\": $(decode_log.payment), \\"callbackAddress\\": $(decode_log.callbackAddr), \\"callbackFunctionId\\": $(decode_log.callbackFunctionId), \\"expiration\\": $(decode_log.cancelExpiration), \\"data\\": $(encode_data)}"
]
submit_tx [type="ethtx" to="0x4244456D81DeFE91a00d735fA57A699FdaAd747e" data="$(encode_tx)"]
decode_log -> decode_cbor -> send_to_bridge -> parseHash -> parseCid -> encode_data -> encode_tx -> submit_tx
"""
#consumer contract requestEthereumPrice args:
#oracle contract address, job id without dashes
#0x4244456D81DeFE91a00d735fA57A699FdaAd747e,766defa685f8407faeda40a3784932f5