Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Block Reward V1
- Optimization enabled
- true
- Compiler version
- v0.5.16+commit.9c3226ce
- Optimization runs
- 200
- EVM Version
- petersburg
- Verified at
- 2021-08-20 08:15:19.111917Z
Constructor Arguments
0000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000303000000000000000000000000000000000000000000000000000000000000030400000000000000000000000000000000000000000000000000000000000003010000000000000000000000000000000000000000000000000000000000000302
Contract source code
// Copyright 2019 The Energi Core Authors// This file is part of Energi Core.//// Energi Core is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Energi Core is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Energi Core. If not, see <http://www.gnu.org/licenses/>.// Energi Governance system is the fundamental part of Energi Core.// NOTE: It's not allowed to change the compiler due to byte-to-byte// match requirement.pragma solidity 0.5.16;//pragma experimental SMTChecker;/** * Genesis version of GovernedContract interface. * * Base Consensus interface for upgradable contracts. * Unlike common approach, the implementation is NOT expected to be * called through delegatecall() to minimize risks of shared storage. * * NOTE: it MUST NOT change after blockchain launch! */interface IGovernedContract { // Return actual proxy address for secure validation function proxy() external returns(address); // It must check that the caller is the proxy // and copy all required data from the old address. function migrate(IGovernedContract _oldImpl) external; // It must check that the caller is the proxy // and self destruct to the new address. function destroy(IGovernedContract _newImpl) external; function () external payable;}// Copyright 2019 The Energi Core Authors// This file is part of Energi Core.//// Energi Core is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Energi Core is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Energi Core. If not, see <http://www.gnu.org/licenses/>.// Energi Governance system is the fundamental part of Energi Core.// NOTE: It's not allowed to change the compiler due to byte-to-byte// match requirement.//pragma experimental SMTChecker;// Copyright 2019 The Energi Core Authors// This file is part of Energi Core.//// Energi Core is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Energi Core is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Energi Core. If not, see <http://www.gnu.org/licenses/>.// Energi Governance system is the fundamental part of Energi Core.// NOTE: It's not allowed to change the compiler due to byte-to-byte// match requirement.//pragma experimental SMTChecker;/** * Genesis version of GovernedContract common base. * * Base Consensus interface for upgradable contracts. * Unlike common approach, the implementation is NOT expected to be * called through delegatecall() to minimize risks of shared storage. * * NOTE: it MUST NOT change after blockchain launch! */contract GovernedContract is IGovernedContract { address public proxy; constructor(address _proxy) public { proxy = _proxy; } modifier requireProxy { require(msg.sender == proxy, "Not proxy"); _; } function migrate(IGovernedContract _oldImpl) external requireProxy { _migrate(_oldImpl); } function destroy(IGovernedContract _newImpl) external requireProxy { _destroy(_newImpl); selfdestruct(address(_newImpl)); } // solium-disable-next-line no-empty-blocks function _migrate(IGovernedContract) internal {} // solium-disable-next-line no-empty-blocks function _destroy(IGovernedContract) internal {} function _callerAddress() internal view returns (address payable) { if (msg.sender == proxy) { // This is guarantee of the GovernedProxy // solium-disable-next-line security/no-tx-origin return tx.origin; } else { return msg.sender; } }}// Copyright 2019 The Energi Core Authors// This file is part of Energi Core.//// Energi Core is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Energi Core is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Energi Core. If not, see <http://www.gnu.org/licenses/>.// Energi Governance system is the fundamental part of Energi Core.// NOTE: It's not allowed to change the compiler due to byte-to-byte// match requirement.//pragma experimental SMTChecker;/** * Genesis version of BlacklistRegistry interface. * * Base Consensus interface for contracts which receive block rewards. * * NOTE: it MUST NOT change after blockchain launch! */interface IBlockReward { // NOTE: it must NEVER fail function reward() external payable; // NOTE: it must NEVER fail function getReward(uint _blockNumber) external view returns(uint amount);}// Copyright 2019 The Energi Core Authors// This file is part of Energi Core.//// Energi Core is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Energi Core is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Energi Core. If not, see <http://www.gnu.org/licenses/>.// Energi Governance system is the fundamental part of Energi Core.// NOTE: It's not allowed to change the compiler due to byte-to-byte// match requirement.//pragma experimental SMTChecker;// Copyright 2019 The Energi Core Authors// This file is part of Energi Core.//// Energi Core is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Energi Core is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Energi Core. If not, see <http://www.gnu.org/licenses/>.// Energi Governance system is the fundamental part of Energi Core.// NOTE: It's not allowed to change the compiler due to byte-to-byte// match requirement.//pragma experimental SMTChecker;// Copyright 2019 The Energi Core Authors// This file is part of Energi Core.//// Energi Core is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Energi Core is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Energi Core. If not, see <http://www.gnu.org/licenses/>.// Energi Governance system is the fundamental part of Energi Core.// NOTE: It's not allowed to change the compiler due to byte-to-byte// match requirement.//pragma experimental SMTChecker;interface IProposal { function parent() external view returns(address); function created_block() external view returns(uint); function deadline() external view returns(uint); function fee_payer() external view returns(address payable); function fee_amount() external view returns(uint); function accepted_weight() external view returns(uint); function rejected_weight() external view returns(uint); function total_weight() external view returns(uint); function quorum_weight() external view returns(uint); function isFinished() external view returns(bool); function isAccepted() external view returns(bool); function withdraw() external; function destroy() external; function collect() external; function voteAccept() external; function voteReject() external; function setFee() external payable; function canVote(address owner) external view returns(bool);}/** * Interface of UpgradeProposal */contract IUpgradeProposal is IProposal { function impl() external view returns(IGovernedContract);}/** * Genesis version of IGovernedProxy interface. * * Base Consensus interface for upgradable contracts proxy. * Unlike common approach, the implementation is NOT expected to be * called through delegatecall() to minimize risks of shared storage. * * NOTE: it MUST NOT change after blockchain launch! */interface IGovernedProxy { event UpgradeProposal( IGovernedContract indexed impl, IUpgradeProposal proposal ); event Upgraded( IGovernedContract indexed impl, IUpgradeProposal proposal ); function impl() external view returns(IGovernedContract); function proposeUpgrade(IGovernedContract _newImpl, uint _period) external payable returns(IUpgradeProposal); function upgrade(IUpgradeProposal _proposal) external; function upgradeProposalImpl(IUpgradeProposal _proposal) external view returns(IGovernedContract new_impl); function listUpgradeProposals() external view returns(IUpgradeProposal[] memory proposals); function collectUpgradeProposal(IUpgradeProposal _proposal) external; function () external payable;}// Copyright 2019 The Energi Core Authors// This file is part of Energi Core.//// Energi Core is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// Energi Core is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with Energi Core. If not, see <http://www.gnu.org/licenses/>.// Energi Governance system is the fundamental part of Energi Core.// NOTE: It's not allowed to change the compiler due to byte-to-byte// match requirement.//pragma experimental SMTChecker;/** * A little helper to protect contract from being re-entrant in state * modifying functions. */contract NonReentrant { uint private entry_guard; modifier noReentry { require(entry_guard == 0, "Reentry"); entry_guard = 1; _; entry_guard = 0; }}/** * Genesis hardcoded version of SporkReward * * NOTE: it MUST NOT change after blockchain launch! */contract BlockRewardV1 is GovernedContract, IBlockReward, NonReentrant{ uint constant internal GET_GAS = 10000; IGovernedProxy[] public reward_proxies; // IGovernedContract //--------------------------------- constructor(address _proxy, IGovernedProxy[] memory _reward_proxies) public GovernedContract(_proxy) { for (uint i = 0; i < _reward_proxies.length; ++i) { reward_proxies.push(_reward_proxies[i]); } } // IBlockReward //--------------------------------- function reward() external payable noReentry { uint len = reward_proxies.length; uint gas_per_reward = (gasleft() / len) - GET_GAS; for (uint i = 0; i < len; ++i) { IBlockReward impl = IBlockReward(address(reward_proxies[i].impl())); uint amount = impl.getReward.gas(GET_GAS)(block.number); // solium-disable-next-line security/no-call-value address(impl).call.value(amount).gas(gas_per_reward)(abi.encode(impl.reward.selector)); } } function getReward(uint _blockNumber) external view returns(uint amount) { for (uint i = reward_proxies.length; i-- > 0;) { IBlockReward impl = IBlockReward(address(reward_proxies[i].impl())); amount += impl.getReward(_blockNumber); } } // Safety //--------------------------------- function () external payable { revert("Not supported"); }}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"address","name":"_proxy","internalType":"address"},{"type":"address[]","name":"_reward_proxies","internalType":"contractIGovernedProxy[]"}]},{"type":"fallback","stateMutability":"payable","payable":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"destroy","inputs":[{"type":"address","name":"_newImpl","internalType":"contractIGovernedContract"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"amount","internalType":"uint256"}],"name":"getReward","inputs":[{"type":"uint256","name":"_blockNumber","internalType":"uint256"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"migrate","inputs":[{"type":"address","name":"_oldImpl","internalType":"contractIGovernedContract"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"proxy","inputs":[],"constant":true},{"type":"function","stateMutability":"payable","payable":true,"outputs":[],"name":"reward","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"contractIGovernedProxy"}],"name":"reward_proxies","inputs":[{"type":"uint256","name":"","internalType":"uint256"}],"constant":true}]
Deployed ByteCode
0x3630383036303430353233343830313536313030313035373630303038306664356235303630343035313631303737323338303338303631303737323833333938313831303136303430353236303430383131303135363130303333353736303030383066643562383135313630323038333031383035313630343035313932393439323933383330313932393139303834363430313030303030303030383231313135363130303561353736303030383066643562393038333031393036303230383230313835383131313135363130303666353736303030383066643562383235313836363032303832303238333031313136343031303030303030303038323131313731353631303038633537363030303830666435623832353235303831353136303230393138323031393238323031393130323830383338333630303035623833383131303135363130306239353738313831303135313833383230313532363032303031363130306131353635623530353035303530393139303931303136303430353235303530363030303830353436303031363030313630613031623033313931363630303136303031363061303162303338363136313738313535393135303530356238313531383131303135363130313431353736303032383238323831353138313130363130306663353766653562363032303930383130323931393039313031383130313531383235343630303138303832303138353535363030303934383535323932393039333230393039323031383035343630303136303031363061303162303331393136363030313630303136306130316230333930393331363932393039323137393039313535303136313030653535363562353035303530363130363166383036313031353336303030333936303030663366653630383036303430353236303034333631303631303035343537363030303335363065303163383036326635356439643134363130303931353738303633316334623737346231343631303063363537383036333232386362373333313436313031303235373830363333633932666237343134363130313061353738303633636535343934626231343631303135303537383036336563353536383839313436313031383335373562363034303830353136323436316263643630653531623831353236303230363030343832303135323630306436303234383230313532366331333962646430383163646435633163316264633964313935393630396131623630343438323031353239303531393038313930303336303634303139306664356233343830313536313030396435373630303038306664356235303631303063343630303438303336303336303230383131303135363130306234353736303030383066643562353033353630303136303031363061303162303331363631303139383536356230303562333438303135363130306432353736303030383066643562353036313030663036303034383033363033363032303831313031353631303065393537363030303830666435623530333536313031663835363562363034303830353139313832353235313930383139303033363032303031393066333562363130306334363130333136353635623334383031353631303131363537363030303830666435623530363130313334363030343830333630333630323038313130313536313031326435373630303038306664356235303335363130353631353635623630343038303531363030313630303136306130316230333930393231363832353235313930383139303033363032303031393066333562333438303135363130313563353736303030383066643562353036313030633436303034383033363033363032303831313031353631303137333537363030303830666435623530333536303031363030313630613031623033313636313035383835363562333438303135363130313866353736303030383066643562353036313031333436313035646235363562363030303534363030313630303136306130316230333136333331343631303165333537363034303830353136323436316263643630653531623831353236303230363030343832303135323630303936303234383230313532363834653666373432303730373236663738373936306238316236303434383230313532393035313930383139303033363036343031393066643562363130316563383136313035643835363562383036303031363030313630613031623033313666663562363030323534363030303930356236303030313938313031393031353631303331303537363030303630303238323831353438313130363130323139353766653562363030303931383235323630323039313832393032303031353436303430383035313633386162663630373736306530316238313532393035313630303136303031363061303162303339303932313639323633386162663630373739323630303438303834303139333832393030333031383138363830336231353830313536313032363235373630303038306664356235303561666131353830313536313032373635373364363030303830336533643630303066643562353035303530353036303430353133643630323038313130313536313032386335373630303038306664356235303531363034303830353136333163346237373462363065303162383135323630303438313031383739303532393035313931393235303630303136303031363061303162303338333136393136333163346237373462393136303234383038323031393236303230393239303931393038323930303330313831383638303362313538303135363130326439353736303030383066643562353035616661313538303135363130326564353733643630303038303365336436303030666435623530353035303530363034303531336436303230383131303135363130333033353736303030383066643562353035313932393039323031393135303631303166663536356235303931393035303536356236303031353431353631303335353537363034303830353136323436316263643630653531623831353236303230363030343832303135323630303736303234383230313532363635323635363536653734373237393630633831623630343438323031353239303531393038313930303336303634303139306664356236303031383035353630303235343630303036313237313038323561383136313033366135376665356230343033393035303630303035623832383131303135363130353537353736303030363030323832383135343831313036313033383835376665356236303030393138323532363032303931383239303230303135343630343038303531363338616266363037373630653031623831353239303531363030313630303136306130316230333930393231363932363338616266363037373932363030343830383430313933383239303033303138313836383033623135383031353631303364313537363030303830666435623530356166613135383031353631303365353537336436303030383033653364363030306664356235303530353035303630343035313364363032303831313031353631303366623537363030303830666435623530353136303430383035313633316334623737346236306530316238313532343336303034383230313532393035313931393235303630303039313630303136303031363061303162303338343136393136333163346237373462393136313237313039313630323438303832303139323630323039323930393139303832393030333031383138373830336231353830313536313034346535373630303038306664356235303836666131353830313536313034363235373364363030303830336533643630303066643562353035303530353035303630343035313364363032303831313031353631303437393537363030303830666435623530353136303430383035313633323238636237333336306530316236303230383238313031393139303931353238323531383038333033383230313831353239313833303139323833393035323831353139333934353036303031363030313630613031623033383631363933383839333836393339323930393138323931383430313930383038333833356236303230383331303631303464663537383035313832353236303166313939303932303139313630323039313832303139313031363130346330353635623630303138333630323030333631303130303061303338303139383235313136383138343531313638303832313738353532353035303530353035303530393035303031393135303530363030303630343035313830383330333831383538383838663139333530353035303530336438303630303038313134363130353432353736303430353139313530363031663139363033663364303131363832303136303430353233643832353233643630303036303230383430313365363130353437353635623630363039313530356235303530353035303530383036303031303139303530363130333731353635623530353036303030363030313535353035363562363030323831383135343831313036313035366535376665356236303030393138323532363032303930393132303031353436303031363030313630613031623033313639303530383135363562363030303534363030313630303136306130316230333136333331343631303564333537363034303830353136323436316263643630653531623831353236303230363030343832303135323630303936303234383230313532363834653666373432303730373236663738373936306238316236303434383230313532393035313930383139303033363036343031393066643562363130356438383135623530353635623630303035343630303136303031363061303162303331363831353666656132363536323761376137323331353832303837376462666366316236323261633337643661323861643338663931323230666232363464313738653438623937353335626464303865653239623933333636343733366636633633343330303035313030303332