POL Price: $0.650388 (+13.56%)
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim407162342023-03-24 14:45:31628 days ago1679669131IN
ETHA Lend: eVault Token
0 POL0.09936626708.46863792
Approve389786182023-02-06 12:31:24674 days ago1675686684IN
ETHA Lend: eVault Token
0 POL0.00622201133.31927878
Claim201814232021-10-13 17:52:481155 days ago1634147568IN
ETHA Lend: eVault Token
0 POL0.0026239530
Transfer Ownersh...174299272021-07-30 16:13:291230 days ago1627661609IN
ETHA Lend: eVault Token
0 POL0.000143795
Change Performan...171342612021-07-22 5:18:221239 days ago1626931102IN
ETHA Lend: eVault Token
0 POL0.0004693710
Claim170178642021-07-19 2:24:011242 days ago1626661441IN
ETHA Lend: eVault Token
0 POL0.0008181410
Update Distribut...168877922021-07-15 13:01:361245 days ago1626354096IN
ETHA Lend: eVault Token
0 POL0.000056691.2
Set Strat168752862021-07-15 5:13:491246 days ago1626326029IN
ETHA Lend: eVault Token
0 POL0.000103632

Latest 1 internal transaction

Parent Transaction Hash Block From To
168752792021-07-15 5:13:351246 days ago1626326015
ETHA Lend: eVault Token
 Contract Creation0 POL
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vault

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 17 : Vault.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "../interfaces/IStrat.sol";
import "../interfaces/IVault.sol";
import "./DividendToken.sol";
import "../utils/Timelock.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "../interfaces/IDistribution.sol";

contract Vault is Ownable, Pausable, DividendToken {
	using SafeMath for uint256;
	using SafeERC20 for IERC20Detailed;
	using SafeERC20 for IERC20;

	// EVENTS
	event HarvesterChanged(address newHarvester);
	event FeeUpdate(uint256 newFee);
	event StrategyChanged(address newStrat);
	event DepositLimitUpdated(uint256 newLimit);
	event NewDistribution(address newDistribution);

	IERC20Detailed public underlying;
	IERC20 public rewards;
	IStrat public strat;
	Timelock public timelock;

	address public harvester;

	uint256 constant MAX_FEE = 10000;
	uint256 public performanceFee = 0; // 0% of profit

	// if depositLimit = 0 then there is no deposit limit
	uint256 public depositLimit;
	uint256 public lastDistribution;
	address public distribution;

	modifier onlyHarvester {
		require(msg.sender == harvester);
		_;
	}

	constructor(
		IERC20Detailed underlying_,
		IERC20 target_,
		IERC20 rewards_,
		address harvester_,
		string memory name_,
		string memory symbol_
	) DividendToken(target_, name_, symbol_, underlying_.decimals()) {
		underlying = underlying_;
		rewards = rewards_;
		harvester = harvester_;
		depositLimit = 20000 * (10**underlying_.decimals()); // 20k initial deposit limit
		timelock = new Timelock(msg.sender, 2 days);
		_pause(); // paused until a strategy is connected
	}

	function calcTotalValue() public view returns (uint256 underlyingAmount) {
		return strat.calcTotalValue();
	}

	function totalYield() public returns (uint256) {
		return strat.totalYield();
	}

	function deposit(uint256 amount) external whenNotPaused {
		require(amount > 0, "ZERO-AMOUNT");
		if (depositLimit > 0) {
			// if deposit limit is 0, then there is no deposit limit
			require(totalSupply().add(amount) <= depositLimit);
		}

		underlying.safeTransferFrom(msg.sender, address(strat), amount);
		strat.invest();

		_mint(msg.sender, amount);

		if (distribution != address(0)) {
			IDistribution(distribution).stake(msg.sender, amount);
		}
	}

	function withdraw(uint256 amount) external {
		require(amount > 0, "ZERO-AMOUNT");

		_burn(msg.sender, amount);

		strat.divest(amount);
		underlying.safeTransfer(msg.sender, amount);

		if (distribution != address(0)) {
			IDistribution(distribution).withdraw(msg.sender, amount);
		}

		// Claim profits when withdrawing
		claim();
	}

	function unclaimedProfit(address user) external view returns (uint256) {
		return withdrawableDividendOf(user);
	}

	function claim() public returns (uint256 claimed) {
		claimed = withdrawDividend(msg.sender);

		if (distribution != address(0)) {
			IDistribution(distribution).getReward(msg.sender);
		}
	}

	// Used to claim on behalf of certain contracts e.g. Uniswap pool
	function claimOnBehalf(address recipient) external {
		require(msg.sender == harvester || msg.sender == owner());
		withdrawDividend(recipient);
	}

	// ==== ONLY OWNER ===== //

	function updateDistribution(address newDistribution) public onlyOwner {
		distribution = newDistribution;
		emit NewDistribution(newDistribution);
	}

	function pauseDeposits(bool trigger) external onlyOwner {
		if (trigger) _pause();
		else _unpause();
	}

	function changeHarvester(address harvester_) external onlyOwner {
		harvester = harvester_;

		emit HarvesterChanged(harvester_);
	}

	function changePerformanceFee(uint256 fee_) external onlyOwner {
		require(fee_ <= MAX_FEE);
		performanceFee = fee_;

		emit FeeUpdate(fee_);
	}

	// if limit == 0 then there is no deposit limit
	function setDepositLimit(uint256 limit) external onlyOwner {
		depositLimit = limit;

		emit DepositLimitUpdated(limit);
	}

	// Any tokens (other than the target) that are sent here by mistake are recoverable by the owner
	function sweep(address _token) external onlyOwner {
		require(_token != address(target));
		IERC20(_token).transfer(
			owner(),
			IERC20(_token).balanceOf(address(this))
		);
	}

	// ==== ONLY HARVESTER ===== //

	function harvest() external onlyHarvester returns (uint256 afterFee) {
		// Divest and claim rewards
		uint256 claimed = strat.claim();

		require(claimed > 0, "Nothing to harvest");

		if (performanceFee > 0) {
			// Calculate fees on underlying
			uint256 fee = claimed.mul(performanceFee).div(MAX_FEE);
			afterFee = claimed.sub(fee);
			rewards.safeTransfer(owner(), fee);
		} else {
			afterFee = claimed;
		}

		// Transfer rewards to harvester
		rewards.safeTransfer(harvester, afterFee);
	}

	function distribute(uint256 amount) external onlyHarvester {
		distributeDividends(amount);
		lastDistribution = block.timestamp;
	}

	// ==== ONLY TIMELOCK ===== //

	// The owner has to wait 2 days to confirm changing the strat.
	// This protects users from an upgrade to a malicious strategy
	// Users must watch the timelock contract on Etherscan for any transactions
	function setStrat(IStrat strat_, bool force) external {
		if (address(strat) != address(0)) {
			require(msg.sender == address(timelock), "Only Timelock");
			uint256 prevTotalValue = strat.calcTotalValue();
			strat.divest(prevTotalValue);
			underlying.safeTransfer(
				address(strat_),
				underlying.balanceOf(address(this))
			);
			strat_.invest();
			if (!force) {
				require(strat_.calcTotalValue() >= prevTotalValue);
				require(strat.calcTotalValue() == 0);
			}
		} else {
			require(msg.sender == owner());
			_unpause();
		}
		strat = strat_;

		emit StrategyChanged(address(strat));
	}
}

File 2 of 17 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";
/**
 * @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.
 */
abstract 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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual 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;
    }
}

File 3 of 17 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor () {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 4 of 17 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @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, IERC20Metadata {
    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The defaut value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override 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 this function is
     * overridden;
     *
     * 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 virtual override returns (uint8) {
        return 18;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual 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);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        _approve(sender, _msgSender(), currentAllowance - amount);

        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] + 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) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        _approve(_msgSender(), spender, currentAllowance - subtractedValue);

        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);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        _balances[sender] = senderBalance - amount;
        _balances[recipient] += 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 += amount;
        _balances[account] += 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);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        _balances[account] = accountBalance - amount;
        _totalSupply -= 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 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 { }
}

File 5 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 6 of 17 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 7 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using 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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _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");
        }
    }
}

File 8 of 17 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 9 of 17 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/*
 * @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 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) {
        return msg.sender;
    }

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

File 10 of 17 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * 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).
     *
     * 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) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 11 of 17 : IDistribution.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IDistribution {
	function stake(address user, uint256 redeemTokens) external;

	function withdraw(address user, uint256 redeemAmount) external;

	function getReward(address user) external;

	function balanceOf(address account) external view returns (uint256);
}

File 12 of 17 : IStrat.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IStrat {
	function invest() external; // underlying amount must be sent from vault to strat address before

	function divest(uint256 amount) external; // should send requested amount to vault directly, not less or more

	function totalYield() external returns (uint256);

	function calcTotalValue() external view returns (uint256);

	function claim() external returns (uint256 claimed);
}

File 13 of 17 : IVault.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IERC20Detailed is IERC20 {
	function decimals() external view returns (uint8);
}

interface IVault {
	function totalSupply() external view returns (uint256);

	function harvest() external returns (uint256);

	function distribute(uint256 amount) external;

	function rewards() external view returns (IERC20);

	function underlying() external view returns (IERC20Detailed);

	function target() external view returns (IERC20);

	function harvester() external view returns (address);

	function owner() external view returns (address);

	function timelock() external view returns (address payable);

	function claimOnBehalf(address recipient) external;

	function lastDistribution() external view returns (uint256);

	function performanceFee() external view returns (uint256);

	function balanceOf(address) external view returns (uint256);

	function totalYield() external returns (uint256);

	function deposit(uint256 amount) external;

	function depositAndWait(uint256 amount) external;

	function withdraw(uint256 amount) external;

	function withdrawPending(uint256 amount) external;

	function changePerformanceFee(uint256 fee) external;

	function claim() external returns (uint256 claimed);

	function unclaimedProfit(address user) external view returns (uint256);

	function pending(address user) external view returns (uint256);
}

File 14 of 17 : SafeMathInt.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title SafeMathInt
 * @dev Math operations with safety checks that revert on error
 * @dev SafeMath adapted for int256
 * Based on code of  https://github.com/RequestNetwork/requestNetwork/blob/master/packages/requestNetworkSmartContracts/contracts/base/math/SafeMathInt.sol
 */
library SafeMathInt {
	function mul(int256 a, int256 b) internal pure returns (int256) {
		// Prevent overflow when multiplying INT256_MIN with -1
		// https://github.com/RequestNetwork/requestNetwork/issues/43
		require(!(a == -2**255 && b == -1) && !(b == -2**255 && a == -1));

		int256 c = a * b;
		require((b == 0) || (c / b == a));
		return c;
	}

	function div(int256 a, int256 b) internal pure returns (int256) {
		// Prevent overflow when dividing INT256_MIN by -1
		// https://github.com/RequestNetwork/requestNetwork/issues/43
		require(!(a == -2**255 && b == -1) && (b > 0));

		return a / b;
	}

	function sub(int256 a, int256 b) internal pure returns (int256) {
		require((b >= 0 && a - b <= a) || (b < 0 && a - b > a));

		return a - b;
	}

	function add(int256 a, int256 b) internal pure returns (int256) {
		int256 c = a + b;
		require((b >= 0 && c >= a) || (b < 0 && c < a));
		return c;
	}

	function toUint256Safe(int256 a) internal pure returns (uint256) {
		require(a >= 0);
		return uint256(a);
	}
}

File 15 of 17 : SafeMathUint.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title SafeMathUint
 * @dev Math operations with safety checks that revert on error
 */
library SafeMathUint {
	function toInt256Safe(uint256 a) internal pure returns (int256) {
		int256 b = int256(a);
		require(b >= 0);
		return b;
	}
}

File 16 of 17 : Timelock.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";

contract Timelock {
	using SafeMath for uint256;

	event NewAdmin(address indexed newAdmin);
	event NewPendingAdmin(address indexed newPendingAdmin);
	event NewDelay(uint256 indexed newDelay);
	event CancelTransaction(
		bytes32 indexed txHash,
		address indexed target,
		uint256 value,
		string signature,
		bytes data,
		uint256 eta
	);
	event ExecuteTransaction(
		bytes32 indexed txHash,
		address indexed target,
		uint256 value,
		string signature,
		bytes data,
		uint256 eta
	);
	event QueueTransaction(
		bytes32 indexed txHash,
		address indexed target,
		uint256 value,
		string signature,
		bytes data,
		uint256 eta
	);

	uint256 public constant GRACE_PERIOD = 14 days;
	uint256 public constant MINIMUM_DELAY = 1 days;
	uint256 public constant MAXIMUM_DELAY = 30 days;

	address public admin;
	address public pendingAdmin;
	uint256 public delay;

	mapping(bytes32 => bool) public queuedTransactions;

	constructor(address admin_, uint256 delay_) {
		require(
			delay_ >= MINIMUM_DELAY,
			"Timelock::constructor: Delay must exceed minimum delay."
		);
		require(
			delay_ <= MAXIMUM_DELAY,
			"Timelock::setDelay: Delay must not exceed maximum delay."
		);

		admin = admin_;
		delay = delay_;
	}

	receive() external payable {}

	function setDelay(uint256 delay_) public {
		require(
			msg.sender == address(this),
			"Timelock::setDelay: Call must come from Timelock."
		);
		require(
			delay_ >= MINIMUM_DELAY,
			"Timelock::setDelay: Delay must exceed minimum delay."
		);
		require(
			delay_ <= MAXIMUM_DELAY,
			"Timelock::setDelay: Delay must not exceed maximum delay."
		);
		delay = delay_;

		emit NewDelay(delay);
	}

	function acceptAdmin() public {
		require(
			msg.sender == pendingAdmin,
			"Timelock::acceptAdmin: Call must come from pendingAdmin."
		);
		admin = msg.sender;
		pendingAdmin = address(0);

		emit NewAdmin(admin);
	}

	function setPendingAdmin(address pendingAdmin_) public {
		require(
			msg.sender == address(this),
			"Timelock::setPendingAdmin: Call must come from Timelock."
		);
		pendingAdmin = pendingAdmin_;

		emit NewPendingAdmin(pendingAdmin);
	}

	function queueTransaction(
		address target,
		uint256 value,
		string memory signature,
		bytes memory data,
		uint256 eta
	) public returns (bytes32) {
		require(
			msg.sender == admin,
			"Timelock::queueTransaction: Call must come from admin."
		);
		require(
			eta >= getBlockTimestamp().add(delay),
			"Timelock::queueTransaction: Estimated execution block must satisfy delay."
		);

		bytes32 txHash = keccak256(
			abi.encode(target, value, signature, data, eta)
		);
		queuedTransactions[txHash] = true;

		emit QueueTransaction(txHash, target, value, signature, data, eta);
		return txHash;
	}

	function cancelTransaction(
		address target,
		uint256 value,
		string memory signature,
		bytes memory data,
		uint256 eta
	) public {
		require(
			msg.sender == admin,
			"Timelock::cancelTransaction: Call must come from admin."
		);

		bytes32 txHash = keccak256(
			abi.encode(target, value, signature, data, eta)
		);
		queuedTransactions[txHash] = false;

		emit CancelTransaction(txHash, target, value, signature, data, eta);
	}

	function executeTransaction(
		address target,
		uint256 value,
		string memory signature,
		bytes memory data,
		uint256 eta
	) public payable returns (bytes memory) {
		require(
			msg.sender == admin,
			"Timelock::executeTransaction: Call must come from admin."
		);

		bytes32 txHash = keccak256(
			abi.encode(target, value, signature, data, eta)
		);
		require(
			queuedTransactions[txHash],
			"Timelock::executeTransaction: Transaction hasn't been queued."
		);
		require(
			getBlockTimestamp() >= eta,
			"Timelock::executeTransaction: Transaction hasn't surpassed time lock."
		);
		require(
			getBlockTimestamp() <= eta.add(GRACE_PERIOD),
			"Timelock::executeTransaction: Transaction is stale."
		);

		queuedTransactions[txHash] = false;

		bytes memory callData;

		if (bytes(signature).length == 0) {
			callData = data;
		} else {
			callData = abi.encodePacked(
				bytes4(keccak256(bytes(signature))),
				data
			);
		}

		// solium-disable-next-line security/no-call-value
		(bool success, bytes memory returnData) = target.call{value: value}(
			callData
		);
		require(
			success,
			"Timelock::executeTransaction: Transaction execution reverted."
		);

		emit ExecuteTransaction(txHash, target, value, signature, data, eta);

		return returnData;
	}

	function getBlockTimestamp() internal view returns (uint256) {
		// solium-disable-next-line security/no-block-members
		return block.timestamp;
	}
}

File 17 of 17 : DividendToken.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "../libs/SafeMathUint.sol";
import "../libs/SafeMathInt.sol";

/// @title Dividend-Paying Token
/// @author Roger Wu (https://github.com/roger-wu)
/// @dev A mintable ERC20 token that allows anyone to pay and distribute a target token
///  to token holders as dividends and allows token holders to withdraw their dividends.
///  Reference: the source code of PoWH3D: https://etherscan.io/address/0xB3775fB83F7D12A36E0475aBdD1FCA35c091efBe#code
contract DividendToken is ERC20 {
	using SafeMath for uint256;
	using SafeMathUint for uint256;
	using SafeMathInt for int256;
	using SafeERC20 for IERC20;

	IERC20 public target;

	uint8 _decimals;

	// With `MAGNITUDE`, we can properly distribute dividends even if the amount of received target is small.
	// For more discussion about choosing the value of `MAGNITUDE`,
	//  see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728
	uint256 internal constant MAGNITUDE = 2**165;

	uint256 internal magnifiedDividendPerShare;

	// About dividendCorrection:
	// If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with:
	//   `dividendOf(_user) = dividendPerShare * balanceOf(_user)`.
	// When `balanceOf(_user)` is changed (via minting/burning/transferring tokens),
	//   `dividendOf(_user)` should not be changed,
	//   but the computed value of `dividendPerShare * balanceOf(_user)` is changed.
	// To keep the `dividendOf(_user)` unchanged, we add a correction term:
	//   `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`,
	//   where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed:
	//   `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`.
	// So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed.
	mapping(address => int256) internal magnifiedDividendCorrections;
	mapping(address => uint256) internal withdrawnDividends;

	constructor(
		IERC20 target_,
		string memory name_,
		string memory symbol_,
		uint8 decimals_
	) ERC20(name_, symbol_) {
		_decimals = decimals_;
		target = target_;
	}

	function decimals() public view override returns (uint8) {
		return _decimals;
	}

	/// @notice Distributes target to token holders as dividends.
	/// @dev It reverts if the total supply of tokens is 0.
	/// It emits the `DividendsDistributed` event if the amount of received target is greater than 0.
	/// About undistributed target tokens:
	///   In each distribution, there is a small amount of target not distributed,
	///     the magnified amount of which is
	///     `(amount * MAGNITUDE) % totalSupply()`.
	///   With a well-chosen `MAGNITUDE`, the amount of undistributed target
	///     (de-magnified) in a distribution can be less than 1 wei.
	///   We can actually keep track of the undistributed target in a distribution
	///     and try to distribute it in the next distribution,
	///     but keeping track of such data on-chain costs much more than
	///     the saved target, so we don't do that.
	function distributeDividends(uint256 amount) internal {
		require(totalSupply() > 0, "ZERO SUPPLY");
		require(amount > 0, "!AMOUNT");

		magnifiedDividendPerShare = magnifiedDividendPerShare.add(
			(amount).mul(MAGNITUDE) / totalSupply()
		);

		target.safeTransferFrom(msg.sender, address(this), amount);

		emit DividendsDistributed(msg.sender, amount);
	}

	/// @notice Withdraws the target distributed to the sender.
	/// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn target is greater than 0.
	function withdrawDividend(address user)
		internal
		returns (uint256 _withdrawableDividend)
	{
		_withdrawableDividend = withdrawableDividendOf(user);
		if (_withdrawableDividend > 0) {
			withdrawnDividends[user] = withdrawnDividends[user].add(
				_withdrawableDividend
			);
			emit DividendWithdrawn(user, _withdrawableDividend);
			target.safeTransfer(user, _withdrawableDividend);
		}
	}

	/// @notice View the amount of dividend in wei that an address can withdraw.
	/// @param _owner The address of a token holder.
	/// @return The amount of dividend in wei that `_owner` can withdraw.
	function dividendOf(address _owner) external view returns (uint256) {
		return withdrawableDividendOf(_owner);
	}

	/// @notice View the amount of dividend in wei that an address can withdraw.
	/// @param _owner The address of a token holder.
	/// @return The amount of dividend in wei that `_owner` can withdraw.
	function withdrawableDividendOf(address _owner)
		internal
		view
		returns (uint256)
	{
		return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);
	}

	/// @notice View the amount of dividend in wei that an address has withdrawn.
	/// @param _owner The address of a token holder.
	/// @return The amount of dividend in wei that `_owner` has withdrawn.
	function withdrawnDividendOf(address _owner)
		external
		view
		returns (uint256)
	{
		return withdrawnDividends[_owner];
	}

	/// @notice View the amount of dividend in wei that an address has earned in total.
	/// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)
	/// = (magnifiedDividendPerShare * balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / MAGNITUDE
	/// @param _owner The address of a token holder.
	/// @return The amount of dividend in wei that `_owner` has earned in total.
	function accumulativeDividendOf(address _owner)
		public
		view
		returns (uint256)
	{
		return
			magnifiedDividendPerShare
			.mul(balanceOf(_owner))
			.toInt256Safe()
			.add(magnifiedDividendCorrections[_owner])
			.toUint256Safe() / MAGNITUDE;
	}

	/// @dev Internal function that transfer tokens from one address to another.
	/// Update magnifiedDividendCorrections to keep dividends unchanged.
	/// @param from The address to transfer from.
	/// @param to The address to transfer to.
	/// @param value The amount to be transferred.
	function _transfer(
		address from,
		address to,
		uint256 value
	) internal override {
		super._transfer(from, to, value);

		int256 _magCorrection = magnifiedDividendPerShare
		.mul(value)
		.toInt256Safe();
		magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from]
		.add(_magCorrection);
		magnifiedDividendCorrections[to] = magnifiedDividendCorrections[to].sub(
			_magCorrection
		);
	}

	/// @dev Internal function that mints tokens to an account.
	/// Update magnifiedDividendCorrections to keep dividends unchanged.
	/// @param account The account that will receive the created tokens.
	/// @param value The amount that will be created.
	function _mint(address account, uint256 value) internal override {
		super._mint(account, value);

		magnifiedDividendCorrections[account] = magnifiedDividendCorrections[
			account
		]
		.sub((magnifiedDividendPerShare.mul(value)).toInt256Safe());
	}

	/// @dev Internal function that burns an amount of the token of a given account.
	/// Update magnifiedDividendCorrections to keep dividends unchanged.
	/// @param account The account whose tokens will be burnt.
	/// @param value The amount that will be burnt.
	function _burn(address account, uint256 value) internal override {
		super._burn(account, value);

		magnifiedDividendCorrections[account] = magnifiedDividendCorrections[
			account
		]
		.add((magnifiedDividendPerShare.mul(value)).toInt256Safe());
	}

	/// @dev This event MUST emit when target is distributed to token holders.
	/// @param from The address which sends target to this contract.
	/// @param weiAmount The amount of distributed target in wei.
	event DividendsDistributed(address indexed from, uint256 weiAmount);

	/// @dev This event MUST emit when an address withdraws their dividend.
	/// @param to The address which withdraws target from this contract.
	/// @param weiAmount The amount of withdrawn target in wei.
	event DividendWithdrawn(address indexed to, uint256 weiAmount);
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20Detailed","name":"underlying_","type":"address"},{"internalType":"contract IERC20","name":"target_","type":"address"},{"internalType":"contract IERC20","name":"rewards_","type":"address"},{"internalType":"address","name":"harvester_","type":"address"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"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":"newLimit","type":"uint256"}],"name":"DepositLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"weiAmount","type":"uint256"}],"name":"DividendWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"weiAmount","type":"uint256"}],"name":"DividendsDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"FeeUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newHarvester","type":"address"}],"name":"HarvesterChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newDistribution","type":"address"}],"name":"NewDistribution","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"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newStrat","type":"address"}],"name":"StrategyChanged","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"accumulativeDividendOf","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":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calcTotalValue","outputs":[{"internalType":"uint256","name":"underlyingAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"harvester_","type":"address"}],"name":"changeHarvester","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee_","type":"uint256"}],"name":"changePerformanceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claim","outputs":[{"internalType":"uint256","name":"claimed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"claimOnBehalf","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distribution","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"dividendOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"harvest","outputs":[{"internalType":"uint256","name":"afterFee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvester","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"lastDistribution","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":[{"internalType":"bool","name":"trigger","type":"bool"}],"name":"pauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewards","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"setDepositLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IStrat","name":"strat_","type":"address"},{"internalType":"bool","name":"force","type":"bool"}],"name":"setStrat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strat","outputs":[{"internalType":"contract IStrat","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"sweep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"target","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"contract Timelock","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalYield","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","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":[{"internalType":"address","name":"user","type":"address"}],"name":"unclaimedProfit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20Detailed","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newDistribution","type":"address"}],"name":"updateDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"withdrawnDividendOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040526000600f553480156200001657600080fd5b5060405162004020380380620040208339810160408190526200003991620004bf565b848282886001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200007657600080fd5b505afa1580156200008b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000b191906200057b565b600080546001600160a01b03191633908117825560405185928592918291907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506000805460ff60a01b1916905581516200011890600490602085019062000358565b5080516200012e90600590602084019062000358565b5050600680546001600160a01b039687166001600160a01b031960ff909516600160a01b0285166001600160a81b03199092169190911717905550600a80548b86169083168117909155600b80548a8716908416179055600e80549589169590921694909417905550506040805163313ce56760e01b8152905163313ce56791600480820192602092909190829003018186803b158015620001cf57600080fd5b505afa158015620001e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020a91906200057b565b6200021790600a620005ee565b6200022590614e20620006af565b60105560405133906202a300906200023d90620003e7565b6001600160a01b0390921682526020820152604001604051809103906000f0801580156200026f573d6000803e3d6000fd5b50600d80546001600160a01b0319166001600160a01b03929092169190911790556200029a620002a6565b50505050505062000753565b620002ba600054600160a01b900460ff1690565b15620002ff5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640160405180910390fd5b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586200033b3390565b6040516001600160a01b03909116815260200160405180910390a1565b8280546200036690620006d1565b90600052602060002090601f0160209004810192826200038a5760008555620003d5565b82601f10620003a557805160ff1916838001178555620003d5565b82800160010185558215620003d5579182015b82811115620003d5578251825591602001919060010190620003b8565b50620003e3929150620003f5565b5090565b6110cc8062002f5483390190565b5b80821115620003e35760008155600101620003f6565b600082601f8301126200041d578081fd5b81516001600160401b03808211156200043a576200043a62000724565b604051601f8301601f19908116603f0116810190828211818310171562000465576200046562000724565b8160405283815260209250868385880101111562000481578485fd5b8491505b83821015620004a4578582018301518183018401529082019062000485565b83821115620004b557848385830101525b9695505050505050565b60008060008060008060c08789031215620004d8578182fd5b8651620004e5816200073a565b6020880151909650620004f8816200073a565b60408801519095506200050b816200073a565b60608801519094506200051e816200073a565b60808801519093506001600160401b03808211156200053b578384fd5b620005498a838b016200040c565b935060a08901519150808211156200055f578283fd5b506200056e89828a016200040c565b9150509295509295509295565b6000602082840312156200058d578081fd5b815160ff811681146200059e578182fd5b9392505050565b600181815b80851115620005e6578160001904821115620005ca57620005ca6200070e565b80851615620005d857918102915b93841c9390800290620005aa565b509250929050565b60006200059e60ff8416836000826200060a57506001620006a9565b816200061957506000620006a9565b81600181146200063257600281146200063d576200065d565b6001915050620006a9565b60ff8411156200065157620006516200070e565b50506001821b620006a9565b5060208310610133831016604e8410600b841016171562000682575081810a620006a9565b6200068e8383620005a5565b8060001904821115620006a557620006a56200070e565b0290505b92915050565b6000816000190483118215151615620006cc57620006cc6200070e565b500290565b600181811c90821680620006e657607f821691505b602082108114156200070857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200075057600080fd5b50565b6127f180620007636000396000f3fe608060405234801561001057600080fd5b50600436106102745760003560e01c806370a0823111610151578063a717639c116100c3578063d33219b411610087578063d33219b41461054b578063d4b839921461055e578063dd62ed3e14610571578063ecf70858146105aa578063f2fde38b146105b3578063f6156d5a146105c657600080fd5b8063a717639c146104e0578063a9059cbb146104e9578063aafd847a146104fc578063b6b55f2514610525578063bdc8144b1461053857600080fd5b806391b89fba1161011557806391b89fba1461030c57806391c05b0b1461049757806395d89b41146104aa5780639ec5a894146104b2578063a00251c6146104c5578063a457c2d7146104cd57600080fd5b806370a0823114610439578063715018a614610462578063738b62e51461046a578063877887821461047d5780638da5cb5b1461048657600080fd5b80632e1a7d4d116101ea5780634bdaeac1116101ae5780634bdaeac1146103d35780634e71d92d146103e65780635c975abb146103ee5780635ee58efc146104005780636466f45e146104135780636f307dc31461042657600080fd5b80632e1a7d4d14610373578063313ce5671461038657806339509351146103a55780634641257d146103b85780634710f2db146103c057600080fd5b80630b3c57d81161023c5780630b3c57d81461030c57806318160ddd1461031f57806323b872dd1461032757806326e2929e1461033a57806327ce01471461034d5780632d4d1b431461036057600080fd5b8063014182051461027957806301681a6214610294578063059b2a10146102a957806306fdde03146102d4578063095ea7b3146102e9575b600080fd5b6102816105d9565b6040519081526020015b60405180910390f35b6102a76102a2366004612455565b61065c565b005b600c546102bc906001600160a01b031681565b6040516001600160a01b03909116815260200161028b565b6102dc6107c4565b60405161028b91906125c5565b6102fc6102f73660046124e9565b610856565b604051901515815260200161028b565b61028161031a366004612455565b61086c565b600354610281565b6102fc6103353660046124a9565b61087d565b6102a761034836600461254c565b610930565b61028161035b366004612455565b610cda565b6102a761036e366004612455565b610d37565b6102a7610381366004612579565b610db6565b600654600160a01b900460ff1660405160ff909116815260200161028b565b6102fc6103b33660046124e9565b610ef2565b610281610f29565b6102a76103ce366004612455565b611094565b600e546102bc906001600160a01b031681565b61028161110c565b600054600160a01b900460ff166102fc565b6012546102bc906001600160a01b031681565b6102a7610421366004612455565b61118c565b600a546102bc906001600160a01b031681565b610281610447366004612455565b6001600160a01b031660009081526001602052604090205490565b6102a76111c1565b6102a7610478366004612514565b611235565b610281600f5481565b6000546001600160a01b03166102bc565b6102a76104a5366004612579565b611278565b6102dc61129f565b600b546102bc906001600160a01b031681565b6102816112ae565b6102fc6104db3660046124e9565b611307565b61028160115481565b6102fc6104f73660046124e9565b6113a2565b61028161050a366004612455565b6001600160a01b031660009081526009602052604090205490565b6102a7610533366004612579565b6113af565b6102a7610546366004612579565b61156c565b600d546102bc906001600160a01b031681565b6006546102bc906001600160a01b031681565b61028161057f366004612471565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61028160105481565b6102a76105c1366004612455565b6115cb565b6102a76105d4366004612579565b6116b5565b600c5460408051630141820560e01b815290516000926001600160a01b031691630141820591600480830192602092919082900301818787803b15801561061f57600080fd5b505af1158015610633573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106579190612591565b905090565b6000546001600160a01b0316331461068f5760405162461bcd60e51b8152600401610686906125f8565b60405180910390fd5b6006546001600160a01b03828116911614156106aa57600080fd5b806001600160a01b031663a9059cbb6106cb6000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a082319060240160206040518083038186803b15801561070a57600080fd5b505afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190612591565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561078857600080fd5b505af115801561079c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c09190612530565b5050565b6060600480546107d390612747565b80601f01602080910402602001604051908101604052809291908181526020018280546107ff90612747565b801561084c5780601f106108215761010080835404028352916020019161084c565b820191906000526020600020905b81548152906001019060200180831161082f57829003601f168201915b5050505050905090565b6000610863338484611723565b50600192915050565b600061087782611848565b92915050565b600061088a848484611874565b6001600160a01b03841660009081526002602090815260408083203384529091529020548281101561090f5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610686565b610923853361091e8685612704565b611723565b60019150505b9392505050565b600c546001600160a01b031615610c6657600d546001600160a01b0316331461098b5760405162461bcd60e51b815260206004820152600d60248201526c4f6e6c792054696d656c6f636b60981b6044820152606401610686565b600c546040805163500128e360e11b815290516000926001600160a01b03169163a00251c6916004808301926020929190829003018186803b1580156109d057600080fd5b505afa1580156109e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a089190612591565b600c54604051638ca1799560e01b8152600481018390529192506001600160a01b031690638ca1799590602401600060405180830381600087803b158015610a4f57600080fd5b505af1158015610a63573d6000803e3d6000fd5b5050600a546040516370a0823160e01b8152306004820152610afb93508692506001600160a01b03909116906370a082319060240160206040518083038186803b158015610ab057600080fd5b505afa158015610ac4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae89190612591565b600a546001600160a01b03169190611910565b826001600160a01b031663e8b5e51f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610b3657600080fd5b505af1158015610b4a573d6000803e3d6000fd5b5050505081610c605780836001600160a01b031663a00251c66040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8d57600080fd5b505afa158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc59190612591565b1015610bd057600080fd5b600c60009054906101000a90046001600160a01b03166001600160a01b031663a00251c66040518163ffffffff1660e01b815260040160206040518083038186803b158015610c1e57600080fd5b505afa158015610c32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c569190612591565b15610c6057600080fd5b50610c85565b6000546001600160a01b03163314610c7d57600080fd5b610c85611978565b600c80546001600160a01b0319166001600160a01b0384169081179091556040519081527fafd1cdc355e15bfc9038294be1c6203ce953704fda8c991bebe78ddd4d5420d19060200160405180910390a15050565b6001600160a01b0381166000908152600860209081526040808320546001909252822054600754600160a51b92610d2d92610d2892610d2291610d1d9190611a15565b611a21565b90611a31565b611a6f565b6108779190612686565b6000546001600160a01b03163314610d615760405162461bcd60e51b8152600401610686906125f8565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527f0f8256c831e1866cc4315c7c4431eacea7efb3d404a3dff6bd41f5f474549f2c906020015b60405180910390a150565b60008111610df45760405162461bcd60e51b815260206004820152600b60248201526a16915493cb505353d5539560aa1b6044820152606401610686565b610dfe3382611a7e565b600c54604051638ca1799560e01b8152600481018390526001600160a01b0390911690638ca1799590602401600060405180830381600087803b158015610e4457600080fd5b505af1158015610e58573d6000803e3d6000fd5b5050600a54610e7492506001600160a01b031690503383611910565b6012546001600160a01b031615610eea5760125460405163f3fef3a360e01b8152336004820152602481018390526001600160a01b039091169063f3fef3a390604401600060405180830381600087803b158015610ed157600080fd5b505af1158015610ee5573d6000803e3d6000fd5b505050505b6107c061110c565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909161086391859061091e90869061266e565b600e546000906001600160a01b03163314610f4357600080fd5b600c5460408051634e71d92d60e01b815290516000926001600160a01b031691634e71d92d91600480830192602092919082900301818787803b158015610f8957600080fd5b505af1158015610f9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc19190612591565b9050600081116110085760405162461bcd60e51b8152602060048201526012602482015271139bdd1a1a5b99c81d1bc81a185c9d995cdd60721b6044820152606401610686565b600f541561106f57600061103361271061102d600f5485611a1590919063ffffffff16565b90611ae2565b905061103f8282611aee565b92506110696110566000546001600160a01b031690565b600b546001600160a01b03169083611910565b50611073565b8091505b600e54600b54611090916001600160a01b03918216911684611910565b5090565b6000546001600160a01b031633146110be5760405162461bcd60e51b8152600401610686906125f8565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fbc4454368f1c71b4fff50bf3bb8a557289012c4c6f7229ce21d566bff33f8b9390602001610dab565b600061111733611afa565b6012549091506001600160a01b03161561118957601254604051630c00007b60e41b81523360048201526001600160a01b039091169063c00007b090602401600060405180830381600087803b15801561117057600080fd5b505af1158015611184573d6000803e3d6000fd5b505050505b90565b600e546001600160a01b03163314806111af57506000546001600160a01b031633145b6111b857600080fd5b6107c081611afa565b6000546001600160a01b031633146111eb5760405162461bcd60e51b8152600401610686906125f8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461125f5760405162461bcd60e51b8152600401610686906125f8565b80156112705761126d611ba3565b50565b61126d611978565b600e546001600160a01b0316331461128f57600080fd5b61129881611c2b565b5042601155565b6060600580546107d390612747565b600c546040805163500128e360e11b815290516000926001600160a01b03169163a00251c6916004808301926020929190829003018186803b1580156112f357600080fd5b505afa158015610633573d6000803e3d6000fd5b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156113895760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610686565b611398338561091e8685612704565b5060019392505050565b6000610863338484611874565b600054600160a01b900460ff16156113fc5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610686565b6000811161143a5760405162461bcd60e51b815260206004820152600b60248201526a16915493cb505353d5539560aa1b6044820152606401610686565b60105415611463576010546114588261145260035490565b90611d2b565b111561146357600080fd5b600c54600a54611482916001600160a01b039182169133911684611d37565b600c60009054906101000a90046001600160a01b03166001600160a01b031663e8b5e51f6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156114d257600080fd5b505af11580156114e6573d6000803e3d6000fd5b505050506114f43382611d75565b6012546001600160a01b03161561126d576012546040516356e4bb9760e11b8152336004820152602481018390526001600160a01b039091169063adc9772e90604401600060405180830381600087803b15801561155157600080fd5b505af1158015611565573d6000803e3d6000fd5b5050505050565b6000546001600160a01b031633146115965760405162461bcd60e51b8152600401610686906125f8565b60108190556040518181527fc512617347fd848ec9d7347c99c10e4fa7059132c92d0445930a7fb0c8252ff590602001610dab565b6000546001600160a01b031633146115f55760405162461bcd60e51b8152600401610686906125f8565b6001600160a01b03811661165a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610686565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146116df5760405162461bcd60e51b8152600401610686906125f8565b6127108111156116ee57600080fd5b600f8190556040518181527f88258d7c1f0510045362f22cdeb36a2c501ef80d7a06168881189fb8480cfe2f90602001610dab565b6001600160a01b0383166117855760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610686565b6001600160a01b0382166117e65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610686565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0381166000908152600960205260408120546108779061186e84610cda565b90611aee565b61187f838383611db9565b6000611899610d1d83600754611a1590919063ffffffff16565b6001600160a01b0385166000908152600860205260409020549091506118bf9082611a31565b6001600160a01b0380861660009081526008602052604080822093909355908516815220546118ee9082611f91565b6001600160a01b03909316600090815260086020526040902092909255505050565b6040516001600160a01b03831660248201526044810182905261197390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fdd565b505050565b600054600160a01b900460ff166119c85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610686565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061092982846126a6565b6000818181121561087757600080fd5b600080611a3e838561262d565b905060008312158015611a515750838112155b80611a665750600083128015611a6657508381125b61092957600080fd5b60008082121561109057600080fd5b611a8882826120af565b611ac2611aa3610d1d83600754611a1590919063ffffffff16565b6001600160a01b03841660009081526008602052604090205490611a31565b6001600160a01b0390921660009081526008602052604090209190915550565b60006109298284612686565b60006109298284612704565b6000611b0582611848565b90508015611b9e576001600160a01b038216600090815260096020526040902054611b309082611d2b565b6001600160a01b038316600081815260096020526040908190209290925590517fee503bee2bb6a87e57bc57db795f98137327401a0e7b7ce42e37926cc1a9ca4d90611b7f9084815260200190565b60405180910390a2600654611b9e906001600160a01b03168383611910565b919050565b600054600160a01b900460ff1615611bf05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610686565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119f83390565b6000611c3660035490565b11611c715760405162461bcd60e51b815260206004820152600b60248201526a5a45524f20535550504c5960a81b6044820152606401610686565b60008111611cab5760405162461bcd60e51b815260206004820152600760248201526608505353d5539560ca1b6044820152606401610686565b611cd8611cb760035490565b611cc583600160a51b611a15565b611ccf9190612686565b60075490611d2b565b600755600654611cf3906001600160a01b0316333084611d37565b60405181815233907fa493a9229478c3fcd73f66d2cdeb7f94fd0f341da924d1054236d784541165119060200160405180910390a250565b6000610929828461266e565b6040516001600160a01b0380851660248301528316604482015260648101829052611d6f9085906323b872dd60e01b9060840161193c565b50505050565b611d7f82826121fe565b611ac2611d9a610d1d83600754611a1590919063ffffffff16565b6001600160a01b03841660009081526008602052604090205490611f91565b6001600160a01b038316611e1d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610686565b6001600160a01b038216611e7f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610686565b6001600160a01b03831660009081526001602052604090205481811015611ef75760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610686565b611f018282612704565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290611f3790849061266e565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f8391815260200190565b60405180910390a350505050565b6000808212158015611fac575082611fa983826126c5565b13155b80611fca5750600082128015611fca575082611fc883826126c5565b135b611fd357600080fd5b61092982846126c5565b6000612032826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122dd9092919063ffffffff16565b80519091501561197357808060200190518101906120509190612530565b6119735760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610686565b6001600160a01b03821661210f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610686565b6001600160a01b038216600090815260016020526040902054818110156121835760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610686565b61218d8282612704565b6001600160a01b038416600090815260016020526040812091909155600380548492906121bb908490612704565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161183b565b6001600160a01b0382166122545760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610686565b8060036000828254612266919061266e565b90915550506001600160a01b0382166000908152600160205260408120805483929061229390849061266e565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606122ec84846000856122f4565b949350505050565b6060824710156123555760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610686565b843b6123a35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610686565b600080866001600160a01b031685876040516123bf91906125a9565b60006040518083038185875af1925050503d80600081146123fc576040519150601f19603f3d011682016040523d82523d6000602084013e612401565b606091505b509150915061241182828661241c565b979650505050505050565b6060831561242b575081610929565b82511561243b5782518084602001fd5b8160405162461bcd60e51b815260040161068691906125c5565b600060208284031215612466578081fd5b813561092981612798565b60008060408385031215612483578081fd5b823561248e81612798565b9150602083013561249e81612798565b809150509250929050565b6000806000606084860312156124bd578081fd5b83356124c881612798565b925060208401356124d881612798565b929592945050506040919091013590565b600080604083850312156124fb578182fd5b823561250681612798565b946020939093013593505050565b600060208284031215612525578081fd5b8135610929816127ad565b600060208284031215612541578081fd5b8151610929816127ad565b6000806040838503121561255e578182fd5b823561256981612798565b9150602083013561249e816127ad565b60006020828403121561258a578081fd5b5035919050565b6000602082840312156125a2578081fd5b5051919050565b600082516125bb81846020870161271b565b9190910192915050565b60208152600082518060208401526125e481604085016020870161271b565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600080821280156001600160ff1b038490038513161561264f5761264f612782565b600160ff1b839003841281161561266857612668612782565b50500190565b6000821982111561268157612681612782565b500190565b6000826126a157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156126c0576126c0612782565b500290565b60008083128015600160ff1b8501841216156126e3576126e3612782565b6001600160ff1b03840183138116156126fe576126fe612782565b50500390565b60008282101561271657612716612782565b500390565b60005b8381101561273657818101518382015260200161271e565b83811115611d6f5750506000910152565b600181811c9082168061275b57607f821691505b6020821081141561277c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461126d57600080fd5b801515811461126d57600080fdfea2646970667358221220112276cca62cb60cbb901588906c521be7eab4ed9decd34adbd88407fdd2b1c364736f6c63430008040033608060405234801561001057600080fd5b506040516110cc3803806110cc83398101604081905261002f9161014f565b620151808110156100ad5760405162461bcd60e51b815260206004820152603760248201527f54696d656c6f636b3a3a636f6e7374727563746f723a2044656c6179206d757360448201527f7420657863656564206d696e696d756d2064656c61792e00000000000000000060648201526084015b60405180910390fd5b62278d008111156101265760405162461bcd60e51b815260206004820152603860248201527f54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e60448201527f6f7420657863656564206d6178696d756d2064656c61792e000000000000000060648201526084016100a4565b600080546001600160a01b0319166001600160a01b039390931692909217909155600255610187565b60008060408385031215610161578182fd5b82516001600160a01b0381168114610177578283fd5b6020939093015192949293505050565b610f36806101966000396000f3fe6080604052600436106100c65760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e2146101fc578063e177246e14610213578063f2b0653714610233578063f851a4401461027357600080fd5b80636a42b8f8146101b85780637d645fab146101ce578063b1b43ae5146101e557600080fd5b80630825f38f146100d25780630e18b681146100fb57806326782247146101125780633a66f9011461014a5780634dd18bf514610178578063591fcdfe1461019857600080fd5b366100cd57005b600080fd5b6100e56100e0366004610c9d565b610293565b6040516100f29190610e26565b60405180910390f35b34801561010757600080fd5b50610110610604565b005b34801561011e57600080fd5b50600154610132906001600160a01b031681565b6040516001600160a01b0390911681526020016100f2565b34801561015657600080fd5b5061016a610165366004610c9d565b6106cd565b6040519081526020016100f2565b34801561018457600080fd5b50610110610193366004610c83565b610880565b3480156101a457600080fd5b506101106101b3366004610c9d565b61093f565b3480156101c457600080fd5b5061016a60025481565b3480156101da57600080fd5b5061016a62278d0081565b3480156101f157600080fd5b5061016a6201518081565b34801561020857600080fd5b5061016a6212750081565b34801561021f57600080fd5b5061011061022e366004610d49565b610a59565b34801561023f57600080fd5b5061026361024e366004610d49565b60036020526000908152604090205460ff1681565b60405190151581526020016100f2565b34801561027f57600080fd5b50600054610132906001600160a01b031681565b6000546060906001600160a01b0316331461031b5760405162461bcd60e51b815260206004820152603860248201527f54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a20436160448201527f6c6c206d75737420636f6d652066726f6d2061646d696e2e000000000000000060648201526084015b60405180910390fd5b60008686868686604051602001610336959493929190610dda565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff166103c15760405162461bcd60e51b815260206004820152603d6024820152600080516020610ee183398151915260448201527f616e73616374696f6e206861736e2774206265656e207175657565642e0000006064820152608401610312565b824210156104335760405162461bcd60e51b81526020600482015260456024820152600080516020610ee183398151915260448201527f616e73616374696f6e206861736e2774207375727061737365642074696d65206064820152643637b1b59760d91b608482015260a401610312565b6104408362127500610bde565b4211156104995760405162461bcd60e51b81526020600482015260336024820152600080516020610ee183398151915260448201527230b739b0b1ba34b7b71034b99039ba30b6329760691b6064820152608401610312565b6000818152600360205260409020805460ff1916905584516060906104bf5750836104eb565b8580519060200120856040516020016104d9929190610d8d565b60405160208183030381529060405290505b600080896001600160a01b031689846040516105079190610dbe565b60006040518083038185875af1925050503d8060008114610544576040519150601f19603f3d011682016040523d82523d6000602084013e610549565b606091505b5091509150816105af5760405162461bcd60e51b815260206004820152603d6024820152600080516020610ee183398151915260448201527f616e73616374696f6e20657865637574696f6e2072657665727465642e0000006064820152608401610312565b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b6040516105ef9493929190610e39565b60405180910390a39998505050505050505050565b6001546001600160a01b031633146106845760405162461bcd60e51b815260206004820152603860248201527f54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737460448201527f20636f6d652066726f6d2070656e64696e6741646d696e2e00000000000000006064820152608401610312565b60008054336001600160a01b0319918216811783556001805490921690915560405190917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b600080546001600160a01b031633146107475760405162461bcd60e51b815260206004820152603660248201527f54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c6044820152751036bab9ba1031b7b6b290333937b69030b236b4b71760511b6064820152608401610312565b61075a6002546107544290565b90610bde565b8210156107e15760405162461bcd60e51b815260206004820152604960248201527f54696d656c6f636b3a3a71756575655472616e73616374696f6e3a204573746960448201527f6d6174656420657865637574696f6e20626c6f636b206d757374207361746973606482015268333c903232b630bc9760b91b608482015260a401610312565b600086868686866040516020016107fc959493929190610dda565b60408051601f19818403018152828252805160209182012060008181526003909252919020805460ff1916600117905591506001600160a01b0388169082907f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f9061086e908a908a908a908a90610e39565b60405180910390a39695505050505050565b3330146108f55760405162461bcd60e51b815260206004820152603860248201527f54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c2060448201527f6d75737420636f6d652066726f6d2054696d656c6f636b2e00000000000000006064820152608401610312565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b031633146109bf5760405162461bcd60e51b815260206004820152603760248201527f54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c60448201527f6c206d75737420636f6d652066726f6d2061646d696e2e0000000000000000006064820152608401610312565b600085858585856040516020016109da959493929190610dda565b60408051601f19818403018152828252805160209182012060008181526003909252919020805460ff1916905591506001600160a01b0387169082907f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8790610a49908990899089908990610e39565b60405180910390a3505050505050565b333014610ac25760405162461bcd60e51b815260206004820152603160248201527f54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f60448201527036b290333937b6902a34b6b2b637b1b59760791b6064820152608401610312565b62015180811015610b325760405162461bcd60e51b815260206004820152603460248201527f54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420656044820152733c31b2b2b21036b4b734b6bab6903232b630bc9760611b6064820152608401610312565b62278d00811115610bab5760405162461bcd60e51b815260206004820152603860248201527f54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e60448201527f6f7420657863656564206d6178696d756d2064656c61792e00000000000000006064820152608401610312565b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b6000610bea8284610e76565b9392505050565b600067ffffffffffffffff80841115610c0c57610c0c610eca565b604051601f8501601f19908116603f01168101908282118183101715610c3457610c34610eca565b81604052809350858152868686011115610c4d57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114610c7e57600080fd5b919050565b600060208284031215610c94578081fd5b610bea82610c67565b600080600080600060a08688031215610cb4578081fd5b610cbd86610c67565b945060208601359350604086013567ffffffffffffffff80821115610ce0578283fd5b818801915088601f830112610cf3578283fd5b610d0289833560208501610bf1565b94506060880135915080821115610d17578283fd5b508601601f81018813610d28578182fd5b610d3788823560208401610bf1565b95989497509295608001359392505050565b600060208284031215610d5a578081fd5b5035919050565b60008151808452610d79816020860160208601610e9a565b601f01601f19169290920160200192915050565b6001600160e01b0319831681528151600090610db0816004850160208701610e9a565b919091016004019392505050565b60008251610dd0818460208701610e9a565b9190910192915050565b60018060a01b038616815284602082015260a060408201526000610e0160a0830186610d61565b8281036060840152610e138186610d61565b9150508260808301529695505050505050565b602081526000610bea6020830184610d61565b848152608060208201526000610e526080830186610d61565b8281036040840152610e648186610d61565b91505082606083015295945050505050565b60008219821115610e9557634e487b7160e01b81526011600452602481fd5b500190565b60005b83811015610eb5578181015183820152602001610e9d565b83811115610ec4576000848401525b50505050565b634e487b7160e01b600052604160045260246000fdfe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472a2646970667358221220b4c538ed8b7d301e5eaaea44ab3ffdf3f80858a3cf5fba4b3c950396630c5ea864736f6c63430008040033000000000000000000000000e7a24ef0c5e95ffb0f6684b813a78f2a3ad7d1710000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000a248c6df64c3ac2f7508a8f8e74933e3f4bf616900000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000014455448412061334352562f455448205661756c740000000000000000000000000000000000000000000000000000000000000000000000000000000000000006655661756c740000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102745760003560e01c806370a0823111610151578063a717639c116100c3578063d33219b411610087578063d33219b41461054b578063d4b839921461055e578063dd62ed3e14610571578063ecf70858146105aa578063f2fde38b146105b3578063f6156d5a146105c657600080fd5b8063a717639c146104e0578063a9059cbb146104e9578063aafd847a146104fc578063b6b55f2514610525578063bdc8144b1461053857600080fd5b806391b89fba1161011557806391b89fba1461030c57806391c05b0b1461049757806395d89b41146104aa5780639ec5a894146104b2578063a00251c6146104c5578063a457c2d7146104cd57600080fd5b806370a0823114610439578063715018a614610462578063738b62e51461046a578063877887821461047d5780638da5cb5b1461048657600080fd5b80632e1a7d4d116101ea5780634bdaeac1116101ae5780634bdaeac1146103d35780634e71d92d146103e65780635c975abb146103ee5780635ee58efc146104005780636466f45e146104135780636f307dc31461042657600080fd5b80632e1a7d4d14610373578063313ce5671461038657806339509351146103a55780634641257d146103b85780634710f2db146103c057600080fd5b80630b3c57d81161023c5780630b3c57d81461030c57806318160ddd1461031f57806323b872dd1461032757806326e2929e1461033a57806327ce01471461034d5780632d4d1b431461036057600080fd5b8063014182051461027957806301681a6214610294578063059b2a10146102a957806306fdde03146102d4578063095ea7b3146102e9575b600080fd5b6102816105d9565b6040519081526020015b60405180910390f35b6102a76102a2366004612455565b61065c565b005b600c546102bc906001600160a01b031681565b6040516001600160a01b03909116815260200161028b565b6102dc6107c4565b60405161028b91906125c5565b6102fc6102f73660046124e9565b610856565b604051901515815260200161028b565b61028161031a366004612455565b61086c565b600354610281565b6102fc6103353660046124a9565b61087d565b6102a761034836600461254c565b610930565b61028161035b366004612455565b610cda565b6102a761036e366004612455565b610d37565b6102a7610381366004612579565b610db6565b600654600160a01b900460ff1660405160ff909116815260200161028b565b6102fc6103b33660046124e9565b610ef2565b610281610f29565b6102a76103ce366004612455565b611094565b600e546102bc906001600160a01b031681565b61028161110c565b600054600160a01b900460ff166102fc565b6012546102bc906001600160a01b031681565b6102a7610421366004612455565b61118c565b600a546102bc906001600160a01b031681565b610281610447366004612455565b6001600160a01b031660009081526001602052604090205490565b6102a76111c1565b6102a7610478366004612514565b611235565b610281600f5481565b6000546001600160a01b03166102bc565b6102a76104a5366004612579565b611278565b6102dc61129f565b600b546102bc906001600160a01b031681565b6102816112ae565b6102fc6104db3660046124e9565b611307565b61028160115481565b6102fc6104f73660046124e9565b6113a2565b61028161050a366004612455565b6001600160a01b031660009081526009602052604090205490565b6102a7610533366004612579565b6113af565b6102a7610546366004612579565b61156c565b600d546102bc906001600160a01b031681565b6006546102bc906001600160a01b031681565b61028161057f366004612471565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61028160105481565b6102a76105c1366004612455565b6115cb565b6102a76105d4366004612579565b6116b5565b600c5460408051630141820560e01b815290516000926001600160a01b031691630141820591600480830192602092919082900301818787803b15801561061f57600080fd5b505af1158015610633573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106579190612591565b905090565b6000546001600160a01b0316331461068f5760405162461bcd60e51b8152600401610686906125f8565b60405180910390fd5b6006546001600160a01b03828116911614156106aa57600080fd5b806001600160a01b031663a9059cbb6106cb6000546001600160a01b031690565b6040516370a0823160e01b81523060048201526001600160a01b038516906370a082319060240160206040518083038186803b15801561070a57600080fd5b505afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190612591565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561078857600080fd5b505af115801561079c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c09190612530565b5050565b6060600480546107d390612747565b80601f01602080910402602001604051908101604052809291908181526020018280546107ff90612747565b801561084c5780601f106108215761010080835404028352916020019161084c565b820191906000526020600020905b81548152906001019060200180831161082f57829003601f168201915b5050505050905090565b6000610863338484611723565b50600192915050565b600061087782611848565b92915050565b600061088a848484611874565b6001600160a01b03841660009081526002602090815260408083203384529091529020548281101561090f5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610686565b610923853361091e8685612704565b611723565b60019150505b9392505050565b600c546001600160a01b031615610c6657600d546001600160a01b0316331461098b5760405162461bcd60e51b815260206004820152600d60248201526c4f6e6c792054696d656c6f636b60981b6044820152606401610686565b600c546040805163500128e360e11b815290516000926001600160a01b03169163a00251c6916004808301926020929190829003018186803b1580156109d057600080fd5b505afa1580156109e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a089190612591565b600c54604051638ca1799560e01b8152600481018390529192506001600160a01b031690638ca1799590602401600060405180830381600087803b158015610a4f57600080fd5b505af1158015610a63573d6000803e3d6000fd5b5050600a546040516370a0823160e01b8152306004820152610afb93508692506001600160a01b03909116906370a082319060240160206040518083038186803b158015610ab057600080fd5b505afa158015610ac4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae89190612591565b600a546001600160a01b03169190611910565b826001600160a01b031663e8b5e51f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610b3657600080fd5b505af1158015610b4a573d6000803e3d6000fd5b5050505081610c605780836001600160a01b031663a00251c66040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8d57600080fd5b505afa158015610ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc59190612591565b1015610bd057600080fd5b600c60009054906101000a90046001600160a01b03166001600160a01b031663a00251c66040518163ffffffff1660e01b815260040160206040518083038186803b158015610c1e57600080fd5b505afa158015610c32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c569190612591565b15610c6057600080fd5b50610c85565b6000546001600160a01b03163314610c7d57600080fd5b610c85611978565b600c80546001600160a01b0319166001600160a01b0384169081179091556040519081527fafd1cdc355e15bfc9038294be1c6203ce953704fda8c991bebe78ddd4d5420d19060200160405180910390a15050565b6001600160a01b0381166000908152600860209081526040808320546001909252822054600754600160a51b92610d2d92610d2892610d2291610d1d9190611a15565b611a21565b90611a31565b611a6f565b6108779190612686565b6000546001600160a01b03163314610d615760405162461bcd60e51b8152600401610686906125f8565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527f0f8256c831e1866cc4315c7c4431eacea7efb3d404a3dff6bd41f5f474549f2c906020015b60405180910390a150565b60008111610df45760405162461bcd60e51b815260206004820152600b60248201526a16915493cb505353d5539560aa1b6044820152606401610686565b610dfe3382611a7e565b600c54604051638ca1799560e01b8152600481018390526001600160a01b0390911690638ca1799590602401600060405180830381600087803b158015610e4457600080fd5b505af1158015610e58573d6000803e3d6000fd5b5050600a54610e7492506001600160a01b031690503383611910565b6012546001600160a01b031615610eea5760125460405163f3fef3a360e01b8152336004820152602481018390526001600160a01b039091169063f3fef3a390604401600060405180830381600087803b158015610ed157600080fd5b505af1158015610ee5573d6000803e3d6000fd5b505050505b6107c061110c565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909161086391859061091e90869061266e565b600e546000906001600160a01b03163314610f4357600080fd5b600c5460408051634e71d92d60e01b815290516000926001600160a01b031691634e71d92d91600480830192602092919082900301818787803b158015610f8957600080fd5b505af1158015610f9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc19190612591565b9050600081116110085760405162461bcd60e51b8152602060048201526012602482015271139bdd1a1a5b99c81d1bc81a185c9d995cdd60721b6044820152606401610686565b600f541561106f57600061103361271061102d600f5485611a1590919063ffffffff16565b90611ae2565b905061103f8282611aee565b92506110696110566000546001600160a01b031690565b600b546001600160a01b03169083611910565b50611073565b8091505b600e54600b54611090916001600160a01b03918216911684611910565b5090565b6000546001600160a01b031633146110be5760405162461bcd60e51b8152600401610686906125f8565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fbc4454368f1c71b4fff50bf3bb8a557289012c4c6f7229ce21d566bff33f8b9390602001610dab565b600061111733611afa565b6012549091506001600160a01b03161561118957601254604051630c00007b60e41b81523360048201526001600160a01b039091169063c00007b090602401600060405180830381600087803b15801561117057600080fd5b505af1158015611184573d6000803e3d6000fd5b505050505b90565b600e546001600160a01b03163314806111af57506000546001600160a01b031633145b6111b857600080fd5b6107c081611afa565b6000546001600160a01b031633146111eb5760405162461bcd60e51b8152600401610686906125f8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461125f5760405162461bcd60e51b8152600401610686906125f8565b80156112705761126d611ba3565b50565b61126d611978565b600e546001600160a01b0316331461128f57600080fd5b61129881611c2b565b5042601155565b6060600580546107d390612747565b600c546040805163500128e360e11b815290516000926001600160a01b03169163a00251c6916004808301926020929190829003018186803b1580156112f357600080fd5b505afa158015610633573d6000803e3d6000fd5b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156113895760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610686565b611398338561091e8685612704565b5060019392505050565b6000610863338484611874565b600054600160a01b900460ff16156113fc5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610686565b6000811161143a5760405162461bcd60e51b815260206004820152600b60248201526a16915493cb505353d5539560aa1b6044820152606401610686565b60105415611463576010546114588261145260035490565b90611d2b565b111561146357600080fd5b600c54600a54611482916001600160a01b039182169133911684611d37565b600c60009054906101000a90046001600160a01b03166001600160a01b031663e8b5e51f6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156114d257600080fd5b505af11580156114e6573d6000803e3d6000fd5b505050506114f43382611d75565b6012546001600160a01b03161561126d576012546040516356e4bb9760e11b8152336004820152602481018390526001600160a01b039091169063adc9772e90604401600060405180830381600087803b15801561155157600080fd5b505af1158015611565573d6000803e3d6000fd5b5050505050565b6000546001600160a01b031633146115965760405162461bcd60e51b8152600401610686906125f8565b60108190556040518181527fc512617347fd848ec9d7347c99c10e4fa7059132c92d0445930a7fb0c8252ff590602001610dab565b6000546001600160a01b031633146115f55760405162461bcd60e51b8152600401610686906125f8565b6001600160a01b03811661165a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610686565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146116df5760405162461bcd60e51b8152600401610686906125f8565b6127108111156116ee57600080fd5b600f8190556040518181527f88258d7c1f0510045362f22cdeb36a2c501ef80d7a06168881189fb8480cfe2f90602001610dab565b6001600160a01b0383166117855760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610686565b6001600160a01b0382166117e65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610686565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0381166000908152600960205260408120546108779061186e84610cda565b90611aee565b61187f838383611db9565b6000611899610d1d83600754611a1590919063ffffffff16565b6001600160a01b0385166000908152600860205260409020549091506118bf9082611a31565b6001600160a01b0380861660009081526008602052604080822093909355908516815220546118ee9082611f91565b6001600160a01b03909316600090815260086020526040902092909255505050565b6040516001600160a01b03831660248201526044810182905261197390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fdd565b505050565b600054600160a01b900460ff166119c85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610686565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061092982846126a6565b6000818181121561087757600080fd5b600080611a3e838561262d565b905060008312158015611a515750838112155b80611a665750600083128015611a6657508381125b61092957600080fd5b60008082121561109057600080fd5b611a8882826120af565b611ac2611aa3610d1d83600754611a1590919063ffffffff16565b6001600160a01b03841660009081526008602052604090205490611a31565b6001600160a01b0390921660009081526008602052604090209190915550565b60006109298284612686565b60006109298284612704565b6000611b0582611848565b90508015611b9e576001600160a01b038216600090815260096020526040902054611b309082611d2b565b6001600160a01b038316600081815260096020526040908190209290925590517fee503bee2bb6a87e57bc57db795f98137327401a0e7b7ce42e37926cc1a9ca4d90611b7f9084815260200190565b60405180910390a2600654611b9e906001600160a01b03168383611910565b919050565b600054600160a01b900460ff1615611bf05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610686565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119f83390565b6000611c3660035490565b11611c715760405162461bcd60e51b815260206004820152600b60248201526a5a45524f20535550504c5960a81b6044820152606401610686565b60008111611cab5760405162461bcd60e51b815260206004820152600760248201526608505353d5539560ca1b6044820152606401610686565b611cd8611cb760035490565b611cc583600160a51b611a15565b611ccf9190612686565b60075490611d2b565b600755600654611cf3906001600160a01b0316333084611d37565b60405181815233907fa493a9229478c3fcd73f66d2cdeb7f94fd0f341da924d1054236d784541165119060200160405180910390a250565b6000610929828461266e565b6040516001600160a01b0380851660248301528316604482015260648101829052611d6f9085906323b872dd60e01b9060840161193c565b50505050565b611d7f82826121fe565b611ac2611d9a610d1d83600754611a1590919063ffffffff16565b6001600160a01b03841660009081526008602052604090205490611f91565b6001600160a01b038316611e1d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610686565b6001600160a01b038216611e7f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610686565b6001600160a01b03831660009081526001602052604090205481811015611ef75760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610686565b611f018282612704565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290611f3790849061266e565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f8391815260200190565b60405180910390a350505050565b6000808212158015611fac575082611fa983826126c5565b13155b80611fca5750600082128015611fca575082611fc883826126c5565b135b611fd357600080fd5b61092982846126c5565b6000612032826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122dd9092919063ffffffff16565b80519091501561197357808060200190518101906120509190612530565b6119735760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610686565b6001600160a01b03821661210f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610686565b6001600160a01b038216600090815260016020526040902054818110156121835760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610686565b61218d8282612704565b6001600160a01b038416600090815260016020526040812091909155600380548492906121bb908490612704565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161183b565b6001600160a01b0382166122545760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610686565b8060036000828254612266919061266e565b90915550506001600160a01b0382166000908152600160205260408120805483929061229390849061266e565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60606122ec84846000856122f4565b949350505050565b6060824710156123555760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610686565b843b6123a35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610686565b600080866001600160a01b031685876040516123bf91906125a9565b60006040518083038185875af1925050503d80600081146123fc576040519150601f19603f3d011682016040523d82523d6000602084013e612401565b606091505b509150915061241182828661241c565b979650505050505050565b6060831561242b575081610929565b82511561243b5782518084602001fd5b8160405162461bcd60e51b815260040161068691906125c5565b600060208284031215612466578081fd5b813561092981612798565b60008060408385031215612483578081fd5b823561248e81612798565b9150602083013561249e81612798565b809150509250929050565b6000806000606084860312156124bd578081fd5b83356124c881612798565b925060208401356124d881612798565b929592945050506040919091013590565b600080604083850312156124fb578182fd5b823561250681612798565b946020939093013593505050565b600060208284031215612525578081fd5b8135610929816127ad565b600060208284031215612541578081fd5b8151610929816127ad565b6000806040838503121561255e578182fd5b823561256981612798565b9150602083013561249e816127ad565b60006020828403121561258a578081fd5b5035919050565b6000602082840312156125a2578081fd5b5051919050565b600082516125bb81846020870161271b565b9190910192915050565b60208152600082518060208401526125e481604085016020870161271b565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600080821280156001600160ff1b038490038513161561264f5761264f612782565b600160ff1b839003841281161561266857612668612782565b50500190565b6000821982111561268157612681612782565b500190565b6000826126a157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156126c0576126c0612782565b500290565b60008083128015600160ff1b8501841216156126e3576126e3612782565b6001600160ff1b03840183138116156126fe576126fe612782565b50500390565b60008282101561271657612716612782565b500390565b60005b8381101561273657818101518382015260200161271e565b83811115611d6f5750506000910152565b600181811c9082168061275b57607f821691505b6020821081141561277c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461126d57600080fd5b801515811461126d57600080fdfea2646970667358221220112276cca62cb60cbb901588906c521be7eab4ed9decd34adbd88407fdd2b1c364736f6c63430008040033

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

000000000000000000000000e7a24ef0c5e95ffb0f6684b813a78f2a3ad7d1710000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000a248c6df64c3ac2f7508a8f8e74933e3f4bf616900000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000014455448412061334352562f455448205661756c740000000000000000000000000000000000000000000000000000000000000000000000000000000000000006655661756c740000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : underlying_ (address): 0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171
Arg [1] : target_ (address): 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619
Arg [2] : rewards_ (address): 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270
Arg [3] : harvester_ (address): 0xa248c6df64c3Ac2f7508A8F8E74933e3f4bF6169
Arg [4] : name_ (string): ETHA a3CRV/ETH Vault
Arg [5] : symbol_ (string): eVault

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000e7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171
Arg [1] : 0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619
Arg [2] : 0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270
Arg [3] : 000000000000000000000000a248c6df64c3ac2f7508a8f8e74933e3f4bf6169
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [7] : 455448412061334352562f455448205661756c74000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [9] : 655661756c740000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading

OVERVIEW

The ETHA Lend protocol interacts with multiple DeFi ecosystems to expose liquidity providers to optimal yield, algorithmically based on gas cost, volatility, current yield, utilization rate, and supplied.

Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.