Last active
October 29, 2021 17:36
-
-
Save vnavascues/d1abe4d9c880a20515e4855dba63545f to your computer and use it in GitHub Desktop.
A TOML jobspec for the AccuWeather EA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type = "directrequest" | |
schemaVersion = 1 | |
minContractPaymentLinkJuels = "1000000000000000000" # 0.1 LINK or 1 LINK | |
name = "AW AccuWeather Get Current Conditions by Location Coordinates" | |
contractAddress = "0x0000000000000000000000000000000000000000" # Replace with Operator.sol address (also in submit_tx task) | |
maxTaskDuration = "0s" | |
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)"] | |
accuweather [type=bridge | |
name="accuweather" | |
requestData="{\\"data\\": {\\"endpoint\\": $(decode_cbor.endpoint),\\"lat\\": $(decode_cbor.lat),\\"lon\\": $(decode_cbor.lon),\\"units\\": $(decode_cbor.units)}}" | |
allowunrestrictednetworkaccess="true"] | |
resultEncoded_parse [type=jsonparse data="$(accuweather)" path="result"] | |
encode_data [type=ethabiencode | |
abi="(bytes32 _requestId, bytes memory _result)" | |
data="{\\"_requestId\\": $(decode_log.requestId),\\"_result\\": $(resultEncoded_parse)}"] | |
encode_tx [type=ethabiencode | |
abi="fulfillOracleRequest2(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes calldata 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="0x0000000000000000000000000000000000000000" data="$(encode_tx)" minConfirmations="2"] | |
decode_log -> decode_cbor -> accuweather -> resultEncoded_parse -> encode_data -> encode_tx -> submit_tx | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment