Contract
0xD9157453E2668B2fc45b7A803D3FEF3642430cC0
10
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
View more zero value Internal Transactions in Advanced View mode
Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x15e6Cc0D69A162151Cadfba035aa10b82b12b970
Contract Name:
TellorFlex
Compiler Version
v0.8.3+commit.8d00100c
Optimization Enabled:
Yes with 300 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "./interfaces/IERC20.sol"; /** @author Tellor Inc. @title TellorFlex @dev This is a streamlined Tellor oracle system which handles staking, reporting, * slashing, and user data getters in one contract. This contract is controlled * by a single address known as 'governance', which could be an externally owned * account or a contract, allowing for a flexible, modular design. */ contract TellorFlex { // Storage IERC20 public token; // token used for staking and rewards address public governance; // address with ability to remove values and slash reporters address public owner; // contract deployer, can call init function once uint256 public accumulatedRewardPerShare; // accumulated staking reward per staked token uint256 public minimumStakeAmount; // minimum amount of tokens required to stake uint256 public reportingLock; // base amount of time before a reporter is able to submit a value again uint256 public rewardRate; // total staking rewards released per second uint256 public stakeAmount; // minimum amount required to be a staker uint256 public stakeAmountDollarTarget; // amount of US dollars required to be a staker uint256 public stakingRewardsBalance; // total amount of staking rewards bytes32 public stakingTokenPriceQueryId; // staking token SpotPrice queryId, used for updating stakeAmount uint256 public timeBasedReward = 5e17; // amount of TB rewards released per 5 minutes uint256 public timeOfLastAllocation; // time of last update to accumulatedRewardPerShare uint256 public timeOfLastNewValue = block.timestamp; // time of the last new submitted value, originally set to the block timestamp uint256 public totalRewardDebt; // staking reward debt, used to calculate real staking rewards balance uint256 public totalStakeAmount; // total amount of tokens locked in contract (via stake) uint256 public totalStakers; // total number of stakers with at least stakeAmount staked, not exact uint256 public toWithdraw; //amountLockedForWithdrawal mapping(bytes32 => Report) private reports; // mapping of query IDs to a report mapping(address => StakeInfo) private stakerDetails; // mapping from a persons address to their staking info // Structs struct Report { uint256[] timestamps; // array of all newValueTimestamps reported mapping(uint256 => uint256) timestampIndex; // mapping of timestamps to respective indices mapping(uint256 => uint256) timestampToBlockNum; // mapping of timestamp to block number mapping(uint256 => bytes) valueByTimestamp; // mapping of timestamps to values mapping(uint256 => address) reporterByTimestamp; // mapping of timestamps to reporters mapping(uint256 => bool) isDisputed; } struct StakeInfo { uint256 startDate; // stake or withdrawal request start date uint256 stakedBalance; // staked token balance uint256 lockedBalance; // amount locked for withdrawal uint256 rewardDebt; // used for staking reward calculation uint256 reporterLastTimestamp; // timestamp of reporter's last reported value uint256 reportsSubmitted; // total number of reports submitted by reporter uint256 startVoteCount; // total number of governance votes when stake deposited uint256 startVoteTally; // staker vote tally when stake deposited bool staked; // used to keep track of total stakers mapping(bytes32 => uint256) reportsSubmittedByQueryId; // mapping of queryId to number of reports submitted by reporter } // Events event NewReport( bytes32 indexed _queryId, uint256 indexed _time, bytes _value, uint256 _nonce, bytes _queryData, address indexed _reporter ); event NewStakeAmount(uint256 _newStakeAmount); event NewStaker(address indexed _staker, uint256 indexed _amount); event ReporterSlashed( address indexed _reporter, address _recipient, uint256 _slashAmount ); event StakeWithdrawn(address _staker); event StakeWithdrawRequested(address _staker, uint256 _amount); event ValueRemoved(bytes32 _queryId, uint256 _timestamp); // Functions /** * @dev Initializes system parameters * @param _token address of token used for staking and rewards * @param _reportingLock base amount of time (seconds) before reporter is able to report again * @param _stakeAmountDollarTarget fixed USD amount that stakeAmount targets on updateStakeAmount * @param _stakingTokenPrice current price of staking token in USD (18 decimals) * @param _stakingTokenPriceQueryId queryId where staking token price is reported */ constructor( address _token, uint256 _reportingLock, uint256 _stakeAmountDollarTarget, uint256 _stakingTokenPrice, uint256 _minimumStakeAmount, bytes32 _stakingTokenPriceQueryId ) { require(_token != address(0), "must set token address"); require(_stakingTokenPrice > 0, "must set staking token price"); require(_reportingLock > 0, "must set reporting lock"); require(_stakingTokenPriceQueryId != bytes32(0), "must set staking token price queryId"); token = IERC20(_token); owner = msg.sender; reportingLock = _reportingLock; stakeAmountDollarTarget = _stakeAmountDollarTarget; minimumStakeAmount = _minimumStakeAmount; uint256 _potentialStakeAmount = (_stakeAmountDollarTarget * 1e18) / _stakingTokenPrice; if(_potentialStakeAmount < _minimumStakeAmount) { stakeAmount = _minimumStakeAmount; } else { stakeAmount = _potentialStakeAmount; } stakingTokenPriceQueryId = _stakingTokenPriceQueryId; } /** * @dev Allows the owner to initialize the governance (flex addy needed for governance deployment) * @param _governanceAddress address of governance contract (github.com/tellor-io/governance) */ function init(address _governanceAddress) external { require(msg.sender == owner, "only owner can set governance address"); require(governance == address(0), "governance address already set"); require( _governanceAddress != address(0), "governance address can't be zero address" ); governance = _governanceAddress; } /** * @dev Funds the Flex contract with staking rewards (paid by autopay and minting) * @param _amount amount of tokens to fund contract with */ function addStakingRewards(uint256 _amount) external { require(token.transferFrom(msg.sender, address(this), _amount)); _updateRewards(); stakingRewardsBalance += _amount; // update reward rate = real staking rewards balance / 30 days rewardRate = (stakingRewardsBalance - ((accumulatedRewardPerShare * totalStakeAmount) / 1e18 - totalRewardDebt)) / 30 days; } /** * @dev Allows a reporter to submit stake * @param _amount amount of tokens to stake */ function depositStake(uint256 _amount) external { require(governance != address(0), "governance address not set"); StakeInfo storage _staker = stakerDetails[msg.sender]; uint256 _stakedBalance = _staker.stakedBalance; uint256 _lockedBalance = _staker.lockedBalance; if (_lockedBalance > 0) { if (_lockedBalance >= _amount) { // if staker's locked balance covers full _amount, use that _staker.lockedBalance -= _amount; toWithdraw -= _amount; } else { // otherwise, stake the whole locked balance and transfer the // remaining amount from the staker's address require( token.transferFrom( msg.sender, address(this), _amount - _lockedBalance ) ); toWithdraw -= _staker.lockedBalance; _staker.lockedBalance = 0; } } else { if (_stakedBalance == 0) { // if staked balance and locked balance equal 0, save current vote tally. // voting participation used for calculating rewards (bool _success, bytes memory _returnData) = governance.call( abi.encodeWithSignature("getVoteCount()") ); if (_success) { _staker.startVoteCount = uint256(abi.decode(_returnData, (uint256))); } (_success,_returnData) = governance.call( abi.encodeWithSignature("getVoteTallyByAddress(address)",msg.sender) ); if(_success){ _staker.startVoteTally = abi.decode(_returnData,(uint256)); } } require(token.transferFrom(msg.sender, address(this), _amount)); } _updateStakeAndPayRewards(msg.sender, _stakedBalance + _amount); _staker.startDate = block.timestamp; // This resets the staker start date to now emit NewStaker(msg.sender, _amount); } /** * @dev Removes a value from the oracle. * Note: this function is only callable by the Governance contract. * @param _queryId is ID of the specific data feed * @param _timestamp is the timestamp of the data value to remove */ function removeValue(bytes32 _queryId, uint256 _timestamp) external { require(msg.sender == governance, "caller must be governance address"); Report storage _report = reports[_queryId]; require(!_report.isDisputed[_timestamp], "value already disputed"); uint256 _index = _report.timestampIndex[_timestamp]; require(_timestamp == _report.timestamps[_index], "invalid timestamp"); _report.valueByTimestamp[_timestamp] = ""; _report.isDisputed[_timestamp] = true; emit ValueRemoved(_queryId, _timestamp); } /** * @dev Allows a reporter to request to withdraw their stake * @param _amount amount of staked tokens requesting to withdraw */ function requestStakingWithdraw(uint256 _amount) external { StakeInfo storage _staker = stakerDetails[msg.sender]; require( _staker.stakedBalance >= _amount, "insufficient staked balance" ); _updateStakeAndPayRewards(msg.sender, _staker.stakedBalance - _amount); _staker.startDate = block.timestamp; _staker.lockedBalance += _amount; toWithdraw += _amount; emit StakeWithdrawRequested(msg.sender, _amount); } /** * @dev Slashes a reporter and transfers their stake amount to the given recipient * Note: this function is only callable by the governance address. * @param _reporter is the address of the reporter being slashed * @param _recipient is the address receiving the reporter's stake * @return _slashAmount uint256 amount of token slashed and sent to recipient address */ function slashReporter(address _reporter, address _recipient) external returns (uint256 _slashAmount) { require(msg.sender == governance, "only governance can slash reporter"); StakeInfo storage _staker = stakerDetails[_reporter]; uint256 _stakedBalance = _staker.stakedBalance; uint256 _lockedBalance = _staker.lockedBalance; require(_stakedBalance + _lockedBalance > 0, "zero staker balance"); if (_lockedBalance >= stakeAmount) { // if locked balance is at least stakeAmount, slash from locked balance _slashAmount = stakeAmount; _staker.lockedBalance -= stakeAmount; toWithdraw -= stakeAmount; } else if (_lockedBalance + _stakedBalance >= stakeAmount) { // if locked balance + staked balance is at least stakeAmount, // slash from locked balance and slash remainder from staked balance _slashAmount = stakeAmount; _updateStakeAndPayRewards( _reporter, _stakedBalance - (stakeAmount - _lockedBalance) ); toWithdraw -= _lockedBalance; _staker.lockedBalance = 0; } else { // if sum(locked balance + staked balance) is less than stakeAmount, // slash sum _slashAmount = _stakedBalance + _lockedBalance; toWithdraw -= _lockedBalance; _updateStakeAndPayRewards(_reporter, 0); _staker.lockedBalance = 0; } require(token.transfer(_recipient, _slashAmount)); emit ReporterSlashed(_reporter, _recipient, _slashAmount); } /** * @dev Allows a reporter to submit a value to the oracle * @param _queryId is ID of the specific data feed. Equals keccak256(_queryData) for non-legacy IDs * @param _value is the value the user submits to the oracle * @param _nonce is the current value count for the query id * @param _queryData is the data used to fulfill the data query */ function submitValue( bytes32 _queryId, bytes calldata _value, uint256 _nonce, bytes calldata _queryData ) external { require(keccak256(_value) != keccak256(""), "value must be submitted"); Report storage _report = reports[_queryId]; require( _nonce == _report.timestamps.length || _nonce == 0, "nonce must match timestamp index" ); StakeInfo storage _staker = stakerDetails[msg.sender]; require( _staker.stakedBalance >= stakeAmount, "balance must be greater than stake amount" ); // Require reporter to abide by given reporting lock require( (block.timestamp - _staker.reporterLastTimestamp) * 1000 > (reportingLock * 1000) / (_staker.stakedBalance / stakeAmount), "still in reporter time lock, please wait!" ); require( _queryId == keccak256(_queryData), "query id must be hash of query data" ); _staker.reporterLastTimestamp = block.timestamp; // Checks for no double reporting of timestamps require( _report.reporterByTimestamp[block.timestamp] == address(0), "timestamp already reported for" ); // Update number of timestamps, value for given timestamp, and reporter for timestamp _report.timestampIndex[block.timestamp] = _report.timestamps.length; _report.timestamps.push(block.timestamp); _report.timestampToBlockNum[block.timestamp] = block.number; _report.valueByTimestamp[block.timestamp] = _value; _report.reporterByTimestamp[block.timestamp] = msg.sender; // Disperse Time Based Reward uint256 _reward = ((block.timestamp - timeOfLastNewValue) * timeBasedReward) / 300; //.5 TRB per 5 minutes uint256 _totalTimeBasedRewardsBalance = token.balanceOf(address(this)) - (totalStakeAmount + stakingRewardsBalance + toWithdraw); if (_totalTimeBasedRewardsBalance > 0 && _reward > 0) { if (_totalTimeBasedRewardsBalance < _reward) { token.transfer(msg.sender, _totalTimeBasedRewardsBalance); } else { token.transfer(msg.sender, _reward); } } // Update last oracle value and number of values submitted by a reporter timeOfLastNewValue = block.timestamp; _staker.reportsSubmitted++; _staker.reportsSubmittedByQueryId[_queryId]++; emit NewReport( _queryId, block.timestamp, _value, _nonce, _queryData, msg.sender ); } /** * @dev Updates the stake amount after retrieving the latest * 12+-hour-old staking token price from the oracle */ function updateStakeAmount() external { // get staking token price (bool _valFound, bytes memory _val, ) = getDataBefore( stakingTokenPriceQueryId, block.timestamp - 12 hours ); if (_valFound) { uint256 _stakingTokenPrice = abi.decode(_val, (uint256)); require( _stakingTokenPrice >= 0.01 ether && _stakingTokenPrice < 1000000 ether, "invalid staking token price" ); uint256 _adjustedStakeAmount = (stakeAmountDollarTarget * 1e18) / _stakingTokenPrice; if(_adjustedStakeAmount < minimumStakeAmount) { stakeAmount = minimumStakeAmount; } else { stakeAmount = _adjustedStakeAmount; } emit NewStakeAmount(stakeAmount); } } /** * @dev Withdraws a reporter's stake after the lock period expires */ function withdrawStake() external { StakeInfo storage _staker = stakerDetails[msg.sender]; // Ensure reporter is locked and that enough time has passed require( block.timestamp - _staker.startDate >= 7 days, "7 days didn't pass" ); require( _staker.lockedBalance > 0, "reporter not locked for withdrawal" ); require(token.transfer(msg.sender, _staker.lockedBalance)); toWithdraw -= _staker.lockedBalance; _staker.lockedBalance = 0; emit StakeWithdrawn(msg.sender); } // ***************************************************************************** // * * // * Getters * // * * // ***************************************************************************** /** * @dev Returns the block number at a given timestamp * @param _queryId is ID of the specific data feed * @param _timestamp is the timestamp to find the corresponding block number for * @return uint256 block number of the timestamp for the given data ID */ function getBlockNumberByTimestamp(bytes32 _queryId, uint256 _timestamp) external view returns (uint256) { return reports[_queryId].timestampToBlockNum[_timestamp]; } /** * @dev Returns the current value of a data feed given a specific ID * @param _queryId is the ID of the specific data feed * @return _value the latest submitted value for the given queryId */ function getCurrentValue(bytes32 _queryId) external view returns (bytes memory _value) { bool _didGet; (_didGet, _value, ) = getDataBefore(_queryId, block.timestamp + 1); if(!_didGet){revert();} } /** * @dev Retrieves the latest value for the queryId before the specified timestamp * @param _queryId is the queryId to look up the value for * @param _timestamp before which to search for latest value * @return _ifRetrieve bool true if able to retrieve a non-zero value * @return _value the value retrieved * @return _timestampRetrieved the value's timestamp */ function getDataBefore(bytes32 _queryId, uint256 _timestamp) public view returns ( bool _ifRetrieve, bytes memory _value, uint256 _timestampRetrieved ) { (bool _found, uint256 _index) = getIndexForDataBefore( _queryId, _timestamp ); if (!_found) return (false, bytes(""), 0); _timestampRetrieved = getTimestampbyQueryIdandIndex(_queryId, _index); _value = retrieveData(_queryId, _timestampRetrieved); return (true, _value, _timestampRetrieved); } /** * @dev Returns governance address * @return address governance */ function getGovernanceAddress() external view returns (address) { return governance; } /** * @dev Counts the number of values that have been submitted for the request. * @param _queryId the id to look up * @return uint256 count of the number of values received for the id */ function getNewValueCountbyQueryId(bytes32 _queryId) public view returns (uint256) { return reports[_queryId].timestamps.length; } /** * @dev Returns the pending staking reward for a given address * @param _stakerAddress staker address to look up * @return _pendingReward - pending reward for given staker */ function getPendingRewardByStaker(address _stakerAddress) external returns (uint256 _pendingReward) { StakeInfo storage _staker = stakerDetails[_stakerAddress]; _pendingReward = (_staker.stakedBalance * _getUpdatedAccumulatedRewardPerShare()) / 1e18 - _staker.rewardDebt; (bool _success, bytes memory _returnData) = governance.call( abi.encodeWithSignature("getVoteCount()") ); uint256 _numberOfVotes; if (_success) { _numberOfVotes = uint256(abi.decode(_returnData, (uint256))) - _staker.startVoteCount; } if (_numberOfVotes > 0) { (_success,_returnData) = governance.call( abi.encodeWithSignature("getVoteTallyByAddress(address)",_stakerAddress) ); if(_success){ _pendingReward = (_pendingReward * (abi.decode(_returnData,(uint256)) - _staker.startVoteTally)) / _numberOfVotes; } } } /** * @dev Returns the real staking rewards balance after accounting for unclaimed rewards * @return uint256 real staking rewards balance */ function getRealStakingRewardsBalance() external view returns (uint256) { uint256 _pendingRewards = (_getUpdatedAccumulatedRewardPerShare() * totalStakeAmount) / 1e18 - totalRewardDebt; return (stakingRewardsBalance - _pendingRewards); } /** * @dev Returns reporter address and whether a value was removed for a given queryId and timestamp * @param _queryId the id to look up * @param _timestamp is the timestamp of the value to look up * @return address reporter who submitted the value * @return bool true if the value was removed */ function getReportDetails(bytes32 _queryId, uint256 _timestamp) external view returns (address, bool) { return (reports[_queryId].reporterByTimestamp[_timestamp], reports[_queryId].isDisputed[_timestamp]); } /** * @dev Returns the address of the reporter who submitted a value for a data ID at a specific time * @param _queryId is ID of the specific data feed * @param _timestamp is the timestamp to find a corresponding reporter for * @return address of the reporter who reported the value for the data ID at the given timestamp */ function getReporterByTimestamp(bytes32 _queryId, uint256 _timestamp) external view returns (address) { return reports[_queryId].reporterByTimestamp[_timestamp]; } /** * @dev Returns the timestamp of the reporter's last submission * @param _reporter is address of the reporter * @return uint256 timestamp of the reporter's last submission */ function getReporterLastTimestamp(address _reporter) external view returns (uint256) { return stakerDetails[_reporter].reporterLastTimestamp; } /** * @dev Returns the reporting lock time, the amount of time a reporter must wait to submit again * @return uint256 reporting lock time */ function getReportingLock() external view returns (uint256) { return reportingLock; } /** * @dev Returns the number of values submitted by a specific reporter address * @param _reporter is the address of a reporter * @return uint256 the number of values submitted by the given reporter */ function getReportsSubmittedByAddress(address _reporter) external view returns (uint256) { return stakerDetails[_reporter].reportsSubmitted; } /** * @dev Returns the number of values submitted to a specific queryId by a specific reporter address * @param _reporter is the address of a reporter * @param _queryId is the ID of the specific data feed * @return uint256 the number of values submitted by the given reporter to the given queryId */ function getReportsSubmittedByAddressAndQueryId( address _reporter, bytes32 _queryId ) external view returns (uint256) { return stakerDetails[_reporter].reportsSubmittedByQueryId[_queryId]; } /** * @dev Returns amount required to report oracle values * @return uint256 stake amount */ function getStakeAmount() external view returns (uint256) { return stakeAmount; } /** * @dev Returns all information about a staker * @param _stakerAddress address of staker inquiring about * @return uint startDate of staking * @return uint current amount staked * @return uint current amount locked for withdrawal * @return uint reward debt used to calculate staking rewards * @return uint reporter's last reported timestamp * @return uint total number of reports submitted by reporter * @return uint governance vote count when first staked * @return uint number of votes cast by staker when first staked * @return bool whether staker is counted in totalStakers */ function getStakerInfo(address _stakerAddress) external view returns ( uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool ) { StakeInfo storage _staker = stakerDetails[_stakerAddress]; return ( _staker.startDate, _staker.stakedBalance, _staker.lockedBalance, _staker.rewardDebt, _staker.reporterLastTimestamp, _staker.reportsSubmitted, _staker.startVoteCount, _staker.startVoteTally, _staker.staked ); } /** * @dev Returns the timestamp for the last value of any ID from the oracle * @return uint256 timestamp of the last oracle value */ function getTimeOfLastNewValue() external view returns (uint256) { return timeOfLastNewValue; } /** * @dev Gets the timestamp for the value based on their index * @param _queryId is the id to look up * @param _index is the value index to look up * @return uint256 timestamp */ function getTimestampbyQueryIdandIndex(bytes32 _queryId, uint256 _index) public view returns (uint256) { return reports[_queryId].timestamps[_index]; } /** * @dev Retrieves latest array index of data before the specified timestamp for the queryId * @param _queryId is the queryId to look up the index for * @param _timestamp is the timestamp before which to search for the latest index * @return _found whether the index was found * @return _index the latest index found before the specified timestamp */ // slither-disable-next-line calls-loop function getIndexForDataBefore(bytes32 _queryId, uint256 _timestamp) public view returns (bool _found, uint256 _index) { uint256 _count = getNewValueCountbyQueryId(_queryId); if (_count > 0) { uint256 _middle; uint256 _start = 0; uint256 _end = _count - 1; uint256 _time; //Checking Boundaries to short-circuit the algorithm _time = getTimestampbyQueryIdandIndex(_queryId, _start); if (_time >= _timestamp) return (false, 0); _time = getTimestampbyQueryIdandIndex(_queryId, _end); if (_time < _timestamp) { while(isInDispute(_queryId, _time) && _end > 0) { _end--; _time = getTimestampbyQueryIdandIndex(_queryId, _end); } if(_end == 0 && isInDispute(_queryId, _time)) { return (false, 0); } return (true, _end); } //Since the value is within our boundaries, do a binary search while (true) { _middle = (_end - _start) / 2 + 1 + _start; _time = getTimestampbyQueryIdandIndex(_queryId, _middle); if (_time < _timestamp) { //get immediate next value uint256 _nextTime = getTimestampbyQueryIdandIndex( _queryId, _middle + 1 ); if (_nextTime >= _timestamp) { if(!isInDispute(_queryId, _time)) { // _time is correct return (true, _middle); } else { // iterate backwards until we find a non-disputed value while(isInDispute(_queryId, _time) && _middle > 0) { _middle--; _time = getTimestampbyQueryIdandIndex(_queryId, _middle); } if(_middle == 0 && isInDispute(_queryId, _time)) { return (false, 0); } // _time is correct return (true, _middle); } } else { //look from middle + 1(next value) to end _start = _middle + 1; } } else { uint256 _prevTime = getTimestampbyQueryIdandIndex( _queryId, _middle - 1 ); if (_prevTime < _timestamp) { if(!isInDispute(_queryId, _prevTime)) { // _prevTime is correct return (true, _middle - 1); } else { // iterate backwards until we find a non-disputed value _middle--; while(isInDispute(_queryId, _prevTime) && _middle > 0) { _middle--; _prevTime = getTimestampbyQueryIdandIndex( _queryId, _middle ); } if(_middle == 0 && isInDispute(_queryId, _prevTime)) { return (false, 0); } // _prevtime is correct return (true, _middle); } } else { //look from start to middle -1(prev value) _end = _middle - 1; } } } } return (false, 0); } /** * @dev Returns the index of a reporter timestamp in the timestamp array for a specific data ID * @param _queryId is ID of the specific data feed * @param _timestamp is the timestamp to find in the timestamps array * @return uint256 of the index of the reporter timestamp in the array for specific ID */ function getTimestampIndexByTimestamp(bytes32 _queryId, uint256 _timestamp) external view returns (uint256) { return reports[_queryId].timestampIndex[_timestamp]; } /** * @dev Returns the address of the token used for staking * @return address of the token used for staking */ function getTokenAddress() external view returns (address) { return address(token); } /** * @dev Returns total amount of token staked for reporting * @return uint256 total amount of token staked */ function getTotalStakeAmount() external view returns (uint256) { return totalStakeAmount; } /** * @dev Returns total number of current stakers. Reporters with stakedBalance less than stakeAmount are excluded from this total * @return uint256 total stakers */ function getTotalStakers() external view returns (uint256) { return totalStakers; } /** * @dev Returns total balance of time based rewards in contract * @return uint256 amount of trb */ function getTotalTimeBasedRewardsBalance() external view returns (uint256) { return token.balanceOf(address(this)) - (totalStakeAmount + stakingRewardsBalance + toWithdraw); } /** * @dev Returns whether a given value is disputed * @param _queryId unique ID of the data feed * @param _timestamp timestamp of the value * @return bool whether the value is disputed */ function isInDispute(bytes32 _queryId, uint256 _timestamp) public view returns (bool) { return reports[_queryId].isDisputed[_timestamp]; } /** * @dev Retrieve value from oracle based on timestamp * @param _queryId being requested * @param _timestamp to retrieve data/value from * @return bytes value for timestamp submitted */ function retrieveData(bytes32 _queryId, uint256 _timestamp) public view returns (bytes memory) { return reports[_queryId].valueByTimestamp[_timestamp]; } /** * @dev Used during the upgrade process to verify valid Tellor contracts * @return bool value used to verify valid Tellor contracts */ function verify() external pure returns (uint256) { return 9999; } // ***************************************************************************** // * * // * Internal functions * // * * // ***************************************************************************** /** * @dev Updates accumulated staking rewards per staked token */ function _updateRewards() internal { if (timeOfLastAllocation == block.timestamp) { return; } if (totalStakeAmount == 0 || rewardRate == 0) { timeOfLastAllocation = block.timestamp; return; } // calculate accumulated reward per token staked uint256 _newAccumulatedRewardPerShare = accumulatedRewardPerShare + ((block.timestamp - timeOfLastAllocation) * rewardRate * 1e18) / totalStakeAmount; // calculate accumulated reward with _newAccumulatedRewardPerShare uint256 _accumulatedReward = (_newAccumulatedRewardPerShare * totalStakeAmount) / 1e18 - totalRewardDebt; if (_accumulatedReward >= stakingRewardsBalance) { // if staking rewards run out, calculate remaining reward per staked // token and set rewardRate to 0 uint256 _newPendingRewards = stakingRewardsBalance - ((accumulatedRewardPerShare * totalStakeAmount) / 1e18 - totalRewardDebt); accumulatedRewardPerShare += (_newPendingRewards * 1e18) / totalStakeAmount; rewardRate = 0; } else { accumulatedRewardPerShare = _newAccumulatedRewardPerShare; } timeOfLastAllocation = block.timestamp; } /** * @dev Called whenever a user's stake amount changes. First updates staking rewards, * transfers pending rewards to user's address, and finally updates user's stake amount * and other relevant variables. * @param _stakerAddress address of user whose stake is being updated * @param _newStakedBalance new staked balance of user */ function _updateStakeAndPayRewards( address _stakerAddress, uint256 _newStakedBalance ) internal { _updateRewards(); StakeInfo storage _staker = stakerDetails[_stakerAddress]; if (_staker.stakedBalance > 0) { // if address already has a staked balance, calculate and transfer pending rewards uint256 _pendingReward = (_staker.stakedBalance * accumulatedRewardPerShare) / 1e18 - _staker.rewardDebt; // get staker voting participation rate uint256 _numberOfVotes; (bool _success, bytes memory _returnData) = governance.call( abi.encodeWithSignature("getVoteCount()") ); if (_success) { _numberOfVotes = uint256(abi.decode(_returnData, (uint256))) - _staker.startVoteCount; } if (_numberOfVotes > 0) { // staking reward = pending reward * voting participation rate (_success, _returnData) = governance.call( abi.encodeWithSignature("getVoteTallyByAddress(address)",_stakerAddress) ); if(_success){ uint256 _voteTally = abi.decode(_returnData,(uint256)); uint256 _tempPendingReward = (_pendingReward * (_voteTally - _staker.startVoteTally)) / _numberOfVotes; if (_tempPendingReward < _pendingReward) { _pendingReward = _tempPendingReward; } } } stakingRewardsBalance -= _pendingReward; require(token.transfer(msg.sender, _pendingReward)); totalRewardDebt -= _staker.rewardDebt; totalStakeAmount -= _staker.stakedBalance; } _staker.stakedBalance = _newStakedBalance; // Update total stakers if (_staker.stakedBalance >= stakeAmount) { if (_staker.staked == false) { totalStakers++; } _staker.staked = true; } else { if (_staker.staked == true && totalStakers > 0) { totalStakers--; } _staker.staked = false; } // tracks rewards accumulated before stake amount updated _staker.rewardDebt = (_staker.stakedBalance * accumulatedRewardPerShare) / 1e18; totalRewardDebt += _staker.rewardDebt; totalStakeAmount += _staker.stakedBalance; // update reward rate if staking rewards are available // given staker's updated parameters if(rewardRate == 0) { rewardRate = (stakingRewardsBalance - ((accumulatedRewardPerShare * totalStakeAmount) / 1e18 - totalRewardDebt)) / 30 days; } } /** * @dev Internal function retrieves updated accumulatedRewardPerShare * @return uint256 up-to-date accumulated reward per share */ function _getUpdatedAccumulatedRewardPerShare() internal view returns (uint256) { if (totalStakeAmount == 0) { return accumulatedRewardPerShare; } uint256 _newAccumulatedRewardPerShare = accumulatedRewardPerShare + ((block.timestamp - timeOfLastAllocation) * rewardRate * 1e18) / totalStakeAmount; uint256 _accumulatedReward = (_newAccumulatedRewardPerShare * totalStakeAmount) / 1e18 - totalRewardDebt; if (_accumulatedReward >= stakingRewardsBalance) { uint256 _newPendingRewards = stakingRewardsBalance - ((accumulatedRewardPerShare * totalStakeAmount) / 1e18 - totalRewardDebt); _newAccumulatedRewardPerShare = accumulatedRewardPerShare + (_newPendingRewards * 1e18) / totalStakeAmount; } return _newAccumulatedRewardPerShare; } }
{ "optimizer": { "enabled": true, "runs": 300 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_reportingLock","type":"uint256"},{"internalType":"uint256","name":"_stakeAmountDollarTarget","type":"uint256"},{"internalType":"uint256","name":"_stakingTokenPrice","type":"uint256"},{"internalType":"uint256","name":"_minimumStakeAmount","type":"uint256"},{"internalType":"bytes32","name":"_stakingTokenPriceQueryId","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"_time","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"_value","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"_nonce","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"_queryData","type":"bytes"},{"indexed":true,"internalType":"address","name":"_reporter","type":"address"}],"name":"NewReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_newStakeAmount","type":"uint256"}],"name":"NewStakeAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_staker","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"NewStaker","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_reporter","type":"address"},{"indexed":false,"internalType":"address","name":"_recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"_slashAmount","type":"uint256"}],"name":"ReporterSlashed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"StakeWithdrawRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_staker","type":"address"}],"name":"StakeWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"ValueRemoved","type":"event"},{"inputs":[],"name":"accumulatedRewardPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"addStakingRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getBlockNumberByTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getCurrentValue","outputs":[{"internalType":"bytes","name":"_value","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getDataBefore","outputs":[{"internalType":"bool","name":"_ifRetrieve","type":"bool"},{"internalType":"bytes","name":"_value","type":"bytes"},{"internalType":"uint256","name":"_timestampRetrieved","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGovernanceAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getIndexForDataBefore","outputs":[{"internalType":"bool","name":"_found","type":"bool"},{"internalType":"uint256","name":"_index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getNewValueCountbyQueryId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stakerAddress","type":"address"}],"name":"getPendingRewardByStaker","outputs":[{"internalType":"uint256","name":"_pendingReward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getRealStakingRewardsBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getReportDetails","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getReporterByTimestamp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reporter","type":"address"}],"name":"getReporterLastTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReportingLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reporter","type":"address"}],"name":"getReportsSubmittedByAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reporter","type":"address"},{"internalType":"bytes32","name":"_queryId","type":"bytes32"}],"name":"getReportsSubmittedByAddressAndQueryId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stakerAddress","type":"address"}],"name":"getStakerInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimeOfLastNewValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"getTimestampIndexByTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getTimestampbyQueryIdandIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStakers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalTimeBasedRewardsBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_governanceAddress","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"isInDispute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"removeValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reportingLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"requestStakingWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"retrieveData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reporter","type":"address"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"slashReporter","outputs":[{"internalType":"uint256","name":"_slashAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeAmountDollarTarget","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingRewardsBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingTokenPriceQueryId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_queryId","type":"bytes32"},{"internalType":"bytes","name":"_value","type":"bytes"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"bytes","name":"_queryData","type":"bytes"}],"name":"submitValue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeBasedReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeOfLastAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeOfLastNewValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewardDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateStakeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"verify","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"withdrawStake","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526706f05b59d3b20000600b5542600d553480156200002157600080fd5b506040516200331438038062003314833981016040819052620000449162000223565b6001600160a01b038616620000a05760405162461bcd60e51b815260206004820152601660248201527f6d7573742073657420746f6b656e20616464726573730000000000000000000060448201526064015b60405180910390fd5b60008311620000f25760405162461bcd60e51b815260206004820152601c60248201527f6d75737420736574207374616b696e6720746f6b656e20707269636500000000604482015260640162000097565b60008511620001445760405162461bcd60e51b815260206004820152601760248201527f6d75737420736574207265706f7274696e67206c6f636b000000000000000000604482015260640162000097565b806200019f5760405162461bcd60e51b8152602060048201526024808201527f6d75737420736574207374616b696e6720746f6b656e207072696365207175656044820152631c9e525960e21b606482015260840162000097565b600080546001600160a01b0388166001600160a01b0319918216178255600280549091163317905560058690556008859055600483905583620001eb86670de0b6b3a7640000620002a3565b620001f7919062000282565b9050828110156200020d57600783905562000213565b60078190555b50600a5550620002cf9350505050565b60008060008060008060c087890312156200023c578182fd5b86516001600160a01b038116811462000253578283fd5b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b6000826200029e57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615620002ca57634e487b7160e01b81526011600452602481fd5b500290565b61303580620002df6000396000f3fe608060405234801561001057600080fd5b50600436106103575760003560e01c806373252494116101c8578063adf1639d11610104578063ce5e11bf116100a2578063d9c51cd41161007c578063d9c51cd4146107fe578063e07c548614610811578063fc0c546a14610849578063fc735e991461085c57610357565b8063ce5e11bf146107da578063cecb0647146107ed578063d75174e1146107f657610357565b8063c0d416b8116100de578063c0d416b8146107a3578063c0f95d52146107ac578063c5958af9146107b4578063cb82cc8f146107c757610357565b8063adf1639d14610768578063bed9d86114610788578063bf5745d61461079057610357565b80638929f4c61161017157806394409a561161014b57806394409a561461070557806396426d971461070e5780639d9b16ed14610717578063a792765f1461074657610357565b80638929f4c6146106b05780638da5cb5b146106c3578063935408d0146106d657610357565b80637b0a47ee116101a25780637b0a47ee1461069557806383bb38771461069e57806386989038146106a757610357565b806373252494146105b8578063733bdef0146105c957806377b03e0d1461067557610357565b80633a0ce342116102975780635b5edcfc116102405780636b036f451161021a5780636b036f45146105965780636dd0a70f1461059f5780636fd4f229146105a7578063722580b6146105b057610357565b80635b5edcfc146105675780635eaa9ced1461057a57806360c7dc471461058d57610357565b80634dfc2a34116102715780634dfc2a341461051557806350005b83146105285780635aa6e6751461055457610357565b80633a0ce342146104c357806344e87f91146104cb578063460c33a21461050d57610357565b80632b6696a7116103045780633321fc41116102de5780633321fc4114610495578063347f23361461049e57806336d42195146104a75780633878293e146104b057610357565b80632b6696a7146104195780632e206cd71461048457806331ed0db41461048d57610357565b806314c2a1bc1161033557806314c2a1bc146103d257806319ab453c146103da57806329449085146103ef57610357565b806304d932e21461035c57806310fe9ae81461037857806311938e0814610398575b600080fd5b61036560095481565b6040519081526020015b60405180910390f35b610380610864565b6040516001600160a01b03909116815260200161036f565b6103656103a6366004612cd1565b6001600160a01b0391909116600090815260136020908152604080832093835260099093019052205490565b600f54610365565b6103ed6103e8366004612c7e565b610874565b005b6104026103fd366004612db2565b6109c3565b60408051921515835260208301919091520161036f565b610465610427366004612db2565b6000918252601260209081526040808420928452600483018252808420546005909301909152909120546001600160a01b039091169160ff90911690565b604080516001600160a01b03909316835290151560208301520161036f565b610365600c5481565b601054610365565b61036560055481565b61036560115481565b61036560035481565b6103656104be366004612c7e565b610d15565b6103ed610d37565b6104fd6104d9366004612db2565b60009182526012602090815260408084209284526005909201905290205460ff1690565b604051901515815260200161036f565b600554610365565b610365610523366004612c9f565b610e5f565b610365610536366004612c7e565b6001600160a01b031660009081526013602052604090206004015490565b600154610380906001600160a01b031681565b6103ed610575366004612db2565b6110f0565b6103ed610588366004612d32565b6112c4565b61036560075481565b61036560045481565b6103656118af565b610365600d5481565b600754610365565b6001546001600160a01b0316610380565b61062f6105d7366004612c7e565b6001600160a01b0316600090815260136020526040902080546001820154600283015460038401546004850154600586015460068701546007880154600890980154969895979496939592949193909260ff90911690565b60408051998a5260208a0198909852968801959095526060870193909352608086019190915260a085015260c084015260e083015215156101008201526101200161036f565b610365610683366004612d1a565b60009081526012602052604090205490565b61036560065481565b610365600e5481565b61036560105481565b6103ed6106be366004612d1a565b6118fd565b600254610380906001600160a01b031681565b6103656106e4366004612db2565b60009182526012602090815260408084209284526002909201905290205490565b610365600f5481565b610365600b5481565b610365610725366004612db2565b60009182526012602090815260408084209284526001909201905290205490565b610759610754366004612db2565b6119e9565b60405161036f93929190612e6d565b61077b610776366004612d1a565b611a4c565b60405161036f9190612ed1565b6103ed611a74565b61036561079e366004612c7e565b611c21565b61036560085481565b600d54610365565b61077b6107c2366004612db2565b611e19565b6103ed6107d5366004612d1a565b611eca565b6103656107e8366004612db2565b61229b565b610365600a5481565b6103656122dc565b6103ed61080c366004612d1a565b612385565b61038061081f366004612db2565b6000918252601260209081526040808420928452600490920190529020546001600160a01b031690565b600054610380906001600160a01b031681565b61270f610365565b6000546001600160a01b03165b90565b6002546001600160a01b031633146108e15760405162461bcd60e51b815260206004820152602560248201527f6f6e6c79206f776e65722063616e2073657420676f7665726e616e6365206164604482015264647265737360d81b60648201526084015b60405180910390fd5b6001546001600160a01b03161561093a5760405162461bcd60e51b815260206004820152601e60248201527f676f7665726e616e6365206164647265737320616c726561647920736574000060448201526064016108d8565b6001600160a01b0381166109a15760405162461bcd60e51b815260206004820152602860248201527f676f7665726e616e636520616464726573732063616e2774206265207a65726f604482015267206164647265737360c01b60648201526084016108d8565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008281526012602052604081205481908015610d0557600080806109e9600185612f3b565b905060006109f7898461229b565b9050878110610a1157600080965096505050505050610d0e565b610a1b898361229b565b905087811015610ac5575b600089815260126020908152604080832084845260050190915290205460ff168015610a525750600082115b15610a755781610a6181612f82565b925050610a6e898361229b565b9050610a26565b81158015610a9f5750600089815260126020908152604080832084845260050190915290205460ff165b15610ab557600080965096505050505050610d0e565b50600195509350610d0e92505050565b826002610ad28285612f3b565b610adc9190612efc565b610ae7906001612ee4565b610af19190612ee4565b9350610afd898561229b565b905087811015610c0c576000610b188a6107e8876001612ee4565b9050888110610bf95760008a815260126020908152604080832085845260050190915290205460ff16610b575760018597509750505050505050610d0e565b60008a815260126020908152604080832085845260050190915290205460ff168015610b835750600085115b15610ba65784610b9281612f82565b955050610b9f8a8661229b565b9150610b57565b84158015610bd0575060008a815260126020908152604080832085845260050190915290205460ff165b15610be75760008097509750505050505050610d0e565b60018597509750505050505050610d0e565b610c04856001612ee4565b935050610d00565b6000610c1d8a6107e8600188612f3b565b905088811015610cf15760008a815260126020908152604080832084845260050190915290205460ff16610c66576001610c578187612f3b565b97509750505050505050610d0e565b84610c7081612f82565b9550505b60008a815260126020908152604080832084845260050190915290205460ff168015610ca05750600085115b15610cc35784610caf81612f82565b955050610cbc8a8661229b565b9050610c74565b84158015610bd0575060008a815260126020908152604080832084845260050190915290205460ff16610bd0565b610cfc600186612f3b565b9250505b610ac5565b60008092509250505b9250929050565b6001600160a01b0381166000908152601360205260409020600501545b919050565b600080610d4e600a5461a8c0426107549190612f3b565b50915091508115610e5b57600081806020019051810190610d6f9190612dd3565b9050662386f26fc100008110158015610d91575069d3c21bcecceda100000081105b610ddd5760405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964207374616b696e6720746f6b656e207072696365000000000060448201526064016108d8565b600081600854670de0b6b3a7640000610df69190612f1c565b610e009190612efc565b9050600454811015610e1757600454600755610e1d565b60078190555b7f1af37d6aaef3c5ef293c3c63d0ac302f60db7fde22eb9f5e96ebd56992832110600754604051610e5091815260200190565b60405180910390a150505b5050565b6001546000906001600160a01b03163314610ec75760405162461bcd60e51b815260206004820152602260248201527f6f6e6c7920676f7665726e616e63652063616e20736c617368207265706f727460448201526132b960f11b60648201526084016108d8565b6001600160a01b0383166000908152601360205260408120600181015460028201549192909190610ef88284612ee4565b11610f3b5760405162461bcd60e51b81526020600482015260136024820152727a65726f207374616b65722062616c616e636560681b60448201526064016108d8565b6007548110610f84576007549350600754836002016000828254610f5f9190612f3b565b909155505060075460118054600090610f79908490612f3b565b909155506110129050565b600754610f918383612ee4565b10610fdb576007549350610fb886610fa98387612f3b565b610fb39085612f3b565b61248a565b8060116000828254610fca9190612f3b565b909155505060006002840155611012565b610fe58183612ee4565b93508060116000828254610ff99190612f3b565b9091555061100a905086600061248a565b600060028401555b60005460405163a9059cbb60e01b81526001600160a01b038781166004830152602482018790529091169063a9059cbb90604401602060405180830381600087803b15801561106057600080fd5b505af1158015611074573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110989190612cfa565b6110a157600080fd5b604080516001600160a01b038781168252602082018790528816917f4317784407a22e643706ef000f5c0eea399dea3632613786167ab71c9446e3ac910160405180910390a250505092915050565b6001546001600160a01b031633146111545760405162461bcd60e51b815260206004820152602160248201527f63616c6c6572206d75737420626520676f7665726e616e6365206164647265736044820152607360f81b60648201526084016108d8565b6000828152601260209081526040808320848452600581019092529091205460ff16156111c35760405162461bcd60e51b815260206004820152601660248201527f76616c756520616c72656164792064697370757465640000000000000000000060448201526064016108d8565b600082815260018201602052604090205481548290829081106111f657634e487b7160e01b600052603260045260246000fd5b906000526020600020015483146112435760405162461bcd60e51b81526020600482015260116024820152700696e76616c69642074696d657374616d7607c1b60448201526064016108d8565b604080516020808201808452600080845287815260038701909252929020905161126d9290612b1a565b50600083815260058301602052604090819020805460ff19166001179055517fb326db0e54476c677e2b35b75856ac6f4d8bbfb0a6de6690582ebe4dabce0de790610e509086908690918252602082015260400190565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47085856040516112f5929190612e41565b6040518091039020141561134b5760405162461bcd60e51b815260206004820152601760248201527f76616c7565206d757374206265207375626d697474656400000000000000000060448201526064016108d8565b60008681526012602052604090208054841480611366575083155b6113b25760405162461bcd60e51b815260206004820181905260248201527f6e6f6e6365206d757374206d617463682074696d657374616d7020696e64657860448201526064016108d8565b336000908152601360205260409020600754600182015410156114295760405162461bcd60e51b815260206004820152602960248201527f62616c616e6365206d7573742062652067726561746572207468616e207374616044820152681ad948185b5bdd5b9d60ba1b60648201526084016108d8565b600754816001015461143b9190612efc565b60055461144a906103e8612f1c565b6114549190612efc565b60048201546114639042612f3b565b61146f906103e8612f1c565b116114ce5760405162461bcd60e51b815260206004820152602960248201527f7374696c6c20696e207265706f727465722074696d65206c6f636b2c20706c6560448201526861736520776169742160b81b60648201526084016108d8565b83836040516114de929190612e41565b604051809103902088146115405760405162461bcd60e51b815260206004820152602360248201527f7175657279206964206d7573742062652068617368206f66207175657279206460448201526261746160e81b60648201526084016108d8565b4260048083018290556000918252830160205260409020546001600160a01b0316156115ae5760405162461bcd60e51b815260206004820152601e60248201527f74696d657374616d7020616c7265616479207265706f7274656420666f72000060448201526064016108d8565b815442600081815260018086016020908152604080842086905591850187558683528083209094018390559181526002850183528181204390556003850190925290206115fc908888612b9e565b50426000818152600484016020526040812080546001600160a01b03191633179055600b54600d54919261012c9261163391612f3b565b61163d9190612f1c565b6116479190612efc565b90506000601154600954600f5461165e9190612ee4565b6116689190612ee4565b6000546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156116ab57600080fd5b505afa1580156116bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e39190612dd3565b6116ed9190612f3b565b90506000811180156116ff5750600082115b1561181c57818110156117965760005460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b15801561175857600080fd5b505af115801561176c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117909190612cfa565b5061181c565b60005460405163a9059cbb60e01b8152336004820152602481018490526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156117e257600080fd5b505af11580156117f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181a9190612cfa565b505b42600d5560058301805490600061183283612fce565b909155505060008a8152600984016020526040812080549161185383612fce565b9190505550336001600160a01b0316428b7f48e9e2c732ba278de6ac88a3a57a5c5ba13d3d8370e709b3b98333a57876ca958c8c8c8c8c60405161189b959493929190612e98565b60405180910390a450505050505050505050565b600080600e54670de0b6b3a7640000600f546118c96128c3565b6118d39190612f1c565b6118dd9190612efc565b6118e79190612f3b565b9050806009546118f79190612f3b565b91505090565b33600090815260136020526040902060018101548211156119605760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e74207374616b65642062616c616e6365000000000060448201526064016108d8565b61197433838360010154610fb39190612f3b565b42815560028101805483919060009061198e908490612ee4565b9250508190555081601160008282546119a79190612ee4565b909155505060408051338152602081018490527f3d8d9df4bd0172df32e557fa48e96435cd7f2cac06aaffacfaee608e6f7898ef910160405180910390a15050565b6000606060008060006119fc87876109c3565b9150915081611a265760006040518060200160405280600081525060009450945094505050611a45565b611a30878261229b565b9250611a3c8784611e19565b93506001945050505b9250925092565b60606000611a5f83610754426001612ee4565b509250905080611a6e57600080fd5b50919050565b336000908152601360205260409020805462093a8090611a949042612f3b565b1015611ad75760405162461bcd60e51b8152602060048201526012602482015271372064617973206469646e2774207061737360701b60448201526064016108d8565b6000816002015411611b365760405162461bcd60e51b815260206004820152602260248201527f7265706f72746572206e6f74206c6f636b656420666f72207769746864726177604482015261185b60f21b60648201526084016108d8565b600054600282015460405163a9059cbb60e01b815233600482015260248101919091526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b158015611b8857600080fd5b505af1158015611b9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc09190612cfa565b611bc957600080fd5b806002015460116000828254611bdf9190612f3b565b9091555050600060028201556040513381527f4a7934670bd8304e7da22378be1368f7c4fef17c5aee81804beda8638fe428ec9060200160405180910390a150565b6001600160a01b03811660009081526013602052604081206003810154670de0b6b3a7640000611c4f6128c3565b8360010154611c5e9190612f1c565b611c689190612efc565b611c729190612f3b565b60015460408051600481526024810182526020810180516001600160e01b03166339ecce1f60e21b179052905192945060009283926001600160a01b031691611cba91612e51565b6000604051808303816000865af19150503d8060008114611cf7576040519150601f19603f3d011682016040523d82523d6000602084013e611cfc565b606091505b509150915060008215611d2f57836006015482806020019051810190611d229190612dd3565b611d2c9190612f3b565b90505b8015611e10576001546040516001600160a01b0388811660248301529091169060440160408051601f198184030181529181526020820180516001600160e01b03166317b8fb3b60e31b17905251611d879190612e51565b6000604051808303816000865af19150503d8060008114611dc4576040519150601f19603f3d011682016040523d82523d6000602084013e611dc9565b606091505b5090935091508215611e105780846007015483806020019051810190611def9190612dd3565b611df99190612f3b565b611e039087612f1c565b611e0d9190612efc565b94505b50505050919050565b60008281526012602090815260408083208484526003019091529020805460609190611e4490612f99565b80601f0160208091040260200160405190810160405280929190818152602001828054611e7090612f99565b8015611ebd5780601f10611e9257610100808354040283529160200191611ebd565b820191906000526020600020905b815481529060010190602001808311611ea057829003601f168201915b5050505050905092915050565b6001546001600160a01b0316611f225760405162461bcd60e51b815260206004820152601a60248201527f676f7665726e616e63652061646472657373206e6f742073657400000000000060448201526064016108d8565b33600090815260136020526040902060018101546002820154801561205557838110611f805783836002016000828254611f5c9190612f3b565b925050819055508360116000828254611f759190612f3b565b909155506120509050565b6000546001600160a01b03166323b872dd3330611f9d8589612f3b565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401602060405180830381600087803b158015611fec57600080fd5b505af1158015612000573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120249190612cfa565b61202d57600080fd5b8260020154601160008282546120439190612f3b565b9091555050600060028401555b612257565b816121c45760015460408051600481526024810182526020810180516001600160e01b03166339ecce1f60e21b179052905160009283926001600160a01b03909116916120a29190612e51565b6000604051808303816000865af19150503d80600081146120df576040519150601f19603f3d011682016040523d82523d6000602084013e6120e4565b606091505b5091509150811561210957808060200190518101906121039190612dd3565b60068601555b6001546040513360248201526001600160a01b039091169060440160408051601f198184030181529181526020820180516001600160e01b03166317b8fb3b60e31b179052516121599190612e51565b6000604051808303816000865af19150503d8060008114612196576040519150601f19603f3d011682016040523d82523d6000602084013e61219b565b606091505b50909250905081156121c157808060200190518101906121bb9190612dd3565b60078601555b50505b6000546040516323b872dd60e01b8152336004820152306024820152604481018690526001600160a01b03909116906323b872dd90606401602060405180830381600087803b15801561221657600080fd5b505af115801561222a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224e9190612cfa565b61225757600080fd5b61226533610fb38685612ee4565b428355604051849033907fa96c2cce65119a2170d1711a6e82f18f2006448828483ba7545e59547654364790600090a350505050565b60008281526012602052604081208054839081106122c957634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6000601154600954600f546122f19190612ee4565b6122fb9190612ee4565b6000546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561233e57600080fd5b505afa158015612352573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123769190612dd3565b6123809190612f3b565b905090565b6000546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b1580156123d757600080fd5b505af11580156123eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061240f9190612cfa565b61241857600080fd5b6124206129d7565b80600960008282546124329190612ee4565b9250508190555062278d00600e54670de0b6b3a7640000600f546003546124599190612f1c565b6124639190612efc565b61246d9190612f3b565b60095461247a9190612f3b565b6124849190612efc565b60065550565b6124926129d7565b6001600160a01b03821660009081526013602052604090206001810154156127805760008160030154670de0b6b3a764000060035484600101546124d69190612f1c565b6124e09190612efc565b6124ea9190612f3b565b60015460408051600481526024810182526020810180516001600160e01b03166339ecce1f60e21b1790529051929350600092839283926001600160a01b03909116916125379190612e51565b6000604051808303816000865af19150503d8060008114612574576040519150601f19603f3d011682016040523d82523d6000602084013e612579565b606091505b509150915081156125aa5784600601548180602001905181019061259d9190612dd3565b6125a79190612f3b565b92505b82156126a0576001546040516001600160a01b0389811660248301529091169060440160408051601f198184030181529181526020820180516001600160e01b03166317b8fb3b60e31b179052516126029190612e51565b6000604051808303816000865af19150503d806000811461263f576040519150601f19603f3d011682016040523d82523d6000602084013e612644565b606091505b50909250905081156126a0576000818060200190518101906126669190612dd3565b905060008487600701548361267b9190612f3b565b6126859088612f1c565b61268f9190612efc565b90508581101561269d578095505b50505b83600960008282546126b29190612f3b565b909155505060005460405163a9059cbb60e01b8152336004820152602481018690526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b15801561270357600080fd5b505af1158015612717573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273b9190612cfa565b61274457600080fd5b8460030154600e600082825461275a9190612f3b565b90915550506001850154600f8054600090612776908490612f3b565b9091555050505050505b6001810182905560075482106127c657600881015460ff166127b257601080549060006127ac83612fce565b91905055505b60088101805460ff19166001179055612809565b600881015460ff16151560011480156127e157506000601054115b156127fc57601080549060006127f683612f82565b91905055505b60088101805460ff191690555b670de0b6b3a764000060035482600101546128249190612f1c565b61282e9190612efc565b60038201819055600e8054600090612847908490612ee4565b90915550506001810154600f8054600090612863908490612ee4565b90915550506006546128be5762278d00600e54670de0b6b3a7640000600f5460035461288f9190612f1c565b6128999190612efc565b6128a39190612f3b565b6009546128b09190612f3b565b6128ba9190612efc565b6006555b505050565b6000600f54600014156128d95750600354610871565b6000600f54600654600c54426128ef9190612f3b565b6128f99190612f1c565b61290b90670de0b6b3a7640000612f1c565b6129159190612efc565b6003546129229190612ee4565b90506000600e54670de0b6b3a7640000600f54846129409190612f1c565b61294a9190612efc565b6129549190612f3b565b905060095481106129d1576000600e54670de0b6b3a7640000600f5460035461297d9190612f1c565b6129879190612efc565b6129919190612f3b565b60095461299e9190612f3b565b600f549091506129b682670de0b6b3a7640000612f1c565b6129c09190612efc565b6003546129cd9190612ee4565b9250505b50905090565b42600c5414156129e657612b18565b600f5415806129f55750600654155b15612a035742600c55612b18565b6000600f54600654600c5442612a199190612f3b565b612a239190612f1c565b612a3590670de0b6b3a7640000612f1c565b612a3f9190612efc565b600354612a4c9190612ee4565b90506000600e54670de0b6b3a7640000600f5484612a6a9190612f1c565b612a749190612efc565b612a7e9190612f3b565b90506009548110612b0b576000600e54670de0b6b3a7640000600f54600354612aa79190612f1c565b612ab19190612efc565b612abb9190612f3b565b600954612ac89190612f3b565b600f54909150612ae082670de0b6b3a7640000612f1c565b612aea9190612efc565b60036000828254612afb9190612ee4565b9091555050600060065550612b11565b60038290555b505042600c555b565b828054612b2690612f99565b90600052602060002090601f016020900481019282612b485760008555612b8e565b82601f10612b6157805160ff1916838001178555612b8e565b82800160010185558215612b8e579182015b82811115612b8e578251825591602001919060010190612b73565b50612b9a929150612c12565b5090565b828054612baa90612f99565b90600052602060002090601f016020900481019282612bcc5760008555612b8e565b82601f10612be55782800160ff19823516178555612b8e565b82800160010185558215612b8e579182015b82811115612b8e578235825591602001919060010190612bf7565b5b80821115612b9a5760008155600101612c13565b80356001600160a01b0381168114610d3257600080fd5b60008083601f840112612c4f578182fd5b50813567ffffffffffffffff811115612c66578182fd5b602083019150836020828501011115610d0e57600080fd5b600060208284031215612c8f578081fd5b612c9882612c27565b9392505050565b60008060408385031215612cb1578081fd5b612cba83612c27565b9150612cc860208401612c27565b90509250929050565b60008060408385031215612ce3578182fd5b612cec83612c27565b946020939093013593505050565b600060208284031215612d0b578081fd5b81518015158114612c98578182fd5b600060208284031215612d2b578081fd5b5035919050565b60008060008060008060808789031215612d4a578182fd5b86359550602087013567ffffffffffffffff80821115612d68578384fd5b612d748a838b01612c3e565b9097509550604089013594506060890135915080821115612d93578384fd5b50612da089828a01612c3e565b979a9699509497509295939492505050565b60008060408385031215612dc4578182fd5b50508035926020909101359150565b600060208284031215612de4578081fd5b5051919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452612e2d816020860160208601612f52565b601f01601f19169290920160200192915050565b6000828483379101908152919050565b60008251612e63818460208701612f52565b9190910192915050565b6000841515825260606020830152612e886060830185612e15565b9050826040830152949350505050565b600060608252612eac606083018789612deb565b8560208401528281036040840152612ec5818587612deb565b98975050505050505050565b600060208252612c986020830184612e15565b60008219821115612ef757612ef7612fe9565b500190565b600082612f1757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612f3657612f36612fe9565b500290565b600082821015612f4d57612f4d612fe9565b500390565b60005b83811015612f6d578181015183820152602001612f55565b83811115612f7c576000848401525b50505050565b600081612f9157612f91612fe9565b506000190190565b600181811c90821680612fad57607f821691505b60208210811415611a6e57634e487b7160e01b600052602260045260246000fd5b6000600019821415612fe257612fe2612fe9565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220268f9e82824a9050611227d9c7f68f2327bead04bdf2781127992b30b477ef0c64736f6c63430008030033000000000000000000000000aad66432d27737ecf6ed183160adc5ef36ab99f2000000000000000000000000000000000000000000000000000000000000a8c0000000000000000000000000000000000000000000000028a857425466f80000000000000000000000000000000000000000000000000000a688906bd8b00000000000000000000000000000000000000000000000000002b5e3af16b18800005c13cd9c97dbb98f2429c101a2a8150e6c7a0ddaff6124ee176a3a411067ded0
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.