Contract 0xf859bf77cbe8699013d6dbc7c2b926aaf307f830

 
Txn Hash
Block
From
To
Value [Txn Fee]
0x4baaad59c5ddcf5b8483f858df17fcc602b9282e1460fc54c7995882afd1b7ed84363082021-06-19 15:49:302 hrs 11 mins ago0x0dadd2a74fef57bde3aa16063a7ab9bfd0eea69e IN  Berry Data: BRY Token0 BNB0.000248965
0xdcd4d59850ab5c56ea0392d6e9abe414643ca2cdb8f3083d3c02dc1541eb252384362272021-06-19 15:45:272 hrs 15 mins ago0x41d1c93f26bf09261c350095306d532d50e22c77 IN  Berry Data: BRY Token0 BNB0.000248965
0x8490974504fb3cf855200a967a9904b308aef80e5f9e13f5685e744d88a2769284358802021-06-19 15:28:062 hrs 32 mins ago0xbe2d86e3394a043ff62f6e0085fea2b7ee0ad9f1 IN  Berry Data: BRY Token0 BNB0.00061612
0x5165342531a0ac6f8dfed8832267770b20102e0a14af54ce0d21175cb1cfaf6884347952021-06-19 14:30:523 hrs 30 mins ago0xceaa47fe733ed16f725d295459f55726c0e81271 IN  Berry Data: BRY Token0 BNB0.000248965
0xffaf3cf1dc2db2117bd8f2daf27f83f5966743393916244575114b01daa8c44284346792021-06-19 14:25:043 hrs 35 mins ago0xe43a281ed2dc8f0fc805c2a1d4108cc075ff598c IN  Berry Data: BRY Token0 BNB0.000248965
0xdb0d02fbea3580e05f13489c66ba64ebbca7962d79cd5b99c1329edc03f083e984345552021-06-19 14:18:523 hrs 42 mins ago0x0595690675910ba5a0a9c9224d65316f5921cdc5 IN  Berry Data: BRY Token0 BNB0.000248965
0xbec9ed5054293a878fb20ab9cf8d7622151991b8aaa39e98c5bd09ed5fad222c84343422021-06-19 14:08:133 hrs 52 mins ago0x6c17c4ad4380e3804a7369ea2319e7c1ee6e0f75 IN  Berry Data: BRY Token0 BNB0.000588315
0xfb6ba30afd367482da523f5bccc022d9f301bc8f600f3efec095660d32e2451484341952021-06-19 14:00:204 hrs ago0x6e5ac1dd0e768de9e1c7244599a01a13470a62d1 IN  Berry Data: BRY Token0 BNB0.000739272
0xeaae9a4bf6c13dd6d2a873c661dcecfe4d0a9aa03e8ade7ae2242c462a29e97484336472021-06-19 13:32:034 hrs 28 mins ago0xb2000349628aa68540868596f5976d09bab19e92 IN  Berry Data: BRY Token0 BNB0.000298758
0xf174cfab6f31b7f0d9c5f7ab24bd466df367df478604292ca535f5c9925e865484320592021-06-19 12:11:055 hrs 49 mins ago0x8263ab5ec3f2c73b7ff87665a6edeaeda7dc8ab0 IN  Berry Data: BRY Token0 BNB0.000248905
0x1eabbe9b183006e7cb026f72158dcf6c69faeef2a32cc6e91acaf54b9594a61884314232021-06-19 11:39:166 hrs 21 mins ago0xd7cbcfe85e9f51fcddd15f4e7709e2806cda6ff9 IN  Berry Data: BRY Token0 BNB0.0000971
0x84ee500b955a32990074272e710dfa4ec835cba4d37701d3a6af739fc100d8b884307562021-06-19 11:04:466 hrs 56 mins ago0xf6ac6899baf35a3382d2ac2adb1b5e09014ff8f2 IN  Berry Data: BRY Token0 BNB0.000298758
0x209f88c53a4a219e8ed5f6d90901165bd38dbd3fc4245701517f1db418da175b84307232021-06-19 11:03:076 hrs 57 mins ago0xb1c22eb6681cfe469470e6e0881c9512d3822fd2 IN  Berry Data: BRY Token0 BNB0.000248965
0x82665a33631410aa353915cbb53d463bdf789f2659bd95edaa71a35db57d130084304402021-06-19 10:48:167 hrs 12 mins ago0x6ecbd28afe3608fe493344bcbba324bd82adf265 IN  Berry Data: BRY Token0 BNB0.00061612
0xbd9a14208d6a3d35936f98aef0d3887a79f71684fe778ebee39c35b34ca8849784303232021-06-19 10:42:257 hrs 18 mins ago0xb371a55945b33f9c9079eedbaa5330b267c0aa18 IN  Berry Data: BRY Token0 BNB0.00061606
0x8ed4a11fad11f1cfbaf3c0437a887b3e50002268bbd4979a8239ca56716445ef84298862021-06-19 10:19:537 hrs 41 mins ago0x6a1951df5866d4b20a09cbe945ed572ea87d680c IN  Berry Data: BRY Token0 BNB0.000616
0xd50348435267279f8cc12614d76220be254f72a8bb9fa7457bde5759f87d6aa384280392021-06-19 8:47:319 hrs 13 mins ago0xc722b5ccc9b9e8ec9da0e56aa358146a36a46c5a IN  Berry Data: BRY Token0 BNB0.000248965
0xc4f1da929a5665c38827587f58cf2f987094c5963935a8d58bc3835fea90c8e584278592021-06-19 8:38:319 hrs 22 mins ago0x73e67da76985f4242a65c758ce3c7aebe8a38c98 IN  Berry Data: BRY Token0 BNB0.000248965
0x5ebeada6a2cdebaeb5fbaf409f22314f6d676a64ef026a82fad1f5c4a813a15d84269072021-06-19 7:50:5210 hrs 10 mins ago0xe8faac2960eb081b8336f9e34152c5ecf3977547 IN  Berry Data: BRY Token0 BNB0.000248965
0x459f4b6c2a863706fde44d84e6cc8b41d26d041de953e87493cc3289e53e847d84264472021-06-19 7:27:5210 hrs 33 mins ago0xf7d5b38f22459219ca4fe12e49a15ff3c072cf93 IN  Berry Data: BRY Token0 BNB0.000248965
0x548d352d61d93982aac359b3cd37e49d0bf1cec62b5ff24d063b1fd90b8962f984264352021-06-19 7:27:1610 hrs 33 mins ago0xfa31b8e9f47695a38e78c1e03f5d37121479cd16 IN  Berry Data: BRY Token0 BNB0.000248965
0x7c9d9245bead3f821e794fe4d0b3fa378a9c223278487591110eb7622120065284252762021-06-19 6:29:1511 hrs 31 mins ago0x518e0dbafb15180636d7f2b7da4a435dc68b6ecf IN  Berry Data: BRY Token0 BNB0.0000971
0x5de25bd80e46a7b19a559b361cedf4fd4bdc54d9b7729e64bff3ade3627ae03284250312021-06-19 6:17:0011 hrs 43 mins ago0x518e0dbafb15180636d7f2b7da4a435dc68b6ecf IN  Berry Data: BRY Token0 BNB0.000248965
0x2806b6f0610862a62a9a9973a648954e22ca70bde3017e65a3a42ce3aa64a8a784224022021-06-19 4:04:5213 hrs 56 mins ago0xe3a0e45bbcfb6569cfd4ba1c8d695c9836a5e820 IN  Berry Data: BRY Token0 BNB0.000248965
0x3bf4ff96378bb47f8908218194b5f97c83c506611ecf4e9d7589c47c54ca6a0984210222021-06-19 2:55:0715 hrs 5 mins ago0x40f4da7cfffaa08e870edd515e7b810fd0f9d68a IN  Berry Data: BRY Token0 BNB0.000248965
[ Download CSV Export 

OVERVIEW

Berry Data is a transparent community-verified price oracles on BSC. It provides a trustless and decentralized alternative for off-chain data and the infrastructure for DAPPs(decentralized applications) to query off-chain data by properly incentivizing miners to provide data.

Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x7eaa4f6fce7d59f96a96372873aafddba6815b5a8ed9fa058e5d50749c69f4cf54713352021-03-07 11:59:42104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0x7eaa4f6fce7d59f96a96372873aafddba6815b5a8ed9fa058e5d50749c69f4cf54713352021-03-07 11:59:42104 days 6 hrs ago Berry Data: BRY Token 0x89c0be3d87e0f28073390e997527d765f9384ed40 BNB
0xa80c3f31bdc4a85f2fb591438642b2edc84eb249933b0cff1a574768fef6eb1a54713352021-03-07 11:59:42104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xa80c3f31bdc4a85f2fb591438642b2edc84eb249933b0cff1a574768fef6eb1a54713352021-03-07 11:59:42104 days 6 hrs ago Berry Data: BRY Token 0x89c0be3d87e0f28073390e997527d765f9384ed40 BNB
0xa80c3f31bdc4a85f2fb591438642b2edc84eb249933b0cff1a574768fef6eb1a54713352021-03-07 11:59:42104 days 6 hrs ago 0x1c736f4fb20c7742ee83a4099fe92aba61dfca41 Berry Data: BRY Token0 BNB
0xd79589996391f42e27f4a324692c4c429bde62b6be354b8c79f5b8ed98e8790954713332021-03-07 11:59:36104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xd79589996391f42e27f4a324692c4c429bde62b6be354b8c79f5b8ed98e8790954713332021-03-07 11:59:36104 days 6 hrs ago 0x0000000000b80b2b49630047c38f2810ab8fb946 Berry Data: BRY Token0 BNB
0xd79589996391f42e27f4a324692c4c429bde62b6be354b8c79f5b8ed98e8790954713332021-03-07 11:59:36104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xd79589996391f42e27f4a324692c4c429bde62b6be354b8c79f5b8ed98e8790954713332021-03-07 11:59:36104 days 6 hrs ago 0x0000000000b80b2b49630047c38f2810ab8fb946 Berry Data: BRY Token0 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago PancakeSwap: BRY 4 Berry Data: BRY Token0 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago 0x79249e6b65030902671c5fa85d79e3ec28e4b1b9 Berry Data: BRY Token0 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x89c0be3d87e0f28073390e997527d765f9384ed40 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago 0xcde540d7eafe93ac5fe6233bee57e1270d3e330f Berry Data: BRY Token0 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago 0x0000000000b80b2b49630047c38f2810ab8fb946 Berry Data: BRY Token0 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x89c0be3d87e0f28073390e997527d765f9384ed40 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago PancakeSwap: BRY 4 Berry Data: BRY Token0 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago 0x0000000000b80b2b49630047c38f2810ab8fb946 Berry Data: BRY Token0 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago Berry Data: BRY Token 0x93dbc20622631e3f819a7ab996ccf68326cc21e90 BNB
0xf961dee161efd8386400519fabd6b6314fc815da2f15a912a245d2e24b5e8fec54713322021-03-07 11:59:33104 days 6 hrs ago 0x0000000000b80b2b49630047c38f2810ab8fb946 Berry Data: BRY Token0 BNB
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BerryMaster

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 9 : BerryGetters.sol
pragma solidity ^0.5.0;

import "./libraries/SafeMath.sol";
import "./libraries/BerryStorage.sol";
import "./libraries/BerryTransfer.sol";
import "./libraries/BerryGettersLibrary.sol";
import "./libraries/BerryStake.sol";

/**
* @title Berry Getters
* @dev Oracle contract with all berry getter functions. The logic for the functions on this contract
* is saved on the BerryGettersLibrary, BerryTransfer, BerryGettersLibrary, and BerryStake
*/
contract BerryGetters {
    using SafeMath for uint256;

    using BerryTransfer for BerryStorage.BerryStorageStruct;
    using BerryGettersLibrary for BerryStorage.BerryStorageStruct;
    using BerryStake for BerryStorage.BerryStorageStruct;

    BerryStorage.BerryStorageStruct berry;

    /**
    * @param _user address
    * @param _spender address
    * @return Returns the remaining allowance of tokens granted to the _spender from the _user
    */
    function allowance(address _user, address _spender) external view returns (uint256) {
        return berry.allowance(_user, _spender);
    }

    /**
    * @dev This function returns whether or not a given user is allowed to trade a given amount
    * @param _user address
    * @param _amount uint of amount
    * @return true if the user is alloed to trade the amount specified
    */
    function allowedToTrade(address _user, uint256 _amount) external view returns (bool) {
        return berry.allowedToTrade(_user, _amount);
    }

    /**
    * @dev Gets balance of owner specified
    * @param _user is the owner address used to look up the balance
    * @return Returns the balance associated with the passed in _user
    */
    function balanceOf(address _user) external view returns (uint256) {
        return berry.balanceOf(_user);
    }

    /**
    * @dev Queries the balance of _user at a specific _blockNumber
    * @param _user The address from which the balance will be retrieved
    * @param _blockNumber The block number when the balance is queried
    * @return The balance at _blockNumber
    */
    function balanceOfAt(address _user, uint256 _blockNumber) external view returns (uint256) {
        return berry.balanceOfAt(_user, _blockNumber);
    }

    /**
    * @dev This function tells you if a given challenge has been completed by a given miner
    * @param _challenge the challenge to search for
    * @param _miner address that you want to know if they solved the challenge
    * @return true if the _miner address provided solved the
    */
    function didMine(bytes32 _challenge, address _miner) external view returns (bool) {
        return berry.didMine(_challenge, _miner);
    }

    /**
    * @dev Checks if an address voted in a given dispute
    * @param _disputeId to look up
    * @param _address to look up
    * @return bool of whether or not party voted
    */
    function didVote(uint256 _disputeId, address _address) external view returns (bool) {
        return berry.didVote(_disputeId, _address);
    }

    /**
    * @dev allows Berry to read data from the addressVars mapping
    * @param _data is the keccak256("variable_name") of the variable that is being accessed.
    * These are examples of how the variables are saved within other functions:
    * addressVars[keccak256("_owner")]
    * addressVars[keccak256("berryContract")]
    * @return address of the requested variable 
    */
    function getAddressVars(bytes32 _data) external view returns (address) {
        return berry.getAddressVars(_data);
    }

    /**
    * @dev Gets all dispute variables
    * @param _disputeId to look up
    * @return bytes32 hash of dispute
    * @return bool executed where true if it has been voted on
    * @return bool disputeVotePassed
    * @return bool isPropFork true if the dispute is a proposed fork
    * @return address of reportedMiner
    * @return address of reportingParty
    * @return address of proposedForkAddress
    * @return uint of requestId
    * @return uint of timestamp
    * @return uint of value
    * @return uint of minExecutionDate
    * @return uint of numberOfVotes
    * @return uint of blocknumber
    * @return uint of minerSlot
    * @return uint of quorum
    * @return uint of fee
    * @return int count of the current tally
    */
    function getAllDisputeVars(uint256 _disputeId)
        public
        view
        returns (bytes32, bool, bool, bool, address, address, address, uint256[9] memory, int256)
    {
        return berry.getAllDisputeVars(_disputeId);
    }

    /**
    * @dev Getter function for variables for the requestId being currently mined(currentRequestId)
    * @return current challenge, curretnRequestId, level of difficulty, api/query string, and granularity(number of decimals requested), total tip for the request
    */
    function getCurrentVariables() external view returns (bytes32, uint256, uint256, string memory, uint256, uint256) {
        return berry.getCurrentVariables();
    }

    /**
    * @dev Checks if a given hash of miner,requestId has been disputed
    * @param _hash is the sha256(abi.encodePacked(_miners[2],_requestId));
    * @return uint disputeId
    */
    function getDisputeIdByDisputeHash(bytes32 _hash) external view returns (uint256) {
        return berry.getDisputeIdByDisputeHash(_hash);
    }

    /**
    * @dev Checks for uint variables in the disputeUintVars mapping based on the disuputeId
    * @param _disputeId is the dispute id;
    * @param _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name is
    * the variables/strings used to save the data in the mapping. The variables names are
    * commented out under the disputeUintVars under the Dispute struct
    * @return uint value for the bytes32 data submitted
    */
    function getDisputeUintVars(uint256 _disputeId, bytes32 _data) external view returns (uint256) {
        return berry.getDisputeUintVars(_disputeId, _data);
    }

    /**
    * @dev Gets the a value for the latest timestamp available
    * @return value for timestamp of last proof of work submited
    * @return true if the is a timestamp for the lastNewValue
    */
    function getLastNewValue() external view returns (uint256, bool) {
        return berry.getLastNewValue();
    }

    /**
    * @dev Gets the a value for the latest timestamp available
    * @param _requestId being requested
    * @return value for timestamp of last proof of work submited and if true if it exist or 0 and false if it doesn't
    */
    function getLastNewValueById(uint256 _requestId) external view returns (uint256, bool) {
        return berry.getLastNewValueById(_requestId);
    }

    /**
    * @dev Gets blocknumber for mined timestamp
    * @param _requestId to look up
    * @param _timestamp is the timestamp to look up blocknumber
    * @return uint of the blocknumber which the dispute was mined
    */
    function getMinedBlockNum(uint256 _requestId, uint256 _timestamp) external view returns (uint256) {
        return berry.getMinedBlockNum(_requestId, _timestamp);
    }

    /**
    * @dev Gets the 5 miners who mined the value for the specified requestId/_timestamp
    * @param _requestId to look up
    * @param _timestamp is the timestamp to look up miners for
    * @return the 5 miners' addresses
    */
    function getMinersByRequestIdAndTimestamp(uint256 _requestId, uint256 _timestamp) external view returns (address[5] memory) {
        return berry.getMinersByRequestIdAndTimestamp(_requestId, _timestamp);
    }

    /**
    * @dev Counts the number of values that have been submited for the request
    * if called for the currentRequest being mined it can tell you how many miners have submitted a value for that
    * request so far
    * @param _requestId the requestId to look up
    * @return uint count of the number of values received for the requestId
    */
    function getNewValueCountbyRequestId(uint256 _requestId) external view returns (uint256) {
        return berry.getNewValueCountbyRequestId(_requestId);
    }

    /**
    * @dev Getter function for the specified requestQ index
    * @param _index to look up in the requestQ array
    * @return uint of reqeuestId
    */
    function getRequestIdByRequestQIndex(uint256 _index) external view returns (uint256) {
        return berry.getRequestIdByRequestQIndex(_index);
    }

    /**
    * @dev Getter function for requestId based on timestamp
    * @param _timestamp to check requestId
    * @return uint of reqeuestId
    */
    function getRequestIdByTimestamp(uint256 _timestamp) external view returns (uint256) {
        return berry.getRequestIdByTimestamp(_timestamp);
    }

    /**
    * @dev Getter function for requestId based on the queryHash
    * @param _request is the hash(of string api and granularity) to check if a request already exists
    * @return uint requestId
    */
    function getRequestIdByQueryHash(bytes32 _request) external view returns (uint256) {
        return berry.getRequestIdByQueryHash(_request);
    }

    /**
    * @dev Getter function for the requestQ array
    * @return the requestQ arrray
    */
    function getRequestQ() public view returns (uint256[51] memory) {
        return berry.getRequestQ();
    }

    /**
    * @dev Allowes access to the uint variables saved in the apiUintVars under the requestDetails struct
    * for the requestId specified
    * @param _requestId to look up
    * @param _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name is
    * the variables/strings used to save the data in the mapping. The variables names are
    * commented out under the apiUintVars under the requestDetails struct
    * @return uint value of the apiUintVars specified in _data for the requestId specified
    */
    function getRequestUintVars(uint256 _requestId, bytes32 _data) external view returns (uint256) {
        return berry.getRequestUintVars(_requestId, _data);
    }

    /**
    * @dev Gets the API struct variables that are not mappings
    * @param _requestId to look up
    * @return string of api to query
    * @return string of symbol of api to query
    * @return bytes32 hash of string
    * @return bytes32 of the granularity(decimal places) requested
    * @return uint of index in requestQ array
    * @return uint of current payout/tip for this requestId
    */
    function getRequestVars(uint256 _requestId) external view returns (string memory, string memory, bytes32, uint256, uint256, uint256) {
        return berry.getRequestVars(_requestId);
    }

    /**
    * @dev This function allows users to retireve all information about a staker
    * @param _staker address of staker inquiring about
    * @return uint current state of staker
    * @return uint startDate of staking
    */
    function getStakerInfo(address _staker) external view returns (uint256, uint256) {
        return berry.getStakerInfo(_staker);
    }

    /**
    * @dev Gets the 5 miners who mined the value for the specified requestId/_timestamp
    * @param _requestId to look up
    * @param _timestamp is the timestampt to look up miners for
    * @return address[5] array of 5 addresses ofminers that mined the requestId
    */
    function getSubmissionsByTimestamp(uint256 _requestId, uint256 _timestamp) external view returns (uint256[5] memory) {
        return berry.getSubmissionsByTimestamp(_requestId, _timestamp);
    }


    /**
    * @dev Gets the timestamp for the value based on their index
    * @param _requestID is the requestId to look up
    * @param _index is the value index to look up
    * @return uint timestamp
    */
    function getTimestampbyRequestIDandIndex(uint256 _requestID, uint256 _index) external view returns (uint256) {
        return berry.getTimestampbyRequestIDandIndex(_requestID, _index);
    }

    /**
    * @dev Getter for the variables saved under the BerryStorageStruct uintVars variable
    * @param _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name is
    * the variables/strings used to save the data in the mapping. The variables names are
    * commented out under the uintVars under the BerryStorageStruct struct
    * This is an example of how data is saved into the mapping within other functions:
    * self.uintVars[keccak256("stakerCount")]
    * @return uint of specified variable
    */
    function getUintVar(bytes32 _data) public view returns (uint256) {
        return berry.getUintVar(_data);
    }

    /**
    * @dev Getter function for next requestId on queue/request with highest payout at time the function is called
    * @return onDeck/info on request with highest payout-- RequestId, Totaltips, and API query string
    */
    function getVariablesOnDeck() external view returns (uint256, uint256, string memory) {
        return berry.getVariablesOnDeck();
    }

    /**
    * @dev Gets the 5 miners who mined the value for the specified requestId/_timestamp
    * @param _requestId to look up
    * @param _timestamp is the timestamp to look up miners for
    * @return bool true if requestId/timestamp is under dispute
    */
    function isInDispute(uint256 _requestId, uint256 _timestamp) external view returns (bool) {
        return berry.isInDispute(_requestId, _timestamp);
    }

    /**
    * @dev Retreive value from oracle based on timestamp
    * @param _requestId being requested
    * @param _timestamp to retreive data/value from
    * @return value for timestamp submitted
    */
    function retrieveData(uint256 _requestId, uint256 _timestamp) external view returns (uint256) {
        return berry.retrieveData(_requestId, _timestamp);
    }

    /**
    * @dev Getter for the total_supply of oracle tokens
    * @return uint total supply
    */
    function totalSupply() external view returns (uint256) {
        return berry.totalSupply();
    }

}

File 2 of 9 : BerryMaster.sol
pragma solidity ^0.5.0;

import "./BerryGetters.sol";

/**
* @title Berry Master
* @dev This is the Master contract with all berry getter functions and delegate call to Berry.
* The logic for the functions on this contract is saved on the BerryGettersLibrary, BerryTransfer,
* BerryGettersLibrary, and BerryStake
*/
contract BerryMaster is BerryGetters {
    event NewBerryAddress(address _newBerry);

    /**
    * @dev The constructor sets the original `berryStorageOwner` of the contract to the sender
    * account, the berry contract to the Berry master address and owner to the Berry master owner address
    * @param _berryContract is the address for the berry contract
    */
    constructor(address _berryContract) public {
        berry.init();
        berry.addressVars[keccak256("_owner")] = msg.sender;
        berry.addressVars[keccak256("_deity")] = msg.sender;
        berry.addressVars[keccak256("berryContract")] = _berryContract;
        emit NewBerryAddress(_berryContract);
    }

    /**
    * @dev Gets the 5 miners who mined the value for the specified requestId/_timestamp
    * @dev Only needs to be in library
    * @param _newDeity the new Deity in the contract
    */

    function changeDeity(address _newDeity) external {
        berry.changeDeity(_newDeity);
    }

    /**
    * @dev  allows for the deity to make fast upgrades.  Deity should be 0 address if decentralized
    * @param _berryContract the address of the new Berry Contract
    */
    function changeBerryContract(address _berryContract) external {
        berry.changeBerryContract(_berryContract);
    }

    /**
    * @dev This is the fallback function that allows contracts to call the berry contract at the address stored
    */
    function() external payable {
        address addr = berry.addressVars[keccak256("berryContract")];
        bytes memory _calldata = msg.data;
        assembly {
            let result := delegatecall(not(0), addr, add(_calldata, 0x20), mload(_calldata), 0, 0)
            let size := returndatasize
            let ptr := mload(0x40)
            returndatacopy(ptr, 0, size)
            // revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.
            // if the call returned error data, forward it
            switch result
                case 0 {
                    revert(ptr, size)
                }
                default {
                    return(ptr, size)
                }
        }
    }
}

File 3 of 9 : BerryDispute.sol
pragma solidity ^0.5.16;
import "./BerryStorage.sol";
import "./BerryTransfer.sol";


/**
* @title Berry Dispute
* @dev Contains the methods related to disputes. Berry.sol references this library for function's logic.
*/

library BerryDispute {
    using SafeMath for uint256;
    using SafeMath for int256;

    //emitted when a new dispute is initialized
    event NewDispute(uint256 indexed _disputeId, uint256 indexed _requestId, uint256 _timestamp, address _miner);
    //emitted when a new vote happens
    event Voted(uint256 indexed _disputeID, bool _position, address indexed _voter, uint256 indexed _voteWeight);
    //emitted upon dispute tally
    event DisputeVoteTallied(uint256 indexed _disputeID, int256 _result, address indexed _reportedMiner, address _reportingParty, bool _active);
    event NewBerryAddress(address _newBerry); //emmited when a proposed fork is voted true

    /*Functions*/

    /**
    * @dev Helps initialize a dispute by assigning it a disputeId
    * when a miner returns a false on the validate array(in Berry.ProofOfWork) it sends the
    * invalidated value information to POS voting
    * @param _requestId being disputed
    * @param _timestamp being disputed
    * @param _minerIndex the index of the miner that submitted the value being disputed. Since each official value
    * requires 5 miners to submit a value.
    */
    function beginDispute(BerryStorage.BerryStorageStruct storage self, uint256 _requestId, uint256 _timestamp, uint256 _minerIndex) public {
        BerryStorage.Request storage _request = self.requestDetails[_requestId];
        require(_request.minedBlockNum[_timestamp] != 0, "Mined block is 0");
        require(_minerIndex < 5, "Miner index is wrong");

        //_miner is the miner being disputed. For every mined value 5 miners are saved in an array and the _minerIndex
        //provided by the party initiating the dispute
        address _miner = _request.minersByValue[_timestamp][_minerIndex];
        bytes32 _hash = keccak256(abi.encodePacked(_miner, _requestId, _timestamp));



        //Increase the dispute count by 1
        uint256 disputeId = self.uintVars[keccak256("disputeCount")] + 1;
        self.uintVars[keccak256("disputeCount")] = disputeId;

        //Sets the new disputeCount as the disputeId

                //Ensures that a dispute is not already open for the that miner, requestId and timestamp
        uint256 hashId = self.disputeIdByDisputeHash[_hash];
        if(hashId != 0){
            self.disputesById[disputeId].disputeUintVars[keccak256("origID")] = hashId;

        }
        else{
            self.disputeIdByDisputeHash[_hash] = disputeId;
            hashId = disputeId;
        }
        uint256 origID = hashId;
        uint256 dispRounds = self.disputesById[origID].disputeUintVars[keccak256("disputeRounds")] + 1;
        self.disputesById[origID].disputeUintVars[keccak256("disputeRounds")] = dispRounds;
        self.disputesById[origID].disputeUintVars[keccak256(abi.encode(dispRounds))] = disputeId;
        if(disputeId != origID){
            uint256 lastID =  self.disputesById[origID].disputeUintVars[keccak256(abi.encode(dispRounds-1))];
            require(self.disputesById[lastID].disputeUintVars[keccak256("minExecutionDate")] <= now, "Dispute is already open");
            if(self.disputesById[lastID].executed){
                require(now - self.disputesById[lastID].disputeUintVars[keccak256("tallyDate")] <= 1 days, "Time for voting haven't elapsed");
            }
        }
        uint256 _fee;
        if (_minerIndex == 2) {
            self.requestDetails[_requestId].apiUintVars[keccak256("disputeCount")] = self.requestDetails[_requestId].apiUintVars[keccak256("disputeCount")] +1;
            //update dispute fee for this case
            _fee = self.uintVars[keccak256("stakeAmount")]*self.requestDetails[_requestId].apiUintVars[keccak256("disputeCount")];
        } else {

            _fee = self.uintVars[keccak256("disputeFee")] * dispRounds;
        }

        //maps the dispute to the Dispute struct
        self.disputesById[disputeId] = BerryStorage.Dispute({
            hash: _hash,
            isPropFork: false,
            reportedMiner: _miner,
            reportingParty: msg.sender,
            proposedForkAddress: address(0),
            executed: false,
            disputeVotePassed: false,
            tally: 0
        });

        //Saves all the dispute variables for the disputeId
        self.disputesById[disputeId].disputeUintVars[keccak256("requestId")] = _requestId;
        self.disputesById[disputeId].disputeUintVars[keccak256("timestamp")] = _timestamp;
        self.disputesById[disputeId].disputeUintVars[keccak256("value")] = _request.valuesByTimestamp[_timestamp][_minerIndex];
        self.disputesById[disputeId].disputeUintVars[keccak256("minExecutionDate")] = now + 2 days * dispRounds;
        self.disputesById[disputeId].disputeUintVars[keccak256("blockNumber")] = block.number;
        self.disputesById[disputeId].disputeUintVars[keccak256("minerSlot")] = _minerIndex;
        self.disputesById[disputeId].disputeUintVars[keccak256("fee")] = _fee;
        BerryTransfer.doTransfer(self, msg.sender, address(this),_fee);

   

        //Values are sorted as they come in and the official value is the median of the first five
        //So the "official value" miner is always minerIndex==2. If the official value is being
        //disputed, it sets its status to inDispute(currentStatus = 3) so that users are made aware it is under dispute
        if (_minerIndex == 2) {
            _request.inDispute[_timestamp] = true;
            _request.finalValues[_timestamp] = 0;
        }
        if (self.stakerDetails[_miner].currentStatus != 4){
            self.stakerDetails[_miner].currentStatus = 3;
        }
        emit NewDispute(disputeId, _requestId, _timestamp, _miner);
    }

    /**
    * @dev Allows token holders to vote
    * @param _disputeId is the dispute id
    * @param _supportsDispute is the vote (true=the dispute has basis false = vote against dispute)
    */
    function vote(BerryStorage.BerryStorageStruct storage self, uint256 _disputeId, bool _supportsDispute) public {
        BerryStorage.Dispute storage disp = self.disputesById[_disputeId];

        //Get the voteWeight or the balance of the user at the time/blockNumber the disupte began
        uint256 voteWeight = BerryTransfer.balanceOfAt(self, msg.sender, disp.disputeUintVars[keccak256("blockNumber")]);

        //Require that the msg.sender has not voted
        require(disp.voted[msg.sender] != true, "Sender has already voted");

        //Requre that the user had a balance >0 at time/blockNumber the disupte began
        require(voteWeight != 0, "User balance is 0");

        //ensures miners that are under dispute cannot vote
        require(self.stakerDetails[msg.sender].currentStatus != 3, "Miner is under dispute");

        //Update user voting status to true
        disp.voted[msg.sender] = true;

        //Update the number of votes for the dispute
        disp.disputeUintVars[keccak256("numberOfVotes")] += 1;

        //If the user supports the dispute increase the tally for the dispute by the voteWeight
        //otherwise decrease it
        if (_supportsDispute) {
            disp.tally = disp.tally.add(int256(voteWeight));
        } else {
            disp.tally = disp.tally.sub(int256(voteWeight));
        }

        //Let the network know the user has voted on the dispute and their casted vote
        emit Voted(_disputeId, _supportsDispute, msg.sender, voteWeight);
    }

    /**
    * @dev tallies the votes and locks the stake disbursement(currentStatus = 4) if the vote passes
    * @param _disputeId is the dispute id
    */
    function tallyVotes(BerryStorage.BerryStorageStruct storage self, uint256 _disputeId) public {
        BerryStorage.Dispute storage disp = self.disputesById[_disputeId];

        //Ensure this has not already been executed/tallied
        require(disp.executed == false, "Dispute has been already executed");
        require(now >= disp.disputeUintVars[keccak256("minExecutionDate")], "Time for voting haven't elapsed");
        require(disp.reportingParty != address(0), "reporting Party is address 0");
        int256  _tally = disp.tally;
        if (_tally > 0) {
            //Set the dispute state to passed/true
            disp.disputeVotePassed = true;
        }
        //If the vote is not a proposed fork
        if (disp.isPropFork == false) {
                //Ensure the time for voting has elapsed
                    BerryStorage.StakeInfo storage stakes = self.stakerDetails[disp.reportedMiner];
                    //If the vote for disputing a value is succesful(disp.tally >0) then unstake the reported
                    // miner and transfer the stakeAmount and dispute fee to the reporting party
                    if(stakes.currentStatus == 3){
                        stakes.currentStatus = 4;
                    }
        } else if (uint(_tally) >= ((self.uintVars[keccak256("total_supply")] * 10) / 100)) {
            emit NewBerryAddress(disp.proposedForkAddress);
        }
        disp.disputeUintVars[keccak256("tallyDate")] = now;
        disp.executed = true;
        emit DisputeVoteTallied(_disputeId, _tally, disp.reportedMiner, disp.reportingParty, disp.disputeVotePassed);
    }

    /**
    * @dev Allows for a fork to be proposed
    * @param _propNewBerryAddress address for new proposed Berry
    */
    function proposeFork(BerryStorage.BerryStorageStruct storage self, address _propNewBerryAddress) public {
        bytes32 _hash = keccak256(abi.encode(_propNewBerryAddress));
        BerryTransfer.doTransfer(self, msg.sender, address(this), 100e18); //This is the fork fee (just 100 tokens flat, no refunds)
        self.uintVars[keccak256("disputeCount")]++;
        uint256 disputeId = self.uintVars[keccak256("disputeCount")];
        if(self.disputeIdByDisputeHash[_hash] != 0){
            self.disputesById[disputeId].disputeUintVars[keccak256("origID")] = self.disputeIdByDisputeHash[_hash];
        }
        else{
            self.disputeIdByDisputeHash[_hash] = disputeId;
        }
        uint256 origID = self.disputeIdByDisputeHash[_hash];

        self.disputesById[origID].disputeUintVars[keccak256("disputeRounds")]++;
        uint256 dispRounds = self.disputesById[origID].disputeUintVars[keccak256("disputeRounds")];
        self.disputesById[origID].disputeUintVars[keccak256(abi.encode(dispRounds))] = disputeId;
        if(disputeId != origID){
            uint256 lastID =  self.disputesById[origID].disputeUintVars[keccak256(abi.encode(dispRounds-1))];
            require(self.disputesById[lastID].disputeUintVars[keccak256("minExecutionDate")] <= now, "Dispute is already open");
            if(self.disputesById[lastID].executed){
                require(now - self.disputesById[lastID].disputeUintVars[keccak256("tallyDate")] <= 1 days, "Time for voting haven't elapsed");
            }
        }
        self.disputesById[disputeId] = BerryStorage.Dispute({
            hash: _hash,
            isPropFork: true,
            reportedMiner: msg.sender,
            reportingParty: msg.sender,
            proposedForkAddress: _propNewBerryAddress,
            executed: false,
            disputeVotePassed: false,
            tally: 0
        });
        self.disputesById[disputeId].disputeUintVars[keccak256("blockNumber")] = block.number;
        self.disputesById[disputeId].disputeUintVars[keccak256("minExecutionDate")] = now + 7 days;
    }

    /**
    * @dev Updates the Berry address after a proposed fork has 
    * passed the vote and day has gone by without a dispute
    * @param _disputeId the disputeId for the proposed fork
    */
    function updateBerry(BerryStorage.BerryStorageStruct storage self, uint _disputeId) public {
        bytes32 _hash = self.disputesById[_disputeId].hash;
        uint256 origID = self.disputeIdByDisputeHash[_hash];
        uint256 lastID =  self.disputesById[origID].disputeUintVars[keccak256(abi.encode(self.disputesById[origID].disputeUintVars[keccak256("disputeRounds")]))];
        BerryStorage.Dispute storage disp = self.disputesById[lastID];
        require(disp.disputeVotePassed == true, "vote needs to pass");
        require(now - disp.disputeUintVars[keccak256("tallyDate")] > 1 days, "Time for voting for further disputes has not passed");
        self.addressVars[keccak256("berryContract")] = disp.proposedForkAddress;
    }

    /**
    * @dev Allows disputer to unlock the dispute fee
    * @param _disputeId to unlock fee from
    */
    function unlockDisputeFee (BerryStorage.BerryStorageStruct storage self, uint _disputeId) public {
        uint256 origID = self.disputeIdByDisputeHash[self.disputesById[_disputeId].hash];
        uint256 lastID =  self.disputesById[origID].disputeUintVars[keccak256(abi.encode(self.disputesById[origID].disputeUintVars[keccak256("disputeRounds")]))];
        if(lastID == 0){
            lastID = origID;
        }
        BerryStorage.Dispute storage disp = self.disputesById[origID];
        BerryStorage.Dispute storage last = self.disputesById[lastID];
                //disputeRounds is increased by 1 so that the _id is not a negative number when it is the first time a dispute is initiated
        uint256 dispRounds = disp.disputeUintVars[keccak256("disputeRounds")];
        if(dispRounds == 0){
          dispRounds = 1;  
        }
        uint256 _id;
        require(disp.disputeUintVars[keccak256("paid")] == 0,"already paid out");
        require(now - last.disputeUintVars[keccak256("tallyDate")] > 1 days, "Time for voting haven't elapsed");
        BerryStorage.StakeInfo storage stakes = self.stakerDetails[disp.reportedMiner];
        disp.disputeUintVars[keccak256("paid")] = 1;
        if (last.disputeVotePassed == true){
                //Changing the currentStatus and startDate unstakes the reported miner and transfers the stakeAmount
                stakes.startDate = now - (now % 86400);

                //Reduce the staker count
                self.uintVars[keccak256("stakerCount")] -= 1;

                //Update the minimum dispute fee that is based on the number of stakers 
                updateMinDisputeFee(self);
                //Decreases the stakerCount since the miner's stake is being slashed
                if(stakes.currentStatus == 4){
                    stakes.currentStatus = 5;
                    BerryTransfer.doTransfer(self,disp.reportedMiner,disp.reportingParty,self.uintVars[keccak256("stakeAmount")]);
                    stakes.currentStatus =0 ;
                }
                for(uint i = 0; i < dispRounds;i++){
                    _id = disp.disputeUintVars[keccak256(abi.encode(dispRounds-i))];
                    if(_id == 0){
                        _id = origID;
                    }
                    BerryStorage.Dispute storage disp2 = self.disputesById[_id];
                        //transfer fee adjusted based on number of miners if the minerIndex is not 2(official value)
                    BerryTransfer.doTransfer(self,address(this), disp2.reportingParty, disp2.disputeUintVars[keccak256("fee")]);
                }
            }
            else {
                stakes.currentStatus = 1;
                BerryStorage.Request storage _request = self.requestDetails[disp.disputeUintVars[keccak256("requestId")]];
                if(disp.disputeUintVars[keccak256("minerSlot")] == 2) {
                    //note we still don't put timestamp back into array (is this an issue? (shouldn't be))
                  _request.finalValues[disp.disputeUintVars[keccak256("timestamp")]] = disp.disputeUintVars[keccak256("value")];
                }
                if (_request.inDispute[disp.disputeUintVars[keccak256("timestamp")]] == true) {
                    _request.inDispute[disp.disputeUintVars[keccak256("timestamp")]] = false;
                }
                for(uint i = 0; i < dispRounds;i++){
                    _id = disp.disputeUintVars[keccak256(abi.encode(dispRounds-i))];
                    if(_id != 0){
                        last = self.disputesById[_id];//handling if happens during an upgrade
                    }
                    BerryTransfer.doTransfer(self,address(this),last.reportedMiner,self.disputesById[_id].disputeUintVars[keccak256("fee")]);
                }
            }

            if (disp.disputeUintVars[keccak256("minerSlot")] == 2) {
                self.requestDetails[disp.disputeUintVars[keccak256("requestId")]].apiUintVars[keccak256("disputeCount")]--;
            } 
    }

    /**
    * @dev This function upates the minimun dispute fee as a function of the amount
    * of staked miners
    */
    function updateMinDisputeFee(BerryStorage.BerryStorageStruct storage self) public {
        uint256 stakeAmount = self.uintVars[keccak256("stakeAmount")];
        uint256 targetMiners = self.uintVars[keccak256("targetMiners")];
        self.uintVars[keccak256("disputeFee")] = SafeMath.max(15e18,
                (stakeAmount-(stakeAmount*(SafeMath.min(targetMiners,self.uintVars[keccak256("stakerCount")])*1000)/
                targetMiners)/1000));
    }
}

File 4 of 9 : BerryGettersLibrary.sol
pragma solidity ^0.5.0;

import "./SafeMath.sol";
import "./BerryStorage.sol";
import "./Utilities.sol";

/**
* @title Berry Getters Library
* @dev This is the getter library for all variables in the Berry Tributes system. BerryGetters references this
* libary for the getters logic
*/
library BerryGettersLibrary {
    using SafeMath for uint256;

    event NewBerryAddress(address _newBerry); //emmited when a proposed fork is voted true

    /*Functions*/

    //The next two functions are onlyOwner functions.  For Berry to be truly decentralized, we will need to transfer the Deity to the 0 address.
    //Only needs to be in library
    /**
    * @dev This function allows us to set a new Deity (or remove it)
    * @param _newDeity address of the new Deity of the berry system
    */
    function changeDeity(BerryStorage.BerryStorageStruct storage self, address _newDeity) internal {
        require(self.addressVars[keccak256("_deity")] == msg.sender, "Sender is not deity");
        self.addressVars[keccak256("_deity")] = _newDeity;
    }

    //Only needs to be in library
    /**
    * @dev This function allows the deity to upgrade the Berry System
    * @param _berryContract address of new updated BerryCore contract
    */
    function changeBerryContract(BerryStorage.BerryStorageStruct storage self, address _berryContract) internal {
        require(self.addressVars[keccak256("_deity")] == msg.sender, "Sender is not deity");
        self.addressVars[keccak256("berryContract")] = _berryContract;
        emit NewBerryAddress(_berryContract);
    }

    /*Berry Getters*/

    /**
    * @dev This function tells you if a given challenge has been completed by a given miner
    * @param _challenge the challenge to search for
    * @param _miner address that you want to know if they solved the challenge
    * @return true if the _miner address provided solved the
    */
    function didMine(BerryStorage.BerryStorageStruct storage self, bytes32 _challenge, address _miner) public view returns (bool) {
        return self.minersByChallenge[_challenge][_miner];
    }

    /**
    * @dev Checks if an address voted in a dispute
    * @param _disputeId to look up
    * @param _address of voting party to look up
    * @return bool of whether or not party voted
    */
    function didVote(BerryStorage.BerryStorageStruct storage self, uint256 _disputeId, address _address) internal view returns (bool) {
        return self.disputesById[_disputeId].voted[_address];
    }

    /**
    * @dev allows Berry to read data from the addressVars mapping
    * @param _data is the keccak256("variable_name") of the variable that is being accessed.
    * These are examples of how the variables are saved within other functions:
    * addressVars[keccak256("_owner")]
    * addressVars[keccak256("berryContract")]
    * @return address requested
    */
    function getAddressVars(BerryStorage.BerryStorageStruct storage self, bytes32 _data) internal view returns (address) {
        return self.addressVars[_data];
    }

    /**
    * @dev Gets all dispute variables
    * @param _disputeId to look up
    * @return bytes32 hash of dispute
    * @return bool executed where true if it has been voted on
    * @return bool disputeVotePassed
    * @return bool isPropFork true if the dispute is a proposed fork
    * @return address of reportedMiner
    * @return address of reportingParty
    * @return address of proposedForkAddress
    * @return uint of requestId
    * @return uint of timestamp
    * @return uint of value
    * @return uint of minExecutionDate
    * @return uint of numberOfVotes
    * @return uint of blocknumber
    * @return uint of minerSlot
    * @return uint of quorum
    * @return uint of fee
    * @return int count of the current tally
    */
    function getAllDisputeVars(BerryStorage.BerryStorageStruct storage self, uint256 _disputeId)
        internal
        view
        returns (bytes32, bool, bool, bool, address, address, address, uint256[9] memory, int256)
    {
        BerryStorage.Dispute storage disp = self.disputesById[_disputeId];
        return (
            disp.hash,
            disp.executed,
            disp.disputeVotePassed,
            disp.isPropFork,
            disp.reportedMiner,
            disp.reportingParty,
            disp.proposedForkAddress,
            [
                disp.disputeUintVars[keccak256("requestId")],
                disp.disputeUintVars[keccak256("timestamp")],
                disp.disputeUintVars[keccak256("value")],
                disp.disputeUintVars[keccak256("minExecutionDate")],
                disp.disputeUintVars[keccak256("numberOfVotes")],
                disp.disputeUintVars[keccak256("blockNumber")],
                disp.disputeUintVars[keccak256("minerSlot")],
                disp.disputeUintVars[keccak256("quorum")],
                disp.disputeUintVars[keccak256("fee")]
            ],
            disp.tally
        );
    }

    /**
    * @dev Getter function for variables for the requestId being currently mined(currentRequestId)
    * @return current challenge, curretnRequestId, level of difficulty, api/query string, and granularity(number of decimals requested), total tip for the request
    */
    function getCurrentVariables(BerryStorage.BerryStorageStruct storage self)
        internal
        view
        returns (bytes32, uint256, uint256, string memory, uint256, uint256)
    {
        return (
            self.currentChallenge,
            self.uintVars[keccak256("currentRequestId")],
            self.uintVars[keccak256("difficulty")],
            self.requestDetails[self.uintVars[keccak256("currentRequestId")]].queryString,
            self.requestDetails[self.uintVars[keccak256("currentRequestId")]].apiUintVars[keccak256("granularity")],
            self.requestDetails[self.uintVars[keccak256("currentRequestId")]].apiUintVars[keccak256("totalTip")]
        );
    }

    /**
    * @dev Checks if a given hash of miner,requestId has been disputed
    * @param _hash is the sha256(abi.encodePacked(_miners[2],_requestId));
    * @return uint disputeId
    */
    function getDisputeIdByDisputeHash(BerryStorage.BerryStorageStruct storage self, bytes32 _hash) internal view returns (uint256) {
        return self.disputeIdByDisputeHash[_hash];
    }

    /**
    * @dev Checks for uint variables in the disputeUintVars mapping based on the disuputeId
    * @param _disputeId is the dispute id;
    * @param _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name is
    * the variables/strings used to save the data in the mapping. The variables names are
    * commented out under the disputeUintVars under the Dispute struct
    * @return uint value for the bytes32 data submitted
    */
    function getDisputeUintVars(BerryStorage.BerryStorageStruct storage self, uint256 _disputeId, bytes32 _data)
        internal
        view
        returns (uint256)
    {
        return self.disputesById[_disputeId].disputeUintVars[_data];
    }

    /**
    * @dev Gets the a value for the latest timestamp available
    * @return value for timestamp of last proof of work submited
    * @return true if the is a timestamp for the lastNewValue
    */
    function getLastNewValue(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256, bool) {
        return (
            retrieveData(
                self,
                self.requestIdByTimestamp[self.uintVars[keccak256("timeOfLastNewValue")]],
                self.uintVars[keccak256("timeOfLastNewValue")]
            ),
            true
        );
    }

    /**
    * @dev Gets the a value for the latest timestamp available
    * @param _requestId being requested
    * @return value for timestamp of last proof of work submited and if true if it exist or 0 and false if it doesn't
    */
    function getLastNewValueById(BerryStorage.BerryStorageStruct storage self, uint256 _requestId) internal view returns (uint256, bool) {
        BerryStorage.Request storage _request = self.requestDetails[_requestId];
        if (_request.requestTimestamps.length != 0) {
            return (retrieveData(self, _requestId, _request.requestTimestamps[_request.requestTimestamps.length - 1]), true);
        } else {
            return (0, false);
        }
    }

    /**
    * @dev Gets blocknumber for mined timestamp
    * @param _requestId to look up
    * @param _timestamp is the timestamp to look up blocknumber
    * @return uint of the blocknumber which the dispute was mined
    */
    function getMinedBlockNum(BerryStorage.BerryStorageStruct storage self, uint256 _requestId, uint256 _timestamp)
        internal
        view
        returns (uint256)
    {
        return self.requestDetails[_requestId].minedBlockNum[_timestamp];
    }

    /**
    * @dev Gets the 5 miners who mined the value for the specified requestId/_timestamp
    * @param _requestId to look up
    * @param _timestamp is the timestamp to look up miners for
    * @return the 5 miners' addresses
    */
    function getMinersByRequestIdAndTimestamp(BerryStorage.BerryStorageStruct storage self, uint256 _requestId, uint256 _timestamp)
        internal
        view
        returns (address[5] memory)
    {
        return self.requestDetails[_requestId].minersByValue[_timestamp];
    }

    /**
    * @dev Counts the number of values that have been submited for the request
    * if called for the currentRequest being mined it can tell you how many miners have submitted a value for that
    * request so far
    * @param _requestId the requestId to look up
    * @return uint count of the number of values received for the requestId
    */
    function getNewValueCountbyRequestId(BerryStorage.BerryStorageStruct storage self, uint256 _requestId) internal view returns (uint256) {
        return self.requestDetails[_requestId].requestTimestamps.length;
    }

    /**
    * @dev Getter function for the specified requestQ index
    * @param _index to look up in the requestQ array
    * @return uint of reqeuestId
    */
    function getRequestIdByRequestQIndex(BerryStorage.BerryStorageStruct storage self, uint256 _index) internal view returns (uint256) {
        require(_index <= 50, "RequestQ index is above 50");
        return self.requestIdByRequestQIndex[_index];
    }

    /**
    * @dev Getter function for requestId based on timestamp
    * @param _timestamp to check requestId
    * @return uint of reqeuestId
    */
    function getRequestIdByTimestamp(BerryStorage.BerryStorageStruct storage self, uint256 _timestamp) internal view returns (uint256) {
        return self.requestIdByTimestamp[_timestamp];
    }

    /**
    * @dev Getter function for requestId based on the qeuaryHash
    * @param _queryHash hash(of string api and granularity) to check if a request already exists
    * @return uint requestId
    */
    function getRequestIdByQueryHash(BerryStorage.BerryStorageStruct storage self, bytes32 _queryHash) internal view returns (uint256) {
        return self.requestIdByQueryHash[_queryHash];
    }

    /**
    * @dev Getter function for the requestQ array
    * @return the requestQ arrray
    */
    function getRequestQ(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256[51] memory) {
        return self.requestQ;
    }

    /**
    * @dev Allowes access to the uint variables saved in the apiUintVars under the requestDetails struct
    * for the requestId specified
    * @param _requestId to look up
    * @param _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name is
    * the variables/strings used to save the data in the mapping. The variables names are
    * commented out under the apiUintVars under the requestDetails struct
    * @return uint value of the apiUintVars specified in _data for the requestId specified
    */
    function getRequestUintVars(BerryStorage.BerryStorageStruct storage self, uint256 _requestId, bytes32 _data)
        internal
        view
        returns (uint256)
    {
        return self.requestDetails[_requestId].apiUintVars[_data];
    }

    /**
    * @dev Gets the API struct variables that are not mappings
    * @param _requestId to look up
    * @return string of api to query
    * @return string of symbol of api to query
    * @return bytes32 hash of string
    * @return bytes32 of the granularity(decimal places) requested
    * @return uint of index in requestQ array
    * @return uint of current payout/tip for this requestId
    */
    function getRequestVars(BerryStorage.BerryStorageStruct storage self, uint256 _requestId)
        internal
        view
        returns (string memory, string memory, bytes32, uint256, uint256, uint256)
    {
        BerryStorage.Request storage _request = self.requestDetails[_requestId];
        return (
            _request.queryString,
            _request.dataSymbol,
            _request.queryHash,
            _request.apiUintVars[keccak256("granularity")],
            _request.apiUintVars[keccak256("requestQPosition")],
            _request.apiUintVars[keccak256("totalTip")]
        );
    }

    /**
    * @dev This function allows users to retireve all information about a staker
    * @param _staker address of staker inquiring about
    * @return uint current state of staker
    * @return uint startDate of staking
    */
    function getStakerInfo(BerryStorage.BerryStorageStruct storage self, address _staker) internal view returns (uint256, uint256) {
        return (self.stakerDetails[_staker].currentStatus, self.stakerDetails[_staker].startDate);
    }

    /**
    * @dev Gets the 5 miners who mined the value for the specified requestId/_timestamp
    * @param _requestId to look up
    * @param _timestamp is the timestampt to look up miners for
    * @return address[5] array of 5 addresses ofminers that mined the requestId
    */
    function getSubmissionsByTimestamp(BerryStorage.BerryStorageStruct storage self, uint256 _requestId, uint256 _timestamp)
        internal
        view
        returns (uint256[5] memory)
    {
        return self.requestDetails[_requestId].valuesByTimestamp[_timestamp];
    }

    /**
    * @dev Gets the timestamp for the value based on their index
    * @param _requestID is the requestId to look up
    * @param _index is the value index to look up
    * @return uint timestamp
    */
    function getTimestampbyRequestIDandIndex(BerryStorage.BerryStorageStruct storage self, uint256 _requestID, uint256 _index)
        internal
        view
        returns (uint256)
    {
        return self.requestDetails[_requestID].requestTimestamps[_index];
    }

    /**
    * @dev Getter for the variables saved under the BerryStorageStruct uintVars variable
    * @param _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name is
    * the variables/strings used to save the data in the mapping. The variables names are
    * commented out under the uintVars under the BerryStorageStruct struct
    * This is an example of how data is saved into the mapping within other functions:
    * self.uintVars[keccak256("stakerCount")]
    * @return uint of specified variable
    */
    function getUintVar(BerryStorage.BerryStorageStruct storage self, bytes32 _data) internal view returns (uint256) {
        return self.uintVars[_data];
    }

    /**
    * @dev Getter function for next requestId on queue/request with highest payout at time the function is called
    * @return onDeck/info on request with highest payout-- RequestId, Totaltips, and API query string
    */
    function getVariablesOnDeck(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256, uint256, string memory) {
        uint256 newRequestId = getTopRequestID(self);
        return (
            newRequestId,
            self.requestDetails[newRequestId].apiUintVars[keccak256("totalTip")],
            self.requestDetails[newRequestId].queryString
        );
    }

    /**
    * @dev Getter function for the request with highest payout. This function is used within the getVariablesOnDeck function
    * @return uint _requestId of request with highest payout at the time the function is called
    */
    function getTopRequestID(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256 _requestId) {
        uint256 _max;
        uint256 _index;
        (_max, _index) = Utilities.getMax(self.requestQ);
        _requestId = self.requestIdByRequestQIndex[_index];
    }

    /**
    * @dev Gets the 5 miners who mined the value for the specified requestId/_timestamp
    * @param _requestId to looku p
    * @param _timestamp is the timestamp to look up miners for
    * @return bool true if requestId/timestamp is under dispute
    */
    function isInDispute(BerryStorage.BerryStorageStruct storage self, uint256 _requestId, uint256 _timestamp) internal view returns (bool) {
        return self.requestDetails[_requestId].inDispute[_timestamp];
    }

    /**
    * @dev Retreive value from oracle based on requestId/timestamp
    * @param _requestId being requested
    * @param _timestamp to retreive data/value from
    * @return uint value for requestId/timestamp submitted
    */
    function retrieveData(BerryStorage.BerryStorageStruct storage self, uint256 _requestId, uint256 _timestamp)
        internal
        view
        returns (uint256)
    {
        return self.requestDetails[_requestId].finalValues[_timestamp];
    }

    /**
    * @dev Getter for the total_supply of oracle tokens
    * @return uint total supply
    */
    function totalSupply(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256) {
        return self.uintVars[keccak256("total_supply")];
    }

}

File 5 of 9 : BerryStake.sol
pragma solidity ^0.5.16;


import "./BerryStorage.sol";
import "./BerryTransfer.sol";
import "./BerryDispute.sol";
import "./Utilities.sol";
/**
* itle Berry Stake
* @dev Contains the methods related to miners staking and unstaking. Berry.sol
* references this library for function's logic.
*/

library BerryStake {
    event NewStake(address indexed _sender); //Emits upon new staker
    event StakeWithdrawn(address indexed _sender); //Emits when a staker is now no longer staked
    event StakeWithdrawRequested(address indexed _sender); //Emits when a staker begins the 7 day withdraw period

    /*Functions*/

    /**
    * @dev This function stakes the five initial miners, sets the supply and all the constant variables.
    * This function is called by the constructor function on BerryMaster.sol
    */
    function init(BerryStorage.BerryStorageStruct storage self) public {
        require(self.uintVars[keccak256("decimals")] == 0, "Too many decimals");
        //Give this contract 6000 Berry Tributes so that it can stake the initial 6 miners
        BerryTransfer.updateBalanceAtNow(self.balances[address(this)], 5000000e18);

        // //the initial 5 miner addresses are specfied below
        // //changed payable[5] to 6
        address payable[6] memory _initalMiners = [
address(0x1b906684efa10C536E4ADbAB63489acE94fE0724),
address(0x12d13EA7869eCBFE703Fb77C0259614b8b927b62),
address(0x1ca1Cd7FB013DEd91B24403B008C5E65C8367E1d),
address(0x95676256f152D3b0E1511a1ED00617aF34FBcC13),
address(0x1d49038242c9CCd299543a765fdf927d0c05F37d),
address(0x18358A7d4A72fAe65d0b30c80CC85CD2332243E3)
        ];
        //Stake each of the 5 miners specified above
        for (uint256 i = 0; i < 6; i++) {
            //6th miner to allow for dispute
            //Miner balance is set at 1000e18 at the block that this function is ran
            BerryTransfer.updateBalanceAtNow(self.balances[_initalMiners[i]], 1000e18);

            newStake(self, _initalMiners[i]);
        }

        // for add tip, if accounts[0] will overwrite 1000 staking
        BerryTransfer.updateBalanceAtNow(self.balances[msg.sender], 10000e18);
        
        // for Mining liquidity 1875000 + for IFO 2000000
        BerryTransfer.updateBalanceAtNow(self.balances[address(0xa2Dd53Cdf42C49963BD8d4E505d7C921b6558F61)], 3875000e18);
        // for Ecosystem data 2875000 - 6000(6 miners staking) - 10000(for add tip)
        BerryTransfer.updateBalanceAtNow(self.balances[address(0x55d166E9b4b20352c18D66BdcC828eD4A9113C19)], 2859000e18);
        // for Team, will vesting for 2 years
        BerryTransfer.updateBalanceAtNow(self.balances[address(0x8342DD495b3aE442BB3615f4779D6db0E85eBD48)], 750000e18);

        //update the total suppply
        self.uintVars[keccak256("total_supply")] += 7500000e18; //6th miner to allow for dispute
        //set Constants
        self.uintVars[keccak256("decimals")] = 18;
        self.uintVars[keccak256("targetMiners")] = 200;
        self.uintVars[keccak256("stakeAmount")] = 1000e18;
        self.uintVars[keccak256("disputeFee")] = 970e18;
        self.uintVars[keccak256("timeTarget")] = 180;
        self.uintVars[keccak256("timeOfLastNewValue")] = now - (now % self.uintVars[keccak256("timeTarget")]);
        self.uintVars[keccak256("difficulty")] = 1;
        self.uintVars[keccak256("height")] = 0;
    }

    /**
    * @dev This function allows stakers to request to withdraw their stake (no longer stake)
    * once they lock for withdraw(stakes.currentStatus = 2) they are locked for 7 days before they
    * can withdraw the deposit
    */
    function requestStakingWithdraw(BerryStorage.BerryStorageStruct storage self) public {
        BerryStorage.StakeInfo storage stakes = self.stakerDetails[msg.sender];
        //Require that the miner is staked
        require(stakes.currentStatus == 1, "Miner is not staked");

        //Change the miner staked to locked to be withdrawStake
        stakes.currentStatus = 2;

        //Change the startDate to now since the lock up period begins now
        //and the miner can only withdraw 7 days later from now(check the withdraw function)
        stakes.startDate = now - (now % 86400);

        //Reduce the staker count
        self.uintVars[keccak256("stakerCount")] -= 1;

        //Update the minimum dispute fee that is based on the number of stakers 
        BerryDispute.updateMinDisputeFee(self);
        emit StakeWithdrawRequested(msg.sender);
    }

    /**
    * @dev This function allows users to withdraw their stake after a 7 day waiting period from request
    */
    function withdrawStake(BerryStorage.BerryStorageStruct storage self) public {
        BerryStorage.StakeInfo storage stakes = self.stakerDetails[msg.sender];
        //Require the staker has locked for withdraw(currentStatus ==2) and that 7 days have
        //passed by since they locked for withdraw
        require(now - (now % 86400) - stakes.startDate >= 7 days, "7 days didn't pass");
        require(stakes.currentStatus == 2, "Miner was not locked for withdrawal");
        stakes.currentStatus = 0;
        emit StakeWithdrawn(msg.sender);
    }

    /**
    * @dev This function allows miners to deposit their stake.
    */
    function depositStake(BerryStorage.BerryStorageStruct storage self) public {
        newStake(self, msg.sender);
        //self adjusting disputeFee
        BerryDispute.updateMinDisputeFee(self);
    }

    /**
    * @dev This function is used by the init function to succesfully stake the initial 5 miners.
    * The function updates their status/state and status start date so they are locked it so they can't withdraw
    * and updates the number of stakers in the system.
    */
    function newStake(BerryStorage.BerryStorageStruct storage self, address staker) internal {
        require(BerryTransfer.balanceOf(self, staker) >= self.uintVars[keccak256("stakeAmount")], "Balance is lower than stake amount");
        //Ensure they can only stake if they are not currrently staked or if their stake time frame has ended
        //and they are currently locked for witdhraw
        require(self.stakerDetails[staker].currentStatus == 0 || self.stakerDetails[staker].currentStatus == 2, "Miner is in the wrong state");
        self.uintVars[keccak256("stakerCount")] += 1;
        self.stakerDetails[staker] = BerryStorage.StakeInfo({
            currentStatus: 1, //this resets their stake start date to today
            startDate: now - (now % 86400)
        });
        emit NewStake(staker);
    }

    /**
    * @dev Getter function for the requestId being mined 
    * @return variables for the current minin event: Challenge, 5 RequestId, difficulty and Totaltips
    */
    function getNewCurrentVariables(BerryStorage.BerryStorageStruct storage self) internal view returns(bytes32 _challenge,uint[5] memory _requestIds,uint256 _difficulty, uint256 _tip){
        for(uint i=0;i<5;i++){
            _requestIds[i] =  self.currentMiners[i].value;
        }
        return (self.currentChallenge,_requestIds,self.uintVars[keccak256("difficulty")],self.uintVars[keccak256("currentTotalTips")]);
    }

    /**
    * @dev Getter function for next requestId on queue/request with highest payout at time the function is called
    * @return onDeck/info on top 5 requests(highest payout)-- RequestId, Totaltips
    */
    function getNewVariablesOnDeck(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256[5] memory idsOnDeck, uint256[5] memory tipsOnDeck) {
        idsOnDeck = getTopRequestIDs(self);
        for(uint i = 0;i<5;i++){
            tipsOnDeck[i] = self.requestDetails[idsOnDeck[i]].apiUintVars[keccak256("totalTip")];
        }
    }
    
    /**
    * @dev Getter function for the top 5 requests with highest payouts. This function is used within the getNewVariablesOnDeck function
    * @return uint256[5] is an array with the top 5(highest payout) _requestIds at the time the function is called
    */
    function getTopRequestIDs(BerryStorage.BerryStorageStruct storage self) internal view returns (uint256[5] memory _requestIds) {
        uint256[5] memory _max;
        uint256[5] memory _index;
        (_max, _index) = Utilities.getMax5(self.requestQ);
        for(uint i=0;i<5;i++){
            if(_max[i] != 0){
                _requestIds[i] = self.requestIdByRequestQIndex[_index[i]];
            }
            else{
                _requestIds[i] = self.currentMiners[4-i].value;
            }
        }
    }


   
}

File 6 of 9 : BerryStorage.sol
pragma solidity ^0.5.0;

/**
 * @title Berry Oracle Storage Library
 * @dev Contains all the variables/structs used by Berry
 */

library BerryStorage {
    //Internal struct for use in proof-of-work submission
    struct Details {
        uint256 value;
        address miner;
    }

    struct Dispute {
        bytes32 hash; //unique hash of dispute: keccak256(_miner,_requestId,_timestamp)
        int256 tally; //current tally of votes for - against measure
        bool executed; //is the dispute settled
        bool disputeVotePassed; //did the vote pass?
        bool isPropFork; //true for fork proposal NEW
        address reportedMiner; //miner who alledgedly submitted the 'bad value' will get disputeFee if dispute vote fails
        address reportingParty; //miner reporting the 'bad value'-pay disputeFee will get reportedMiner's stake if dispute vote passes
        address proposedForkAddress; //new fork address (if fork proposal)
        mapping(bytes32 => uint256) disputeUintVars;
        //Each of the variables below is saved in the mapping disputeUintVars for each disputeID
        //e.g. BerryStorageStruct.DisputeById[disputeID].disputeUintVars[keccak256("requestId")]
        //These are the variables saved in this mapping:
        // uint keccak256("requestId");//apiID of disputed value
        // uint keccak256("timestamp");//timestamp of distputed value
        // uint keccak256("value"); //the value being disputed
        // uint keccak256("minExecutionDate");//7 days from when dispute initialized
        // uint keccak256("numberOfVotes");//the number of parties who have voted on the measure
        // uint keccak256("blockNumber");// the blocknumber for which votes will be calculated from
        // uint keccak256("minerSlot"); //index in dispute array
        // uint keccak256("fee"); //fee paid corresponding to dispute
        mapping(address => bool) voted; //mapping of address to whether or not they voted
    }

    struct StakeInfo {
        uint256 currentStatus; //0-not Staked, 1=Staked, 2=LockedForWithdraw 3= OnDispute 4=ReadyForUnlocking 5=Unlocked
        uint256 startDate; //stake start date
    }

    //Internal struct to allow balances to be queried by blocknumber for voting purposes
    struct Checkpoint {
        uint128 fromBlock; // fromBlock is the block number that the value was generated from
        uint128 value; // value is the amount of tokens at a specific block number
    }

    struct Request {
        string queryString; //id to string api
        string dataSymbol; //short name for api request
        bytes32 queryHash; //hash of api string and granularity e.g. keccak256(abi.encodePacked(_sapi,_granularity))
        uint256[] requestTimestamps; //array of all newValueTimestamps requested
        mapping(bytes32 => uint256) apiUintVars;
        //Each of the variables below is saved in the mapping apiUintVars for each api request
        //e.g. requestDetails[_requestId].apiUintVars[keccak256("totalTip")]
        //These are the variables saved in this mapping:
        // uint keccak256("granularity"); //multiplier for miners
        // uint keccak256("requestQPosition"); //index in requestQ
        // uint keccak256("totalTip");//bonus portion of payout
        mapping(uint256 => uint256) minedBlockNum; //[apiId][minedTimestamp]=>block.number
        //This the time series of finalValues stored by the contract where uint UNIX timestamp is mapped to value
        mapping(uint256 => uint256) finalValues;
        mapping(uint256 => bool) inDispute; //checks if API id is in dispute or finalized.
        mapping(uint256 => address[5]) minersByValue;
        mapping(uint256 => uint256[5]) valuesByTimestamp;
    }

    struct BerryStorageStruct {
        bytes32 currentChallenge; //current challenge to be solved
        uint256[51] requestQ; //uint50 array of the top50 requests by payment amount
        uint256[] newValueTimestamps; //array of all timestamps requested
        Details[5] currentMiners; //This struct is for organizing the five mined values to find the median
        mapping(bytes32 => address) addressVars;
        //Address fields in the Berry contract are saved the addressVars mapping
        //e.g. addressVars[keccak256("berryContract")] = address
        //These are the variables saved in this mapping:
        // address keccak256("berryContract");//Berry address
        // address  keccak256("_owner");//Berry Owner address
        // address  keccak256("_deity");//Berry Owner that can do things at will
        // address  keccak256("pending_owner"); // The proposed new owner
        mapping(bytes32 => uint256) uintVars;
        //uint fields in the Berry contract are saved the uintVars mapping
        //e.g. uintVars[keccak256("decimals")] = uint
        //These are the variables saved in this mapping:
        // keccak256("decimals");    //18 decimal standard ERC20
        // keccak256("disputeFee");//cost to dispute a mined value
        // keccak256("disputeCount");//totalHistoricalDisputes
        // keccak256("total_supply"); //total_supply of the token in circulation
        // keccak256("stakeAmount");//stakeAmount for miners (we can cut gas if we just hardcode it in...or should it be variable?)
        // keccak256("stakerCount"); //number of parties currently staked
        // keccak256("timeOfLastNewValue"); // time of last challenge solved
        // keccak256("difficulty"); // Difficulty of current block
        // keccak256("currentTotalTips"); //value of highest api/timestamp PayoutPool
        // keccak256("currentRequestId"); //API being mined--updates with the ApiOnQ Id
        // keccak256("requestCount"); // total number of requests through the system
        // keccak256("slotProgress");//Number of miners who have mined this value so far
        // keccak256("miningReward");//Mining Reward in PoWo tokens given to all miners per value
        // keccak256("timeTarget"); //The time between blocks (mined Oracle values)
        // keccak256("_tBlock"); //
        // keccak256("runningTips"); // VAriable to track running tips
        // keccak256("currentReward"); // The current reward
        // keccak256("devShare"); // The amount directed towards th devShare
        // keccak256("currentTotalTips"); //
        // keccak256("height");
        
        //This is a boolean that tells you if a given challenge has been completed by a given miner
        mapping(bytes32 => mapping(address => bool)) minersByChallenge;
        mapping(uint256 => uint256) requestIdByTimestamp; //minedTimestamp to apiId
        mapping(uint256 => uint256) requestIdByRequestQIndex; //link from payoutPoolIndex (position in payout pool array) to apiId
        mapping(uint256 => Dispute) disputesById; //disputeId=> Dispute details
        mapping(address => Checkpoint[]) balances; //balances of a party given blocks
        mapping(address => mapping(address => uint256)) allowed; //allowance for a given party and approver
        mapping(address => StakeInfo) stakerDetails; //mapping from a persons address to their staking info
        mapping(uint256 => Request) requestDetails; //mapping of apiID to details
        mapping(bytes32 => uint256) requestIdByQueryHash; // api bytes32 gets an id = to count of requests array
        mapping(bytes32 => uint256) disputeIdByDisputeHash; //maps a hash to an ID for each dispute
    }
}

File 7 of 9 : BerryTransfer.sol
pragma solidity ^0.5.16;

import "./SafeMath.sol";
import "./BerryStorage.sol";

/**
* @title Berry Transfer
* @dev Contains the methods related to transfers and ERC20. Berry.sol and BerryGetters.sol
* reference this library for function's logic.
*/
library BerryTransfer {
    using SafeMath for uint256;

    event Approval(address indexed _owner, address indexed _spender, uint256 _value); //ERC20 Approval event
    event Transfer(address indexed _from, address indexed _to, uint256 _value); //ERC20 Transfer Event

    bytes32 public constant stakeAmount = 0x7be108969d31a3f0b261465c71f2b0ba9301cd914d55d9091c3b36a49d4d41b2; //keccak256("stakeAmount")

    /*Functions*/

    /**
    * @dev Allows for a transfer of tokens to _to
    * @param _to The address to send tokens to
    * @param _amount The amount of tokens to send
    * @return true if transfer is successful
    */
    function transfer(BerryStorage.BerryStorageStruct storage self, address _to, uint256 _amount) public returns (bool success) {
        doTransfer(self, msg.sender, _to, _amount);
        return true;
    }

    /**
    * @notice Send _amount tokens to _to from _from on the condition it
    * is approved by _from
    * @param _from The address holding the tokens being transferred
    * @param _to The address of the recipient
    * @param _amount The amount of tokens to be transferred
    * @return True if the transfer was successful
    */
    function transferFrom(BerryStorage.BerryStorageStruct storage self, address _from, address _to, uint256 _amount)
        public
        returns (bool success)
    {
        require(self.allowed[_from][msg.sender] >= _amount, "Allowance is wrong");
        self.allowed[_from][msg.sender] -= _amount;
        doTransfer(self, _from, _to, _amount);
        return true;
    }

    /**
    * @dev This function approves a _spender an _amount of tokens to use
    * @param _spender address
    * @param _amount amount the spender is being approved for
    * @return true if spender appproved successfully
    */
    function approve(BerryStorage.BerryStorageStruct storage self, address _spender, uint256 _amount) public returns (bool) {
        require(_spender != address(0), "Spender is 0-address");
        require(self.allowed[msg.sender][_spender] == 0 || _amount == 0, "Spender is already approved");
        self.allowed[msg.sender][_spender] = _amount;
        emit Approval(msg.sender, _spender, _amount);
        return true;
    }

    /**
    * @param _user address of party with the balance
    * @param _spender address of spender of parties said balance
    * @return Returns the remaining allowance of tokens granted to the _spender from the _user
    */
    function allowance(BerryStorage.BerryStorageStruct storage self, address _user, address _spender) public view returns (uint256) {
        return self.allowed[_user][_spender];
    }

    /**
    * @dev Completes POWO transfers by updating the balances on the current block number
    * @param _from address to transfer from
    * @param _to addres to transfer to
    * @param _amount to transfer
    */
    function doTransfer(BerryStorage.BerryStorageStruct storage self, address _from, address _to, uint256 _amount) public {
        require(_amount != 0, "Tried to send non-positive amount");
        require(_to != address(0), "Receiver is 0 address");
        require(allowedToTrade(self, _from, _amount), "Should have sufficient balance to trade");
        uint256 previousBalance = balanceOf(self, _from);
        updateBalanceAtNow(self.balances[_from], previousBalance - _amount);
        previousBalance = balanceOf(self,_to);
        require(previousBalance + _amount >= previousBalance, "Overflow happened"); // Check for overflow
        updateBalanceAtNow(self.balances[_to], previousBalance + _amount);
        emit Transfer(_from, _to, _amount);
    }

    /**
    * @dev Gets balance of owner specified
    * @param _user is the owner address used to look up the balance
    * @return Returns the balance associated with the passed in _user
    */
    function balanceOf(BerryStorage.BerryStorageStruct storage self, address _user) public view returns (uint256) {
        return balanceOfAt(self, _user, block.number);
    }

    /**
    * @dev Queries the balance of _user at a specific _blockNumber
    * @param _user The address from which the balance will be retrieved
    * @param _blockNumber The block number when the balance is queried
    * @return The balance at _blockNumber specified
    */
    function balanceOfAt(BerryStorage.BerryStorageStruct storage self, address _user, uint256 _blockNumber) public view returns (uint256) {
        BerryStorage.Checkpoint[] storage checkpoints = self.balances[_user];
        if (checkpoints.length == 0|| checkpoints[0].fromBlock > _blockNumber) {
            return 0;
        } else {
            if (_blockNumber >= checkpoints[checkpoints.length - 1].fromBlock) return checkpoints[checkpoints.length - 1].value;
            // Binary search of the value in the array
            uint256 min = 0;
            uint256 max = checkpoints.length - 2;
            while (max > min) {
                uint256 mid = (max + min + 1) / 2;
                if  (checkpoints[mid].fromBlock ==_blockNumber){
                    return checkpoints[mid].value;
                }else if(checkpoints[mid].fromBlock < _blockNumber) {
                    min = mid;
                } else {
                    max = mid - 1;
                }
            }
            return checkpoints[min].value;
        }
    }
    /**
    * @dev This function returns whether or not a given user is allowed to trade a given amount
    * and removing the staked amount from their balance if they are staked
    * @param _user address of user
    * @param _amount to check if the user can spend
    * @return true if they are allowed to spend the amount being checked
    */
    function allowedToTrade(BerryStorage.BerryStorageStruct storage self, address _user, uint256 _amount) public view returns (bool) { 
        if (self.stakerDetails[_user].currentStatus != 0 && self.stakerDetails[_user].currentStatus < 5) {
            //Subtracts the stakeAmount from balance if the _user is staked
            if (balanceOf(self, _user)- self.uintVars[stakeAmount] >= _amount) {
                return true;
            }
            return false;
        } 
        return (balanceOf(self, _user) >= _amount);
    }

    /**
    * @dev Updates balance for from and to on the current block number via doTransfer
    * @param checkpoints gets the mapping for the balances[owner]
    * @param _value is the new balance
    */
    function updateBalanceAtNow(BerryStorage.Checkpoint[] storage checkpoints, uint256 _value) public {
        if (checkpoints.length == 0 || checkpoints[checkpoints.length - 1].fromBlock != block.number) {
           checkpoints.push(BerryStorage.Checkpoint({
                fromBlock : uint128(block.number),
                value : uint128(_value)
            }));
        } else {
            BerryStorage.Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length - 1];
            oldCheckPoint.value = uint128(_value);
        }
    }
}

File 8 of 9 : SafeMath.sol
pragma solidity ^0.5.16;

//Slightly modified SafeMath library - includes a min and max function, removes useless div function
library SafeMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }

    function add(int256 a, int256 b) internal pure returns (int256 c) {
        if (b > 0) {
            c = a + b;
            assert(c >= a);
        } else {
            c = a + b;
            assert(c <= a);
        }
    }

    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    function max(int256 a, int256 b) internal pure returns (uint256) {
        return a > b ? uint256(a) : uint256(b);
    }

    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a * b;
        assert(a == 0 || c / a == b);
        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    function sub(int256 a, int256 b) internal pure returns (int256 c) {
        if (b > 0) {
            c = a - b;
            assert(c <= a);
        } else {
            c = a - b;
            assert(c >= a);
        }

    }
}

File 9 of 9 : Utilities.sol
pragma solidity ^0.5.16;

//Functions for retrieving min and Max in 51 length array (requestQ)
//Taken partly from: https://github.com/modular-network/ethereum-libraries-array-utils/blob/master/contracts/Array256Lib.sol

library Utilities {
    /**
    * @dev Returns the max value in an array.
    * The zero position here is ignored. It's because 
    * there's no null in solidity and we map each address 
    * to an index in this array. So when we get 51 parties, 
    * and one person is kicked out of the top 50, we 
    * assign them a 0, and when you get mined and pulled 
    * out of the top 50, also a 0. So then lot's of parties 
    * will have zero as the index so we made the array run 
    * from 1-51 with zero as nothing.
    * @param data is the array to calculate max from
    * @return max amount and its index within the array
    */
    function getMax(uint256[51] memory data) internal pure returns (uint256 max, uint256 maxIndex) {
        maxIndex = 1;
        max = data[maxIndex];
        for (uint256 i = 2; i < data.length; i++) {
            if (data[i] > max) {
                max = data[i];
                maxIndex = i;
            }
        }
    }

    /**
    * @dev Returns the minimum value in an array.
    * @param data is the array to calculate min from
    * @return min amount and its index within the array
    */
    function getMin(uint256[51] memory data) internal pure returns (uint256 min, uint256 minIndex) {
        minIndex = data.length - 1;
        min = data[minIndex];
        for (uint256 i = data.length - 2; i > 0; i--) {
            if (data[i] < min) {
                min = data[i];
                minIndex = i;
            }
        }
    }

    /**
    * @dev Returns the 5 requestsId's with the top payouts in an array.
    * @param data is the array to get the top 5 from
    * @return to 5 max amounts and their respective index within the array
    */
    function getMax5(uint256[51] memory data) internal pure returns (uint256[5] memory max, uint256[5] memory maxIndex) {
        uint256 min5 = data[1];
        uint256 minI = 0;
        for(uint256 j=0;j<5;j++){
            max[j]= data[j+1];//max[0]=data[1]
            maxIndex[j] = j+1;//maxIndex[0]= 1
            if(max[j] < min5){
                min5 = max[j];
                minI = j;
            }
        }
        for(uint256 i = 6; i < data.length; i++) {
            if (data[i] > min5) {
                max[minI] = data[i];
                maxIndex[minI] = i;
                min5 = data[i];
                for(uint256 j=0;j<5;j++){
                    if(max[j] < min5){
                        min5 = max[j];
                        minI = j;
                    }
                }
            }
        }
    }
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "evmVersion": "istanbul",
  "libraries": {
    "/home/ubuntu/v2/bsc/BerryCore/contracts/libraries/BerryTransfer.sol": {
      "BerryTransfer": "0x93DbC20622631e3F819a7ab996ccF68326Cc21E9"
    },
    "/home/ubuntu/v2/bsc/BerryCore/contracts/libraries/BerryGettersLibrary.sol": {
      "BerryGettersLibrary": "0x63A8488900D1dcE6878C4ac9C2EA6cf7DA7f212b"
    },
    "/home/ubuntu/v2/bsc/BerryCore/contracts/libraries/BerryStake.sol": {
      "BerryStake": "0xE4b404183DDB6416C42a9f22b1B8d58Dd033f4A4"
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_berryContract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newBerry","type":"address"}],"name":"NewBerryAddress","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"allowedToTrade","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_blockNumber","type":"uint256"}],"name":"balanceOfAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_berryContract","type":"address"}],"name":"changeBerryContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newDeity","type":"address"}],"name":"changeDeity","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_challenge","type":"bytes32"},{"internalType":"address","name":"_miner","type":"address"}],"name":"didMine","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"},{"internalType":"address","name":"_address","type":"address"}],"name":"didVote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"getAddressVars","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"}],"name":"getAllDisputeVars","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[9]","name":"","type":"uint256[9]"},{"internalType":"int256","name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCurrentVariables","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"string","name":"","type":"string"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_hash","type":"bytes32"}],"name":"getDisputeIdByDisputeHash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_disputeId","type":"uint256"},{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"getDisputeUintVars","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLastNewValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"getLastNewValueById","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getMinedBlockNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getMinersByRequestIdAndTimestamp","outputs":[{"internalType":"address[5]","name":"","type":"address[5]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"getNewValueCountbyRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_request","type":"bytes32"}],"name":"getRequestIdByQueryHash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getRequestIdByRequestQIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getRequestIdByTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRequestQ","outputs":[{"internalType":"uint256[51]","name":"","type":"uint256[51]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"getRequestUintVars","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"getRequestVars","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"getStakerInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getSubmissionsByTimestamp","outputs":[{"internalType":"uint256[5]","name":"","type":"uint256[5]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestID","type":"uint256"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getTimestampbyRequestIDandIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_data","type":"bytes32"}],"name":"getUintVar","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getVariablesOnDeck","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"isInDispute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"retrieveData","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50604051620031a2380380620031a28339818101604052602081101561003557600080fd5b8101908080519060200190929190505050600073e4b404183ddb6416c42a9f22b1b8d58dd033f4a463778153bc90916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b15801561009857600080fd5b505af41580156100ac573d6000803e3d6000fd5b50505050336000603f01600060405180807f5f6f776e6572000000000000000000000000000000000000000000000000000081525060060190506040518091039020815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550336000603f01600060405180807f5f6465697479000000000000000000000000000000000000000000000000000081525060060190506040518091039020815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806000603f01600060405180807f6265727279436f6e747261637400000000000000000000000000000000000000815250600d0190506040518091039020815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507ffa6e3b024b379dfb1c03221aab2ead93a3b6cf5dc541bfc336ede1a1c0e1392381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150612ee080620002c26000396000f3fe6080604052600436106101e35760003560e01c806370a0823111610102578063af0b132711610095578063dd62ed3e11610064578063dd62ed3e14610e7f578063e0ae93c114610f04578063e1eee6d614610f5d578063fc7cf0a014611099576101e3565b8063af0b132714610c45578063b541302914610d84578063c775b54214610dd7578063da37994114610e30576101e3565b806393fa4915116100d157806393fa491514610a53578063999cf26c14610aac578063a22e407a14610b1f578063a7c438bc14610bd2576101e3565b806370a08231146108d0578063733bdef01461093557806377fbb663146109a15780637f6fd5d9146109fa576101e3565b80633df0777b1161017a578063612c8f7f11610149578063612c8f7f1461073e5780636173c0b81461078d57806363bb82ad146107dc57806369026d631461084f576101e3565b80633df0777b146105d257806346eee1c41461062f57806347abd7f11461067e5780634ee2cd7e146106cf576101e3565b806318160ddd116101b657806318160ddd1461046057806319e8e03b1461048b5780631db842f0146105295780633180f8df14610578576101e3565b80630442c1b8146102c45780630f0b424d1461031557806311c9851214610364578063133bee5e146103e5575b600080603f01600060405180807f6265727279436f6e747261637400000000000000000000000000000000000000815250600d0190506040518091039020815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060606000368080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008082516020840185600019f43d604051816000823e82600081146102c0578282f35b8282fd5b3480156102d057600080fd5b50610313600480360360208110156102e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110cf565b005b34801561032157600080fd5b5061034e6004803603602081101561033857600080fd5b81019080803590602001909291905050506110e6565b6040518082815260200191505060405180910390f35b34801561037057600080fd5b506103a76004803603604081101561038757600080fd5b810190808035906020019092919080359060200190929190505050611103565b6040518082600560200280838360005b838110156103d25780820151818401526020810190506103b7565b5050505090500191505060405180910390f35b3480156103f157600080fd5b5061041e6004803603602081101561040857600080fd5b8101908080359060200190929190505050611129565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561046c57600080fd5b50610475611146565b6040518082815260200191505060405180910390f35b34801561049757600080fd5b506104a0611157565b6040518084815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156104ec5780820151818401526020810190506104d1565b50505050905090810190601f1680156105195780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34801561053557600080fd5b506105626004803603602081101561054c57600080fd5b8101908080359060200190929190505050611171565b6040518082815260200191505060405180910390f35b34801561058457600080fd5b506105b16004803603602081101561059b57600080fd5b810190808035906020019092919050505061118e565b60405180838152602001821515151581526020019250505060405180910390f35b3480156105de57600080fd5b50610615600480360360408110156105f557600080fd5b8101908080359060200190929190803590602001909291905050506111ae565b604051808215151515815260200191505060405180910390f35b34801561063b57600080fd5b506106686004803603602081101561065257600080fd5b81019080803590602001909291905050506111ce565b6040518082815260200191505060405180910390f35b34801561068a57600080fd5b506106cd600480360360208110156106a157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111eb565b005b3480156106db57600080fd5b50610728600480360360408110156106f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611202565b6040518082815260200191505060405180910390f35b34801561074a57600080fd5b506107776004803603602081101561076157600080fd5b81019080803590602001909291905050506112d4565b6040518082815260200191505060405180910390f35b34801561079957600080fd5b506107c6600480360360208110156107b057600080fd5b81019080803590602001909291905050506112f1565b6040518082815260200191505060405180910390f35b3480156107e857600080fd5b50610835600480360360408110156107ff57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061130e565b604051808215151515815260200191505060405180910390f35b34801561085b57600080fd5b506108926004803603604081101561087257600080fd5b8101908080359060200190929190803590602001909291905050506113e0565b6040518082600560200280838360005b838110156108bd5780820151818401526020810190506108a2565b5050505090500191505060405180910390f35b3480156108dc57600080fd5b5061091f600480360360208110156108f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611406565b6040518082815260200191505060405180910390f35b34801561094157600080fd5b506109846004803603602081101561095857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114cf565b604051808381526020018281526020019250505060405180910390f35b3480156109ad57600080fd5b506109e4600480360360408110156109c457600080fd5b8101908080359060200190929190803590602001909291905050506114ef565b6040518082815260200191505060405180910390f35b348015610a0657600080fd5b50610a3d60048036036040811015610a1d57600080fd5b81019080803590602001909291908035906020019092919050505061150f565b6040518082815260200191505060405180910390f35b348015610a5f57600080fd5b50610a9660048036036040811015610a7657600080fd5b81019080803590602001909291908035906020019092919050505061152f565b6040518082815260200191505060405180910390f35b348015610ab857600080fd5b50610b0560048036036040811015610acf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061154f565b604051808215151515815260200191505060405180910390f35b348015610b2b57600080fd5b50610b34611621565b6040518087815260200186815260200185815260200180602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b83811015610b92578082015181840152602081019050610b77565b50505050905090810190601f168015610bbf5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b348015610bde57600080fd5b50610c2b60048036036040811015610bf557600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611649565b604051808215151515815260200191505060405180910390f35b348015610c5157600080fd5b50610c7e60048036036020811015610c6857600080fd5b8101908080359060200190929190505050611669565b604051808a81526020018915151515815260200188151515158152602001871515151581526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183600960200280838360005b83811015610d63578082015181840152602081019050610d48565b50505050905001828152602001995050505050505050505060405180910390f35b348015610d9057600080fd5b50610d996116b1565b6040518082603360200280838360005b83811015610dc4578082015181840152602081019050610da9565b5050505090500191505060405180910390f35b348015610de357600080fd5b50610e1a60048036036040811015610dfa57600080fd5b8101908080359060200190929190803590602001909291905050506116c8565b6040518082815260200191505060405180910390f35b348015610e3c57600080fd5b50610e6960048036036020811015610e5357600080fd5b81019080803590602001909291905050506116e8565b6040518082815260200191505060405180910390f35b348015610e8b57600080fd5b50610eee60048036036040811015610ea257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611705565b6040518082815260200191505060405180910390f35b348015610f1057600080fd5b50610f4760048036036040811015610f2757600080fd5b810190808035906020019092919080359060200190929190505050611803565b6040518082815260200191505060405180910390f35b348015610f6957600080fd5b50610f9660048036036020811015610f8057600080fd5b8101908080359060200190929190505050611823565b604051808060200180602001878152602001868152602001858152602001848152602001838103835289818151815260200191508051906020019080838360005b83811015610ff2578082015181840152602081019050610fd7565b50505050905090810190601f16801561101f5780820380516001836020036101000a031916815260200191505b50838103825288818151815260200191508051906020019080838360005b8381101561105857808201518184015260208101905061103d565b50505050905090810190601f1680156110855780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390f35b3480156110a557600080fd5b506110ae611855565b60405180838152602001821515151581526020019250505060405180910390f35b6110e381600061186a90919063ffffffff16565b50565b60006110fc826000611a6590919063ffffffff16565b9050919050565b61110b612e21565b61112183836000611a859092919063ffffffff16565b905092915050565b600061113f826000611afb90919063ffffffff16565b9050919050565b60006111526000611b3b565b905090565b60008060606111666000611b8f565b925092509250909192565b6000611187826000611cc390919063ffffffff16565b9050919050565b6000806111a5836000611ce390919063ffffffff16565b91509150915091565b60006111c683836000611d5b9092919063ffffffff16565b905092915050565b60006111e4826000611d9d90919063ffffffff16565b9050919050565b6111ff816000611dc390919063ffffffff16565b50565b6000807393dbc20622631e3f819a7ab996ccf68326cc21e9637f0ee307909185856040518463ffffffff1660e01b8152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b15801561129157600080fd5b505af41580156112a5573d6000803e3d6000fd5b505050506040513d60208110156112bb57600080fd5b8101908080519060200190929190505050905092915050565b60006112ea826000611f5b90919063ffffffff16565b9050919050565b6000611307826000611f7b90919063ffffffff16565b9050919050565b6000807363a8488900d1dce6878c4ac9c2ea6cf7da7f212b633e0e4206909185856040518463ffffffff1660e01b8152600401808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060206040518083038186803b15801561139d57600080fd5b505af41580156113b1573d6000803e3d6000fd5b505050506040513d60208110156113c757600080fd5b8101908080519060200190929190505050905092915050565b6113e8612e43565b6113fe838360006120129092919063ffffffff16565b905092915050565b6000807393dbc20622631e3f819a7ab996ccf68326cc21e96317408d579091846040518363ffffffff1660e01b8152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561148d57600080fd5b505af41580156114a1573d6000803e3d6000fd5b505050506040513d60208110156114b757600080fd5b81019080805190602001909291905050509050919050565b6000806114e68360006120be90919063ffffffff16565b91509150915091565b6000611507838360006121569092919063ffffffff16565b905092915050565b60006115278383600061218f9092919063ffffffff16565b905092915050565b6000611547838360006121c49092919063ffffffff16565b905092915050565b6000807393dbc20622631e3f819a7ab996ccf68326cc21e9633dba7659909185856040518463ffffffff1660e01b8152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060206040518083038186803b1580156115de57600080fd5b505af41580156115f2573d6000803e3d6000fd5b505050506040513d602081101561160857600080fd5b8101908080519060200190929190505050905092915050565b6000806000606060008061163560006121f9565b955095509550955095509550909192939495565b6000611661838360006125039092919063ffffffff16565b905092915050565b600080600080600080600061167c612e65565b60006116928a600061257190919063ffffffff16565b9850985098509850985098509850985098509193959799909294969850565b6116b9612e88565b6116c36000612947565b905090565b60006116e0838360006129969092919063ffffffff16565b905092915050565b60006116fe8260006129cb90919063ffffffff16565b9050919050565b6000807393dbc20622631e3f819a7ab996ccf68326cc21e9632826ac83909185856040518463ffffffff1660e01b8152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060206040518083038186803b1580156117c057600080fd5b505af41580156117d4573d6000803e3d6000fd5b505050506040513d60208110156117ea57600080fd5b8101908080519060200190929190505050905092915050565b600061181b838360006129eb9092919063ffffffff16565b905092915050565b606080600080600080611840876000612a2090919063ffffffff16565b95509550955095509550955091939550919395565b6000806118626000612c7f565b915091509091565b3373ffffffffffffffffffffffffffffffffffffffff1682603f01600060405180807f5f6465697479000000000000000000000000000000000000000000000000000081525060060190506040518091039020815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611975576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53656e646572206973206e6f742064656974790000000000000000000000000081525060200191505060405180910390fd5b8082603f01600060405180807f6265727279436f6e747261637400000000000000000000000000000000000000815250600d0190506040518091039020815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507ffa6e3b024b379dfb1c03221aab2ead93a3b6cf5dc541bfc336ede1a1c0e1392381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15050565b600082604201600083815260200190815260200160002054905092915050565b611a8d612e21565b8360480160008481526020019081526020016000206009016000838152602001908152602001600020600580602002604051908101604052809291908260058015611aed576020028201915b815481526020019060010190808311611ad9575b505050505090509392505050565b600082603f01600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b600081604001600060405180807f746f74616c5f737570706c790000000000000000000000000000000000000000815250600c01905060405180910390208152602001908152602001600020549050919050565b60008060606000611b9f85612d41565b905080856048016000838152602001908152602001600020600401600060405180807f746f74616c54697000000000000000000000000000000000000000000000000081525060080190506040518091039020815260200190815260200160002054866048016000848152602001908152602001600020600001808054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611cae5780601f10611c8357610100808354040283529160200191611cae565b820191906000526020600020905b815481529060010190602001808311611c9157829003601f168201915b50505050509050935093509350509193909250565b600082604901600083815260200190815260200160002054905092915050565b600080600084604801600085815260200190815260200160002090506000816003018054905014611d4857611d3c858583600301600185600301805490500381548110611d2c57fe5b90600052602060002001546121c4565b60019250925050611d54565b60008081915092509250505b9250929050565b6000836048016000848152602001908152602001600020600701600083815260200190815260200160002060009054906101000a900460ff1690509392505050565b600082604801600083815260200190815260200160002060030180549050905092915050565b3373ffffffffffffffffffffffffffffffffffffffff1682603f01600060405180807f5f6465697479000000000000000000000000000000000000000000000000000081525060060190506040518091039020815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611ece576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53656e646572206973206e6f742064656974790000000000000000000000000081525060200191505060405180910390fd5b8082603f01600060405180807f5f6465697479000000000000000000000000000000000000000000000000000081525060060190506040518091039020815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600082604001600083815260200190815260200160002054905092915050565b60006032821115611ff4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f526571756573745120696e6465782069732061626f766520353000000000000081525060200191505060405180910390fd5b82604301600083815260200190815260200160002054905092915050565b61201a612e43565b83604801600084815260200190815260200160002060080160008381526020019081526020016000206005806020026040519081016040528092919082600580156120b0576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612066575b505050505090509392505050565b6000808360470160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548460470160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154915091509250929050565b6000836048016000848152602001908152602001600020600301828154811061217b57fe5b906000526020600020015490509392505050565b600083604401600084815260200190815260200160002060050160008381526020019081526020016000205490509392505050565b600083604801600084815260200190815260200160002060060160008381526020019081526020016000205490509392505050565b60008060006060600080866000015487604001600060405180807f63757272656e74526571756573744964000000000000000000000000000000008152506010019050604051809103902081526020019081526020016000205488604001600060405180807f646966666963756c747900000000000000000000000000000000000000000000815250600a01905060405180910390208152602001908152602001600020548960480160008b604001600060405180807f63757272656e74526571756573744964000000000000000000000000000000008152506010019050604051809103902081526020019081526020016000205481526020019081526020016000206000018a60480160008c604001600060405180807f63757272656e7452657175657374496400000000000000000000000000000000815250601001905060405180910390208152602001908152602001600020548152602001908152602001600020600401600060405180807f6772616e756c6172697479000000000000000000000000000000000000000000815250600b01905060405180910390208152602001908152602001600020548b60480160008d604001600060405180807f63757272656e7452657175657374496400000000000000000000000000000000815250601001905060405180910390208152602001908152602001600020548152602001908152602001600020600401600060405180807f746f74616c54697000000000000000000000000000000000000000000000000081525060080190506040518091039020815260200190815260200160002054828054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156124e75780601f106124bc576101008083540402835291602001916124e7565b820191906000526020600020905b8154815290600101906020018083116124ca57829003601f168201915b5050505050925095509550955095509550955091939550919395565b600083604401600084815260200190815260200160002060060160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1690509392505050565b6000806000806000806000612584612e65565b6000808b60440160008c8152602001908152602001600020905080600001548160020160009054906101000a900460ff168260020160019054906101000a900460ff168360020160029054906101000a900460ff168460020160039054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405180610120016040528089600501600060405180807f726571756573744964000000000000000000000000000000000000000000000081525060090190506040518091039020815260200190815260200160002054815260200189600501600060405180807f74696d657374616d70000000000000000000000000000000000000000000000081525060090190506040518091039020815260200190815260200160002054815260200189600501600060405180807f76616c756500000000000000000000000000000000000000000000000000000081525060050190506040518091039020815260200190815260200160002054815260200189600501600060405180807f6d696e457865637574696f6e446174650000000000000000000000000000000081525060100190506040518091039020815260200190815260200160002054815260200189600501600060405180807f6e756d6265724f66566f74657300000000000000000000000000000000000000815250600d0190506040518091039020815260200190815260200160002054815260200189600501600060405180807f626c6f636b4e756d626572000000000000000000000000000000000000000000815250600b0190506040518091039020815260200190815260200160002054815260200189600501600060405180807f6d696e6572536c6f74000000000000000000000000000000000000000000000081525060090190506040518091039020815260200190815260200160002054815260200189600501600060405180807f71756f72756d000000000000000000000000000000000000000000000000000081525060060190506040518091039020815260200190815260200160002054815260200189600501600060405180807f6665650000000000000000000000000000000000000000000000000000000000815250600301905060405180910390208152602001908152602001600020548152508860010154995099509950995099509950995099509950509295985092959850929598565b61294f612e88565b8160010160338060200260405190810160405280929190826033801561298a576020028201915b815481526020019060010190808311612976575b50505050509050919050565b600083604801600084815260200190815260200160002060050160008381526020019081526020016000205490509392505050565b600082604a01600083815260200190815260200160002054905092915050565b600083604801600084815260200190815260200160002060040160008381526020019081526020016000205490509392505050565b606080600080600080600088604801600089815260200190815260200160002090508060000181600101826002015483600401600060405180807f6772616e756c6172697479000000000000000000000000000000000000000000815250600b019050604051809103902081526020019081526020016000205484600401600060405180807f7265717565737451506f736974696f6e000000000000000000000000000000008152506010019050604051809103902081526020019081526020016000205485600401600060405180807f746f74616c54697000000000000000000000000000000000000000000000000081525060080190506040518091039020815260200190815260200160002054858054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612bc55780601f10612b9a57610100808354040283529160200191612bc5565b820191906000526020600020905b815481529060010190602001808311612ba857829003601f168201915b50505050509550848054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612c615780601f10612c3657610100808354040283529160200191612c61565b820191906000526020600020905b815481529060010190602001808311612c4457829003601f168201915b50505050509450965096509650965096509650509295509295509295565b600080612d368384604201600086604001600060405180807f74696d654f664c6173744e657756616c756500000000000000000000000000008152506012019050604051809103902081526020019081526020016000205481526020019081526020016000205485604001600060405180807f74696d654f664c6173744e657756616c75650000000000000000000000000000815250601201905060405180910390208152602001908152602001600020546121c4565b600191509150915091565b6000806000612d8e84600101603380602002604051908101604052809291908260338015612d84576020028201915b815481526020019060010190808311612d70575b5050505050612db5565b80925081935050508360430160008281526020019081526020016000205492505050919050565b60008060019050828160338110612dc857fe5b602002015191506000600290505b6033811015612e1b5782848260338110612dec57fe5b60200201511115612e0e57838160338110612e0357fe5b602002015192508091505b8080600101915050612dd6565b50915091565b6040518060a00160405280600590602082028038833980820191505090505090565b6040518060a00160405280600590602082028038833980820191505090505090565b604051806101200160405280600990602082028038833980820191505090505090565b60405180610660016040528060339060208202803883398082019150509050509056fea265627a7a72315820a8aefd1a7545ca68e6931193f74287851ad6ae4ab288ee3168887d9aa238968764736f6c6343000510003200000000000000000000000089c0be3d87e0f28073390e997527d765f9384ed4

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000089c0be3d87e0f28073390e997527d765f9384ed4

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000089c0be3d87e0f28073390e997527d765f9384ed4


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.