Cleanup old contracts from eth-contracts folder
This commit is contained in:
parent
8d539a5aac
commit
56c23a9087
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -87,7 +87,7 @@ contract DioneOracle is Ownable {
|
|||||||
require(pendingRequests[_reqID] == requestHash, "Params do not match request ID");
|
require(pendingRequests[_reqID] == requestHash, "Params do not match request ID");
|
||||||
delete pendingRequests[_reqID];
|
delete pendingRequests[_reqID];
|
||||||
dioneStaking.mine(msg.sender);
|
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);
|
emit SubmittedOracleRequest(_requestParams, _callbackAddress, _callbackMethodID, _reqID, _requestDeadline, _data);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user