diff --git a/eth-contracts/contracts/Aggregator.sol b/eth-contracts/contracts/Aggregator.sol deleted file mode 100644 index f6fad23..0000000 --- a/eth-contracts/contracts/Aggregator.sol +++ /dev/null @@ -1,23 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity >= 0.5.0 < 0.7.0; - -import "@openzeppelin/contracts/access/Ownable.sol"; -import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; -import "./DioneStaking.sol"; - -interface IMediator { - function _receiveDataCallback(uint256 reqID, string memory data) external; -} - -contract Aggregator is Ownable, ReentrancyGuard { - DioneStaking public dioneStaking; - - constructor(DioneStaking _dioneStaking) public { - dioneStaking = _dioneStaking; - } - - function collectData(uint256 reqID, string memory data, IMediator callbackAddress) public { - dioneStaking.mine(msg.sender); - callbackAddress._receiveDataCallback(reqID, data); - } -} diff --git a/eth-contracts/contracts/DioneOracle.sol b/eth-contracts/contracts/DioneOracle.sol index 54027e1..4d1adb6 100644 --- a/eth-contracts/contracts/DioneOracle.sol +++ b/eth-contracts/contracts/DioneOracle.sol @@ -87,7 +87,7 @@ contract DioneOracle is Ownable { require(pendingRequests[_reqID] == requestHash, "Params do not match request ID"); delete pendingRequests[_reqID]; dioneStaking.mine(msg.sender); - (bool success, ) = _callbackAddress.call(abi.encodeWithSelector(_callbackMethodID, _reqID, _data)); + (bool success, ) = _callbackAddress.call(abi.encodeWithSelector(_callbackMethodID, _reqID, _data)); // TODO: check on success call emit SubmittedOracleRequest(_requestParams, _callbackAddress, _callbackMethodID, _reqID, _requestDeadline, _data); return success; } diff --git a/eth-contracts/contracts/Mediator.sol b/eth-contracts/contracts/Mediator.sol deleted file mode 100644 index 75c9fee..0000000 --- a/eth-contracts/contracts/Mediator.sol +++ /dev/null @@ -1,29 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity >= 0.5.0 < 0.7.0; - -import "./vendor/Ownable.sol"; -import "./OracleEmitter.sol"; - -contract Mediator is Ownable { - event DataReceived( - uint256 reqID, - string data - ); - - OracleEmitter oracleEmitter; - address aggregator; - - constructor(address _oracleEmitter, address _aggregator) public Ownable() { - oracleEmitter = OracleEmitter(_oracleEmitter); - aggregator = _aggregator; - } - - function request(uint8 originChain, string memory requestType, string memory requestParams) public returns (uint256) { - return oracleEmitter.requestOracles(originChain, requestType, requestParams, address(this), bytes4(keccak256("_receiveDataCallback(uint256, string)"))); - } - - function _receiveDataCallback(uint256 reqID, string memory data) public { - require(msg.sender == aggregator); - emit DataReceived(reqID, data); - } -} diff --git a/eth-contracts/contracts/OracleEmitter.sol b/eth-contracts/contracts/OracleEmitter.sol deleted file mode 100644 index 36ae5d6..0000000 --- a/eth-contracts/contracts/OracleEmitter.sol +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.4.21 <0.7.0; - -contract OracleEmitter { - uint256 requestCounter; - - event NewOracleRequest( - uint8 originChain, - string requestType, - string requestParams, - address callbackAddress, - bytes4 callbackMethodID, - uint256 requestID - ); - - function requestOracles(uint8 originChain, string memory requestType, string memory requestParams, address callbackAddress, bytes4 callbackMethodID) public returns (uint256) { - requestCounter++; - emit NewOracleRequest(originChain, requestType, requestParams, callbackAddress, callbackMethodID, requestCounter); - return requestCounter; - } -}