Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x023FAe6F...6E932B49D The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
ValidatorExecutionRewards
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity 0.8.19; import {Ownable} from "./utils/NexusOwnable.sol"; /** * @title Validator Execution Reward Contract * @author RohitAudit * @dev This contract handles the proposer awards for the validators. As the rewards are associated with particular * validator one needs to update it in the contract as to who can claim those rewards. The reward bot performs that * functionality by tracking proposer of the block */ contract ValidatorExecutionRewards is Ownable{ struct RollupExecutionReward{ address rollupAdmin; uint256 amount; } mapping(address => uint256) public executionRewards; address public rewardBot; uint256 public rewardsEarned; uint256 public rewardsClaimed; event ExecutionRewardsReceived(uint256 rewards); event ChangeRewardBotAddress(address reward_bot); event ExecutionRewardSent(uint256 rewards,address rollupAdmin); event RollupExecutionRewardUpdated(address rollupAdmin, uint256 rewards); error NotRewardBot(); error RewardNotPresent(); error IncorrectRewards(); modifier onlyRewardBot() { if (msg.sender != rewardBot) revert NotRewardBot(); _; } constructor(address _rewardBot){ if (_rewardBot == address(0)) revert IncorrectAddress(); rewardBot = _rewardBot; emit ChangeRewardBotAddress(_rewardBot); _ownableInit(msg.sender); } function changeRewardBotAddress(address _bot_address) external onlyOwner{ if (_bot_address == address(0)) revert IncorrectAddress(); rewardBot = _bot_address; emit ChangeRewardBotAddress(_bot_address); } receive() external payable { rewardsEarned+=msg.value; emit ExecutionRewardsReceived(msg.value); } /** * Used for updation of rewards for a particular rollup * @param rewards: Array of rollups and their rewards earned by their validators */ function updateRewardsRollup(RollupExecutionReward[] calldata rewards) external onlyRewardBot { uint256 total_rewards; for(uint i=0;i<rewards.length;i++){ executionRewards[rewards[i].rollupAdmin] += rewards[i].amount; total_rewards+=rewards[i].amount; emit RollupExecutionRewardUpdated(rewards[i].rollupAdmin, rewards[i].amount); } if (total_rewards>(rewardsEarned-rewardsClaimed)) revert IncorrectRewards(); } /** * This function can be used by rollupAdmin to claim the proposer rewards asscociated with their validators */ function claimRewards() external { if (executionRewards[msg.sender] == 0) revert RewardNotPresent(); uint256 amount_to_send = executionRewards[msg.sender]; rewardsClaimed+=amount_to_send; executionRewards[msg.sender] = 0; (bool rewardSent,bytes memory data) = msg.sender.call{ value: amount_to_send, gas: 5000 }(""); if (rewardSent) emit ExecutionRewardSent(amount_to_send,msg.sender); } }
//SPDX-License-Identifier: MIT pragma solidity 0.8.19; /** * @title Ownable Contract * @author RohitAudit * @dev This contract is used to implement ownable features to the contracts */ contract Ownable { address private owner; bool private initialized = false; event OwnerChanged(address oldOwner, address newOwner); error NotOwner(); error ContractAlreadyInitialized(); error IncorrectAddress(); modifier onlyOwner() { if (msg.sender != owner) revert NotOwner(); _; } modifier initilizeOnce() { if (initialized) revert ContractAlreadyInitialized(); _; } function getOwner() external view returns (address) { return owner; } function _ownableInit(address _owner) internal { owner = _owner; initialized = true; } /** * This function transfers the ownership of the contract * @param newOwner New Owner of the contract */ function transferOwnership(address newOwner) external onlyOwner{ if (newOwner == address(0)) revert IncorrectAddress(); emit OwnerChanged(owner, newOwner); owner = newOwner; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_rewardBot","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ContractAlreadyInitialized","type":"error"},{"inputs":[],"name":"IncorrectAddress","type":"error"},{"inputs":[],"name":"IncorrectRewards","type":"error"},{"inputs":[],"name":"NotOwner","type":"error"},{"inputs":[],"name":"NotRewardBot","type":"error"},{"inputs":[],"name":"RewardNotPresent","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reward_bot","type":"address"}],"name":"ChangeRewardBotAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"},{"indexed":false,"internalType":"address","name":"rollupAdmin","type":"address"}],"name":"ExecutionRewardSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"}],"name":"ExecutionRewardsReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"rollupAdmin","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"}],"name":"RollupExecutionRewardUpdated","type":"event"},{"inputs":[{"internalType":"address","name":"_bot_address","type":"address"}],"name":"changeRewardBotAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"executionRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardBot","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsEarned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"rollupAdmin","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ValidatorExecutionRewards.RollupExecutionReward[]","name":"rewards","type":"tuple[]"}],"name":"updateRewardsRollup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x60806040526004361061008a5760003560e01c806386fa69581161005957806386fa695814610174578063871c791d146101af578063893d20e8146101c5578063c1ae90c8146101e3578063f2fde38b146101f957600080fd5b8063072a8d26146100e0578063372500ab146101025780634e0edd1b146101175780635d1421401461013757600080fd5b366100db5734600360008282546100a19190610632565b90915550506040513481527f7e40e49e494a5d79f21415ad41e04551aa0670da5528433d0c5189a516f6b22f9060200160405180910390a1005b600080fd5b3480156100ec57600080fd5b506101006100fb36600461064b565b610219565b005b34801561010e57600080fd5b506101006102bf565b34801561012357600080fd5b5061010061013236600461067b565b6103bb565b34801561014357600080fd5b50600254610157906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561018057600080fd5b506101a161018f36600461064b565b60016020526000908152604090205481565b60405190815260200161016b565b3480156101bb57600080fd5b506101a160035481565b3480156101d157600080fd5b506000546001600160a01b0316610157565b3480156101ef57600080fd5b506101a160045481565b34801561020557600080fd5b5061010061021436600461064b565b610561565b6000546001600160a01b03163314610244576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03811661026b576040516376cb291d60e11b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f26737078077065f1e609204025716eea068c45410cca3fc69c8e130be7bfde179060200160405180910390a150565b3360009081526001602052604081205490036102ee57604051632407887760e01b815260040160405180910390fd5b336000908152600160205260408120546004805491928392610311908490610632565b909155505033600081815260016020526040808220829055519091829161138890859084818181858888f193505050503d806000811461036d576040519150601f19603f3d011682016040523d82523d6000602084013e610372565b606091505b509150915081156103b657604080518481523360208201527fa976953eef597a7cc602a5519074f8b939667ec4a6792fceb3bab8ca755b0fa5910160405180910390a15b505050565b6002546001600160a01b031633146103e65760405163a47f374760e01b815260040160405180910390fd5b6000805b8281101561053057838382818110610404576104046106f0565b9050604002016020013560016000868685818110610424576104246106f0565b61043a926020604090920201908101915061064b565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546104699190610632565b909155508490508382818110610481576104816106f0565b90506040020160200135826104969190610632565b91507f24964897c81595f51a45fc1f0abadcb5be483687c6cc744a3d0d3835e0898e3e8484838181106104cb576104cb6106f0565b6104e1926020604090920201908101915061064b565b8585848181106104f3576104f36106f0565b604080516001600160a01b03909516855260209181029390930181013590840152500160405180910390a18061052881610706565b9150506103ea565b50600454600354610541919061071f565b8111156103b657604051636cb26a2160e11b815260040160405180910390fd5b6000546001600160a01b0316331461058c576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b0381166105b3576040516376cb291d60e11b815260040160405180910390fd5b600054604080516001600160a01b03928316815291831660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600080546001600160a01b0319166001600160a01b0392909216919091179055565b634e487b7160e01b600052601160045260246000fd5b808201808211156106455761064561061c565b92915050565b60006020828403121561065d57600080fd5b81356001600160a01b038116811461067457600080fd5b9392505050565b6000806020838503121561068e57600080fd5b823567ffffffffffffffff808211156106a657600080fd5b818501915085601f8301126106ba57600080fd5b8135818111156106c957600080fd5b8660208260061b85010111156106de57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016107185761071861061c565b5060010190565b818103818111156106455761064561061c56fea264697066735822122009f2449db968bcd763cd43e2d0806f1b56e655941fabc059c0fcd66e6b3c5b1564736f6c63430008130033
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.