pragma solidity >=0.6.8 <0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
constructor() internal {
_owner = msg.sender;
}
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_owner = newOwner;
}
}
interface ITellor {
function addTip(uint256 _requestId, uint256 _tip) external;
function submitMiningSolution(string calldata _nonce, uint256[5] calldata _requestId, uint256[5] calldata _value) external;
function depositStake() external;
function requestStakingWithdraw() external;
function withdrawStake() external;
function getUintVar(bytes32 _data) external view returns (uint256);
function vote(uint256 _disputeId, bool _supportsDispute) external;
function transfer(address _to, uint256 _amount) external returns (bool);
}
contract TellorProxy is Ownable {
address tellorAddress;
constructor(address _tellorAddress)
public
{
tellorAddress = _tellorAddress;
}
function addTip(uint256 _requestId, uint256 _tip) external onlyOwner {
ITellor(tellorAddress).addTip(_requestId, _tip);
}
function submitMiningSolution(
string calldata _nonce,
uint256[5] calldata _requestId,
uint256[5] calldata _value,
uint256 _pass
) external onlyOwner {
if (_pass == 0) {
bytes32 slotProgress =
0x6c505cb2db6644f57b42d87bd9407b0f66788b07d0617a2bc1356a0e69e66f9a;
uint256 _soltNum = ITellor(tellorAddress).getUintVar(slotProgress);
require(_soltNum != 4, "haha");
}
ITellor(tellorAddress).submitMiningSolution(_nonce, _requestId, _value);
}
function depositStake() external onlyOwner {
ITellor(tellorAddress).depositStake();
}
function requestStakingWithdraw() external onlyOwner {
ITellor(tellorAddress).requestStakingWithdraw();
}
function payment(address _to, uint256 _amount) external onlyOwner {
ITellor(tellorAddress).transfer(_to, _amount);
}
function getSlotProgress() external view returns (uint256) {
bytes32 slotProgress =
0x6c505cb2db6644f57b42d87bd9407b0f66788b07d0617a2bc1356a0e69e66f9a;
return ITellor(tellorAddress).getUintVar(slotProgress);
}
function withdrawStake() external onlyOwner {
ITellor(tellorAddress).withdrawStake();
}
function vote(uint256 _disputeId, bool _supportsDispute)
external
onlyOwner
{
ITellor(tellorAddress).vote(_disputeId, _supportsDispute);
}
}
{
"compilationTarget": {
"browser/trb-proxy.sol": "TellorProxy"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_tellorAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_tip","type":"uint256"}],"name":"addTip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getSlotProgress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"payment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestStakingWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_nonce","type":"string"},{"internalType":"uint256[5]","name":"_requestId","type":"uint256[5]"},{"internalType":"uint256[5]","name":"_value","type":"uint256[5]"},{"internalType":"uint256","name":"_pass","type":"uint256"}],"name":"submitMiningSolution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"},{"internalType":"bool","name":"_supportsDispute","type":"bool"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawStake","outputs":[],"stateMutability":"nonpayable","type":"function"}]