Files

81 lines
63 KiB
JSON

{
"contractName": "TellorModule",
"sourceName": "contracts/TellorModule.sol",
"compilerVersion": "v0.8.7+commit.e28d00a7",
"constructorArguments": "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c",
"input": {
"language": "Solidity",
"sources": {
"contracts/TellorModule.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport \"@gnosis.pm/zodiac/contracts/core/Module.sol\";\nimport \"usingtellor/contracts/UsingTellor.sol\";\n\ncontract TellorModule is Module, UsingTellor {\n // Events\n event ProposalAdded(bytes32 indexed queryId, string indexed proposalId);\n event TellorModuleSetup(\n address indexed initiator,\n address indexed avatar,\n address target\n );\n // Storage\n bool private initialized;\n uint32 public resultExpiration;\n bytes32 public constant DOMAIN_SEPARATOR_TYPEHASH =\n 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;\n // keccak256(\n // \"EIP712Domain(uint256 chainId,address verifyingContract)\"\n // );\n // Mapping of proposalHash to transactionHash to execution state\n mapping(bytes32 => mapping(bytes32 => bool))\n public executedProposalTransactions;\n bytes32 public constant INVALIDATED =\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\n uint32 public cooldown;\n // Mapping of proposal hash to proposal id. Special case: INVALIDATED for proposal hashes that have been invalidated\n mapping(bytes32 => bytes32) public queryIds;\n bytes32 public constant TRANSACTION_TYPEHASH =\n 0x72e9670a7ee00f5fbf1049b8c38e3f22fab7e9b85029e85cf9412f17fdd5c2ad;\n\n // keccak256(\n // \"Transaction(address to,uint256 value,bytes data,uint8 operation,uint256 nonce)\"\n // );\n /*Functions*/\n /**\n * @param _owner Address of the owner of the module\n * @param _avatar Address of the avatar (e.g. a Safe)\n * @param _target Address of the contract that will call exec function\n * @param _tellorAddress Address of the Tellor oracle contract\n * @param _cooldown Cooldown in seconds that should be required after a oracle provided result\n * @param _expiration Duration that a positive result of the oracle is valid in seconds (or 0 if valid forever)\n * @notice There need to be at least 60 seconds between end of cooldown and expiration\n */\n constructor(\n address _owner,\n address _avatar,\n address _target,\n address payable _tellorAddress,\n uint32 _cooldown,\n uint32 _expiration\n ) UsingTellor(_tellorAddress) {\n bytes memory initParams = abi.encode(\n _owner,\n _avatar,\n _target,\n _tellorAddress,\n _cooldown,\n _expiration\n );\n setUp(initParams);\n }\n\n /**\n * @dev Function to add a proposal that should be considered for execution\n * @param _proposalId Id that should identify the proposal uniquely\n * @param _txHashes EIP-712 hashes of the transactions that should be executed\n */\n function addProposal(string memory _proposalId, bytes32[] memory _txHashes)\n public\n {\n // We generate the proposal string used for the oracle\n string memory _proposal = buildProposal(_proposalId, _txHashes);\n bytes32 _proposalHash = keccak256(bytes(_proposal));\n require(\n queryIds[_proposalHash] == bytes32(0),\n \"Proposal has already been submitted\"\n );\n bytes32 _queryId = getQueryId(_proposalId, _txHashes);\n // Set the proposal hash for this query id\n queryIds[_proposalHash] = _queryId;\n emit ProposalAdded(_queryId, _proposalId);\n }\n\n /**\n * @dev Build the proposal by combining the proposalId and the hex string of the hash of the txHashes\n * @param _proposalId Id of the proposal that proposes to execute the transactions represented by the txHashes\n * @param _txHashes EIP-712 Hashes of the transactions that should be executed\n */\n function buildProposal(\n string memory _proposalId,\n bytes32[] memory _txHashes\n ) public pure returns (string memory) {\n string memory _txsHash = _bytes32ToAsciiString(\n keccak256(abi.encodePacked(_txHashes))\n );\n return\n string(abi.encodePacked(_proposalId, bytes3(0xe2909f), _txsHash));\n }\n\n /**\n * @dev Executes the transactions of a proposal via the target if accepted\n * @param _proposalId Id that should identify the proposal uniquely\n * @param _txHashes EIP-712 hashes of the transactions that should be executed\n * @param _to Target of the transaction that should be executed\n * @param _value Wei value of the transaction that should be executed\n * @param _data Data of the transaction that should be executed\n * @param _operation Operation (Call or Delegatecall) of the transaction that should be executed\n * @notice The txIndex used by this function is always 0\n */\n function executeProposal(\n string memory _proposalId,\n bytes32[] memory _txHashes,\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation\n ) public {\n executeProposalWithIndex(\n _proposalId,\n _txHashes,\n _to,\n _value,\n _data,\n _operation,\n 0\n );\n }\n\n /**\n * @dev Executes the transactions of a proposal via the target if accepted\n * @param _proposalId Id that should identify the proposal uniquely\n * @param _txHashes EIP-712 hashes of the transactions that should be executed\n * @param _to Target of the transaction that should be executed\n * @param _value Wei value of the transaction that should be executed\n * @param _data Data of the transaction that should be executed\n * @param _operation Operation (Call or Delegatecall) of the transaction that should be executed\n * @param _txIndex Index of the transaction hash in txHashes. This is used as the nonce for the transaction, to make the tx hash unique\n */\n function executeProposalWithIndex(\n string memory _proposalId,\n bytes32[] memory _txHashes,\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation,\n uint256 _txIndex\n ) public {\n // We use the hash of the proposal to check the execution state, as the other parameters might change, but the proposal not\n bytes32 _proposalHash = keccak256(\n bytes(buildProposal(_proposalId, _txHashes))\n );\n // Lookup query id for this proposal\n bytes32 _queryId = queryIds[_proposalHash];\n // Proposal hash needs to set to be eligible for execution\n require(\n _queryId != bytes32(0),\n \"No query id set for provided proposal\"\n );\n require(_queryId != INVALIDATED, \"Proposal has been invalidated\");\n bytes32 _txHash = getTransactionHash(\n _to,\n _value,\n _data,\n _operation,\n _txIndex\n );\n require(_txHashes[_txIndex] == _txHash, \"Unexpected transaction hash\");\n (\n bytes memory _valueRetrieved,\n uint256 _timestampReceived\n ) = getDataBefore(_queryId, block.timestamp); // change to getDataAfter(ts=0)\n require(_timestampReceived > 0, \"Data not retrieved\");\n // The result is valid in the time after the cooldown and before the expiration time (if set).\n require(\n _timestampReceived + uint256(cooldown) < block.timestamp, \n \"Wait for additional cooldown\"\n );\n bool _didPass = abi.decode(_valueRetrieved, (bool));\n require(_didPass, \"Transaction was not approved\");\n uint32 _expiration = resultExpiration;\n require(\n _expiration == 0 ||\n _timestampReceived + uint256(_expiration) >= block.timestamp,\n \"Result has expired\"\n );\n // Check this is either the first transaction in the list or that the previous proposal was already approved\n require(\n _txIndex == 0 ||\n executedProposalTransactions[_proposalHash][\n _txHashes[_txIndex - 1]\n ],\n \"Previous transaction not executed yet\"\n );\n // Check that this proposal was not executed yet\n require(\n !executedProposalTransactions[_proposalHash][_txHash],\n \"Cannot execute transaction again\"\n );\n // Mark transaction as executed\n executedProposalTransactions[_proposalHash][_txHash] = true;\n // Execute the transaction via the target.\n require(\n exec(_to, _value, _data, _operation),\n \"Module transaction failed\"\n );\n }\n\n /// @dev Marks a proposal as invalid, preventing execution of the connected transactions\n /// @param _proposalId Id that should identify the proposal uniquely\n /// @param _txHashes EIP-712 hashes of the transactions that should be executed\n /// @notice This can only be called by the owner\n function markProposalAsInvalid(\n string memory _proposalId,\n bytes32[] memory _txHashes // owner only is checked in markProposalAsInvalidByHash(bytes32)\n ) public {\n // We generate the proposal string used for the oracle\n string memory _proposal = buildProposal(_proposalId, _txHashes);\n bytes32 _proposalHash = keccak256(bytes(_proposal));\n markProposalAsInvalidByHash(_proposalHash);\n }\n\n /// @dev Marks a question hash as invalid, preventing execution of the connected transactions\n /// @param _proposalHash Proposal hash calculated based on the proposal id and txHashes\n /// @notice This can only be called by the owner\n function markProposalAsInvalidByHash(bytes32 _proposalHash)\n public\n onlyOwner\n {\n queryIds[_proposalHash] = INVALIDATED;\n }\n\n /**\n * @dev Generate the query id.\n * @param _proposalId Id that should identify the proposal uniquely\n * @notice It is required that this is the same as for the oracle implementation used.\n */\n function getQueryId(string memory _proposalId, bytes32[] memory _txHashes)\n public\n view\n returns (bytes32)\n {\n bytes32 _superHash = keccak256(abi.encode(_txHashes));\n bytes32 _queryId = keccak256(\n abi.encode(\"Snapshot\", abi.encode(_proposalId, _superHash, address(this)))\n );\n return _queryId;\n }\n\n /**\n * @dev Returns the chain id used by this contract.\n */\n function getChainId() public view returns (uint256) {\n uint256 _id;\n // solium-disable-next-line security/no-inline-assembly\n assembly {\n _id := chainid()\n }\n return _id;\n }\n\n /**\n * @dev Generates the data for the module transaction hash (required for signing)\n * @param _to Target of the transaction that should be executed\n * @param _value Wei value of the transaction that should be executed\n * @param _data Data of the transaction that should be executed\n * @param _operation Operation (Call or Delegatecall) of the transaction that should be executed\n * @param _nonce Nonce of the transaction that should be executed\n */\n function generateTransactionHashData(\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation,\n uint256 _nonce\n ) internal view returns (bytes memory) {\n uint256 _chainId = getChainId();\n bytes32 _domainSeparator = keccak256(\n abi.encode(DOMAIN_SEPARATOR_TYPEHASH, _chainId, this)\n );\n bytes32 _transactionHash = keccak256(\n abi.encode(\n TRANSACTION_TYPEHASH,\n _to,\n _value,\n keccak256(_data),\n _operation,\n _nonce\n )\n );\n return\n abi.encodePacked(\n bytes1(0x19),\n bytes1(0x01),\n _domainSeparator,\n _transactionHash\n );\n }\n\n /**\n * @dev Generates the hash for the module transaction\n * @param _to Target of the transaction\n * @param _value Wei value of the transaction\n * @param _data Data of the transaction\n * @param _operation Operation (Call or Delegatecall) of the transaction\n * @param _nonce Nonce of the transaction\n */\n function getTransactionHash(\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation,\n uint256 _nonce\n ) public view returns (bytes32) {\n return\n keccak256(\n generateTransactionHashData(\n _to,\n _value,\n _data,\n _operation,\n _nonce\n )\n );\n }\n\n /**\n * @dev Marks a proposal with an expired result as invalid, preventing execution of the connected transactions\n * @param _proposalHash Proposal hash calculated based on the proposal id and txHashes\n */\n function markProposalWithExpiredResultAsInvalid(bytes32 _proposalHash)\n public\n {\n uint32 _expirationDuration = resultExpiration;\n require(_expirationDuration > 0, \"Results are valid forever\");\n bytes32 _queryId = queryIds[_proposalHash];\n require(_queryId != INVALIDATED, \"Proposal is already invalidated\");\n require(\n _queryId != bytes32(0),\n \"No query id set for provided proposal\"\n );\n (\n bytes memory _valueRetrieved,\n uint256 _timestampRetrieved\n ) = getDataBefore(_queryId, block.timestamp); // change to getDataAfter(ts=0)\n require(_timestampRetrieved > 0, \"Data not retrieved\");\n bool _didPass = abi.decode(_valueRetrieved, (bool));\n require(_didPass, \"Transaction was not approved\");\n require(\n _timestampRetrieved + uint256(_expirationDuration) <\n block.timestamp,\n \"Result has not expired yet\"\n );\n queryIds[_proposalHash] = INVALIDATED;\n }\n\n /**\n // * @dev Initializes the contract with the given parameters.\n // * @param _initParams Initialization parameters for the contract\n // */\n function setUp(bytes memory _initParams) public override {\n (\n address _owner,\n address _avatar,\n address _target,\n address _tellorAddress,\n uint32 _cooldown,\n uint32 _expiration\n ) = abi.decode(\n _initParams,\n (address, address, address, address, uint32, uint32)\n );\n require(\n !initialized,\n \"Initializable: contract is already initialized\"\n );\n initialized = true;\n __Ownable_init();\n require(_avatar != address(0), \"Avatar can not be zero address\");\n require(_target != address(0), \"Target can not be zero address\");\n require(\n _expiration == 0 || _expiration - _cooldown >= 60,\n \"There need to be at least 60s between end of cooldown and expiration\"\n );\n avatar = _avatar;\n target = _target;\n tellor = ITellor(payable(_tellorAddress));\n resultExpiration = _expiration;\n cooldown = _cooldown;\n\n transferOwnership(_owner);\n\n emit TellorModuleSetup(msg.sender, _avatar, _target);\n }\n\n /**\n * @dev converts bytes32 to string\n * @param _bytes bytes32 to be converted\n */\n function _bytes32ToAsciiString(bytes32 _bytes)\n internal\n pure\n returns (string memory)\n {\n bytes memory s = new bytes(64);\n for (uint256 i = 0; i < 32; i++) {\n uint8 b = uint8(bytes1(_bytes << (i * 8)));\n uint8 hi = uint8(b) / 16;\n uint8 lo = uint8(b) % 16;\n s[2 * i] = _char(hi);\n s[2 * i + 1] = _char(lo);\n }\n return string(s);\n }\n\n /**\n * @dev converts uint8 to char\n * @param _b uint8 to be converted\n */\n function _char(uint8 _b) internal pure returns (bytes1 c) {\n if (_b < 10) return bytes1(_b + 0x30);\n else return bytes1(_b + 0x57);\n }\n}\n"
},
"@gnosis.pm/zodiac/contracts/core/Module.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Module Interface - A contract that can pass messages to a Module Manager contract if enabled by that contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../interfaces/IAvatar.sol\";\nimport \"../factory/FactoryFriendly.sol\";\nimport \"../guard/Guardable.sol\";\n\nabstract contract Module is FactoryFriendly, Guardable {\n /// @dev Emitted each time the avatar is set.\n event AvatarSet(address indexed previousAvatar, address indexed newAvatar);\n /// @dev Emitted each time the Target is set.\n event TargetSet(address indexed previousTarget, address indexed newTarget);\n\n /// @dev Address that will ultimately execute function calls.\n address public avatar;\n /// @dev Address that this module will pass transactions to.\n address public target;\n\n /// @dev Sets the avatar to a new avatar (`newAvatar`).\n /// @notice Can only be called by the current owner.\n function setAvatar(address _avatar) public onlyOwner {\n address previousAvatar = avatar;\n avatar = _avatar;\n emit AvatarSet(previousAvatar, _avatar);\n }\n\n /// @dev Sets the target to a new target (`newTarget`).\n /// @notice Can only be called by the current owner.\n function setTarget(address _target) public onlyOwner {\n address previousTarget = target;\n target = _target;\n emit TargetSet(previousTarget, _target);\n }\n\n /// @dev Passes a transaction to be executed by the avatar.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function exec(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success) {\n /// check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n address(0)\n );\n }\n success = IAvatar(target).execTransactionFromModule(\n to,\n value,\n data,\n operation\n );\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return success;\n }\n\n /// @dev Passes a transaction to be executed by the target and returns data.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execAndReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success, bytes memory returnData) {\n /// check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n address(0)\n );\n }\n (success, returnData) = IAvatar(target)\n .execTransactionFromModuleReturnData(to, value, data, operation);\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return (success, returnData);\n }\n}\n"
},
"usingtellor/contracts/UsingTellor.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport \"./interface/ITellor.sol\";\nimport \"./interface/IERC2362.sol\";\nimport \"./interface/IMappingContract.sol\";\n\n/**\n @author Tellor Inc\n @title UsingTellor\n @dev This contract helps smart contracts read data from Tellor\n */\ncontract UsingTellor is IERC2362 {\n ITellor public tellor;\n IMappingContract public idMappingContract;\n\n /*Constructor*/\n /**\n * @dev the constructor sets the oracle address in storage\n * @param _tellor is the Tellor Oracle address\n */\n constructor(address payable _tellor) {\n tellor = ITellor(_tellor);\n }\n\n /*Getters*/\n /**\n * @dev Retrieves the next value for the queryId after the specified timestamp\n * @param _queryId is the queryId to look up the value for\n * @param _timestamp after which to search for next value\n * @return _value the value retrieved\n * @return _timestampRetrieved the value's timestamp\n */\n function getDataAfter(bytes32 _queryId, uint256 _timestamp)\n public\n view\n returns (bytes memory _value, uint256 _timestampRetrieved)\n {\n (bool _found, uint256 _index) = getIndexForDataAfter(\n _queryId,\n _timestamp\n );\n if (!_found) {\n return (\"\", 0);\n }\n _timestampRetrieved = getTimestampbyQueryIdandIndex(_queryId, _index);\n _value = retrieveData(_queryId, _timestampRetrieved);\n return (_value, _timestampRetrieved);\n }\n\n /**\n * @dev Retrieves the latest value for the queryId before the specified timestamp\n * @param _queryId is the queryId to look up the value for\n * @param _timestamp before which to search for latest value\n * @return _value the value retrieved\n * @return _timestampRetrieved the value's timestamp\n */\n function getDataBefore(bytes32 _queryId, uint256 _timestamp)\n public\n view\n returns (bytes memory _value, uint256 _timestampRetrieved)\n {\n (, _value, _timestampRetrieved) = tellor.getDataBefore(\n _queryId,\n _timestamp\n );\n }\n\n /**\n * @dev Retrieves latest array index of data before the specified timestamp for the queryId\n * @param _queryId is the queryId to look up the index for\n * @param _timestamp is the timestamp before which to search for the latest index\n * @return _found whether the index was found\n * @return _index the latest index found before the specified timestamp\n */\n // slither-disable-next-line calls-loop\n function getIndexForDataAfter(bytes32 _queryId, uint256 _timestamp)\n public\n view\n returns (bool _found, uint256 _index)\n {\n uint256 _count = getNewValueCountbyQueryId(_queryId);\n if (_count == 0) return (false, 0);\n _count--;\n bool _search = true; // perform binary search\n uint256 _middle = 0;\n uint256 _start = 0;\n uint256 _end = _count;\n uint256 _timestampRetrieved;\n // checking boundaries to short-circuit the algorithm\n _timestampRetrieved = getTimestampbyQueryIdandIndex(_queryId, _end);\n if (_timestampRetrieved <= _timestamp) return (false, 0);\n _timestampRetrieved = getTimestampbyQueryIdandIndex(_queryId, _start);\n if (_timestampRetrieved > _timestamp) {\n // candidate found, check for disputes\n _search = false;\n }\n // since the value is within our boundaries, do a binary search\n while (_search) {\n _middle = (_end + _start) / 2;\n _timestampRetrieved = getTimestampbyQueryIdandIndex(\n _queryId,\n _middle\n );\n if (_timestampRetrieved > _timestamp) {\n // get immediate previous value\n uint256 _prevTime = getTimestampbyQueryIdandIndex(\n _queryId,\n _middle - 1\n );\n if (_prevTime <= _timestamp) {\n // candidate found, check for disputes\n _search = false;\n } else {\n // look from start to middle -1(prev value)\n _end = _middle - 1;\n }\n } else {\n // get immediate next value\n uint256 _nextTime = getTimestampbyQueryIdandIndex(\n _queryId,\n _middle + 1\n );\n if (_nextTime > _timestamp) {\n // candidate found, check for disputes\n _search = false;\n _middle++;\n _timestampRetrieved = _nextTime;\n } else {\n // look from middle + 1(next value) to end\n _start = _middle + 1;\n }\n }\n }\n // candidate found, check for disputed values\n if (!isInDispute(_queryId, _timestampRetrieved)) {\n // _timestampRetrieved is correct\n return (true, _middle);\n } else {\n // iterate forward until we find a non-disputed value\n while (\n isInDispute(_queryId, _timestampRetrieved) && _middle < _count\n ) {\n _middle++;\n _timestampRetrieved = getTimestampbyQueryIdandIndex(\n _queryId,\n _middle\n );\n }\n if (\n _middle == _count && isInDispute(_queryId, _timestampRetrieved)\n ) {\n return (false, 0);\n }\n // _timestampRetrieved is correct\n return (true, _middle);\n }\n }\n\n /**\n * @dev Retrieves latest array index of data before the specified timestamp for the queryId\n * @param _queryId is the queryId to look up the index for\n * @param _timestamp is the timestamp before which to search for the latest index\n * @return _found whether the index was found\n * @return _index the latest index found before the specified timestamp\n */\n // slither-disable-next-line calls-loop\n function getIndexForDataBefore(bytes32 _queryId, uint256 _timestamp)\n public\n view\n returns (bool _found, uint256 _index)\n {\n return tellor.getIndexForDataBefore(_queryId, _timestamp);\n }\n\n /**\n * @dev Retrieves multiple uint256 values before the specified timestamp\n * @param _queryId the unique id of the data query\n * @param _timestamp the timestamp before which to search for values\n * @param _maxAge the maximum number of seconds before the _timestamp to search for values\n * @param _maxCount the maximum number of values to return\n * @return _values the values retrieved, ordered from oldest to newest\n * @return _timestamps the timestamps of the values retrieved\n */\n function getMultipleValuesBefore(\n bytes32 _queryId,\n uint256 _timestamp,\n uint256 _maxAge,\n uint256 _maxCount\n )\n public\n view\n returns (bytes[] memory _values, uint256[] memory _timestamps)\n {\n // get index of first possible value\n (bool _ifRetrieve, uint256 _startIndex) = getIndexForDataAfter(\n _queryId,\n _timestamp - _maxAge\n );\n // no value within range\n if (!_ifRetrieve) {\n return (new bytes[](0), new uint256[](0));\n }\n uint256 _endIndex;\n // get index of last possible value\n (_ifRetrieve, _endIndex) = getIndexForDataBefore(_queryId, _timestamp);\n // no value before _timestamp\n if (!_ifRetrieve) {\n return (new bytes[](0), new uint256[](0));\n }\n uint256 _valCount = 0;\n uint256 _index = 0;\n uint256[] memory _timestampsArrayTemp = new uint256[](_maxCount);\n // generate array of non-disputed timestamps within range\n while (_valCount < _maxCount && _endIndex + 1 - _index > _startIndex) {\n uint256 _timestampRetrieved = getTimestampbyQueryIdandIndex(\n _queryId,\n _endIndex - _index\n );\n if (!isInDispute(_queryId, _timestampRetrieved)) {\n _timestampsArrayTemp[_valCount] = _timestampRetrieved;\n _valCount++;\n }\n _index++;\n }\n\n bytes[] memory _valuesArray = new bytes[](_valCount);\n uint256[] memory _timestampsArray = new uint256[](_valCount);\n // retrieve values and reverse timestamps order\n for (uint256 _i = 0; _i < _valCount; _i++) {\n _timestampsArray[_i] = _timestampsArrayTemp[_valCount - 1 - _i];\n _valuesArray[_i] = retrieveData(_queryId, _timestampsArray[_i]);\n }\n return (_valuesArray, _timestampsArray);\n }\n\n /**\n * @dev Counts the number of values that have been submitted for the queryId\n * @param _queryId the id to look up\n * @return uint256 count of the number of values received for the queryId\n */\n function getNewValueCountbyQueryId(bytes32 _queryId)\n public\n view\n returns (uint256)\n {\n return tellor.getNewValueCountbyQueryId(_queryId);\n }\n\n /**\n * @dev Returns the address of the reporter who submitted a value for a data ID at a specific time\n * @param _queryId is ID of the specific data feed\n * @param _timestamp is the timestamp to find a corresponding reporter for\n * @return address of the reporter who reported the value for the data ID at the given timestamp\n */\n function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp)\n public\n view\n returns (address)\n {\n return tellor.getReporterByTimestamp(_queryId, _timestamp);\n }\n\n /**\n * @dev Gets the timestamp for the value based on their index\n * @param _queryId is the id to look up\n * @param _index is the value index to look up\n * @return uint256 timestamp\n */\n function getTimestampbyQueryIdandIndex(bytes32 _queryId, uint256 _index)\n public\n view\n returns (uint256)\n {\n return tellor.getTimestampbyQueryIdandIndex(_queryId, _index);\n }\n\n /**\n * @dev Determines whether a value with a given queryId and timestamp has been disputed\n * @param _queryId is the value id to look up\n * @param _timestamp is the timestamp of the value to look up\n * @return bool true if queryId/timestamp is under dispute\n */\n function isInDispute(bytes32 _queryId, uint256 _timestamp)\n public\n view\n returns (bool)\n {\n return tellor.isInDispute(_queryId, _timestamp);\n }\n\n /**\n * @dev Retrieve value from oracle based on queryId/timestamp\n * @param _queryId being requested\n * @param _timestamp to retrieve data/value from\n * @return bytes value for query/timestamp submitted\n */\n function retrieveData(bytes32 _queryId, uint256 _timestamp)\n public\n view\n returns (bytes memory)\n {\n return tellor.retrieveData(_queryId, _timestamp);\n }\n\n /**\n * @dev allows dev to set mapping contract for valueFor (EIP2362)\n * @param _addy address of mapping contract\n */\n function setIdMappingContract(address _addy) external {\n require(address(idMappingContract) == address(0));\n idMappingContract = IMappingContract(_addy);\n }\n\n /**\n * @dev Retrieve most recent int256 value from oracle based on queryId\n * @param _id being requested\n * @return _value most recent value submitted\n * @return _timestamp timestamp of most recent value\n * @return _statusCode 200 if value found, 404 if not found\n */\n function valueFor(bytes32 _id)\n external\n view\n override\n returns (\n int256 _value,\n uint256 _timestamp,\n uint256 _statusCode\n )\n {\n bytes32 _queryId = idMappingContract.getTellorID(_id);\n bytes memory _valueBytes;\n (_valueBytes, _timestamp) = getDataBefore(\n _queryId,\n block.timestamp + 1\n );\n if (_timestamp == 0) {\n return (0, 0, 404);\n }\n uint256 _valueUint = _sliceUint(_valueBytes);\n _value = int256(_valueUint);\n return (_value, _timestamp, 200);\n }\n\n // Internal functions\n /**\n * @dev Convert bytes to uint256\n * @param _b bytes value to convert to uint256\n * @return _number uint256 converted from bytes\n */\n function _sliceUint(bytes memory _b)\n internal\n pure\n returns (uint256 _number)\n {\n for (uint256 _i = 0; _i < _b.length; _i++) {\n _number = _number * 256 + uint8(_b[_i]);\n }\n }\n}\n"
},
"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IAvatar {\n /// @dev Enables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Modules should be stored as a linked list.\n /// @notice Must emit EnabledModule(address module) if successful.\n /// @param module Module to be enabled.\n function enableModule(address module) external;\n\n /// @dev Disables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Must emit DisabledModule(address module) if successful.\n /// @param prevModule Address that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) external;\n\n /// @dev Allows a Module to execute a transaction.\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success);\n\n /// @dev Allows a Module to execute a transaction and return data\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success, bytes memory returnData);\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) external view returns (bool);\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next);\n}\n"
},
"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FactoryFriendly is OwnableUpgradeable {\n function setUp(bytes memory initializeParams) public virtual;\n}\n"
},
"@gnosis.pm/zodiac/contracts/guard/Guardable.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@gnosis.pm/safe-contracts/contracts/interfaces/IERC165.sol\";\nimport \"./BaseGuard.sol\";\n\n/// @title Guardable - A contract that manages fallback calls made to this contract\ncontract Guardable is OwnableUpgradeable {\n event ChangedGuard(address guard);\n\n address public guard;\n\n /// @dev Set a guard that checks transactions before execution\n /// @param _guard The address of the guard to be used or the 0 address to disable the guard\n function setGuard(address _guard) external onlyOwner {\n if (_guard != address(0)) {\n require(\n BaseGuard(_guard).supportsInterface(type(IGuard).interfaceId),\n \"Guard does not implement IERC165\"\n );\n }\n guard = _guard;\n emit ChangedGuard(guard);\n }\n\n function getGuard() external view returns (address _guard) {\n return guard;\n }\n}\n"
},
"@gnosis.pm/safe-contracts/contracts/common/Enum.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Enum - Collection of enums\n/// @author Richard Meissner - <[email protected]>\ncontract Enum {\n enum Operation {Call, DelegateCall}\n}\n"
},
"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal initializer {\n __Context_init_unchained();\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal initializer {\n _setOwner(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n uint256[49] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal initializer {\n __Context_init_unchained();\n }\n\n function __Context_init_unchained() internal initializer {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n require(_initializing || !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n}\n"
},
"@gnosis.pm/safe-contracts/contracts/interfaces/IERC165.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @notice More details at https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/IERC165.sol\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
},
"@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@gnosis.pm/safe-contracts/contracts/interfaces/IERC165.sol\";\nimport \"../interfaces/IGuard.sol\";\n\nabstract contract BaseGuard is IERC165 {\n function supportsInterface(bytes4 interfaceId)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceId == type(IGuard).interfaceId || // 0xe6d7a83a\n interfaceId == type(IERC165).interfaceId; // 0x01ffc9a7\n }\n\n /// Module transactions only use the first four parameters: to, value, data, and operation.\n /// Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.\n /// This interface is used to maintain compatibilty with Gnosis Safe transaction guards.\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external virtual;\n\n function checkAfterExecution(bytes32 txHash, bool success) external virtual;\n}\n"
},
"@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol": {
"content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IGuard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n"
},
"usingtellor/contracts/interface/ITellor.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface ITellor {\n //Controller\n function addresses(bytes32) external view returns (address);\n\n function uints(bytes32) external view returns (uint256);\n\n function burn(uint256 _amount) external;\n\n function changeDeity(address _newDeity) external;\n\n function changeOwner(address _newOwner) external;\n function changeUint(bytes32 _target, uint256 _amount) external;\n\n function migrate() external;\n\n function mint(address _reciever, uint256 _amount) external;\n\n function init() external;\n\n function getAllDisputeVars(uint256 _disputeId)\n external\n view\n returns (\n bytes32,\n bool,\n bool,\n bool,\n address,\n address,\n address,\n uint256[9] memory,\n int256\n );\n\n function getDisputeIdByDisputeHash(bytes32 _hash)\n external\n view\n returns (uint256);\n\n function getDisputeUintVars(uint256 _disputeId, bytes32 _data)\n external\n view\n returns (uint256);\n\n function getLastNewValueById(uint256 _requestId)\n external\n view\n returns (uint256, bool);\n\n function retrieveData(uint256 _requestId, uint256 _timestamp)\n external\n view\n returns (uint256);\n\n function getNewValueCountbyRequestId(uint256 _requestId)\n external\n view\n returns (uint256);\n\n function getAddressVars(bytes32 _data) external view returns (address);\n\n function getUintVar(bytes32 _data) external view returns (uint256);\n\n function totalSupply() external view returns (uint256);\n\n function name() external pure returns (string memory);\n\n function symbol() external pure returns (string memory);\n\n function decimals() external pure returns (uint8);\n\n function isMigrated(address _addy) external view returns (bool);\n\n function allowance(address _user, address _spender)\n external\n view\n returns (uint256);\n\n function allowedToTrade(address _user, uint256 _amount)\n external\n view\n returns (bool);\n\n function approve(address _spender, uint256 _amount) external returns (bool);\n\n function approveAndTransferFrom(\n address _from,\n address _to,\n uint256 _amount\n ) external returns (bool);\n\n function balanceOf(address _user) external view returns (uint256);\n\n function balanceOfAt(address _user, uint256 _blockNumber)\n external\n view\n returns (uint256);\n\n function transfer(address _to, uint256 _amount)\n external\n returns (bool success);\n\n function transferFrom(\n address _from,\n address _to,\n uint256 _amount\n ) external returns (bool success);\n\n function depositStake() external;\n\n function requestStakingWithdraw() external;\n\n function withdrawStake() external;\n\n function changeStakingStatus(address _reporter, uint256 _status) external;\n\n function slashReporter(address _reporter, address _disputer) external;\n\n function getStakerInfo(address _staker)\n external\n view\n returns (uint256, uint256);\n\n function getTimestampbyRequestIDandIndex(uint256 _requestId, uint256 _index)\n external\n view\n returns (uint256);\n\n function getNewCurrentVariables()\n external\n view\n returns (\n bytes32 _c,\n uint256[5] memory _r,\n uint256 _d,\n uint256 _t\n );\n\n function getNewValueCountbyQueryId(bytes32 _queryId)\n external\n view\n returns (uint256);\n\n function getTimestampbyQueryIdandIndex(bytes32 _queryId, uint256 _index)\n external\n view\n returns (uint256);\n\n function retrieveData(bytes32 _queryId, uint256 _timestamp)\n external\n view\n returns (bytes memory);\n\n //Governance\n enum VoteResult {\n FAILED,\n PASSED,\n INVALID\n }\n\n function setApprovedFunction(bytes4 _func, bool _val) external;\n\n function beginDispute(bytes32 _queryId, uint256 _timestamp) external;\n\n function delegate(address _delegate) external;\n\n function delegateOfAt(address _user, uint256 _blockNumber)\n external\n view\n returns (address);\n\n function executeVote(uint256 _disputeId) external;\n\n function proposeVote(\n address _contract,\n bytes4 _function,\n bytes calldata _data,\n uint256 _timestamp\n ) external;\n\n function tallyVotes(uint256 _disputeId) external;\n\n function governance() external view returns (address);\n\n function updateMinDisputeFee() external;\n\n function verify() external pure returns (uint256);\n\n function vote(\n uint256 _disputeId,\n bool _supports,\n bool _invalidQuery\n ) external;\n\n function voteFor(\n address[] calldata _addys,\n uint256 _disputeId,\n bool _supports,\n bool _invalidQuery\n ) external;\n\n function getDelegateInfo(address _holder)\n external\n view\n returns (address, uint256);\n\n function isFunctionApproved(bytes4 _func) external view returns (bool);\n\n function isApprovedGovernanceContract(address _contract)\n external\n returns (bool);\n\n function getVoteRounds(bytes32 _hash)\n external\n view\n returns (uint256[] memory);\n\n function getVoteCount() external view returns (uint256);\n\n function getVoteInfo(uint256 _disputeId)\n external\n view\n returns (\n bytes32,\n uint256[9] memory,\n bool[2] memory,\n VoteResult,\n bytes memory,\n bytes4,\n address[2] memory\n );\n\n function getDisputeInfo(uint256 _disputeId)\n external\n view\n returns (\n uint256,\n uint256,\n bytes memory,\n address\n );\n\n function getOpenDisputesOnId(bytes32 _queryId)\n external\n view\n returns (uint256);\n\n function didVote(uint256 _disputeId, address _voter)\n external\n view\n returns (bool);\n\n //Oracle\n function getReportTimestampByIndex(bytes32 _queryId, uint256 _index)\n external\n view\n returns (uint256);\n\n function getValueByTimestamp(bytes32 _queryId, uint256 _timestamp)\n external\n view\n returns (bytes memory);\n\n function getBlockNumberByTimestamp(bytes32 _queryId, uint256 _timestamp)\n external\n view\n returns (uint256);\n\n function getReportingLock() external view returns (uint256);\n\n function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp)\n external\n view\n returns (address);\n\n function reportingLock() external view returns (uint256);\n\n function removeValue(bytes32 _queryId, uint256 _timestamp) external;\n function getTipsByUser(address _user) external view returns(uint256);\n function tipQuery(bytes32 _queryId, uint256 _tip, bytes memory _queryData) external;\n function submitValue(bytes32 _queryId, bytes calldata _value, uint256 _nonce, bytes memory _queryData) external;\n function burnTips() external;\n\n function changeReportingLock(uint256 _newReportingLock) external;\n function getReportsSubmittedByAddress(address _reporter) external view returns(uint256);\n function changeTimeBasedReward(uint256 _newTimeBasedReward) external;\n function getReporterLastTimestamp(address _reporter) external view returns(uint256);\n function getTipsById(bytes32 _queryId) external view returns(uint256);\n function getTimeBasedReward() external view returns(uint256);\n function getTimestampCountById(bytes32 _queryId) external view returns(uint256);\n function getTimestampIndexByTimestamp(bytes32 _queryId, uint256 _timestamp) external view returns(uint256);\n function getCurrentReward(bytes32 _queryId) external view returns(uint256, uint256);\n function getCurrentValue(bytes32 _queryId) external view returns(bytes memory);\n function getDataBefore(bytes32 _queryId, uint256 _timestamp) external view returns(bool _ifRetrieve, bytes memory _value, uint256 _timestampRetrieved);\n function getTimeOfLastNewValue() external view returns(uint256);\n function depositStake(uint256 _amount) external;\n function requestStakingWithdraw(uint256 _amount) external;\n\n //Test functions\n function changeAddressVar(bytes32 _id, address _addy) external;\n\n //parachute functions\n function killContract() external;\n\n function migrateFor(address _destination, uint256 _amount) external;\n\n function rescue51PercentAttack(address _tokenHolder) external;\n\n function rescueBrokenDataReporting() external;\n\n function rescueFailedUpdate() external;\n\n //Tellor 360\n function addStakingRewards(uint256 _amount) external;\n\n function _sliceUint(bytes memory _b)\n external\n pure\n returns (uint256 _number);\n\n function claimOneTimeTip(bytes32 _queryId, uint256[] memory _timestamps)\n external;\n\n function claimTip(\n bytes32 _feedId,\n bytes32 _queryId,\n uint256[] memory _timestamps\n ) external;\n\n function fee() external view returns (uint256);\n\n function feedsWithFunding(uint256) external view returns (bytes32);\n\n function fundFeed(\n bytes32 _feedId,\n bytes32 _queryId,\n uint256 _amount\n ) external;\n\n function getCurrentFeeds(bytes32 _queryId)\n external\n view\n returns (bytes32[] memory);\n\n function getCurrentTip(bytes32 _queryId) external view returns (uint256);\n\n function getDataAfter(bytes32 _queryId, uint256 _timestamp)\n external\n view\n returns (bytes memory _value, uint256 _timestampRetrieved);\n\n function getDataFeed(bytes32 _feedId)\n external\n view\n returns (Autopay.FeedDetails memory);\n\n function getFundedFeeds() external view returns (bytes32[] memory);\n\n function getFundedQueryIds() external view returns (bytes32[] memory);\n\n function getIndexForDataAfter(bytes32 _queryId, uint256 _timestamp)\n external\n view\n returns (bool _found, uint256 _index);\n\n function getIndexForDataBefore(bytes32 _queryId, uint256 _timestamp)\n external\n view\n returns (bool _found, uint256 _index);\n\n function getMultipleValuesBefore(\n bytes32 _queryId,\n uint256 _timestamp,\n uint256 _maxAge,\n uint256 _maxCount\n )\n external\n view\n returns (uint256[] memory _values, uint256[] memory _timestamps);\n\n function getPastTipByIndex(bytes32 _queryId, uint256 _index)\n external\n view\n returns (Autopay.Tip memory);\n\n function getPastTipCount(bytes32 _queryId) external view returns (uint256);\n\n function getPastTips(bytes32 _queryId)\n external\n view\n returns (Autopay.Tip[] memory);\n\n function getQueryIdFromFeedId(bytes32 _feedId)\n external\n view\n returns (bytes32);\n\n function getRewardAmount(\n bytes32 _feedId,\n bytes32 _queryId,\n uint256[] memory _timestamps\n ) external view returns (uint256 _cumulativeReward);\n\n function getRewardClaimedStatus(\n bytes32 _feedId,\n bytes32 _queryId,\n uint256 _timestamp\n ) external view returns (bool);\n\n function getTipsByAddress(address _user) external view returns (uint256);\n\n function isInDispute(bytes32 _queryId, uint256 _timestamp)\n external\n view\n returns (bool);\n\n function queryIdFromDataFeedId(bytes32) external view returns (bytes32);\n\n function queryIdsWithFunding(uint256) external view returns (bytes32);\n\n function queryIdsWithFundingIndex(bytes32) external view returns (uint256);\n\n function setupDataFeed(\n bytes32 _queryId,\n uint256 _reward,\n uint256 _startTime,\n uint256 _interval,\n uint256 _window,\n uint256 _priceThreshold,\n uint256 _rewardIncreasePerSecond,\n bytes memory _queryData,\n uint256 _amount\n ) external;\n\n function tellor() external view returns (address);\n\n function tip(\n bytes32 _queryId,\n uint256 _amount,\n bytes memory _queryData\n ) external;\n\n function tips(bytes32, uint256)\n external\n view\n returns (uint256 amount, uint256 timestamp);\n\n function token() external view returns (address);\n\n function userTipsTotal(address) external view returns (uint256);\n\n function valueFor(bytes32 _id)\n external\n view\n returns (\n int256 _value,\n uint256 _timestamp,\n uint256 _statusCode\n );\n}\n\ninterface Autopay {\n struct FeedDetails {\n uint256 reward;\n uint256 balance;\n uint256 startTime;\n uint256 interval;\n uint256 window;\n uint256 priceThreshold;\n uint256 rewardIncreasePerSecond;\n uint256 feedsWithFundingIndex;\n }\n\n struct Tip {\n uint256 amount;\n uint256 timestamp;\n }\n function getStakeAmount() external view returns(uint256);\n function stakeAmount() external view returns(uint256);\n function token() external view returns(address);\n}\n"
},
"usingtellor/contracts/interface/IERC2362.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/**\n * @dev EIP2362 Interface for pull oracles\n * https://github.com/tellor-io/EIP-2362\n*/\ninterface IERC2362\n{\n\t/**\n\t * @dev Exposed function pertaining to EIP standards\n\t * @param _id bytes32 ID of the query\n\t * @return int,uint,uint returns the value, timestamp, and status code of query\n\t */\n\tfunction valueFor(bytes32 _id) external view returns(int256,uint256,uint256);\n}"
},
"usingtellor/contracts/interface/IMappingContract.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IMappingContract{\n function getTellorID(bytes32 _id) external view returns(bytes32);\n}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}
}
}