diff --git a/contracts/chainlink/Operator.sol b/contracts/chainlink/Operator.sol new file mode 100644 index 00000000..8c2f8112 --- /dev/null +++ b/contracts/chainlink/Operator.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.7.0; + +import '@chainlink/contracts/src/v0.7/Operator.sol'; \ No newline at end of file diff --git a/deploy/operator.ts b/deploy/operator.ts new file mode 100644 index 00000000..e69de29b diff --git a/hardhat.config.ts b/hardhat.config.ts index 3606a293..bc7867f8 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -42,6 +42,15 @@ const config: HardhatUserConfig = { }, }, }, + { + version: '^0.7.0', + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, { version: '0.6.6', settings: { diff --git a/services/chainlink-nodes/example-v2-job-spec.toml b/services/chainlink-nodes/example-v2-job-spec.toml new file mode 100644 index 00000000..1393c6c2 --- /dev/null +++ b/services/chainlink-nodes/example-v2-job-spec.toml @@ -0,0 +1,23 @@ +type = "directrequest" +schemaVersion = 1 +name = "StakingParametricReq" +forwardingAllowed = false +maxTaskDuration = "0s" +contractAddress = "0xFooBar" +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)"] + fetch [type=bridge name="staking-parametric" requestData="{\\"id\\": $(jobSpec.externalJobID), \\"data\\": { \\"sla_monitoring_start\\": $(decode_cbor.sla_monitoring_start), \\"sla_monitoring_end\\": $(decode_cbor.sla_monitoring_end), \\"sla_address\\": $(decode_cbor.sla_address), \\"network_name\\": $(decode_cbor.network_name)}}"] + parse [type=jsonparse path="data,result" data="$(fetch)"] + encode_data [type=ethabiencode abi="(uint256 value)" data="{ \\"value\\": $(parse) }"] + 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="0xFooBar" data="$(encode_tx)"] + decode_log -> decode_cbor -> fetch -> parse -> encode_data -> encode_tx -> submit_tx +""" diff --git a/subtasks.ts b/subtasks.ts index 3d8570d7..def53740 100644 --- a/subtasks.ts +++ b/subtasks.ts @@ -1881,11 +1881,37 @@ subtask(SUB_TASK_NAMES.REQUEST_SLI, undefined).setAction( let tx; if (taskArgs.retry) { console.log('Retrying request...'); + + // const linkToken = await get(CONTRACT_NAMES.LinkToken); + + // const token = await ERC20__factory.connect(linkToken.address, signer); + + // let approval = await token.approve( + // '0x834B065cf4Ac904E4bFfd983Ec2b2A6c8Af8AD7E', + // toWei('10') + // ); + + // approval.wait(); + const messenger = IMessenger__factory.connect( await sla.messengerAddress(), await ethers.getSigner(deployer) ); - tx = await messenger.retryRequest(slaAddress, nextVerifiablePeriod); + + tx = await messenger.retryRequest( + sla.address, + Number(nextVerifiablePeriod), + { + ...(hre.network.config.gas !== 'auto' && + hre.network.config.chainId != 137 && { + gasLimit: hre.network.config.gas, + }), + ...(hre.network.config.gas !== 'auto' && + hre.network.config.chainId == 137 && { + gasPrice: hre.network.config.gas, + }), + } + ); } else { console.log('Requesting SLI...'); tx = await slaRegistry.requestSLI(