Contract Overview
Contract Name:
MiningReward
Compiler Version
v0.6.4+commit.1dca32f3
/** *Submitted for verification at Etherscan.io on 2020-09-09 */ pragma solidity 0.6.4; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; } contract MiningReward is Initializable { using SafeMath for uint256; using SafeERC20 for IERC20; bool internal _notEntered; /// @notice 奖励代币地址 address public rewardToken; /// @notice 管理员地址 address public admin; /// @notice 预备管理员地址 address public proposedAdmin; /// @notice 奖励设置时间 uint256 public datetime; /// @notice 用户奖励信息 /// @param amount 用户可提取的奖励数量 struct Balance { uint256 amount; } /// @notice 提币管理员地址 address public coinAdmin; /// @notice 预备提币管理员地址 address public proposedCoinAdmin; /// @notice 用户地址 => 用户奖励余额信息 mapping(address => Balance) public userBalance; /// @notice 事件:设置预备管理员 /// @param admin 管理员地址 /// @param proposedAdmin 预备管理员地址 event ProposeAdmin(address admin, address proposedAdmin); /// @notice 事件:Claim Admin /// @param oldAdmin 旧管理员地址 /// @param newAdmin 新管理员地址 event ClaimAdmin(address oldAdmin, address newAdmin); /// @notice 事件:管理员取出奖励代币(指定数量) /// @param amount 数量 event WithdrawRewardWithAmount(uint256 amount); /// @notice 事件:管理员取出奖励代币(全部取出) /// @param amount 数量 event WithdrawReward(uint256 amount); /// @notice 事件:管理员取出奖励代币(指定接收地址,全部取出) /// @param addr 接收地址 /// @param amount 数量 event WithdrawRewardToAddress(address addr, uint256 amount); /// @notice 事件:管理员取出奖励代币(指定接收地址,指定数量) /// @param addr 接收地址 /// @param amount 数量 event WithdrawRewardToAddressWithAmount(address addr, uint256 amount); /// @notice 事件:用户取出奖励 /// @param addr 用户地址 /// @param amount 数量 event ClaimReward(address addr, uint256 amount); /// @notice 事件:设置奖励代币 /// @param oldToken 老地址 /// @param newToken 新地址 event SetRewardToken(address oldToken, address newToken); /// @notice 事件:批量设置用户奖励 /// @param accounts 用户地址数组 /// @param amounts 奖励数量数组 /// @param datetime 时间戳 event BatchSet(address[] accounts, uint256[] amounts, uint256 datetime); /// @notice 事件:单独设置用户的奖励数量(修正情况下使用) /// @param account 用户地址 /// @param amount 奖励数量 event Set(address account, uint256 amount); /// @notice 初始化函数 /// @param _admin 管理员地址 /// @param _rewardToken 奖励代币地址 function initialize(address _admin, address _coinAdmin, address _rewardToken) public initializer { admin = _admin; coinAdmin = _coinAdmin; rewardToken = _rewardToken; _notEntered = true; } modifier onlyAdmin { require(msg.sender == admin, "Admin required"); _; } modifier onlyCoinAdmin { require(msg.sender == coinAdmin, "CoinAdmin required"); _; } modifier nonReentrant() { require(_notEntered, "re-entered"); _notEntered = false; _; _notEntered = true; } /// @notice 设置奖励代币地址 /// @param _rewardToken 奖励代币地址 function setRewardToken(address _rewardToken) public onlyCoinAdmin { address oldToken = rewardToken; rewardToken = _rewardToken; emit SetRewardToken(oldToken, rewardToken); } /// @notice 设置预备管理员地址 /// @param _proposedAdmin 预备管理员地址 function proposeAdmin(address _proposedAdmin) public onlyAdmin { require(_proposedAdmin != address(0)); proposedAdmin = _proposedAdmin; emit ProposeAdmin(admin, _proposedAdmin); } /// @notice 预备管理员 claim 权限 function claimAdmin() public { require(msg.sender == proposedAdmin, "ProposedAdmin required"); address oldAdmin = admin; admin = proposedAdmin; proposedAdmin = address(0); emit ClaimAdmin(oldAdmin, admin); } /// @notice 设置预备管理员地址 /// @param _proposedCoinAdmin 预备管理员地址 function proposeCoinAdmin(address _proposedCoinAdmin) public onlyCoinAdmin { require(_proposedCoinAdmin != address(0)); proposedCoinAdmin = _proposedCoinAdmin; // emit ProposeAdmin(admin, _proposedCoinAdmin); } /// @notice 预备管理员 claim 权限 function claimCoinAdmin() public { require(msg.sender == proposedCoinAdmin, "proposedCoinAdmin required"); // address oldCoinAdmin = coinAdmin; coinAdmin = proposedCoinAdmin; proposedCoinAdmin = address(0); // emit ClaimAdmin(oldAdmin, admin); } /// @notice 管理员取出奖励代币的数量(可指定数量) /// @param amount 取出数量 function withdrawRewardWithAmount(uint256 amount) public onlyCoinAdmin { require( IERC20(rewardToken).balanceOf(address(this)) > 0, "No reward left" ); require(amount > 0, "Invalid amount"); IERC20(rewardToken).safeTransfer(admin, amount); emit WithdrawRewardWithAmount(amount); } /// @notice 管理员取出奖励代币的数量(全部取出) function withdrawReward() public onlyCoinAdmin { require( IERC20(rewardToken).balanceOf(address(this)) > 0, "No reward left" ); uint256 balance = checkRewardBalance(); IERC20(rewardToken).safeTransfer(admin, balance); emit WithdrawReward(balance); } /// @notice 管理员取出奖励代币的数量(全部取出,指定接收地址) /// @param addr 接收代币地址 function withdrawRewardToAddress(address addr) public onlyCoinAdmin { require( IERC20(rewardToken).balanceOf(address(this)) > 0, "No reward left" ); uint256 balance = checkRewardBalance(); IERC20(rewardToken).safeTransfer(addr, balance); emit WithdrawRewardToAddress(addr, balance); } /// @notice 管理员取出奖励代币的数量(全部取出,指定接收地址,指定数量) /// @param addr 接收代币地址 /// @param amount 取出数量 function withdrawRewardToAddressWithAmount(address addr, uint256 amount) public onlyCoinAdmin { require( IERC20(rewardToken).balanceOf(address(this)) > 0, "No reward left" ); IERC20(rewardToken).safeTransfer(addr, amount); emit WithdrawRewardToAddressWithAmount(addr, amount); } /// @notice 批量设置用户的奖励数量 /// @param accounts 用户地址数组 /// @param amount 奖励数量数组 /// @param _datetime 时间戳 function batchSet( address[] calldata accounts, uint256[] calldata amount, uint256 _datetime ) external onlyAdmin { require(_datetime > datetime, "Invalid time"); uint256 userCount = accounts.length; require(userCount == amount.length, "Invalid input"); for (uint256 i = 0; i < userCount; ++i) { userBalance[accounts[i]].amount = userBalance[accounts[i]] .amount .add(amount[i]); } datetime = _datetime; emit BatchSet(accounts, amount, _datetime); } /// @notice 单独设置用户的奖励数量(修正情况下使用) /// @param account 用户地址 /// @param amount 奖励数量 function set(address account, uint256 amount) external onlyAdmin { userBalance[account].amount = amount; emit Set(account, amount); } /// @notice 用户取出自己的挖矿奖励 function claimReward() public nonReentrant { uint256 claimAmount = userBalance[msg.sender].amount; require(claimAmount > 0, "No reward"); require( checkRewardBalance() >= claimAmount, "Insufficient rewardToken" ); userBalance[msg.sender].amount = 0; IERC20(rewardToken).safeTransfer(msg.sender, claimAmount); emit ClaimReward(msg.sender, claimAmount); } /// @notice 用户查看自己的可取资产 function checkBalance(address account) public view returns (uint256) { return userBalance[account].amount; } /// @notice 查看当前奖励代币余额 function checkRewardBalance() public view returns (uint256) { return IERC20(rewardToken).balanceOf(address(this)); } }
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"accounts","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"datetime","type":"uint256"}],"name":"BatchSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"ClaimAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"address","name":"proposedAdmin","type":"address"}],"name":"ProposeAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Set","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldToken","type":"address"},{"indexed":false,"internalType":"address","name":"newToken","type":"address"}],"name":"SetRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawRewardToAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawRewardToAddressWithAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawRewardWithAmount","type":"event"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"amount","type":"uint256[]"},{"internalType":"uint256","name":"_datetime","type":"uint256"}],"name":"batchSet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"checkBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkRewardBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimCoinAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"coinAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"datetime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_coinAdmin","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proposedAdmin","type":"address"}],"name":"proposeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proposedCoinAdmin","type":"address"}],"name":"proposeCoinAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proposedAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposedCoinAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"setRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userBalance","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"withdrawRewardToAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawRewardToAddressWithAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawRewardWithAmount","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50600436106101425760003560e01c80638b26e2c5116100b8578063cfb4d5751161007c578063cfb4d5751461031a578063d3edf604146103dc578063e5a1b643146103e4578063f314d51b1461040a578063f7c618c114610412578063f851a4401461041a57610142565b80638b26e2c5146102c2578063b88a802f146102ca578063c0c53b8b146102d2578063c885bc581461030a578063cd2290fb1461031257610142565b80633ea722e31161010a5780633ea722e31461022357806340d5605a146102495780635f5152261461025157806363cb4a901461027757806377f50f97146102945780638aee81271461029c57610142565b80630103c92b14610147578063147bf6c41461017f57806332f751ec146101a75780633599c9bc146101cb5780633825d828146101f7575b600080fd5b61016d6004803603602081101561015d57600080fd5b50356001600160a01b0316610422565b60408051918252519081900360200190f35b6101a56004803603602081101561019557600080fd5b50356001600160a01b0316610434565b005b6101af6104fb565b604080516001600160a01b039092168252519081900360200190f35b6101a5600480360360408110156101e157600080fd5b506001600160a01b03813516906020013561050a565b6101a56004803603604081101561020d57600080fd5b506001600160a01b038135169060200135610681565b6101a56004803603602081101561023957600080fd5b50356001600160a01b031661072a565b61016d6108ae565b61016d6004803603602081101561026757600080fd5b50356001600160a01b03166108b4565b6101a56004803603602081101561028d57600080fd5b50356108cf565b6101a5610a80565b6101a5600480360360208110156102b257600080fd5b50356001600160a01b0316610b46565b6101af610c09565b6101a5610c18565b6101a5600480360360608110156102e857600080fd5b506001600160a01b038135811691602081013582169160409091013516610d8e565b6101a5610e86565b6101af611004565b6101a56004803603606081101561033057600080fd5b81019060208101813564010000000081111561034b57600080fd5b82018360208201111561035d57600080fd5b8035906020019184602083028401116401000000008311171561037f57600080fd5b91939092909160208101903564010000000081111561039d57600080fd5b8201836020820111156103af57600080fd5b803590602001918460208302840111640100000000831117156103d157600080fd5b919350915035611013565b6101a5611246565b6101a5600480360360208110156103fa57600080fd5b50356001600160a01b03166112cc565b61016d611355565b6101af6113d6565b6101af6113ea565b60396020526000908152604090205481565b6034546001600160a01b03163314610484576040805162461bcd60e51b815260206004820152600e60248201526d10591b5a5b881c995c5d5a5c995960921b604482015290519081900360640190fd5b6001600160a01b03811661049757600080fd5b603580546001600160a01b0319166001600160a01b0383811691821790925560345460408051919093168152602081019190915281517f09836bb9aad40118d4cdc3500a189a0940bab36af8f47f11252d2a85b03b6dad929181900390910190a150565b6035546001600160a01b031681565b6037546001600160a01b0316331461055e576040805162461bcd60e51b815260206004820152601260248201527110dbda5b90591b5a5b881c995c5d5a5c995960721b604482015290519081900360640190fd5b603354604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156105ae57600080fd5b505afa1580156105c2573d6000803e3d6000fd5b505050506040513d60208110156105d857600080fd5b50511161061d576040805162461bcd60e51b815260206004820152600e60248201526d139bc81c995dd85c99081b19599d60921b604482015290519081900360640190fd5b6033546106399061010090046001600160a01b031683836113f9565b604080516001600160a01b03841681526020810183905281517f8bad6c3594c4fb67b5b57979b82b3649970547e6e65b9115a71821a42db2a5db929181900390910190a15050565b6034546001600160a01b031633146106d1576040805162461bcd60e51b815260206004820152600e60248201526d10591b5a5b881c995c5d5a5c995960921b604482015290519081900360640190fd5b6001600160a01b0382166000818152603960209081526040918290208490558151928352820183905280517ffd28ec3ec2555238d8ad6f9faf3e4cd10e574ce7e7ef28b73caa53f9512f65b99281900390910190a15050565b6037546001600160a01b0316331461077e576040805162461bcd60e51b815260206004820152601260248201527110dbda5b90591b5a5b881c995c5d5a5c995960721b604482015290519081900360640190fd5b603354604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107ce57600080fd5b505afa1580156107e2573d6000803e3d6000fd5b505050506040513d60208110156107f857600080fd5b50511161083d576040805162461bcd60e51b815260206004820152600e60248201526d139bc81c995dd85c99081b19599d60921b604482015290519081900360640190fd5b6000610847611355565b6033549091506108669061010090046001600160a01b031683836113f9565b604080516001600160a01b03841681526020810183905281517ff8fa3c51901aa470ae9ec1988b11a8a46f67617dbefae9f92429371133c2753b929181900390910190a15050565b60365481565b6001600160a01b031660009081526039602052604090205490565b6037546001600160a01b03163314610923576040805162461bcd60e51b815260206004820152601260248201527110dbda5b90591b5a5b881c995c5d5a5c995960721b604482015290519081900360640190fd5b603354604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561097357600080fd5b505afa158015610987573d6000803e3d6000fd5b505050506040513d602081101561099d57600080fd5b5051116109e2576040805162461bcd60e51b815260206004820152600e60248201526d139bc81c995dd85c99081b19599d60921b604482015290519081900360640190fd5b60008111610a28576040805162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b604482015290519081900360640190fd5b603454603354610a4a916001600160a01b0361010090920482169116836113f9565b6040805182815290517f3f1f37d6ba2cb9c48629270d074e28e4c8076c2bcf40cd81a56581ebf48a71a29181900360200190a150565b6035546001600160a01b03163314610ad8576040805162461bcd60e51b8152602060048201526016602482015275141c9bdc1bdcd95910591b5a5b881c995c5d5a5c995960521b604482015290519081900360640190fd5b60348054603580546001600160a01b03198084166001600160a01b03838116919091179586905591169091556040805192821680845293909116602083015280517f60cae9fabd3bef6b015e14f55d6c66df6c507bbacdb16149e2bf7c440690da279281900390910190a150565b6037546001600160a01b03163314610b9a576040805162461bcd60e51b815260206004820152601260248201527110dbda5b90591b5a5b881c995c5d5a5c995960721b604482015290519081900360640190fd5b603380546001600160a01b03838116610100908102610100600160a81b03198416179384905560408051938290048316808552919094049091166020830152825190927f218717d77d844f0565caa29f3c551e7efe643ad51bfc9a9512ba8bb2ab45e494928290030190a15050565b6038546001600160a01b031681565b60335460ff16610c5c576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6033805460ff191690553360009081526039602052604090205480610cb4576040805162461bcd60e51b8152602060048201526009602482015268139bc81c995dd85c9960ba1b604482015290519081900360640190fd5b80610cbd611355565b1015610d10576040805162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e7420726577617264546f6b656e0000000000000000604482015290519081900360640190fd5b33600081815260396020526040812055603354610d43916101009091046001600160a01b0316908363ffffffff6113f916565b604080513381526020810183905281517fba8de60c3403ec381d1d484652ea1980e3c3e56359195c92525bff4ce47ad98e929181900390910190a1506033805460ff19166001179055565b600054610100900460ff1680610da75750610da7611450565b80610db5575060005460ff16155b610df05760405162461bcd60e51b815260040180806020018281038252602e815260200180611731602e913960400191505060405180910390fd5b600054610100900460ff16158015610e1b576000805460ff1961ff0019909116610100171660011790555b603480546001600160a01b038087166001600160a01b0319928316179092556037805486841692169190911790556033805460ff1992851661010002610100600160a81b0319909116179190911660011790558015610e80576000805461ff00191690555b50505050565b6037546001600160a01b03163314610eda576040805162461bcd60e51b815260206004820152601260248201527110dbda5b90591b5a5b881c995c5d5a5c995960721b604482015290519081900360640190fd5b603354604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610f2a57600080fd5b505afa158015610f3e573d6000803e3d6000fd5b505050506040513d6020811015610f5457600080fd5b505111610f99576040805162461bcd60e51b815260206004820152600e60248201526d139bc81c995dd85c99081b19599d60921b604482015290519081900360640190fd5b6000610fa3611355565b603454603354919250610fce9161010090046001600160a01b0390811691168363ffffffff6113f916565b6040805182815290517f57b16428e0995660a2371bfccc1866c98df04182d095c00b50648af066dd1ec99181900360200190a150565b6037546001600160a01b031681565b6034546001600160a01b03163314611063576040805162461bcd60e51b815260206004820152600e60248201526d10591b5a5b881c995c5d5a5c995960921b604482015290519081900360640190fd5b60365481116110a8576040805162461bcd60e51b815260206004820152600c60248201526b496e76616c69642074696d6560a01b604482015290519081900360640190fd5b838281146110ed576040805162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b604482015290519081900360640190fd5b60005b8181101561119b5761116085858381811061110757fe5b90506020020135603960008a8a8681811061111e57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b031681526020019081526020016000206000015461145690919063ffffffff16565b6039600089898581811061117057fe5b602090810292909201356001600160a01b0316835250810191909152604001600020556001016110f0565b50816036819055507f3d42dcf7dc9d942d0432de62f545e4f39cd82301f72f0a070a17b6ff2d05a68b86868686866040518080602001806020018481526020018381038352888882818152602001925060200280828437600083820152601f01601f19169091018481038352868152602090810191508790870280828437600083820152604051601f909101601f1916909201829003995090975050505050505050a1505050505050565b6038546001600160a01b031633146112a5576040805162461bcd60e51b815260206004820152601a60248201527f70726f706f736564436f696e41646d696e207265717569726564000000000000604482015290519081900360640190fd5b60388054603780546001600160a01b03199081166001600160a01b03841617909155169055565b6037546001600160a01b03163314611320576040805162461bcd60e51b815260206004820152601260248201527110dbda5b90591b5a5b881c995c5d5a5c995960721b604482015290519081900360640190fd5b6001600160a01b03811661133357600080fd5b603880546001600160a01b0319166001600160a01b0392909216919091179055565b603354604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156113a557600080fd5b505afa1580156113b9573d6000803e3d6000fd5b505050506040513d60208110156113cf57600080fd5b5051905090565b60335461010090046001600160a01b031681565b6034546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261144b9084906114b7565b505050565b303b1590565b6000828201838110156114b0576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b606061150c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115689092919063ffffffff16565b80519091501561144b5780806020019051602081101561152b57600080fd5b505161144b5760405162461bcd60e51b815260040180806020018281038252602a81526020018061175f602a913960400191505060405180910390fd5b6060611577848460008561157f565b949350505050565b606061158a8561172a565b6115db576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061161a5780518252601f1990920191602091820191016115fb565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461167c576040519150601f19603f3d011682016040523d82523d6000602084013e611681565b606091505b509150915081156116955791506115779050565b8051156116a55780518082602001fd5b8360405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116ef5781810151838201526020016116d7565b50505050905090810190601f16801561171c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b3b15159056fe436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a65645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212208f5559e4026fb022b4b4901f06e6596e38dab0fd1dfe471c6051b8f2141cf11e64736f6c63430006040033
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.