Contract Address Details

0x13784220cB46932fE8d508F119deE60faAb41A0F

RewardByBlock Last Balance Update: Block #15156982
Created by 0x1092–f8ebae at 0x3c79–d8ab1a

Balance

0 POA

(@ /POA)

Fetching tokens...

Contract name:
RewardByBlock




Optimization enabled
true
Compiler version
v0.4.24+commit.e67f0147




Optimization runs
200
EVM Version
byzantium

Contract source code

/**
* Submitted for verification at blockscout.com on 2020-04-08 11:13:45.612699Z
*/
pragma solidity ^0.4.24;
/**
* @title EternalStorage
* @dev This contract holds all the necessary state variables to carry out the storage of any contract
* and to support the upgrade functionality.
*/
contract EternalStorage {
// Version number of the current implementation
uint256 internal _version;
// Address of the current implementation
address internal _implementation;
// Storage mappings
mapping(bytes32 => uint256) internal uintStorage;
mapping(bytes32 => string) internal stringStorage;
mapping(bytes32 => address) internal addressStorage;
mapping(bytes32 => bytes) internal bytesStorage;
mapping(bytes32 => bool) internal boolStorage;
mapping(bytes32 => int256) internal intStorage;
mapping(bytes32 => bytes32) internal bytes32Storage;
mapping(bytes32 => uint256[]) internal uintArrayStorage;
mapping(bytes32 => string[]) internal stringArrayStorage;
mapping(bytes32 => address[]) internal addressArrayStorage;
//mapping(bytes32 => bytes[]) internal bytesArrayStorage;
mapping(bytes32 => bool[]) internal boolArrayStorage;
mapping(bytes32 => int256[]) internal intArrayStorage;
mapping(bytes32 => bytes32[]) internal bytes32ArrayStorage;
}
interface IProxyStorage {
function initializeAddresses(
address, address, address, address, address, address, address, address
) external;
function setContractAddress(uint256, address) external returns(bool);
function getBallotsStorage() external view returns(address);
function getKeysManager() external view returns(address);
function getPoaConsensus() external view returns(address);
function getValidatorMetadata() external view returns(address);
function getVotingToChangeKeys() external view returns(address);
function getVotingToChangeMinThreshold() external view returns(address);
}
interface IKeysManager {
function addMiningKey(address) external returns(bool);
function addVotingKey(address, address) external returns(bool);
function addPayoutKey(address, address) external returns(bool);
function createKeys(address, address, address) external;
function initiateKeys(address) external;
function migrateInitialKey(address) external;
function migrateMiningKey(address) external;
function removeMiningKey(address) external returns(bool);
function removeVotingKey(address) external returns(bool);
function removePayoutKey(address) external returns(bool);
function swapMiningKey(address, address) external returns(bool);
function swapVotingKey(address, address) external returns(bool);
function swapPayoutKey(address, address) external returns(bool);
function checkIfMiningExisted(address, address) external view returns(bool);
function initialKeysCount() external view returns(uint256);
function isMiningActive(address) external view returns(bool);
function isVotingActive(address) external view returns(bool);
function isPayoutActive(address) external view returns(bool);
function getVotingByMining(address) external view returns(address);
function getPayoutByMining(address) external view returns(address);
function getTime() external view returns(uint256);
function getMiningKeyHistory(address) external view returns(address);
function getMiningKeyByVoting(address) external view returns(address);
function getInitialKeyStatus(address) external view returns(uint256);
function masterOfCeremony() external view returns(address);
function maxOldMiningKeysDeepCheck() external pure returns(uint256);
function miningKeyByPayout(address) external view returns(address);
function miningKeyByVoting(address) external view returns(address);
}
interface IKeysManagerPrev {
function getInitialKey(address) external view returns(uint8);
}
interface IRewardByBlock {
// Produce rewards for the given benefactors, with corresponding reward codes.
// Only callable by `SYSTEM_ADDRESS`
function reward(address[], uint16[]) external returns (address[], uint256[]);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns(uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns(uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns(uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract RewardByBlock is EternalStorage, IRewardByBlock {
using SafeMath for uint256;
bytes32 internal constant EXTRA_RECEIVERS = keccak256("extraReceivers");
bytes32 internal constant EXTRA_RECEIVERS_AMOUNTS = "extraReceiversAmounts";
// solhint-disable const-name-snakecase
// These values must be changed before deploy
uint256 public constant blockRewardAmount = 1 ether;
uint256 public constant emissionFundsAmount = 1 ether;
address public constant emissionFunds = 0x523B6539Ff08d72A6C8Bb598Af95bF50c1EA839C;
address public constant bridgeContract = 0x0000000000000000000000000000000000000000;
// solhint-enable const-name-snakecase
event AddedReceiver(uint256 amount, address indexed receiver);
event Rewarded(address[] receivers, uint256[] rewards);
modifier onlyBridgeContract {
require(msg.sender == bridgeContract);
_;
}
modifier onlySystem {
require(msg.sender == 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE);
_;
}
function addExtraReceiver(uint256 _amount, address _receiver)
external
onlyBridgeContract
{
require(_receiver != address(0));
require(_amount != 0);
require(extraReceiversAmounts(_receiver) == 0);
_setExtraReceiverAmount(_amount, _receiver);
_addExtraReceiver(_receiver);
emit AddedReceiver(_amount, _receiver);
}
function reward(address[] benefactors, uint16[] kind)
external
onlySystem
returns (address[], uint256[])
{
require(benefactors.length == kind.length);
require(benefactors.length == 1);
require(kind[0] == 0);
address miningKey = benefactors[0];
if (miningKey == address(0)) {
// Return empty arrays
return (new address[](0), new uint256[](0));
}
uint256 extraLength = extraReceiversLength();
address[] memory receivers = new address[](extraLength.add(2));
uint256[] memory rewards = new uint256[](receivers.length);
receivers[0] = _getPayoutByMining(miningKey);
rewards[0] = blockRewardAmount;
receivers[1] = emissionFunds;
rewards[1] = emissionFundsAmount;
for (uint256 i = 0; i < extraLength; i++) {
uint256 extraIndex = i.add(2);
address extraAddress = extraReceivers(i);
uint256 extraAmount = extraReceiversAmounts(extraAddress);
_setExtraReceiverAmount(0, extraAddress);
receivers[extraIndex] = extraAddress;
rewards[extraIndex] = extraAmount;
}
_clearExtraReceivers();
emit Rewarded(receivers, rewards);
return (receivers, rewards);
}
function extraReceivers(uint256 _index) public view returns(address) {
return addressArrayStorage[EXTRA_RECEIVERS][_index];
}
function extraReceiversAmounts(address _receiver) public view returns(uint256) {
return uintStorage[
keccak256(abi.encode(EXTRA_RECEIVERS_AMOUNTS, _receiver))
];
}
function extraReceiversLength() public view returns(uint256) {
return addressArrayStorage[EXTRA_RECEIVERS].length;
}
function proxyStorage() public view returns(address) {
return addressStorage[keccak256("proxyStorage")];
}
function _addExtraReceiver(address _receiver) private {
addressArrayStorage[EXTRA_RECEIVERS].push(_receiver);
}
function _clearExtraReceivers() private {
addressArrayStorage[EXTRA_RECEIVERS].length = 0;
}
function _getPayoutByMining(address _miningKey)
private
view
returns (address)
{
IKeysManager keysManager = IKeysManager(
IProxyStorage(proxyStorage()).getKeysManager()
);
address payoutKey = keysManager.getPayoutByMining(_miningKey);
return (payoutKey != address(0)) ? payoutKey : _miningKey;
}
function _isMiningActive(address _miningKey)
private
view
returns (bool)
{
IKeysManager keysManager = IKeysManager(
IProxyStorage(proxyStorage()).getKeysManager()
);
return keysManager.isMiningActive(_miningKey);
}
function _setExtraReceiverAmount(uint256 _amount, address _receiver) private {
uintStorage[
keccak256(abi.encode(EXTRA_RECEIVERS_AMOUNTS, _receiver))
] = _amount;
}
}

Contract ABI

[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"emissionFunds","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"blockRewardAmount","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"extraReceivers","inputs":[{"type":"uint256","name":"_index"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"extraReceiversAmounts","inputs":[{"type":"address","name":"_receiver"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addExtraReceiver","inputs":[{"type":"uint256","name":"_amount"},{"type":"address","name":"_receiver"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"proxyStorage","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"bridgeContract","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"emissionFundsAmount","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"extraReceiversLength","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"address[]","name":""},{"type":"uint256[]","name":""}],"name":"reward","inputs":[{"type":"address[]","name":"benefactors"},{"type":"uint16[]","name":"kind"}],"constant":false},{"type":"event","name":"AddedReceiver","inputs":[{"type":"uint256","name":"amount","indexed":false},{"type":"address","name":"receiver","indexed":true}],"anonymous":false},{"type":"event","name":"Rewarded","inputs":[{"type":"address[]","name":"receivers","indexed":false},{"type":"uint256[]","name":"rewards","indexed":false}],"anonymous":false}]
            

Contract Byte Code

0x6080604052600436106100a35763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631f4356e481146100a857806326cc2256146100d95780635ce94456146101005780637fb3a43e14610118578063aa9fa27414610139578063ae4b1b5b1461015f578063cd59658314610174578063ee8d75ff146100d9578063efdc4d0114610189578063f91c28981461019e575b600080fd5b3480156100b457600080fd5b506100bd610263565b60408051600160a060020a039092168252519081900360200190f35b3480156100e557600080fd5b506100ee61027b565b60408051918252519081900360200190f35b34801561010c57600080fd5b506100bd600435610287565b34801561012457600080fd5b506100ee600160a060020a03600435166102db565b34801561014557600080fd5b5061015d600435600160a060020a036024351661039e565b005b34801561016b57600080fd5b506100bd610433565b34801561018057600080fd5b506100bd61047e565b34801561019557600080fd5b506100ee610483565b3480156101aa57600080fd5b506101ca60246004803582810192908201359181359182019101356104b2565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561020e5781810151838201526020016101f6565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561024d578181015183820152602001610235565b5050505090500194505050505060405180910390f35b73523b6539ff08d72a6c8bb598af95bf50c1ea839c81565b670de0b6b3a764000081565b60408051600080516020610b148339815191528152815190819003600e0190206000908152600b6020529081208054839081106102c057fe5b600091825260209091200154600160a060020a031692915050565b604080517f6578747261526563656976657273416d6f756e74730000000000000000000000602080830191909152600160a060020a0384168284015282518083038401815260609092019283905281516000936002938593909282918401908083835b6020831061035d5780518252601f19909201916020918201910161033e565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205495945050505050565b33156103a957600080fd5b600160a060020a03811615156103be57600080fd5b8115156103ca57600080fd5b6103d3816102db565b156103dd57600080fd5b6103e78282610807565b6103f0816108cb565b604080518381529051600160a060020a038316917f5b4c7f26538bc9d1959f2612cc8d595abab5073872ab2cb3fa78f95567a6b1cc919081900360200190a25050565b604080517f70726f787953746f7261676500000000000000000000000000000000000000008152815190819003600c019020600090815260046020522054600160a060020a03165b90565b600081565b60408051600080516020610b148339815191528152815190819003600e0190206000908152600b602052205490565b60608060008082808280808073fffffffffffffffffffffffffffffffffffffffe33146104de57600080fd5b8c8b146104ea57600080fd5b60018d146104f757600080fd5b8b8b600081811061050457fe5b9050602002013561ffff1661ffff16600014151561052157600080fd5b8d8d600081811061052e57fe5b90506020020135600160a060020a031697506000600160a060020a031688600160a060020a0316141561057a57604080516000808252602082019081528183019092529a5098506107f6565b610582610483565b965061059587600263ffffffff61093716565b6040519080825280602002602001820160405280156105be578160200160208202803883390190505b50955085516040519080825280602002602001820160405280156105ec578160200160208202803883390190505b5094506105f88861094d565b86600081518110151561060757fe5b600160a060020a039092166020928302909101909101528451670de0b6b3a7640000908690600090811061063757fe5b60209081029091010152855173523b6539ff08d72a6c8bb598af95bf50c1ea839c908790600190811061066657fe5b600160a060020a039092166020928302909101909101528451670de0b6b3a7640000908690600190811061069657fe5b60209081029091010152600093505b8684101561072c576106be84600263ffffffff61093716565b92506106c984610287565b91506106d4826102db565b90506106e1600083610807565b8186848151811015156106f057fe5b600160a060020a039092166020928302909101909101528451819086908590811061071757fe5b602090810290910101526001909301926106a5565b610734610a92565b7fb747d4e9a0b39cc47496d84b42e4066ba8b8a0b89776528bcec4ac2997e224538686604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561079b578181015183820152602001610783565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156107da5781810151838201526020016107c2565b5050505090500194505050505060405180910390a18585995099505b505050505050505094509492505050565b604080517f6578747261526563656976657273416d6f756e74730000000000000000000000602080830191909152600160a060020a0384168284015282518083038401815260609092019283905281518593600293600093909282918401908083835b602083106108895780518252601f19909201916020918201910161086a565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020939093555050505050565b60408051600080516020610b148339815191528152815190819003600e0190206000908152600b60209081529181208054600181018255908252919020018054600160a060020a0390921673ffffffffffffffffffffffffffffffffffffffff19909216919091179055565b60008282018381101561094657fe5b9392505050565b600080600061095a610433565b600160a060020a0316639a5737866040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156109b057600080fd5b505af11580156109c4573d6000803e3d6000fd5b505050506040513d60208110156109da57600080fd5b5051604080517f7cded930000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152915192945090841691637cded930916024808201926020929091908290030181600087803b158015610a4457600080fd5b505af1158015610a58573d6000803e3d6000fd5b505050506040513d6020811015610a6e57600080fd5b50519050600160a060020a0381161515610a885783610a8a565b805b949350505050565b60408051600080516020610b148339815191528152815190819003600e0190206000908152600b602052908120610ac99082610acc565b50565b815481835581811115610af057600083815260209020610af0918101908301610af5565b505050565b61047b91905b80821115610b0f5760008155600101610afb565b509056006578747261526563656976657273000000000000000000000000000000000000a165627a7a723058204d86491d76416bf1762997cd1cd1b5eae4fe144ee090183bf7dfcdf7df062e790029