ETH Price: $2,819.56 (-10.51%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Map129446052021-08-02 7:19:051280 days ago1627888745IN
Indexed Finance: Cream Protocol Adapter
0 ETH0.084888525
Map129445952021-08-02 7:16:051280 days ago1627888565IN
Indexed Finance: Cream Protocol Adapter
0 ETH0.1362185725
Map129445932021-08-02 7:15:541280 days ago1627888554IN
Indexed Finance: Cream Protocol Adapter
0 ETH0.1259893525
Map129444392021-08-02 6:42:471280 days ago1627886567IN
Indexed Finance: Cream Protocol Adapter
0 ETH0.1373536525

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129446052021-08-02 7:19:051280 days ago1627888745
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
129445952021-08-02 7:16:051280 days ago1627888565
Indexed Finance: Cream Protocol Adapter
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CreamProtocolAdapter

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion, MIT license
File 1 of 20 : CreamProtocolAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;

import "../interfaces/CompoundInterfaces.sol";
import "../adapters/cream/CrErc20Adapter.sol";
import "../adapters/cream/CrEtherAdapter.sol";
import "./AbstractProtocolAdapter.sol";


contract CreamProtocolAdapter is AbstractProtocolAdapter {
  using CloneLibrary for address;

/* ========== Constants ========== */

  IComptroller public constant comptroller = IComptroller(0x3d5BC3c8d13dcB8bF317092d84783c2697AE9258);
  address public immutable erc20AdapterImplementation;
  address public immutable etherAdapterImplementation;

/* ========== Constructor ========== */

  constructor(IAdapterRegistry _registry) AbstractProtocolAdapter(_registry) {
    erc20AdapterImplementation = address(new CrErc20Adapter());
    etherAdapterImplementation = address(new CrEtherAdapter());
  }

/* ========== Internal Actions ========== */

  function deployAdapter(address cToken) internal virtual override returns (address adapter) {
    address underlying;
    // The call to underlying will use all the gas sent if it fails,
    // so we specify a maximum of 25k gas. The contract will only use ~2k
    // but this protects against all likely changes to the gas schedule.
    try ICToken(cToken).underlying{gas: 25000}() returns (address _underlying) {
      underlying = _underlying;
      if (underlying == address(0)) {
        underlying = weth;
      }
    } catch {
      underlying = weth;
    }
    if (underlying == weth) {
      adapter = CloneLibrary.createClone(etherAdapterImplementation);
    } else {
      adapter = CloneLibrary.createClone(erc20AdapterImplementation);
    }
    CrErc20Adapter(adapter).initialize(underlying, address(cToken));
  }

/* ========== Public Queries ========== */

  function protocol() external pure virtual override returns (string memory) {
    return "Cream";
  }

  function getUnmapped() public view virtual override returns (address[] memory cTokens) {
    cTokens = toAddressArray(comptroller.getAllMarkets());
    uint256 len = cTokens.length;
    uint256 prevLen = totalMapped;
    if (len == prevLen) {
      assembly { mstore(cTokens, 0) }
    } else {
      assembly {
        cTokens := add(cTokens, mul(prevLen, 32))
        mstore(cTokens, sub(len, prevLen))
      }
    }
  }

  function toAddressArray(ICToken[] memory cTokens) internal pure returns (address[] memory arr) {
    assembly { arr := cTokens }
  }

/* ========== Internal Queries ========== */

  function isAdapterMarketFrozen(address adapter) internal view virtual override returns (bool) {
    return comptroller.mintGuardianPaused(IErc20Adapter(adapter).token());
  }

  function isTokenMarketFrozen(address cToken) internal view virtual override returns (bool) {
    // Return true if market is paused in comptroller
    bool isFrozen = comptroller.mintGuardianPaused(cToken);
    if (isFrozen) return true;
    // Return true if market is for an SLP token, which the adapter can not handle.
    // The call to `sushi()` will use all the gas sent if it fails, so we specify a
    // maximum of 25k gas to ensure it will not use all the gas in the transaction, but
    // can still be executed with any foreseeable changes to the gas schedule.
    try ICToken(cToken).sushi{gas:25000}() returns (address) {
      return true;
    } catch {
      // Return true is supply is 0.
      return IERC20(cToken).totalSupply() == 0;
    }
  }
}

File 2 of 20 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

            bytes32 lastvalue = set._values[lastIndex];

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

File 3 of 20 : AbstractErc20Adapter.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

import "../libraries/TransferHelper.sol";
import "../libraries/SymbolHelper.sol";
import "../interfaces/IERC20Metadata.sol";
import "../interfaces/IERC20.sol";


abstract contract AbstractErc20Adapter {
  using SymbolHelper for address;
  using TransferHelper for address;

/* ========== Storage ========== */

  address public underlying;
  address public token;

/* ========== Initializer ========== */

  function initialize(address _underlying, address _token) public virtual {
    require(underlying == address(0) && token == address(0), "initialized");
    require(_underlying != address(0) && _token != address(0), "bad address");
    underlying = _underlying;
    token = _token;
    _approve();
  }

/* ========== Internal Queries ========== */

  function _protocolName() internal view virtual returns (string memory);

/* ========== Metadata ========== */

  function name() external view virtual returns (string memory) {
    return string(abi.encodePacked(
      bytes(_protocolName()),
      " ",
      bytes(underlying.getSymbol()),
      " Adapter"
    ));
  }

  function availableLiquidity() public view virtual returns (uint256);

/* ========== Conversion Queries ========== */

  function toUnderlyingAmount(uint256 tokenAmount) external view virtual returns (uint256);

  function toWrappedAmount(uint256 underlyingAmount) external view virtual returns (uint256);

/* ========== Performance Queries ========== */

  function getAPR() public view virtual returns (uint256);

  function getHypotheticalAPR(int256 _deposit) external view virtual returns (uint256);

  function getRevenueBreakdown()
    external
    view
    virtual
    returns (
      address[] memory assets,
      uint256[] memory aprs
    )
  {
    assets = new address[](1);
    aprs = new uint256[](1);
    assets[0] = underlying;
    aprs[0] = getAPR();
  }

/* ========== Caller Balance Queries ========== */

  function balanceWrapped() public view virtual returns (uint256) {
    return IERC20(token).balanceOf(msg.sender);
  }

  function balanceUnderlying() external view virtual returns (uint256);

/* ========== Token Actions ========== */

  function deposit(uint256 amountUnderlying) external virtual returns (uint256 amountMinted) {
    require(amountUnderlying > 0, "deposit 0");
    underlying.safeTransferFrom(msg.sender, address(this), amountUnderlying);
    amountMinted = _mint(amountUnderlying);
    token.safeTransfer(msg.sender, amountMinted);
  }

  function withdraw(uint256 amountToken) public virtual returns (uint256 amountReceived) {
    require(amountToken > 0, "withdraw 0");
    token.safeTransferFrom(msg.sender, address(this), amountToken);
    amountReceived = _burn(amountToken);
    underlying.safeTransfer(msg.sender, amountReceived);
  }

  function withdrawAll() public virtual returns (uint256 amountReceived) {
    return withdraw(balanceWrapped());
  }

  function withdrawUnderlying(uint256 amountUnderlying) external virtual returns (uint256 amountBurned) {
    require(amountUnderlying > 0, "withdraw 0");
    amountBurned = _burnUnderlying(amountUnderlying);
    underlying.safeTransfer(msg.sender, amountUnderlying);
  }

  function withdrawUnderlyingUpTo(uint256 amountUnderlying) external virtual returns (uint256 amountReceived) {
    require(amountUnderlying > 0, "withdraw 0");
    uint256 amountAvailable = availableLiquidity();
    amountReceived = amountAvailable < amountUnderlying ? amountAvailable : amountUnderlying;
    _burnUnderlying(amountReceived);
    underlying.safeTransfer(msg.sender, amountReceived);
  }

/* ========== Internal Actions ========== */

  function _approve() internal virtual;

  /**
   * @dev Deposit `amountUnderlying` into the wrapper and return the amount of wrapped tokens received.
   * Note:
   * - Called after the underlying token is transferred.
   * - Should not transfer minted token to caller.
   */
  function _mint(uint256 amountUnderlying) internal virtual returns (uint256 amountMinted);

  /**
   * @dev Burn `amountToken` of `token` and return the amount of `underlying` received.
   * Note:
   * - Called after the wrapper token is transferred.
   * - Should not transfer underlying token to caller.
   */
  function _burn(uint256 amountToken) internal virtual returns (uint256 amountReceived);

  /**
   * @dev Redeem `amountUnderlying` of the underlying token and return the amount of wrapper tokens burned.
   * Note:
   * - Should transfer the wrapper token from the caller.
   * - Should not transfer underlying token to caller.
   */
  function _burnUnderlying(uint256 amountUnderlying) internal virtual returns (uint256 amountBurned);
}

File 4 of 20 : AbstractEtherAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

import "../libraries/TransferHelper.sol";
import "../interfaces/IERC20Metadata.sol";
import "../interfaces/IERC20.sol";
import "./AbstractErc20Adapter.sol";


abstract contract AbstractEtherAdapter is AbstractErc20Adapter {
  using TransferHelper for address;

/* ========== Metadata ========== */

  function name() external view virtual override returns (string memory) {
    return string(abi.encodePacked(
      bytes(_protocolName()),
      " ETH Adapter"
    ));
  }

/* ========== Fallback ========== */

  fallback() external payable { return; }

  receive() external payable { return; }

/* ========== Token Actions ========== */

  function deposit(uint256 amountUnderlying)
    external
    virtual
    override
    returns (uint256 amountMinted)
  {
    underlying.safeTransferFrom(msg.sender, address(this), amountUnderlying);
    _afterReceiveWETH(amountUnderlying);
    amountMinted = _mint(amountUnderlying);
    token.safeTransfer(msg.sender, amountMinted);
  }

  function depositETH() external virtual payable returns (uint256 amountMinted) {
    _afterReceiveETH(msg.value);
    amountMinted = _mint(msg.value);
    token.safeTransfer(msg.sender, amountMinted);
  }

  function withdraw(uint256 amountToken) public virtual override returns (uint256 amountReceived) {
    token.safeTransferFrom(msg.sender, address(this), amountToken);
    amountReceived = _burn(amountToken);
    _beforeSendWETH(amountReceived);
    underlying.safeTransfer(msg.sender, amountReceived);
  }

  function withdrawAsETH(uint256 amountToken) public virtual returns (uint256 amountReceived) {
    token.safeTransferFrom(msg.sender, address(this), amountToken);
    amountReceived = _burn(amountToken);
    _beforeSendETH(amountReceived);
    address(msg.sender).safeTransferETH(amountReceived);
  }

  function withdrawAllAsETH() public virtual returns (uint256 amountReceived) {
    return withdrawAsETH(balanceWrapped());
  }

  function withdrawUnderlying(uint256 amountUnderlying) external virtual override returns (uint256 amountBurned) {
    amountBurned = _burnUnderlying(amountUnderlying);
    _beforeSendWETH(amountUnderlying);
    underlying.safeTransfer(msg.sender, amountUnderlying);
  }

  function withdrawUnderlyingAsETH(uint256 amountUnderlying) external virtual returns (uint256 amountBurned) {
    amountBurned = _burnUnderlying(amountUnderlying);
    _beforeSendETH(amountUnderlying);
    address(msg.sender).safeTransferETH(amountUnderlying);
  }

  function withdrawUnderlyingUpTo(uint256 amountUnderlying) external virtual override returns (uint256 amountReceived) {
    require(amountUnderlying > 0, "withdraw 0");
    uint256 amountAvailable = availableLiquidity();
    amountReceived = amountAvailable < amountUnderlying ? amountAvailable : amountUnderlying;
    _burnUnderlying(amountReceived);
    _beforeSendWETH(amountReceived);
    underlying.safeTransfer(msg.sender, amountReceived);
  }

/* ========== Internal Ether Handlers ========== */
  
  // Convert to WETH if contract takes WETH
  function _afterReceiveETH(uint256 amount) internal virtual;

  // Convert to WETH if contract takes ETH
  function _afterReceiveWETH(uint256 amount) internal virtual;

  // Convert to ETH if contract returns WETH
  function _beforeSendETH(uint256 amount) internal virtual;

  // Convert to WETH if contract returns ETH
  function _beforeSendWETH(uint256 amount) internal virtual;
}

File 5 of 20 : CrErc20Adapter.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

import "../AbstractErc20Adapter.sol";
import "../../interfaces/CompoundInterfaces.sol";
import "../../interfaces/IERC20.sol";
import "../../interfaces/IWETH.sol";
import "../../libraries/LowGasSafeMath.sol";
import "../../libraries/TransferHelper.sol";
import "../../libraries/MinimalSignedMath.sol";
import { CTokenParams } from "../../libraries/CTokenParams.sol";


contract CrErc20Adapter is AbstractErc20Adapter() {
  using MinimalSignedMath for uint256;
  using LowGasSafeMath for uint256;
  using TransferHelper for address;

/* ========== Internal Queries ========== */

  function _protocolName() internal view virtual override returns (string memory) {
    return "Cream";
  }

/* ========== Metadata ========== */

  function availableLiquidity() public view override returns (uint256) {
    return IERC20(underlying).balanceOf(token);
  }

/* ========== Conversion Queries ========== */

  function toUnderlyingAmount(uint256 tokenAmount) public view override returns (uint256) {
    return (
      tokenAmount
      .mul(CTokenParams.currentExchangeRate(token))
      / uint256(1e18)
    );
  }

  function toWrappedAmount(uint256 underlyingAmount) public view override returns (uint256) {
    return underlyingAmount
      .mul(1e18)
      / CTokenParams.currentExchangeRate(token);
  }

/* ========== Performance Queries ========== */

  function getAPR() public view virtual override returns (uint256) {
    return ICToken(token).supplyRatePerBlock().mul(2102400);
  }

  function getHypotheticalAPR(int256 liquidityDelta) external view virtual override returns (uint256) {
    ICToken cToken = ICToken(token);
    (
      address model,
      uint256 cashPrior,
      uint256 borrowsPrior,
      uint256 reservesPrior,
      uint256 reserveFactorMantissa
    ) = CTokenParams.getInterestRateParameters(address(cToken));
    return IInterestRateModel(model).getSupplyRate(
      cashPrior.add(liquidityDelta),
      borrowsPrior,
      reservesPrior,
      reserveFactorMantissa
    ).mul(2102400);
  }

/* ========== Caller Balance Queries ========== */

  function balanceUnderlying() external view virtual override returns (uint256) {
    return toUnderlyingAmount(ICToken(token).balanceOf(msg.sender));
  }

/* ========== Internal Actions ========== */

  function _approve() internal virtual override {
    underlying.safeApproveMax(token);
  }

  function _mint(uint256 amountUnderlying) internal virtual override returns (uint256 amountMinted) {
    address _token = token;
    require(ICToken(_token).mint(amountUnderlying) == 0, "CrErc20: Mint failed");
    amountMinted = IERC20(_token).balanceOf(address(this));
  }

  function _burn(uint256 amountToken) internal virtual override returns (uint256 amountReceived) {
    require(ICToken(token).redeem(amountToken) == 0, "CrErc20: Burn failed");
    amountReceived = IERC20(underlying).balanceOf(address(this));
  }

  function _burnUnderlying(uint256 amountUnderlying) internal virtual override returns (uint256 amountBurned) {
    amountBurned = toWrappedAmount(amountUnderlying);
    token.safeTransferFrom(msg.sender, address(this), amountBurned);
    require(ICToken(token).redeemUnderlying(amountUnderlying) == 0, "CrErc20: Burn failed");
  }
}

File 6 of 20 : CrEtherAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

import "../AbstractEtherAdapter.sol";
import "../../interfaces/CompoundInterfaces.sol";
import "../../interfaces/IERC20.sol";
import "../../interfaces/IWETH.sol";
import "../../libraries/LowGasSafeMath.sol";
import "../../libraries/TransferHelper.sol";
import "../../libraries/MinimalSignedMath.sol";
import { CTokenParams } from "../../libraries/CTokenParams.sol";


contract CrEtherAdapter is AbstractEtherAdapter() {
  using MinimalSignedMath for uint256;
  using LowGasSafeMath for uint256;
  using TransferHelper for address;

/* ========== Internal Queries ========== */

  function _protocolName() internal view virtual override returns (string memory) {
    return "Cream";
  }

/* ========== Metadata ========== */

  function availableLiquidity() public view override returns (uint256) {
    return address(token).balance;
  }

/* ========== Conversion Queries ========== */

  function toUnderlyingAmount(uint256 tokenAmount) public view override returns (uint256) {
    return (
      tokenAmount
      .mul(CTokenParams.currentExchangeRate(token))
      / uint256(1e18)
    );
  }

  function toWrappedAmount(uint256 underlyingAmount) public view override returns (uint256) {
    return underlyingAmount
      .mul(1e18)
      / CTokenParams.currentExchangeRate(token);
  }

/* ========== Performance Queries ========== */

  function getAPR() public view virtual override returns (uint256) {
    return ICToken(token).supplyRatePerBlock().mul(2102400);
  }

  function getHypotheticalAPR(int256 liquidityDelta) external view virtual override returns (uint256) {
    ICToken cToken = ICToken(token);
    (
      address model,
      uint256 cashPrior,
      uint256 borrowsPrior,
      uint256 reservesPrior,
      uint256 reserveFactorMantissa
    ) = CTokenParams.getInterestRateParameters(address(cToken));
    return IInterestRateModel(model).getSupplyRate(
      cashPrior.add(liquidityDelta),
      borrowsPrior,
      reservesPrior,
      reserveFactorMantissa
    ).mul(2102400);
  }

/* ========== Caller Balance Queries ========== */

  function balanceUnderlying() external view virtual override returns (uint256) {
    return toUnderlyingAmount(ICToken(token).balanceOf(msg.sender));
  }

/* ========== Internal Ether Handlers ========== */
  
  // Convert to WETH if contract takes WETH
  function _afterReceiveETH(uint256 amount) internal virtual override {}

  // Convert to WETH if contract takes ETH
  function _afterReceiveWETH(uint256 amount) internal virtual override {
    IWETH(underlying).withdraw(amount);
  }

  // Convert to ETH if contract returns WETH
  function _beforeSendETH(uint256 amount) internal virtual override {}

  // Convert to WETH if contract returns ETH
  function _beforeSendWETH(uint256 amount) internal virtual override {
    IWETH(underlying).deposit{value: amount}();
  }

/* ========== Internal Actions ========== */

  function _approve() internal virtual override {}

  function _mint(uint256 amountUnderlying) internal virtual override returns (uint256 amountMinted) {
    address _token = token;
    ICToken(_token).mint{value: amountUnderlying}();
    amountMinted = IERC20(_token).balanceOf(address(this));
  }

  function _burn(uint256 amountToken) internal virtual override returns (uint256 amountReceived) {
    require(ICToken(token).redeem(amountToken) == 0, "CEther: Burn failed");
    amountReceived = address(this).balance;
  }

  function _burnUnderlying(uint256 amountUnderlying) internal virtual override returns (uint256 amountBurned) {
    amountBurned = toWrappedAmount(amountUnderlying);
    token.safeTransferFrom(msg.sender, address(this), amountBurned);
    require(ICToken(token).redeemUnderlying(amountUnderlying) == 0, "CEther: Burn failed");
  }
}

File 7 of 20 : CompoundInterfaces.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
pragma abicoder v2;


interface ICToken {
  function comptroller() external view returns (address);
  function underlying() external view returns (address);
  function name() external view returns (string memory);
  function totalSupply() external view returns (uint256);

  function supplyRatePerBlock() external view returns (uint256);
  function borrowRatePerBlock() external view returns (uint256);

  function getCash() external view returns (uint256);
  function totalBorrows() external view returns (uint256);
  function totalReserves() external view returns (uint256);
  function reserveFactorMantissa() external view returns (uint256);
  function exchangeRateCurrent() external returns (uint256);
  function exchangeRateStored() external view returns (uint256);
  function accrualBlockNumber() external view returns (uint256);
  function borrowBalanceStored(address account) external view returns (uint);
  function interestRateModel() external view returns (IInterestRateModel);

  function balanceOf(address account) external view returns (uint256);
  function balanceOfUnderlying(address owner) external returns (uint);

  function mint(uint256 mintAmount) external returns (uint256);
  function mint() external payable;
  function redeem(uint256 tokenAmount) external returns (uint256);
  function redeemUnderlying(uint256 underlyingAmount) external returns (uint256);
  function borrow(uint borrowAmount) external returns (uint);

  // Used to check if a cream market is for an SLP token
  function sushi() external view returns (address);
}


interface IInterestRateModel {
  function getBorrowRate(
    uint cash,
    uint borrows,
    uint reserves
  ) external view returns (uint);

  function getSupplyRate(
    uint256 cash,
    uint256 borrows,
    uint256 reserves,
    uint256 reserveFactorMantissa
  ) external view returns (uint);
}


interface IComptroller {
  function admin() external view returns (address);
  function _setMintPaused(address cToken, bool state) external returns (bool);

  function getAllMarkets() external view returns (ICToken[] memory);
  function mintGuardianPaused(address cToken) external view returns (bool);
  function compSpeeds(address cToken) external view returns (uint256);
  function oracle() external view returns (IPriceOracle);
  function compAccrued(address) external view returns (uint);
  function markets(address cToken) external view returns (
    bool isListed,
    uint collateralFactorMantissa,
    bool isComped
  );
  function claimComp(address[] memory holders, address[] memory cTokens, bool borrowers, bool suppliers) external;
  function refreshCompSpeeds() external;
}


interface IPriceOracle {
  function getUnderlyingPrice(address cToken) external view returns (uint);
}

File 8 of 20 : IAdapterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;


interface IAdapterRegistry {
/* ========== Events ========== */

  event ProtocolAdapterAdded(uint256 protocolId, address protocolAdapter);

  event ProtocolAdapterRemoved(uint256 protocolId);

  event TokenAdapterAdded(address adapter, uint256 protocolId, address underlying, address wrapper);

  event TokenAdapterRemoved(address adapter, uint256 protocolId, address underlying, address wrapper);

  event TokenSupportAdded(address underlying);

  event TokenSupportRemoved(address underlying);

  event VaultFactoryAdded(address factory);

  event VaultFactoryRemoved(address factory);

  event VaultAdded(address underlying, address vault);

  event VaultRemoved(address underlying, address vault);

/* ========== Structs ========== */

  struct TokenAdapter {
    address adapter;
    uint96 protocolId;
  }

/* ========== Storage ========== */

  function protocolsCount() external view returns (uint256);

  function protocolAdapters(uint256 id) external view returns (address protocolAdapter);

  function protocolAdapterIds(address protocolAdapter) external view returns (uint256 id);

  function vaultsByUnderlying(address underlying) external view returns (address vault);

  function approvedVaultFactories(address factory) external view returns (bool approved);

/* ========== Vault Factory Management ========== */

  function addVaultFactory(address _factory) external;

  function removeVaultFactory(address _factory) external;

/* ========== Vault Management ========== */

  function addVault(address vault) external;

  function removeVault(address vault) external;

/* ========== Protocol Adapter Management ========== */

  function addProtocolAdapter(address protocolAdapter) external returns (uint256 id);

  function removeProtocolAdapter(address protocolAdapter) external;

/* ========== Token Adapter Management ========== */

  function addTokenAdapter(address adapter) external;

  function addTokenAdapters(address[] calldata adapters) external;

  function removeTokenAdapter(address adapter) external;

/* ========== Vault Queries ========== */

  function getVaultsList() external view returns (address[] memory);

  function haveVaultFor(address underlying) external view returns (bool);

/* ========== Protocol Queries ========== */

  function getProtocolAdaptersAndIds() external view returns (address[] memory adapters, uint256[] memory ids);

  function getProtocolMetadata(uint256 id) external view returns (address protocolAdapter, string memory name);

  function getProtocolForTokenAdapter(address adapter) external view returns (address protocolAdapter);

/* ========== Supported Token Queries ========== */

  function isSupported(address underlying) external view returns (bool);

  function getSupportedTokens() external view returns (address[] memory list);

/* ========== Token Adapter Queries ========== */

  function isApprovedAdapter(address adapter) external view returns (bool);

  function getAdaptersList(address underlying) external view returns (address[] memory list);

  function getAdapterForWrapperToken(address wrapperToken) external view returns (address);

  function getAdaptersCount(address underlying) external view returns (uint256);

  function getAdaptersSortedByAPR(address underlying)
    external
    view
    returns (address[] memory adapters, uint256[] memory aprs);

  function getAdaptersSortedByAPRWithDeposit(
    address underlying,
    uint256 deposit,
    address excludingAdapter
  )
    external
    view
    returns (address[] memory adapters, uint256[] memory aprs);

  function getAdapterWithHighestAPR(address underlying) external view returns (address adapter, uint256 apr);

  function getAdapterWithHighestAPRForDeposit(
    address underlying,
    uint256 deposit,
    address excludingAdapter
  ) external view returns (address adapter, uint256 apr);
}

File 9 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;


interface IERC20 {
  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);

  function totalSupply() external view returns (uint256);
  function balanceOf(address account) external view returns (uint256);
  function transfer(address recipient, uint256 amount) external returns (bool);
  function allowance(address owner, address spender) external view returns (uint256);
  function approve(address spender, uint256 amount) external returns (bool);
  function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
  function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
  function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}

File 10 of 20 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;


interface IERC20Metadata {
  function name() external view returns (string memory);
  function symbol() external view returns (string memory);
  function decimals() external view returns (uint8);
}


interface IERC20MetadataBytes32 {
  function name() external view returns (bytes32);
  function symbol() external view returns (bytes32);
}

File 11 of 20 : ITokenAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;


interface IErc20Adapter {
/* ========== Metadata ========== */

  function underlying() external view returns (address);

  function token() external view returns (address);

  function name() external view returns (string memory);

  function availableLiquidity() external view returns (uint256);

/* ========== Conversion ========== */

  function toUnderlyingAmount(uint256 tokenAmount) external view returns (uint256);

  function toWrappedAmount(uint256 underlyingAmount) external view returns (uint256);

/* ========== Performance Queries ========== */

  function getAPR() external view returns (uint256);

  function getHypotheticalAPR(int256 liquidityDelta) external view returns (uint256);

  function getRevenueBreakdown()
    external
    view
    returns (
      address[] memory assets,
      uint256[] memory aprs
    );

/* ========== Caller Balance Queries ========== */

  function balanceWrapped() external view returns (uint256);

  function balanceUnderlying() external view returns (uint256);

/* ========== Interactions ========== */

  function deposit(uint256 amountUnderlying) external returns (uint256 amountMinted);

  function withdraw(uint256 amountToken) external returns (uint256 amountReceived);

  function withdrawAll() external returns (uint256 amountReceived);

  function withdrawUnderlying(uint256 amountUnderlying) external returns (uint256 amountBurned);

  function withdrawUnderlyingUpTo(uint256 amountUnderlying) external returns (uint256 amountReceived);
}

interface IEtherAdapter is IErc20Adapter {
  function depositETH() external payable returns (uint256 amountMinted);

  function withdrawAsETH(uint256 amountToken) external returns (uint256 amountReceived);

  function withdrawAllAsETH() external returns (uint256 amountReceived);

  function withdrawUnderlyingAsETH(uint256 amountUnderlying) external returns (uint256 amountBurned); 
}

File 12 of 20 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;


interface IWETH {
  function deposit() external payable;
  function withdraw(uint) external;
}

File 13 of 20 : ArrayHelper.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0;

import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "../libraries/LowGasSafeMath.sol";
import "../interfaces/ITokenAdapter.sol";


library ArrayHelper {
  using EnumerableSet for EnumerableSet.AddressSet;
  using LowGasSafeMath for uint256;

/* ========== Type Cast ========== */

  /**
   * @dev Cast an enumerable address set as an address array.
   * The enumerable set library stores the values as a bytes32 array, this function
   * casts it as an address array with a pointer assignment.
   */
  function toArray(EnumerableSet.AddressSet storage set) internal view returns (address[] memory arr) {
    bytes32[] memory bytes32Arr = set._inner._values;
    assembly { arr := bytes32Arr }
  }

  /**
   * @dev Cast an array of IErc20Adapter to an array of address using a pointer assignment.
   * Note: The resulting array is the same as the original, so all changes to one will be
   * reflected in the other.
   */
  function toAddressArray(IErc20Adapter[] memory _arr) internal pure returns (address[] memory arr) {
    assembly { arr := _arr }
  }

/* ========== Math ========== */

  /**
   * @dev Computes the sum of a uint256 array.
   */
  function sum(uint256[] memory arr) internal pure returns (uint256 _sum) {
    uint256 len = arr.length;
    for (uint256 i; i < len; i++) _sum = _sum.add(arr[i]);
  }

/* ========== Removal ========== */

  /**
   * @dev Remove the element at `index` from an array and decrement its length.
   * If `index` is the last index in the array, pops it from the array.
   * Otherwise, stores the last element in the array at `index` and then pops the last element.
   */
  function mremove(uint256[] memory arr, uint256 index) internal pure {
    uint256 len = arr.length;
    if (index != len - 1) {
      uint256 last = arr[len - 1];
      arr[index] = last;
    }
    assembly { mstore(arr, sub(len, 1)) }
  }

  /**
   * @dev Remove the element at `index` from an array and decrement its length.
   * If `index` is the last index in the array, pops it from the array.
   * Otherwise, stores the last element in the array at `index` and then pops the last element.
   */
  function mremove(address[] memory arr, uint256 index) internal pure {
    uint256 len = arr.length;
    if (index != len - 1) {
      address last = arr[len - 1];
      arr[index] = last;
    }
    assembly { mstore(arr, sub(len, 1)) }
  }

  /**
   * @dev Remove the element at `index` from an array and decrement its length.
   * If `index` is the last index in the array, pops it from the array.
   * Otherwise, stores the last element in the array at `index` and then pops the last element.
   */
  function mremove(IErc20Adapter[] memory arr, uint256 index) internal pure {
    uint256 len = arr.length;
    if (index != len - 1) {
      IErc20Adapter last = arr[len - 1];
      arr[index] = last;
    }
    assembly { mstore(arr, sub(len, 1)) }
  }

  /**
   * @dev Remove the element at `index` from an array and decrement its length.
   * If `index` is the last index in the array, pops it from the array.
   * Otherwise, stores the last element in the array at `index` and then pops the last element.
   */
  function remove(bytes32[] storage arr, uint256 index) internal {
    uint256 len = arr.length;
    if (index == len - 1) {
      arr.pop();
      return;
    }
    bytes32 last = arr[len - 1];
    arr[index] = last;
    arr.pop();
  }

  /**
   * @dev Remove the element at `index` from an array and decrement its length.
   * If `index` is the last index in the array, pops it from the array.
   * Otherwise, stores the last element in the array at `index` and then pops the last element.
   */
  function remove(address[] storage arr, uint256 index) internal {
    uint256 len = arr.length;
    if (index == len - 1) {
      arr.pop();
      return;
    }
    address last = arr[len - 1];
    arr[index] = last;
    arr.pop();
  }

/* ========== Search ========== */

  /**
   * @dev Find the index of an address in an array.
   * If the address is not found, revert.
   */
  function indexOf(address[] memory arr, address find) internal pure returns (uint256) {
    uint256 len = arr.length;
    for (uint256 i; i < len; i++) if (arr[i] == find) return i;
    revert("element not found");
  }

  /**
   * @dev Determine whether an element is included in an array.
   */
  function includes(address[] memory arr, address find) internal pure returns (bool) {
    uint256 len = arr.length;
    for (uint256 i; i < len; i++) if (arr[i] == find) return true;
    return false;
  }

/* ========== Sorting ========== */

  /**
   * @dev Given an array of tokens and scores, sort by scores in descending order.
   * Maintains the relationship between elements of each array at the same index.
   */
  function sortByDescendingScore(
    address[] memory addresses,
    uint256[] memory scores
  ) internal pure {
    uint256 len = addresses.length;
    for (uint256 i = 0; i < len; i++) {
      uint256 score = scores[i];
      address _address = addresses[i];
      uint256 j = i - 1;
      while (int(j) >= 0 && scores[j] < score) {
        scores[j + 1] = scores[j];
        addresses[j + 1] = addresses[j];
        j--;
      }
      scores[j + 1] = score;
      addresses[j + 1] = _address;
    }
  }
}

File 14 of 20 : CTokenParams.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

import "../interfaces/CompoundInterfaces.sol";
import "./LowGasSafeMath.sol";
import "./MinimalSignedMath.sol";


library CTokenParams {
  using LowGasSafeMath for uint256;
  using MinimalSignedMath for uint256;

  uint256 internal constant EXP_SCALE = 1e18;
  uint256 internal constant HALF_EXP_SCALE = 5e17;

  function getInterestRateParameters(address token) internal view returns (
    address model,
    uint256 cashPrior,
    uint256 borrowsPrior,
    uint256 reservesPrior,
    uint256 reserveFactorMantissa
  ) {
    ICToken cToken = ICToken(token);
    model = address(cToken.interestRateModel());

    cashPrior = cToken.getCash();
    borrowsPrior = cToken.totalBorrows();
    reservesPrior = cToken.totalReserves();
    uint256 accrualBlockNumber = cToken.accrualBlockNumber();
    uint256 blockDelta = block.number - accrualBlockNumber;
    reserveFactorMantissa = cToken.reserveFactorMantissa();
    if (blockDelta > 0) {
      uint256 borrowRateMantissa = getBorrowRate(address(model), cashPrior, borrowsPrior, reservesPrior);
      uint256 interestAccumulated = mulScalarTruncate(borrowRateMantissa.mul(blockDelta), borrowsPrior);
      borrowsPrior = borrowsPrior.add(interestAccumulated);
      reservesPrior = mulScalarTruncate(reserveFactorMantissa, interestAccumulated).add(reservesPrior);
    }
  }

  function currentExchangeRate(address token) internal view returns (uint256 exchangeRate) {
    ICToken cToken = ICToken(token);
    uint256 blockDelta = block.number - cToken.accrualBlockNumber();
    if (blockDelta == 0) {
      return cToken.exchangeRateStored();
    }

    IInterestRateModel model = cToken.interestRateModel();

    uint256 cashPrior = cToken.getCash();
    uint256 borrowsPrior = cToken.totalBorrows();
    uint256 reservesPrior = cToken.totalReserves();
    uint256 reserveFactorMantissa = cToken.reserveFactorMantissa();
    if (blockDelta > 0) {
      uint256 borrowRateMantissa = getBorrowRate(address(model), cashPrior, borrowsPrior, reservesPrior);
      uint256 interestAccumulated = mulScalarTruncate(borrowRateMantissa.mul(blockDelta), borrowsPrior);
      borrowsPrior = borrowsPrior.add(interestAccumulated);
      reservesPrior = mulScalarTruncate(reserveFactorMantissa, interestAccumulated).add(reservesPrior);
    }

    return cashPrior.add(borrowsPrior).sub(reservesPrior).mul(1e18) / ICToken(token).totalSupply();
  }
  

  function truncate(uint256 x) internal pure returns (uint256) {
    return x / EXP_SCALE;
  }

  function mulScalarTruncate(uint256 x, uint256 y) internal pure returns (uint256) {
    return truncate(x.mul(y));
  }

  function mulScalarTruncateAddUInt(uint256 x, uint256 y, uint256 z) internal pure returns (uint256) {
    return mulScalarTruncate(x, y).add(z);
  }

  function getBorrowRate(
    address model,
    uint256 cash,
    uint256 borrows,
    uint256 reserves
  ) internal view returns (uint256 borrowRateMantissa) {
    (bool success, bytes memory retData) = model.staticcall(
      abi.encodeWithSelector(
        IInterestRateModel.getBorrowRate.selector,
        cash,
        borrows,
        reserves
      )
    );
    if (!success) revert(abi.decode(retData, (string)));
    assembly {
      switch lt(mload(retData), 64)
      case 0 {borrowRateMantissa := mload(add(retData, 64))}
      default {borrowRateMantissa := mload(add(retData, 32))}
    }
  }
}

File 15 of 20 : CloneLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/**
 * EIP 1167 Proxy Deployment
 * Originally from https://github.com/optionality/clone-factory/
 */
library CloneLibrary {
  function getCreateCode(address target) internal pure returns (bytes memory createCode) {
    // Reserve 55 bytes for the deploy code + 17 bytes as a buffer to prevent overwriting
    // other memory in the final mstore
    createCode = new bytes(72);
    assembly {
      let clone := add(createCode, 32)
      mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
      mstore(add(clone, 0x14), shl(96, target))
      mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
      mstore(createCode, 55)
    }
  }

  function createClone(address target) internal returns (address result) {
    bytes memory createCode = getCreateCode(target);
    assembly { result := create(0, add(createCode, 32), 55) }
  }

  function createClone(address target, bytes32 salt) internal returns (address result) {
    bytes memory createCode = getCreateCode(target);
    assembly { result := create2(0, add(createCode, 32), 55, salt) }
  }

  function isClone(address target, address query) internal view returns (bool result) {
    assembly {
      let clone := mload(0x40)
      mstore(clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000)
      mstore(add(clone, 0xa), shl(96, target))
      mstore(add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)

      let other := add(clone, 0x40)
      extcodecopy(query, other, 0, 0x2d)
      result := and(
        eq(mload(clone), mload(other)),
        eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
      )
    }
  }
}

File 16 of 20 : LowGasSafeMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.0;

/************************************************************************************************
Originally from https://github.com/Uniswap/uniswap-v3-core/blob/main/contracts/libraries/LowGasSafeMath.sol

This source code has been modified from the original, which was copied from the github repository
at commit hash b83fcf497e895ae59b97c9d04e997023f69b5e97.

Subject to the GPL-2.0 license
*************************************************************************************************/


/// @title Optimized overflow and underflow safe math operations
/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost
library LowGasSafeMath {
  /// @notice Returns x + y, reverts if sum overflows uint256
  /// @param x The augend
  /// @param y The addend
  /// @return z The sum of x and y
  function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
    require((z = x + y) >= x);
  }

  /// @notice Returns x + y, reverts if sum overflows uint256
  /// @param x The augend
  /// @param y The addend
  /// @return z The sum of x and y
  function add(uint256 x, uint256 y, string memory errorMessage) internal pure returns (uint256 z) {
    require((z = x + y) >= x, errorMessage);
  }

  /// @notice Returns x - y, reverts if underflows
  /// @param x The minuend
  /// @param y The subtrahend
  /// @return z The difference of x and y
  function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
    require(y <= x);
    z = x - y;
  }

  /// @notice Returns x - y, reverts if underflows
  /// @param x The minuend
  /// @param y The subtrahend
  /// @return z The difference of x and y
  function sub(uint256 x, uint256 y, string memory errorMessage) internal pure returns (uint256 z) {
    require(y <= x, errorMessage);
    z = x - y;
  }

  /// @notice Returns x * y, reverts if overflows
  /// @param x The multiplicand
  /// @param y The multiplier
  /// @return z The product of x and y
  function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
    if (x == 0) return 0;
    z = x * y;
    require(z / x == y);
  }

  /// @notice Returns x * y, reverts if overflows
  /// @param x The multiplicand
  /// @param y The multiplier
  /// @return z The product of x and y
  function mul(uint256 x, uint256 y, string memory errorMessage) internal pure returns (uint256 z) {
    if (x == 0) return 0;
    z = x * y;
    require(z / x == y, errorMessage);
  }

  /// @notice Returns ceil(x / y)
  /// @param x The numerator
  /// @param y The denominator
  /// @return z The quotient of x and y
  function divCeil(uint256 x, uint256 y) internal pure returns (uint256 z) {
    z = x % y == 0 ? x / y : (x/y) + 1;
  }
}

File 17 of 20 : MinimalSignedMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;


library MinimalSignedMath {
  function add(int256 a, int256 b) internal pure returns (int256) {
    int256 c = a + b;
    require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");

    return c;
  }

  function sub(int256 a, int256 b) internal pure returns (int256) {
    int256 c = a - b;
    require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow");

    return c;
  }

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

File 18 of 20 : SymbolHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

import "../interfaces/IERC20Metadata.sol";


library SymbolHelper {

  /**
   * @dev Returns the index of the lowest bit set in `self`.
   * Note: Requires that `self != 0`
   */
  function lowestBitSet(uint256 self) internal pure returns (uint256 _z) {
    require (self > 0, "Bits::lowestBitSet: Value 0 has no bits set");
    uint256 _magic = 0x00818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff;
    uint256 val = (self & -self) * _magic >> 248;
    uint256 _y = val >> 5;
    _z = (
      _y < 4
        ? _y < 2
          ? _y == 0
            ? 0x753a6d1b65325d0c552a4d1345224105391a310b29122104190a110309020100
            : 0xc976c13bb96e881cb166a933a55e490d9d56952b8d4e801485467d2362422606
          : _y == 2
            ? 0xe39ed557db96902cd38ed14fad815115c786af479b7e83247363534337271707
            : 0xf7cae577eec2a03cf3bad76fb589591debb2dd67e0aa9834bea6925f6a4a2e0e
        : _y < 6
          ? _y == 4
            ? 0xc8c0b887b0a8a4489c948c7f847c6125746c645c544c444038302820181008ff
            : 0xf6e4ed9ff2d6b458eadcdf97bd91692de2d4da8fd2d0ac50c6ae9a8272523616
          : _y == 6
            ? 0xf5ecf1b3e9debc68e1d9cfabc5997135bfb7a7a3938b7b606b5b4b3f2f1f0ffe
            : 0xf8f9cbfae6cc78fbefe7cdc3a1793dfcf4f0e8bbd8cec470b6a28a7a5a3e1efd
    );
    _z >>= (val & 0x1f) << 3;
    return _z & 0xff;
  }

  function getSymbol(address token) internal view returns (string memory) {
    (bool success, bytes memory data) = token.staticcall(abi.encodeWithSignature("symbol()"));
    if (!success) return "UNKNOWN";
    if (data.length != 32) return abi.decode(data, (string));
    uint256 symbol = abi.decode(data, (uint256));
    if (symbol == 0) return "UNKNOWN";
    uint256 emptyBits = 255 - lowestBitSet(symbol);
    uint256 size = (emptyBits / 8) + (emptyBits % 8 > 0 ? 1 : 0);
    assembly { mstore(data, size) }
    return string(data);
  }

  function getName(address token) internal view returns (string memory) {
    (bool success, bytes memory data) = token.staticcall(abi.encodeWithSignature("name()"));
    if (!success) return "UNKNOWN";
    if (data.length != 32) return abi.decode(data, (string));
    uint256 symbol = abi.decode(data, (uint256));
    if (symbol == 0) return "UNKNOWN";
    uint256 emptyBits = 255 - lowestBitSet(symbol);
    uint256 size = (emptyBits / 8) + (emptyBits % 8 > 0 ? 1 : 0);
    assembly { mstore(data, size) }
    return string(data);
  }

  function getPrefixedSymbol(string memory prefix, address token) internal view returns (string memory prefixedSymbol) {
    prefixedSymbol = string(abi.encodePacked(
      prefix,
      getSymbol(token)
    ));
  }

  function getPrefixedName(string memory prefix, address token) internal view returns (string memory prefixedName) {
    prefixedName = string(abi.encodePacked(
      prefix,
      getName(token)
    ));
  }
}

File 19 of 20 : TransferHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

/************************************************************************************************
Originally from https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/TransferHelper.sol

This source code has been modified from the original, which was copied from the github repository
at commit hash cfedb1f55864dcf8cc0831fdd8ec18eb045b7fd1.

Subject to the MIT license
*************************************************************************************************/


library TransferHelper {
  function safeApproveMax(address token, address to) internal {
    safeApprove(token, to, type(uint256).max);
  }

  function safeUnapprove(address token, address to) internal {
    safeApprove(token, to, 0);
  }

  function safeApprove(address token, address to, uint value) internal {
    // bytes4(keccak256(bytes("approve(address,uint256)")));
    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
    require(success && (data.length == 0 || abi.decode(data, (bool))), "TH:SA");
  }

  function safeTransfer(address token, address to, uint value) internal {
    // bytes4(keccak256(bytes("transfer(address,uint256)")));
    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
    require(success && (data.length == 0 || abi.decode(data, (bool))), "TH:ST");
  }

  function safeTransferFrom(address token, address from, address to, uint value) internal {
    // bytes4(keccak256(bytes("transferFrom(address,address,uint256)")));
    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
    require(success && (data.length == 0 || abi.decode(data, (bool))), "TH:STF");
  }

  function safeTransferETH(address to, uint256 value) internal {
    (bool success, ) = to.call{value: value}("");
    require(success, "TH:STE");
  }
}

File 20 of 20 : AbstractProtocolAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;

import "../interfaces/IAdapterRegistry.sol";
import "../libraries/CloneLibrary.sol";
import "../libraries/ArrayHelper.sol";


abstract contract AbstractProtocolAdapter {
  using ArrayHelper for address[];

/* ========== Events ========== */

  event MarketFrozen(address token);

  event MarketUnfrozen(address token);

  event AdapterFrozen(address adapter);

  event AdapterUnfrozen(address adapter);

/* ========== Constants ========== */

  /**
   * @dev WETH address used for deciding whether to deploy an ERC20 or Ether adapter.
   */
  address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

  /**
   * @dev Global registry of adapters.
   */
  IAdapterRegistry public immutable registry;

/* ========== Storage ========== */

  /**
   * @dev List of adapters which have been deployed and then frozen.
   */
  address[] public frozenAdapters;

  /**
   * @dev List of tokens which have been frozen and which do not have an adapter.
   */
  address[] public frozenTokens;

  /**
   * @dev Number of tokens which have been mapped by the adapter.
   */
  uint256 public totalMapped;

/* ========== Constructor ========== */

  constructor(IAdapterRegistry _registry) {
    registry = _registry;
  }

/* ========== Public Actions ========== */

  /**
   * @dev Map up to `max` tokens, starting at `totalMapped`.
   */
  function map(uint256 max) external virtual {
    address[] memory tokens = getUnmappedUpTo(max);
    uint256 len = tokens.length;
    address[] memory adapters = new address[](len);
    uint256 skipped;
    for (uint256 i; i < len; i++) {
      address token = tokens[i];
      if (isTokenMarketFrozen(token)) {
        skipped++;
        frozenTokens.push(token);
        emit MarketFrozen(token);
        continue;
      }
      address adapter = deployAdapter(token);
      adapters[i - skipped] = adapter;
    }
    totalMapped += len;
    assembly { if gt(skipped, 0) { mstore(adapters, sub(len, skipped)) } }
    registry.addTokenAdapters(adapters);
  }

  /**
   * @dev Unfreeze adapter at `index` in `frozenAdapters`.
   * Market for the adapter must not be frozen by the protocol.
   */
  function unfreezeAdapter(uint256 index) external virtual {
    address adapter = frozenAdapters[index];
    require(!isAdapterMarketFrozen(adapter), "Market still frozen");
    frozenAdapters.remove(index);
    registry.addTokenAdapter(adapter);
    emit AdapterUnfrozen(adapter);
  }

  /**
   * @dev Unfreeze token at `index` in `frozenTokens` and create a new adapter for it.
   * Market for the token must not be frozen by the protocol.
   */
  function unfreezeToken(uint256 index) external virtual {
    address token = frozenTokens[index];
    require(!isTokenMarketFrozen(token), "Market still frozen");
    frozenTokens.remove(index);
    address adapter = deployAdapter(token);
    registry.addTokenAdapter(adapter);
    emit MarketUnfrozen(token);
  }

  /**
   * @dev Freeze `adapter` - add it to `frozenAdapters` and remove it from the registry.
   * Does not verify adapter exists or has been registered by this contract because the
   * registry handles that.
   */
  function freezeAdapter(address adapter) external virtual {
    require(isAdapterMarketFrozen(adapter), "Market not frozen");
    frozenAdapters.push(adapter);
    registry.removeTokenAdapter(adapter);
    emit AdapterFrozen(adapter);
  }

/* ========== Internal Actions ========== */

  /**
   * @dev Deploys an adapter for `token`, which will either be an underlying token
   * or a wrapper token, whichever is returned by `getUnmapped`.
   */
  function deployAdapter(address token) internal virtual returns (address);

/* ========== Public Queries ========== */

  /**
   * @dev Name of the protocol the adapter is for.
   */
  function protocol() external view virtual returns (string memory);

  /**
   * @dev Get the list of tokens which have not already been mapped by the adapter.
   * Tokens may be underlying tokens or wrapper tokens for a lending market.
   */
  function getUnmapped() public view virtual returns (address[] memory tokens);

  /**
   * @dev Get up to `max` tokens which have not already been mapped by the adapter.
   * Tokens may be underlying tokens or wrapper tokens for a lending market.
   */
  function getUnmappedUpTo(uint256 max) public view virtual returns (address[] memory tokens) {
    tokens = getUnmapped();
    if (tokens.length > max) {
      assembly { mstore(tokens, max) }
    }
  }

  function getFrozenAdapters() external view returns (address[] memory tokens) {
    tokens = frozenAdapters;
  }

  function getFrozenTokens() external view returns (address[] memory tokens) {
    tokens = frozenTokens;
  }

/* ========== Internal Queries ========== */

  /**
   * @dev Check whether the market for an adapter is frozen.
   */
  function isAdapterMarketFrozen(address adapter) internal view virtual returns (bool);

  /**
   * @dev Check whether the market for a token is frozen.
   */
  function isTokenMarketFrozen(address token) internal view virtual returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IAdapterRegistry","name":"_registry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterFrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterUnfrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"MarketFrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"MarketUnfrozen","type":"event"},{"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract IComptroller","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20AdapterImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"etherAdapterImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"adapter","type":"address"}],"name":"freezeAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"frozenAdapters","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"frozenTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFrozenAdapters","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFrozenTokens","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnmapped","outputs":[{"internalType":"address[]","name":"cTokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"max","type":"uint256"}],"name":"getUnmappedUpTo","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"max","type":"uint256"}],"name":"map","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"protocol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract IAdapterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMapped","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"unfreezeAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"unfreezeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e06040523480156200001157600080fd5b5060405162005508380380620055088339810160408190526200003491620000e1565b6001600160601b0319606082901b166080526040516200005490620000c5565b604051809103906000f08015801562000071573d6000803e3d6000fd5b5060601b6001600160601b03191660a0526040516200009090620000d3565b604051809103906000f080158015620000ad573d6000803e3d6000fd5b5060601b6001600160601b03191660c0525062000111565b6122af806200144283390190565b611e1780620036f183390190565b600060208284031215620000f3578081fd5b81516001600160a01b03811681146200010a578182fd5b9392505050565b60805160601c60a05160601c60c05160601c6112dd62000165600039806104c25280610dc35250806108dd5280610df35250806103aa528061046752806106e952806107d852806109b552506112dd6000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c8063b1245307116100b2578063d1e08f3111610081578063dc51b6ac11610066578063dc51b6ac146101f9578063e31beb9a1461020e578063f401f8a0146102215761011b565b8063d1e08f31146101de578063dc331224146101e65761011b565b8063b1245307146101a8578063b8dda9c7146101b0578063c961c589146101c3578063c97764e5146101d65761011b565b80637b103999116100ee5780637b103999146101705780638ce7442614610178578063990918fb1461018d57806399a16e61146101955761011b565b80633fc8cef3146101205780634d0ceecb1461013e5780634d787ea9146101535780635fe3b56714610168575b600080fd5b610128610234565b6040516101359190611173565b60405180910390f35b61014661024c565b60405161013591906111a1565b610166610161366004611143565b61030c565b005b61012861044d565b610128610465565b610180610489565b60405161013591906111ee565b6101286104c0565b6101466101a3366004611143565b6104e4565b610146610502565b6101666101be366004611143565b610564565b6101666101d136600461102f565b610757565b61014661087b565b6101286108db565b6101286101f4366004611143565b6108ff565b610201610929565b60405161013591906112af565b61016661021c366004611143565b61092f565b61012861022f366004611143565b610a57565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b60606102df733d5bc3c8d13dcb8bf317092d84783c2697ae92586001600160a01b031663b0772d0b6040518163ffffffff1660e01b815260040160006040518083038186803b15801561029e57600080fd5b505afa1580156102b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102da919081019061106e565b610a67565b805160025491925090808214156102f95760008352610307565b602081028301925080820383525b505090565b60006001828154811061031b57fe5b6000918252602090912001546001600160a01b0316905061033b81610a6a565b156103615760405162461bcd60e51b815260040161035890611241565b60405180910390fd5b61036c600183610c00565b600061037782610cdf565b6040517fff46d01b0000000000000000000000000000000000000000000000000000000081529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063ff46d01b906103df908490600401611173565b600060405180830381600087803b1580156103f957600080fd5b505af115801561040d573d6000803e3d6000fd5b505050507f9d70968988366484026d19fd2ed45ba53154e653af0d3b64a6e30fd1e59e9c02826040516104409190611173565b60405180910390a1505050565b733d5bc3c8d13dcb8bf317092d84783c2697ae925881565b7f000000000000000000000000000000000000000000000000000000000000000081565b60408051808201909152600581527f437265616d000000000000000000000000000000000000000000000000000000602082015290565b7f000000000000000000000000000000000000000000000000000000000000000081565b60606104ee61024c565b905081815111156104fd578181525b919050565b6060600080548060200260200160405190810160405280929190818152602001828054801561055a57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161053c575b5050505050905090565b600061056f826104e4565b805190915060008167ffffffffffffffff8111801561058d57600080fd5b506040519080825280602002602001820160405280156105b7578160200160208202803683370190505b5090506000805b838110156106bd5760008582815181106105d457fe5b602002602001015190506105e781610a6a565b156106765760018054808201825560008290527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b0384161790556040519301927fb33cb2dd3d0d4f68fb707ddade8bd1e4c8ba3c3cf18274aff3968e86a0548da190610668908390611173565b60405180910390a1506106b5565b600061068182610cdf565b905080858585038151811061069257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505050505b6001016105be565b50600280548401905580156106d25780830382525b604051633be4c7fd60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633be4c7fd9061071e9085906004016111a1565b600060405180830381600087803b15801561073857600080fd5b505af115801561074c573d6000803e3d6000fd5b505050505050505050565b61076081610e80565b61077c5760405162461bcd60e51b815260040161035890611278565b600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630180546001600160a01b0319166001600160a01b038381169190911790915560405163053551dd60e51b81527f00000000000000000000000000000000000000000000000000000000000000009091169063a6aa3ba09061080f908490600401611173565b600060405180830381600087803b15801561082957600080fd5b505af115801561083d573d6000803e3d6000fd5b505050507fd40fc6dc0bc7f9e69f705b5e74dfd3623d55ea32890b826bd25584e5f0f03fcc816040516108709190611173565b60405180910390a150565b6060600180548060200260200160405190810160405280929190818152602001828054801561055a576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161053c575050505050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000818154811061090f57600080fd5b6000918252602090912001546001600160a01b0316905081565b60025481565b600080828154811061093d57fe5b6000918252602090912001546001600160a01b0316905061095d81610e80565b1561097a5760405162461bcd60e51b815260040161035890611241565b610985600083610c00565b6040517fff46d01b0000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063ff46d01b906109ea908490600401611173565b600060405180830381600087803b158015610a0457600080fd5b505af1158015610a18573d6000803e3d6000fd5b505050507f2dac01b475b5c97016d30db596f912172f79a142dd507389304167f50f0173fb81604051610a4b9190611173565b60405180910390a15050565b6001818154811061090f57600080fd5b90565b60405163731f0c2b60e01b81526000908190733d5bc3c8d13dcb8bf317092d84783c2697ae92589063731f0c2b90610aa6908690600401611173565b60206040518083038186803b158015610abe57600080fd5b505afa158015610ad2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af69190611123565b90508015610b085760019150506104fd565b826001600160a01b0316630a0879036161a86040518263ffffffff1660e01b815260040160206040518083038187803b158015610b4457600080fd5b5086fa93505050508015610b75575060408051601f3d908101601f19168201909252610b7291810190611052565b60015b610bf557826001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb257600080fd5b505afa158015610bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bea919061115b565b6000149150506104fd565b6001925050506104fd565b81546000198101821415610c405782805480610c1857fe5b600082815260209020810160001990810180546001600160a01b031916905501905550610cdb565b6000836001830381548110610c5157fe5b9060005260206000200160009054906101000a90046001600160a01b0316905080848481548110610c7e57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555083805480610cb657fe5b600082815260209020810160001990810180546001600160a01b031916905501905550505b5050565b600080826001600160a01b0316636f307dc36161a86040518263ffffffff1660e01b815260040160206040518083038187803b158015610d1e57600080fd5b5086fa93505050508015610d4f575060408051601f3d908101601f19168201909252610d4c91810190611052565b60015b610d6e575073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2610d99565b9050806001600160a01b038116610d975773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291505b505b6001600160a01b03811673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21415610dee57610de77f0000000000000000000000000000000000000000000000000000000000000000610f88565b9150610e1a565b610e177f0000000000000000000000000000000000000000000000000000000000000000610f88565b91505b60405163485cc95560e01b81526001600160a01b0383169063485cc95590610e489084908790600401611187565b600060405180830381600087803b158015610e6257600080fd5b505af1158015610e76573d6000803e3d6000fd5b5050505050919050565b6000733d5bc3c8d13dcb8bf317092d84783c2697ae92586001600160a01b031663731f0c2b836001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ede57600080fd5b505afa158015610ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f169190611052565b6040518263ffffffff1660e01b8152600401610f329190611173565b60206040518083038186803b158015610f4a57600080fd5b505afa158015610f5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f829190611123565b92915050565b600080610f9483610fa6565b90506037602082016000f09392505050565b6040805160488082526080820190925260609160208201818036833750507f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000060208301525060609290921b6034830152507f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060488201526037815290565b80516104fd816112b8565b600060208284031215611040578081fd5b813561104b816112b8565b9392505050565b600060208284031215611063578081fd5b815161104b816112b8565b60006020808385031215611080578182fd5b825167ffffffffffffffff80821115611097578384fd5b818501915085601f8301126110aa578384fd5b8151818111156110b657fe5b838102604051858282010181811085821117156110cf57fe5b604052828152858101935084860182860187018a10156110ed578788fd5b8795505b838610156111165761110281611024565b8552600195909501949386019386016110f1565b5098975050505050505050565b600060208284031215611134578081fd5b8151801515811461104b578182fd5b600060208284031215611154578081fd5b5035919050565b60006020828403121561116c578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156111e25783516001600160a01b0316835292840192918401916001016111bd565b50909695505050505050565b6000602080835283518082850152825b8181101561121a578581018301518582016040015282016111fe565b8181111561122b5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526013908201527f4d61726b6574207374696c6c2066726f7a656e00000000000000000000000000604082015260600190565b60208082526011908201527f4d61726b6574206e6f742066726f7a656e000000000000000000000000000000604082015260600190565b90815260200190565b6001600160a01b03811681146112cd57600080fd5b5056fea164736f6c6343000706000a608060405234801561001057600080fd5b5061228f806100206000396000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c80636f307dc3116100b2578063b6b55f2511610081578063d31c9c2911610066578063d31c9c2914610372578063e83dd2e01461038f578063fc0c546a146103975761011b565b8063b6b55f251461034d578063c89d5b8b1461036a5761011b565b80636f307dc3146103115780637437535914610335578063853828b61461033d5780638da876c9146103455761011b565b80632e1a7d4d116100ee5780632e1a7d4d1461028a578063485cc955146102a75780634e6f376d146102d757806365cdab3d146102f45761011b565b8063020c06731461012057806306fdde03146101c15780631071a2901461023e578063282a050b1461026d575b600080fd5b61012861039f565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561016c578181015183820152602001610154565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156101ab578181015183820152602001610193565b5050505090500194505050505060405180910390f35b6101c9610441565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102035781810151838201526020016101eb565b50505050905090810190601f1680156102305780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61025b6004803603602081101561025457600080fd5b503561054d565b60408051918252519081900360200190f35b61025b6004803603602081101561028357600080fd5b50356105b8565b61025b600480360360208110156102a057600080fd5b50356105f3565b6102d5600480360360408110156102bd57600080fd5b506001600160a01b0381358116916020013516610671565b005b61025b600480360360208110156102ed57600080fd5b50356107a9565b61025b6004803603602081101561030a57600080fd5b50356107d3565b61031961085a565b604080516001600160a01b039092168252519081900360200190f35b61025b610869565b61025b6108eb565b61025b610902565b61025b6004803603602081101561036357600080fd5b5035610985565b61025b610a16565b61025b6004803603602081101561038857600080fd5b5035610a9f565b61025b610b40565b610319610b8b565b60408051600180825281830190925260609182919060208083019080368337505060408051600180825281830190925292945090506020808301908036833750506000805485519394506001600160a01b0316928592506103fc57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050610424610a16565b8160008151811061043157fe5b6020026020010181815250509091565b606061044b610b9a565b600054610460906001600160a01b0316610bd1565b6040516020018083805190602001908083835b602083106104925780518252601f199092019160209182019101610473565b6001836020036101000a03801982511681845116808217855250505050505090500180600160fd1b81525060010182805190602001908083835b602083106104eb5780518252601f1990920191602091820191016104cc565b6001836020036101000a038019825116818451168082178552505050505050905001807f204164617074657200000000000000000000000000000000000000000000000081525060080192505050604051602081830303815290604052905090565b6000808211610590576040805162461bcd60e51b815260206004820152600a6024820152690776974686472617720360b41b604482015290519081900360640190fd5b61059982610e2e565b6000549091506105b3906001600160a01b03163384610f20565b919050565b600154600090670de0b6b3a7640000906105e5906105de906001600160a01b0316611089565b8490611491565b816105ec57fe5b0492915050565b6000808211610636576040805162461bcd60e51b815260206004820152600a6024820152690776974686472617720360b41b604482015290519081900360640190fd5b60015461064e906001600160a01b03163330856114bf565b61065782611631565b6000549091506105b3906001600160a01b03163383610f20565b6000546001600160a01b031615801561069357506001546001600160a01b0316155b6106e4576040805162461bcd60e51b815260206004820152600b60248201527f696e697469616c697a6564000000000000000000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0382161580159061070457506001600160a01b03811615155b610755576040805162461bcd60e51b815260206004820152600b60248201527f6261642061646472657373000000000000000000000000000000000000000000604482015290519081900360640190fd5b600080546001600160a01b038085167fffffffffffffffffffffffff00000000000000000000000000000000000000009283161790925560018054928416929091169190911790556107a5611779565b5050565b6001546000906107c1906001600160a01b0316611089565b6105e583670de0b6b3a7640000611491565b6000808211610816576040805162461bcd60e51b815260206004820152600a6024820152690776974686472617720360b41b604482015290519081900360640190fd5b6000610820610869565b905082811061082f5782610831565b805b915061083c82610e2e565b50600054610854906001600160a01b03163384610f20565b50919050565b6000546001600160a01b031681565b60008054600154604080516370a0823160e01b81526001600160a01b039283166004820152905191909216916370a08231916024808301926020929190829003018186803b1580156108ba57600080fd5b505afa1580156108ce573d6000803e3d6000fd5b505050506040513d60208110156108e457600080fd5b5051905090565b60006108fd6108f8610b40565b6105f3565b905090565b600154604080516370a0823160e01b815233600482015290516000926108fd926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561095457600080fd5b505afa158015610968573d6000803e3d6000fd5b505050506040513d602081101561097e57600080fd5b50516105b8565b60008082116109db576040805162461bcd60e51b815260206004820152600960248201527f6465706f73697420300000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000546109f3906001600160a01b03163330856114bf565b6109fc82611797565b6001549091506105b3906001600160a01b03163383610f20565b60006108fd62201480600160009054906101000a90046001600160a01b03166001600160a01b031663ae9d70b06040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6d57600080fd5b505afa158015610a81573d6000803e3d6000fd5b505050506040513d6020811015610a9757600080fd5b505190611491565b6001546000906001600160a01b03168180808080610abc866118de565b939850919650945092509050610b34622014806001600160a01b03871663b8168816610ae8888d611bdf565b8787876040518563ffffffff1660e01b81526004018085815260200184815260200183815260200182815260200194505050505060206040518083038186803b158015610a6d57600080fd5b98975050505050505050565b600154604080516370a0823160e01b815233600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156108ba57600080fd5b6001546001600160a01b031681565b60408051808201909152600581527f437265616d000000000000000000000000000000000000000000000000000000602082015290565b60408051600481526024810182526020810180516001600160e01b03166395d89b4160e01b1781529151815160609360009384936001600160a01b03881693919290918291908083835b60208310610c3a5780518252601f199092019160209182019101610c1b565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610c9a576040519150601f19603f3d011682016040523d82523d6000602084013e610c9f565b606091505b509150915081610cd257604051806040016040528060078152602001662aa725a727aba760c91b815250925050506105b3565b8051602014610da957808060200190516020811015610cf057600080fd5b8101908080516040519392919084640100000000821115610d1057600080fd5b908301906020820185811115610d2557600080fd5b8251640100000000811182820188101715610d3f57600080fd5b82525081516020918201929091019080838360005b83811015610d6c578181015183820152602001610d54565b50505050905090810190601f168015610d995780820380516001836020036101000a031916815260200191505b50604052505050925050506105b3565b6000818060200190516020811015610dc057600080fd5b5051905080610df357604051806040016040528060078152602001662aa725a727aba760c91b81525093505050506105b3565b6000610dfe82611c40565b60ff0390506000806008830611610e16576000610e19565b60015b60ff1660088304018452509195945050505050565b6000610e39826107a9565b600154909150610e54906001600160a01b03163330846114bf565b6001546040805163852a12e360e01b81526004810185905290516001600160a01b039092169163852a12e3916024808201926020929091908290030181600087803b158015610ea257600080fd5b505af1158015610eb6573d6000803e3d6000fd5b505050506040513d6020811015610ecc57600080fd5b5051156105b3576040805162461bcd60e51b815260206004820152601460248201527f437245726332303a204275726e206661696c6564000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310610f9c5780518252601f199092019160209182019101610f7d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610ffe576040519150601f19603f3d011682016040523d82523d6000602084013e611003565b606091505b5091509150818015611031575080511580611031575080806020019051602081101561102e57600080fd5b50515b611082576040805162461bcd60e51b815260206004820152600560248201527f54483a5354000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b5050505050565b6000808290506000816001600160a01b0316636c540baf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156110ca57600080fd5b505afa1580156110de573d6000803e3d6000fd5b505050506040513d60208110156110f457600080fd5b5051430390508061116e57816001600160a01b031663182df0f56040518163ffffffff1660e01b815260040160206040518083038186803b15801561113857600080fd5b505afa15801561114c573d6000803e3d6000fd5b505050506040513d602081101561116257600080fd5b505192506105b3915050565b6000826001600160a01b031663f3fdb15a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156111a957600080fd5b505afa1580156111bd573d6000803e3d6000fd5b505050506040513d60208110156111d357600080fd5b505160408051631d8e90d160e11b815290519192506000916001600160a01b03861691633b1d21a2916004808301926020929190829003018186803b15801561121b57600080fd5b505afa15801561122f573d6000803e3d6000fd5b505050506040513d602081101561124557600080fd5b5051604080516308f7a6e360e31b815290519192506000916001600160a01b038716916347bd3718916004808301926020929190829003018186803b15801561128d57600080fd5b505afa1580156112a1573d6000803e3d6000fd5b505050506040513d60208110156112b757600080fd5b505160408051638f840ddd60e01b815290519192506000916001600160a01b03881691638f840ddd916004808301926020929190829003018186803b1580156112ff57600080fd5b505afa158015611313573d6000803e3d6000fd5b505050506040513d602081101561132957600080fd5b5051604080516305cee64160e21b815290519192506000916001600160a01b0389169163173b9904916004808301926020929190829003018186803b15801561137157600080fd5b505afa158015611385573d6000803e3d6000fd5b505050506040513d602081101561139b57600080fd5b5051905085156113f15760006113b386868686611e2e565b905060006113ca6113c4838a611491565b86612097565b90506113d685826120b2565b94506113ec846113e68584612097565b906120b2565b935050505b886001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561142a57600080fd5b505afa15801561143e573d6000803e3d6000fd5b505050506040513d602081101561145457600080fd5b505161147c670de0b6b3a76400006114768561147089896120b2565b906120c2565b90611491565b8161148357fe5b049998505050505050505050565b6000826114a0575060006114b9565b50818102818382816114ae57fe5b04146114b957600080fd5b92915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b178152925182516000948594938a169392918291908083835b602083106115435780518252601f199092019160209182019101611524565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146115a5576040519150601f19603f3d011682016040523d82523d6000602084013e6115aa565b606091505b50915091508180156115d85750805115806115d857508080602001905160208110156115d557600080fd5b50515b611629576040805162461bcd60e51b815260206004820152600660248201527f54483a5354460000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b505050505050565b6001546040805163db006a7560e01b81526004810184905290516000926001600160a01b03169163db006a7591602480830192602092919082900301818787803b15801561167e57600080fd5b505af1158015611692573d6000803e3d6000fd5b505050506040513d60208110156116a857600080fd5b5051156116fc576040805162461bcd60e51b815260206004820152601460248201527f437245726332303a204275726e206661696c6564000000000000000000000000604482015290519081900360640190fd5b600054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561174757600080fd5b505afa15801561175b573d6000803e3d6000fd5b505050506040513d602081101561177157600080fd5b505192915050565b600154600054611795916001600160a01b0391821691166120d7565b565b6001546040805163140e25ad60e31b81526004810184905290516000926001600160a01b031691829163a0712d689160248082019260209290919082900301818887803b1580156117e757600080fd5b505af11580156117fb573d6000803e3d6000fd5b505050506040513d602081101561181157600080fd5b505115611865576040805162461bcd60e51b815260206004820152601460248201527f437245726332303a204d696e74206661696c6564000000000000000000000000604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b038316916370a08231916024808301926020929190829003018186803b1580156118ab57600080fd5b505afa1580156118bf573d6000803e3d6000fd5b505050506040513d60208110156118d557600080fd5b50519392505050565b600080600080600080869050806001600160a01b031663f3fdb15a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561192357600080fd5b505afa158015611937573d6000803e3d6000fd5b505050506040513d602081101561194d57600080fd5b505160408051631d8e90d160e11b815290519197506001600160a01b03831691633b1d21a291600480820192602092909190829003018186803b15801561199357600080fd5b505afa1580156119a7573d6000803e3d6000fd5b505050506040513d60208110156119bd57600080fd5b5051604080516308f7a6e360e31b815290519196506001600160a01b038316916347bd371891600480820192602092909190829003018186803b158015611a0357600080fd5b505afa158015611a17573d6000803e3d6000fd5b505050506040513d6020811015611a2d57600080fd5b505160408051638f840ddd60e01b815290519195506001600160a01b03831691638f840ddd91600480820192602092909190829003018186803b158015611a7357600080fd5b505afa158015611a87573d6000803e3d6000fd5b505050506040513d6020811015611a9d57600080fd5b505160408051636c540baf60e01b815290519194506000916001600160a01b03841691636c540baf916004808301926020929190829003018186803b158015611ae557600080fd5b505afa158015611af9573d6000803e3d6000fd5b505050506040513d6020811015611b0f57600080fd5b5051604080516305cee64160e21b8152905191925043839003916001600160a01b0385169163173b9904916004808301926020929190829003018186803b158015611b5957600080fd5b505afa158015611b6d573d6000803e3d6000fd5b505050506040513d6020811015611b8357600080fd5b505193508015611bd3576000611b9b89898989611e2e565b90506000611bb2611bac8385611491565b89612097565b9050611bbe88826120b2565b9750611bce876113e68884612097565b965050505b50505091939590929450565b6000600160ff1b8310611bf157600080fd5b8282810160008412801590611c065750818112155b80611c1b5750600084128015611c1b57508181125b611c2457600080fd5b6000811215611c38576000925050506114b9565b949350505050565b6000808211611c805760405162461bcd60e51b815260040180806020018281038252602b815260200180612258602b913960400191505060405180910390fd5b7e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff60008390038316810260f881901c9060fd1c60048110611d6c5760068110611d175780600614611cf0577ff8f9cbfae6cc78fbefe7cdc3a1793dfcf4f0e8bbd8cec470b6a28a7a5a3e1efd611d12565b7ff5ecf1b3e9debc68e1d9cfabc5997135bfb7a7a3938b7b606b5b4b3f2f1f0ffe5b611d67565b80600414611d45577ff6e4ed9ff2d6b458eadcdf97bd91692de2d4da8fd2d0ac50c6ae9a8272523616611d67565b7fc8c0b887b0a8a4489c948c7f847c6125746c645c544c444038302820181008ff5b611e16565b60028110611dc85780600214611da2577ff7cae577eec2a03cf3bad76fb589591debb2dd67e0aa9834bea6925f6a4a2e0e611d67565b7fe39ed557db96902cd38ed14fad815115c786af479b7e83247363534337271707611e16565b8015611df4577fc976c13bb96e881cb166a933a55e490d9d56952b8d4e801485467d2362422606611e16565b7f753a6d1b65325d0c552a4d1345224105391a310b29122104190a1103090201005b60039290921b60f8169190911c60ff16949350505050565b604080516024810185905260448101849052606480820184905282518083039091018152608490910182526020810180516001600160e01b03166315f2405360e01b17815291518151600093849384936001600160a01b038b1693919290918291908083835b60208310611eb35780518252601f199092019160209182019101611e94565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611f13576040519150601f19603f3d011682016040523d82523d6000602084013e611f18565b606091505b50915091508161206b57808060200190516020811015611f3757600080fd5b8101908080516040519392919084640100000000821115611f5757600080fd5b908301906020820185811115611f6c57600080fd5b8251640100000000811182820188101715611f8657600080fd5b82525081516020918201929091019080838360005b83811015611fb3578181015183820152602001611f9b565b50505050905090810190601f168015611fe05780820380516001836020036101000a031916815260200191505b5060405250505060405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612030578181015183820152602001612018565b50505050905090810190601f16801561205d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604081511060008114612084576020820151935061208c565b604082015193505b505050949350505050565b60006120ab6120a68484611491565b6120e4565b9392505050565b808201828110156114b957600080fd5b6000828211156120d157600080fd5b50900390565b6107a582826000196120f5565b6000670de0b6b3a7640000826105ec565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1781529251825160009485949389169392918291908083835b602083106121715780518252601f199092019160209182019101612152565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146121d3576040519150601f19603f3d011682016040523d82523d6000602084013e6121d8565b606091505b5091509150818015612206575080511580612206575080806020019051602081101561220357600080fd5b50515b611082576040805162461bcd60e51b815260206004820152600560248201527f54483a5341000000000000000000000000000000000000000000000000000000604482015290519081900360640190fdfe426974733a3a6c6f776573744269745365743a2056616c7565203020686173206e6f206269747320736574a164736f6c6343000706000a608060405234801561001057600080fd5b50611df7806100206000396000f3fe60806040526004361061016a5760003560e01c806374375359116100cb578063c89d5b8b1161007f578063e83dd2e011610059578063e83dd2e014610505578063f6326fb31461051a578063fc0c546a146105225761016a565b8063c89d5b8b146104b1578063d31c9c29146104c6578063d809e453146104f05761016a565b80638da876c9116100b05780638da876c9146104485780639103c16b1461045d578063b6b55f25146104875761016a565b8063743753591461041e578063853828b6146104335761016a565b8063485cc9551161012257806365cdab3d1161010757806365cdab3d146103995780636c4c790e146103c35780636f307dc3146103ed5761016a565b8063485cc955146103345780634e6f376d1461036f5761016a565b80631071a290116101535780631071a290146102a4578063282a050b146102e05780632e1a7d4d1461030a5761016a565b8063020c06731461016c57806306fdde031461021a575b005b34801561017857600080fd5b50610181610537565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156101c55781810151838201526020016101ad565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156102045781810151838201526020016101ec565b5050505090500194505050505060405180910390f35b34801561022657600080fd5b5061022f6105d9565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610269578181015183820152602001610251565b50505050905090810190601f1680156102965780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102b057600080fd5b506102ce600480360360208110156102c757600080fd5b5035610677565b60408051918252519081900360200190f35b3480156102ec57600080fd5b506102ce6004803603602081101561030357600080fd5b50356106a9565b34801561031657600080fd5b506102ce6004803603602081101561032d57600080fd5b50356106e4565b34801561034057600080fd5b5061016a6004803603604081101561035757600080fd5b506001600160a01b038135811691602001351661072a565b34801561037b57600080fd5b506102ce6004803603602081101561039257600080fd5b5035610862565b3480156103a557600080fd5b506102ce600480360360208110156103bc57600080fd5b503561088c565b3480156103cf57600080fd5b506102ce600480360360208110156103e657600080fd5b503561092f565b3480156103f957600080fd5b50610402610968565b604080516001600160a01b039092168252519081900360200190f35b34801561042a57600080fd5b506102ce610977565b34801561043f57600080fd5b506102ce610987565b34801561045457600080fd5b506102ce61099e565b34801561046957600080fd5b506102ce6004803603602081101561048057600080fd5b5035610a21565b34801561049357600080fd5b506102ce600480360360208110156104aa57600080fd5b5035610a41565b3480156104bd57600080fd5b506102ce610a86565b3480156104d257600080fd5b506102ce600480360360208110156104e957600080fd5b5035610b0f565b3480156104fc57600080fd5b506102ce610bb0565b34801561051157600080fd5b506102ce610bc2565b6102ce610c3e565b34801561052e57600080fd5b50610402610c6c565b60408051600180825281830190925260609182919060208083019080368337505060408051600180825281830190925292945090506020808301908036833750506000805485519394506001600160a01b03169285925061059457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506105bc610a86565b816000815181106105c957fe5b6020026020010181815250509091565b60606105e3610c7b565b6040516020018082805190602001908083835b602083106106155780518252601f1990920191602091820191016105f6565b6001836020036101000a038019825116818451168082178552505050505050905001807f2045544820416461707465720000000000000000000000000000000000000000815250600c0191505060405160208183030381529060405290505b90565b600061068282610cb2565b905061068d82610da4565b6000546106a4906001600160a01b03163384610e0e565b919050565b600154600090670de0b6b3a7640000906106d6906106cf906001600160a01b0316610f77565b849061137f565b816106dd57fe5b0492915050565b6001546000906106ff906001600160a01b03163330856113ad565b61070882611517565b905061071381610da4565b6000546106a4906001600160a01b03163383610e0e565b6000546001600160a01b031615801561074c57506001546001600160a01b0316155b61079d576040805162461bcd60e51b815260206004820152600b60248201527f696e697469616c697a6564000000000000000000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b038216158015906107bd57506001600160a01b03811615155b61080e576040805162461bcd60e51b815260206004820152600b60248201527f6261642061646472657373000000000000000000000000000000000000000000604482015290519081900360640190fd5b600080546001600160a01b038085167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255600180549284169290911691909117905561085e6115e9565b5050565b60015460009061087a906001600160a01b0316610f77565b6106d683670de0b6b3a764000061137f565b60008082116108e2576040805162461bcd60e51b815260206004820152600a60248201527f7769746864726177203000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60006108ec610977565b90508281106108fb57826108fd565b805b915061090882610cb2565b5061091282610da4565b600054610929906001600160a01b03163384610e0e565b50919050565b60015460009061094a906001600160a01b03163330856113ad565b61095382611517565b905061095e816115eb565b6106a433826115ee565b6000546001600160a01b031681565b6001546001600160a01b03163190565b6000610999610994610bc2565b6106e4565b905090565b600154604080516370a0823160e01b81523360048201529051600092610999926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b1580156109f057600080fd5b505afa158015610a04573d6000803e3d6000fd5b505050506040513d6020811015610a1a57600080fd5b50516106a9565b6000610a2c82610cb2565b9050610a37826115eb565b6106a433836115ee565b60008054610a5a906001600160a01b03163330856113ad565b610a6382611699565b610a6c826116f5565b6001549091506106a4906001600160a01b03163383610e0e565b600061099962201480600160009054906101000a90046001600160a01b03166001600160a01b031663ae9d70b06040518163ffffffff1660e01b815260040160206040518083038186803b158015610add57600080fd5b505afa158015610af1573d6000803e3d6000fd5b505050506040513d6020811015610b0757600080fd5b50519061137f565b6001546000906001600160a01b03168180808080610b2c866117ce565b939850919650945092509050610ba4622014806001600160a01b03871663b8168816610b58888d611acf565b8787876040518563ffffffff1660e01b81526004018085815260200184815260200183815260200182815260200194505050505060206040518083038186803b158015610add57600080fd5b98975050505050505050565b6000610999610bbd610bc2565b61092f565b600154604080516370a0823160e01b815233600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610c0d57600080fd5b505afa158015610c21573d6000803e3d6000fd5b505050506040513d6020811015610c3757600080fd5b5051905090565b6000610c49346115eb565b610c52346116f5565b600154909150610674906001600160a01b03163383610e0e565b6001546001600160a01b031681565b60408051808201909152600581527f437265616d000000000000000000000000000000000000000000000000000000602082015290565b6000610cbd82610862565b600154909150610cd8906001600160a01b03163330846113ad565b6001546040805163852a12e360e01b81526004810185905290516001600160a01b039092169163852a12e3916024808201926020929091908290030181600087803b158015610d2657600080fd5b505af1158015610d3a573d6000803e3d6000fd5b505050506040513d6020811015610d5057600080fd5b5051156106a4576040805162461bcd60e51b815260206004820152601360248201527f4345746865723a204275726e206661696c656400000000000000000000000000604482015290519081900360640190fd5b60008054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015610df257600080fd5b505af1158015610e06573d6000803e3d6000fd5b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310610e8a5780518252601f199092019160209182019101610e6b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610eec576040519150601f19603f3d011682016040523d82523d6000602084013e610ef1565b606091505b5091509150818015610f1f575080511580610f1f5750808060200190516020811015610f1c57600080fd5b50515b610f70576040805162461bcd60e51b815260206004820152600560248201527f54483a5354000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b5050505050565b6000808290506000816001600160a01b0316636c540baf6040518163ffffffff1660e01b815260040160206040518083038186803b158015610fb857600080fd5b505afa158015610fcc573d6000803e3d6000fd5b505050506040513d6020811015610fe257600080fd5b5051430390508061105c57816001600160a01b031663182df0f56040518163ffffffff1660e01b815260040160206040518083038186803b15801561102657600080fd5b505afa15801561103a573d6000803e3d6000fd5b505050506040513d602081101561105057600080fd5b505192506106a4915050565b6000826001600160a01b031663f3fdb15a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561109757600080fd5b505afa1580156110ab573d6000803e3d6000fd5b505050506040513d60208110156110c157600080fd5b505160408051631d8e90d160e11b815290519192506000916001600160a01b03861691633b1d21a2916004808301926020929190829003018186803b15801561110957600080fd5b505afa15801561111d573d6000803e3d6000fd5b505050506040513d602081101561113357600080fd5b5051604080516308f7a6e360e31b815290519192506000916001600160a01b038716916347bd3718916004808301926020929190829003018186803b15801561117b57600080fd5b505afa15801561118f573d6000803e3d6000fd5b505050506040513d60208110156111a557600080fd5b505160408051638f840ddd60e01b815290519192506000916001600160a01b03881691638f840ddd916004808301926020929190829003018186803b1580156111ed57600080fd5b505afa158015611201573d6000803e3d6000fd5b505050506040513d602081101561121757600080fd5b5051604080516305cee64160e21b815290519192506000916001600160a01b0389169163173b9904916004808301926020929190829003018186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b5051905085156112df5760006112a186868686611b30565b905060006112b86112b2838a61137f565b86611d99565b90506112c48582611db4565b94506112da846112d48584611d99565b90611db4565b935050505b886001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561131857600080fd5b505afa15801561132c573d6000803e3d6000fd5b505050506040513d602081101561134257600080fd5b505161136a670de0b6b3a76400006113648561135e8989611db4565b90611dc4565b9061137f565b8161137157fe5b049998505050505050505050565b60008261138e575060006113a7565b508181028183828161139c57fe5b04146113a757600080fd5b92915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b178152925182516000948594938a169392918291908083835b602083106114315780518252601f199092019160209182019101611412565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611493576040519150601f19603f3d011682016040523d82523d6000602084013e611498565b606091505b50915091508180156114c65750805115806114c657508080602001905160208110156114c357600080fd5b50515b610e06576040805162461bcd60e51b815260206004820152600660248201527f54483a5354460000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6001546040805163db006a7560e01b81526004810184905290516000926001600160a01b03169163db006a7591602480830192602092919082900301818787803b15801561156457600080fd5b505af1158015611578573d6000803e3d6000fd5b505050506040513d602081101561158e57600080fd5b5051156115e2576040805162461bcd60e51b815260206004820152601360248201527f4345746865723a204275726e206661696c656400000000000000000000000000604482015290519081900360640190fd5b5047919050565b565b50565b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114611639576040519150601f19603f3d011682016040523d82523d6000602084013e61163e565b606091505b5050905080611694576040805162461bcd60e51b815260206004820152600660248201527f54483a5354450000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b505050565b6000805460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921692632e1a7d4d9260248084019382900301818387803b1580156116e157600080fd5b505af1158015610f70573d6000803e3d6000fd5b60015460408051631249c58b60e01b815290516000926001600160a01b0316918291631249c58b9186916004808301928892919082900301818588803b15801561173e57600080fd5b505af1158015611752573d6000803e3d6000fd5b5050604080516370a0823160e01b815230600482015290516001600160a01b03861694506370a08231935060248083019350602092829003018186803b15801561179b57600080fd5b505afa1580156117af573d6000803e3d6000fd5b505050506040513d60208110156117c557600080fd5b50519392505050565b600080600080600080869050806001600160a01b031663f3fdb15a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561181357600080fd5b505afa158015611827573d6000803e3d6000fd5b505050506040513d602081101561183d57600080fd5b505160408051631d8e90d160e11b815290519197506001600160a01b03831691633b1d21a291600480820192602092909190829003018186803b15801561188357600080fd5b505afa158015611897573d6000803e3d6000fd5b505050506040513d60208110156118ad57600080fd5b5051604080516308f7a6e360e31b815290519196506001600160a01b038316916347bd371891600480820192602092909190829003018186803b1580156118f357600080fd5b505afa158015611907573d6000803e3d6000fd5b505050506040513d602081101561191d57600080fd5b505160408051638f840ddd60e01b815290519195506001600160a01b03831691638f840ddd91600480820192602092909190829003018186803b15801561196357600080fd5b505afa158015611977573d6000803e3d6000fd5b505050506040513d602081101561198d57600080fd5b505160408051636c540baf60e01b815290519194506000916001600160a01b03841691636c540baf916004808301926020929190829003018186803b1580156119d557600080fd5b505afa1580156119e9573d6000803e3d6000fd5b505050506040513d60208110156119ff57600080fd5b5051604080516305cee64160e21b8152905191925043839003916001600160a01b0385169163173b9904916004808301926020929190829003018186803b158015611a4957600080fd5b505afa158015611a5d573d6000803e3d6000fd5b505050506040513d6020811015611a7357600080fd5b505193508015611ac3576000611a8b89898989611b30565b90506000611aa2611a9c838561137f565b89611d99565b9050611aae8882611db4565b9750611abe876112d48884611d99565b965050505b50505091939590929450565b6000600160ff1b8310611ae157600080fd5b8282810160008412801590611af65750818112155b80611b0b5750600084128015611b0b57508181125b611b1457600080fd5b6000811215611b28576000925050506113a7565b949350505050565b604080516024810185905260448101849052606480820184905282518083039091018152608490910182526020810180516001600160e01b03166315f2405360e01b17815291518151600093849384936001600160a01b038b1693919290918291908083835b60208310611bb55780518252601f199092019160209182019101611b96565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611c15576040519150601f19603f3d011682016040523d82523d6000602084013e611c1a565b606091505b509150915081611d6d57808060200190516020811015611c3957600080fd5b8101908080516040519392919084640100000000821115611c5957600080fd5b908301906020820185811115611c6e57600080fd5b8251640100000000811182820188101715611c8857600080fd5b82525081516020918201929091019080838360005b83811015611cb5578181015183820152602001611c9d565b50505050905090810190601f168015611ce25780820380516001836020036101000a031916815260200191505b5060405250505060405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d32578181015183820152602001611d1a565b50505050905090810190601f168015611d5f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604081511060008114611d865760208201519350611d8e565b604082015193505b505050949350505050565b6000611dad611da8848461137f565b611dd9565b9392505050565b808201828110156113a757600080fd5b600082821115611dd357600080fd5b50900390565b6000670de0b6b3a7640000826106dd56fea164736f6c6343000706000a0000000000000000000000005f2945604013ee9f80ae2eddb384462b681859c4

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061011b5760003560e01c8063b1245307116100b2578063d1e08f3111610081578063dc51b6ac11610066578063dc51b6ac146101f9578063e31beb9a1461020e578063f401f8a0146102215761011b565b8063d1e08f31146101de578063dc331224146101e65761011b565b8063b1245307146101a8578063b8dda9c7146101b0578063c961c589146101c3578063c97764e5146101d65761011b565b80637b103999116100ee5780637b103999146101705780638ce7442614610178578063990918fb1461018d57806399a16e61146101955761011b565b80633fc8cef3146101205780634d0ceecb1461013e5780634d787ea9146101535780635fe3b56714610168575b600080fd5b610128610234565b6040516101359190611173565b60405180910390f35b61014661024c565b60405161013591906111a1565b610166610161366004611143565b61030c565b005b61012861044d565b610128610465565b610180610489565b60405161013591906111ee565b6101286104c0565b6101466101a3366004611143565b6104e4565b610146610502565b6101666101be366004611143565b610564565b6101666101d136600461102f565b610757565b61014661087b565b6101286108db565b6101286101f4366004611143565b6108ff565b610201610929565b60405161013591906112af565b61016661021c366004611143565b61092f565b61012861022f366004611143565b610a57565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b60606102df733d5bc3c8d13dcb8bf317092d84783c2697ae92586001600160a01b031663b0772d0b6040518163ffffffff1660e01b815260040160006040518083038186803b15801561029e57600080fd5b505afa1580156102b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102da919081019061106e565b610a67565b805160025491925090808214156102f95760008352610307565b602081028301925080820383525b505090565b60006001828154811061031b57fe5b6000918252602090912001546001600160a01b0316905061033b81610a6a565b156103615760405162461bcd60e51b815260040161035890611241565b60405180910390fd5b61036c600183610c00565b600061037782610cdf565b6040517fff46d01b0000000000000000000000000000000000000000000000000000000081529091506001600160a01b037f0000000000000000000000005f2945604013ee9f80ae2eddb384462b681859c4169063ff46d01b906103df908490600401611173565b600060405180830381600087803b1580156103f957600080fd5b505af115801561040d573d6000803e3d6000fd5b505050507f9d70968988366484026d19fd2ed45ba53154e653af0d3b64a6e30fd1e59e9c02826040516104409190611173565b60405180910390a1505050565b733d5bc3c8d13dcb8bf317092d84783c2697ae925881565b7f0000000000000000000000005f2945604013ee9f80ae2eddb384462b681859c481565b60408051808201909152600581527f437265616d000000000000000000000000000000000000000000000000000000602082015290565b7f000000000000000000000000c9e8915d7295c0bcf3160d23610f85c0768e301d81565b60606104ee61024c565b905081815111156104fd578181525b919050565b6060600080548060200260200160405190810160405280929190818152602001828054801561055a57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161053c575b5050505050905090565b600061056f826104e4565b805190915060008167ffffffffffffffff8111801561058d57600080fd5b506040519080825280602002602001820160405280156105b7578160200160208202803683370190505b5090506000805b838110156106bd5760008582815181106105d457fe5b602002602001015190506105e781610a6a565b156106765760018054808201825560008290527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b0384161790556040519301927fb33cb2dd3d0d4f68fb707ddade8bd1e4c8ba3c3cf18274aff3968e86a0548da190610668908390611173565b60405180910390a1506106b5565b600061068182610cdf565b905080858585038151811061069257fe5b60200260200101906001600160a01b031690816001600160a01b03168152505050505b6001016105be565b50600280548401905580156106d25780830382525b604051633be4c7fd60e01b81526001600160a01b037f0000000000000000000000005f2945604013ee9f80ae2eddb384462b681859c41690633be4c7fd9061071e9085906004016111a1565b600060405180830381600087803b15801561073857600080fd5b505af115801561074c573d6000803e3d6000fd5b505050505050505050565b61076081610e80565b61077c5760405162461bcd60e51b815260040161035890611278565b600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630180546001600160a01b0319166001600160a01b038381169190911790915560405163053551dd60e51b81527f0000000000000000000000005f2945604013ee9f80ae2eddb384462b681859c49091169063a6aa3ba09061080f908490600401611173565b600060405180830381600087803b15801561082957600080fd5b505af115801561083d573d6000803e3d6000fd5b505050507fd40fc6dc0bc7f9e69f705b5e74dfd3623d55ea32890b826bd25584e5f0f03fcc816040516108709190611173565b60405180910390a150565b6060600180548060200260200160405190810160405280929190818152602001828054801561055a576020028201919060005260206000209081546001600160a01b0316815260019091019060200180831161053c575050505050905090565b7f0000000000000000000000000f629d8661074592720990b1295a8f288e1c1bd081565b6000818154811061090f57600080fd5b6000918252602090912001546001600160a01b0316905081565b60025481565b600080828154811061093d57fe5b6000918252602090912001546001600160a01b0316905061095d81610e80565b1561097a5760405162461bcd60e51b815260040161035890611241565b610985600083610c00565b6040517fff46d01b0000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000005f2945604013ee9f80ae2eddb384462b681859c4169063ff46d01b906109ea908490600401611173565b600060405180830381600087803b158015610a0457600080fd5b505af1158015610a18573d6000803e3d6000fd5b505050507f2dac01b475b5c97016d30db596f912172f79a142dd507389304167f50f0173fb81604051610a4b9190611173565b60405180910390a15050565b6001818154811061090f57600080fd5b90565b60405163731f0c2b60e01b81526000908190733d5bc3c8d13dcb8bf317092d84783c2697ae92589063731f0c2b90610aa6908690600401611173565b60206040518083038186803b158015610abe57600080fd5b505afa158015610ad2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af69190611123565b90508015610b085760019150506104fd565b826001600160a01b0316630a0879036161a86040518263ffffffff1660e01b815260040160206040518083038187803b158015610b4457600080fd5b5086fa93505050508015610b75575060408051601f3d908101601f19168201909252610b7291810190611052565b60015b610bf557826001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb257600080fd5b505afa158015610bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bea919061115b565b6000149150506104fd565b6001925050506104fd565b81546000198101821415610c405782805480610c1857fe5b600082815260209020810160001990810180546001600160a01b031916905501905550610cdb565b6000836001830381548110610c5157fe5b9060005260206000200160009054906101000a90046001600160a01b0316905080848481548110610c7e57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555083805480610cb657fe5b600082815260209020810160001990810180546001600160a01b031916905501905550505b5050565b600080826001600160a01b0316636f307dc36161a86040518263ffffffff1660e01b815260040160206040518083038187803b158015610d1e57600080fd5b5086fa93505050508015610d4f575060408051601f3d908101601f19168201909252610d4c91810190611052565b60015b610d6e575073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2610d99565b9050806001600160a01b038116610d975773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291505b505b6001600160a01b03811673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21415610dee57610de77f000000000000000000000000c9e8915d7295c0bcf3160d23610f85c0768e301d610f88565b9150610e1a565b610e177f0000000000000000000000000f629d8661074592720990b1295a8f288e1c1bd0610f88565b91505b60405163485cc95560e01b81526001600160a01b0383169063485cc95590610e489084908790600401611187565b600060405180830381600087803b158015610e6257600080fd5b505af1158015610e76573d6000803e3d6000fd5b5050505050919050565b6000733d5bc3c8d13dcb8bf317092d84783c2697ae92586001600160a01b031663731f0c2b836001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ede57600080fd5b505afa158015610ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f169190611052565b6040518263ffffffff1660e01b8152600401610f329190611173565b60206040518083038186803b158015610f4a57600080fd5b505afa158015610f5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f829190611123565b92915050565b600080610f9483610fa6565b90506037602082016000f09392505050565b6040805160488082526080820190925260609160208201818036833750507f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000060208301525060609290921b6034830152507f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060488201526037815290565b80516104fd816112b8565b600060208284031215611040578081fd5b813561104b816112b8565b9392505050565b600060208284031215611063578081fd5b815161104b816112b8565b60006020808385031215611080578182fd5b825167ffffffffffffffff80821115611097578384fd5b818501915085601f8301126110aa578384fd5b8151818111156110b657fe5b838102604051858282010181811085821117156110cf57fe5b604052828152858101935084860182860187018a10156110ed578788fd5b8795505b838610156111165761110281611024565b8552600195909501949386019386016110f1565b5098975050505050505050565b600060208284031215611134578081fd5b8151801515811461104b578182fd5b600060208284031215611154578081fd5b5035919050565b60006020828403121561116c578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156111e25783516001600160a01b0316835292840192918401916001016111bd565b50909695505050505050565b6000602080835283518082850152825b8181101561121a578581018301518582016040015282016111fe565b8181111561122b5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526013908201527f4d61726b6574207374696c6c2066726f7a656e00000000000000000000000000604082015260600190565b60208082526011908201527f4d61726b6574206e6f742066726f7a656e000000000000000000000000000000604082015260600190565b90815260200190565b6001600160a01b03811681146112cd57600080fd5b5056fea164736f6c6343000706000a

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

0000000000000000000000005f2945604013ee9f80ae2eddb384462b681859c4

-----Decoded View---------------
Arg [0] : _registry (address): 0x5F2945604013Ee9f80aE2eDDb384462B681859C4

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000005f2945604013ee9f80ae2eddb384462b681859c4


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

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

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