Contract Address Details

0x2e7d17ABCb9a2a40ec482B2ac9a9F811c12Bf630

Contract Name
Boardroom
Creator
0x062f27–4a1ce0 at 0x18b7b1–75eb1a
Balance
0 CRO ( )
Tokens
Fetching tokens...
Transactions
150,330 Transactions
Transfers
223,662 Transfers
Gas Used
21,648,608,540
Last Balance Update
13637310
Contract name:
Boardroom




Optimization enabled
true
Compiler version
v0.6.12+commit.27d51765




Optimization runs
999
EVM Version
default




Verified at
2022-01-12T07:53:13.689227Z

Contract source code

// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;

/**
 * @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);
}


/**
 * @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;
    }
}


/**
 * @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);
    }

    /**
     * @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);
            }
        }
    }
}


/**
 * @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");
        }
    }
}

contract ContractGuard {
    mapping(uint256 => mapping(address => bool)) private _status;

    function checkSameOriginReentranted() internal view returns (bool) {
        return _status[block.number][tx.origin];
    }

    function checkSameSenderReentranted() internal view returns (bool) {
        return _status[block.number][msg.sender];
    }

    modifier onlyOneBlock() {
        require(!checkSameOriginReentranted(), "ContractGuard: one block, one function");
        require(!checkSameSenderReentranted(), "ContractGuard: one block, one function");

        _status[block.number][tx.origin] = true;
        _status[block.number][msg.sender] = true;

        _;
    }
}

interface IBasisAsset {
    function mint(address recipient, uint256 amount) external returns (bool);

    function burn(uint256 amount) external;

    function burnFrom(address from, uint256 amount) external;

    function isOperator() external returns (bool);

    function operator() external view returns (address);

    function transferOperator(address newOperator_) external;
}


interface ITreasury {
    function epoch() external view returns (uint256);

    function nextEpochPoint() external view returns (uint256);

    function getDarkPrice() external view returns (uint256);

    function buyBonds(uint256 amount, uint256 targetPrice) external;

    function redeemBonds(uint256 amount, uint256 targetPrice) external;
}


contract Boardroom is ContractGuard {
    using SafeERC20 for IERC20;
    using Address for address;
    using SafeMath for uint256;

    /* ========== DATA STRUCTURES ========== */

    struct Boardseat {
        uint256 lastSnapshotIndex;
        uint256 rewardEarned;
        uint256 epochTimerStart;
    }

    struct BoardroomSnapshot {
        uint256 time;
        uint256 rewardReceived;
        uint256 rewardPerShare;
    }

    /* ========== STATE VARIABLES ========== */

    IERC20 public sky;

    uint256 private _totalSupply;
    mapping(address => uint256) private _balances;

    // governance
    address public operator;

    // flags
    bool public initialized = false;

    IERC20 public dark;
    ITreasury public treasury;

    mapping(address => Boardseat) public directors;
    BoardroomSnapshot[] public boardHistory;

    uint256 public withdrawLockupEpochs;
    uint256 public rewardLockupEpochs;

    address public reserveFund;
    uint256 public withdrawFee;
    uint256 public stakeFee;

    /* ========== EVENTS ========== */

    event Initialized(address indexed executor, uint256 at);
    event Staked(address indexed user, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);
    event RewardAdded(address indexed user, uint256 reward);

    /* ========== Modifiers =============== */

    modifier onlyOperator() {
        require(operator == msg.sender, "Boardroom: caller is not the operator");
        _;
    }

    modifier directorExists {
        require(balanceOf(msg.sender) > 0, "Boardroom: The director does not exist");
        _;
    }

    modifier updateReward(address director) {
        if (director != address(0)) {
            Boardseat memory seat = directors[director];
            seat.rewardEarned = earned(director);
            seat.lastSnapshotIndex = latestSnapshotIndex();
            directors[director] = seat;
        }
        _;
    }

    modifier notInitialized {
        require(!initialized, "Boardroom: already initialized");
        _;
    }

    /* ========== GOVERNANCE ========== */

    function initialize(
        IERC20 _dark,
        IERC20 _sky,
        ITreasury _treasury
    ) public notInitialized {
        dark = _dark;
        sky = _sky;
        treasury = _treasury;

        stakeFee = 2;
        withdrawFee = 0;

        BoardroomSnapshot memory genesisSnapshot = BoardroomSnapshot({time : block.number, rewardReceived : 0, rewardPerShare : 0});
        boardHistory.push(genesisSnapshot);

        withdrawLockupEpochs = 6; // Lock for 6 epochs (48h) before release withdraw
        rewardLockupEpochs = 3; // Lock for 3 epochs (24h) before release claimReward

        initialized = true;
        operator = msg.sender;
        emit Initialized(msg.sender, block.number);
    }

    function setOperator(address _operator) external onlyOperator {
        operator = _operator;
    }

    function setLockUp(uint256 _withdrawLockupEpochs, uint256 _rewardLockupEpochs) external onlyOperator {
        require(_withdrawLockupEpochs >= _rewardLockupEpochs && _withdrawLockupEpochs <= 42, "_withdrawLockupEpochs: out of range"); // <= 2 week
        withdrawLockupEpochs = _withdrawLockupEpochs;
        rewardLockupEpochs = _rewardLockupEpochs;
    }

    function setReserveFund(address _reserveFund) external onlyOperator {
        require(_reserveFund != address(0), "reserveFund address cannot be 0 address");
        reserveFund = _reserveFund;
    }

    function setStakeFee(uint256 _stakeFee) external onlyOperator {
        require(_stakeFee <= 5, "Max stake fee is 5%");
        stakeFee = _stakeFee;
    }

    function setWithdrawFee(uint256 _withdrawFee) external onlyOperator {
        require(_withdrawFee <= 20, "Max withdraw fee is 20%");
        withdrawFee = _withdrawFee;
    }

    /* ========== VIEW FUNCTIONS ========== */

    // =========== Snapshot getters

    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    function latestSnapshotIndex() public view returns (uint256) {
        return boardHistory.length.sub(1);
    }

    function getLatestSnapshot() internal view returns (BoardroomSnapshot memory) {
        return boardHistory[latestSnapshotIndex()];
    }

    function getLastSnapshotIndexOf(address director) public view returns (uint256) {
        return directors[director].lastSnapshotIndex;
    }

    function getLastSnapshotOf(address director) internal view returns (BoardroomSnapshot memory) {
        return boardHistory[getLastSnapshotIndexOf(director)];
    }

    function canWithdraw(address director) external view returns (bool) {
        return directors[director].epochTimerStart.add(withdrawLockupEpochs) <= treasury.epoch();
    }

    function canClaimReward(address director) external view returns (bool) {
        return directors[director].epochTimerStart.add(rewardLockupEpochs) <= treasury.epoch();
    }

    function epoch() external view returns (uint256) {
        return treasury.epoch();
    }

    function nextEpochPoint() external view returns (uint256) {
        return treasury.nextEpochPoint();
    }

    function getDarkPrice() external view returns (uint256) {
        return treasury.getDarkPrice();
    }

    // =========== Director getters

    function rewardPerShare() public view returns (uint256) {
        return getLatestSnapshot().rewardPerShare;
    }

    function earned(address director) public view returns (uint256) {
        uint256 latestRPS = getLatestSnapshot().rewardPerShare;
        uint256 storedRPS = getLastSnapshotOf(director).rewardPerShare;

        return balanceOf(director).mul(latestRPS.sub(storedRPS)).div(1e18).add(directors[director].rewardEarned);
    }

    /* ========== MUTATIVE FUNCTIONS ========== */

    function stake(uint256 amount) public onlyOneBlock updateReward(msg.sender) {
        require(amount > 0, "Boardroom: Cannot stake 0");
        sky.safeTransferFrom(msg.sender, address(this), amount);
        if (stakeFee > 0) {
            uint256 feeAmount = amount.mul(stakeFee).div(100);
            sky.safeTransfer(reserveFund, feeAmount);
            amount = amount.sub(feeAmount);
        }
        _totalSupply = _totalSupply.add(amount);
        _balances[msg.sender] = _balances[msg.sender].add(amount);
        directors[msg.sender].epochTimerStart = treasury.epoch(); // reset timer
        emit Staked(msg.sender, amount);
    }

    function withdraw(uint256 amount) public onlyOneBlock directorExists updateReward(msg.sender) {
        require(amount > 0, "Boardroom: Cannot withdraw 0");
        require(directors[msg.sender].epochTimerStart.add(withdrawLockupEpochs) <= treasury.epoch(), "Boardroom: still in withdraw lockup");
        claimReward();
        uint256 directorShare = _balances[msg.sender];
        require(directorShare >= amount, "Boardroom: withdraw request greater than staked amount");
        _totalSupply = _totalSupply.sub(amount);
        _balances[msg.sender] = directorShare.sub(amount);
        if (withdrawFee > 0) {
            uint256 feeAmount = amount.mul(withdrawFee).div(100);
            sky.safeTransfer(reserveFund, feeAmount);
            amount = amount.sub(feeAmount);
        }
        sky.safeTransfer(msg.sender, amount);
        emit Withdrawn(msg.sender, amount);
    }

    function exit() external {
        withdraw(balanceOf(msg.sender));
    }

    function claimReward() public updateReward(msg.sender) {
        uint256 reward = directors[msg.sender].rewardEarned;
        if (reward > 0) {
            require(directors[msg.sender].epochTimerStart.add(rewardLockupEpochs) <= treasury.epoch(), "Boardroom: still in reward lockup");
            directors[msg.sender].epochTimerStart = treasury.epoch(); // reset timer
            directors[msg.sender].rewardEarned = 0;
            dark.safeTransfer(msg.sender, reward);
            emit RewardPaid(msg.sender, reward);
        }
    }

    function allocateSeigniorage(uint256 amount) external onlyOneBlock onlyOperator {
        require(amount > 0, "Boardroom: Cannot allocate 0");
        require(totalSupply() > 0, "Boardroom: Cannot allocate when totalSupply is 0");

        // Create & add new snapshot
        uint256 prevRPS = getLatestSnapshot().rewardPerShare;
        uint256 nextRPS = prevRPS.add(amount.mul(1e18).div(totalSupply()));

        BoardroomSnapshot memory newSnapshot = BoardroomSnapshot({
            time: block.number,
            rewardReceived: amount,
            rewardPerShare: nextRPS
        });
        boardHistory.push(newSnapshot);

        dark.safeTransferFrom(msg.sender, address(this), amount);
        emit RewardAdded(msg.sender, amount);
    }

    function governanceRecoverUnsupported(IERC20 _token, uint256 _amount, address _to) external onlyOperator {
        // do not allow to drain core tokens
        require(address(_token) != address(dark), "dark");
        require(address(_token) != address(sky), "sky");
        _token.safeTransfer(_to, _amount);
    }
}
        

Contract ABI

[{"type":"event","name":"Initialized","inputs":[{"type":"address","name":"executor","internalType":"address","indexed":true},{"type":"uint256","name":"at","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardAdded","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"reward","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardPaid","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"reward","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Staked","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Withdrawn","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"allocateSeigniorage","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"time","internalType":"uint256"},{"type":"uint256","name":"rewardReceived","internalType":"uint256"},{"type":"uint256","name":"rewardPerShare","internalType":"uint256"}],"name":"boardHistory","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"canClaimReward","inputs":[{"type":"address","name":"director","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"canWithdraw","inputs":[{"type":"address","name":"director","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimReward","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"dark","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"lastSnapshotIndex","internalType":"uint256"},{"type":"uint256","name":"rewardEarned","internalType":"uint256"},{"type":"uint256","name":"epochTimerStart","internalType":"uint256"}],"name":"directors","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"earned","inputs":[{"type":"address","name":"director","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"epoch","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"exit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getDarkPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLastSnapshotIndexOf","inputs":[{"type":"address","name":"director","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"governanceRecoverUnsupported","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"address","name":"_to","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_dark","internalType":"contract IERC20"},{"type":"address","name":"_sky","internalType":"contract IERC20"},{"type":"address","name":"_treasury","internalType":"contract ITreasury"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"initialized","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"latestSnapshotIndex","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nextEpochPoint","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"operator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"reserveFund","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardLockupEpochs","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPerShare","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLockUp","inputs":[{"type":"uint256","name":"_withdrawLockupEpochs","internalType":"uint256"},{"type":"uint256","name":"_rewardLockupEpochs","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setOperator","inputs":[{"type":"address","name":"_operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setReserveFund","inputs":[{"type":"address","name":"_reserveFund","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setStakeFee","inputs":[{"type":"uint256","name":"_stakeFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWithdrawFee","inputs":[{"type":"uint256","name":"_withdrawFee","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"sky","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stake","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"stakeFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ITreasury"}],"name":"treasury","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawLockupEpochs","inputs":[]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102405760003560e01c806370a0823111610145578063b88a802f116100bd578063e941fa781161008c578063f0ec943011610071578063f0ec94301461051f578063f498d8a614610563578063fd147b7f1461058957610240565b8063e941fa781461050f578063e9fad8ee1461051757610240565b8063b88a802f146104aa578063c0c53b8b146104b2578063c5967c26146104ea578063e2d7bee4146104f257610240565b806397ffe1d711610114578063b3ab15fb116100f9578063b3ab15fb1461045f578063b6ac642a14610485578063b7f92b71146104a257610240565b806397ffe1d714610425578063a694fc3a1461044257610240565b806370a08231146103c9578063714b4658146103ef5780638f0e0e5114610415578063900cf0cf1461041d57610240565b80632e1a7d4d116101d857806354575af4116101a75780635c59f76e1161018c5780635c59f76e146103b157806361d027b3146103b957806369231804146103c157610240565b806354575af414610357578063570ca7351461038d57610240565b80632e1a7d4d146103055780632ffaaa09146103245780633f9e3f0414610347578063446a2ec81461034f57610240565b806318160ddd1161021457806318160ddd146102c757806319262d30146102cf5780631e85cd65146102f5578063222c9777146102fd57610240565b80628cc26214610245578063022ba18d1461027d578063046335d014610285578063158ef93e146102bf575b600080fd5b61026b6004803603602081101561025b57600080fd5b50356001600160a01b03166105a6565b60408051918252519081900360200190f35b61026b610627565b6102ab6004803603602081101561029b57600080fd5b50356001600160a01b031661062d565b604080519115158252519081900360200190f35b6102ab6106ce565b61026b6106de565b6102ab600480360360208110156102e557600080fd5b50356001600160a01b03166106e4565b61026b61077d565b61026b610783565b6103226004803603602081101561031b57600080fd5b5035610789565b005b6103226004803603604081101561033a57600080fd5b5080359060200135610b79565b61026b610c19565b61026b610c2f565b6103226004803603606081101561036d57600080fd5b506001600160a01b03813581169160208101359160409091013516610c42565b610395610d6c565b604080516001600160a01b039092168252519081900360200190f35b61026b610d7b565b610395610e0a565b610395610e19565b61026b600480360360208110156103df57600080fd5b50356001600160a01b0316610e28565b61026b6004803603602081101561040557600080fd5b50356001600160a01b0316610e43565b610395610e5e565b61026b610e6d565b6103226004803603602081101561043b57600080fd5b5035610eb2565b6103226004803603602081101561045857600080fd5b5035611193565b6103226004803603602081101561047557600080fd5b50356001600160a01b03166114a7565b6103226004803603602081101561049b57600080fd5b503561151f565b6103956115c3565b6103226115d2565b610322600480360360608110156104c857600080fd5b506001600160a01b038135811691602081013582169160409091013516611849565b61026b611a3a565b6103226004803603602081101561050857600080fd5b5035611a98565b61026b611b3c565b610322611b42565b6105456004803603602081101561053557600080fd5b50356001600160a01b0316611b55565b60408051938452602084019290925282820152519081900360600190f35b6103226004803603602081101561057957600080fd5b50356001600160a01b0316611b76565b6105456004803603602081101561059f57600080fd5b5035611c33565b6000806105b1611c63565b60400151905060006105c284611cbb565b6040908101516001600160a01b03861660009081526007602052919091206001015490915061061f90610619670de0b6b3a76400006106136106048787611d16565b61060d8a610e28565b90611d78565b90611dd8565b90611e3f565b949350505050565b600a5481565b6006546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561067257600080fd5b505afa158015610686573d6000803e3d6000fd5b505050506040513d602081101561069c57600080fd5b5051600a546001600160a01b0384166000908152600760205260409020600201546106c691611e3f565b111592915050565b600454600160a01b900460ff1681565b60025490565b6006546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b15801561072957600080fd5b505afa15801561073d573d6000803e3d6000fd5b505050506040513d602081101561075357600080fd5b50516009546001600160a01b0384166000908152600760205260409020600201546106c691611e3f565b60095481565b600d5481565b610791611e99565b156107cd5760405162461bcd60e51b81526004018080602001828103825260268152602001806123dc6026913960400191505060405180910390fd5b6107d5611eb8565b156108115760405162461bcd60e51b81526004018080602001828103825260268152602001806123dc6026913960400191505060405180910390fd5b436000908152602081815260408083203284529091528082208054600160ff199182168117909255338085529284208054909116909117905561085390610e28565b1161088f5760405162461bcd60e51b81526004018080602001828103825260268152602001806123696026913960400191505060405180910390fd5b3380156109295761089e612266565b506001600160a01b03811660009081526007602090815260409182902082516060810184528154815260018201549281019290925260020154918101919091526108e7826105a6565b60208201526108f4610c19565b81526001600160a01b038216600090815260076020908152604091829020835181559083015160018201559101516002909101555b6000821161097e576040805162461bcd60e51b815260206004820152601c60248201527f426f617264726f6f6d3a2043616e6e6f74207769746864726177203000000000604482015290519081900360640190fd5b600660009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109cc57600080fd5b505afa1580156109e0573d6000803e3d6000fd5b505050506040513d60208110156109f657600080fd5b505160095433600090815260076020526040902060020154610a1791611e3f565b1115610a545760405162461bcd60e51b815260040180806020018281038252602381526020018061238f6023913960400191505060405180910390fd5b610a5c6115d2565b3360009081526003602052604090205482811015610aab5760405162461bcd60e51b81526004018080602001828103825260368152602001806124026036913960400191505060405180910390fd5b600254610ab89084611d16565b600255610ac58184611d16565b33600090815260036020526040902055600c5415610b27576000610af96064610613600c5487611d7890919063ffffffff16565b600b54600154919250610b19916001600160a01b03908116911683611ed7565b610b238482611d16565b9350505b600154610b3e906001600160a01b03163385611ed7565b60408051848152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a2505050565b6004546001600160a01b03163314610bc25760405162461bcd60e51b81526004018080602001828103825260258152602001806123446025913960400191505060405180910390fd5b808210158015610bd35750602a8211155b610c0e5760405162461bcd60e51b81526004018080602001828103825260238152602001806123216023913960400191505060405180910390fd5b600991909155600a55565b600854600090610c2a906001611d16565b905090565b6000610c39611c63565b60400151905090565b6004546001600160a01b03163314610c8b5760405162461bcd60e51b81526004018080602001828103825260258152602001806123446025913960400191505060405180910390fd5b6005546001600160a01b0384811691161415610cf0576040805162461bcd60e51b8152602060048083019190915260248201527f6461726b00000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6001546001600160a01b0384811691161415610d53576040805162461bcd60e51b815260206004820152600360248201527f736b790000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b610d676001600160a01b0384168284611ed7565b505050565b6004546001600160a01b031681565b600654604080517f5c59f76e00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b031691635c59f76e916004808301926020929190829003018186803b158015610dd957600080fd5b505afa158015610ded573d6000803e3d6000fd5b505050506040513d6020811015610e0357600080fd5b5051905090565b6006546001600160a01b031681565b6001546001600160a01b031681565b6001600160a01b031660009081526003602052604090205490565b6001600160a01b031660009081526007602052604090205490565b6005546001600160a01b031681565b6006546040805163900cf0cf60e01b815290516000926001600160a01b03169163900cf0cf916004808301926020929190829003018186803b158015610dd957600080fd5b610eba611e99565b15610ef65760405162461bcd60e51b81526004018080602001828103825260268152602001806123dc6026913960400191505060405180910390fd5b610efe611eb8565b15610f3a5760405162461bcd60e51b81526004018080602001828103825260268152602001806123dc6026913960400191505060405180910390fd5b436000908152602081815260408083203284529091528082208054600160ff19918216811790925533808552929093208054909316179091556004546001600160a01b031614610fbb5760405162461bcd60e51b81526004018080602001828103825260258152602001806123446025913960400191505060405180910390fd5b60008111611010576040805162461bcd60e51b815260206004820152601c60248201527f426f617264726f6f6d3a2043616e6e6f7420616c6c6f63617465203000000000604482015290519081900360640190fd5b600061101a6106de565b116110565760405162461bcd60e51b81526004018080602001828103825260308152602001806122886030913960400191505060405180910390fd5b6000611060611c63565b604001519050600061108f6110886110766106de565b61061386670de0b6b3a7640000611d78565b8390611e3f565b9050611099612266565b5060408051606081018252438152602081018581529181018381526008805460018101825560009190915282517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee360039092029182015592517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee4840155517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee590920191909155600554611157906001600160a01b0316333087611f57565b60408051858152905133917fac24935fd910bc682b5ccb1a07b718cadf8cf2f6d1404c4f3ddc3662dae40e29919081900360200190a250505050565b61119b611e99565b156111d75760405162461bcd60e51b81526004018080602001828103825260268152602001806123dc6026913960400191505060405180910390fd5b6111df611eb8565b1561121b5760405162461bcd60e51b81526004018080602001828103825260268152602001806123dc6026913960400191505060405180910390fd5b436000908152602081815260408083203284529091528082208054600160ff199182168117909255338085529290932080549093161790915580156112ed57611262612266565b506001600160a01b03811660009081526007602090815260409182902082516060810184528154815260018201549281019290925260020154918101919091526112ab826105a6565b60208201526112b8610c19565b81526001600160a01b038216600090815260076020908152604091829020835181559083015160018201559101516002909101555b60008211611342576040805162461bcd60e51b815260206004820152601960248201527f426f617264726f6f6d3a2043616e6e6f74207374616b65203000000000000000604482015290519081900360640190fd5b60015461135a906001600160a01b0316333085611f57565b600d54156113ac57600061137e6064610613600d5486611d7890919063ffffffff16565b600b5460015491925061139e916001600160a01b03908116911683611ed7565b6113a88382611d16565b9250505b6002546113b99083611e3f565b600255336000908152600360205260409020546113d69083611e3f565b3360009081526003602090815260409182902092909255600654815163900cf0cf60e01b815291516001600160a01b039091169263900cf0cf9260048082019391829003018186803b15801561142b57600080fd5b505afa15801561143f573d6000803e3d6000fd5b505050506040513d602081101561145557600080fd5b505133600081815260076020908152604091829020600201939093558051858152905191927f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d92918290030190a25050565b6004546001600160a01b031633146114f05760405162461bcd60e51b81526004018080602001828103825260258152602001806123446025913960400191505060405180910390fd5b6004805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6004546001600160a01b031633146115685760405162461bcd60e51b81526004018080602001828103825260258152602001806123446025913960400191505060405180910390fd5b60148111156115be576040805162461bcd60e51b815260206004820152601760248201527f4d61782077697468647261772066656520697320323025000000000000000000604482015290519081900360640190fd5b600c55565b600b546001600160a01b031681565b33801561166c576115e1612266565b506001600160a01b038116600090815260076020908152604091829020825160608101845281548152600182015492810192909252600201549181019190915261162a826105a6565b6020820152611637610c19565b81526001600160a01b038216600090815260076020908152604091829020835181559083015160018201559101516002909101555b33600090815260076020526040902060010154801561184557600660009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116d357600080fd5b505afa1580156116e7573d6000803e3d6000fd5b505050506040513d60208110156116fd57600080fd5b5051600a543360009081526007602052604090206002015461171e91611e3f565b111561175b5760405162461bcd60e51b81526004018080602001828103825260218152602001806123006021913960400191505060405180910390fd5b600660009054906101000a90046001600160a01b03166001600160a01b031663900cf0cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117a957600080fd5b505afa1580156117bd573d6000803e3d6000fd5b505050506040513d60208110156117d357600080fd5b5051336000818152600760205260408120600281019390935560019092019190915560055461180e916001600160a01b039091169083611ed7565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a25b5050565b600454600160a01b900460ff16156118a8576040805162461bcd60e51b815260206004820152601e60248201527f426f617264726f6f6d3a20616c726561647920696e697469616c697a65640000604482015290519081900360640190fd5b600580546001600160a01b0380861673ffffffffffffffffffffffffffffffffffffffff19928316179092556001805485841690831617905560068054928416929091169190911790556002600d556000600c55611904612266565b50604080516060810182524380825260006020808401828152848601838152600880546001810182559452855160039485027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee381019190915591517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee4830155517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee5909101556006600955600a919091556004805473ffffffffffffffffffffffffffffffffffffffff197fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909116600160a01b171633908117909155845192835293519293927f25ff68dd81b34665b5ba7e553ee5511bf6812e12adb4a7e2c0d9e26b3099ce799281900390910190a250505050565b600654604080517fc5967c2600000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163c5967c26916004808301926020929190829003018186803b158015610dd957600080fd5b6004546001600160a01b03163314611ae15760405162461bcd60e51b81526004018080602001828103825260258152602001806123446025913960400191505060405180910390fd5b6005811115611b37576040805162461bcd60e51b815260206004820152601360248201527f4d6178207374616b652066656520697320352500000000000000000000000000604482015290519081900360640190fd5b600d55565b600c5481565b611b53611b4e33610e28565b610789565b565b60076020526000908152604090208054600182015460029092015490919083565b6004546001600160a01b03163314611bbf5760405162461bcd60e51b81526004018080602001828103825260258152602001806123446025913960400191505060405180910390fd5b6001600160a01b038116611c045760405162461bcd60e51b81526004018080602001828103825260278152602001806122b86027913960400191505060405180910390fd5b600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60088181548110611c4057fe5b600091825260209091206003909102018054600182015460029092015490925083565b611c6b612266565b6008611c75610c19565b81548110611c7f57fe5b90600052602060002090600302016040518060600160405290816000820154815260200160018201548152602001600282015481525050905090565b611cc3612266565b6008611cce83610e43565b81548110611cd857fe5b906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820154815250509050919050565b600082821115611d6d576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b600082611d8757506000611d72565b82820282848281611d9457fe5b0414611dd15760405162461bcd60e51b81526004018080602001828103825260218152602001806122df6021913960400191505060405180910390fd5b9392505050565b6000808211611e2e576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611e3757fe5b049392505050565b600082820183811015611dd1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b4360009081526020818152604080832032845290915290205460ff1690565b4360009081526020818152604080832033845290915290205460ff1690565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610d67908490611fe5565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611fdf908590611fe5565b50505050565b606061203a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120969092919063ffffffff16565b805190915015610d675780806020019051602081101561205957600080fd5b5051610d675760405162461bcd60e51b815260040180806020018281038252602a8152602001806123b2602a913960400191505060405180910390fd5b606061061f8484600085856120aa856121bc565b6120fb576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061213a5780518252601f19909201916020918201910161211b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461219c576040519150601f19603f3d011682016040523d82523d6000602084013e6121a1565b606091505b50915091506121b18282866121c2565b979650505050505050565b3b151590565b606083156121d1575081611dd1565b8251156121e15782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561222b578181015183820152602001612213565b50505050905090810190601f1680156122585780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060600160405280600081526020016000815260200160008152509056fe426f617264726f6f6d3a2043616e6e6f7420616c6c6f63617465207768656e20746f74616c537570706c7920697320307265736572766546756e6420616464726573732063616e6e6f7420626520302061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77426f617264726f6f6d3a207374696c6c20696e20726577617264206c6f636b75705f77697468647261774c6f636b757045706f6368733a206f7574206f662072616e6765426f617264726f6f6d3a2063616c6c6572206973206e6f7420746865206f70657261746f72426f617264726f6f6d3a20546865206469726563746f7220646f6573206e6f74206578697374426f617264726f6f6d3a207374696c6c20696e207769746864726177206c6f636b75705361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564436f6e747261637447756172643a206f6e6520626c6f636b2c206f6e652066756e6374696f6e426f617264726f6f6d3a20776974686472617720726571756573742067726561746572207468616e207374616b656420616d6f756e74a26469706673582212207c615a5326d3952c9abb8efc25f2b693527b6577635b9f79619b98975731c0d764736f6c634300060c0033