mirror of
https://github.com/Instadapp/Gelato-automations.git
synced 2024-07-29 22:28:07 +00:00
180 lines
44 KiB
JSON
180 lines
44 KiB
JSON
{
|
|
"address": "0xE5c15cb45485Dab0C9B39CFBe3Abfeb710e3A3FE",
|
|
"abi": [
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "address",
|
|
"name": "_sourceA",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"internalType": "address",
|
|
"name": "_sourceB",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"internalType": "bytes",
|
|
"name": "_sourceAData",
|
|
"type": "bytes"
|
|
},
|
|
{
|
|
"internalType": "bytes",
|
|
"name": "_sourceBData",
|
|
"type": "bytes"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "_minSpread",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "compare",
|
|
"outputs": [
|
|
{
|
|
"internalType": "string",
|
|
"name": "",
|
|
"type": "string"
|
|
}
|
|
],
|
|
"stateMutability": "view",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "address",
|
|
"name": "_sourceA",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"internalType": "address",
|
|
"name": "_sourceB",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"internalType": "bytes",
|
|
"name": "_sourceAData",
|
|
"type": "bytes"
|
|
},
|
|
{
|
|
"internalType": "bytes",
|
|
"name": "_sourceBData",
|
|
"type": "bytes"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "_minSpread",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "getConditionData",
|
|
"outputs": [
|
|
{
|
|
"internalType": "bytes",
|
|
"name": "",
|
|
"type": "bytes"
|
|
}
|
|
],
|
|
"stateMutability": "pure",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"internalType": "bytes",
|
|
"name": "_conditionData",
|
|
"type": "bytes"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "ok",
|
|
"outputs": [
|
|
{
|
|
"internalType": "string",
|
|
"name": "",
|
|
"type": "string"
|
|
}
|
|
],
|
|
"stateMutability": "view",
|
|
"type": "function"
|
|
}
|
|
],
|
|
"transactionHash": "0xa638a4693bbfad4904a63dc30de5bb7809ca321da9565d787fbf05fd85d550ef",
|
|
"receipt": {
|
|
"to": null,
|
|
"from": "0xe1F076849B781b1395Fd332dC1758Dbc129be6EC",
|
|
"contractAddress": "0xE5c15cb45485Dab0C9B39CFBe3Abfeb710e3A3FE",
|
|
"transactionIndex": 146,
|
|
"gasUsed": "648027",
|
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
"blockHash": "0x3580fa7350e5ede7b07becec815133f5f365f03f7fa6711d56e557d29b00af36",
|
|
"transactionHash": "0xa638a4693bbfad4904a63dc30de5bb7809ca321da9565d787fbf05fd85d550ef",
|
|
"logs": [],
|
|
"blockNumber": 11273869,
|
|
"cumulativeGasUsed": "9016207",
|
|
"status": 1,
|
|
"byzantium": true
|
|
},
|
|
"args": [],
|
|
"solcInputHash": "d1d4184366927728b52537856ecb8f22",
|
|
"metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sourceA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sourceB\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_sourceAData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_sourceBData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_minSpread\",\"type\":\"uint256\"}],\"name\":\"compare\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sourceA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sourceB\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_sourceAData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_sourceBData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_minSpread\",\"type\":\"uint256\"}],\"name\":\"getConditionData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_conditionData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"ok\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This contract only works if the refContracts fns returndata has a uint in the first 32-byte position.\",\"kind\":\"dev\",\"methods\":{\"compare(address,address,bytes,bytes,uint256)\":{\"details\":\"If you want to trigger when ContractA uint is greater than or equal to ContractB by _minSpread: (ContractA=_sourceA, ContractB=_sourceB) For the reverse (lower than/equal to): (ContractA=_sourceB, ContractB=_sourceA)\",\"params\":{\"_minSpread\":\"The minimum diff between sourceA and sourceB for the Condition to be relevant.\",\"_sourceA\":\"The first contract that returns a uint for comparison.\",\"_sourceAData\":\"Payload for retrieving the uint from _sourceA.\",\"_sourceB\":\"The second contract that returns a uint256 for comparison.\",\"_sourceBData\":\"Payload for retrieving the uint from _sourceB.\"},\"returns\":{\"_0\":\"OK if the Condition is fulfilled.\"}},\"ok(uint256,bytes,uint256)\":{\"details\":\"Every Gelato Condition must have this function selector as entry point.\",\"params\":{\"_conditionData\":\"The encoded data from getConditionData()\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"compare(address,address,bytes,bytes,uint256)\":{\"notice\":\"Compares 2 values from sourceA and sourceB to check if minSpread is there.\"},\"getConditionData(address,address,bytes,bytes,uint256)\":{\"notice\":\"Helper to encode the Condition.data field off-chain\"},\"ok(uint256,bytes,uint256)\":{\"notice\":\"Gelato Standard Condition function.\"}},\"notice\":\"A general contract for retrieving and comparing 2 uints from 2 contracts.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/contracts/gelato/conditions/ConditionCompareUintsFromTwoSources.sol\":\"ConditionCompareUintsFromTwoSources\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\n\\nimport \\\"./IGelatoCondition.sol\\\";\\n\\nabstract contract GelatoConditionsStandard is IGelatoCondition {\\n string internal constant OK = \\\"OK\\\";\\n}\\n\",\"keccak256\":\"0xa3d9ee5c4398914bbc0fe75fe54e57b73b8a4367caf9a40d9e5fd1ba9d4adb89\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/conditions/IGelatoCondition.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\n/// @title IGelatoCondition - solidity interface of GelatoConditionsStandard\\n/// @notice all the APIs of GelatoConditionsStandard\\n/// @dev all the APIs are implemented inside GelatoConditionsStandard\\ninterface IGelatoCondition {\\n\\n /// @notice GelatoCore calls this to verify securely the specified Condition securely\\n /// @dev Be careful only to encode a Task's condition.data as is and not with the\\n /// \\\"ok\\\" selector or _taskReceiptId, since those two things are handled by GelatoCore.\\n /// @param _taskReceiptId This is passed by GelatoCore so we can rely on it as a secure\\n /// source of Task identification.\\n /// @param _conditionData This is the Condition.data field developers must encode their\\n /// Condition's specific parameters in.\\n /// @param _cycleId For Tasks that are executed as part of a cycle.\\n function ok(uint256 _taskReceiptId, bytes calldata _conditionData, uint256 _cycleId)\\n external\\n view\\n returns(string memory);\\n}\",\"keccak256\":\"0xd07607af93227ec5f8c2f5401289937b98c298f0d2398c1ba7410f82a6253964\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {IGelatoProviderModule} from \\\"../../provider_modules/IGelatoProviderModule.sol\\\";\\nimport {IGelatoCondition} from \\\"../../conditions/IGelatoCondition.sol\\\";\\n\\nstruct Provider {\\n address addr; // if msg.sender == provider => self-Provider\\n IGelatoProviderModule module; // can be IGelatoProviderModule(0) for self-Providers\\n}\\n\\nstruct Condition {\\n IGelatoCondition inst; // can be AddressZero for self-conditional Actions\\n bytes data; // can be bytes32(0) for self-conditional Actions\\n}\\n\\nenum Operation { Call, Delegatecall }\\n\\nenum DataFlow { None, In, Out, InAndOut }\\n\\nstruct Action {\\n address addr;\\n bytes data;\\n Operation operation;\\n DataFlow dataFlow;\\n uint256 value;\\n bool termsOkCheck;\\n}\\n\\nstruct Task {\\n Condition[] conditions; // optional\\n Action[] actions;\\n uint256 selfProviderGasLimit; // optional: 0 defaults to gelatoMaxGas\\n uint256 selfProviderGasPriceCeil; // optional: 0 defaults to NO_CEIL\\n}\\n\\nstruct TaskReceipt {\\n uint256 id;\\n address userProxy;\\n Provider provider;\\n uint256 index;\\n Task[] tasks;\\n uint256 expiryDate;\\n uint256 cycleId; // auto-filled by GelatoCore. 0 for non-cyclic/chained tasks\\n uint256 submissionsLeft;\\n}\\n\\ninterface IGelatoCore {\\n event LogTaskSubmitted(\\n uint256 indexed taskReceiptId,\\n bytes32 indexed taskReceiptHash,\\n TaskReceipt taskReceipt\\n );\\n\\n event LogExecSuccess(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorSuccessFee,\\n uint256 sysAdminSuccessFee\\n );\\n event LogCanExecFailed(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n string reason\\n );\\n event LogExecReverted(\\n address indexed executor,\\n uint256 indexed taskReceiptId,\\n uint256 executorRefund,\\n string reason\\n );\\n\\n event LogTaskCancelled(uint256 indexed taskReceiptId, address indexed cancellor);\\n\\n /// @notice API to query whether Task can be submitted successfully.\\n /// @dev In submitTask the msg.sender must be the same as _userProxy here.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _userProxy The userProxy from which the task will be submitted.\\n /// @param _task Selected provider, conditions, actions, expiry date of the task\\n function canSubmitTask(\\n address _userProxy,\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external\\n view\\n returns(string memory);\\n\\n /// @notice API to submit a single Task.\\n /// @dev You can let users submit multiple tasks at once by batching calls to this.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _task A Gelato Task object: provider, conditions, actions.\\n /// @param _expiryDate From then on the task cannot be executed. 0 for infinity.\\n function submitTask(\\n Provider calldata _provider,\\n Task calldata _task,\\n uint256 _expiryDate\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _cycles How many full cycles will be submitted\\n function submitTaskCycle(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _cycles\\n )\\n external;\\n\\n\\n /// @notice A Gelato Task Cycle consists of 1 or more Tasks that automatically submit\\n /// the next one, after they have been executed.\\n /// @dev CAUTION: _sumOfRequestedTaskSubmits does not mean the number of cycles.\\n /// @dev If _sumOfRequestedTaskSubmits = 1 && _tasks.length = 2, only the first task\\n /// would be submitted, but not the second\\n /// @param _provider Gelato Provider object: provider address and module.\\n /// @param _tasks This can be a single task or a sequence of tasks.\\n /// @param _expiryDate After this no task of the sequence can be executed any more.\\n /// @param _sumOfRequestedTaskSubmits The TOTAL number of Task auto-submits\\n /// that should have occured once the cycle is complete:\\n /// _sumOfRequestedTaskSubmits = 0 => One Task will resubmit the next Task infinitly\\n /// _sumOfRequestedTaskSubmits = 1 => One Task will resubmit no other task\\n /// _sumOfRequestedTaskSubmits = 2 => One Task will resubmit 1 other task\\n /// ...\\n function submitTaskChain(\\n Provider calldata _provider,\\n Task[] calldata _tasks,\\n uint256 _expiryDate,\\n uint256 _sumOfRequestedTaskSubmits\\n )\\n external;\\n\\n // ================ Exec Suite =========================\\n /// @notice Off-chain API for executors to check, if a TaskReceipt is executable\\n /// @dev GelatoCore checks this during execution, in order to safeguard the Conditions\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @param _gasLimit Task.selfProviderGasLimit is used for SelfProviders. All other\\n /// Providers must use gelatoMaxGas. If the _gasLimit is used by an Executor and the\\n /// tx reverts, a refund is paid by the Provider and the TaskReceipt is annulated.\\n /// @param _execTxGasPrice Must be used by Executors. Gas Price fed by gelatoCore's\\n /// Gas Price Oracle. Executors can query the current gelatoGasPrice from events.\\n function canExec(TaskReceipt calldata _TR, uint256 _gasLimit, uint256 _execTxGasPrice)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Executors call this when Conditions allow it to execute submitted Tasks.\\n /// @dev Executors get rewarded for successful Execution. The Task remains open until\\n /// successfully executed, or when the execution failed, despite of gelatoMaxGas usage.\\n /// In the latter case Executors are refunded by the Task Provider.\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function exec(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel task\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _TR TaskReceipt: id, userProxy, Task.\\n function cancelTask(TaskReceipt calldata _TR) external;\\n\\n /// @notice Cancel multiple tasks at once\\n /// @dev Callable only by userProxy or selected provider\\n /// @param _taskReceipts TaskReceipts: id, userProxy, Task.\\n function multiCancelTasks(TaskReceipt[] calldata _taskReceipts) external;\\n\\n /// @notice Compute hash of task receipt\\n /// @param _TR TaskReceipt, consisting of user task, user proxy address and id\\n /// @return hash of taskReceipt\\n function hashTaskReceipt(TaskReceipt calldata _TR) external pure returns(bytes32);\\n\\n // ================ Getters =========================\\n /// @notice Returns the taskReceiptId of the last TaskReceipt submitted\\n /// @return currentId currentId, last TaskReceiptId submitted\\n function currentTaskReceiptId() external view returns(uint256);\\n\\n /// @notice Returns computed taskReceipt hash, used to check for taskReceipt validity\\n /// @param _taskReceiptId Id of taskReceipt emitted in submission event\\n /// @return hash of taskReceipt\\n function taskReceiptHash(uint256 _taskReceiptId) external view returns(bytes32);\\n}\\n\",\"keccak256\":\"0x93fdb67219b2d675621f935f3f7bc460b7283e797198741a95fabbafc7e33fee\",\"license\":\"UNLICENSED\"},\"@gelatonetwork/core/contracts/provider_modules/IGelatoProviderModule.sol\":{\"content\":\"// \\\"SPDX-License-Identifier: UNLICENSED\\\"\\npragma solidity >=0.6.10;\\npragma experimental ABIEncoderV2;\\n\\nimport {Action, Task} from \\\"../gelato_core/interfaces/IGelatoCore.sol\\\";\\n\\ninterface IGelatoProviderModule {\\n\\n /// @notice Check if provider agrees to pay for inputted task receipt\\n /// @dev Enables arbitrary checks by provider\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @return \\\"OK\\\" if provider agrees\\n function isProvided(address _userProxy, address _provider, Task calldata _task)\\n external\\n view\\n returns(string memory);\\n\\n /// @notice Convert action specific payload into proxy specific payload\\n /// @dev Encoded multiple actions into a multisend\\n /// @param _taskReceiptId Unique ID of Gelato Task to be executed.\\n /// @param _userProxy The smart contract account of the user who submitted the Task.\\n /// @param _provider The account of the Provider who uses the ProviderModule.\\n /// @param _task Gelato Task to be executed.\\n /// @param _cycleId For Tasks that form part of a cycle/chain.\\n /// @return Encoded payload that will be used for low-level .call on user proxy\\n /// @return checkReturndata if true, fwd returndata from userProxy.call to ProviderModule\\n function execPayload(\\n uint256 _taskReceiptId,\\n address _userProxy,\\n address _provider,\\n Task calldata _task,\\n uint256 _cycleId\\n )\\n external\\n view\\n returns(bytes memory, bool checkReturndata);\\n\\n /// @notice Called by GelatoCore.exec to verifiy that no revert happend on userProxy\\n /// @dev If a caught revert is detected, this fn should revert with the detected error\\n /// @param _proxyReturndata Data from GelatoCore._exec.userProxy.call(execPayload)\\n function execRevertCheck(bytes calldata _proxyReturndata) external pure;\\n}\\n\",\"keccak256\":\"0x8d08ceddbc4e686d070e916d2bcffc69c5a640b56866bc2cef0256b564eb14dc\",\"license\":\"UNLICENSED\"},\"contracts/contracts/gelato/conditions/ConditionCompareUintsFromTwoSources.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nimport {\\n GelatoConditionsStandard\\n} from \\\"@gelatonetwork/core/contracts/conditions/GelatoConditionsStandard.sol\\\";\\nimport {SafeMath} from \\\"../../../vendor/SafeMath.sol\\\";\\nimport {\\n IGelatoCore\\n} from \\\"@gelatonetwork/core/contracts/gelato_core/interfaces/IGelatoCore.sol\\\";\\nimport {GelatoBytes} from \\\"../../../lib/GelatoBytes.sol\\\";\\n\\n/// @notice A general contract for retrieving and comparing 2 uints from 2 contracts.\\n/// @dev This contract only works if the refContracts fns returndata has a uint in\\n/// the first 32-byte position.\\ncontract ConditionCompareUintsFromTwoSources is GelatoConditionsStandard {\\n using GelatoBytes for bytes;\\n using SafeMath for uint256;\\n\\n /// @notice Helper to encode the Condition.data field off-chain\\n function getConditionData(\\n address _sourceA,\\n address _sourceB,\\n bytes calldata _sourceAData,\\n bytes calldata _sourceBData,\\n uint256 _minSpread\\n ) public pure virtual returns (bytes memory) {\\n return\\n abi.encode(\\n _sourceA,\\n _sourceB,\\n _sourceAData,\\n _sourceBData,\\n _minSpread\\n );\\n }\\n\\n /// @notice Gelato Standard Condition function.\\n /// @dev Every Gelato Condition must have this function selector as entry point.\\n /// @param _conditionData The encoded data from getConditionData()\\n function ok(\\n uint256,\\n bytes calldata _conditionData,\\n uint256\\n ) public view virtual override returns (string memory) {\\n (\\n address _sourceA,\\n address _sourceB,\\n bytes memory _sourceAData,\\n bytes memory _sourceBData,\\n uint256 _minSpread\\n ) =\\n abi.decode(\\n _conditionData,\\n (address, address, bytes, bytes, uint256)\\n );\\n return\\n compare(_sourceA, _sourceB, _sourceAData, _sourceBData, _minSpread);\\n }\\n\\n /// @notice Compares 2 values from sourceA and sourceB to check if minSpread is there.\\n /// @dev If you want to trigger when ContractA uint is greater than or equal\\n /// to ContractB by _minSpread: (ContractA=_sourceA, ContractB=_sourceB)\\n /// For the reverse (lower than/equal to): (ContractA=_sourceB, ContractB=_sourceA)\\n /// @param _sourceA The first contract that returns a uint for comparison.\\n /// @param _sourceB The second contract that returns a uint256 for comparison.\\n /// @param _sourceAData Payload for retrieving the uint from _sourceA.\\n /// @param _sourceBData Payload for retrieving the uint from _sourceB.\\n /// @param _minSpread The minimum diff between sourceA and sourceB\\n /// for the Condition to be relevant.\\n /// @return OK if the Condition is fulfilled.\\n function compare(\\n address _sourceA,\\n address _sourceB,\\n bytes memory _sourceAData,\\n bytes memory _sourceBData,\\n uint256 _minSpread\\n ) public view virtual returns (string memory) {\\n // Retrieve uint256 from sourceA\\n (bool success, bytes memory returndata) =\\n _sourceA.staticcall(_sourceAData);\\n if (!success) {\\n return\\n returndata.returnError(\\n \\\"ConditionCompareTwoUints.compare._sourceA:\\\"\\n );\\n }\\n uint256 a = abi.decode(returndata, (uint256));\\n\\n // Retrieve uint256 from sourceB\\n (success, returndata) = _sourceB.staticcall(_sourceBData);\\n if (!success) {\\n return\\n returndata.returnError(\\n \\\"ConditionCompareTwoUints.compare._sourceB:\\\"\\n );\\n }\\n uint256 b = abi.decode(returndata, (uint256));\\n\\n if (a >= b.add(_minSpread)) return OK;\\n return \\\"ANotGreaterOrEqualToBbyMinspread\\\";\\n }\\n}\\n\",\"keccak256\":\"0x2b08ae08691d0dc528baff4fb62ab8580ed5bde231c85e28c23459950a2a5d62\",\"license\":\"UNLICENSED\"},\"contracts/lib/GelatoBytes.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity 0.7.4;\\n\\nlibrary GelatoBytes {\\n function calldataSliceSelector(bytes calldata _bytes)\\n internal\\n pure\\n returns (bytes4 selector)\\n {\\n selector =\\n _bytes[0] |\\n (bytes4(_bytes[1]) >> 8) |\\n (bytes4(_bytes[2]) >> 16) |\\n (bytes4(_bytes[3]) >> 24);\\n }\\n\\n function memorySliceSelector(bytes memory _bytes)\\n internal\\n pure\\n returns (bytes4 selector)\\n {\\n selector =\\n _bytes[0] |\\n (bytes4(_bytes[1]) >> 8) |\\n (bytes4(_bytes[2]) >> 16) |\\n (bytes4(_bytes[3]) >> 24);\\n }\\n\\n function revertWithError(bytes memory _bytes, string memory _tracingInfo)\\n internal\\n pure\\n {\\n // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err\\n if (_bytes.length % 32 == 4) {\\n bytes4 selector;\\n assembly {\\n selector := mload(add(0x20, _bytes))\\n }\\n if (selector == 0x08c379a0) {\\n // Function selector for Error(string)\\n assembly {\\n _bytes := add(_bytes, 68)\\n }\\n revert(string(abi.encodePacked(_tracingInfo, string(_bytes))));\\n } else {\\n revert(\\n string(abi.encodePacked(_tracingInfo, \\\"NoErrorSelector\\\"))\\n );\\n }\\n } else {\\n revert(\\n string(abi.encodePacked(_tracingInfo, \\\"UnexpectedReturndata\\\"))\\n );\\n }\\n }\\n\\n function returnError(bytes memory _bytes, string memory _tracingInfo)\\n internal\\n pure\\n returns (string memory)\\n {\\n // 68: 32-location, 32-length, 4-ErrorSelector, UTF-8 err\\n if (_bytes.length % 32 == 4) {\\n bytes4 selector;\\n assembly {\\n selector := mload(add(0x20, _bytes))\\n }\\n if (selector == 0x08c379a0) {\\n // Function selector for Error(string)\\n assembly {\\n _bytes := add(_bytes, 68)\\n }\\n return string(abi.encodePacked(_tracingInfo, string(_bytes)));\\n } else {\\n return\\n string(abi.encodePacked(_tracingInfo, \\\"NoErrorSelector\\\"));\\n }\\n } else {\\n return\\n string(abi.encodePacked(_tracingInfo, \\\"UnexpectedReturndata\\\"));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9038c820e041814ca2311bf582f2123171865b36c9438a7c6f85eb99406ec45c\",\"license\":\"UNLICENSED\"},\"contracts/vendor/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.7.4;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return sub(a, b, \\\"SafeMath: subtraction overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n uint256 c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return div(a, b, \\\"SafeMath: division by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n uint256 c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return mod(a, b, \\\"SafeMath: modulo by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts with custom message when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b != 0, errorMessage);\\n return a % b;\\n }\\n}\",\"keccak256\":\"0x2df10d7e2f5eeffa2d90841eef4987593c4b67a0c81bca67ec774c2683a59b43\",\"license\":\"MIT\"}},\"version\":1}",
|
|
"bytecode": "0x608060405234801561001057600080fd5b50610ac2806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063237dcf571461004657806345cea5b314610192578063a99891c5146102d6575b600080fd5b61011d600480360360a081101561005c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561008f57600080fd5b8201836020820111156100a157600080fd5b803590602001918460018302840111600160201b831117156100c257600080fd5b919390929091602081019035600160201b8111156100df57600080fd5b8201836020820111156100f157600080fd5b803590602001918460018302840111600160201b8311171561011257600080fd5b91935091503561034b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015757818101518382015260200161013f565b50505050905090810190601f1680156101845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61011d600480360360a08110156101a857600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156101db57600080fd5b8201836020820111156101ed57600080fd5b803590602001918460018302840111600160201b8311171561020e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561026057600080fd5b82018360208201111561027257600080fd5b803590602001918460018302840111600160201b8311171561029357600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506103fa915050565b61011d600480360360608110156102ec57600080fd5b81359190810190604081016020820135600160201b81111561030d57600080fd5b82018360208201111561031f57600080fd5b803590602001918460018302840111600160201b8311171561034057600080fd5b919350915035610662565b60608787878787878760405160200180886001600160a01b03168152602001876001600160a01b0316815260200180602001806020018481526020018381038352888882818152602001925080828437600083820152601f01601f19169091018481038352868152602001905086868082843760008382015260408051601f909201601f19908116909401828103909401825292909252509a5050505050505050505050979650505050505050565b606060006060876001600160a01b0316866040518082805190602001908083835b6020831061043a5780518252601f19909201916020918201910161041b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461049a576040519150601f19603f3d011682016040523d82523d6000602084013e61049f565b606091505b5091509150816104d5576104cc6040518060600160405280602a8152602001610a63602a913982906107cd565b92505050610659565b60008180602001905160208110156104ec57600080fd5b505160405187519192506001600160a01b038a1691889190819060208401908083835b6020831061052e5780518252601f19909201916020918201910161050f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461058e576040519150601f19603f3d011682016040523d82523d6000602084013e610593565b606091505b509093509150826105cb576105c16040518060600160405280602a8152602001610a39602a913983906107cd565b9350505050610659565b60008280602001905160208110156105e257600080fd5b505190506105f081876109d7565b821061061c57604051806040016040528060028152602001614f4b60f01b815250945050505050610659565b6040518060400160405280602081526020017f414e6f74477265617465724f72457175616c546f4262794d696e7370726561648152509450505050505b95945050505050565b60606000806060806000888860a081101561067c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156106af57600080fd5b8201836020820111156106c157600080fd5b803590602001918460018302840111600160201b831117156106e257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561073457600080fd5b82018360208201111561074657600080fd5b803590602001918460018302840111600160201b8311171561076757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250989d50969b5094995097503595506107bf9450899350889250879150869050856103fa565b9a9950505050505050505050565b606060208351816107da57fe5b066004141561094857602083015162461bcd60e51b6001600160e01b0319821614156108bf5760448401935082846040516020018083805190602001908083835b6020831061083a5780518252601f19909201916020918201910161081b565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106108825780518252601f199092019160209182019101610863565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506109d1565b826040516020018082805190602001908083835b602083106108f25780518252601f1990920191602091820191016108d3565b6001836020036101000a038019825116818451168082178552505050505050905001806e2737a2b93937b929b2b632b1ba37b960891b815250600f019150506040516020818303038152906040529150506109d1565b816040516020018082805190602001908083835b6020831061097b5780518252601f19909201916020918201910161095c565b6001836020036101000a0380198251168184511680821785525050505050509050018073556e657870656374656452657475726e6461746160601b81525060140191505060405160208183030381529060405290505b92915050565b600082820183811015610a31576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe436f6e646974696f6e436f6d7061726554776f55696e74732e636f6d706172652e5f736f75726365423a436f6e646974696f6e436f6d7061726554776f55696e74732e636f6d706172652e5f736f75726365413aa26469706673582212205c9c828072ffa2fbab269eab40da64cafeeadc0ce592addf0e84934a9863da9e64736f6c63430007040033",
|
|
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063237dcf571461004657806345cea5b314610192578063a99891c5146102d6575b600080fd5b61011d600480360360a081101561005c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561008f57600080fd5b8201836020820111156100a157600080fd5b803590602001918460018302840111600160201b831117156100c257600080fd5b919390929091602081019035600160201b8111156100df57600080fd5b8201836020820111156100f157600080fd5b803590602001918460018302840111600160201b8311171561011257600080fd5b91935091503561034b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015757818101518382015260200161013f565b50505050905090810190601f1680156101845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61011d600480360360a08110156101a857600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156101db57600080fd5b8201836020820111156101ed57600080fd5b803590602001918460018302840111600160201b8311171561020e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561026057600080fd5b82018360208201111561027257600080fd5b803590602001918460018302840111600160201b8311171561029357600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506103fa915050565b61011d600480360360608110156102ec57600080fd5b81359190810190604081016020820135600160201b81111561030d57600080fd5b82018360208201111561031f57600080fd5b803590602001918460018302840111600160201b8311171561034057600080fd5b919350915035610662565b60608787878787878760405160200180886001600160a01b03168152602001876001600160a01b0316815260200180602001806020018481526020018381038352888882818152602001925080828437600083820152601f01601f19169091018481038352868152602001905086868082843760008382015260408051601f909201601f19908116909401828103909401825292909252509a5050505050505050505050979650505050505050565b606060006060876001600160a01b0316866040518082805190602001908083835b6020831061043a5780518252601f19909201916020918201910161041b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461049a576040519150601f19603f3d011682016040523d82523d6000602084013e61049f565b606091505b5091509150816104d5576104cc6040518060600160405280602a8152602001610a63602a913982906107cd565b92505050610659565b60008180602001905160208110156104ec57600080fd5b505160405187519192506001600160a01b038a1691889190819060208401908083835b6020831061052e5780518252601f19909201916020918201910161050f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461058e576040519150601f19603f3d011682016040523d82523d6000602084013e610593565b606091505b509093509150826105cb576105c16040518060600160405280602a8152602001610a39602a913983906107cd565b9350505050610659565b60008280602001905160208110156105e257600080fd5b505190506105f081876109d7565b821061061c57604051806040016040528060028152602001614f4b60f01b815250945050505050610659565b6040518060400160405280602081526020017f414e6f74477265617465724f72457175616c546f4262794d696e7370726561648152509450505050505b95945050505050565b60606000806060806000888860a081101561067c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b8111156106af57600080fd5b8201836020820111156106c157600080fd5b803590602001918460018302840111600160201b831117156106e257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561073457600080fd5b82018360208201111561074657600080fd5b803590602001918460018302840111600160201b8311171561076757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250989d50969b5094995097503595506107bf9450899350889250879150869050856103fa565b9a9950505050505050505050565b606060208351816107da57fe5b066004141561094857602083015162461bcd60e51b6001600160e01b0319821614156108bf5760448401935082846040516020018083805190602001908083835b6020831061083a5780518252601f19909201916020918201910161081b565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106108825780518252601f199092019160209182019101610863565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506109d1565b826040516020018082805190602001908083835b602083106108f25780518252601f1990920191602091820191016108d3565b6001836020036101000a038019825116818451168082178552505050505050905001806e2737a2b93937b929b2b632b1ba37b960891b815250600f019150506040516020818303038152906040529150506109d1565b816040516020018082805190602001908083835b6020831061097b5780518252601f19909201916020918201910161095c565b6001836020036101000a0380198251168184511680821785525050505050509050018073556e657870656374656452657475726e6461746160601b81525060140191505060405160208183030381529060405290505b92915050565b600082820183811015610a31576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe436f6e646974696f6e436f6d7061726554776f55696e74732e636f6d706172652e5f736f75726365423a436f6e646974696f6e436f6d7061726554776f55696e74732e636f6d706172652e5f736f75726365413aa26469706673582212205c9c828072ffa2fbab269eab40da64cafeeadc0ce592addf0e84934a9863da9e64736f6c63430007040033",
|
|
"devdoc": {
|
|
"details": "This contract only works if the refContracts fns returndata has a uint in the first 32-byte position.",
|
|
"kind": "dev",
|
|
"methods": {
|
|
"compare(address,address,bytes,bytes,uint256)": {
|
|
"details": "If you want to trigger when ContractA uint is greater than or equal to ContractB by _minSpread: (ContractA=_sourceA, ContractB=_sourceB) For the reverse (lower than/equal to): (ContractA=_sourceB, ContractB=_sourceA)",
|
|
"params": {
|
|
"_minSpread": "The minimum diff between sourceA and sourceB for the Condition to be relevant.",
|
|
"_sourceA": "The first contract that returns a uint for comparison.",
|
|
"_sourceAData": "Payload for retrieving the uint from _sourceA.",
|
|
"_sourceB": "The second contract that returns a uint256 for comparison.",
|
|
"_sourceBData": "Payload for retrieving the uint from _sourceB."
|
|
},
|
|
"returns": {
|
|
"_0": "OK if the Condition is fulfilled."
|
|
}
|
|
},
|
|
"ok(uint256,bytes,uint256)": {
|
|
"details": "Every Gelato Condition must have this function selector as entry point.",
|
|
"params": {
|
|
"_conditionData": "The encoded data from getConditionData()"
|
|
}
|
|
}
|
|
},
|
|
"version": 1
|
|
},
|
|
"userdoc": {
|
|
"kind": "user",
|
|
"methods": {
|
|
"compare(address,address,bytes,bytes,uint256)": {
|
|
"notice": "Compares 2 values from sourceA and sourceB to check if minSpread is there."
|
|
},
|
|
"getConditionData(address,address,bytes,bytes,uint256)": {
|
|
"notice": "Helper to encode the Condition.data field off-chain"
|
|
},
|
|
"ok(uint256,bytes,uint256)": {
|
|
"notice": "Gelato Standard Condition function."
|
|
}
|
|
},
|
|
"notice": "A general contract for retrieving and comparing 2 uints from 2 contracts.",
|
|
"version": 1
|
|
},
|
|
"storageLayout": {
|
|
"storage": [],
|
|
"types": null
|
|
}
|
|
}
|