Last active
January 9, 2022 09:23
-
-
Save danstarns/0614db8cb7858f130573c2c2938caede to your computer and use it in GitHub Desktop.
example.toml
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 | |
| name = "select" | |
| contractAddress = "YOUR_ORACLE_ADDRESS" | |
| 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)"] | |
| adapter [type="bridge" name="neo4j" requestData="{\\"id\\": $(jobSpec.externalJobID), \\"data\\":{\\"query\\": $(decode_cbor.query)}}"] | |
| jsondecode [type="jsonparse" data="$(adapter)" path="data,result,result"] | |
| encode_data [type="ethabiencode" abi="(bytes32 value)" data="{ \\"value\\": $(jsondecode) }"] | |
| 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="YOUR_ORACLE_ADDRESS" data="$(encode_tx)"] | |
| decode_log -> decode_cbor -> adapter -> jsondecode -> encode_data -> encode_tx -> submit_tx | |
| """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment