ETH Price: $2,412.29 (-0.46%)
Gas: 2.14 Gwei

Token

ERC20 ***
 

Overview

Max Total Supply

26.556265075826355036 ERC20 ***

Holders

16

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Filtered by Token Holder
methodses.eth
Balance
0.000000000000005022 ERC20 ***

Value
$0.00
0xc02c6577c2172f420d6aedcb2e65591270f1e804
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
YieldDelegatingVault

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-10-13
*/

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;


// 
/**
 * @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 Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

// 
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// 
/**
 * @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, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// 
/**
 * @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 in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return _functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

// 
/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;
    using Address for address;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name, string memory symbol) public {
        _name = name;
        _symbol = symbol;
        _decimals = 18;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20};
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

// 
contract YieldDelegatingVaultEvent {
    /// @notice Emitted when set new treasury
    event NewTreasury(address oldTreasury, address newTreasury);
    
    /// @notice Emitted when set new delegate percent
    event NewDelegatePercent(uint256 oldDelegatePercent, uint256 newDelegatePercent);

    /// @notice Emitted when set new global deposit cap
    event NewGlobalDepositCap(uint256 oldGlobalDepositCap, uint256 newGlobalDepositCap);
    
    /// @notice Emitted when set new individual deposit cap
    event NewIndividualDepositCap(uint256 oldInvidivualDepositCap, uint256 newInvidivualDepositCap);
    
    /// @notice Emitted when a minter is added by admin
    event NewRewardPerToken(uint256 oldRewardPerToken, uint256 newRewardPerToken);
    
    /// @notice Emitted when a reward paid
    event RewardPaid(address account, uint256 reward);
}

// 
/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
 * (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint256(_at(set._inner, index)));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

// 
/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// 
contract YDVRewardsDistributor is AccessControl, Ownable {
    using SafeERC20 for IERC20;
    using Address for address;

    IERC20 public rewardToken;
    address[] public ydvs;
    bytes32 public constant YDV_REWARDS = keccak256("YDV_REWARDS");
    
    constructor(address _rally) public {
        rewardToken = IERC20(_rally);
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    function transferReward(uint256 _amount) external {
        require (hasRole(YDV_REWARDS, msg.sender), "only ydv rewards");
        rewardToken.safeTransfer(msg.sender, _amount);
    }

    function addYDV(address _ydv) external onlyOwner {
        grantRole(YDV_REWARDS, _ydv);
        ydvs.push(_ydv);
    }

    function ydvsLength() external view returns (uint256) {
        return ydvs.length;
    }
}

// 
interface Vault {
    function balanceOf(address) external view returns (uint256);
    function token() external view returns (address);
    function claimInsurance() external;
    function getPricePerFullShare() external view returns (uint256);
    function deposit(uint) external;
    function withdraw(uint) external;
}

// 
contract YDVErrorReporter {
    enum Error {
        NO_ERROR,
        UNAUTHORIZED,
        BAD_INPUT,
        REJECTION
    }

    enum FailureInfo {
        SET_INDIVIDUAL_SOFT_CAP_CHECK,
        SET_GLOBAL_SOFT_CAP_CHECK
    }

    /**
      * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary
      * contract-specific code that enables us to report opaque error codes from upgradeable contracts.
      **/
    event Failure(uint error, uint info, uint detail);

    /**
      * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator
      */
    function fail(Error err, FailureInfo info) internal returns (uint) {
        emit Failure(uint(err), uint(info), 0);

        return uint(err);
    }

    /**
      * @dev use this when reporting an opaque error from an upgradeable collaborator contract
      */
    function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) {
        emit Failure(uint(err), uint(info), opaqueError);

        return uint(err);
    }
}

// 
contract YieldDelegatingVaultStorage {
    address public controller;
    address public vault;
    YDVRewardsDistributor rewards;
    IERC20 public rally;
    address public treasury;
    IERC20 public token;
    uint256 public delegatePercent;
    uint256 public globalDepositCap;
    uint256 public individualDepositCap;
    
    mapping(address => uint256) public rewardDebt;
    uint256 public totalDeposits;

    uint256 public rewardPerToken;
    uint256 public accRallyPerShare;
}

// 
contract YieldDelegatingVault is ERC20, YieldDelegatingVaultStorage, YieldDelegatingVaultEvent, YDVErrorReporter, Ownable {
    using SafeERC20 for IERC20;
    using Address for address;
    using SafeMath for uint256;

    constructor (
        address _vault,
        address _rewards,
        address _treasury,
        uint256 _delegatePercent,
        uint256 _globalDepositCap,
        uint256 _individualDepositCap
    ) public ERC20(
        string(abi.encodePacked("rally delegating ", ERC20(Vault(_vault).token()).name())),
        string(abi.encodePacked("rd", ERC20(Vault(_vault).token()).symbol()))
    ) {
        _setupDecimals(ERC20(Vault(_vault).token()).decimals());
        token = IERC20(Vault(_vault).token()); //token being deposited in the referenced vault
        vault = _vault; //address of the vault we're proxying
        rewards = YDVRewardsDistributor(_rewards);
        rally = rewards.rewardToken();
	treasury = _treasury;
        delegatePercent = _delegatePercent;
        globalDepositCap = _globalDepositCap;
        individualDepositCap = _individualDepositCap;
	    totalDeposits = 0;
        accRallyPerShare = 0;
    }

    function setTreasury(address newTreasury) public onlyOwner {
        require(newTreasury != address(0), "treasure should be valid address");

        address oldTreasury = treasury;
        treasury = newTreasury;

        emit NewTreasury(oldTreasury, newTreasury);
    }

    function setGlobalDepositCap(uint256 newGlobalDepositCap) public onlyOwner {
        uint256 oldGlobalDepositCap = globalDepositCap;
        globalDepositCap = newGlobalDepositCap;

        emit NewGlobalDepositCap(oldGlobalDepositCap, newGlobalDepositCap);
    }

    function setIndividualDepositCap(uint256 newIndividualDepositCap) public onlyOwner {
        uint256 oldIndividualDepositCap = individualDepositCap;
        individualDepositCap = newIndividualDepositCap;

        emit NewIndividualDepositCap(oldIndividualDepositCap, newIndividualDepositCap);
    }

    function setNewRewardPerToken(uint256 newRewardPerToken) public onlyOwner {
        uint256 oldRewardPerToken = rewardPerToken;
        rewardPerToken = newRewardPerToken;

        emit NewRewardPerToken(oldRewardPerToken, newRewardPerToken);
    }

    function earned(address account) public view returns (uint256) {
        return balanceOf(account).mul(accRallyPerShare).div(1e12).sub(rewardDebt[account]);
    }

    function balance() public view returns (uint256) {
        return (IERC20(vault)).balanceOf(address(this)); //how many shares do we have in the vault we are delegating to
    }

    function depositAll() external {
        deposit(token.balanceOf(msg.sender));
    }

    function deposit(uint256 _amount) public returns (uint256) {
        if(individualDepositCap < balanceOf(address(this)).add(_amount)) {
            return fail(Error.BAD_INPUT, FailureInfo.SET_INDIVIDUAL_SOFT_CAP_CHECK);
        }

        if(globalDepositCap < totalSupply().add(_amount)) {
            return fail(Error.BAD_INPUT, FailureInfo.SET_GLOBAL_SOFT_CAP_CHECK);
        }

        uint256 pending = earned(msg.sender);
        if (pending > 0) {
            safeRallyTransfer(msg.sender, pending);
        }
        uint256 _pool = balance();

        uint256 _before = token.balanceOf(address(this));
        token.safeTransferFrom(msg.sender, address(this), _amount);
        uint256 _after = token.balanceOf(address(this));
        _amount = _after.sub(_before);

        totalDeposits = totalDeposits.add(_amount);

        token.approve(vault, _amount);
        Vault(vault).deposit(_amount);
        uint256 _after_pool = balance();
		
        uint256 _new_shares = _after_pool.sub(_pool); //new vault tokens representing my added vault shares

        //translate vault shares into delegating vault shares
        uint256 shares = 0;
        if (totalSupply() == 0) {
            shares = _new_shares;
        } else {
            shares = (_new_shares.mul(totalSupply())).div(_pool);
        }
        _mint(msg.sender, shares);
        rewardDebt[msg.sender] = balanceOf(msg.sender).mul(accRallyPerShare).div(1e12);
    }

    function deposityToken(uint256 _yamount) public returns (uint256) {
        uint256 pending = earned(msg.sender);
        if (pending > 0) {
            safeRallyTransfer(msg.sender, pending);
        }

        uint256 _before = IERC20(vault).balanceOf(address(this));
        IERC20(vault).safeTransferFrom(msg.sender, address(this), _yamount);
        uint256 _after = IERC20(vault).balanceOf(address(this));
        _yamount = _after.sub(_before);

        uint _underlyingAmount = _yamount.mul(Vault(vault).getPricePerFullShare()).div(1e18);
        totalDeposits = totalDeposits.add(_underlyingAmount);
		
        //translate vault shares into delegating vault shares
        uint256 shares = 0;
        if (totalSupply() == 0) {
            shares = _yamount;
        } else {
            shares = (_yamount.mul(totalSupply())).div(_before);
        }
        _mint(msg.sender, shares);
        rewardDebt[msg.sender] = balanceOf(msg.sender).mul(accRallyPerShare).div(1e12);
    }

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

    function withdraw(uint256 _shares) public {
        uint256 pending = earned(msg.sender);
        if (pending > 0) {
            safeRallyTransfer(msg.sender, pending);
        }

        uint256 r = (balance().mul(_shares)).div(totalSupply());
        _burn(msg.sender, _shares);
        rewardDebt[msg.sender] = balanceOf(msg.sender).mul(accRallyPerShare).div(1e12);
        uint256 _before = token.balanceOf(address(this));
        Vault(vault).withdraw(r);
        uint256 _after = token.balanceOf(address(this));

        uint256 toTransfer = _after.sub(_before);
        safeReduceTotalDeposits(toTransfer);
        token.safeTransfer(msg.sender, toTransfer);
    }

    //in case of rounding errors converting between vault tokens and underlying value
    function safeReduceTotalDeposits(uint256 _amount) internal {
        if (_amount > totalDeposits) {
          totalDeposits = 0;
        } else {
          totalDeposits = totalDeposits.sub(_amount);
        }
    }

    function withdrawyToken(uint256 _shares) public {
        uint256 pending = earned(msg.sender);
        if (pending > 0) {
            safeRallyTransfer(msg.sender, pending);
        }
        uint256 r = (balance().mul(_shares)).div(totalSupply());
        _burn(msg.sender, _shares);
        rewardDebt[msg.sender] = balanceOf(msg.sender).mul(accRallyPerShare).div(1e12);
        uint256 _amount = r.mul(Vault(vault).getPricePerFullShare()).div(1e18);

        safeReduceTotalDeposits(_amount);

        IERC20(vault).safeTransfer(msg.sender, r);
    }

    // Safe RLY transfer function, just in case pool does not have enough RLY due to rounding error
    function safeRallyTransfer(address _to, uint256 _amount) internal {
        uint256 rallyBal = rally.balanceOf(address(this));
        if (_amount > rallyBal) {
            rally.transfer(_to, rallyBal);
        } else {
            rally.transfer(_to, _amount);
        }
    }

    //how much are our shares of the underlying vault worth relative to the deposit value? returns value denominated in vault tokens
    function availableYield() public view returns (uint256) {
        uint256 totalValue = balance().mul(Vault(vault).getPricePerFullShare()).div(1e18);
        if (totalValue > totalDeposits) {
            uint256 earnings = totalValue.sub(totalDeposits);
            return earnings.mul(1e18).div(Vault(vault).getPricePerFullShare());
        }
        return 0;
    }

    //transfer accumulated yield to treasury, update totalDeposits to ensure availableYield following
    //harvest is 0, and increase accumulated rally rewards
    //harvest fails if we're unable to fund rewards
    function harvest() public {
        uint256 _availableYield = availableYield();
        if (_availableYield > 0) {
            uint256 rallyReward = _availableYield.mul(delegatePercent).div(10000).mul(rewardPerToken).div(1e18);
            rewards.transferReward(rallyReward);
            IERC20(vault).safeTransfer(treasury, _availableYield.mul(delegatePercent).div(10000));
            accRallyPerShare = accRallyPerShare.add(rallyReward.mul(1e12).div(totalSupply()));
            totalDeposits = balance().mul(Vault(vault).getPricePerFullShare()).div(1e18);
        }
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_rewards","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_delegatePercent","type":"uint256"},{"internalType":"uint256","name":"_globalDepositCap","type":"uint256"},{"internalType":"uint256","name":"_individualDepositCap","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"error","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"info","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"detail","type":"uint256"}],"name":"Failure","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldDelegatePercent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDelegatePercent","type":"uint256"}],"name":"NewDelegatePercent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldGlobalDepositCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newGlobalDepositCap","type":"uint256"}],"name":"NewGlobalDepositCap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldInvidivualDepositCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newInvidivualDepositCap","type":"uint256"}],"name":"NewIndividualDepositCap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRewardPerToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRewardPerToken","type":"uint256"}],"name":"NewRewardPerToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldTreasury","type":"address"},{"indexed":false,"internalType":"address","name":"newTreasury","type":"address"}],"name":"NewTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"accRallyPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"availableYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"delegatePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_yamount","type":"uint256"}],"name":"deposityToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalDepositCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"individualDepositCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rally","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newGlobalDepositCap","type":"uint256"}],"name":"setGlobalDepositCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newIndividualDepositCap","type":"uint256"}],"name":"setIndividualDepositCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRewardPerToken","type":"uint256"}],"name":"setNewRewardPerToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTreasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdrawyToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200309238038062003092833981810160405260c08110156200003757600080fd5b5080516020808301516040808501516060860151608087015160a0909701518351637e062a3560e11b8152935196979496929591949390926001600160a01b0389169263fc0c546a9260048082019391829003018186803b1580156200009c57600080fd5b505afa158015620000b1573d6000803e3d6000fd5b505050506040513d6020811015620000c857600080fd5b5051604080516306fdde0360e01b815290516001600160a01b03909216916306fdde0391600480820192600092909190829003018186803b1580156200010d57600080fd5b505afa15801562000122573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156200014c57600080fd5b81019080805160405193929190846401000000008211156200016d57600080fd5b9083019060208201858111156200018357600080fd5b82516401000000008111828201881017156200019e57600080fd5b82525081516020918201929091019080838360005b83811015620001cd578181015183820152602001620001b3565b50505050905090810190601f168015620001fb5780820380516001836020036101000a031916815260200191505b5060405250505060405160200180807003930b6363c903232b632b3b0ba34b7339607d1b81525060110182805190602001908083835b60208310620002525780518252601f19909201916020918201910162000231565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052866001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015620002c057600080fd5b505afa158015620002d5573d6000803e3d6000fd5b505050506040513d6020811015620002ec57600080fd5b5051604080516395d89b4160e01b815290516001600160a01b03909216916395d89b4191600480820192600092909190829003018186803b1580156200033157600080fd5b505afa15801562000346573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156200037057600080fd5b81019080805160405193929190846401000000008211156200039157600080fd5b908301906020820185811115620003a757600080fd5b8251640100000000811182820188101715620003c257600080fd5b82525081516020918201929091019080838360005b83811015620003f1578181015183820152602001620003d7565b50505050905090810190601f1680156200041f5780820380516001836020036101000a031916815260200191505b506040525050506040516020018080611c9960f21b81525060020182805190602001908083835b60208310620004675780518252601f19909201916020918201910162000446565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528160039080519060200190620004b392919062000789565b508051620004c990600490602084019062000789565b50506005805460ff19166012179055506000620004e56200076f565b601280546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35062000616866001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200057157600080fd5b505afa15801562000586573d6000803e3d6000fd5b505050506040513d60208110156200059d57600080fd5b50516040805163313ce56760e01b815290516001600160a01b039092169163313ce56791600480820192602092909190829003018186803b158015620005e257600080fd5b505afa158015620005f7573d6000803e3d6000fd5b505050506040513d60208110156200060e57600080fd5b505162000773565b856001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200065057600080fd5b505afa15801562000665573d6000803e3d6000fd5b505050506040513d60208110156200067c57600080fd5b5051600a80546001600160a01b03199081166001600160a01b03938416179091556006805482168984161790556007805490911687831617908190556040805163f7c618c160e01b81529051919092169163f7c618c1916004828101926020929190829003018186803b158015620006f357600080fd5b505afa15801562000708573d6000803e3d6000fd5b505050506040513d60208110156200071f57600080fd5b5051600880546001600160a01b039283166001600160a01b0319918216179091556009805496909216951694909417909355600b91909155600c55600d5550506000600f81905560115562000825565b3390565b6005805460ff191660ff92909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620007cc57805160ff1916838001178555620007fc565b82800160010185558215620007fc579182015b82811115620007fc578251825591602001919060010190620007df565b506200080a9291506200080e565b5090565b5b808211156200080a57600081556001016200080f565b61285d80620008356000396000f3fe608060405234801561001057600080fd5b50600436106102465760003560e01c80637fd347971161013b578063cbb58bf7116100b8578063f2fde38b1161007c578063f2fde38b1461060c578063f77c479114610632578063f7e6a66a1461063a578063fbfa77cf14610657578063fc0c546a1461065f57610246565b8063cbb58bf7146105a0578063cd3daf9d146105a8578063dd62ed3e146105b0578063de5f6268146105de578063f0f44260146105e657610246565b8063a457c2d7116100ff578063a457c2d71461051b578063a9059cbb14610547578063b69ef8a814610573578063b6b55f251461057b578063bdeb56021461059857610246565b80637fd34797146104de578063853828b6146104e65780638da5cb5b146104ee57806393f52c85146104f657806395d89b411461051357610246565b8063313ce567116101c95780636b4965091161018d5780636b4965091461048357806370a082311461048b578063715018a6146104b15780637867dff5146104b95780637d882097146104d657610246565b8063313ce5671461040357806339509351146104215780634641257d1461044d5780635873eb9b1461045557806361d027b31461047b57610246565b80630d82c887116102105780630d82c88714610383578063175e439c146103a057806318160ddd146103a857806323b872dd146103b05780632e1a7d4d146103e657610246565b806230bffe1461024b5780628cc2621461026f57806306fdde03146102a7578063095ea7b31461032457806309920bad14610364575b600080fd5b610253610667565b604080516001600160a01b039092168252519081900360200190f35b6102956004803603602081101561028557600080fd5b50356001600160a01b0316610676565b60408051918252519081900360200190f35b6102af6106c9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e95781810151838201526020016102d1565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103506004803603604081101561033a57600080fd5b506001600160a01b038135169060200135610760565b604080519115158252519081900360200190f35b6103816004803603602081101561037a57600080fd5b503561077e565b005b6102956004803603602081101561039957600080fd5b503561081d565b610295610a62565b610295610bbb565b610350600480360360608110156103c657600080fd5b506001600160a01b03813581169160208101359091169060400135610bc1565b610381600480360360208110156103fc57600080fd5b5035610c48565b61040b610e45565b6040805160ff9092168252519081900360200190f35b6103506004803603604081101561043757600080fd5b506001600160a01b038135169060200135610e4e565b610381610e9c565b6102956004803603602081101561046b57600080fd5b50356001600160a01b0316611012565b610253611024565b610295611033565b610295600480360360208110156104a157600080fd5b50356001600160a01b0316611039565b610381611054565b610381600480360360208110156104cf57600080fd5b50356110f6565b610295611205565b61029561120b565b610381611211565b610253611224565b6103816004803603602081101561050c57600080fd5b5035611233565b6102af6112d2565b6103506004803603604081101561053157600080fd5b506001600160a01b038135169060200135611333565b6103506004803603604081101561055d57600080fd5b506001600160a01b03813516906020013561139b565b6102956113af565b6102956004803603602081101561059157600080fd5b503561142b565b610295611742565b610295611748565b61029561174e565b610295600480360360408110156105c657600080fd5b506001600160a01b0381358116916020013516611754565b61038161177f565b610381600480360360208110156105fc57600080fd5b50356001600160a01b03166117fc565b6103816004803603602081101561062257600080fd5b50356001600160a01b0316611912565b610253611a0b565b6103816004803603602081101561065057600080fd5b5035611a1f565b610253611abe565b610253611acd565b6008546001600160a01b031681565b6001600160a01b0381166000908152600e60205260408120546011546106c191906106bb9064e8d4a51000906106b5906106af88611039565b90611adc565b90611b3c565b90611b7e565b90505b919050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107555780601f1061072a57610100808354040283529160200191610755565b820191906000526020600020905b81548152906001019060200180831161073857829003601f168201915b505050505090505b90565b600061077461076d611bc0565b8484611bc4565b5060015b92915050565b610786611bc0565b6012546001600160a01b039081169116146107d6576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b600d805490829055604080518281526020810184905281517f16dce8a765cb6ee3e4d13d090afac37e2a2265533419e1d04e9a9533b796acdc929181900390910190a15050565b60008061082933610676565b9050801561083b5761083b3382611cb0565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561088657600080fd5b505afa15801561089a573d6000803e3d6000fd5b505050506040513d60208110156108b057600080fd5b50516006549091506108cd906001600160a01b0316333087611e41565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561091857600080fd5b505afa15801561092c573d6000803e3d6000fd5b505050506040513d602081101561094257600080fd5b505190506109508183611b7e565b945060006109e4670de0b6b3a76400006106b5600660009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b157600080fd5b505afa1580156109c5573d6000803e3d6000fd5b505050506040513d60208110156109db57600080fd5b50518990611adc565b600f549091506109f49082611e9b565b600f556000610a01610bbb565b610a0c575085610a25565b610a22846106b5610a1b610bbb565b8a90611adc565b90505b610a2f3382611ef5565b610a4764e8d4a510006106b56011546106af33611039565b336000908152600e6020526040902055509395945050505050565b600080610af6670de0b6b3a76400006106b5600660009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac257600080fd5b505afa158015610ad6573d6000803e3d6000fd5b505050506040513d6020811015610aec57600080fd5b50516106af6113af565b9050600f54811115610bb3576000610b19600f5483611b7e90919063ffffffff16565b9050610baa600660009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6c57600080fd5b505afa158015610b80573d6000803e3d6000fd5b505050506040513d6020811015610b9657600080fd5b50516106b583670de0b6b3a7640000611adc565b9250505061075d565b600091505090565b60025490565b6000610bce848484611fe5565b610c3e84610bda611bc0565b610c3985604051806060016040528060288152602001612727602891396001600160a01b038a16600090815260016020526040812090610c18611bc0565b6001600160a01b031681526020810191909152604001600020549190612140565b611bc4565b5060019392505050565b6000610c5333610676565b90508015610c6557610c653382611cb0565b6000610c7e610c72610bbb565b6106b5856106af6113af565b9050610c8a33846121d7565b610ca264e8d4a510006106b56011546106af33611039565b336000908152600e6020908152604080832093909355600a5483516370a0823160e01b8152306004820152935192936001600160a01b03909116926370a0823192602480840193919291829003018186803b158015610d0057600080fd5b505afa158015610d14573d6000803e3d6000fd5b505050506040513d6020811015610d2a57600080fd5b505160065460408051632e1a7d4d60e01b81526004810186905290519293506001600160a01b0390911691632e1a7d4d9160248082019260009290919082900301818387803b158015610d7c57600080fd5b505af1158015610d90573d6000803e3d6000fd5b5050600a54604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b158015610de157600080fd5b505afa158015610df5573d6000803e3d6000fd5b505050506040513d6020811015610e0b57600080fd5b505190506000610e1b8284611b7e565b9050610e26816122d3565b600a54610e3d906001600160a01b031633836122fa565b505050505050565b60055460ff1690565b6000610774610e5b611bc0565b84610c398560016000610e6c611bc0565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611e9b565b6000610ea6610a62565b9050801561100f576000610edd670de0b6b3a76400006106b56010546106af6127106106b5600b5489611adc90919063ffffffff16565b60075460408051632d4f81f160e21b81526004810184905290519293506001600160a01b039091169163b53e07c49160248082019260009290919082900301818387803b158015610f2d57600080fd5b505af1158015610f41573d6000803e3d6000fd5b5050600954600b54610f8193506001600160a01b039091169150610f6e90612710906106b5908790611adc565b6006546001600160a01b031691906122fa565b610fa7610f9e610f8f610bbb565b6106b58464e8d4a51000611adc565b60115490611e9b565b60118190555061100a670de0b6b3a76400006106b5600660009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac257600080fd5b600f55505b50565b600e6020526000908152604090205481565b6009546001600160a01b031681565b600b5481565b6001600160a01b031660009081526020819052604090205490565b61105c611bc0565b6012546001600160a01b039081169116146110ac576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b6012546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3601280546001600160a01b0319169055565b600061110133610676565b90508015611113576111133382611cb0565b6000611120610c72610bbb565b905061112c33846121d7565b61114464e8d4a510006106b56011546106af33611039565b336000908152600e60209081526040808320939093556006548351631df1ee3f60e21b8152935192936111dd93670de0b6b3a7640000936106b5936001600160a01b0316926377c7b8fc9260048083019392829003018186803b1580156111aa57600080fd5b505afa1580156111be573d6000803e3d6000fd5b505050506040513d60208110156111d457600080fd5b50518590611adc565b90506111e8816122d3565b6006546111ff906001600160a01b031633846122fa565b50505050565b600f5481565b600c5481565b61122261121d33611039565b610c48565b565b6012546001600160a01b031690565b61123b611bc0565b6012546001600160a01b0390811691161461128b576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b600c805490829055604080518281526020810184905281517ff188aeec9f2cef772b967829d57da7b607a102100e7a60916fddddf6175382e6929181900390910190a15050565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107555780601f1061072a57610100808354040283529160200191610755565b6000610774611340611bc0565b84610c3985604051806060016040528060258152602001612803602591396001600061136a611bc0565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190612140565b60006107746113a8611bc0565b8484611fe5565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156113fa57600080fd5b505afa15801561140e573d6000803e3d6000fd5b505050506040513d602081101561142457600080fd5b5051905090565b60006114408261143a30611039565b90611e9b565b600d54101561145c576114556002600061234c565b90506106c4565b6114688261143a610bbb565b600c54101561147d576114556002600161234c565b600061148833610676565b9050801561149a5761149a3382611cb0565b60006114a46113af565b600a54604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156114f557600080fd5b505afa158015611509573d6000803e3d6000fd5b505050506040513d602081101561151f57600080fd5b5051600a5490915061153c906001600160a01b0316333088611e41565b600a54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561158757600080fd5b505afa15801561159b573d6000803e3d6000fd5b505050506040513d60208110156115b157600080fd5b505190506115bf8183611b7e565b600f549096506115cf9087611e9b565b600f55600a546006546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018a90529051919092169163095ea7b39160448083019260209291908290030181600087803b15801561162b57600080fd5b505af115801561163f573d6000803e3d6000fd5b505050506040513d602081101561165557600080fd5b50506006546040805163b6b55f2560e01b81526004810189905290516001600160a01b039092169163b6b55f259160248082019260009290919082900301818387803b1580156116a457600080fd5b505af11580156116b8573d6000803e3d6000fd5b5050505060006116c66113af565b905060006116d48286611b7e565b905060006116e0610bbb565b6116eb575080611704565b611701866106b56116fa610bbb565b8590611adc565b90505b61170e3382611ef5565b61172664e8d4a510006106b56011546106af33611039565b336000908152600e602052604090205550505050505050919050565b60115481565b600d5481565b60105481565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600a54604080516370a0823160e01b8152336004820152905161100f926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156117cb57600080fd5b505afa1580156117df573d6000803e3d6000fd5b505050506040513d60208110156117f557600080fd5b505161142b565b611804611bc0565b6012546001600160a01b03908116911614611854576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b6001600160a01b0381166118af576040805162461bcd60e51b815260206004820181905260248201527f74726561737572652073686f756c642062652076616c69642061646472657373604482015290519081900360640190fd5b600980546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f567657fa3f286518b318f4a29870674f433f622fdfc819691acb13105b228225929181900390910190a15050565b61191a611bc0565b6012546001600160a01b0390811691161461196a576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b6001600160a01b0381166119af5760405162461bcd60e51b81526004018080602001828103825260268152602001806126986026913960400191505060405180910390fd5b6012546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3601280546001600160a01b0319166001600160a01b0392909216919091179055565b60055461010090046001600160a01b031681565b611a27611bc0565b6012546001600160a01b03908116911614611a77576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b6010805490829055604080518281526020810184905281517fbfd081c10a6f662e897477e984f1acebacf505f1ad88592bb5d6ec1df6ad9916929181900390910190a15050565b6006546001600160a01b031681565b600a546001600160a01b031681565b600082611aeb57506000610778565b82820282848281611af857fe5b0414611b355760405162461bcd60e51b81526004018080602001828103825260218152602001806127066021913960400191505060405180910390fd5b9392505050565b6000611b3583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123b2565b6000611b3583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612140565b3390565b6001600160a01b038316611c095760405162461bcd60e51b81526004018080602001828103825260248152602001806127b56024913960400191505060405180910390fd5b6001600160a01b038216611c4e5760405162461bcd60e51b81526004018080602001828103825260228152602001806126be6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600854604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611cfb57600080fd5b505afa158015611d0f573d6000803e3d6000fd5b505050506040513d6020811015611d2557600080fd5b5051905080821115611db9576008546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015611d8757600080fd5b505af1158015611d9b573d6000803e3d6000fd5b505050506040513d6020811015611db157600080fd5b50611e3c9050565b6008546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015611e0f57600080fd5b505af1158015611e23573d6000803e3d6000fd5b505050506040513d6020811015611e3957600080fd5b50505b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526111ff908590612417565b600082820183811015611b35576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b038216611f50576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b611f5c60008383611e3c565b600254611f699082611e9b565b6002556001600160a01b038216600090815260208190526040902054611f8f9082611e9b565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03831661202a5760405162461bcd60e51b81526004018080602001828103825260258152602001806127906025913960400191505060405180910390fd5b6001600160a01b03821661206f5760405162461bcd60e51b81526004018080602001828103825260238152602001806126536023913960400191505060405180910390fd5b61207a838383611e3c565b6120b7816040518060600160405280602681526020016126e0602691396001600160a01b0386166000908152602081905260409020549190612140565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546120e69082611e9b565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156121cf5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561219457818101518382015260200161217c565b50505050905090810190601f1680156121c15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03821661221c5760405162461bcd60e51b815260040180806020018281038252602181526020018061276f6021913960400191505060405180910390fd5b61222882600083611e3c565b61226581604051806060016040528060228152602001612676602291396001600160a01b0385166000908152602081905260409020549190612140565b6001600160a01b03831660009081526020819052604090205560025461228b9082611b7e565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600f548111156122e7576000600f5561100f565b600f546122f49082611b7e565b600f5550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611e3c908490612417565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa083600381111561237b57fe5b83600181111561238757fe5b604080519283526020830191909152600082820152519081900360600190a1826003811115611b3557fe5b600081836124015760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561219457818101518382015260200161217c565b50600083858161240d57fe5b0495945050505050565b606061246c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124c89092919063ffffffff16565b805190915015611e3c5780806020019051602081101561248b57600080fd5b5051611e3c5760405162461bcd60e51b815260040180806020018281038252602a8152602001806127d9602a913960400191505060405180910390fd5b60606124d784846000856124df565b949350505050565b60606124ea8561264c565b61253b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061257a5780518252601f19909201916020918201910161255b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146125dc576040519150601f19603f3d011682016040523d82523d6000602084013e6125e1565b606091505b509150915081156125f55791506124d79050565b8051156126055780518082602001fd5b60405162461bcd60e51b815260206004820181815286516024840152865187939192839260440191908501908083836000831561219457818101518382015260200161217c565b3b15159056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220adf28cb964aa5ea90702acb96b53d01c1ce8bf79abdfa447cdb1b92652bebe3064736f6c634300060c00330000000000000000000000002994529c0652d127b7842094103715ec5299bbed000000000000000000000000fb467828778a6747011c467e1b346d08491ae3530000000000000000000000003b66890289366175c360c1f0e1bafae06276ba0300000000000000000000000000000000000000000000000000000000000023280000000000000000000000000000000000000000033b2e3c9fd0803ce80000000000000000000000000000000000000000000000033b2e3c9fd0803ce8000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102465760003560e01c80637fd347971161013b578063cbb58bf7116100b8578063f2fde38b1161007c578063f2fde38b1461060c578063f77c479114610632578063f7e6a66a1461063a578063fbfa77cf14610657578063fc0c546a1461065f57610246565b8063cbb58bf7146105a0578063cd3daf9d146105a8578063dd62ed3e146105b0578063de5f6268146105de578063f0f44260146105e657610246565b8063a457c2d7116100ff578063a457c2d71461051b578063a9059cbb14610547578063b69ef8a814610573578063b6b55f251461057b578063bdeb56021461059857610246565b80637fd34797146104de578063853828b6146104e65780638da5cb5b146104ee57806393f52c85146104f657806395d89b411461051357610246565b8063313ce567116101c95780636b4965091161018d5780636b4965091461048357806370a082311461048b578063715018a6146104b15780637867dff5146104b95780637d882097146104d657610246565b8063313ce5671461040357806339509351146104215780634641257d1461044d5780635873eb9b1461045557806361d027b31461047b57610246565b80630d82c887116102105780630d82c88714610383578063175e439c146103a057806318160ddd146103a857806323b872dd146103b05780632e1a7d4d146103e657610246565b806230bffe1461024b5780628cc2621461026f57806306fdde03146102a7578063095ea7b31461032457806309920bad14610364575b600080fd5b610253610667565b604080516001600160a01b039092168252519081900360200190f35b6102956004803603602081101561028557600080fd5b50356001600160a01b0316610676565b60408051918252519081900360200190f35b6102af6106c9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e95781810151838201526020016102d1565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103506004803603604081101561033a57600080fd5b506001600160a01b038135169060200135610760565b604080519115158252519081900360200190f35b6103816004803603602081101561037a57600080fd5b503561077e565b005b6102956004803603602081101561039957600080fd5b503561081d565b610295610a62565b610295610bbb565b610350600480360360608110156103c657600080fd5b506001600160a01b03813581169160208101359091169060400135610bc1565b610381600480360360208110156103fc57600080fd5b5035610c48565b61040b610e45565b6040805160ff9092168252519081900360200190f35b6103506004803603604081101561043757600080fd5b506001600160a01b038135169060200135610e4e565b610381610e9c565b6102956004803603602081101561046b57600080fd5b50356001600160a01b0316611012565b610253611024565b610295611033565b610295600480360360208110156104a157600080fd5b50356001600160a01b0316611039565b610381611054565b610381600480360360208110156104cf57600080fd5b50356110f6565b610295611205565b61029561120b565b610381611211565b610253611224565b6103816004803603602081101561050c57600080fd5b5035611233565b6102af6112d2565b6103506004803603604081101561053157600080fd5b506001600160a01b038135169060200135611333565b6103506004803603604081101561055d57600080fd5b506001600160a01b03813516906020013561139b565b6102956113af565b6102956004803603602081101561059157600080fd5b503561142b565b610295611742565b610295611748565b61029561174e565b610295600480360360408110156105c657600080fd5b506001600160a01b0381358116916020013516611754565b61038161177f565b610381600480360360208110156105fc57600080fd5b50356001600160a01b03166117fc565b6103816004803603602081101561062257600080fd5b50356001600160a01b0316611912565b610253611a0b565b6103816004803603602081101561065057600080fd5b5035611a1f565b610253611abe565b610253611acd565b6008546001600160a01b031681565b6001600160a01b0381166000908152600e60205260408120546011546106c191906106bb9064e8d4a51000906106b5906106af88611039565b90611adc565b90611b3c565b90611b7e565b90505b919050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107555780601f1061072a57610100808354040283529160200191610755565b820191906000526020600020905b81548152906001019060200180831161073857829003601f168201915b505050505090505b90565b600061077461076d611bc0565b8484611bc4565b5060015b92915050565b610786611bc0565b6012546001600160a01b039081169116146107d6576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b600d805490829055604080518281526020810184905281517f16dce8a765cb6ee3e4d13d090afac37e2a2265533419e1d04e9a9533b796acdc929181900390910190a15050565b60008061082933610676565b9050801561083b5761083b3382611cb0565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561088657600080fd5b505afa15801561089a573d6000803e3d6000fd5b505050506040513d60208110156108b057600080fd5b50516006549091506108cd906001600160a01b0316333087611e41565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561091857600080fd5b505afa15801561092c573d6000803e3d6000fd5b505050506040513d602081101561094257600080fd5b505190506109508183611b7e565b945060006109e4670de0b6b3a76400006106b5600660009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109b157600080fd5b505afa1580156109c5573d6000803e3d6000fd5b505050506040513d60208110156109db57600080fd5b50518990611adc565b600f549091506109f49082611e9b565b600f556000610a01610bbb565b610a0c575085610a25565b610a22846106b5610a1b610bbb565b8a90611adc565b90505b610a2f3382611ef5565b610a4764e8d4a510006106b56011546106af33611039565b336000908152600e6020526040902055509395945050505050565b600080610af6670de0b6b3a76400006106b5600660009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac257600080fd5b505afa158015610ad6573d6000803e3d6000fd5b505050506040513d6020811015610aec57600080fd5b50516106af6113af565b9050600f54811115610bb3576000610b19600f5483611b7e90919063ffffffff16565b9050610baa600660009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6c57600080fd5b505afa158015610b80573d6000803e3d6000fd5b505050506040513d6020811015610b9657600080fd5b50516106b583670de0b6b3a7640000611adc565b9250505061075d565b600091505090565b60025490565b6000610bce848484611fe5565b610c3e84610bda611bc0565b610c3985604051806060016040528060288152602001612727602891396001600160a01b038a16600090815260016020526040812090610c18611bc0565b6001600160a01b031681526020810191909152604001600020549190612140565b611bc4565b5060019392505050565b6000610c5333610676565b90508015610c6557610c653382611cb0565b6000610c7e610c72610bbb565b6106b5856106af6113af565b9050610c8a33846121d7565b610ca264e8d4a510006106b56011546106af33611039565b336000908152600e6020908152604080832093909355600a5483516370a0823160e01b8152306004820152935192936001600160a01b03909116926370a0823192602480840193919291829003018186803b158015610d0057600080fd5b505afa158015610d14573d6000803e3d6000fd5b505050506040513d6020811015610d2a57600080fd5b505160065460408051632e1a7d4d60e01b81526004810186905290519293506001600160a01b0390911691632e1a7d4d9160248082019260009290919082900301818387803b158015610d7c57600080fd5b505af1158015610d90573d6000803e3d6000fd5b5050600a54604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b158015610de157600080fd5b505afa158015610df5573d6000803e3d6000fd5b505050506040513d6020811015610e0b57600080fd5b505190506000610e1b8284611b7e565b9050610e26816122d3565b600a54610e3d906001600160a01b031633836122fa565b505050505050565b60055460ff1690565b6000610774610e5b611bc0565b84610c398560016000610e6c611bc0565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611e9b565b6000610ea6610a62565b9050801561100f576000610edd670de0b6b3a76400006106b56010546106af6127106106b5600b5489611adc90919063ffffffff16565b60075460408051632d4f81f160e21b81526004810184905290519293506001600160a01b039091169163b53e07c49160248082019260009290919082900301818387803b158015610f2d57600080fd5b505af1158015610f41573d6000803e3d6000fd5b5050600954600b54610f8193506001600160a01b039091169150610f6e90612710906106b5908790611adc565b6006546001600160a01b031691906122fa565b610fa7610f9e610f8f610bbb565b6106b58464e8d4a51000611adc565b60115490611e9b565b60118190555061100a670de0b6b3a76400006106b5600660009054906101000a90046001600160a01b03166001600160a01b03166377c7b8fc6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac257600080fd5b600f55505b50565b600e6020526000908152604090205481565b6009546001600160a01b031681565b600b5481565b6001600160a01b031660009081526020819052604090205490565b61105c611bc0565b6012546001600160a01b039081169116146110ac576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b6012546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3601280546001600160a01b0319169055565b600061110133610676565b90508015611113576111133382611cb0565b6000611120610c72610bbb565b905061112c33846121d7565b61114464e8d4a510006106b56011546106af33611039565b336000908152600e60209081526040808320939093556006548351631df1ee3f60e21b8152935192936111dd93670de0b6b3a7640000936106b5936001600160a01b0316926377c7b8fc9260048083019392829003018186803b1580156111aa57600080fd5b505afa1580156111be573d6000803e3d6000fd5b505050506040513d60208110156111d457600080fd5b50518590611adc565b90506111e8816122d3565b6006546111ff906001600160a01b031633846122fa565b50505050565b600f5481565b600c5481565b61122261121d33611039565b610c48565b565b6012546001600160a01b031690565b61123b611bc0565b6012546001600160a01b0390811691161461128b576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b600c805490829055604080518281526020810184905281517ff188aeec9f2cef772b967829d57da7b607a102100e7a60916fddddf6175382e6929181900390910190a15050565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107555780601f1061072a57610100808354040283529160200191610755565b6000610774611340611bc0565b84610c3985604051806060016040528060258152602001612803602591396001600061136a611bc0565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190612140565b60006107746113a8611bc0565b8484611fe5565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156113fa57600080fd5b505afa15801561140e573d6000803e3d6000fd5b505050506040513d602081101561142457600080fd5b5051905090565b60006114408261143a30611039565b90611e9b565b600d54101561145c576114556002600061234c565b90506106c4565b6114688261143a610bbb565b600c54101561147d576114556002600161234c565b600061148833610676565b9050801561149a5761149a3382611cb0565b60006114a46113af565b600a54604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156114f557600080fd5b505afa158015611509573d6000803e3d6000fd5b505050506040513d602081101561151f57600080fd5b5051600a5490915061153c906001600160a01b0316333088611e41565b600a54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561158757600080fd5b505afa15801561159b573d6000803e3d6000fd5b505050506040513d60208110156115b157600080fd5b505190506115bf8183611b7e565b600f549096506115cf9087611e9b565b600f55600a546006546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018a90529051919092169163095ea7b39160448083019260209291908290030181600087803b15801561162b57600080fd5b505af115801561163f573d6000803e3d6000fd5b505050506040513d602081101561165557600080fd5b50506006546040805163b6b55f2560e01b81526004810189905290516001600160a01b039092169163b6b55f259160248082019260009290919082900301818387803b1580156116a457600080fd5b505af11580156116b8573d6000803e3d6000fd5b5050505060006116c66113af565b905060006116d48286611b7e565b905060006116e0610bbb565b6116eb575080611704565b611701866106b56116fa610bbb565b8590611adc565b90505b61170e3382611ef5565b61172664e8d4a510006106b56011546106af33611039565b336000908152600e602052604090205550505050505050919050565b60115481565b600d5481565b60105481565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b600a54604080516370a0823160e01b8152336004820152905161100f926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156117cb57600080fd5b505afa1580156117df573d6000803e3d6000fd5b505050506040513d60208110156117f557600080fd5b505161142b565b611804611bc0565b6012546001600160a01b03908116911614611854576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b6001600160a01b0381166118af576040805162461bcd60e51b815260206004820181905260248201527f74726561737572652073686f756c642062652076616c69642061646472657373604482015290519081900360640190fd5b600980546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517f567657fa3f286518b318f4a29870674f433f622fdfc819691acb13105b228225929181900390910190a15050565b61191a611bc0565b6012546001600160a01b0390811691161461196a576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b6001600160a01b0381166119af5760405162461bcd60e51b81526004018080602001828103825260268152602001806126986026913960400191505060405180910390fd5b6012546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3601280546001600160a01b0319166001600160a01b0392909216919091179055565b60055461010090046001600160a01b031681565b611a27611bc0565b6012546001600160a01b03908116911614611a77576040805162461bcd60e51b8152602060048201819052602482015260008051602061274f833981519152604482015290519081900360640190fd5b6010805490829055604080518281526020810184905281517fbfd081c10a6f662e897477e984f1acebacf505f1ad88592bb5d6ec1df6ad9916929181900390910190a15050565b6006546001600160a01b031681565b600a546001600160a01b031681565b600082611aeb57506000610778565b82820282848281611af857fe5b0414611b355760405162461bcd60e51b81526004018080602001828103825260218152602001806127066021913960400191505060405180910390fd5b9392505050565b6000611b3583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123b2565b6000611b3583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612140565b3390565b6001600160a01b038316611c095760405162461bcd60e51b81526004018080602001828103825260248152602001806127b56024913960400191505060405180910390fd5b6001600160a01b038216611c4e5760405162461bcd60e51b81526004018080602001828103825260228152602001806126be6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600854604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611cfb57600080fd5b505afa158015611d0f573d6000803e3d6000fd5b505050506040513d6020811015611d2557600080fd5b5051905080821115611db9576008546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015611d8757600080fd5b505af1158015611d9b573d6000803e3d6000fd5b505050506040513d6020811015611db157600080fd5b50611e3c9050565b6008546040805163a9059cbb60e01b81526001600160a01b038681166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015611e0f57600080fd5b505af1158015611e23573d6000803e3d6000fd5b505050506040513d6020811015611e3957600080fd5b50505b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526111ff908590612417565b600082820183811015611b35576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b038216611f50576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b611f5c60008383611e3c565b600254611f699082611e9b565b6002556001600160a01b038216600090815260208190526040902054611f8f9082611e9b565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03831661202a5760405162461bcd60e51b81526004018080602001828103825260258152602001806127906025913960400191505060405180910390fd5b6001600160a01b03821661206f5760405162461bcd60e51b81526004018080602001828103825260238152602001806126536023913960400191505060405180910390fd5b61207a838383611e3c565b6120b7816040518060600160405280602681526020016126e0602691396001600160a01b0386166000908152602081905260409020549190612140565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546120e69082611e9b565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156121cf5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561219457818101518382015260200161217c565b50505050905090810190601f1680156121c15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03821661221c5760405162461bcd60e51b815260040180806020018281038252602181526020018061276f6021913960400191505060405180910390fd5b61222882600083611e3c565b61226581604051806060016040528060228152602001612676602291396001600160a01b0385166000908152602081905260409020549190612140565b6001600160a01b03831660009081526020819052604090205560025461228b9082611b7e565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600f548111156122e7576000600f5561100f565b600f546122f49082611b7e565b600f5550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611e3c908490612417565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa083600381111561237b57fe5b83600181111561238757fe5b604080519283526020830191909152600082820152519081900360600190a1826003811115611b3557fe5b600081836124015760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561219457818101518382015260200161217c565b50600083858161240d57fe5b0495945050505050565b606061246c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124c89092919063ffffffff16565b805190915015611e3c5780806020019051602081101561248b57600080fd5b5051611e3c5760405162461bcd60e51b815260040180806020018281038252602a8152602001806127d9602a913960400191505060405180910390fd5b60606124d784846000856124df565b949350505050565b60606124ea8561264c565b61253b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061257a5780518252601f19909201916020918201910161255b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146125dc576040519150601f19603f3d011682016040523d82523d6000602084013e6125e1565b606091505b509150915081156125f55791506124d79050565b8051156126055780518082602001fd5b60405162461bcd60e51b815260206004820181815286516024840152865187939192839260440191908501908083836000831561219457818101518382015260200161217c565b3b15159056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220adf28cb964aa5ea90702acb96b53d01c1ce8bf79abdfa447cdb1b92652bebe3064736f6c634300060c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000002994529c0652d127b7842094103715ec5299bbed000000000000000000000000fb467828778a6747011c467e1b346d08491ae3530000000000000000000000003b66890289366175c360c1f0e1bafae06276ba0300000000000000000000000000000000000000000000000000000000000023280000000000000000000000000000000000000000033b2e3c9fd0803ce80000000000000000000000000000000000000000000000033b2e3c9fd0803ce8000000

-----Decoded View---------------
Arg [0] : _vault (address): 0x2994529C0652D127b7842094103715ec5299bBed
Arg [1] : _rewards (address): 0xFb467828778a6747011c467e1B346D08491Ae353
Arg [2] : _treasury (address): 0x3b66890289366175c360c1F0e1BafaE06276BA03
Arg [3] : _delegatePercent (uint256): 9000
Arg [4] : _globalDepositCap (uint256): 1000000000000000000000000000
Arg [5] : _individualDepositCap (uint256): 1000000000000000000000000000

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000002994529c0652d127b7842094103715ec5299bbed
Arg [1] : 000000000000000000000000fb467828778a6747011c467e1b346d08491ae353
Arg [2] : 0000000000000000000000003b66890289366175c360c1f0e1bafae06276ba03
Arg [3] : 0000000000000000000000000000000000000000000000000000000000002328
Arg [4] : 0000000000000000000000000000000000000000033b2e3c9fd0803ce8000000
Arg [5] : 0000000000000000000000000000000000000000033b2e3c9fd0803ce8000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.