kovan ネットワークを使用した Chainlink フルフィルメントの公式ドキュメントに従いました。以下のコードを実行します
pragma solidity 0.6.6; import "@chainlink/contracts/src/v0.6/Oracle.sol";
【公式ドキュメントから入手、https://remix.ethereum.org/#url=https://docs.chain.link/samples/NodeOperators/Oracle.sol
for node chainlink node job
type = "directrequest"
schemaVersion = 1
name = "Get > Uint256"
# Optional External Job ID: Automatically generated if unspecified
# externalJobID = "b1d42cd5-4a3a-4200-b1f7-25a68e48aad8"
contractAddress = "YOUR_ORACLE_CONTRACT_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)"]
fetch [type=http method=GET url="$(decode_cbor.get)"]
parse [type=jsonparse path="$(decode_cbor.path)" data="$(fetch)"]
multiply [type=multiply input="$(parse)" times=100]
encode_data [type=ethabiencode abi="(uint256 value)" data="{ \\"value\\": $(multiply) }"]
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_CONTRACT_ADDRESS" data="$(encode_tx)"]
decode_log -> decode_cbor -> fetch -> parse -> multiply -> encode_data -> encode_tx -> enter code heresubmit_tx
"""
コンシューマーの場合、以下のコードを使用します https://remix.ethereum.org/#url=https://docs.chain.link/samples/APIRequests/ATestnetConsumer.sol