ETH Price: $3,583.94 (+2.02%)
Gas: 49 Gwei

Contract

0x7E0049866879151480d9Ec01391Bbf713F7705b1
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Transfer Ownersh...150779682022-07-04 19:32:50632 days ago1656963170IN
0x7E004986...13F7705b1
0 ETH0.0005721620
Replace As Child150779292022-07-04 19:23:25632 days ago1656962605IN
0x7E004986...13F7705b1
0 ETH0.0013347420
Set Initial Chil...150778822022-07-04 19:12:50632 days ago1656961970IN
0x7E004986...13F7705b1
0 ETH0.0011064420
0x60e06040150778662022-07-04 19:08:56632 days ago1656961736IN
 Create: AlphaBetaEqualDepositSplitter
0 ETH0.0586749220

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AlphaBetaEqualDepositSplitter

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 20000 runs

Other Settings:
default evmVersion
File 1 of 12 : AlphaBetaEqualDepositSplitter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;

/******************************************************************************\
* Author: Evert Kors <[email protected]> (https://twitter.com/evert0x)
* Sherlock Protocol: https://sherlock.xyz
/******************************************************************************/

import './AlphaBetaSplitter.sol';

/**
  ChildOne is the first node that is being used to withdraw from
  Only when ChildOne balance = 0 it will start withdrawing from ChildTwo

  If the deposit amount is at least `MIN_AMOUNT_FOR_EQUAL_SPLIT` of USDC
  It will try to balance out the childs by havng the option to deposit in both

  If the deposit amount is less then `MIN_AMOUNT_FOR_EQUAL_SPLIT` of USDC
  It will deposit in the child that returns the lowest balance
*/
contract AlphaBetaEqualDepositSplitter is AlphaBetaSplitter {
  // Min USDC deposit amount to activate logic to equal out balances
  uint256 public immutable MIN_AMOUNT_FOR_EQUAL_SPLIT;

  /// @param _initialParent Contract that will be the parent in the tree structure
  /// @param _initialChildOne Contract that will be the initial childOne in the tree structure
  /// @param _initialChildTwo Contract that will be the initial childTwo in the tree structure
  /// @param _MIN_AMOUNT_FOR_EQUAL_SPLIT Min USDC deposit amount to activate logic to equal out balances
  constructor(
    IMaster _initialParent,
    INode _initialChildOne,
    INode _initialChildTwo,
    uint256 _MIN_AMOUNT_FOR_EQUAL_SPLIT
  ) AlphaBetaSplitter(_initialParent, _initialChildOne, _initialChildTwo) {
    // Write variable to storage
    MIN_AMOUNT_FOR_EQUAL_SPLIT = _MIN_AMOUNT_FOR_EQUAL_SPLIT;
  }

  /// @notice Deposit USDC into one or both childs
  function _deposit() internal virtual override {
    // Amount of USDC in the contract
    uint256 amount = want.balanceOf(address(this));

    // Try to balance out childs if at least `MIN_AMOUNT_FOR_EQUAL_SPLIT` USDC is deposited
    if (amount >= MIN_AMOUNT_FOR_EQUAL_SPLIT) {
      // Cache balances in memory
      uint256 childOneBalance = cachedChildOneBalance;
      uint256 childTwoBalance = cachedChildTwoBalance;

      if (childOneBalance <= childTwoBalance) {
        // How much extra balance does childTWo have?
        // Can be 0
        uint256 childTwoBalanceExtra = childTwoBalance - childOneBalance;

        // If the difference exceeds the amount we can deposit it all in childOne
        // As this brings the two balances close to each other
        if (childTwoBalanceExtra >= amount) {
          // Deposit all USDC into childOne
          _childOneDeposit(amount);
        } else {
          // Depositing in a single child will not make the balances equal
          // So we have to deposit in both childs

          // We know childTwo has a bigger balance
          // Calculting how much to deposit in childTwo
          /**
            Example

            One = 180k USDC
            Two = 220k USDC
            amount = 100k USDC

            childTwoAdd = (100 - (220 - 180)) / 2 = 30k
            childOneAdd = 100k - 30k = 70k
            ---+
            One = 250k USDC
            Two = 250k USDC
          */
          uint256 childTwoAdd = (amount - childTwoBalanceExtra) / 2;
          // Deposit USDC into childTwo
          _childTwoDeposit(childTwoAdd);
          // Deposit leftover USDC into childOne
          _childOneDeposit(amount - childTwoAdd);
        }
      } else {
        // Do same logic as above but for the scenario childOne has a bigger balance

        uint256 childOneBalanceExtra = childOneBalance - childTwoBalance;

        if (childOneBalanceExtra >= amount) {
          // Deposit all USDC into childTwo
          _childTwoDeposit(amount);
        } else {
          uint256 childOneAdd = (amount - childOneBalanceExtra) / 2;
          // Deposit USDC into childOne
          _childOneDeposit(childOneAdd);
          // Deposit leftover USDC into childTwo
          _childTwoDeposit(amount - childOneAdd);
        }
      }
    } else {
      // Use deposit function based on balance
      AlphaBetaSplitter._deposit();
    }
  }
}

File 2 of 12 : AlphaBetaSplitter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;

/******************************************************************************\
* Author: Evert Kors <[email protected]> (https://twitter.com/evert0x)
* Sherlock Protocol: https://sherlock.xyz
/******************************************************************************/

import '../base/BaseSplitter.sol';

/**
  ChildOne is the first node that is being used to withdraw from
  Only when ChildOne balance = 0 it will start withdrawing from ChildTwo

  It will deposit in the child that returns the lowest balance (childOne first)
*/
contract AlphaBetaSplitter is BaseSplitter {
  using SafeERC20 for IERC20;

  /// @param _initialParent Contract that will be the parent in the tree structure
  /// @param _initialChildOne Contract that will be the initial childOne in the tree structure
  /// @param _initialChildTwo Contract that will be the initial childTwo in the tree structure
  constructor(
    IMaster _initialParent,
    INode _initialChildOne,
    INode _initialChildTwo
  ) BaseSplitter(_initialParent, _initialChildOne, _initialChildTwo) {}

  /// @notice Signal to withdraw `_amount` of USDC from the underlying nodes into core
  /// @param _amount Amount of USDC to withdraw
  function _withdraw(uint256 _amount) internal virtual override {
    // First in line for liquidations
    uint256 childOneBalance = cachedChildOneBalance;

    // If the amount exceeds childOne balance, it will start withdrawing from childTwo
    if (_amount > childOneBalance) {
      // Withdraw all USDC from childOne
      if (childOneBalance != 0) childOne.withdrawAll();

      // Withdraw USDC from childTwo when childOne balance hits zero
      childTwo.withdraw(_amount - childOneBalance);
    } else {
      // Withdraw from childOne
      childOne.withdraw(_amount);
    }
  }

  /// @notice Transfer USDC to childOne and call deposit
  /// @param _amount Amount of USDC to deposit
  function _childOneDeposit(uint256 _amount) internal virtual {
    // Transfer USDC to childOne
    want.safeTransfer(address(childOne), _amount);

    // Signal childOne it received a deposit
    childOne.deposit();
  }

  /// @notice Transfer USDC to childTwo and call deposit
  /// @param _amount Amount of USDC to deposit
  function _childTwoDeposit(uint256 _amount) internal virtual {
    // Transfer USDC to childTwo
    want.safeTransfer(address(childTwo), _amount);

    // Signal childOne it received a deposit
    childTwo.deposit();
  }

  /// @notice Deposit USDC into one child
  function _deposit() internal virtual override {
    // Deposit USDC into strategy that has the lowest balance
    if (cachedChildOneBalance <= cachedChildTwoBalance) {
      _childOneDeposit(want.balanceOf(address(this)));
    } else {
      _childTwoDeposit(want.balanceOf(address(this)));
    }
  }
}

File 3 of 12 : BaseSplitter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;

/******************************************************************************\
* Author: Evert Kors <[email protected]> (https://twitter.com/evert0x)
* Sherlock Protocol: https://sherlock.xyz
/******************************************************************************/

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/security/Pausable.sol';

import '../../interfaces/strategy/INode.sol';
import './BaseMaster.sol';

// Interface used by every splitter
abstract contract BaseSplitter is BaseMaster, ISplitter {
  using SafeERC20 for IERC20;
  // ChildNode
  INode public override childTwo;

  /*//////////////////////////////////////////////////////////////
                        TREE STRUCTURE LOGIC
  //////////////////////////////////////////////////////////////*/

  /// @param _initialParent The initial parent of this node
  /// @param _initialChildOne The initial childOne of this node
  /// @param _initialChildTwo The initial childTwo of this node
  constructor(
    IMaster _initialParent,
    INode _initialChildOne,
    INode _initialChildTwo
  ) BaseNode(_initialParent) {
    if (address(_initialChildOne) != address(0)) {
      _verifySetChildSkipParentCheck(INode(address(0)), _initialChildOne);
      _setChildOne(INode(address(0)), _initialChildOne);
    }

    if (address(_initialChildTwo) != address(0)) {
      _verifySetChildSkipParentCheck(INode(address(0)), _initialChildTwo);
      _setChildTwo(INode(address(0)), _initialChildTwo);
    }
  }

  /// @notice Check if this splitter is a master node
  /// @dev This implementation has two childs, it can never be a master (needs one child)
  function isMaster() external view override returns (bool) {
    return false;
  }

  /// @notice Check if this splitter completed it's setup
  /// @return completed Boolean indicating if setup is completed
  function setupCompleted() external view override returns (bool completed) {
    (completed, , ) = _setupCompleted();
  }

  /// @notice Check if this splitter completed it's setup
  /// @return completed Boolean indicating if setup is completed
  /// @return _childOne ChildOne read from storage
  /// @return _childTwo ChildTwo read from storage
  function _setupCompleted()
    internal
    view
    returns (
      bool completed,
      INode _childOne,
      INode _childTwo
    )
  {
    _childOne = childOne;
    _childTwo = childTwo;

    completed = address(_childOne) != address(0) && address(_childTwo) != address(0);
  }

  /// @notice Replace this splitter
  /// @param _node Splitter to be replaced by
  /// @dev only callable by owner
  /// @dev Same as `replace()`
  function replaceForce(INode _node) external virtual override {
    replace(_node);
    emit ForceReplace();
  }

  /// @notice Replace this splitter
  /// @param __newNode Splitter to be replaced by
  /// @dev only callable by owner
  function replace(INode __newNode) public virtual override onlyOwner {
    // Get childs from storage
    (bool completed, INode _childOne, INode _childTwo) = _setupCompleted();
    // Check if setup of this is completed
    if (completed == false) revert SetupNotCompleted(INode(address(this)));

    // Use ISplitter interface
    ISplitter _newNode = ISplitter(address(__newNode));

    // Check if same childs are used in `_newNode`
    if (_newNode.childOne() != _childOne) revert InvalidChildOne();
    if (_newNode.childTwo() != _childTwo) revert InvalidChildTwo();

    // Replace this with `_newNode`
    _replace(_newNode);

    // Make sure children have reference to `_newNode`
    _childOne.updateParent(_newNode);
    _childTwo.updateParent(_newNode);
  }

  /// @notice Get notified by child that it wants to be replaced by `_newChild`
  /// @param _newChild address of new child
  function updateChild(INode _newChild) external virtual override {
    // Get childs from storage
    (bool completed, INode _childOne, INode _childTwo) = _setupCompleted();
    // Check if setup of this is completed
    if (completed == false) revert SetupNotCompleted(INode(address(this)));

    // Is sender childOne?
    if (msg.sender == address(_childOne)) {
      // Can't have duplicate childs
      if (_newChild == _childTwo) revert InvalidArg();

      // Check if we are able to update
      _verifySetChild(_childOne, _newChild);
      // Execute update
      _setChildOne(_childOne, _newChild);
    } else if (msg.sender == address(_childTwo)) {
      // Is sender childTwo?

      // Can't have duplicate childs
      if (_newChild == _childOne) revert InvalidArg();

      // Check if we are able to update
      _verifySetChild(_childTwo, _newChild);
      // Execute update
      _setChildTwo(_childTwo, _newChild);
    } else {
      // Sender wasn't actually a child
      revert SenderNotChild();
    }
  }

  /// @notice Get notified by child that it is removed
  function childRemoved() external virtual override {
    // Get childs from storage
    (bool completed, INode _childOne, INode _childTwo) = _setupCompleted();
    // Check if setup of this is completed
    if (completed == false) revert SetupNotCompleted(INode(address(this)));

    // Is sender childOne?
    if (msg.sender == address(_childOne)) {
      // Notify childTwo that it's sibling has been removed
      _childTwo.siblingRemoved();
      // Tell parent to make a relationship with our non removed child
      parent.updateChild(_childTwo);

      // Declare removed child obsolete
      emit Obsolete(_childOne);
    } else if (msg.sender == address(_childTwo)) {
      // Notify childOne that it's sibling has been removed
      _childOne.siblingRemoved();
      // Tell parent to make a relationship with our non removed child
      parent.updateChild(_childOne);

      // Declare removed child obsolete
      emit Obsolete(_childTwo);
    } else {
      revert SenderNotChild();
    }

    // Declare address(this) obsolete
    emit Obsolete(INode(address(this)));
  }

  /// @notice Set childTwo in storage
  /// @param _currentChild The `childTwo` currently stored
  /// @param _newChild The `childTwo` that is stored after this call
  function _setChildTwo(INode _currentChild, INode _newChild) internal {
    childTwo = _newChild;
    emit ChildTwoUpdate(_currentChild, _newChild);
  }

  /// @notice Set initial childTwo
  /// @param _newChild Address of the initial child
  function setInitialChildTwo(INode _newChild) external override onlyOwner {
    if (address(childTwo) != address(0)) revert InvalidState();

    _verifySetChild(INode(address(0)), _newChild);
    _setChildTwo(INode(address(0)), _newChild);
  }

  /*//////////////////////////////////////////////////////////////
                        YIELD STRATEGY LOGIC
  //////////////////////////////////////////////////////////////*/

  // Internal variables to cache balances during runtime
  // Will always be 0 (except during runtime)
  uint256 internal cachedChildOneBalance;
  uint256 internal cachedChildTwoBalance;

  /// @notice Cache balances of childs in storage
  /// @notice Can only be called by parent node
  /// @dev It will first tell childs to cache their balances
  /// @dev Cache is built up from the bottom of the tree
  /// @dev As the chain returns when the bottom (strategies) are being called
  function prepareBalanceCache() external override onlyParent returns (uint256) {
    // Query balance of childs
    uint256 _cachedChildOneBalance = childOne.prepareBalanceCache();
    uint256 _cachedChildTwoBalance = childTwo.prepareBalanceCache();

    // Write balances to storage
    // It's "cached" as we expect/assume `expireBalanceCache()` will be called in the same transaction
    cachedChildOneBalance = _cachedChildOneBalance;
    cachedChildTwoBalance = _cachedChildTwoBalance;

    // Return the balance of this splitter to parent
    // The balance this splitter represent is the sum of the childs
    return _cachedChildOneBalance + _cachedChildTwoBalance;
  }

  /// @notice Expired cached balances in storage
  /// @notice Can only be called by parent node
  /// @dev It assumes `prepareBalanceCache()` was called before
  function expireBalanceCache() external override onlyParent {
    // Set cached balances back to the value of the start of the transaction (--> 0)
    delete cachedChildOneBalance;
    delete cachedChildTwoBalance;
  }

  /// @notice Withdraw all funds
  /// @notice Can only be called by admin
  /// @notice Not implemented
  /// @return amount Amount of USDC withdrawn
  /// @dev More context: https://github.com/sherlock-protocol/sherlock-v2-core/issues/24
  function withdrawAllByAdmin() external override onlyOwner returns (uint256 amount) {
    revert NotImplemented(msg.sig);
  }

  /// @notice Withdraw `_amount` funds
  /// @notice Can only be called by admin
  /// @notice Not implemented
  /// @dev More context: https://github.com/sherlock-protocol/sherlock-v2-core/issues/24
  function withdrawByAdmin(uint256 _amount) external override onlyOwner {
    revert NotImplemented(msg.sig);
  }

  function _withdrawAll() internal virtual override returns (uint256 amount) {
    // Children will withdraw to core()
    amount = childOne.withdrawAll();
    amount += childTwo.withdrawAll();
  }

  function _balanceOf() internal view virtual override returns (uint256 amount) {
    amount = childOne.balanceOf();
    amount += childTwo.balanceOf();
  }
}

File 4 of 12 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

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() {
        _transferOwnership(_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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

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 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

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'
        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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 7 of 12 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

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 8 of 12 : INode.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;

/******************************************************************************\
* Author: Evert Kors <[email protected]> (https://twitter.com/evert0x)
* Sherlock Protocol: https://sherlock.xyz
/******************************************************************************/

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

interface INode {
  event AdminWithdraw(uint256 amount);
  event ReplaceAsChild();
  event ParentUpdate(IMaster previous, IMaster current);
  event Obsolete(INode implementation);
  event ForceReplace();
  event Replace(INode newAddress);

  error NotImplemented(bytes4 func);
  error SenderNotParent();
  error SenderNotChild();
  error InvalidParent();
  error InvalidCore();
  error InvalidWant();
  error InvalidState();
  error ZeroArg();
  error InvalidArg();
  error NotSetup();
  error IsMaster();
  error BothChild();
  error NotChild();
  error InvalidParentAddress();
  error SetupNotCompleted(INode instance);
  error NonZeroBalance();

  /*//////////////////////////////////////////////////////////////
                        CONSTRUCTOR VARIABLES
  //////////////////////////////////////////////////////////////*/

  /// @return Returns the token type being deposited into a node
  function want() external view returns (IERC20);

  /// @notice Parent will always inherit IMaster interface.
  /// @notice Parent of root node will inherit IStrategyManager
  function parent() external view returns (IMaster);

  /// @notice View core controller of funds
  function core() external view returns (address);

  /*//////////////////////////////////////////////////////////////
                        TREE STRUCTURE LOGIC
  //////////////////////////////////////////////////////////////*/

  /// @notice Replace the node
  /// @notice If this is executed on a strategy, the funds will be withdrawn
  /// @notice If this is executed on a splitter, the children are expected to be the same
  function replace(INode _node) external;

  /// @notice Replace the node
  /// @notice If this is executed on a strategy, attempt is made to withdraw the funds
  /// @notice If this is executed on a splitter, check of children is skipped
  function replaceForce(INode _node) external;

  function setupCompleted() external view returns (bool);

  /// @notice Move the current node as the child of `_node`
  function replaceAsChild(ISplitter _node) external;

  /// @notice Update parent of node
  /// @dev Can only be called by current parent
  function updateParent(IMaster _node) external;

  function siblingRemoved() external;

  /*//////////////////////////////////////////////////////////////
                        YIELD STRATEGY LOGIC
  //////////////////////////////////////////////////////////////*/

  /// @return Returns the token balance managed by this contract
  /// @dev For Splitter this will be the sum of balances of the children
  function balanceOf() external view returns (uint256);

  /// @notice Withdraws all tokens back into core.
  /// @return The final amount withdrawn
  function withdrawAll() external returns (uint256);

  /// @notice Withdraws all token from the node back into core
  /// @return The final amount withdrawn
  function withdrawAllByAdmin() external returns (uint256);

  /// @notice Withdraws a specific amount of tokens from the node back into core
  /// @param _amount Amount of tokens to withdraw
  function withdraw(uint256 _amount) external;

  /// @notice Withdraws a specific amount of tokens from the node back into core
  /// @param _amount Amount of tokens to withdraw
  function withdrawByAdmin(uint256 _amount) external;

  /// @notice Deposits all tokens held in this contract into the children on strategy
  /// @dev Splitter will deposit the tokens in their children
  /// @dev Strategy will deposit the tokens into a yield strategy
  function deposit() external;

  function prepareBalanceCache() external returns (uint256);

  function expireBalanceCache() external;
}

interface IMaster is INode {
  event ChildOneUpdate(INode previous, INode current);

  /// @notice Call by child if it's needs to be updated
  function updateChild(INode _node) external;

  /// @notice Call by child if removed
  function childRemoved() external;

  function isMaster() external view returns (bool);

  function childOne() external view returns (INode);

  function setInitialChildOne(INode _child) external;
}

interface ISplitter is IMaster {
  event ChildTwoUpdate(INode previous, INode current);

  error InvalidChildOne();
  error InvalidChildTwo();

  function childTwo() external view returns (INode);

  function setInitialChildTwo(INode _child) external;
}

File 9 of 12 : BaseMaster.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;

/******************************************************************************\
* Author: Evert Kors <[email protected]> (https://twitter.com/evert0x)
* Sherlock Protocol: https://sherlock.xyz
/******************************************************************************/

import '@openzeppelin/contracts/access/Ownable.sol';

import '../../interfaces/strategy/INode.sol';
import '../../interfaces/strategy/INode.sol';
import './BaseNode.sol';

// Interface used by the MasterStrategy, the contract core will reference as `yieldStrategy`
abstract contract BaseMaster is IMaster, BaseNode {
  // ChildNode
  INode public override childOne;

  /// @notice Verify if `_newChild` is able to replace `_currentChild` without doing same parent check
  /// @param _currentChild Node that is the current child
  /// @param _newChild Node that is the new child
  function _verifySetChildSkipParentCheck(INode _currentChild, INode _newChild) internal {
    if (address(_newChild) == address(0)) revert ZeroArg();
    if (_newChild.setupCompleted() == false) revert SetupNotCompleted(_newChild);

    if (_newChild == _currentChild) revert InvalidArg();
    if (core != _newChild.core()) revert InvalidCore();
    if (want != _newChild.want()) revert InvalidWant();
  }

  /// @notice Verify if `_newChild` is able to replace `_currentChild`
  /// @param _currentChild Node that is the current child
  /// @param _newChild Node that is the new child
  function _verifySetChild(INode _currentChild, INode _newChild) internal {
    _verifySetChildSkipParentCheck(_currentChild, _newChild);
    // NOTE this check is basically one here for the `updateChild` call in splitter
    if (address(_newChild.parent()) != address(this)) revert InvalidParent();
  }

  /// @notice Set childOne in storage
  /// @param _currentChild The `childOne` currently stored
  /// @param _newChild The `childOne` that is stored after this call
  function _setChildOne(INode _currentChild, INode _newChild) internal {
    childOne = _newChild;
    emit ChildOneUpdate(_currentChild, _newChild);
  }

  /// @notice Set initial childOne
  /// @param _newChild Address of the initial child
  function setInitialChildOne(INode _newChild) external override onlyOwner {
    if (address(childOne) != address(0)) revert InvalidState();

    _verifySetChild(INode(address(0)), _newChild);
    _setChildOne(INode(address(0)), _newChild);
  }
}

File 10 of 12 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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) {
        return msg.data;
    }
}

File 11 of 12 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

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

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

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

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

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 12 of 12 : BaseNode.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;

/******************************************************************************\
* Author: Evert Kors <[email protected]> (https://twitter.com/evert0x)
* Sherlock Protocol: https://sherlock.xyz
/******************************************************************************/

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';

import '../../interfaces/strategy/INode.sol';

// Interface used by every node
abstract contract BaseNode is INode, Ownable {
  using SafeERC20 for IERC20;

  // Parent node
  IMaster public override parent;
  // Which token the strategy uses (USDC)
  IERC20 public immutable override want;
  // Reference to core (Sherlock.sol)
  address public immutable override core;

  /// @param _initialParent The initial parent of this node
  constructor(IMaster _initialParent) {
    if (address(_initialParent) == address(0)) revert ZeroArg();

    IERC20 _want = _initialParent.want();
    address _core = _initialParent.core();

    if (address(_want) == address(0)) revert InvalidWant();
    if (address(_core) == address(0)) revert InvalidCore();

    want = _want;
    core = _core;
    parent = _initialParent;

    emit ParentUpdate(IMaster(address(0)), _initialParent);
  }

  modifier onlyParent() {
    if (msg.sender != address(parent)) revert SenderNotParent();
    _;
  }

  /*//////////////////////////////////////////////////////////////
                        TREE STRUCTURE LOGIC
  //////////////////////////////////////////////////////////////*/

  /// @notice Replace this node to be a child of `_newParent`
  /// @param _newParent address of the new parent
  /// @dev Replace as child ensures that (this) is the child of the `_newParent`
  /// @dev It will also enfore a `_executeParentUpdate` to make that relation bi-directional
  /// @dev For the other child is does minimal checks, it only checks if it isn't the same as address(this)
  function replaceAsChild(ISplitter _newParent) external virtual override onlyOwner {
    /*
          m
          |
        this

          m
          |
          1
         / \
        z  this
    */

    // Gas savings
    IMaster _currentParent = parent;

    // Revert is parent is master
    // The master is always at the root of the tree
    if (_newParent.isMaster()) revert IsMaster();

    // Verify if the new parent has the right connections
    _verifyParentUpdate(_currentParent, _newParent);
    // Verify is childs of newParent are correct
    INode otherChild = _verifyNewParent(_newParent);

    // Revert if otherchild = 0
    // Revert if the other child has the right parent reference too
    // Check if `z` has the right parent (referencing comment on top function)
    if (otherChild.parent() != _newParent) revert InvalidParent();

    // Check if `_newParent` references our currentParent as their parent
    // Check if `m` == `1`.parent() (referencing comment on top function)
    if (_currentParent != _newParent.parent()) revert InvalidParent();

    // Make sure the parent recognizes the new child
    // Make sure `m` references `1` as it's child (referencing comment on top function)
    _currentParent.updateChild(_newParent);

    // Update parent
    _executeParentUpdate(_currentParent, _newParent);

    emit ReplaceAsChild();
  }

  /// @notice Replace parent of this node
  /// @param _newParent Address of the new parent
  /// @dev Only callable by current parent
  function updateParent(IMaster _newParent) external virtual override onlyParent {
    // Verify if the parent can be updated
    _verifyParentUpdate(IMaster(msg.sender), _newParent);
    _verifyNewParent(_newParent);

    // Update parent
    _executeParentUpdate(IMaster(msg.sender), _newParent);
  }

  /// @notice Get notified by parent that your sibling is removed
  /// @dev This contract will take the position of the parent
  /// @dev Only callable by current parent
  function siblingRemoved() external override onlyParent {
    // Get current parent of parent
    IMaster _newParent = parent.parent();

    // Take position of current parent
    _verifyParentUpdate(IMaster(msg.sender), _newParent);
    // NOTE: _verifyNewParent() is skipped on this call
    // As address(this) should be added as a child after the function returns
    _executeParentUpdate(IMaster(msg.sender), _newParent);
  }

  /// @notice Verify if `_newParent` is able to be our new parent
  /// @param _newParent Address of the new parent
  /// @return otherChild Address of the child that isn't address(this)
  function _verifyNewParent(IMaster _newParent) internal view returns (INode otherChild) {
    // The setup needs to be completed of parent
    if (_newParent.setupCompleted() == false) revert SetupNotCompleted(_newParent);

    // get first child
    INode firstChild = _newParent.childOne();
    INode secondChild;

    // is address(this) childOne?
    bool isFirstChild = address(firstChild) == address(this);
    bool isSecondChild = false;

    // Parent only has a childTwo if it isn't master
    if (!_newParent.isMaster()) {
      // get second child
      secondChild = ISplitter(address(_newParent)).childTwo();
      // is address(this) childTwo?
      isSecondChild = address(secondChild) == address(this);
    }

    // Check if address(this) is referenced as both childs
    if (isFirstChild && isSecondChild) revert BothChild();
    // Check if address(this) isn't referenced at all
    if (!isFirstChild && !isSecondChild) revert NotChild();

    // return child that isn't address(this)
    if (isFirstChild) {
      return secondChild;
    }
    return firstChild;
  }

  /// @notice Verify if `_newParent` can replace `_currentParent`
  /// @param _currentParent Address of our current `parent`
  /// @param _newParent Address of our future `parent`
  function _verifyParentUpdate(IMaster _currentParent, IMaster _newParent) internal view {
    // Revert if it's the same address
    if (address(_newParent) == address(this)) revert InvalidParentAddress();
    // Revert if the address is parent
    if (address(_newParent) == address(_currentParent)) revert InvalidParentAddress();
    // Revert if core is invalid
    if (_currentParent.core() != _newParent.core()) revert InvalidCore();
    // Revert if want is invalid
    if (_currentParent.want() != _newParent.want()) revert InvalidWant();
  }

  /// @notice Set parent in storage
  /// @param _currentParent Address of our current `parent`
  /// @param _newParent Address of our future `parent`
  function _executeParentUpdate(IMaster _currentParent, IMaster _newParent) internal {
    // Make `_newParent` our new parent
    parent = _newParent;
    emit ParentUpdate(_currentParent, _newParent);
  }

  /// @notice Replace address(this) with `_newNode`
  function _replace(INode _newNode) internal {
    if (address(_newNode) == address(0)) revert ZeroArg();
    if (_newNode.setupCompleted() == false) revert SetupNotCompleted(_newNode);
    if (address(_newNode) == address(this)) revert InvalidArg();
    if (_newNode.parent() != parent) revert InvalidParent();
    if (_newNode.core() != core) revert InvalidCore();
    if (_newNode.want() != want) revert InvalidWant();

    // Make sure our parent references `_newNode` as it's child
    parent.updateChild(_newNode);

    emit Replace(_newNode);
    emit Obsolete(INode(address(this)));
  }

  /*//////////////////////////////////////////////////////////////
                        YIELD STRATEGY LOGIC
  //////////////////////////////////////////////////////////////*/

  function balanceOf() external view override returns (uint256 amount) {
    return _balanceOf();
  }

  function withdrawAll() external override onlyParent returns (uint256 amount) {
    amount = _withdrawAll();
  }

  function withdrawAllByAdmin() external override onlyOwner returns (uint256 amount) {
    amount = _withdrawAll();
    emit AdminWithdraw(amount);
  }

  function withdraw(uint256 _amount) external override onlyParent {
    if (_amount == 0) revert ZeroArg();

    _withdraw(_amount);
  }

  function withdrawByAdmin(uint256 _amount) external override onlyOwner {
    if (_amount == 0) revert ZeroArg();

    _withdraw(_amount);
    emit AdminWithdraw(_amount);
  }

  function deposit() external override onlyParent {
    _deposit();
  }

  function _balanceOf() internal view virtual returns (uint256 amount) {}

  function _withdrawAll() internal virtual returns (uint256 amount) {}

  function _withdraw(uint256 _amount) internal virtual {}

  function _deposit() internal virtual {}
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 20000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IMaster","name":"_initialParent","type":"address"},{"internalType":"contract INode","name":"_initialChildOne","type":"address"},{"internalType":"contract INode","name":"_initialChildTwo","type":"address"},{"internalType":"uint256","name":"_MIN_AMOUNT_FOR_EQUAL_SPLIT","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BothChild","type":"error"},{"inputs":[],"name":"InvalidArg","type":"error"},{"inputs":[],"name":"InvalidChildOne","type":"error"},{"inputs":[],"name":"InvalidChildTwo","type":"error"},{"inputs":[],"name":"InvalidCore","type":"error"},{"inputs":[],"name":"InvalidParent","type":"error"},{"inputs":[],"name":"InvalidParentAddress","type":"error"},{"inputs":[],"name":"InvalidState","type":"error"},{"inputs":[],"name":"InvalidWant","type":"error"},{"inputs":[],"name":"IsMaster","type":"error"},{"inputs":[],"name":"NonZeroBalance","type":"error"},{"inputs":[],"name":"NotChild","type":"error"},{"inputs":[{"internalType":"bytes4","name":"func","type":"bytes4"}],"name":"NotImplemented","type":"error"},{"inputs":[],"name":"NotSetup","type":"error"},{"inputs":[],"name":"SenderNotChild","type":"error"},{"inputs":[],"name":"SenderNotParent","type":"error"},{"inputs":[{"internalType":"contract INode","name":"instance","type":"address"}],"name":"SetupNotCompleted","type":"error"},{"inputs":[],"name":"ZeroArg","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AdminWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract INode","name":"previous","type":"address"},{"indexed":false,"internalType":"contract INode","name":"current","type":"address"}],"name":"ChildOneUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract INode","name":"previous","type":"address"},{"indexed":false,"internalType":"contract INode","name":"current","type":"address"}],"name":"ChildTwoUpdate","type":"event"},{"anonymous":false,"inputs":[],"name":"ForceReplace","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract INode","name":"implementation","type":"address"}],"name":"Obsolete","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":"contract IMaster","name":"previous","type":"address"},{"indexed":false,"internalType":"contract IMaster","name":"current","type":"address"}],"name":"ParentUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract INode","name":"newAddress","type":"address"}],"name":"Replace","type":"event"},{"anonymous":false,"inputs":[],"name":"ReplaceAsChild","type":"event"},{"inputs":[],"name":"MIN_AMOUNT_FOR_EQUAL_SPLIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"childOne","outputs":[{"internalType":"contract INode","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"childRemoved","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"childTwo","outputs":[{"internalType":"contract INode","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"core","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expireBalanceCache","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isMaster","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parent","outputs":[{"internalType":"contract IMaster","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prepareBalanceCache","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INode","name":"__newNode","type":"address"}],"name":"replace","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISplitter","name":"_newParent","type":"address"}],"name":"replaceAsChild","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INode","name":"_node","type":"address"}],"name":"replaceForce","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INode","name":"_newChild","type":"address"}],"name":"setInitialChildOne","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INode","name":"_newChild","type":"address"}],"name":"setInitialChildTwo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setupCompleted","outputs":[{"internalType":"bool","name":"completed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"siblingRemoved","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INode","name":"_newChild","type":"address"}],"name":"updateChild","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMaster","name":"_newParent","type":"address"}],"name":"updateParent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"want","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAllByAdmin","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e06040523480156200001157600080fd5b5060405162003979380380620039798339810160408190526200003491620005a8565b83838382828282620000463362000262565b6001600160a01b0381166200006e576040516362c0b8cd60e11b815260040160405180910390fd5b6000816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000af573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d5919062000602565b90506000826001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000118573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200013e919062000602565b90506001600160a01b03821662000168576040516341b30e2560e01b815260040160405180910390fd5b6001600160a01b038116620001905760405163c5c23c8d60e01b815260040160405180910390fd5b6001600160a01b0382811660805281811660a052600180546001600160a01b0319169185169182179055604080516000815260208101929092527f2a821884f0167e84fc3824c66c12861f8f72abb7c76fd899bf5039be1c4ac7b7910160405180910390a15050506001600160a01b03821615620002225762000215600083620002b2565b62000222600083620004d6565b6001600160a01b038116156200024c576200023f600082620002b2565b6200024c60008262000536565b50505060c093909352506200064d945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116620002da576040516362c0b8cd60e11b815260040160405180910390fd5b806001600160a01b031663609da8976040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000319573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200033f919062000629565b6200036c5760405163040d05c360e21b81526001600160a01b038216600482015260240160405180910390fd5b816001600160a01b0316816001600160a01b03161415620003a05760405163d30917ed60e01b815260040160405180910390fd5b806001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa158015620003df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000405919062000602565b6001600160a01b031660a0516001600160a01b031614620004395760405163c5c23c8d60e01b815260040160405180910390fd5b806001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000478573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200049e919062000602565b6001600160a01b03166080516001600160a01b031614620004d2576040516341b30e2560e01b815260040160405180910390fd5b5050565b600280546001600160a01b0319166001600160a01b0383811691821790925560408051928516835260208301919091527fbd5e43cc7b243faaa8e808256df815d121be0fd579b46c17a3f993fb170972ec91015b60405180910390a15050565b600380546001600160a01b0319166001600160a01b0383811691821790925560408051928516835260208301919091527fc6df8dcbfc70e15ca180225a8f328727b3205e5bf99f25d94077862b53a6e6ee91016200052a565b6001600160a01b0381168114620005a557600080fd5b50565b60008060008060808587031215620005bf57600080fd5b8451620005cc816200058f565b6020860151909450620005df816200058f565b6040860151909350620005f2816200058f565b6060959095015193969295505050565b6000602082840312156200061557600080fd5b815162000622816200058f565b9392505050565b6000602082840312156200063c57600080fd5b815180151581146200062257600080fd5b60805160a05160c0516132b6620006c36000396000818161030701526126c40152600081816103920152818161239b01526129bc0152600081816101d8015281816124670152818161264d01528181612a8801528181612af801528181612b9601528181612c4c0152612cf101526132b66000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c8063853828b6116100f9578063d0e30db011610097578063e84b725d11610071578063e84b725d1461037a578063f2f4eb261461038d578063f2fde38b146103b4578063f947d5c9146103c757600080fd5b8063d0e30db01461034c578063d921f2ee14610354578063e573317b1461036757600080fd5b8063b84c7f2d116100d3578063b84c7f2d14610302578063b8efa43514610329578063bec1c47314610331578063cabfb9341461033957600080fd5b8063853828b6146102e15780638da5cb5b146102e957806394a368d2146102fa57600080fd5b8063562901d911610166578063645c044111610140578063645c0441146102b75780636f791d29146102ca578063715018a6146102d1578063722713f7146102d957600080fd5b8063562901d914610279578063609da8971461028c57806360f96a8f146102a457600080fd5b80632e1a7d4d116101a25780632e1a7d4d1461022a5780632fd20a471461023d57806332ce8ccd146102535780633d8db9111461026657600080fd5b806301d05096146101c95780631f1fcd51146101d357806329627e5914610217575b600080fd5b6101d16103da565b005b6101fa7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101d16102253660046130c0565b6106cb565b6101d16102383660046130dd565b61079b565b61024561081f565b60405190815260200161020e565b6101d16102613660046130c0565b610988565b6101d16102743660046130dd565b6109bd565b6101d16102873660046130c0565b610aa2565b610294610df1565b604051901515815260200161020e565b6001546101fa906001600160a01b031681565b6101d16102c53660046130c0565b610e03565b6000610294565b6101d1610e65565b610245610ee5565b610245610ef4565b6000546001600160a01b03166101fa565b610245610f43565b6102457f000000000000000000000000000000000000000000000000000000000000000081565b6101d1610f4b565b6101d161102c565b6101d16103473660046130c0565b61107c565b6101d1611392565b6002546101fa906001600160a01b031681565b6101d16103753660046130c0565b6113de565b6101d16103883660046130c0565b6114ab565b6101fa7f000000000000000000000000000000000000000000000000000000000000000081565b6101d16103c23660046130c0565b6115e5565b6003546101fa906001600160a01b031681565b60008060006103e76116f8565b919450925090508261042c576040517f1034170c0000000000000000000000000000000000000000000000000000000081523060048201526024015b60405180910390fd5b336001600160a01b038316141561054b57806001600160a01b031663b8efa4356040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561047857600080fd5b505af115801561048c573d6000803e3d6000fd5b50506001546040517fe84b725d0000000000000000000000000000000000000000000000000000000081526001600160a01b038581166004830152909116925063e84b725d9150602401600060405180830381600087803b1580156104f057600080fd5b505af1158015610504573d6000803e3d6000fd5b50506040516001600160a01b03851681527fe3bee2269179dff609bde2667db864c00a1529211302f765535fd788510b629c925060200190505b60405180910390a1610693565b336001600160a01b038216141561066157816001600160a01b031663b8efa4356040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561059757600080fd5b505af11580156105ab573d6000803e3d6000fd5b50506001546040517fe84b725d0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152909116925063e84b725d9150602401600060405180830381600087803b15801561060f57600080fd5b505af1158015610623573d6000803e3d6000fd5b50506040516001600160a01b03841681527fe3bee2269179dff609bde2667db864c00a1529211302f765535fd788510b629c9250602001905061053e565b6040517f01f65dd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040513081527fe3bee2269179dff609bde2667db864c00a1529211302f765535fd788510b629c9060200160405180910390a1505050565b6000546001600160a01b0316331461073f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b6003546001600160a01b031615610782576040517fbaf3f0f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61078d60008261172c565b6107986000826117e6565b50565b6001546001600160a01b031633146107df576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80610816576040517fc581719a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107988161185e565b6001546000906001600160a01b03163314610866576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600254604080517f2fd20a4700000000000000000000000000000000000000000000000000000000815290516000926001600160a01b031691632fd20a47916004808301926020929190829003018187875af11580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee91906130f6565b90506000600360009054906101000a90046001600160a01b03166001600160a01b0316632fd20a476040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610947573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096b91906130f6565b600483905560058190559050610981818361313e565b9250505090565b6109918161107c565b6040517f71861b9f192277502a2209dde5e25ecfd52ca83931ffc892ef70282bf7b93a2a90600090a150565b335b6001600160a01b03166109da6000546001600160a01b031690565b6001600160a01b031614610a4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b6040517fc79348a60000000000000000000000000000000000000000000000000000000081527fffffffff00000000000000000000000000000000000000000000000000000000600035166004820152602401610423565b6000546001600160a01b03163314610b16576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b600154604080517f6f791d2900000000000000000000000000000000000000000000000000000000815290516001600160a01b0392831692841691636f791d299160048083019260209291908290030181865afa158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9f9190613156565b15610bd6576040517fef062dc400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610be081836119a3565b6000610beb83611c4c565b9050826001600160a01b0316816001600160a01b03166360f96a8f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c599190613178565b6001600160a01b031614610c99576040517f5f53dd9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b826001600160a01b03166360f96a8f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfb9190613178565b6001600160a01b0316826001600160a01b031614610d45576040517f5f53dd9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fe84b725d0000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015283169063e84b725d90602401600060405180830381600087803b158015610da157600080fd5b505af1158015610db5573d6000803e3d6000fd5b50505050610dc38284611ee9565b6040517f1fd0ed0afde2d0281930362705e45b089222803618cdbae0b540a3ad040e845690600090a1505050565b6000610dfb6116f8565b509092915050565b6001546001600160a01b03163314610e47576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e5133826119a3565b610e5a81611c4c565b506107983382611ee9565b6000546001600160a01b03163314610ed9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b610ee36000611f59565b565b6000610eef611fc1565b905090565b6001546000906001600160a01b03163314610f3b576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eef6120cb565b6000336109bf565b6001546001600160a01b03163314610f8f576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154604080517f60f96a8f00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916360f96a8f9160048083019260209291908290030181865afa158015610ff2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110169190613178565b905061102233826119a3565b6107983382611ee9565b6001546001600160a01b03163314611070576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006004819055600555565b6000546001600160a01b031633146110f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b60008060006110fd6116f8565b919450925090508261113d576040517f1034170c000000000000000000000000000000000000000000000000000000008152306004820152602401610423565b6000849050826001600160a01b0316816001600160a01b031663d921f2ee6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ae9190613178565b6001600160a01b0316146111ee576040517fa575e80500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316816001600160a01b031663f947d5c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015611236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125a9190613178565b6001600160a01b03161461129a576040517f899f893a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112a3816121aa565b6040517f645c04410000000000000000000000000000000000000000000000000000000081526001600160a01b03828116600483015284169063645c044190602401600060405180830381600087803b1580156112ff57600080fd5b505af1158015611313573d6000803e3d6000fd5b50506040517f645c04410000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516925063645c04419150602401600060405180830381600087803b15801561137357600080fd5b505af1158015611387573d6000803e3d6000fd5b505050505050505050565b6001546001600160a01b031633146113d6576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ee361261c565b6000546001600160a01b03163314611452576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b6002546001600160a01b031615611495576040517fbaf3f0f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114a060008261172c565b6107986000826127b0565b60008060006114b86116f8565b91945092509050826114f8576040517f1034170c000000000000000000000000000000000000000000000000000000008152306004820152602401610423565b336001600160a01b038316141561156e57806001600160a01b0316846001600160a01b03161415611555576040517fd30917ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61155f828561172c565b61156982856127b0565b6115df565b336001600160a01b038216141561066157816001600160a01b0316846001600160a01b031614156115cb576040517fd30917ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115d5818561172c565b61156981856117e6565b50505050565b6000546001600160a01b03163314611659576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b6001600160a01b0381166116ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610423565b61079881611f59565b6002546003546000916001600160a01b039081169116811580159061172557506001600160a01b03811615155b9250909192565b6117368282612820565b306001600160a01b0316816001600160a01b03166360f96a8f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561177e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a29190613178565b6001600160a01b0316146117e2576040517f5f53dd9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383811691821790925560408051928516835260208301919091527fc6df8dcbfc70e15ca180225a8f328727b3205e5bf99f25d94077862b53a6e6ee91015b60405180910390a15050565b600454808211156119595780156118ea57600260009054906101000a90046001600160a01b03166001600160a01b031663853828b66040518163ffffffff1660e01b81526004016020604051808303816000875af11580156118c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e891906130f6565b505b6003546001600160a01b0316632e1a7d4d6119058385613195565b6040518263ffffffff1660e01b815260040161192391815260200190565b600060405180830381600087803b15801561193d57600080fd5b505af1158015611951573d6000803e3d6000fd5b505050505050565b6002546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690632e1a7d4d90602401611923565b6001600160a01b0381163014156119e6576040517f3073085f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316816001600160a01b03161415611a32576040517f3073085f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a949190613178565b6001600160a01b0316826001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff9190613178565b6001600160a01b031614611b3f576040517fc5c23c8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba19190613178565b6001600160a01b0316826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0c9190613178565b6001600160a01b0316146117e2576040517f41b30e2500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000816001600160a01b031663609da8976040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb09190613156565b611cf1576040517f1034170c0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602401610423565b6000826001600160a01b031663d921f2ee6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d559190613178565b9050600080306001600160a01b0316836001600160a01b03161490506000856001600160a01b0316636f791d296040518163ffffffff1660e01b8152600401602060405180830381865afa158015611db1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd59190613156565b611e4b57856001600160a01b031663f947d5c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3b9190613178565b9250506001600160a01b03821630145b818015611e555750805b15611e8c576040517fbb0897ee00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81158015611e98575080155b15611ecf576040517f1e203c1700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8115611edf575090949350505050565b5091949350505050565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383811691821790925560408051928516835260208301919091527f2a821884f0167e84fc3824c66c12861f8f72abb7c76fd899bf5039be1c4ac7b79101611852565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600254604080517f722713f700000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163722713f79160048083019260209291908290030181865afa158015612024573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204891906130f6565b9050600360009054906101000a90046001600160a01b03166001600160a01b031663722713f76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561209d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c191906130f6565b610eef908261313e565b600254604080517f853828b600000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163853828b6916004808301926020929190829003018187875af115801561212f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215391906130f6565b9050600360009054906101000a90046001600160a01b03166001600160a01b031663853828b66040518163ffffffff1660e01b81526004016020604051808303816000875af115801561209d573d6000803e3d6000fd5b6001600160a01b0381166121ea576040517fc581719a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663609da8976040518163ffffffff1660e01b8152600401602060405180830381865afa158015612228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224c9190613156565b61228d576040517f1034170c0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602401610423565b6001600160a01b0381163014156122d0576040517fd30917ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154604080517f60f96a8f00000000000000000000000000000000000000000000000000000000815290516001600160a01b03928316928416916360f96a8f9160048083019260209291908290030181865afa158015612335573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123599190613178565b6001600160a01b031614612399576040517f5f53dd9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa158015612401573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124259190613178565b6001600160a01b031614612465576040517fc5c23c8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f19190613178565b6001600160a01b031614612531576040517f41b30e2500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001546040517fe84b725d0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301529091169063e84b725d90602401600060405180830381600087803b15801561259157600080fd5b505af11580156125a5573d6000803e3d6000fd5b50506040516001600160a01b03841681527f2220a12ec67ab06fa89ad2bf6522745af04a8f29b466b9c896da126dc95e21839250602001905060405180910390a16040513081527fe3bee2269179dff609bde2667db864c00a1529211302f765535fd788510b629c9060200160405180910390a150565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561269c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126c091906130f6565b90507f000000000000000000000000000000000000000000000000000000000000000081106127a8576004546005548082116127505760006127028383613195565b90508381106127145761156984612ae7565b600060026127228387613195565b61272c91906131ac565b905061273781612b85565b6127496127448287613195565b612ae7565b5050505050565b600061275c8284613195565b905083811061276e5761156984612b85565b6000600261277c8387613195565b61278691906131ac565b905061279181612ae7565b61274961279e8287613195565b612b85565b505050565b610798612c0f565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383811691821790925560408051928516835260208301919091527fbd5e43cc7b243faaa8e808256df815d121be0fd579b46c17a3f993fb170972ec9101611852565b6001600160a01b038116612860576040517fc581719a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663609da8976040518163ffffffff1660e01b8152600401602060405180830381865afa15801561289e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128c29190613156565b612903576040517f1034170c0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602401610423565b816001600160a01b0316816001600160a01b0316141561294f576040517fd30917ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa15801561298d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b19190613178565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614612a1b576040517fc5c23c8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7d9190613178565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146117e2576040517f41b30e2500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600254612b21906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911683612d64565b600260009054906101000a90046001600160a01b03166001600160a01b031663d0e30db06040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612b7157600080fd5b505af1158015612749573d6000803e3d6000fd5b600354612bbf906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116911683612d64565b600360009054906101000a90046001600160a01b03166001600160a01b031663d0e30db06040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612b7157600080fd5b60055460045411612cbf576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152610ee3907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612c9b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274491906130f6565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152610ee3907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612d40573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279e91906130f6565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526127a392869291600091612e22918516908490612ecc565b8051909150156127a35780806020019051810190612e409190613156565b6127a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610423565b6060612edb8484600085612ee5565b90505b9392505050565b606082471015612f77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610423565b843b612fdf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610423565b600080866001600160a01b03168587604051612ffb9190613213565b60006040518083038185875af1925050503d8060008114613038576040519150601f19603f3d011682016040523d82523d6000602084013e61303d565b606091505b509150915061304d828286613058565b979650505050505050565b60608315613067575081612ede565b8251156130775782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610423919061322f565b6001600160a01b038116811461079857600080fd5b6000602082840312156130d257600080fd5b8135612ede816130ab565b6000602082840312156130ef57600080fd5b5035919050565b60006020828403121561310857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156131515761315161310f565b500190565b60006020828403121561316857600080fd5b81518015158114612ede57600080fd5b60006020828403121561318a57600080fd5b8151612ede816130ab565b6000828210156131a7576131a761310f565b500390565b6000826131e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60005b838110156132025781810151838201526020016131ea565b838111156115df5750506000910152565b600082516132258184602087016131e7565b9190910192915050565b602081526000825180602084015261324e8160408501602087016131e7565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220cea76130715bcb48721900380465bf1f74abb80db4b93ebca5e49d5564c67d7664736f6c634300080a00330000000000000000000000001e8be946370a99019e323998acd37a1206bdd507000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075c5d2d8d54254476239a5c1e1f23ec48df8779e000000000000000000000000000000000000000000000000000000746a528800

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063853828b6116100f9578063d0e30db011610097578063e84b725d11610071578063e84b725d1461037a578063f2f4eb261461038d578063f2fde38b146103b4578063f947d5c9146103c757600080fd5b8063d0e30db01461034c578063d921f2ee14610354578063e573317b1461036757600080fd5b8063b84c7f2d116100d3578063b84c7f2d14610302578063b8efa43514610329578063bec1c47314610331578063cabfb9341461033957600080fd5b8063853828b6146102e15780638da5cb5b146102e957806394a368d2146102fa57600080fd5b8063562901d911610166578063645c044111610140578063645c0441146102b75780636f791d29146102ca578063715018a6146102d1578063722713f7146102d957600080fd5b8063562901d914610279578063609da8971461028c57806360f96a8f146102a457600080fd5b80632e1a7d4d116101a25780632e1a7d4d1461022a5780632fd20a471461023d57806332ce8ccd146102535780633d8db9111461026657600080fd5b806301d05096146101c95780631f1fcd51146101d357806329627e5914610217575b600080fd5b6101d16103da565b005b6101fa7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b6040516001600160a01b0390911681526020015b60405180910390f35b6101d16102253660046130c0565b6106cb565b6101d16102383660046130dd565b61079b565b61024561081f565b60405190815260200161020e565b6101d16102613660046130c0565b610988565b6101d16102743660046130dd565b6109bd565b6101d16102873660046130c0565b610aa2565b610294610df1565b604051901515815260200161020e565b6001546101fa906001600160a01b031681565b6101d16102c53660046130c0565b610e03565b6000610294565b6101d1610e65565b610245610ee5565b610245610ef4565b6000546001600160a01b03166101fa565b610245610f43565b6102457f000000000000000000000000000000000000000000000000000000746a52880081565b6101d1610f4b565b6101d161102c565b6101d16103473660046130c0565b61107c565b6101d1611392565b6002546101fa906001600160a01b031681565b6101d16103753660046130c0565b6113de565b6101d16103883660046130c0565b6114ab565b6101fa7f0000000000000000000000000865a889183039689034da55c1fd12af5083eabf81565b6101d16103c23660046130c0565b6115e5565b6003546101fa906001600160a01b031681565b60008060006103e76116f8565b919450925090508261042c576040517f1034170c0000000000000000000000000000000000000000000000000000000081523060048201526024015b60405180910390fd5b336001600160a01b038316141561054b57806001600160a01b031663b8efa4356040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561047857600080fd5b505af115801561048c573d6000803e3d6000fd5b50506001546040517fe84b725d0000000000000000000000000000000000000000000000000000000081526001600160a01b038581166004830152909116925063e84b725d9150602401600060405180830381600087803b1580156104f057600080fd5b505af1158015610504573d6000803e3d6000fd5b50506040516001600160a01b03851681527fe3bee2269179dff609bde2667db864c00a1529211302f765535fd788510b629c925060200190505b60405180910390a1610693565b336001600160a01b038216141561066157816001600160a01b031663b8efa4356040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561059757600080fd5b505af11580156105ab573d6000803e3d6000fd5b50506001546040517fe84b725d0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152909116925063e84b725d9150602401600060405180830381600087803b15801561060f57600080fd5b505af1158015610623573d6000803e3d6000fd5b50506040516001600160a01b03841681527fe3bee2269179dff609bde2667db864c00a1529211302f765535fd788510b629c9250602001905061053e565b6040517f01f65dd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040513081527fe3bee2269179dff609bde2667db864c00a1529211302f765535fd788510b629c9060200160405180910390a1505050565b6000546001600160a01b0316331461073f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b6003546001600160a01b031615610782576040517fbaf3f0f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61078d60008261172c565b6107986000826117e6565b50565b6001546001600160a01b031633146107df576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80610816576040517fc581719a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107988161185e565b6001546000906001600160a01b03163314610866576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600254604080517f2fd20a4700000000000000000000000000000000000000000000000000000000815290516000926001600160a01b031691632fd20a47916004808301926020929190829003018187875af11580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee91906130f6565b90506000600360009054906101000a90046001600160a01b03166001600160a01b0316632fd20a476040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610947573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096b91906130f6565b600483905560058190559050610981818361313e565b9250505090565b6109918161107c565b6040517f71861b9f192277502a2209dde5e25ecfd52ca83931ffc892ef70282bf7b93a2a90600090a150565b335b6001600160a01b03166109da6000546001600160a01b031690565b6001600160a01b031614610a4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b6040517fc79348a60000000000000000000000000000000000000000000000000000000081527fffffffff00000000000000000000000000000000000000000000000000000000600035166004820152602401610423565b6000546001600160a01b03163314610b16576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b600154604080517f6f791d2900000000000000000000000000000000000000000000000000000000815290516001600160a01b0392831692841691636f791d299160048083019260209291908290030181865afa158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9f9190613156565b15610bd6576040517fef062dc400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610be081836119a3565b6000610beb83611c4c565b9050826001600160a01b0316816001600160a01b03166360f96a8f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c599190613178565b6001600160a01b031614610c99576040517f5f53dd9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b826001600160a01b03166360f96a8f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfb9190613178565b6001600160a01b0316826001600160a01b031614610d45576040517f5f53dd9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fe84b725d0000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015283169063e84b725d90602401600060405180830381600087803b158015610da157600080fd5b505af1158015610db5573d6000803e3d6000fd5b50505050610dc38284611ee9565b6040517f1fd0ed0afde2d0281930362705e45b089222803618cdbae0b540a3ad040e845690600090a1505050565b6000610dfb6116f8565b509092915050565b6001546001600160a01b03163314610e47576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e5133826119a3565b610e5a81611c4c565b506107983382611ee9565b6000546001600160a01b03163314610ed9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b610ee36000611f59565b565b6000610eef611fc1565b905090565b6001546000906001600160a01b03163314610f3b576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eef6120cb565b6000336109bf565b6001546001600160a01b03163314610f8f576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154604080517f60f96a8f00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916360f96a8f9160048083019260209291908290030181865afa158015610ff2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110169190613178565b905061102233826119a3565b6107983382611ee9565b6001546001600160a01b03163314611070576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006004819055600555565b6000546001600160a01b031633146110f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b60008060006110fd6116f8565b919450925090508261113d576040517f1034170c000000000000000000000000000000000000000000000000000000008152306004820152602401610423565b6000849050826001600160a01b0316816001600160a01b031663d921f2ee6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ae9190613178565b6001600160a01b0316146111ee576040517fa575e80500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316816001600160a01b031663f947d5c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015611236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125a9190613178565b6001600160a01b03161461129a576040517f899f893a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112a3816121aa565b6040517f645c04410000000000000000000000000000000000000000000000000000000081526001600160a01b03828116600483015284169063645c044190602401600060405180830381600087803b1580156112ff57600080fd5b505af1158015611313573d6000803e3d6000fd5b50506040517f645c04410000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516925063645c04419150602401600060405180830381600087803b15801561137357600080fd5b505af1158015611387573d6000803e3d6000fd5b505050505050505050565b6001546001600160a01b031633146113d6576040517fb70e2d7000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ee361261c565b6000546001600160a01b03163314611452576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b6002546001600160a01b031615611495576040517fbaf3f0f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114a060008261172c565b6107986000826127b0565b60008060006114b86116f8565b91945092509050826114f8576040517f1034170c000000000000000000000000000000000000000000000000000000008152306004820152602401610423565b336001600160a01b038316141561156e57806001600160a01b0316846001600160a01b03161415611555576040517fd30917ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61155f828561172c565b61156982856127b0565b6115df565b336001600160a01b038216141561066157816001600160a01b0316846001600160a01b031614156115cb576040517fd30917ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115d5818561172c565b61156981856117e6565b50505050565b6000546001600160a01b03163314611659576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610423565b6001600160a01b0381166116ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610423565b61079881611f59565b6002546003546000916001600160a01b039081169116811580159061172557506001600160a01b03811615155b9250909192565b6117368282612820565b306001600160a01b0316816001600160a01b03166360f96a8f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561177e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a29190613178565b6001600160a01b0316146117e2576040517f5f53dd9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383811691821790925560408051928516835260208301919091527fc6df8dcbfc70e15ca180225a8f328727b3205e5bf99f25d94077862b53a6e6ee91015b60405180910390a15050565b600454808211156119595780156118ea57600260009054906101000a90046001600160a01b03166001600160a01b031663853828b66040518163ffffffff1660e01b81526004016020604051808303816000875af11580156118c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e891906130f6565b505b6003546001600160a01b0316632e1a7d4d6119058385613195565b6040518263ffffffff1660e01b815260040161192391815260200190565b600060405180830381600087803b15801561193d57600080fd5b505af1158015611951573d6000803e3d6000fd5b505050505050565b6002546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0390911690632e1a7d4d90602401611923565b6001600160a01b0381163014156119e6576040517f3073085f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316816001600160a01b03161415611a32576040517f3073085f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a949190613178565b6001600160a01b0316826001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff9190613178565b6001600160a01b031614611b3f576040517fc5c23c8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba19190613178565b6001600160a01b0316826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611be8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0c9190613178565b6001600160a01b0316146117e2576040517f41b30e2500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000816001600160a01b031663609da8976040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb09190613156565b611cf1576040517f1034170c0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602401610423565b6000826001600160a01b031663d921f2ee6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d559190613178565b9050600080306001600160a01b0316836001600160a01b03161490506000856001600160a01b0316636f791d296040518163ffffffff1660e01b8152600401602060405180830381865afa158015611db1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd59190613156565b611e4b57856001600160a01b031663f947d5c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3b9190613178565b9250506001600160a01b03821630145b818015611e555750805b15611e8c576040517fbb0897ee00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81158015611e98575080155b15611ecf576040517f1e203c1700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8115611edf575090949350505050565b5091949350505050565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383811691821790925560408051928516835260208301919091527f2a821884f0167e84fc3824c66c12861f8f72abb7c76fd899bf5039be1c4ac7b79101611852565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600254604080517f722713f700000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163722713f79160048083019260209291908290030181865afa158015612024573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204891906130f6565b9050600360009054906101000a90046001600160a01b03166001600160a01b031663722713f76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561209d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c191906130f6565b610eef908261313e565b600254604080517f853828b600000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163853828b6916004808301926020929190829003018187875af115801561212f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215391906130f6565b9050600360009054906101000a90046001600160a01b03166001600160a01b031663853828b66040518163ffffffff1660e01b81526004016020604051808303816000875af115801561209d573d6000803e3d6000fd5b6001600160a01b0381166121ea576040517fc581719a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663609da8976040518163ffffffff1660e01b8152600401602060405180830381865afa158015612228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224c9190613156565b61228d576040517f1034170c0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602401610423565b6001600160a01b0381163014156122d0576040517fd30917ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600154604080517f60f96a8f00000000000000000000000000000000000000000000000000000000815290516001600160a01b03928316928416916360f96a8f9160048083019260209291908290030181865afa158015612335573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123599190613178565b6001600160a01b031614612399576040517f5f53dd9800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0000000000000000000000000865a889183039689034da55c1fd12af5083eabf6001600160a01b0316816001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa158015612401573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124259190613178565b6001600160a01b031614612465576040517fc5c23c8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316816001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f19190613178565b6001600160a01b031614612531576040517f41b30e2500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001546040517fe84b725d0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301529091169063e84b725d90602401600060405180830381600087803b15801561259157600080fd5b505af11580156125a5573d6000803e3d6000fd5b50506040516001600160a01b03841681527f2220a12ec67ab06fa89ad2bf6522745af04a8f29b466b9c896da126dc95e21839250602001905060405180910390a16040513081527fe3bee2269179dff609bde2667db864c00a1529211302f765535fd788510b629c9060200160405180910390a150565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316906370a0823190602401602060405180830381865afa15801561269c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126c091906130f6565b90507f000000000000000000000000000000000000000000000000000000746a52880081106127a8576004546005548082116127505760006127028383613195565b90508381106127145761156984612ae7565b600060026127228387613195565b61272c91906131ac565b905061273781612b85565b6127496127448287613195565b612ae7565b5050505050565b600061275c8284613195565b905083811061276e5761156984612b85565b6000600261277c8387613195565b61278691906131ac565b905061279181612ae7565b61274961279e8287613195565b612b85565b505050565b610798612c0f565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383811691821790925560408051928516835260208301919091527fbd5e43cc7b243faaa8e808256df815d121be0fd579b46c17a3f993fb170972ec9101611852565b6001600160a01b038116612860576040517fc581719a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663609da8976040518163ffffffff1660e01b8152600401602060405180830381865afa15801561289e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128c29190613156565b612903576040517f1034170c0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602401610423565b816001600160a01b0316816001600160a01b0316141561294f576040517fd30917ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa15801561298d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b19190613178565b6001600160a01b03167f0000000000000000000000000865a889183039689034da55c1fd12af5083eabf6001600160a01b031614612a1b576040517fc5c23c8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7d9190613178565b6001600160a01b03167f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316146117e2576040517f41b30e2500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600254612b21906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488116911683612d64565b600260009054906101000a90046001600160a01b03166001600160a01b031663d0e30db06040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612b7157600080fd5b505af1158015612749573d6000803e3d6000fd5b600354612bbf906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488116911683612d64565b600360009054906101000a90046001600160a01b03166001600160a01b031663d0e30db06040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612b7157600080fd5b60055460045411612cbf576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152610ee3907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316906370a0823190602401602060405180830381865afa158015612c9b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274491906130f6565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152610ee3907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316906370a0823190602401602060405180830381865afa158015612d40573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279e91906130f6565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526127a392869291600091612e22918516908490612ecc565b8051909150156127a35780806020019051810190612e409190613156565b6127a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610423565b6060612edb8484600085612ee5565b90505b9392505050565b606082471015612f77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610423565b843b612fdf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610423565b600080866001600160a01b03168587604051612ffb9190613213565b60006040518083038185875af1925050503d8060008114613038576040519150601f19603f3d011682016040523d82523d6000602084013e61303d565b606091505b509150915061304d828286613058565b979650505050505050565b60608315613067575081612ede565b8251156130775782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610423919061322f565b6001600160a01b038116811461079857600080fd5b6000602082840312156130d257600080fd5b8135612ede816130ab565b6000602082840312156130ef57600080fd5b5035919050565b60006020828403121561310857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156131515761315161310f565b500190565b60006020828403121561316857600080fd5b81518015158114612ede57600080fd5b60006020828403121561318a57600080fd5b8151612ede816130ab565b6000828210156131a7576131a761310f565b500390565b6000826131e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60005b838110156132025781810151838201526020016131ea565b838111156115df5750506000910152565b600082516132258184602087016131e7565b9190910192915050565b602081526000825180602084015261324e8160408501602087016131e7565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220cea76130715bcb48721900380465bf1f74abb80db4b93ebca5e49d5564c67d7664736f6c634300080a0033

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

0000000000000000000000001e8be946370a99019e323998acd37a1206bdd507000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075c5d2d8d54254476239a5c1e1f23ec48df8779e000000000000000000000000000000000000000000000000000000746a528800

-----Decoded View---------------
Arg [0] : _initialParent (address): 0x1E8bE946370a99019E323998Acd37A1206bdD507
Arg [1] : _initialChildOne (address): 0x0000000000000000000000000000000000000000
Arg [2] : _initialChildTwo (address): 0x75C5d2d8D54254476239a5c1e1F23ec48Df8779E
Arg [3] : _MIN_AMOUNT_FOR_EQUAL_SPLIT (uint256): 500000000000

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000001e8be946370a99019e323998acd37a1206bdd507
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 00000000000000000000000075c5d2d8d54254476239a5c1e1f23ec48df8779e
Arg [3] : 000000000000000000000000000000000000000000000000000000746a528800


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.