My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Contract Name:
RomeStaking
Compiler Version
v0.7.5+commit.eb77ed08
Optimization Enabled:
Yes with 9999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.7.5; import "./libraries/SafeERC20.sol"; import "./types/Policy.sol"; interface IsROME { function rebase( uint256 romeProfit_, uint epoch_) external returns (uint256); function circulatingSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function gonsForBalance( uint amount ) external view returns ( uint ); function balanceForGons( uint gons ) external view returns ( uint ); function index() external view returns ( uint ); } interface IWarmup { function retrieve( address staker_, uint amount_ ) external; } interface IDistributor { function distribute() external returns ( bool ); } contract RomeStaking is Policy { using SafeMath for uint256; using SafeERC20 for IERC20; address public immutable ROME; address public immutable sROME; struct Epoch { uint length; uint number; uint endBlock; uint distribute; } Epoch public epoch; address public distributor; address public locker; uint public totalBonus; address public warmupContract; uint public warmupPeriod; constructor ( address _ROME, address _sROME, uint _epochLength, uint _firstEpochNumber, uint _firstEpochBlock ) { require( _ROME != address(0) ); ROME = _ROME; require( _sROME != address(0) ); sROME = _sROME; require( _firstEpochNumber != 0); require( _firstEpochBlock != 0); epoch = Epoch({ length: _epochLength, number: _firstEpochNumber, endBlock: _firstEpochBlock, distribute: 0 }); } struct Claim { uint deposit; uint gons; uint expiry; bool lock; // prevents malicious delays } mapping( address => Claim ) public warmupInfo; /** @notice stake ROME to enter warmup @param _amount uint @return bool */ function stake( uint _amount, address _recipient ) external returns ( bool ) { rebase(); IERC20( ROME ).safeTransferFrom( msg.sender, address(this), _amount ); Claim memory info = warmupInfo[ _recipient ]; require( !info.lock, "Deposits for account are locked" ); warmupInfo[ _recipient ] = Claim ({ deposit: info.deposit.add( _amount ), gons: info.gons.add( IsROME( sROME ).gonsForBalance( _amount ) ), expiry: epoch.number.add( warmupPeriod ), lock: false }); IERC20( sROME ).safeTransfer( warmupContract, _amount ); return true; } /** @notice retrieve sROME from warmup @param _recipient address */ function claim ( address _recipient ) public { Claim memory info = warmupInfo[ _recipient ]; if ( epoch.number >= info.expiry && info.expiry != 0 ) { delete warmupInfo[ _recipient ]; IWarmup( warmupContract ).retrieve( _recipient, IsROME( sROME ).balanceForGons( info.gons ) ); } } /** @notice forfeit sROME in warmup and retrieve ROME */ function forfeit() external { Claim memory info = warmupInfo[ msg.sender ]; delete warmupInfo[ msg.sender ]; IWarmup( warmupContract ).retrieve( address(this), IsROME( sROME ).balanceForGons( info.gons ) ); IERC20( ROME ).safeTransfer( msg.sender, info.deposit ); } /** @notice prevent new deposits to address (protection from malicious activity) */ function toggleDepositLock() external { warmupInfo[ msg.sender ].lock = !warmupInfo[ msg.sender ].lock; } /** @notice redeem sROME for ROME @param _amount uint @param _trigger bool */ function unstake( uint _amount, bool _trigger ) external { if ( _trigger ) { rebase(); } IERC20( sROME ).safeTransferFrom( msg.sender, address(this), _amount ); IERC20( ROME ).safeTransfer( msg.sender, _amount ); } /** @notice returns the sROME index, which tracks rebase growth @return uint */ function index() public view returns ( uint ) { return IsROME( sROME ).index(); } /** @notice trigger rebase if epoch over */ function rebase() public { if( epoch.endBlock <= block.number ) { IsROME( sROME ).rebase( epoch.distribute, epoch.number ); epoch.endBlock = epoch.endBlock.add( epoch.length ); epoch.number++; if ( distributor != address(0) ) { IDistributor( distributor ).distribute(); } uint balance = contractBalance(); uint staked = IsROME( sROME ).circulatingSupply(); if( balance <= staked ) { epoch.distribute = 0; } else { epoch.distribute = balance.sub( staked ); } } } /** @notice returns contract ROME holdings, including bonuses provided @return uint */ function contractBalance() public view returns ( uint ) { return IERC20( ROME ).balanceOf( address(this) ).add( totalBonus ); } /** @notice provide bonus to locked staking contract @param _amount uint */ function giveLockBonus( uint _amount ) external { require( msg.sender == locker ); totalBonus = totalBonus.add( _amount ); IERC20( sROME ).safeTransfer( locker, _amount ); } /** @notice reclaim bonus from locked staking contract @param _amount uint */ function returnLockBonus( uint _amount ) external { require( msg.sender == locker ); totalBonus = totalBonus.sub( _amount ); IERC20( sROME ).safeTransferFrom( locker, address(this), _amount ); } enum CONTRACTS { DISTRIBUTOR, WARMUP, LOCKER } /** @notice sets the contract address for LP staking @param _contract address */ function setContract( CONTRACTS _contract, address _address ) external onlyPolicy() { if( _contract == CONTRACTS.DISTRIBUTOR ) { // 0 distributor = _address; } else if ( _contract == CONTRACTS.WARMUP ) { // 1 require( warmupContract == address( 0 ), "Warmup cannot be set more than once" ); warmupContract = _address; } else if ( _contract == CONTRACTS.LOCKER ) { // 2 require( locker == address(0), "Locker cannot be set more than once" ); locker = _address; } } /** * @notice set warmup period for new stakers * @param _warmupPeriod uint */ function setWarmup( uint _warmupPeriod ) external onlyPolicy() { warmupPeriod = _warmupPeriod; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.5; import "../interfaces/IERC20.sol"; import "./SafeMath.sol"; import "./Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ 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"); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; interface IPolicy { function policy() external view returns (address); function renouncePolicy() external; function pushPolicy( address newOwner_ ) external; function pullPolicy() external; } contract Policy is IPolicy { address internal _owner; address internal _newOwner; event OwnershipPushed(address indexed previousOwner, address indexed newOwner); event OwnershipPulled(address indexed previousOwner, address indexed newOwner); constructor () { _owner = msg.sender; emit OwnershipPushed( address(0), _owner ); } function policy() public view override returns (address) { return _owner; } modifier onlyPolicy() { require( _owner == msg.sender, "Ownable: caller is not the owner" ); _; } function renouncePolicy() public virtual override onlyPolicy() { emit OwnershipPushed( _owner, address(0) ); _owner = address(0); } function pushPolicy( address newOwner_ ) public virtual override onlyPolicy() { require( newOwner_ != address(0), "Ownable: new owner is the zero address"); emit OwnershipPushed( _owner, newOwner_ ); _newOwner = newOwner_; } function pullPolicy() public virtual override { require( msg.sender == _newOwner, "Ownable: must be new owner to pull"); emit OwnershipPulled( _owner, _newOwner ); _owner = _newOwner; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.7.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /* * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } // Only used in the BondingCalculator.sol function sqrrt(uint256 a) internal pure returns (uint c) { if (a > 3) { c = a; uint b = add( div( a, 2), 1 ); while (b < c) { c = b; b = div( add( div( a, b ), b), 2 ); } } else if (a != 0) { c = 1; } } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.5; /** * @dev Collection of functions related to the address type */ 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 on 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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, 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); } } } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { 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); } } } function addressToString(address _address) internal pure returns(string memory) { bytes32 _bytes = bytes32(uint256(_address)); bytes memory HEX = "0123456789abcdef"; bytes memory _addr = new bytes(42); _addr[0] = '0'; _addr[1] = 'x'; for(uint256 i = 0; i < 20; i++) { _addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)]; _addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)]; } return string(_addr); } }
{ "optimizer": { "enabled": true, "runs": 9999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_ROME","type":"address"},{"internalType":"address","name":"_sROME","type":"address"},{"internalType":"uint256","name":"_epochLength","type":"uint256"},{"internalType":"uint256","name":"_firstEpochNumber","type":"uint256"},{"internalType":"uint256","name":"_firstEpochBlock","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipPulled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipPushed","type":"event"},{"inputs":[],"name":"ROME","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"length","type":"uint256"},{"internalType":"uint256","name":"number","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"distribute","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"forfeit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"giveLockBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"index","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"policy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pullPolicy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner_","type":"address"}],"name":"pushPolicy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rebase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renouncePolicy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"returnLockBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sROME","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum RomeStaking.CONTRACTS","name":"_contract","type":"uint8"},{"internalType":"address","name":"_address","type":"address"}],"name":"setContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_warmupPeriod","type":"uint256"}],"name":"setWarmup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"stake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleDepositLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_trigger","type":"bool"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"warmupContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"warmupInfo","outputs":[{"internalType":"uint256","name":"deposit","type":"uint256"},{"internalType":"uint256","name":"gons","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"bool","name":"lock","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"warmupPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c060405234801561001057600080fd5b50604051611c65380380611c65833981810160405260a081101561003357600080fd5b50805160208201516040808401516060850151608090950151600080546001600160a01b031916331780825593519596949592949391926001600160a01b0392909216917fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba908290a36001600160a01b0385166100af57600080fd5b6001600160601b0319606086901b166080526001600160a01b0384166100d457600080fd5b6001600160601b0319606085901b1660a052816100f057600080fd5b806100fa57600080fd5b604080516080810182528481526020810184905290810182905260006060909101819052600293909355600391909155600455600555505060805160601c60a05160601c611ac46101a16000398061043b5280610584528061067d52806108fe5280610a285280610a5d5280610d8f5280610fd4528061112f528061133f528061149f5250806108085280610c5d5280610d525280610dc4528061143e5250611ac46000f3fe608060405234801561001057600080fd5b50600436106101a35760003560e01c80639d95fbd2116100ee578063bfe1092811610097578063deac361a11610071578063deac361a146103ce578063ed4acaa8146103d6578063f3d86e4a146103de578063f62ae76a146103e6576101a3565b8063bfe10928146103a1578063c9f464ff146103a9578063d7b96d4e146103c6576101a3565b8063a4b23980116100c8578063a4b2398014610389578063a8dd07dc14610391578063af14052c14610399576101a3565b80639d95fbd2146103365780639ebea88c1461033e578063a15ad07714610363576101a3565b80637acb7757116101505780638b7afe2e1161012a5780638b7afe2e146102f85780638f077b8314610300578063900cf0cf14610308576101a3565b80637acb7757146102815780638147f558146102c1578063865e6fd3146102c9576101a3565b80632986c0e5116101815780632986c0e5146102115780635beede081461022b5780636746f4c214610233576101a3565b806303c23670146101a85780630505c8c9146101c75780631e83409a146101eb575b600080fd5b6101c5600480360360208110156101be57600080fd5b5035610403565b005b6101cf610467565b604080516001600160a01b039092168252519081900360200190f35b6101c56004803603602081101561020157600080fd5b50356001600160a01b0316610476565b610219610679565b60408051918252519081900360200190f35b6101c5610705565b6102596004803603602081101561024957600080fd5b50356001600160a01b03166107c7565b6040805194855260208501939093528383019190915215156060830152519081900360800190f35b6102ad6004803603604081101561029757600080fd5b50803590602001356001600160a01b03166107f1565b604080519115158252519081900360200190f35b6101cf610a5b565b6101c5600480360360408110156102df57600080fd5b50803560ff1690602001356001600160a01b0316610a7f565b610219610c53565b6101c5610cff565b610310610d41565b604080519485526020850193909352838301919091526060830152519081900360800190f35b6101cf610d50565b6101c56004803603604081101561035457600080fd5b50803590602001351515610d74565b6101c56004803603602081101561037957600080fd5b50356001600160a01b0316610deb565b6101c5610f02565b610219610fc3565b6101c5610fc9565b6101cf6111d7565b6101c5600480360360208110156103bf57600080fd5b50356111e6565b6101cf61124a565b610219611259565b6101cf61125f565b6101c561126e565b6101c5600480360360208110156103fc57600080fd5b5035611467565b6007546001600160a01b0316331461041a57600080fd5b60085461042790826114c9565b600855600754610464906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691168361152a565b50565b6000546001600160a01b031690565b61047e611986565b506001600160a01b0381166000908152600b6020908152604091829020825160808101845281548152600182015492810192909252600281015492820183905260039081015460ff1615156060830152549091118015906104e25750604081015115155b15610675576001600160a01b038083166000908152600b60209081526040808320838155600181018490556002810193909355600390920180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556009548482015183517f7965d56d000000000000000000000000000000000000000000000000000000008152600481019190915292519084169363c3a2a6659387937f000000000000000000000000000000000000000000000000000000000000000090921692637965d56d92602480840193919291829003018186803b1580156105ca57600080fd5b505afa1580156105de573d6000803e3d6000fd5b505050506040513d60208110156105f457600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b039093166004840152602483019190915251604480830192600092919082900301818387803b15801561065c57600080fd5b505af1158015610670573d6000803e3d6000fd5b505050505b5050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632986c0e56040518163ffffffff1660e01b815260040160206040518083038186803b1580156106d457600080fd5b505afa1580156106e8573d6000803e3d6000fd5b505050506040513d60208110156106fe57600080fd5b5051905090565b6001546001600160a01b0316331461074e5760405162461bcd60e51b8152600401808060200182810382526022815260200180611a1d6022913960400191505060405180910390fd5b600154600080546040516001600160a01b0393841693909116917faa151555690c956fc3ea32f106bb9f119b5237a061eaa8557cff3e51e3792c8d91a3600154600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03909216919091179055565b600b6020526000908152604090208054600182015460028301546003909301549192909160ff1684565b60006107fb610fc9565b6108306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330866115af565b610838611986565b506001600160a01b0382166000908152600b602090815260409182902082516080810184528154815260018201549281019290925260028101549282019290925260039091015460ff1615801560608301526108db576040805162461bcd60e51b815260206004820152601f60248201527f4465706f7369747320666f72206163636f756e7420617265206c6f636b656400604482015290519081900360640190fd5b6040805160808101909152815181906108f490876114c9565b81526020016109977f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631bd39674886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561096057600080fd5b505afa158015610974573d6000803e3d6000fd5b505050506040513d602081101561098a57600080fd5b50516020850151906114c9565b8152600a546003546020909201916109ae916114c9565b8152600060209182018190526001600160a01b038681168252600b835260409182902084518155928401516001840155908301516002830155606090920151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055600954610a51917f0000000000000000000000000000000000000000000000000000000000000000811691168661152a565b5060019392505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b03163314610ade576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000826002811115610aec57fe5b1415610b2a57600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316179055610675565b6001826002811115610b3857fe5b1415610bbe576009546001600160a01b031615610b865760405162461bcd60e51b81526004018080602001828103825260238152602001806119fa6023913960400191505060405180910390fd5b600980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316179055610675565b6002826002811115610bcc57fe5b1415610675576007546001600160a01b031615610c1a5760405162461bcd60e51b81526004018080602001828103825260238152602001806119b16023913960400191505060405180910390fd5b600780546001600160a01b0383167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b6000610cfa6008547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610cc857600080fd5b505afa158015610cdc573d6000803e3d6000fd5b505050506040513d6020811015610cf257600080fd5b5051906114c9565b905090565b336000908152600b6020526040902060030180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00811660ff90911615179055565b60025460035460045460055484565b7f000000000000000000000000000000000000000000000000000000000000000081565b8015610d8257610d82610fc9565b610db76001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330856115af565b6106756001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338461152a565b6000546001600160a01b03163314610e4a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610e8f5760405162461bcd60e51b81526004018080602001828103825260268152602001806119d46026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba91a3600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610f61576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907fea8258f2d9ddb679928cf34b78cf645b7feda9acc828e4dd82d014eaae270eba908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60085481565b60045443106111d5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663058ecdb46002600301546002600101546040518363ffffffff1660e01b81526004018083815260200182815260200192505050602060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b505050506040513d602081101561107457600080fd5b5050600254600454611085916114c9565b6004556003805460010190556006546001600160a01b03161561111f57600660009054906101000a90046001600160a01b03166001600160a01b031663e4fc6b6d6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156110f257600080fd5b505af1158015611106573d6000803e3d6000fd5b505050506040513d602081101561111c57600080fd5b50505b6000611129610c53565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639358928b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561118657600080fd5b505afa15801561119a573d6000803e3d6000fd5b505050506040513d60208110156111b057600080fd5b505190508082116111c5576000600555610675565b6111cf828261163d565b60055550505b565b6006546001600160a01b031681565b6000546001600160a01b03163314611245576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600a55565b6007546001600160a01b031681565b600a5481565b6009546001600160a01b031681565b611276611986565b50336000818152600b602081815260408084208151608081018352815481526001820180548286019081526002840180548487015260038501805460ff8116151560608701529a8a529787529388905590879055959091557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909516909255600954925182517f7965d56d000000000000000000000000000000000000000000000000000000008152600481019190915291516001600160a01b039384169363c3a2a6659330937f000000000000000000000000000000000000000000000000000000000000000090921692637965d56d92602480840193919291829003018186803b15801561138557600080fd5b505afa158015611399573d6000803e3d6000fd5b505050506040513d60208110156113af57600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b039093166004840152602483019190915251604480830192600092919082900301818387803b15801561141757600080fd5b505af115801561142b573d6000803e3d6000fd5b5050825161046492506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169150339061152a565b6007546001600160a01b0316331461147e57600080fd5b60085461148b908261163d565b600855600754610464906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911630846115af565b600082820183811015611523576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526115aa90849061169a565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261163790859061169a565b50505050565b600082821115611694576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60606116ef826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661174b9092919063ffffffff16565b8051909150156115aa5780806020019051602081101561170e57600080fd5b50516115aa5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a65602a913960400191505060405180910390fd5b606061175a8484600085611762565b949350505050565b6060824710156117a35760405162461bcd60e51b8152600401808060200182810382526026815260200180611a3f6026913960400191505060405180910390fd5b6117ac856118dc565b6117fd576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061185a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161181d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146118bc576040519150601f19603f3d011682016040523d82523d6000602084013e6118c1565b606091505b50915091506118d18282866118e2565b979650505050505050565b3b151590565b606083156118f1575081611523565b8251156119015782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561194b578181015183820152602001611933565b50505050905090810190601f1680156119785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060800160405280600081526020016000815260200160008152602001600015158152509056fe4c6f636b65722063616e6e6f7420626520736574206d6f7265207468616e206f6e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735761726d75702063616e6e6f7420626520736574206d6f7265207468616e206f6e63654f776e61626c653a206d757374206265206e6577206f776e657220746f2070756c6c416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212209fe77fb45baffef2ffebd19c422dc8791a1913419cb23555942023a7f7ebde4664736f6c634300070500330000000000000000000000004a436073552044d5f2f49b176853ad3ad473d9d600000000000000000000000089f52002e544585b42f8c7cf557609ca4c8ce12a0000000000000000000000000000000000000000000000000000000000000898000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f29c6
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004a436073552044d5f2f49b176853ad3ad473d9d600000000000000000000000089f52002e544585b42f8c7cf557609ca4c8ce12a0000000000000000000000000000000000000000000000000000000000000898000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f29c6
-----Decoded View---------------
Arg [0] : _ROME (address): 0x4a436073552044d5f2f49b176853ad3ad473d9d6
Arg [1] : _sROME (address): 0x89f52002e544585b42f8c7cf557609ca4c8ce12a
Arg [2] : _epochLength (uint256): 2200
Arg [3] : _firstEpochNumber (uint256): 1
Arg [4] : _firstEpochBlock (uint256): 993734
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000004a436073552044d5f2f49b176853ad3ad473d9d6
Arg [1] : 00000000000000000000000089f52002e544585b42f8c7cf557609ca4c8ce12a
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000898
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [4] : 00000000000000000000000000000000000000000000000000000000000f29c6
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.