ETH Price: $2,417.89 (+2.01%)

Contract

0xD49Da05aef8077CC6824e3B84493D6491f452B0A
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Execute Meta Tx106307332020-08-10 7:06:501516 days ago1597043210IN
0xD49Da05a...91f452B0A
0 ETH0.079509381.52
Execute Meta Tx105971942020-08-05 3:01:001521 days ago1596596460IN
0xD49Da05a...91f452B0A
0 ETH0.0349138435.8
Execute Meta Tx105163122020-07-23 14:44:271534 days ago1595515467IN
0xD49Da05a...91f452B0A
0 ETH0.0766544178.6
Execute Meta Tx105110942020-07-22 19:29:381535 days ago1595446178IN
0xD49Da05a...91f452B0A
0 ETH0.0373136738.26
Execute Meta Tx104974832020-07-20 16:41:591537 days ago1595263319IN
0xD49Da05a...91f452B0A
0 ETH0.0705793472.372
Execute Meta Tx104971822020-07-20 15:35:031537 days ago1595259303IN
0xD49Da05a...91f452B0A
0 ETH0.0715857773.40000056
Execute Meta Tx104448262020-07-12 12:46:431545 days ago1594558003IN
0xD49Da05a...91f452B0A
0 ETH0.0219879122.54600022
Execute Meta Tx104365952020-07-11 6:28:541546 days ago1594448934IN
0xD49Da05a...91f452B0A
0 ETH0.0222815522.84708571
Execute Meta Tx104262212020-07-09 15:58:441548 days ago1594310324IN
0xD49Da05a...91f452B0A
0 ETH0.0511997152.49599999
Execute Meta Tx104219302020-07-08 23:48:311549 days ago1594252111IN
0xD49Da05a...91f452B0A
0 ETH0.0247126325.34000026
Execute Meta Tx104197542020-07-08 15:47:381549 days ago1594223258IN
0xD49Da05a...91f452B0A
0 ETH0.0579286659.4
Execute Meta Tx104194352020-07-08 14:34:411549 days ago1594218881IN
0xD49Da05a...91f452B0A
0 ETH0.0755693377.47800064
Execute Meta Tx104190962020-07-08 13:17:371549 days ago1594214257IN
0xD49Da05a...91f452B0A
0 ETH0.0497367351.00000053
Execute Meta Tx104190952020-07-08 13:17:341549 days ago1594214254IN
0xD49Da05a...91f452B0A
0 ETH0.0544201255.8
Execute Meta Tx104190582020-07-08 13:10:171549 days ago1594213817IN
0xD49Da05a...91f452B0A
0 ETH0.0464209447.6
Execute Meta Tx104190572020-07-08 13:10:121549 days ago1594213812IN
0xD49Da05a...91f452B0A
0 ETH0.0652349666.89304
Execute Meta Tx104190312020-07-08 13:06:021549 days ago1594213562IN
0xD49Da05a...91f452B0A
0 ETH0.0463251347.50000005
Execute Meta Tx104190312020-07-08 13:06:021549 days ago1594213562IN
0xD49Da05a...91f452B0A
0 ETH0.0463264647.50000005
Execute Meta Tx104190312020-07-08 13:06:021549 days ago1594213562IN
0xD49Da05a...91f452B0A
0 ETH0.0470143648.2073
Execute Meta Tx104190312020-07-08 13:06:021549 days ago1594213562IN
0xD49Da05a...91f452B0A
0 ETH0.0463234247.50000005
Execute Meta Tx104187662020-07-08 12:07:201549 days ago1594210040IN
0xD49Da05a...91f452B0A
0 ETH0.0665103468.20000058
Execute Meta Tx104132242020-07-07 15:48:181550 days ago1594136898IN
0xD49Da05a...91f452B0A
0 ETH0.038035139
Execute Meta Tx103675202020-06-30 14:01:191557 days ago1593525679IN
0xD49Da05a...91f452B0A
0 ETH0.056572158.01
Execute Meta Tx103666102020-06-30 10:39:481557 days ago1593513588IN
0xD49Da05a...91f452B0A
0 ETH0.0597803161.30126305
Execute Meta Tx103652062020-06-30 5:16:111557 days ago1593494171IN
0xD49Da05a...91f452B0A
0 ETH0.0457385246.9
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
106307332020-08-10 7:06:501516 days ago1597043210
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
105971942020-08-05 3:01:001521 days ago1596596460
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
105163122020-07-23 14:44:271534 days ago1595515467
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
105110942020-07-22 19:29:381535 days ago1595446178
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104974832020-07-20 16:41:591537 days ago1595263319
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104971822020-07-20 15:35:031537 days ago1595259303
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104448262020-07-12 12:46:431545 days ago1594558003
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104365952020-07-11 6:28:541546 days ago1594448934
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104262212020-07-09 15:58:441548 days ago1594310324
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104219302020-07-08 23:48:311549 days ago1594252111
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104197542020-07-08 15:47:381549 days ago1594223258
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104194352020-07-08 14:34:411549 days ago1594218881
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104190962020-07-08 13:17:371549 days ago1594214257
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104190952020-07-08 13:17:341549 days ago1594214254
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104190582020-07-08 13:10:171549 days ago1594213817
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104190572020-07-08 13:10:121549 days ago1594213812
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104190312020-07-08 13:06:021549 days ago1594213562
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104190312020-07-08 13:06:021549 days ago1594213562
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104190312020-07-08 13:06:021549 days ago1594213562
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104190312020-07-08 13:06:021549 days ago1594213562
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104187662020-07-08 12:07:201549 days ago1594210040
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
104132242020-07-07 15:48:181550 days ago1594136898
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
103675202020-06-30 14:01:191557 days ago1593525679
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
103666102020-06-30 10:39:481557 days ago1593513588
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
103652062020-06-30 5:16:111557 days ago1593494171
0xD49Da05a...91f452B0A
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WalletFactoryModule

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

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

/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;

/**
 * ENS Registry interface.
 */
interface ENSRegistry {
    // Logged when the owner of a node assigns a new owner to a subnode.
    event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);

    // Logged when the owner of a node transfers ownership to a new account.
    event Transfer(bytes32 indexed node, address owner);

    // Logged when the resolver for a node changes.
    event NewResolver(bytes32 indexed node, address resolver);

    // Logged when the TTL of a node changes
    event NewTTL(bytes32 indexed node, uint64 ttl);

    function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external;
    function setResolver(bytes32 node, address resolver) external;
    function setOwner(bytes32 node, address owner) external;
    function setTTL(bytes32 node, uint64 ttl) external;
    function owner(bytes32 node) external view returns (address);
    function resolver(bytes32 node) external view returns (address);
    function ttl(bytes32 node) external view returns (uint64);
}


/**
 * ENS Resolver interface.
 */
abstract contract ENSResolver {
    function addr(bytes32 _node) public view virtual returns (address);
    function setAddr(bytes32 _node, address _addr) public virtual;
    function name(bytes32 _node) public view virtual returns (string memory);
    function setName(bytes32 _node, string memory _name) public virtual;
}

/**
 * ENS Reverse Registrar interface.
 */
abstract contract ENSReverseRegistrar {
    function claim(address _owner) public virtual returns (bytes32 _node);
    function claimWithResolver(address _owner, address _resolver) public virtual returns (bytes32);
    function setName(string memory _name) public virtual returns (bytes32);
    function node(address _addr) public view virtual returns (bytes32);
}
/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title Wallet
/// @dev Base contract for smart wallets.
///      Sub-contracts must NOT use non-default constructor to initialize
///      wallet states, instead, `init` shall be used. This is to enable
///      proxies to be deployed in front of the real wallet contract for
///      saving gas.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
interface Wallet
{
    function owner() external view returns (address);

    /// @dev Set a new owner.
    function setOwner(address newOwner) external;

    /// @dev Set up this wallet by assigning an original owner and a
    ///      list of initial modules. For each module, its `init` method
    ///      will be called with `address(this)` as the parameter.
    ///
    ///      Note that calling this method more than once will throw.
    ///
    /// @param _controller The Controller instance.
    /// @param _owner The owner of this wallet, must not be address(0).
    /// @param _boostrapModule The bootstrap module.
    function setup(address _controller, address _owner, address _boostrapModule) external;

    /// @dev Adds a new module. The `init` method of the module
    ///      will be called with `address(this)` as the parameter.
    ///      This method must throw if the module has already been added.
    /// @param _module The module's address.
    function addModule(address _module) external;

    /// @dev Removes an existing module. This method must throw if the module
    ///      has NOT been added or the module is the wallet's only module.
    /// @param _module The module's address.
    function removeModule(address _module) external;

    /// @dev Checks if a module has been added to this wallet.
    /// @param _module The module to check.
    /// @return True if the module exists; False otherwise.
    function hasModule(address _module) external view returns (bool);

    /// @dev Binds a method from the given module to this
    ///      wallet so the method can be invoked using this wallet's default
    ///      function.
    ///      Note that this method must throw when the given module has
    ///      not been added to this wallet.
    /// @param _method The method's 4-byte selector.
    /// @param _module The module's address. Use address(0) to unbind the method.
    function bindMethod(bytes4 _method, address _module) external;

    /// @dev Returns the module the given method has been bound to.
    /// @param _method The method's 4-byte selector.
    /// @return _module The address of the bound module. If no binding exists,
    ///                 returns address(0) instead.
    function boundMethodModule(bytes4 _method) external view returns (address _module);

    /// @dev Performs generic transactions. Any module that has been added to this
    ///      wallet can use this method to transact on any third-party contract with
    ///      msg.sender as this wallet itself.
    ///
    ///      This method will emit `Transacted` event if it doesn't throw.
    ///
    ///      Note: this method must ONLY allow invocations from a module that has
    ///      been added to this wallet. The wallet owner shall NOT be permitted
    ///      to call this method directly.
    ///
    /// @param mode The transaction mode, 1 for CALL, 2 for DELEGATECALL.
    /// @param to The desitination address.
    /// @param value The amount of Ether to transfer.
    /// @param data The data to send over using `to.call{value: value}(data)`
    /// @return returnData The transaction's return value.
    function transact(
        uint8    mode,
        address  to,
        uint     value,
        bytes    calldata data
        )
        external
        returns (bytes memory returnData);
}

// Taken from Argent's code base - https://github.com/argentlabs/argent-contracts/blob/develop/contracts/ens/ENSConsumer.sol
// with few modifications.





/**
 * @title ENSConsumer
 * @dev Helper contract to resolve ENS names.
 * @author Julien Niset - <[email protected]>
 */
contract ENSConsumer {

    using strings for *;

    // namehash('addr.reverse')
    bytes32 constant public ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;

    // the address of the ENS registry
    address ensRegistry;

    /**
    * @dev No address should be provided when deploying on Mainnet to avoid storage cost. The
    * contract will use the hardcoded value.
    */
    constructor(address _ensRegistry) public {
        ensRegistry = _ensRegistry;
    }

    /**
    * @dev Resolves an ENS name to an address.
    * @param _node The namehash of the ENS name.
    */
    function resolveEns(bytes32 _node) public view returns (address) {
        address resolver = getENSRegistry().resolver(_node);
        return ENSResolver(resolver).addr(_node);
    }

    /**
    * @dev Gets the official ENS registry.
    */
    function getENSRegistry() public view returns (ENSRegistry) {
        return ENSRegistry(ensRegistry);
    }

    /**
    * @dev Gets the official ENS reverse registrar.
    */
    function getENSReverseRegistrar() public view returns (ENSReverseRegistrar) {
        return ENSReverseRegistrar(getENSRegistry().owner(ADDR_REVERSE_NODE));
    }
}
/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title Ownable
/// @author Brecht Devos - <[email protected]>
/// @dev The Ownable contract has an owner address, and provides basic
///      authorization control functions, this simplifies the implementation of
///      "user permissions".
contract Ownable
{
    address public owner;

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

    /// @dev The Ownable constructor sets the original `owner` of the contract
    ///      to the sender.
    constructor()
        public
    {
        owner = msg.sender;
    }

    /// @dev Throws if called by any account other than the owner.
    modifier onlyOwner()
    {
        require(msg.sender == owner, "UNAUTHORIZED");
        _;
    }

    /// @dev Allows the current owner to transfer control of the contract to a
    ///      new owner.
    /// @param newOwner The address to transfer ownership to.
    function transferOwnership(
        address newOwner
        )
        public
        virtual
        onlyOwner
    {
        require(newOwner != address(0), "ZERO_ADDRESS");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

    function renounceOwnership()
        public
        onlyOwner
    {
        emit OwnershipTransferred(owner, address(0));
        owner = address(0);
    }
}
/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title ReentrancyGuard
/// @author Brecht Devos - <[email protected]>
/// @dev Exposes a modifier that guards a function against reentrancy
///      Changing the value of the same storage value multiple times in a transaction
///      is cheap (starting from Istanbul) so there is no need to minimize
///      the number of times the value is changed
contract ReentrancyGuard
{
    //The default value must be 0 in order to work behind a proxy.
    uint private _guardValue;

    modifier nonReentrant()
    {
        require(_guardValue == 0, "REENTRANCY");
        _guardValue = 1;
        _;
        _guardValue = 0;
    }
}
/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title AddressSet
/// @author Daniel Wang - <[email protected]>
contract AddressSet
{
    struct Set
    {
        address[] addresses;
        mapping (address => uint) positions;
        uint count;
    }
    mapping (bytes32 => Set) private sets;

    function addAddressToSet(
        bytes32 key,
        address addr,
        bool maintainList
        ) internal
    {
        Set storage set = sets[key];
        require(set.positions[addr] == 0, "ALREADY_IN_SET");

        if (maintainList) {
            require(set.addresses.length == set.count, "PREVIOUSLY_NOT_MAINTAILED");
            set.addresses.push(addr);
        } else {
            require(set.addresses.length == 0, "MUST_MAINTAIN");
        }

        set.count += 1;
        set.positions[addr] = set.count;
    }

    function removeAddressFromSet(
        bytes32 key,
        address addr
        )
        internal
    {
        Set storage set = sets[key];
        uint pos = set.positions[addr];
        require(pos != 0, "NOT_IN_SET");

        delete set.positions[addr];
        set.count -= 1;

        if (set.addresses.length > 0) {
            address lastAddr = set.addresses[set.count];
            if (lastAddr != addr) {
                set.addresses[pos - 1] = lastAddr;
                set.positions[lastAddr] = pos;
            }
            set.addresses.pop();
        }
    }

    function removeSet(bytes32 key)
        internal
    {
        delete sets[key];
    }

    function isAddressInSet(
        bytes32 key,
        address addr
        )
        internal
        view
        returns (bool)
    {
        return sets[key].positions[addr] != 0;
    }

    function numAddressesInSet(bytes32 key)
        internal
        view
        returns (uint)
    {
        Set storage set = sets[key];
        return set.count;
    }

    function addressesInSet(bytes32 key)
        internal
        view
        returns (address[] memory)
    {
        Set storage set = sets[key];
        require(set.count == set.addresses.length, "NOT_MAINTAINED");
        return sets[key].addresses;
    }
}/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title ERC20 Token Interface
/// @dev see https://github.com/ethereum/EIPs/issues/20
/// @author Daniel Wang - <[email protected]>
abstract contract ERC20
{
    function totalSupply()
        public
        view
        virtual
        returns (uint);

    function balanceOf(
        address who
        )
        public
        view
        virtual
        returns (uint);

    function allowance(
        address owner,
        address spender
        )
        public
        view
        virtual
        returns (uint);

    function transfer(
        address to,
        uint value
        )
        public
        virtual
        returns (bool);

    function transferFrom(
        address from,
        address to,
        uint    value
        )
        public
        virtual
        returns (bool);

    function approve(
        address spender,
        uint    value
        )
        public
        virtual
        returns (bool);
}
// Copied from https://eips.ethereum.org/EIPS/eip-1271.



abstract contract ERC1271 {

    // bytes4(keccak256("isValidSignature(bytes,bytes)")
    bytes4 constant internal MAGICVALUE = 0x20c13b0b;

    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param _data Arbitrary length data signed on the behalf of address(this)
     * @param _signature Signature byte array associated with _data
     *
     * MUST return the bytes4 magic value 0x20c13b0b when function passes.
     * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)
     * MUST allow external calls
     */
    function isValidSignature(
        bytes memory _data,
        bytes memory _signature)
        public
        view
        virtual
        returns (bytes4 magicValue);
}//Mainly taken from https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol


library BytesUtil {
    function concat(
        bytes memory _preBytes,
        bytes memory _postBytes
    )
        internal
        pure
        returns (bytes memory)
    {
        bytes memory tempBytes;

        assembly {
            // Get a location of some free memory and store it in tempBytes as
            // Solidity does for memory variables.
            tempBytes := mload(0x40)

            // Store the length of the first bytes array at the beginning of
            // the memory for tempBytes.
            let length := mload(_preBytes)
            mstore(tempBytes, length)

            // Maintain a memory counter for the current write location in the
            // temp bytes array by adding the 32 bytes for the array length to
            // the starting location.
            let mc := add(tempBytes, 0x20)
            // Stop copying when the memory counter reaches the length of the
            // first bytes array.
            let end := add(mc, length)

            for {
                // Initialize a copy counter to the start of the _preBytes data,
                // 32 bytes into its memory.
                let cc := add(_preBytes, 0x20)
            } lt(mc, end) {
                // Increase both counters by 32 bytes each iteration.
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                // Write the _preBytes data into the tempBytes memory 32 bytes
                // at a time.
                mstore(mc, mload(cc))
            }

            // Add the length of _postBytes to the current length of tempBytes
            // and store it as the new length in the first 32 bytes of the
            // tempBytes memory.
            length := mload(_postBytes)
            mstore(tempBytes, add(length, mload(tempBytes)))

            // Move the memory counter back from a multiple of 0x20 to the
            // actual end of the _preBytes data.
            mc := end
            // Stop copying when the memory counter reaches the new combined
            // length of the arrays.
            end := add(mc, length)

            for {
                let cc := add(_postBytes, 0x20)
            } lt(mc, end) {
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                mstore(mc, mload(cc))
            }

            // Update the free-memory pointer by padding our last write location
            // to 32 bytes: add 31 bytes to the end of tempBytes to move to the
            // next 32 byte block, then round down to the nearest multiple of
            // 32. If the sum of the length of the two arrays is zero then add
            // one before rounding down to leave a blank 32 bytes (the length block with 0).
            mstore(0x40, and(
              add(add(end, iszero(add(length, mload(_preBytes)))), 31),
              not(31) // Round down to the nearest 32 bytes.
            ))
        }

        return tempBytes;
    }

    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
        assembly {
            // Read the first 32 bytes of _preBytes storage, which is the length
            // of the array. (We don't need to use the offset into the slot
            // because arrays use the entire slot.)
            let fslot := sload(_preBytes_slot)
            // Arrays of 31 bytes or less have an even value in their slot,
            // while longer arrays have an odd value. The actual length is
            // the slot divided by two for odd values, and the lowest order
            // byte divided by two for even values.
            // If the slot is even, bitwise and the slot with 255 and divide by
            // two to get the length. If the slot is odd, bitwise and the slot
            // with -1 and divide by two.
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)
            let newlength := add(slength, mlength)
            // slength can contain both the length and contents of the array
            // if length < 32 bytes so let's prepare for that
            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
            switch add(lt(slength, 32), lt(newlength, 32))
            case 2 {
                // Since the new array still fits in the slot, we just need to
                // update the contents of the slot.
                // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
                sstore(
                    _preBytes_slot,
                    // all the modifications to the slot are inside this
                    // next block
                    add(
                        // we can just add to the slot contents because the
                        // bytes we want to change are the LSBs
                        fslot,
                        add(
                            mul(
                                div(
                                    // load the bytes from memory
                                    mload(add(_postBytes, 0x20)),
                                    // zero all bytes to the right
                                    exp(0x100, sub(32, mlength))
                                ),
                                // and now shift left the number of bytes to
                                // leave space for the length in the slot
                                exp(0x100, sub(32, newlength))
                            ),
                            // increase length by the double of the memory
                            // bytes length
                            mul(mlength, 2)
                        )
                    )
                )
            }
            case 1 {
                // The stored value fits in the slot, but the combined value
                // will exceed it.
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes_slot)
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes_slot, add(mul(newlength, 2), 1))

                // The contents of the _postBytes array start 32 bytes into
                // the structure. Our first read should obtain the `submod`
                // bytes that can fit into the unused space in the last word
                // of the stored array. To get this, we read 32 bytes starting
                // from `submod`, so the data we read overlaps with the array
                // contents by `submod` bytes. Masking the lowest-order
                // `submod` bytes allows us to add that value directly to the
                // stored value.

                let submod := sub(32, slength)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(
                    sc,
                    add(
                        and(
                            fslot,
                            0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
                        ),
                        and(mload(mc), mask)
                    )
                )

                for {
                    mc := add(mc, 0x20)
                    sc := add(sc, 1)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
            default {
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes_slot)
                // Start copying to the last used word of the stored array.
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes_slot, add(mul(newlength, 2), 1))

                // Copy over the first `submod` bytes of the new data as in
                // case 1 above.
                let slengthmod := mod(slength, 32)
                let mlengthmod := mod(mlength, 32)
                let submod := sub(32, slengthmod)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(sc, add(sload(sc), and(mload(mc), mask)))

                for {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
        }
    }

    function slice(
        bytes memory _bytes,
        uint _start,
        uint _length
    )
        internal
        pure
        returns (bytes memory)
    {
        require(_bytes.length >= (_start + _length));

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
                // Get a location of some free memory and store it in tempBytes as
                // Solidity does for memory variables.
                tempBytes := mload(0x40)

                // The first word of the slice result is potentially a partial
                // word read from the original array. To read it, we calculate
                // the length of that partial word and start copying that many
                // bytes into the array. The first word we copy will start with
                // data we don't care about, but the last `lengthmod` bytes will
                // land at the beginning of the contents of the new array. When
                // we're done copying, we overwrite the full first word with
                // the actual length of the slice.
                let lengthmod := and(_length, 31)

                // The multiplication in the next line is necessary
                // because when slicing multiples of 32 bytes (lengthmod == 0)
                // the following copy loop was copying the origin's length
                // and then ending prematurely not copying everything it should.
                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                let end := add(mc, _length)

                for {
                    // The multiplication in the next line has the same exact purpose
                    // as the one above.
                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

                //update free-memory pointer
                //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function toAddress(bytes memory _bytes, uint _start) internal  pure returns (address) {
        require(_bytes.length >= (_start + 20));
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }

    function toUint8(bytes memory _bytes, uint _start) internal  pure returns (uint8) {
        require(_bytes.length >= (_start + 1));
        uint8 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x1), _start))
        }

        return tempUint;
    }

    function toUint16(bytes memory _bytes, uint _start) internal  pure returns (uint16) {
        require(_bytes.length >= (_start + 2));
        uint16 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x2), _start))
        }

        return tempUint;
    }

    function toUint32(bytes memory _bytes, uint _start) internal  pure returns (uint32) {
        require(_bytes.length >= (_start + 4));
        uint32 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x4), _start))
        }

        return tempUint;
    }

    function toUint64(bytes memory _bytes, uint _start) internal  pure returns (uint64) {
        require(_bytes.length >= (_start + 8));
        uint64 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x8), _start))
        }

        return tempUint;
    }

    function toUint96(bytes memory _bytes, uint _start) internal  pure returns (uint96) {
        require(_bytes.length >= (_start + 12));
        uint96 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0xc), _start))
        }

        return tempUint;
    }

    function toUint128(bytes memory _bytes, uint _start) internal  pure returns (uint128) {
        require(_bytes.length >= (_start + 16));
        uint128 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x10), _start))
        }

        return tempUint;
    }

    function toUint(bytes memory _bytes, uint _start) internal  pure returns (uint256) {
        require(_bytes.length >= (_start + 32));
        uint256 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
        }

        return tempUint;
    }

    function toBytes4(bytes memory _bytes, uint _start) internal  pure returns (bytes4) {
        require(_bytes.length >= (_start + 4));
        bytes4 tempBytes4;

        assembly {
            tempBytes4 := mload(add(add(_bytes, 0x20), _start))
        }

        return tempBytes4;
    }

    function toBytes32(bytes memory _bytes, uint _start) internal  pure returns (bytes32) {
        require(_bytes.length >= (_start + 32));
        bytes32 tempBytes32;

        assembly {
            tempBytes32 := mload(add(add(_bytes, 0x20), _start))
        }

        return tempBytes32;
    }

    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

            // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
                // cb is a circuit breaker in the for loop since there's
                //  no said feature for inline assembly loops
                // cb = 1 - don't breaker
                // cb = 0 - break
                let cb := 1

                let mc := add(_preBytes, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(_postBytes, 0x20)
                // the next line is the loop condition:
                // while(uint(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                        // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equalStorage(
        bytes storage _preBytes,
        bytes memory _postBytes
    )
        internal
        view
        returns (bool)
    {
        bool success = true;

        assembly {
            // we know _preBytes_offset is 0
            let fslot := sload(_preBytes_slot)
            // Decode the length of the stored array like in concatStorage().
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)

            // if lengths don't match the arrays are not equal
            switch eq(slength, mlength)
            case 1 {
                // slength can contain both the length and contents of the array
                // if length < 32 bytes so let's prepare for that
                // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
                if iszero(iszero(slength)) {
                    switch lt(slength, 32)
                    case 1 {
                        // blank the last byte which is the length
                        fslot := mul(div(fslot, 0x100), 0x100)

                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
                            // unsuccess:
                            success := 0
                        }
                    }
                    default {
                        // cb is a circuit breaker in the for loop since there's
                        //  no said feature for inline assembly loops
                        // cb = 1 - don't breaker
                        // cb = 0 - break
                        let cb := 1

                        // get the keccak hash to get the contents of the array
                        mstore(0x0, _preBytes_slot)
                        let sc := keccak256(0x0, 0x20)

                        let mc := add(_postBytes, 0x20)
                        let end := add(mc, mlength)

                        // the next line is the loop condition:
                        // while(uint(mc < end) + cb == 2)
                        for {} eq(add(lt(mc, end), cb), 2) {
                            sc := add(sc, 1)
                            mc := add(mc, 0x20)
                        } {
                            if iszero(eq(sload(sc), mload(mc))) {
                                // unsuccess:
                                success := 0
                                cb := 0
                            }
                        }
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }
}
/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title Utility Functions for uint
/// @author Daniel Wang - <[email protected]>
library MathUint
{
    function mul(
        uint a,
        uint b
        )
        internal
        pure
        returns (uint c)
    {
        c = a * b;
        require(a == 0 || c / a == b, "MUL_OVERFLOW");
    }

    function sub(
        uint a,
        uint b
        )
        internal
        pure
        returns (uint)
    {
        require(b <= a, "SUB_UNDERFLOW");
        return a - b;
    }

    function add(
        uint a,
        uint b
        )
        internal
        pure
        returns (uint c)
    {
        c = a + b;
        require(c >= a, "ADD_OVERFLOW");
    }
}
/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title Utility Functions for addresses
/// @author Daniel Wang - <[email protected]>
/// @author Brecht Devos - <[email protected]>
library AddressUtil
{
    using AddressUtil for *;

    function isContract(
        address addr
        )
        internal
        view
        returns (bool)
    {
        uint32 size;
        assembly { size := extcodesize(addr) }
        return (size > 0);
    }

    function toPayable(
        address addr
        )
        internal
        pure
        returns (address payable)
    {
        return address(uint160(addr));
    }

    // Works like address.send but with a customizable gas limit
    // Make sure your code is safe for reentrancy when using this function!
    function sendETH(
        address to,
        uint    amount,
        uint    gasLimit
        )
        internal
        returns (bool success)
    {
        if (amount == 0) {
            return true;
        }
        address payable recipient = to.toPayable();
        /* solium-disable-next-line */
        (success, ) = recipient.call{value: amount, gas: gasLimit}("");
    }

    // Works like address.transfer but with a customizable gas limit
    // Make sure your code is safe for reentrancy when using this function!
    function sendETHAndVerify(
        address to,
        uint    amount,
        uint    gasLimit
        )
        internal
        returns (bool success)
    {
        success = to.sendETH(amount, gasLimit);
        require(success, "TRANSFER_FAILURE");
    }
}
/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/





/// @title DataStore
/// @dev Modules share states by accessing the same storage instance.
///      Using ModuleStorage will achieve better module decoupling.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
contract DataStore
{
  modifier onlyWalletModule(address wallet)
    {
        require(Wallet(wallet).hasModule(msg.sender), "UNAUTHORIZED");
        _;
    }
}/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/


/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/





/// @title Claimable
/// @author Brecht Devos - <[email protected]>
/// @dev Extension for the Ownable contract, where the ownership needs
///      to be claimed. This allows the new owner to accept the transfer.
contract Claimable is Ownable
{
    address public pendingOwner;

    /// @dev Modifier throws if called by any account other than the pendingOwner.
    modifier onlyPendingOwner() {
        require(msg.sender == pendingOwner, "UNAUTHORIZED");
        _;
    }

    /// @dev Allows the current owner to set the pendingOwner address.
    /// @param newOwner The address to transfer ownership to.
    function transferOwnership(
        address newOwner
        )
        public
        override
        onlyOwner
    {
        require(newOwner != address(0) && newOwner != owner, "INVALID_ADDRESS");
        pendingOwner = newOwner;
    }

    /// @dev Allows the pendingOwner address to finalize the transfer.
    function claimOwnership()
        public
        onlyPendingOwner
    {
        emit OwnershipTransferred(owner, pendingOwner);
        owner = pendingOwner;
        pendingOwner = address(0);
    }
}




contract OwnerManagable is Claimable, AddressSet
{
    bytes32 internal constant MANAGER = keccak256("__MANAGED__");

    event ManagerAdded  (address indexed manager);
    event ManagerRemoved(address indexed manager);

    modifier onlyManager
    {
        require(isManager(msg.sender), "NOT_MANAGER");
        _;
    }

    modifier onlyOwnerOrManager
    {
        require(msg.sender == owner || isManager(msg.sender), "NOT_OWNER_OR_MANAGER");
        _;
    }

    constructor() public Claimable() {}

    /// @dev Gets the managers.
    /// @return The list of managers.
    function managers()
        public
        view
        returns (address[] memory)
    {
        return addressesInSet(MANAGER);
    }

    /// @dev Gets the number of managers.
    /// @return The numer of managers.
    function numManagers()
        public
        view
        returns (uint)
    {
        return numAddressesInSet(MANAGER);
    }

    /// @dev Checks if an address is a manger.
    /// @param addr The address to check.
    /// @return True if the address is a manager, False otherwise.
    function isManager(address addr)
        public
        view
        returns (bool)
    {
        return isAddressInSet(MANAGER, addr);
    }

    /// @dev Adds a new manager.
    /// @param manager The new address to add.
    function addManager(address manager)
        public
        onlyOwner
    {
        addManagerInternal(manager);
    }

    /// @dev Removes a manager.
    /// @param manager The manager to remove.
    function removeManager(address manager)
        public
        onlyOwner
    {
        removeAddressFromSet(MANAGER, manager);
        emit ManagerRemoved(manager);
    }

    function addManagerInternal(address manager)
        internal
    {
        addAddressToSet(MANAGER, manager, true);
        emit ManagerAdded(manager);
    }
}/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/


/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title ModuleRegistry
/// @dev A registry for modules.
///
/// @author Daniel Wang - <[email protected]>
interface ModuleRegistry
{
    function registerModule(address module) external;
    function deregisterModule(address module) external;
    function isModuleRegistered(address module) external view returns (bool);
    function modules() external view returns (address[] memory _modules);
    function numOfModules() external view returns (uint);
}

/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title WalletRegistry
/// @dev A registry for wallets.
/// @author Daniel Wang - <[email protected]>
interface WalletRegistry
{
    function registerWallet(address wallet) external;
    function isWalletRegistered(address addr) external view returns (bool);
    function numOfWallets() external view returns (uint);
}


/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/







/// @title QuotaStore
/// @dev This store maintains daily spending quota for each wallet.
///      A rolling daily limit is used.
contract QuotaStore is DataStore
{
    using MathUint for uint;

    uint public defaultQuota;

    struct Quota
    {
        uint    currentQuota; // 0 indicates default
        uint    pendingQuota;
        uint64  pendingUntil;
        uint64  spentTimestamp;
        uint    spentAmount;
    }

    mapping (address => Quota) public quotas;

    event QuotaScheduled(
        address indexed wallet,
        uint            pendingQuota,
        uint64          pendingUntil
    );

    constructor(uint _defaultQuota)
        public
        DataStore()
    {
        defaultQuota = _defaultQuota;
    }

    function changeQuota(
        address wallet,
        uint    newQuota,
        uint    effectiveTime
        )
        public
        onlyWalletModule(wallet)
    {
        quotas[wallet].currentQuota = currentQuota(wallet);
        quotas[wallet].pendingQuota = newQuota;
        quotas[wallet].pendingUntil = uint64(effectiveTime);

        emit QuotaScheduled(
            wallet,
            newQuota,
            quotas[wallet].pendingUntil
        );
    }

    function checkAndAddToSpent(
        address wallet,
        uint    amount
        )
        public
        onlyWalletModule(wallet)
    {
        require(hasEnoughQuota(wallet, amount), "QUOTA_EXCEEDED");
        addToSpent(wallet, amount);
    }

    function addToSpent(
        address wallet,
        uint    amount
        )
        public
        onlyWalletModule(wallet)
    {
        Quota storage q = quotas[wallet];
        q.spentAmount = spentQuota(wallet).add(amount);
        q.spentTimestamp = uint64(now);
    }

    function currentQuota(address wallet)
        public
        view
        returns (uint)
    {
        Quota storage q = quotas[wallet];
        uint value = q.pendingUntil <= now ?
            q.pendingQuota : q.currentQuota;

        return value == 0 ? defaultQuota : value;
    }

    function pendingQuota(address wallet)
        public
        view
        returns (
            uint _pendingQuota,
            uint _pendingUntil
        )
    {
        Quota storage q = quotas[wallet];
        if (q.pendingUntil > 0 && q.pendingUntil > now) {
            _pendingQuota = q.pendingQuota > 0 ? q.pendingQuota : defaultQuota;
            _pendingUntil = q.pendingUntil;
        }
    }

    function spentQuota(address wallet)
        public
        view
        returns (uint)
    {
        Quota storage q = quotas[wallet];
        uint timeSinceLastSpent = now.sub(q.spentTimestamp);
        if (timeSinceLastSpent < 1 days) {
            return q.spentAmount.sub(q.spentAmount.mul(timeSinceLastSpent) / 1 days);
        } else {
            return 0;
        }
    }

    function availableQuota(address wallet)
        public
        view
        returns (uint)
    {
        uint quota = currentQuota(wallet);
        uint spent = spentQuota(wallet);
        return quota > spent ? quota - spent : 0;
    }

    function hasEnoughQuota(
        address wallet,
        uint    requiredAmount
        )
        public
        view
        returns (bool)
    {
        return availableQuota(wallet) >= requiredAmount;
    }
}

/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/




/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



library Data
{
    struct Guardian
    {
        address  addr;
        uint     group;
        uint     validSince;
        uint     validUntil;
    }
}



/// @title SecurityStore
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
contract SecurityStore is DataStore
{
    struct Wallet
    {
        address    inheritor;
        uint128    lastActive; // the latest timestamp the owner is considered to be active
        uint128    lock;
        address    lockedBy;   // the module that locked the wallet.

        Data.Guardian[]            guardians;
        mapping (address => uint)  guardianIdx;
    }

    mapping (address => Wallet) public wallets;

    constructor() public DataStore() {}

    function isGuardian(
        address wallet,
        address addr
        )
        public
        view
        returns (bool)
    {
        Data.Guardian memory guardian = getGuardian(wallet, addr);
        return guardian.addr != address(0) && isGuardianActive(guardian);
    }

    function isGuardianOrPendingAddition(
        address wallet,
        address addr
        )
        public
        view
        returns (bool)
    {
        Data.Guardian memory guardian = getGuardian(wallet, addr);
        return guardian.addr != address(0) && (isGuardianActive(guardian) || isGuardianPendingAddition(guardian));
    }

    function getGuardian(
        address wallet,
        address guardianAddr
        )
        public
        view
        returns (Data.Guardian memory)
    {
        uint index = wallets[wallet].guardianIdx[guardianAddr];
        if (index > 0) {
            return wallets[wallet].guardians[index-1];
        }
    }

    // @dev Returns active guardians.
    function guardians(address wallet)
        public
        view
        returns (Data.Guardian[] memory _guardians)
    {
        Wallet storage w = wallets[wallet];
        _guardians = new Data.Guardian[](w.guardians.length);
        uint index = 0;
        for (uint i = 0; i < w.guardians.length; i++) {
            Data.Guardian memory g = w.guardians[i];
            if (isGuardianActive(g)) {
                _guardians[index] = g;
                index ++;
            }
        }
        assembly { mstore(_guardians, index) }
    }

    // @dev Returns the number of active guardians.
    function numGuardians(address wallet)
        public
        view
        returns (uint count)
    {
        Wallet storage w = wallets[wallet];
        for (uint i = 0; i < w.guardians.length; i++) {
            if (isGuardianActive(w.guardians[i])) {
                count ++;
            }
        }
    }

    // @dev Returns guardians who are either active or pending addition.
    function guardiansWithPending(address wallet)
        public
        view
        returns (Data.Guardian[] memory _guardians)
    {
        Wallet storage w = wallets[wallet];
        _guardians = new Data.Guardian[](w.guardians.length);
        uint index = 0;
        for (uint i = 0; i < w.guardians.length; i++) {
            Data.Guardian memory g = w.guardians[i];
            if (isGuardianActive(g) || isGuardianPendingAddition(g)) {
                _guardians[index] = g;
                index ++;
            }
        }
        assembly { mstore(_guardians, index) }
    }

    // @dev Returns the number of guardians who are active or pending addition.
    function numGuardiansWithPending(address wallet)
        public
        view
        returns (uint count)
    {
        Wallet storage w = wallets[wallet];
        for (uint i = 0; i < w.guardians.length; i++) {
            Data.Guardian memory g = w.guardians[i];
            if (isGuardianActive(g) || isGuardianPendingAddition(g)) {
                count ++;
            }
        }
    }

    function addGuardian(
        address wallet,
        address guardianAddr,
        uint    group,
        uint    validSince
        )
        public
        onlyWalletModule(wallet)
    {
        cleanRemovedGuardians(wallet);

        require(guardianAddr != address(0), "ZERO_ADDRESS");
        Wallet storage w = wallets[wallet];

        uint pos = w.guardianIdx[guardianAddr];
        require(pos == 0, "GUARDIAN_EXISTS");

        // Add the new guardian
        Data.Guardian memory g = Data.Guardian(guardianAddr, group, validSince, 0);
        w.guardians.push(g);
        w.guardianIdx[guardianAddr] = w.guardians.length;
    }

    function cancelGuardianAddition(
        address wallet,
        address guardianAddr
        )
        public
        onlyWalletModule(wallet)
    {
        cleanRemovedGuardians(wallet);

        Wallet storage w = wallets[wallet];
        uint idx = w.guardianIdx[guardianAddr];
        require(idx > 0, "GUARDIAN_NOT_EXISTS");
        require(
            isGuardianPendingAddition(w.guardians[idx - 1]),
            "NOT_PENDING_ADDITION"
        );

        Data.Guardian memory lastGuardian = w.guardians[w.guardians.length - 1];
        if (guardianAddr != lastGuardian.addr) {
            w.guardians[idx - 1] = lastGuardian;
            w.guardianIdx[lastGuardian.addr] = idx;
        }
        w.guardians.pop();
        delete w.guardianIdx[guardianAddr];
    }

    function removeGuardian(
        address wallet,
        address guardianAddr,
        uint    validUntil
        )
        public
        onlyWalletModule(wallet)
    {
        cleanRemovedGuardians(wallet);

        Wallet storage w = wallets[wallet];
        uint idx = w.guardianIdx[guardianAddr];
        require(idx > 0, "GUARDIAN_NOT_EXISTS");

        w.guardians[idx - 1].validUntil = validUntil;
    }

    function removeAllGuardians(address wallet)
        public
        onlyWalletModule(wallet)
    {
         Wallet storage w = wallets[wallet];
         for (uint i = 0; i < w.guardians.length; i++) {
            delete w.guardianIdx[w.guardians[i].addr];
         }
         delete w.guardians;
    }

    function cancelGuardianRemoval(
        address wallet,
        address guardianAddr
        )
        public
        onlyWalletModule(wallet)
    {
        cleanRemovedGuardians(wallet);

        Wallet storage w = wallets[wallet];
        uint idx = w.guardianIdx[guardianAddr];
        require(idx > 0, "GUARDIAN_NOT_EXISTS");

        require(
            isGuardianPendingRemoval(w.guardians[idx - 1]),
            "NOT_PENDING_REMOVAL"
         );

        w.guardians[idx - 1].validUntil = 0;
    }

    function getLock(address wallet)
        public
        view
        returns (uint _lock, address _module)
    {
        _lock = uint(wallets[wallet].lock);
        _module = wallets[wallet].lockedBy;
    }

    function setLock(
        address wallet,
        uint    lock
        )
        public
        onlyWalletModule(wallet)
    {
        require(lock == 0 || lock > now, "INVALID_LOCK_TIME");
        uint128 _lock = uint128(lock);
        require(uint(_lock) == lock, "LOCK_TOO_LARGE");

        wallets[wallet].lock = _lock;
        wallets[wallet].lockedBy = msg.sender;
    }

    function touchLastActive(address wallet)
        public
        onlyWalletModule(wallet)
    {
        wallets[wallet].lastActive = uint128(now);
    }

    function inheritor(address wallet)
        public
        view
        returns (
            address who,
            uint    lastActive
        )
    {
        who = wallets[wallet].inheritor;
        lastActive = uint(wallets[wallet].lastActive);
    }

    function setInheritor(address wallet, address who)
        public
        onlyWalletModule(wallet)
    {
        wallets[wallet].inheritor = who;
        wallets[wallet].lastActive = uint128(now);
    }

    function cleanRemovedGuardians(address wallet)
        private
    {
        Wallet storage w = wallets[wallet];

        for (int i = int(w.guardians.length) - 1; i >= 0; i--) {
            Data.Guardian memory g = w.guardians[uint(i)];
            if (isGuardianExpired(g)) {
                Data.Guardian memory lastGuardian = w.guardians[w.guardians.length - 1];

                if (g.addr != lastGuardian.addr) {
                    w.guardians[uint(i)] = lastGuardian;
                    w.guardianIdx[lastGuardian.addr] = uint(i) + 1;
                }
                w.guardians.pop();
                delete w.guardianIdx[g.addr];
            }
        }
    }

    function isGuardianActive(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
        return guardian.validSince > 0 && guardian.validSince <= now &&
            !isGuardianExpired(guardian);
    }

    function isGuardianPendingAddition(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
        return guardian.validSince > now;
    }

    function isGuardianPendingRemoval(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
        return guardian.validUntil > now;
    }

    function isGuardianExpired(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
        return guardian.validUntil > 0 &&
            guardian.validUntil <= now;
    }

}

/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/







/// @title DappAddressStore
/// @dev This store maintains global whitelist dapps.
contract DappAddressStore is DataStore, OwnerManagable
{
    bytes32 internal constant DAPPS = keccak256("__DAPPS__");

    event Whitelisted(
        address indexed addr,
        bool            whitelisted
    );

    constructor() public DataStore() {}

    function addDapp(address addr)
        public
        onlyManager
    {
        addAddressToSet(DAPPS, addr, true);
        emit Whitelisted(addr, true);
    }

    function removeDapp(address addr)
        public
        onlyManager
    {
        removeAddressFromSet(DAPPS, addr);
        emit Whitelisted(addr, false);
    }

    function dapps()
        public
        view
        returns (
            address[] memory addresses
        )
    {
        return addressesInSet(DAPPS);
    }

    function isDapp(
        address addr
        )
        public
        view
        returns (bool)
    {
        return isAddressInSet(DAPPS, addr);
    }

    function numDapps()
        public
        view
        returns (uint)
    {
        return numAddressesInSet(DAPPS);
    }
}

/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/







/// @title WhitelistStore
/// @dev This store maintains a wallet's whitelisted addresses.
contract WhitelistStore is DataStore, AddressSet
{
    // wallet => whitelisted_addr => effective_since
    mapping(address => mapping(address => uint)) public effectiveTimeMap;

    event Whitelisted(
        address indexed wallet,
        address indexed addr,
        bool            whitelisted,
        uint            effectiveTime
    );

    constructor() public DataStore() {}

    function addToWhitelist(
        address wallet,
        address addr,
        uint    effectiveTime
        )
        public
        onlyWalletModule(wallet)
    {
        addAddressToSet(walletKey(wallet), addr, true);
        uint effective = effectiveTime >= now ? effectiveTime : now;
        effectiveTimeMap[wallet][addr] = effective;
        emit Whitelisted(wallet, addr, true, effective);
    }

    function removeFromWhitelist(
        address wallet,
        address addr
        )
        public
        onlyWalletModule(wallet)
    {
        removeAddressFromSet(walletKey(wallet), addr);
        delete effectiveTimeMap[wallet][addr];
        emit Whitelisted(wallet, addr, false, 0);
    }

    function whitelist(address wallet)
        public
        view
        returns (
            address[] memory addresses,
            uint[]    memory effectiveTimes
        )
    {
        addresses = addressesInSet(walletKey(wallet));
        effectiveTimes = new uint[](addresses.length);
        for (uint i = 0; i < addresses.length; i++) {
            effectiveTimes[i] = effectiveTimeMap[wallet][addresses[i]];
        }
    }

    function isWhitelisted(
        address wallet,
        address addr
        )
        public
        view
        returns (
            bool isWhitelistedAndEffective,
            uint effectiveTime
        )
    {
        effectiveTime = effectiveTimeMap[wallet][addr];
        isWhitelistedAndEffective = effectiveTime > 0 && effectiveTime <= now;
    }

    function whitelistSize(address wallet)
        public
        view
        returns (uint)
    {
        return numAddressesInSet(walletKey(wallet));
    }

    function walletKey(address addr)
        public
        pure
        returns (bytes32)
    {
        return keccak256(abi.encodePacked("__WHITELIST__", addr));
    }
}


/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/// @title PriceOracle
abstract contract PriceOracle
{
    // @dev Return's the token's value in ETH
    function tokenValue(address token, uint amount)
        public
        view
        virtual
        returns (uint value);
}

/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/


// Taken from Argent's code base - https://github.com/argentlabs/argent-contracts/blob/develop/contracts/ens/ArgentENSManager.sol
// with few modifications.


/*
 * @title String & slice utility library for Solidity contracts.
 * @author Nick Johnson <[email protected]>
 *
 * @dev Functionality in this library is largely implemented using an
 *      abstraction called a 'slice'. A slice represents a part of a string -
 *      anything from the entire string to a single character, or even no
 *      characters at all (a 0-length slice). Since a slice only has to specify
 *      an offset and a length, copying and manipulating slices is a lot less
 *      expensive than copying and manipulating the strings they reference.
 *
 *      To further reduce gas costs, most functions on slice that need to return
 *      a slice modify the original one instead of allocating a new one; for
 *      instance, `s.split(".")` will return the text up to the first '.',
 *      modifying s to only contain the remainder of the string after the '.'.
 *      In situations where you do not want to modify the original slice, you
 *      can make a copy first with `.copy()`, for example:
 *      `s.copy().split(".")`. Try and avoid using this idiom in loops; since
 *      Solidity has no memory management, it will result in allocating many
 *      short-lived slices that are later discarded.
 *
 *      Functions that return two slices come in two versions: a non-allocating
 *      version that takes the second slice as an argument, modifying it in
 *      place, and an allocating version that allocates and returns the second
 *      slice; see `nextRune` for example.
 *
 *      Functions that have to copy string data will return strings rather than
 *      slices; these can be cast back to slices for further processing if
 *      required.
 *
 *      For convenience, some functions are provided with non-modifying
 *      variants that create a new slice and return both; for instance,
 *      `s.splitNew('.')` leaves s unmodified, and returns two values
 *      corresponding to the left and right parts of the string.
 */



/* solium-disable */
library strings {
    struct slice {
        uint _len;
        uint _ptr;
    }

    function memcpy(uint dest, uint src, uint len) private pure {
        // Copy word-length chunks while possible
        for(; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        uint mask = 256 ** (32 - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }
    }

    /*
     * @dev Returns a slice containing the entire string.
     * @param self The string to make a slice from.
     * @return A newly allocated slice containing the entire string.
     */
    function toSlice(string memory self) internal pure returns (slice memory) {
        uint ptr;
        assembly {
            ptr := add(self, 0x20)
        }
        return slice(bytes(self).length, ptr);
    }

    /*
     * @dev Returns the length of a null-terminated bytes32 string.
     * @param self The value to find the length of.
     * @return The length of the string, from 0 to 32.
     */
    function len(bytes32 self) internal pure returns (uint) {
        uint ret;
        if (self == 0)
            return 0;
        if (uint256(self) & 0xffffffffffffffffffffffffffffffff == 0) {
            ret += 16;
            self = bytes32(uint(self) / 0x100000000000000000000000000000000);
        }
        if (uint256(self) & 0xffffffffffffffff == 0) {
            ret += 8;
            self = bytes32(uint(self) / 0x10000000000000000);
        }
        if (uint256(self) & 0xffffffff == 0) {
            ret += 4;
            self = bytes32(uint(self) / 0x100000000);
        }
        if (uint256(self) & 0xffff == 0) {
            ret += 2;
            self = bytes32(uint(self) / 0x10000);
        }
        if (uint256(self) & 0xff == 0) {
            ret += 1;
        }
        return 32 - ret;
    }

    /*
     * @dev Returns a slice containing the entire bytes32, interpreted as a
     *      null-terminated utf-8 string.
     * @param self The bytes32 value to convert to a slice.
     * @return A new slice containing the value of the input argument up to the
     *         first null.
     */
    function toSliceB32(bytes32 self) internal pure returns (slice memory ret) {
        // Allocate space for `self` in memory, copy it there, and point ret at it
        assembly {
            let ptr := mload(0x40)
            mstore(0x40, add(ptr, 0x20))
            mstore(ptr, self)
            mstore(add(ret, 0x20), ptr)
        }
        ret._len = len(self);
    }

    /*
     * @dev Returns a new slice containing the same data as the current slice.
     * @param self The slice to copy.
     * @return A new slice containing the same data as `self`.
     */
    function copy(slice memory self) internal pure returns (slice memory) {
        return slice(self._len, self._ptr);
    }

    /*
     * @dev Copies a slice to a new string.
     * @param self The slice to copy.
     * @return A newly allocated string containing the slice's text.
     */
    function toString(slice memory self) internal pure returns (string memory) {
        string memory ret = new string(self._len);
        uint retptr;
        assembly { retptr := add(ret, 32) }

        memcpy(retptr, self._ptr, self._len);
        return ret;
    }

    /*
     * @dev Returns the length in runes of the slice. Note that this operation
     *      takes time proportional to the length of the slice; avoid using it
     *      in loops, and call `slice.empty()` if you only need to know whether
     *      the slice is empty or not.
     * @param self The slice to operate on.
     * @return The length of the slice in runes.
     */
    function len(slice memory self) internal pure returns (uint l) {
        // Starting at ptr-31 means the LSB will be the byte we care about
        uint ptr = self._ptr - 31;
        uint end = ptr + self._len;
        for (l = 0; ptr < end; l++) {
            uint8 b;
            assembly { b := and(mload(ptr), 0xFF) }
            if (b < 0x80) {
                ptr += 1;
            } else if(b < 0xE0) {
                ptr += 2;
            } else if(b < 0xF0) {
                ptr += 3;
            } else if(b < 0xF8) {
                ptr += 4;
            } else if(b < 0xFC) {
                ptr += 5;
            } else {
                ptr += 6;
            }
        }
    }

    /*
     * @dev Returns true if the slice is empty (has a length of 0).
     * @param self The slice to operate on.
     * @return True if the slice is empty, False otherwise.
     */
    function empty(slice memory self) internal pure returns (bool) {
        return self._len == 0;
    }

    /*
     * @dev Returns a positive number if `other` comes lexicographically after
     *      `self`, a negative number if it comes before, or zero if the
     *      contents of the two slices are equal. Comparison is done per-rune,
     *      on unicode codepoints.
     * @param self The first slice to compare.
     * @param other The second slice to compare.
     * @return The result of the comparison.
     */
    function compare(slice memory self, slice memory other) internal pure returns (int) {
        uint shortest = self._len;
        if (other._len < self._len)
            shortest = other._len;

        uint selfptr = self._ptr;
        uint otherptr = other._ptr;
        for (uint idx = 0; idx < shortest; idx += 32) {
            uint a;
            uint b;
            assembly {
                a := mload(selfptr)
                b := mload(otherptr)
            }
            if (a != b) {
                // Mask out irrelevant bytes and check again
                uint256 mask = uint256(-1); // 0xffff...
                if(shortest < 32) {
                  mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
                }
                uint256 diff = (a & mask) - (b & mask);
                if (diff != 0)
                    return int(diff);
            }
            selfptr += 32;
            otherptr += 32;
        }
        return int(self._len) - int(other._len);
    }

    /*
     * @dev Returns true if the two slices contain the same text.
     * @param self The first slice to compare.
     * @param self The second slice to compare.
     * @return True if the slices are equal, false otherwise.
     */
    function equals(slice memory self, slice memory other) internal pure returns (bool) {
        return compare(self, other) == 0;
    }

    /*
     * @dev Extracts the first rune in the slice into `rune`, advancing the
     *      slice to point to the next rune and returning `self`.
     * @param self The slice to operate on.
     * @param rune The slice that will contain the first rune.
     * @return `rune`.
     */
    function nextRune(slice memory self, slice memory rune) internal pure returns (slice memory) {
        rune._ptr = self._ptr;

        if (self._len == 0) {
            rune._len = 0;
            return rune;
        }

        uint l;
        uint b;
        // Load the first byte of the rune into the LSBs of b
        assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) }
        if (b < 0x80) {
            l = 1;
        } else if(b < 0xE0) {
            l = 2;
        } else if(b < 0xF0) {
            l = 3;
        } else {
            l = 4;
        }

        // Check for truncated codepoints
        if (l > self._len) {
            rune._len = self._len;
            self._ptr += self._len;
            self._len = 0;
            return rune;
        }

        self._ptr += l;
        self._len -= l;
        rune._len = l;
        return rune;
    }

    /*
     * @dev Returns the first rune in the slice, advancing the slice to point
     *      to the next rune.
     * @param self The slice to operate on.
     * @return A slice containing only the first rune from `self`.
     */
    function nextRune(slice memory self) internal pure returns (slice memory ret) {
        nextRune(self, ret);
    }

    /*
     * @dev Returns the number of the first codepoint in the slice.
     * @param self The slice to operate on.
     * @return The number of the first codepoint in the slice.
     */
    function ord(slice memory self) internal pure returns (uint ret) {
        if (self._len == 0) {
            return 0;
        }

        uint word;
        uint length;
        uint divisor = 2 ** 248;

        // Load the rune into the MSBs of b
        assembly { word:= mload(mload(add(self, 32))) }
        uint b = word / divisor;
        if (b < 0x80) {
            ret = b;
            length = 1;
        } else if(b < 0xE0) {
            ret = b & 0x1F;
            length = 2;
        } else if(b < 0xF0) {
            ret = b & 0x0F;
            length = 3;
        } else {
            ret = b & 0x07;
            length = 4;
        }

        // Check for truncated codepoints
        if (length > self._len) {
            return 0;
        }

        for (uint i = 1; i < length; i++) {
            divisor = divisor / 256;
            b = (word / divisor) & 0xFF;
            if (b & 0xC0 != 0x80) {
                // Invalid UTF-8 sequence
                return 0;
            }
            ret = (ret * 64) | (b & 0x3F);
        }

        return ret;
    }

    /*
     * @dev Returns the keccak-256 hash of the slice.
     * @param self The slice to hash.
     * @return The hash of the slice.
     */
    function keccak(slice memory self) internal pure returns (bytes32 ret) {
        assembly {
            ret := keccak256(mload(add(self, 32)), mload(self))
        }
    }

    /*
     * @dev Returns true if `self` starts with `needle`.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return True if the slice starts with the provided text, false otherwise.
     */
    function startsWith(slice memory self, slice memory needle) internal pure returns (bool) {
        if (self._len < needle._len) {
            return false;
        }

        if (self._ptr == needle._ptr) {
            return true;
        }

        bool equal;
        assembly {
            let length := mload(needle)
            let selfptr := mload(add(self, 0x20))
            let needleptr := mload(add(needle, 0x20))
            equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
        }
        return equal;
    }

    /*
     * @dev If `self` starts with `needle`, `needle` is removed from the
     *      beginning of `self`. Otherwise, `self` is unmodified.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
    function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) {
        if (self._len < needle._len) {
            return self;
        }

        bool equal = true;
        if (self._ptr != needle._ptr) {
            assembly {
                let length := mload(needle)
                let selfptr := mload(add(self, 0x20))
                let needleptr := mload(add(needle, 0x20))
                equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
            }
        }

        if (equal) {
            self._len -= needle._len;
            self._ptr += needle._len;
        }

        return self;
    }

    /*
     * @dev Returns true if the slice ends with `needle`.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return True if the slice starts with the provided text, false otherwise.
     */
    function endsWith(slice memory self, slice memory needle) internal pure returns (bool) {
        if (self._len < needle._len) {
            return false;
        }

        uint selfptr = self._ptr + self._len - needle._len;

        if (selfptr == needle._ptr) {
            return true;
        }

        bool equal;
        assembly {
            let length := mload(needle)
            let needleptr := mload(add(needle, 0x20))
            equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
        }

        return equal;
    }

    /*
     * @dev If `self` ends with `needle`, `needle` is removed from the
     *      end of `self`. Otherwise, `self` is unmodified.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
    function until(slice memory self, slice memory needle) internal pure returns (slice memory) {
        if (self._len < needle._len) {
            return self;
        }

        uint selfptr = self._ptr + self._len - needle._len;
        bool equal = true;
        if (selfptr != needle._ptr) {
            assembly {
                let length := mload(needle)
                let needleptr := mload(add(needle, 0x20))
                equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
            }
        }

        if (equal) {
            self._len -= needle._len;
        }

        return self;
    }

    // Returns the memory address of the first byte of the first occurrence of
    // `needle` in `self`, or the first byte after `self` if not found.
    function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
        uint ptr = selfptr;
        uint idx;

        if (needlelen <= selflen) {
            if (needlelen <= 32) {
                bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));

                bytes32 needledata;
                assembly { needledata := and(mload(needleptr), mask) }

                uint end = selfptr + selflen - needlelen;
                bytes32 ptrdata;
                assembly { ptrdata := and(mload(ptr), mask) }

                while (ptrdata != needledata) {
                    if (ptr >= end)
                        return selfptr + selflen;
                    ptr++;
                    assembly { ptrdata := and(mload(ptr), mask) }
                }
                return ptr;
            } else {
                // For long needles, use hashing
                bytes32 hash;
                assembly { hash := keccak256(needleptr, needlelen) }

                for (idx = 0; idx <= selflen - needlelen; idx++) {
                    bytes32 testHash;
                    assembly { testHash := keccak256(ptr, needlelen) }
                    if (hash == testHash)
                        return ptr;
                    ptr += 1;
                }
            }
        }
        return selfptr + selflen;
    }

    // Returns the memory address of the first byte after the last occurrence of
    // `needle` in `self`, or the address of `self` if not found.
    function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
        uint ptr;

        if (needlelen <= selflen) {
            if (needlelen <= 32) {
                bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));

                bytes32 needledata;
                assembly { needledata := and(mload(needleptr), mask) }

                ptr = selfptr + selflen - needlelen;
                bytes32 ptrdata;
                assembly { ptrdata := and(mload(ptr), mask) }

                while (ptrdata != needledata) {
                    if (ptr <= selfptr)
                        return selfptr;
                    ptr--;
                    assembly { ptrdata := and(mload(ptr), mask) }
                }
                return ptr + needlelen;
            } else {
                // For long needles, use hashing
                bytes32 hash;
                assembly { hash := keccak256(needleptr, needlelen) }
                ptr = selfptr + (selflen - needlelen);
                while (ptr >= selfptr) {
                    bytes32 testHash;
                    assembly { testHash := keccak256(ptr, needlelen) }
                    if (hash == testHash)
                        return ptr + needlelen;
                    ptr -= 1;
                }
            }
        }
        return selfptr;
    }

    /*
     * @dev Modifies `self` to contain everything from the first occurrence of
     *      `needle` to the end of the slice. `self` is set to the empty slice
     *      if `needle` is not found.
     * @param self The slice to search and modify.
     * @param needle The text to search for.
     * @return `self`.
     */
    function find(slice memory self, slice memory needle) internal pure returns (slice memory) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
        self._len -= ptr - self._ptr;
        self._ptr = ptr;
        return self;
    }

    /*
     * @dev Modifies `self` to contain the part of the string from the start of
     *      `self` to the end of the first occurrence of `needle`. If `needle`
     *      is not found, `self` is set to the empty slice.
     * @param self The slice to search and modify.
     * @param needle The text to search for.
     * @return `self`.
     */
    function rfind(slice memory self, slice memory needle) internal pure returns (slice memory) {
        uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
        self._len = ptr - self._ptr;
        return self;
    }

    /*
     * @dev Splits the slice, setting `self` to everything after the first
     *      occurrence of `needle`, and `token` to everything before it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and `token` is set to the entirety of `self`.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
    function split(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
        token._ptr = self._ptr;
        token._len = ptr - self._ptr;
        if (ptr == self._ptr + self._len) {
            // Not found
            self._len = 0;
        } else {
            self._len -= token._len + needle._len;
            self._ptr = ptr + needle._len;
        }
        return token;
    }

    /*
     * @dev Splits the slice, setting `self` to everything after the first
     *      occurrence of `needle`, and returning everything before it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and the entirety of `self` is returned.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @return The part of `self` up to the first occurrence of `delim`.
     */
    function split(slice memory self, slice memory needle) internal pure returns (slice memory token) {
        split(self, needle, token);
    }

    /*
     * @dev Splits the slice, setting `self` to everything before the last
     *      occurrence of `needle`, and `token` to everything after it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and `token` is set to the entirety of `self`.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
    function rsplit(slice memory self, slice memory needle, slice memory token) internal pure returns (slice memory) {
        uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
        token._ptr = ptr;
        token._len = self._len - (ptr - self._ptr);
        if (ptr == self._ptr) {
            // Not found
            self._len = 0;
        } else {
            self._len -= token._len + needle._len;
        }
        return token;
    }

    /*
     * @dev Splits the slice, setting `self` to everything before the last
     *      occurrence of `needle`, and returning everything after it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and the entirety of `self` is returned.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @return The part of `self` after the last occurrence of `delim`.
     */
    function rsplit(slice memory self, slice memory needle) internal pure returns (slice memory token) {
        rsplit(self, needle, token);
    }

    /*
     * @dev Counts the number of nonoverlapping occurrences of `needle` in `self`.
     * @param self The slice to search.
     * @param needle The text to search for in `self`.
     * @return The number of occurrences of `needle` found in `self`.
     */
    function count(slice memory self, slice memory needle) internal pure returns (uint cnt) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
        while (ptr <= self._ptr + self._len) {
            cnt++;
            ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len;
        }
    }

    /*
     * @dev Returns True if `self` contains `needle`.
     * @param self The slice to search.
     * @param needle The text to search for in `self`.
     * @return True if `needle` is found in `self`, false otherwise.
     */
    function contains(slice memory self, slice memory needle) internal pure returns (bool) {
        return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr;
    }

    /*
     * @dev Returns a newly allocated string containing the concatenation of
     *      `self` and `other`.
     * @param self The first slice to concatenate.
     * @param other The second slice to concatenate.
     * @return The concatenation of the two strings.
     */
    function concat(slice memory self, slice memory other) internal pure returns (string memory) {
        string memory ret = new string(self._len + other._len);
        uint retptr;
        assembly { retptr := add(ret, 32) }
        memcpy(retptr, self._ptr, self._len);
        memcpy(retptr + self._len, other._ptr, other._len);
        return ret;
    }

    /*
     * @dev Joins an array of slices, using `self` as a delimiter, returning a
     *      newly allocated string.
     * @param self The delimiter to use.
     * @param parts A list of slices to join.
     * @return A newly allocated string containing all the slices in `parts`,
     *         joined with `self`.
     */
    function join(slice memory self, slice[] memory parts) internal pure returns (string memory) {
        if (parts.length == 0)
            return "";

        uint length = self._len * (parts.length - 1);
        for(uint i = 0; i < parts.length; i++)
            length += parts[i]._len;

        string memory ret = new string(length);
        uint retptr;
        assembly { retptr := add(ret, 32) }

        for(uint i = 0; i < parts.length; i++) {
            memcpy(retptr, parts[i]._ptr, parts[i]._len);
            retptr += parts[i]._len;
            if (i < parts.length - 1) {
                memcpy(retptr, self._ptr, self._len);
                retptr += self._len;
            }
        }

        return ret;
    }
}






/**
 * @dev Interface for an ENS Mananger.
 */
interface IENSManager {
    function changeRootnodeOwner(address _newOwner) external;

    function isAvailable(bytes32 _subnode) external view returns(bool);

    function resolveName(address _owner) external view returns (string memory);

    function register(
        address _owner,
        string  calldata _label,
        bytes   calldata _approval
    ) external;
}

/**
 * @title BaseENSManager
 * @dev Implementation of an ENS manager that orchestrates the complete
 * registration of subdomains for a single root (e.g. argent.eth).
 * The contract defines a manager role who is the only role that can trigger the registration of
 * a new subdomain.
 * @author Julien Niset - <[email protected]>
 */
contract BaseENSManager is IENSManager, OwnerManagable, ENSConsumer {

    using strings for *;
    using BytesUtil     for bytes;
    using MathUint      for uint;

    // The managed root name
    string public rootName;
    // The managed root node
    bytes32 public rootNode;
    // The address of the ENS resolver
    address public ensResolver;

    // *************** Events *************************** //

    event RootnodeOwnerChange(bytes32 indexed _rootnode, address indexed _newOwner);
    event ENSResolverChanged(address addr);
    event Registered(address indexed _owner, string _ens);
    event Unregistered(string _ens);

    // *************** Constructor ********************** //

    /**
     * @dev Constructor that sets the ENS root name and root node to manage.
     * @param _rootName The root name (e.g. argentx.eth).
     * @param _rootNode The node of the root name (e.g. namehash(argentx.eth)).
     */
    constructor(string memory _rootName, bytes32 _rootNode, address _ensRegistry, address _ensResolver)
        ENSConsumer(_ensRegistry)
        public {
        rootName = _rootName;
        rootNode = _rootNode;
        ensResolver = _ensResolver;
    }

    // *************** External Functions ********************* //

    /**
     * @dev This function must be called when the ENS Manager contract is replaced
     * and the address of the new Manager should be provided.
     * @param _newOwner The address of the new ENS manager that will manage the root node.
     */
    function changeRootnodeOwner(address _newOwner) external override onlyOwner {
        getENSRegistry().setOwner(rootNode, _newOwner);
        emit RootnodeOwnerChange(rootNode, _newOwner);
    }

    /**
     * @dev Lets the owner change the address of the ENS resolver contract.
     * @param _ensResolver The address of the ENS resolver contract.
     */
    function changeENSResolver(address _ensResolver) external onlyOwner {
        require(_ensResolver != address(0), "WF: address cannot be null");
        ensResolver = _ensResolver;
        emit ENSResolverChanged(_ensResolver);
    }

    /**
    * @dev Lets the manager assign an ENS subdomain of the root node to a target address.
    * Registers both the forward and reverse ENS.
    * @param _owner The owner of the subdomain.
    * @param _label The subdomain label.
    * @param _approval The signature of _owner and _label by a manager.
    */
    function register(
        address _owner,
        string  calldata _label,
        bytes   calldata _approval
        )
        external
        override
        onlyManager
    {
        verifyApproval(_owner, _label, _approval);

        bytes32 labelNode = keccak256(abi.encodePacked(_label));
        bytes32 node = keccak256(abi.encodePacked(rootNode, labelNode));
        address currentOwner = getENSRegistry().owner(node);
        require(currentOwner == address(0), "AEM: _label is alrealdy owned");

        // Forward ENS
        getENSRegistry().setSubnodeOwner(rootNode, labelNode, address(this));
        getENSRegistry().setResolver(node, ensResolver);
        getENSRegistry().setOwner(node, _owner);
        ENSResolver(ensResolver).setAddr(node, _owner);

        // Reverse ENS
        strings.slice[] memory parts = new strings.slice[](2);
        parts[0] = _label.toSlice();
        parts[1] = rootName.toSlice();
        string memory name = ".".toSlice().join(parts);
        bytes32 reverseNode = getENSReverseRegistrar().node(_owner);
        ENSResolver(ensResolver).setName(reverseNode, name);

        emit Registered(_owner, name);
    }

    // *************** Public Functions ********************* //

    /**
    * @dev Resolves an address to an ENS name
    * @param _owner The ENS owner address
    */
    function resolveName(address _owner) public view override returns (string memory) {
        bytes32 reverseNode = getENSReverseRegistrar().node(_owner);
        return ENSResolver(ensResolver).name(reverseNode);
    }

    /**
     * @dev Returns true is a given subnode is available.
     * @param _subnode The target subnode.
     * @return true if the subnode is available.
     */
    function isAvailable(bytes32 _subnode) public view override returns (bool) {
        bytes32 node = keccak256(abi.encodePacked(rootNode, _subnode));
        address currentOwner = getENSRegistry().owner(node);
        if(currentOwner == address(0)) {
            return true;
        }
        return false;
    }

    function verifyApproval(
        address _owner,
        string  memory _label,
        bytes   memory _approval
        )
        internal
        view
    {
        if (numManagers() == 1) {
            return;
        }

        bytes32 messageHash = keccak256(
            abi.encodePacked(
                _owner,
                _label
            )
        );

        bytes32 hash = keccak256(
            abi.encodePacked(
                "\x19Ethereum Signed Message:\n32",
                messageHash
            )
        );

        address signer = SignatureUtil.recoverECDSASigner(hash, _approval);
        require(isManager(signer), "UNAUTHORIZED");
    }

}


/// @title WalletENSManager
/// @dev An ENS manager to interactive with ENS module.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
contract WalletENSManager is BaseENSManager {

    constructor(
        string memory _rootName,
        bytes32       _rootNode,
        address       _ensRegistry,
        address       _ensResolver
        )
        public
        BaseENSManager(
            _rootName,
            _rootNode,
            _ensRegistry,
            _ensResolver
        )
    {
    }

}


/// @title Controller
///
/// @author Daniel Wang - <[email protected]>
contract Controller
{
    // The address to which all colletable tokens/ether in modules will
    // be sent to.
    address public collectTo;
    uint    public defaultLockPeriod;

    ModuleRegistry          public moduleRegistry;
    WalletRegistry          public walletRegistry;

    QuotaStore              public quotaStore;
    SecurityStore           public securityStore;
    DappAddressStore        public dappAddressStore;
    WhitelistStore          public whitelistStore;

    PriceOracle             public priceOracle;
    WalletENSManager        public ensManager;
}
/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/




/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless _requirement by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/



library EIP712
{
    struct Domain {
        string  name;
        string  version;
        address verifyingContract;
    }

    bytes32 constant internal EIP712_DOMAIN_TYPEHASH = keccak256(
        "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
    );

    string constant internal EIP191_HEADER = "\x19\x01";

    function hash(Domain memory domain)
        internal
        pure
        returns (bytes32)
    {
        uint _chainid;
        assembly { _chainid := chainid() }

        return keccak256(
            abi.encode(
                EIP712_DOMAIN_TYPEHASH,
                keccak256(bytes(domain.name)),
                keccak256(bytes(domain.version)),
                _chainid,
                domain.verifyingContract
            )
        );
    }

    function hashPacked(
        bytes32 domainHash,
        bytes32 dataHash
        )
        internal
        pure
        returns (bytes32)
    {
        return keccak256(
            abi.encodePacked(
                EIP191_HEADER,
                domainHash,
                dataHash
            )
        );
    }
}


/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/










/// @title SignatureUtil
/// @author Daniel Wang - <[email protected]>
/// @dev This method supports multihash standard. Each signature's first byte indicates
///      the signature's type, the second byte indicates the signature's length, therefore,
///      each signature will have 2 extra bytes prefix. Mulitple signatures are concatenated
///      together.
library SignatureUtil
{
    using BytesUtil     for bytes;
    using MathUint      for uint;

    enum SignatureType {
        ILLEGAL,
        INVALID,
        EIP_712,
        ETH_SIGN,
        WALLET
    }

    bytes4 constant private ERC1271_MAGICVALUE = 0x20c13b0b;

    function verifySignatures(
        bytes32   signHash,
        address[] memory signers,
        bytes[]   memory signatures
        )
        internal
        view
        returns (bool)
    {
        require(signers.length == signatures.length, "BAD_SIGNATURE_DATA");
        address lastSigner;
        for (uint i = 0; i < signers.length; i++) {
            require(signers[i] > lastSigner, "INVALID_SIGNERS_ORDER");
            lastSigner = signers[i];
            if (!verifySignature(signHash, signers[i], signatures[i])) {
                return false;
            }
        }
        return true;
    }

    function verifySignature(
        bytes32 signHash,
        address signer,
        bytes   memory signature
        )
        internal
        view
        returns (bool)
    {
        uint signatureTypeOffset = signature.length.sub(1);
        SignatureType signatureType = SignatureType(signature.toUint8(signatureTypeOffset));

        bytes memory stripped = signature.slice(0, signatureTypeOffset);

        if (signatureType == SignatureType.WALLET) {
            return verifyERC1271Signature(signHash, signer, stripped);
        } else if (signatureType == SignatureType.EIP_712) {
            return recoverECDSASigner(signHash, stripped) == signer;
        } else if (signatureType == SignatureType.ETH_SIGN) {
            bytes32 hash = keccak256(
                abi.encodePacked("\x19Ethereum Signed Message:\n32", signHash)
            );
            return recoverECDSASigner(hash, stripped) == signer;
        } else {
            return false;
        }
    }

    function verifyERC1271Signature(
        bytes32 signHash,
        address signer,
        bytes   memory signature
        )
        private
        view
        returns(bool)
    {
        bytes memory callData = abi.encodeWithSelector(
            ERC1271(0).isValidSignature.selector,
            abi.encode(signHash),
            signature
        );
        (bool success, bytes memory result) = signer.staticcall(callData);
        return (
            success &&
            result.length == 32 &&
            result.toBytes4(0) == ERC1271_MAGICVALUE
        );
    }

    function recoverECDSASigner(
        bytes32      signHash,
        bytes memory signature
        )
        internal
        pure
        returns (address)
    {
        if (signature.length != 65) {
            return address(0);
        }

        bytes32 r;
        bytes32 s;
        uint8   v;
        // we jump 32 (0x20) as the first slot of bytes contains the length
        // we jump 65 (0x41) per signature
        // for v we load 32 bytes ending with v (the first 31 come from s) then apply a mask
        assembly {
            r := mload(add(signature, 0x20))
            s := mload(add(signature, 0x40))
            v := and(mload(add(signature, 0x41)), 0xff)
        }
        // See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return address(0);
        }
        if (v == 27 || v == 28) {
            return ecrecover(signHash, v, r, s);
        } else {
            return address(0);
        }
    }
}








/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/






/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/







/// @title Module
/// @dev Base contract for all smart wallet modules.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
interface Module
{
    /// @dev Activates the module for the given wallet (msg.sender) after the module is added.
    ///      Warning: this method shall ONLY be callable by a wallet.
    function activate() external;

    /// @dev Deactivates the module for the given wallet (msg.sender) before the module is removed.
    ///      Warning: this method shall ONLY be callable by a wallet.
    function deactivate() external;
}



/// @title BaseModule
/// @dev This contract implements some common functions that are likely
///      be useful for all modules.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
contract BaseModule is ReentrancyGuard, Module
{
    event Activated   (address indexed wallet);
    event Deactivated (address indexed wallet);

    modifier onlyFromWallet(address wallet) virtual
    {
        require(msg.sender == wallet, "NOT_FROM_WALLET");
        _;
    }

    modifier onlyFromMetaTx() virtual {
        require(msg.sender == address(this), "NOT_FROM_META_TX");
        _;
    }

    modifier onlyFromWalletOwner(address wallet) virtual {
        require(msg.sender == Wallet(wallet).owner(), "NOT_FROM_WALLET_OWNER");
        _;
    }

    modifier onlyFromMetaTxOrWalletOwner(address wallet) virtual {
        require(
            msg.sender == address(this) || msg.sender == Wallet(wallet).owner(),
            "NOT_FROM_METATX_OR_WALLET_OWNER");
        _;
    }

    modifier onlyFromMetaTxOrOwner(address owner) virtual {
        require(
            msg.sender == address(this) || msg.sender == owner,
            "NOT_FROM_METATX_OR_OWNER");
        _;
    }

    modifier onlyWalletOwner(address wallet, address addr) virtual {
        require(Wallet(wallet).owner() == addr, "NOT_WALLET_OWNER");
        _;
    }

    modifier notWalletOwner(address wallet, address addr) virtual {
        require(Wallet(wallet).owner() != addr, "IS_WALLET_OWNER");
        _;
    }

    function addModule(
        address wallet,
        address module
        )
        external
        nonReentrant
        onlyFromMetaTxOrWalletOwner(wallet)
    {
        Wallet(wallet).addModule(module);
    }

    /// @dev This method will cause an re-entry to the same module contract.
    function activate()
        external
        override
        virtual
    {
        address wallet = msg.sender;
        bindMethods(wallet);
        emit Activated(wallet);
    }

    /// @dev This method will cause an re-entry to the same module contract.
    function deactivate()
        external
        override
        virtual
    {
        address wallet = msg.sender;
        unbindMethods(wallet);
        emit Deactivated(wallet);
    }

    ///.@dev Gets the list of methods for binding to wallets.
    ///      Sub-contracts should override this method to provide methods for
    ///      wallet binding.
    /// @return methods A list of method selectors for binding to the wallet
    ///         when this module is activated for the wallet.
    function bindableMethods()
        public
        pure
        virtual
        returns (bytes4[] memory methods)
    {
    }

    // ===== internal & private methods =====

    /// @dev Binds all methods to the given wallet.
    function bindMethods(address wallet)
        internal
    {
        Wallet w = Wallet(wallet);
        bytes4[] memory methods = bindableMethods();
        for (uint i = 0; i < methods.length; i++) {
            w.bindMethod(methods[i], address(this));
        }
    }

    /// @dev Unbinds all methods from the given wallet.
    function unbindMethods(address wallet)
        internal
    {
        Wallet w = Wallet(wallet);
        bytes4[] memory methods = bindableMethods();
        for (uint i = 0; i < methods.length; i++) {
            w.bindMethod(methods[i], address(0));
        }
    }

    function transactCall(
        address wallet,
        address to,
        uint    value,
        bytes   memory data
        )
        internal
        returns (bytes memory)
    {
        return Wallet(wallet).transact(uint8(1), to, value, data);
    }

    // Special case for transactCall to support transfers on "bad" ERC20 tokens
    function transactTokenTransfer(
        address wallet,
        address token,
        address to,
        uint    amount
        )
        internal
        returns (bool success)
    {
        bytes memory txData = abi.encodeWithSelector(
            ERC20(0).transfer.selector,
            to,
            amount
        );
        bytes memory returnData = transactCall(wallet, token, 0, txData);
        // `transactCall` will revert if the call was unsuccessful.
        // The only extra check we have to do is verify if the return value (if there is any) is correct.
        if (returnData.length > 0) {
            success = abi.decode(returnData, (bool));
        } else {
            // If there is no return value then a failure would have resulted in a revert
            success = true;
        }
    }

    // Special case for transactCall to support approvals on "bad" ERC20 tokens
    function transactTokenApprove(
        address wallet,
        address token,
        address spender,
        uint    amount
        )
        internal
        returns (bool success)
    {
        bytes memory txData = abi.encodeWithSelector(
            ERC20(0).approve.selector,
            spender,
            amount
        );
        bytes memory returnData = transactCall(wallet, token, 0, txData);
        // `transactCall` will revert if the call was unsuccessful.
        // The only extra check we have to do is verify if the return value (if there is any) is correct.
        if (returnData.length > 0) {
            success = abi.decode(returnData, (bool));
        } else {
            // If there is no return value then a failure would have resulted in a revert
            success = true;
        }
    }

    function transactDelegateCall(
        address wallet,
        address to,
        uint    value,
        bytes   memory data
        )
        internal
        returns (bytes memory)
    {
        return Wallet(wallet).transact(uint8(2), to, value, data);
    }

    function transactStaticCall(
        address wallet,
        address to,
        bytes   memory data
        )
        internal
        returns (bytes memory)
    {
        return Wallet(wallet).transact(uint8(3), to, 0, data);
    }
}



/// @title MetaTxModule
/// @dev This is the base module for supporting meta-transactions.
///      A MetaTxModule will only relay transactions on itself, and the methods
///      relayed must as the target wallet address as its first argument, unless
///      the `extractWalletAddress` is overridden.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts

abstract contract MetaTxModule is BaseModule
{
    using MathUint      for uint;
    using AddressUtil   for address;
    using SignatureUtil for bytes32;
    using BytesUtil     for bytes;

    struct WalletState
    {
        uint nonce;
        mapping (bytes32 => bool) metaTxHash;
    }

    struct GasSettings
    {
        address token;
        uint    price;
        uint    limit;
        uint    overhead;
        address recipient;
    }

    struct MetaTransaction
    {
        address wallet;
        address module;
        uint    value;
        bytes   data;
        uint    nonce;
        uint    validUntil;
        address gasToken;
        uint    gasPrice;
        uint    gasLimit;
        uint    gasOverhead;
        address feeRecipient;
    }

    bytes32 constant public METATRANSACTION_TYPEHASH = keccak256(
        "MetaTransaction(address wallet,address module,uint256 value,bytes data,uint256 nonce,uint256 validUntil,address gasToken,uint256 gasPrice,uint256 gasLimit,uint256 gasOverhead,address feeRecipient)"
    );

    bytes32    public DOMAIN_SEPARATOR;
    Controller public controller;

    mapping (address => WalletState) public wallets;

    event MetaTxExecuted(
        address indexed transactor,
        address indexed wallet,
        uint    nonce,
        bytes32 metaTxHash,
        uint    gasUsed,
        bool    success,
        bytes   returnData
    );

    modifier onlyFromMetaTx override
    {
        require(msg.sender == address(this), "NOT_FROM_THIS_MODULE");
        _;
    }

    constructor(Controller _controller)
        public
        BaseModule()
    {
        DOMAIN_SEPARATOR = EIP712.hash(EIP712.Domain("Loopring Wallet MetaTxModule", "1.0", address(this)));
        controller = _controller;
    }

    function quotaStore()
        internal
        view
        virtual
        returns (address)
    {
        return address(0);
    }

    function isWalletOwnerOrGuardian(address wallet, address addr)
        internal
        view
        returns (bool)
    {
        return Wallet(wallet).owner() == addr ||
            controller.securityStore().isGuardian(wallet, addr);
    }

    function isWalletOwnerOrGuardian(address wallet, address[] memory addrs)
        internal
        view
        returns (bool)
    {
        if (addrs.length == 0) return false;

        for (uint i = 0; i < addrs.length; i++) {
            if (!isWalletOwnerOrGuardian(wallet, addrs[i])) {
                return false;
            }
        }
        return true;
    }

    /// @dev Execute a signed meta transaction.
    ///      This method can be called by any relayer without restriction. The relayer
    ///      will pay for transaction gas in Ether and charge the wallet Ether or other
    ///      ERC20 tokens as fee. If gasPrice is set to 0, then the relayer won't charge
    ///      the wallet any fee.
    ///
    ///      Important! This function needs to be safe against re-entrancy by using
    ///      the 'Checks Effects Interactions' pattern! We do not use `nonReentrant`
    ///      because this function is used to call into the same contract.
    ///
    /// @param data The raw transaction to be performed on this module.
    /// @param nonce The nonce of this meta transaction. When nonce is 0, this module will
    ///              make sure the transaction's metaTxHash is unique; otherwise, the module
    ///              requires the nonce is greater than the last nonce used by the same
    ///              wallet, but not by more than `block.number * 2^128`.
    /// @param validUntil The expiry timestamp
    /// @param gasSetting A list that contains `gasToken` address, `gasPrice`, `gasLimit`,
    ///                   `gasOverhead` and `feeRecipient`. To pay fee in Ether, use address(0) as gasToken.
    ///                   To receive reimbursement at `msg.sender`, use address(0) as feeRecipient.
    /// @param signatures The signatures of the signers.
    /// @param signers The signers needed for the transaction.
    function executeMetaTx(
        bytes     memory data,
        uint      nonce,
        uint      validUntil,
        uint[5]   memory gasSetting, // [gasToken address][gasPrice][gasLimit][gasOverhead][feeRecipient]
        bytes[]   memory signatures,
        address[] memory signers
        )
        public
        payable
    {
        require(validUntil >= now, "EXPIRED");

        GasSettings memory gasSettings = GasSettings(
            address(gasSetting[0]),
            gasSetting[1],
            gasSetting[2],
            gasSetting[3],
            address(gasSetting[4])
        );
        require(gasSettings.limit > 0, "INVALID_GAS_LIMIT");

        address wallet = extractWalletAddress(data);
        bytes32 metaTxHash = EIP712.hashPacked(
            DOMAIN_SEPARATOR,
            hash(
                MetaTransaction(
                    wallet,
                    address(this),
                    msg.value,
                    data,
                    nonce,
                    validUntil,
                    gasSettings.token,
                    gasSettings.price,
                    gasSettings.limit,
                    gasSettings.overhead,
                    gasSettings.recipient
                )
            )
        );

        // Get the signers necessary for this meta transaction.
        require(checkSigners(wallet, data, signers), "METATX_UNAUTHORIZED");
        require(metaTxHash.verifySignatures(signers, signatures), "INVALID_SIGNATURES");

        // Mark the transaction as used before doing the call to guard against re-entrancy
        // (the only exploit possible here is that the transaction can be executed multiple times).
        saveExecutedMetaTx(wallet, nonce, metaTxHash);

        // Deposit msg.value to the wallet so it can be used from the wallet
        if (msg.value > 0) {
            wallet.sendETHAndVerify(msg.value, gasleft());
        }

        require(gasleft() >= (gasSettings.limit.mul(64) / 63).add(60000), "INSUFFICIENT_GAS");
        uint gasUsed = gasleft();
        // solium-disable-next-line security/no-call-value
        (bool success, bytes memory returnData) = address(this).call{gas: gasSettings.limit}(data);
        gasUsed = gasUsed - gasleft();
        // The gas amount measured could be a little bit higher because of the extra costs to do the call itself
        gasUsed = gasUsed < gasSettings.limit ? gasUsed : gasSettings.limit;

        emit MetaTxExecuted(msg.sender, wallet, nonce, metaTxHash, gasUsed, success, returnData);

        if (gasSettings.price != 0) {
            reimburseGasFee(wallet, gasSettings, gasUsed);
        }
    }

    /// @dev Returns the last nonce used by a wallet.
    /// @param wallet The wallet's address.
    /// @return Last nonce used.
    function lastNonce(address wallet)
        public
        view
        returns (uint)
    {
        return wallets[wallet].nonce;
    }

    /// @dev Collects tokens and ether owned by this module to a controlled address.
    /// @param tokens The list of tokens and ether to collect.
    function collectTokens(address[] calldata tokens)
        external
        nonReentrant
    {
        address to = controller.collectTo();

        for (uint i = 0; i < tokens.length; i++) {
            address token = tokens[i];
            if (token == address(0)) {
                uint amount = address(this).balance;
                to.sendETHAndVerify(amount, gasleft());
            } else {
                uint amount = ERC20(token).balanceOf(address(this));
                if (amount > 0) {
                    // Do not check the return value to support "bad" ERC20 tokens
                    ERC20(token).transfer(to, amount);
                }
            }
        }
    }

    // ---- internal functions -----

    /// @dev Validate the list of signers for the given meta transaction.
    ///      Additional validation of the signers can also be done inside this function.
    /// @param wallet The wallet address.
    /// @param method The method selector.
    /// @param data The call data.
    /// @param signers The list of addresses which have signed the meta transaction
    /// @return True if the list of signers are as expected, else False
    function verifySigners(
        address   wallet,
        bytes4    method,
        bytes     memory data,
        address[] memory signers
        )
        internal
        view
        virtual
        returns (bool);

    /// @dev Check if the specified signer is the only signer
    function isOnlySigner(address signer, address[] memory signers)
        internal
        pure
        virtual
        returns (bool)
    {
        return (signers.length == 1 && signers[0] == signer);
    }

    /// @dev For all relayed method, the first parameter must be the wallet address.
    function extractWalletAddress(bytes memory data)
        internal
        view
        virtual
        returns (address wallet)
    {
        wallet = extractAddressFromCallData(data, 0);
    }

    /// @dev Returns the address stored in the call data
    ///      at the specified function parameter index.
    ///      Example: function bar(uint value, address signer, bytes data);
    ///               To extact `signer` use parameterIdx := 1
    function extractAddressFromCallData(
        bytes memory data,
        uint  parameterIdx
        )
        internal
        pure
        returns (address addr)
    {
        addr = data.toAddress(4 + 32 * parameterIdx + 12);
    }

    /// @dev Returns a read-only array with the addresses stored in the call data
    ///      at the specified function parameter index.
    ///      Example: function bar(address[] signers, uint value);
    ///               To extact `signers` use parameterIdx := 0
    ///      Example: function foo(address wallet, address[] signers, address[] contracts);
    ///               To extact `signers` use parameterIdx := 1
    ///               To extact `contracts` use parameterIdx := 2
    function extractAddressesFromCallData(
        bytes memory data,
        uint  parameterIdx
        )
        internal
        pure
        returns (address[] memory addresses)
    {
        // Find the offset of the function parameter in the call data
        uint dataOffset = data.toUint(4 + 32 * parameterIdx);
        // Make sure enough bytes are in data to store the complete array
        uint length = data.toUint(4 + dataOffset);
        require(data.length >= 4 + dataOffset + 32 * (1 + length), "INVALID_DATA");
        // Extract the signers by copying the pointer at the beginning of the array
        // An extra offset of 36 is applied: 32(length) + 4(sig)
        assembly { addresses := add(data, add(36, dataOffset)) }
    }

    function hash(MetaTransaction memory _tx)
        internal
        pure
        returns (bytes32)
    {
        return keccak256(
            abi.encode(
                METATRANSACTION_TYPEHASH,
                _tx.wallet,
                _tx.module,
                _tx.value,
                keccak256(_tx.data),
                _tx.nonce,
                _tx.validUntil,
                _tx.gasToken,
                _tx.gasPrice,
                _tx.gasLimit,
                _tx.gasOverhead,
                _tx.feeRecipient
            )
        );
    }

    function extractMethod(bytes memory data)
        internal
        pure
        returns (bytes4 method)
    {
        return data.toBytes4(0);
    }

    function reimburseGasFee(
        address     wallet,
        GasSettings memory gasSettings,
        uint        gasUsed
        )
        private
    {
        uint gasCost = gasUsed.add(gasSettings.overhead).mul(gasSettings.price);
        updateQuota(wallet, gasSettings.token, gasCost);

        address feeRecipient = (gasSettings.recipient == address(0)) ? msg.sender : gasSettings.recipient;
        if (gasSettings.token == address(0)) {
            transactCall(wallet, feeRecipient, gasCost, "");
        } else {
            require(
                transactTokenTransfer(wallet, gasSettings.token, feeRecipient, gasCost),
                "TRANSFER_FAILED"
            );
        }
    }

    // ---- private functions -----

    function checkSigners(
        address   wallet,
        bytes     memory data,
        address[] memory signers
        )
        private
        view
        returns (bool)
    {
        bytes4 method = extractMethod(data);
        if (method == this.addModule.selector) {
            return isOnlySigner(Wallet(wallet).owner(), signers);
        } else {
            return verifySigners(wallet, method, data, signers);
        }
    }

    /// @dev Save the meta-transaction to history.
    ///      This method must throw if the transaction is not unique or the nonce is invalid.
    /// @param wallet The target wallet.
    /// @param nonce The nonce
    /// @param metaTxHash The signed hash of the transaction
    function saveExecutedMetaTx(
        address wallet,
        uint    nonce,
        bytes32 metaTxHash
        )
        private
    {
        if (nonce == 0) {
            require(!wallets[wallet].metaTxHash[metaTxHash], "INVALID_HASH");
            wallets[wallet].metaTxHash[metaTxHash] = true;
        } else {
            require(nonce > wallets[wallet].nonce, "NONCE_TOO_SMALL");
            require((nonce >> 128) <= (block.number), "NONCE_TOO_LARGE");
            wallets[wallet].nonce = nonce;
        }
    }

    function updateQuota(
        address wallet,
        address token,
        uint    amount
        )
        internal
    {
        if (amount > 0 && quotaStore() != address(0)) {
            uint value = controller.priceOracle().tokenValue(token, amount);
            QuotaStore(quotaStore()).checkAndAddToSpent(wallet, value);
        }
    }

    function tryToUpdateQuota(
        address wallet,
        address token,
        uint    amount
        )
        internal
        returns (bool)
    {
        if (quotaStore() != address(0)) {
            uint value = controller.priceOracle().tokenValue(token, amount);
            try QuotaStore(quotaStore()).checkAndAddToSpent(wallet, value) {
                return true;
            } catch Error(string memory /*reason*/) {
                return false;
            }
        } else {
            return true;
        }
    }
}

/*

  Copyright 2017 Loopring Project Ltd (Loopring Foundation).

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/




// This code is taken from https://github.com/OpenZeppelin/openzeppelin-labs
// with minor modifications.



// This code is taken from https://github.com/OpenZeppelin/openzeppelin-labs
// with minor modifications.



// This code is taken from https://github.com/OpenZeppelin/openzeppelin-labs
// with minor modifications.




/**
 * @title Proxy
 * @dev Gives the possibility to delegate any call to a foreign implementation.
 */
abstract contract Proxy {
  /**
  * @dev Tells the address of the implementation where every call will be delegated.
  * @return address of the implementation to which it will be delegated
  */
  function implementation() public view virtual returns (address);

  /**
  * @dev Fallback function allowing to perform a delegatecall to the given implementation.
  * This function will return whatever the implementation call returns
  */
  fallback() payable external {
    address _impl = implementation();
    require(_impl != address(0));

    assembly {
      let ptr := mload(0x40)
      calldatacopy(ptr, 0, calldatasize())
      let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
      let size := returndatasize()
      returndatacopy(ptr, 0, size)

      switch result
      case 0 { revert(ptr, size) }
      default { return(ptr, size) }
    }
  }
}


/**
 * @title UpgradeabilityProxy
 * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded
 */
contract UpgradeabilityProxy is Proxy {
  /**
   * @dev This event will be emitted every time the implementation gets upgraded
   * @param implementation representing the address of the upgraded implementation
   */
  event Upgraded(address indexed implementation);

  // Storage position of the address of the current implementation
  bytes32 private constant implementationPosition = keccak256("org.zeppelinos.proxy.implementation");

  /**
   * @dev Constructor function
   */
  constructor() public {}

  /**
   * @dev Tells the address of the current implementation
   * @return impl address of the current implementation
   */
  function implementation() public view override returns (address impl) {
    bytes32 position = implementationPosition;
    assembly {
      impl := sload(position)
    }
  }

  /**
   * @dev Sets the address of the current implementation
   * @param newImplementation address representing the new implementation to be set
   */
  function setImplementation(address newImplementation) internal {
    bytes32 position = implementationPosition;
    assembly {
      sstore(position, newImplementation)
    }
  }

  /**
   * @dev Upgrades the implementation address
   * @param newImplementation representing the address of the new implementation to be set
   */
  function _upgradeTo(address newImplementation) internal {
    address currentImplementation = implementation();
    require(currentImplementation != newImplementation);
    setImplementation(newImplementation);
    emit Upgraded(newImplementation);
  }
}


/**
 * @title OwnedUpgradabilityProxy
 * @dev This contract combines an upgradeability proxy with basic authorization control functionalities
 */
contract OwnedUpgradabilityProxy is UpgradeabilityProxy {
  /**
  * @dev Event to show ownership has been transferred
  * @param previousOwner representing the address of the previous owner
  * @param newOwner representing the address of the new owner
  */
  event ProxyOwnershipTransferred(address previousOwner, address newOwner);

  // Storage position of the owner of the contract
  bytes32 private constant proxyOwnerPosition = keccak256("org.zeppelinos.proxy.owner");

  /**
  * @dev the constructor sets the original owner of the contract to the sender account.
  */
  constructor() public {
    setUpgradeabilityOwner(msg.sender);
  }

  /**
  * @dev Throws if called by any account other than the owner.
  */
  modifier onlyProxyOwner() {
    require(msg.sender == proxyOwner());
    _;
  }

  /**
   * @dev Tells the address of the owner
   * @return owner the address of the owner
   */
  function proxyOwner() public view returns (address owner) {
    bytes32 position = proxyOwnerPosition;
    assembly {
      owner := sload(position)
    }
  }

  /**
   * @dev Sets the address of the owner
   */
  function setUpgradeabilityOwner(address newProxyOwner) internal {
    bytes32 position = proxyOwnerPosition;
    assembly {
      sstore(position, newProxyOwner)
    }
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferProxyOwnership(address newOwner) public onlyProxyOwner {
    require(newOwner != address(0));
    emit ProxyOwnershipTransferred(proxyOwner(), newOwner);
    setUpgradeabilityOwner(newOwner);
  }

  /**
   * @dev Allows the proxy owner to upgrade the current version of the proxy.
   * @param implementation representing the address of the new implementation to be set.
   */
  function upgradeTo(address implementation) public onlyProxyOwner {
    _upgradeTo(implementation);
  }

  /**
   * @dev Allows the proxy owner to upgrade the current version of the proxy and call the new implementation
   * to initialize whatever is needed through a low level call.
   * @param implementation representing the address of the new implementation to be set.
   * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
   * signature of the implementation to be called with the needed payload
   */
  function upgradeToAndCall(address implementation, bytes memory data) payable public onlyProxyOwner {
    upgradeTo(implementation);
    (bool success, ) = address(this).call{value:msg.value}(data);
    require(success);
  }
}
// Taken from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/970f687f04d20e01138a3e8ccf9278b1d4b3997b/contracts/utils/Create2.sol



/**
 * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
 * `CREATE2` can be used to compute in advance the address where a smart
 * contract will be deployed, which allows for interesting new mechanisms known
 * as 'counterfactual interactions'.
 *
 * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
 * information.
 */
library Create2 {
    /**
     * @dev Deploys a contract using `CREATE2`. The address where the contract
     * will be deployed can be known in advance via {computeAddress}. Note that
     * a contract cannot be deployed twice using the same salt.
     */
    function deploy(bytes32 salt, bytes memory bytecode) internal returns (address payable) {
        address payable addr;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            addr := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
        }
        require(addr != address(0), "CREATE2_FAILED");
        return addr;
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the `bytecode`
     * or `salt` will result in a new destination address.
     */
    function computeAddress(bytes32 salt, bytes memory bytecode) internal view returns (address) {
        return computeAddress(salt, bytecode, address(this));
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
     * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
     */
    function computeAddress(bytes32 salt, bytes memory bytecodeHash, address deployer) internal pure returns (address) {
        bytes32 bytecodeHashHash = keccak256(bytecodeHash);
        bytes32 _data = keccak256(
            abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHashHash)
        );
        return address(bytes20(_data << 96));
    }
}







/// @title WalletFactory
/// @dev A factory contract to create a new wallet by deploying a proxy
///      in front of a real wallet.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
contract WalletFactory is ReentrancyGuard
{
    event WalletCreated(
        address indexed wallet,
        address indexed owner
    );

    function computeWalletAddress(
        address owner
        )
        public
        view
        returns (address)
    {
        return Create2.computeAddress(
            getSalt(owner),
            getWalletCode()
        );
    }

    function createWalletInternal(
        Controller _controller,
        address    _implementation,
        address    _owner,
        address    _bootstrapModule
        )
        internal
        returns (address payable _wallet)
    {
        // Deploy the wallet
        _wallet = Create2.deploy(getSalt(_owner), getWalletCode());

        OwnedUpgradabilityProxy(_wallet).upgradeTo(_implementation);
        OwnedUpgradabilityProxy(_wallet).transferProxyOwnership(_wallet);

        Wallet(_wallet).setup(address(_controller), _owner, _bootstrapModule);

        _controller.walletRegistry().registerWallet(_wallet);

        emit WalletCreated(_wallet, _owner);
    }

    function getSalt(
        address owner
        )
        internal
        pure
        returns (bytes32 salt)
    {
        return keccak256(abi.encodePacked("WALLET_CREATION", owner));
    }

    function getWalletCode()
        internal
        pure
        returns (bytes memory)
    {
        return type(OwnedUpgradabilityProxy).creationCode;
    }
}







/// @title WalletFactoryModule
/// @dev Factory to create new wallets and also register a ENS subdomain for
///      newly created wallets.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
contract WalletFactoryModule is WalletFactory, MetaTxModule
{
    using AddressUtil for address;

    address public walletImplementation;

    constructor(
        Controller _controller,
        address    _walletImplementation
        )
        public
        MetaTxModule(_controller)
    {
        walletImplementation = _walletImplementation;
    }

    /// @dev Create a new wallet by deploying a proxy.
    /// @param _owner The wallet's owner.
    /// @param _label The ENS subdomain to register, use "" to skip.
    /// @param _labelApproval The signature for ENS subdomain approval.
    /// @param _modules The wallet's modules.
    /// @return _wallet The newly created wallet's address.
    function createWallet(
        address            _owner,
        string    calldata _label,
        bytes     calldata _labelApproval,
        address[] calldata _modules
        )
        external
        payable
        nonReentrant
        onlyFromMetaTxOrOwner(_owner)
        returns (address _wallet)
    {
        _wallet = createWalletInternal(
            controller,
            walletImplementation,
            _owner,
            address(this)
        );
        Wallet w = Wallet(_wallet);

        for(uint i = 0; i < _modules.length; i++) {
            w.addModule(_modules[i]);
        }

        if (bytes(_label).length > 0) {
            controller.ensManager().register(
                _wallet,
                _label,
                _labelApproval
            );
        }
        // Don't remove this module so it is still authorized for reimbursing meta tx's
        //w.removeModule(address(this));
    }

    function verifySigners(
        address   wallet,
        bytes4    method,
        bytes     memory data,
        address[] memory signers
        )
        internal
        view
        override
        returns (bool)
    {
        if (method == this.createWallet.selector) {
            // The wallet doesn't exist yet, so the owner of the wallet (or any guardians) has not yet been set.
            // Only allow the future wallet owner to sign the meta tx if the wallet hasn't been created yet.
            address futureOwner = extractAddressFromCallData(data, 0);
            return isOnlySigner(futureOwner, signers) && !wallet.isContract();
        } else {
            revert("INVALID_METHOD");
        }
    }

    function extractWalletAddress(bytes memory data)
        internal
        view
        override
        returns (address wallet)
    {
        require(extractMethod(data) == this.createWallet.selector, "INVALID_METHOD");
        address owner = extractAddressFromCallData(data, 0);
        wallet = computeWalletAddress(owner);
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract Controller","name":"_controller","type":"address"},{"internalType":"address","name":"_walletImplementation","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"}],"name":"Activated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"}],"name":"Deactivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transactor","type":"address"},{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"metaTxHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"bytes","name":"returnData","type":"bytes"}],"name":"MetaTxExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"WalletCreated","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"METATRANSACTION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"address","name":"module","type":"address"}],"name":"addModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bindableMethods","outputs":[{"internalType":"bytes4[]","name":"methods","type":"bytes4[]"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"collectTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"computeWalletAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract Controller","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"string","name":"_label","type":"string"},{"internalType":"bytes","name":"_labelApproval","type":"bytes"},{"internalType":"address[]","name":"_modules","type":"address[]"}],"name":"createWallet","outputs":[{"internalType":"address","name":"_wallet","type":"address"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"deactivate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"uint256[5]","name":"gasSetting","type":"uint256[5]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"},{"internalType":"address[]","name":"signers","type":"address[]"}],"name":"executeMetaTx","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"lastNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"walletImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wallets","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506040516200368338038062003683833981016040819052620000349162000164565b81620000be60405180606001604052806040518060400160405280601c81526020017f4c6f6f7072696e672057616c6c6574204d65746154784d6f64756c65000000008152508152602001604051806040016040528060038152602001620312e360ec1b8152508152602001306001600160a01b0316815250620000f760201b62002d2a1760201c565b600155600280546001600160a01b039283166001600160a01b031991821617909155600480549390921692169190911790555062000251565b60405160009046906200010a90620001a2565b6040518091039020836000015180519060200120846020015180519060200120838660400151604051602001620001469594939291906200020c565b60405160208183030381529060405280519060200120915050919050565b6000806040838503121562000177578182fd5b8251620001848162000238565b6020840151909250620001978162000238565b809150509250929050565b7f454950373132446f6d61696e28737472696e67206e616d652c737472696e672081527f76657273696f6e2c75696e7432353620636861696e49642c6164647265737320602082015271766572696679696e67436f6e74726163742960701b604082015260520190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6001600160a01b03811681146200024e57600080fd5b50565b61342280620002616000396000f3fe608060405260043610620000f25760003560e01c80638117abc1116200008b578063afa3363d1162000061578063afa3363d1462000235578063c0fd43b4146200025c578063f77c47911462000281578063fddf851f146200029957620000f2565b80638117abc114620001d357806389b08f1114620001eb57806390502c2e146200021057620000f2565b80632d621c5111620000cd5780632d621c5114620001575780633644e515146200017e57806351b42b0014620001965780635a1db8c414620001ae57620000f2565b80630ab9ad3314620000f75780630f15f4c014620001105780631180ef4a1462000128575b600080fd5b6200010e62000108366004620023c6565b620002be565b005b3480156200011d57600080fd5b506200010e62000600565b6200013f6200013936600462002235565b62000643565b6040516200014e91906200270e565b60405180910390f35b3480156200016457600080fd5b506200016f62000871565b6040516200014e9190620027ea565b3480156200018b57600080fd5b506200016f6200088a565b348015620001a357600080fd5b506200010e62000890565b348015620001bb57600080fd5b506200010e620001cd366004620021f8565b620008d3565b348015620001e057600080fd5b506200013f62000a1a565b348015620001f857600080fd5b506200016f6200020a366004620021ba565b62000a29565b3480156200021d57600080fd5b506200010e6200022f366004620022ea565b62000a3b565b3480156200024257600080fd5b506200024d62000c7e565b6040516200014e9190620027a6565b3480156200026957600080fd5b506200016f6200027b366004620021ba565b62000c83565b3480156200028e57600080fd5b506200013f62000c9e565b348015620002a657600080fd5b506200013f620002b8366004620021ba565b62000cad565b42841015620002ea5760405162461bcd60e51b8152600401620002e19062002b1e565b60405180910390fd5b620002f462001fa8565b506040805160a08101825284516001600160a01b0390811682526020808701519083015285830151928201839052606080870151908301526080808701519091169082015290620003595760405162461bcd60e51b8152600401620002e19062002942565b6000620003668862000cd4565b9050600062000405600154620003ff604051806101600160405280866001600160a01b03168152602001306001600160a01b031681526020013481526020018d81526020018c81526020018b815260200187600001516001600160a01b0316815260200187602001518152602001876040015181526020018760600151815260200187608001516001600160a01b031681525062000d36565b62000dc9565b905062000414828a8662000e1a565b620004335760405162461bcd60e51b8152600401620002e19062002acb565b6200044681858763ffffffff62000edb16565b620004655760405162461bcd60e51b8152600401620002e19062002bb7565b6200047282898362000fc9565b3415620004995762000497345a6001600160a01b038516919063ffffffff620010d516565b505b620004d261ea60603f620004bc604087604001516200111590919063ffffffff16565b81620004c457fe5b049063ffffffff6200114e16565b5a1015620004f45760405162461bcd60e51b8152600401620002e19062002b67565b60005a905060006060306001600160a01b031686604001518d6040516200051c91906200256d565b60006040518083038160008787f1925050503d80600081146200055c576040519150601f19603f3d011682016040523d82523d6000602084013e62000561565b606091505b50915091505a604087015193039283106200058157856040015162000583565b825b9250846001600160a01b0316336001600160a01b03167f4d3367ceeab65bf3b68cc4658d780a0f6e4101b2475aa8b6658c2df7851e12bb8d87878787604051620005d295949392919062002c09565b60405180910390a3602086015115620005f257620005f285878562001174565b505050505050505050505050565b336200060c816200124b565b6040516001600160a01b038216907f0cc43938d137e7efade6a531f663e78c1fc75257b0d65ffda2fdaf70cb49cdf990600090a250565b6000805415620006675760405162461bcd60e51b8152600401620002e190620028bf565b60016000558733301480620006845750336001600160a01b038216145b620006a35760405162461bcd60e51b8152600401620002e1906200290b565b600254600454620006c3916001600160a01b0390811691168b30620012f2565b91508160005b848110156200076457816001600160a01b0316631ed86f19878784818110620006ee57fe5b9050602002016020810190620007059190620021ba565b6040518263ffffffff1660e01b81526004016200072391906200270e565b600060405180830381600087803b1580156200073e57600080fd5b505af115801562000753573d6000803e3d6000fd5b505060019092019150620006c99050565b5087156200086057600260009054906101000a90046001600160a01b03166001600160a01b0316635a6971f96040518163ffffffff1660e01b815260040160206040518083038186803b158015620007bb57600080fd5b505afa158015620007d0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007f69190620021d9565b6001600160a01b03166358086775848b8b8b8b6040518663ffffffff1660e01b81526004016200082b95949392919062002745565b600060405180830381600087803b1580156200084657600080fd5b505af11580156200085b573d6000803e3d6000fd5b505050505b505060008055979650505050505050565b6040516200087f906200261a565b604051809103902081565b60015481565b336200089c8162001556565b6040516001600160a01b038216907f749cb6b4c510bc468cf6b9c2086d6f0a54d6b18e25d37bf3200e68eab0880c0090600090a250565b60005415620008f65760405162461bcd60e51b8152600401620002e190620028bf565b60016000558133301480620009905750806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200094057600080fd5b505afa15801562000955573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200097b9190620021d9565b6001600160a01b0316336001600160a01b0316145b620009af5760405162461bcd60e51b8152600401620002e19062002a94565b604051631ed86f1960e01b81526001600160a01b03841690631ed86f1990620009dd9085906004016200270e565b600060405180830381600087803b158015620009f857600080fd5b505af115801562000a0d573d6000803e3d6000fd5b5050600080555050505050565b6004546001600160a01b031681565b60036020526000908152604090205481565b6000541562000a5e5760405162461bcd60e51b8152600401620002e190620028bf565b60016000908155600254604080516306a32ffd60e01b815290516001600160a01b03909216916306a32ffd91600480820192602092909190829003018186803b15801562000aab57600080fd5b505afa15801562000ac0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ae69190620021d9565b905060005b8281101562000c7457600084848381811062000b0357fe5b905060200201602081019062000b1a9190620021ba565b90506001600160a01b03811662000b52574762000b4a815a6001600160a01b038716919063ffffffff620010d516565b505062000c6a565b6040516370a0823160e01b81526000906001600160a01b038316906370a082319062000b839030906004016200270e565b60206040518083038186803b15801562000b9c57600080fd5b505afa15801562000bb1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bd79190620024c3565b9050801562000c685760405163a9059cbb60e01b81526001600160a01b0383169063a9059cbb9062000c1090879085906004016200278d565b602060405180830381600087803b15801562000c2b57600080fd5b505af115801562000c40573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c6691906200232e565b505b505b5060010162000aeb565b5050600080555050565b606090565b6001600160a01b031660009081526003602052604090205490565b6002546001600160a01b031681565b600062000cce62000cbe83620015f8565b62000cc86200160d565b62001639565b92915050565b60006308c077a560e11b62000ce98362001648565b6001600160e01b0319161462000d135760405162461bcd60e51b8152600401620002e190620028e3565b600062000d228360006200165c565b905062000d2f8162000cad565b9392505050565b600060405162000d46906200261a565b604051809103902082600001518360200151846040015185606001518051906020012086608001518760a001518860c001518960e001518a61010001518b61012001518c610140015160405160200162000dac9c9b9a99989796959493929190620027f3565b604051602081830303815290604052805190602001209050919050565b600060405180604001604052806002815260200161190160f01b815250838360405160200162000dfc939291906200258b565b60405160208183030381529060405280519060200120905092915050565b60008062000e288462001648565b90506001600160e01b031981166316876e3160e21b141562000ecd5762000ec4856001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801562000e8257600080fd5b505afa15801562000e97573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ebd9190620021d9565b8462001676565b91505062000d2f565b62000ec485828686620016b7565b6000815183511462000f015760405162461bcd60e51b8152600401620002e1906200296d565b6000805b845181101562000fbd57816001600160a01b031685828151811062000f2657fe5b60200260200101516001600160a01b03161162000f575760405162461bcd60e51b8152600401620002e19062002a13565b84818151811062000f6457fe5b6020026020010151915062000fa38686838151811062000f8057fe5b602002602001015186848151811062000f9557fe5b602002602001015162001739565b62000fb45760009250505062000d2f565b60010162000f05565b50600195945050505050565b8162001053576001600160a01b038316600090815260036020908152604080832084845260010190915290205460ff1615620010195760405162461bcd60e51b8152600401620002e19062002b91565b6001600160a01b03831660009081526003602090815260408083208484526001908101909252909120805460ff19169091179055620010d0565b6001600160a01b03831660009081526003602052604090205482116200108d5760405162461bcd60e51b8152600401620002e190620029c3565b43608083901c1115620010b45760405162461bcd60e51b8152600401620002e19062002a42565b6001600160a01b03831660009081526003602052604090208290555b505050565b6000620010f36001600160a01b038516848463ffffffff6200187d16565b90508062000d2f5760405162461bcd60e51b8152600401620002e19062002999565b8181028215806200112f5750818382816200112c57fe5b04145b62000cce5760405162461bcd60e51b8152600401620002e19062002be3565b8181018281101562000cce5760405162461bcd60e51b8152600401620002e19062002af8565b6000620011a58360200151620011988560600151856200114e90919063ffffffff16565b9063ffffffff6200111516565b9050620011b88484600001518362001912565b60808301516000906001600160a01b031615620011da578360800151620011dc565b335b84519091506001600160a01b031662001213576200120c8582846040518060200160405280600081525062001ab5565b5062001244565b62001225858560000151838562001b50565b620012445760405162461bcd60e51b8152600401620002e19062002a6b565b5050505050565b8060606200125862000c7e565b905060005b8151811015620012ec57826001600160a01b031663b149206e8383815181106200128357fe5b6020026020010151306040518363ffffffff1660e01b8152600401620012ab92919062002873565b600060405180830381600087803b158015620012c657600080fd5b505af1158015620012db573d6000803e3d6000fd5b5050600190920191506200125d9050565b50505050565b6000620013136200130384620015f8565b6200130d6200160d565b62001bee565b604051631b2ce7f360e11b81529091506001600160a01b03821690633659cfe690620013449087906004016200270e565b600060405180830381600087803b1580156200135f57600080fd5b505af115801562001374573d6000803e3d6000fd5b50506040516378b9ce5760e11b81526001600160a01b038416925063f1739cae9150620013a69084906004016200270e565b600060405180830381600087803b158015620013c157600080fd5b505af1158015620013d6573d6000803e3d6000fd5b50506040516377b8b1c760e01b81526001600160a01b03841692506377b8b1c791506200140c9088908790879060040162002722565b600060405180830381600087803b1580156200142757600080fd5b505af11580156200143c573d6000803e3d6000fd5b50505050846001600160a01b031663ab7aa6ad6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200147a57600080fd5b505afa1580156200148f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014b59190620021d9565b6001600160a01b031663779beedf826040518263ffffffff1660e01b8152600401620014e291906200270e565b600060405180830381600087803b158015620014fd57600080fd5b505af115801562001512573d6000803e3d6000fd5b50506040516001600160a01b038087169350841691507f5b03bfed1c14a02bdeceb5fa582eb1a5765fc0bc64ca0e6af4c20afc9487f08190600090a3949350505050565b8060606200156362000c7e565b905060005b8151811015620012ec57826001600160a01b031663b149206e8383815181106200158e57fe5b602002602001015160006040518363ffffffff1660e01b8152600401620015b792919062002873565b600060405180830381600087803b158015620015d257600080fd5b505af1158015620015e7573d6000803e3d6000fd5b505060019092019150620015689050565b60008160405160200162000dac9190620025e5565b606060405180602001620016219062001fe9565b601f1982820381018352601f90910116604052905090565b600062000d2f83833062001c26565b600062000cce828263ffffffff62001c8016565b600062000d2f836010602085020163ffffffff62001c9d16565b60008151600114801562000d2f5750826001600160a01b0316826000815181106200169d57fe5b60200260200101516001600160a01b031614905092915050565b60006001600160e01b031984166308c077a560e11b141562001717576000620016e28460006200165c565b9050620016f0818462001676565b80156200170e57506200170c866001600160a01b031662001cc1565b155b91505062001731565b60405162461bcd60e51b8152600401620002e190620028e3565b949350505050565b600080620017536001845162001ccd90919063ffffffff16565b9050600062001769848363ffffffff62001cf816565b60ff1660048111156200177857fe5b90506060620017908560008563ffffffff62001d1516565b90506004826004811115620017a157fe5b1415620017c057620017b587878362001d9a565b935050505062000d2f565b6002826004811115620017cf57fe5b14156200180157856001600160a01b0316620017ec888362001ebd565b6001600160a01b031614935050505062000d2f565b60038260048111156200181057fe5b141562001870576000876040516020016200182c9190620025b4565b604051602081830303815290604052805190602001209050866001600160a01b03166200185a828462001ebd565b6001600160a01b03161494505050505062000d2f565b6000935050505062000d2f565b6000826200188e5750600162000d2f565b6000620018a4856001600160a01b031662001fa0565b9050806001600160a01b0316848490604051620018c19062001fa0565b600060405180830381858888f193505050503d806000811462001901576040519150601f19603f3d011682016040523d82523d6000602084013e62001906565b606091505b50909695505050505050565b60008111801562001936575060006200192a62001fa3565b6001600160a01b031614155b15620010d05760025460408051632630c12f60e01b815290516000926001600160a01b031691632630c12f916004808301926020929190829003018186803b1580156200198257600080fd5b505afa15801562001997573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019bd9190620021d9565b6001600160a01b031663f182178384846040518363ffffffff1660e01b8152600401620019ec9291906200278d565b60206040518083038186803b15801562001a0557600080fd5b505afa15801562001a1a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a409190620024c3565b905062001a4c62001fa3565b6001600160a01b031663c976bd9a85836040518363ffffffff1660e01b815260040162001a7b9291906200278d565b600060405180830381600087803b15801562001a9657600080fd5b505af115801562001aab573d6000803e3d6000fd5b5050505050505050565b604051631c48add360e21b81526060906001600160a01b03861690637122b74c9062001aed9060019088908890889060040162002c38565b600060405180830381600087803b15801562001b0857600080fd5b505af115801562001b1d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001b47919081019062002350565b95945050505050565b6000606063a9059cbb60e01b848460405160240162001b719291906200278d565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091529050606062001bb6878760008562001ab5565b80519091501562001bdf578080602001905181019062001bd791906200232e565b925062001be4565b600192505b5050949350505050565b600080838351602085016000f590506001600160a01b03811662000d2f5760405162461bcd60e51b8152600401620002e19062002b3f565b8151602080840191909120604051600092839162001c55916001600160f81b03199187918a9187910162002534565b60408051808303601f1901815291905280516020909101206001600160a01b03169695505050505050565b6000816004018351101562001c9457600080fd5b50016020015190565b6000816014018351101562001cb157600080fd5b500160200151600160601b900490565b3b63ffffffff16151590565b60008282111562001cf25760405162461bcd60e51b8152600401620002e190620029ec565b50900390565b6000816001018351101562001d0c57600080fd5b50016001015190565b60608183018451101562001d2857600080fd5b60608215801562001d455760405191506020820160405262001d91565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101562001d8057805183526020928301920162001d66565b5050858452601f01601f1916604052505b50949350505050565b600060606320c13b0b60e01b8560405160200162001db99190620027ea565b60408051601f198184030181529082905262001dda91869060240162002896565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006060856001600160a01b03168360405162001e2d91906200256d565b600060405180830381855afa9150503d806000811462001e6a576040519150601f19603f3d011682016040523d82523d6000602084013e62001e6f565b606091505b509150915081801562001e83575080516020145b801562001eb257506320c13b0b60e01b62001ea682600063ffffffff62001c8016565b6001600160e01b031916145b979650505050505050565b6000815160411462001ed25750600062000cce565b60208201516040830151604184015160ff167f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111562001f1a576000935050505062000cce565b8060ff16601b148062001f3057508060ff16601c145b1562001f93576001868285856040516000815260200160405260405162001f5b949392919062002855565b6020604051602081039080840390855afa15801562001f7e573d6000803e3d6000fd5b50505060206040510351935050505062000cce565b6000935050505062000cce565b90565b600090565b6040518060a0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6105bf8062002e2e83390190565b60008083601f84011262002009578182fd5b50813567ffffffffffffffff81111562002021578182fd5b60208301915083602080830285010111156200203c57600080fd5b9250929050565b600082601f83011262002054578081fd5b81356200206b620020658262002c9c565b62002c74565b8181529150602080830190848101818402860182018710156200208d57600080fd5b60005b84811015620020b9578135620020a68162002d11565b8452928201929082019060010162002090565b505050505092915050565b600082601f830112620020d5578081fd5b8135620020e6620020658262002c9c565b818152915060208083019084810160005b84811015620020b95762002111888484358a010162002167565b84529282019290820190600101620020f7565b60008083601f84011262002136578182fd5b50813567ffffffffffffffff8111156200214e578182fd5b6020830191508360208285010111156200203c57600080fd5b600082601f83011262002178578081fd5b813562002189620020658262002cbd565b9150808252836020828501011115620021a157600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215620021cc578081fd5b813562000d2f8162002d11565b600060208284031215620021eb578081fd5b815162000d2f8162002d11565b600080604083850312156200220b578081fd5b8235620022188162002d11565b915060208301356200222a8162002d11565b809150509250929050565b60008060008060008060006080888a03121562002250578283fd5b87356200225d8162002d11565b9650602088013567ffffffffffffffff808211156200227a578485fd5b620022888b838c0162002124565b909850965060408a0135915080821115620022a1578485fd5b620022af8b838c0162002124565b909650945060608a0135915080821115620022c8578384fd5b50620022d78a828b0162001ff7565b989b979a50959850939692959293505050565b60008060208385031215620022fd578182fd5b823567ffffffffffffffff81111562002314578283fd5b620023228582860162001ff7565b90969095509350505050565b60006020828403121562002340578081fd5b8151801515811462000d2f578182fd5b60006020828403121562002362578081fd5b815167ffffffffffffffff81111562002379578182fd5b80830184601f8201126200238b578283fd5b805191506200239e620020658362002cbd565b828152856020848401011115620023b3578384fd5b62001b4783602083016020850162002ce2565b6000806000806000806101408789031215620023e0578182fd5b863567ffffffffffffffff80821115620023f8578384fd5b620024068a838b0162002167565b9750602091508189013596506040890135955089607f8a011262002428578384fd5b6200243460a062002c74565b8060608b016101008c018d8111156200244b578788fd5b875b60058110156200246c578235855293860193918601916001016200244d565b5091975050359250508082111562002482578384fd5b620024908a838b01620020c4565b9350610120890135915080821115620024a7578283fd5b50620024b689828a0162002043565b9150509295509295509295565b600060208284031215620024d5578081fd5b5051919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b600081518084526200252081602086016020860162002ce2565b601f01601f19169290920160200192915050565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b600082516200258181846020870162002ce2565b9190910192915050565b600084516200259f81846020890162002ce2565b91909101928352506020820152604001919050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6e2ba0a62622aa2fa1a922a0aa24a7a760891b815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b7f4d6574615472616e73616374696f6e28616464726573732077616c6c65742c6181527f646472657373206d6f64756c652c75696e743235362076616c75652c6279746560208201527f7320646174612c75696e74323536206e6f6e63652c75696e743235362076616c60408201527f6964556e74696c2c6164647265737320676173546f6b656e2c75696e7432353660608201527f2067617350726963652c75696e74323536206761734c696d69742c75696e743260808201527f3536206761734f766572686561642c616464726573732066656552656369706960a082015263656e742960e01b60c082015260c40190565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b03861681526060602082018190526000906200276c9083018688620024dc565b828103604084015262002781818587620024dc565b98975050505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015620019065783516001600160e01b03191683529284019291840191600101620027c2565b90815260200190565b9b8c526001600160a01b039a8b1660208d0152988a1660408c015260608b019790975260808a019590955260a089019390935260c0880191909152851660e0870152610100860152610120850152610140840152166101608201526101800190565b93845260ff9290921660208401526040830152606082015260800190565b6001600160e01b03199290921682526001600160a01b0316602082015260400190565b600060408252620028ab604083018562002506565b828103602084015262001b47818562002506565b6020808252600a90820152695245454e5452414e435960b01b604082015260600190565b6020808252600e908201526d1253959053125117d351551213d160921b604082015260600190565b60208082526018908201527f4e4f545f46524f4d5f4d45544154585f4f525f4f574e45520000000000000000604082015260600190565b6020808252601190820152701253959053125117d1d054d7d312535255607a1b604082015260600190565b6020808252601290820152714241445f5349474e41545552455f4441544160701b604082015260600190565b60208082526010908201526f5452414e534645525f4641494c55524560801b604082015260600190565b6020808252600f908201526e1393d390d157d513d3d7d4d3505313608a1b604082015260600190565b6020808252600d908201526c5355425f554e444552464c4f5760981b604082015260600190565b60208082526015908201527424a72b20a624a22fa9a4a3a722a929afa7a92222a960591b604082015260600190565b6020808252600f908201526e4e4f4e43455f544f4f5f4c4152474560881b604082015260600190565b6020808252600f908201526e1514905394d1915497d19052531151608a1b604082015260600190565b6020808252601f908201527f4e4f545f46524f4d5f4d45544154585f4f525f57414c4c45545f4f574e455200604082015260600190565b60208082526013908201527213515510551617d5539055551213d492569151606a1b604082015260600190565b6020808252600c908201526b4144445f4f564552464c4f5760a01b604082015260600190565b6020808252600790820152661156141254915160ca1b604082015260600190565b6020808252600e908201526d10d4915055114c97d1905253115160921b604082015260600190565b60208082526010908201526f494e53554646494349454e545f47415360801b604082015260600190565b6020808252600c908201526b0929cac82989288be9082a6960a31b604082015260600190565b602080825260129082015271494e56414c49445f5349474e41545552455360701b604082015260600190565b6020808252600c908201526b4d554c5f4f564552464c4f5760a01b604082015260600190565b6000868252856020830152846040830152831515606083015260a0608083015262001eb260a083018462002506565b600060ff8616825260018060a01b03851660208301528360408301526080606083015262002c6a608083018462002506565b9695505050505050565b60405181810167ffffffffffffffff8111828210171562002c9457600080fd5b604052919050565b600067ffffffffffffffff82111562002cb3578081fd5b5060209081020190565b600067ffffffffffffffff82111562002cd4578081fd5b50601f01601f191660200190565b60005b8381101562002cff57818101518382015260200162002ce5565b83811115620012ec5750506000910152565b6001600160a01b038116811462002d2757600080fd5b50565b604051600090469062002d3d9062002d97565b604051809103902083600001518051906020012084602001518051906020012083866040015160405160200162002d7995949392919062002e01565b60405160208183030381529060405280519060200120915050919050565b7f454950373132446f6d61696e28737472696e67206e616d652c737472696e672081527f76657273696f6e2c75696e7432353620636861696e49642c6164647265737320602082015271766572696679696e67436f6e74726163742960701b604082015260520190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a0019056fe608060405234801561001057600080fd5b50610023336001600160e01b0361002816565b61006f565b600060405161003690610046565b6040519081900390209190915550565b7f6f72672e7a657070656c696e6f732e70726f78792e6f776e65720000000000008152601a0190565b6105418061007e6000396000f3fe60806040526004361061004a5760003560e01c8063025313a21461008e5780633659cfe6146100b95780634f1ef286146100db5780635c60da1b146100ee578063f1739cae14610103575b6000610054610123565b90506001600160a01b03811661006957600080fd5b60405136600082376000803683855af43d806000843e81801561008a578184f35b8184fd5b34801561009a57600080fd5b506100a3610142565b6040516100b091906104aa565b60405180910390f35b3480156100c557600080fd5b506100d96100d4366004610339565b610151565b005b6100d96100e9366004610367565b610182565b3480156100fa57600080fd5b506100a3610123565b34801561010f57600080fd5b506100d961011e366004610339565b610220565b60008060405161013290610475565b6040519081900390205492915050565b6000806040516101329061044c565b610159610142565b6001600160a01b0316336001600160a01b03161461017657600080fd5b61017f816102a1565b50565b61018a610142565b6001600160a01b0316336001600160a01b0316146101a757600080fd5b6101b082610151565b6000306001600160a01b031634836040516101cb9190610413565b60006040518083038185875af1925050503d8060008114610208576040519150601f19603f3d011682016040523d82523d6000602084013e61020d565b606091505b505090508061021b57600080fd5b505050565b610228610142565b6001600160a01b0316336001600160a01b03161461024557600080fd5b6001600160a01b03811661025857600080fd5b7f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd9610281610142565b826040516102909291906104be565b60405180910390a161017f8161030d565b60006102ab610123565b9050816001600160a01b0316816001600160a01b031614156102cc57600080fd5b6102d58261032b565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a25050565b600060405161031b9061044c565b6040519081900390209190915550565b600060405161031b90610475565b60006020828403121561034a578081fd5b81356001600160a01b0381168114610360578182fd5b9392505050565b60008060408385031215610379578081fd5b82356001600160a01b038116811461038f578182fd5b9150602083013567ffffffffffffffff808211156103ab578283fd5b81850186601f8201126103bc578384fd5b80359250818311156103cc578384fd5b6103df601f8401601f19166020016104d8565b91508282528660208483010111156103f5578384fd5b6104068360208401602084016104ff565b5080925050509250929050565b60008251815b818110156104335760208186018101518583015201610419565b818111156104415782828501525b509190910192915050565b7f6f72672e7a657070656c696e6f732e70726f78792e6f776e65720000000000008152601a0190565b7f6f72672e7a657070656c696e6f732e70726f78792e696d706c656d656e74617481526234b7b760e91b602082015260230190565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b60405181810167ffffffffffffffff811182821017156104f757600080fd5b604052919050565b8281833750600091015256fea2646970667358221220f2866cb180971be35ca8efcd1e48412813a6a7fd09f1cddee17992e9561cd86564736f6c63430006060033a2646970667358221220e5cf4d06dbb43edb1435fbb84965911afd31aa0ea79ecf5ebd75e619b44f067564736f6c63430006060033000000000000000000000000728348a947b808483365bf24f5f7886f0a9786bf000000000000000000000000f8c1f5848969bac54a5cc0178e0a36504b818db9

Deployed Bytecode

0x608060405260043610620000f25760003560e01c80638117abc1116200008b578063afa3363d1162000061578063afa3363d1462000235578063c0fd43b4146200025c578063f77c47911462000281578063fddf851f146200029957620000f2565b80638117abc114620001d357806389b08f1114620001eb57806390502c2e146200021057620000f2565b80632d621c5111620000cd5780632d621c5114620001575780633644e515146200017e57806351b42b0014620001965780635a1db8c414620001ae57620000f2565b80630ab9ad3314620000f75780630f15f4c014620001105780631180ef4a1462000128575b600080fd5b6200010e62000108366004620023c6565b620002be565b005b3480156200011d57600080fd5b506200010e62000600565b6200013f6200013936600462002235565b62000643565b6040516200014e91906200270e565b60405180910390f35b3480156200016457600080fd5b506200016f62000871565b6040516200014e9190620027ea565b3480156200018b57600080fd5b506200016f6200088a565b348015620001a357600080fd5b506200010e62000890565b348015620001bb57600080fd5b506200010e620001cd366004620021f8565b620008d3565b348015620001e057600080fd5b506200013f62000a1a565b348015620001f857600080fd5b506200016f6200020a366004620021ba565b62000a29565b3480156200021d57600080fd5b506200010e6200022f366004620022ea565b62000a3b565b3480156200024257600080fd5b506200024d62000c7e565b6040516200014e9190620027a6565b3480156200026957600080fd5b506200016f6200027b366004620021ba565b62000c83565b3480156200028e57600080fd5b506200013f62000c9e565b348015620002a657600080fd5b506200013f620002b8366004620021ba565b62000cad565b42841015620002ea5760405162461bcd60e51b8152600401620002e19062002b1e565b60405180910390fd5b620002f462001fa8565b506040805160a08101825284516001600160a01b0390811682526020808701519083015285830151928201839052606080870151908301526080808701519091169082015290620003595760405162461bcd60e51b8152600401620002e19062002942565b6000620003668862000cd4565b9050600062000405600154620003ff604051806101600160405280866001600160a01b03168152602001306001600160a01b031681526020013481526020018d81526020018c81526020018b815260200187600001516001600160a01b0316815260200187602001518152602001876040015181526020018760600151815260200187608001516001600160a01b031681525062000d36565b62000dc9565b905062000414828a8662000e1a565b620004335760405162461bcd60e51b8152600401620002e19062002acb565b6200044681858763ffffffff62000edb16565b620004655760405162461bcd60e51b8152600401620002e19062002bb7565b6200047282898362000fc9565b3415620004995762000497345a6001600160a01b038516919063ffffffff620010d516565b505b620004d261ea60603f620004bc604087604001516200111590919063ffffffff16565b81620004c457fe5b049063ffffffff6200114e16565b5a1015620004f45760405162461bcd60e51b8152600401620002e19062002b67565b60005a905060006060306001600160a01b031686604001518d6040516200051c91906200256d565b60006040518083038160008787f1925050503d80600081146200055c576040519150601f19603f3d011682016040523d82523d6000602084013e62000561565b606091505b50915091505a604087015193039283106200058157856040015162000583565b825b9250846001600160a01b0316336001600160a01b03167f4d3367ceeab65bf3b68cc4658d780a0f6e4101b2475aa8b6658c2df7851e12bb8d87878787604051620005d295949392919062002c09565b60405180910390a3602086015115620005f257620005f285878562001174565b505050505050505050505050565b336200060c816200124b565b6040516001600160a01b038216907f0cc43938d137e7efade6a531f663e78c1fc75257b0d65ffda2fdaf70cb49cdf990600090a250565b6000805415620006675760405162461bcd60e51b8152600401620002e190620028bf565b60016000558733301480620006845750336001600160a01b038216145b620006a35760405162461bcd60e51b8152600401620002e1906200290b565b600254600454620006c3916001600160a01b0390811691168b30620012f2565b91508160005b848110156200076457816001600160a01b0316631ed86f19878784818110620006ee57fe5b9050602002016020810190620007059190620021ba565b6040518263ffffffff1660e01b81526004016200072391906200270e565b600060405180830381600087803b1580156200073e57600080fd5b505af115801562000753573d6000803e3d6000fd5b505060019092019150620006c99050565b5087156200086057600260009054906101000a90046001600160a01b03166001600160a01b0316635a6971f96040518163ffffffff1660e01b815260040160206040518083038186803b158015620007bb57600080fd5b505afa158015620007d0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007f69190620021d9565b6001600160a01b03166358086775848b8b8b8b6040518663ffffffff1660e01b81526004016200082b95949392919062002745565b600060405180830381600087803b1580156200084657600080fd5b505af11580156200085b573d6000803e3d6000fd5b505050505b505060008055979650505050505050565b6040516200087f906200261a565b604051809103902081565b60015481565b336200089c8162001556565b6040516001600160a01b038216907f749cb6b4c510bc468cf6b9c2086d6f0a54d6b18e25d37bf3200e68eab0880c0090600090a250565b60005415620008f65760405162461bcd60e51b8152600401620002e190620028bf565b60016000558133301480620009905750806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200094057600080fd5b505afa15801562000955573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200097b9190620021d9565b6001600160a01b0316336001600160a01b0316145b620009af5760405162461bcd60e51b8152600401620002e19062002a94565b604051631ed86f1960e01b81526001600160a01b03841690631ed86f1990620009dd9085906004016200270e565b600060405180830381600087803b158015620009f857600080fd5b505af115801562000a0d573d6000803e3d6000fd5b5050600080555050505050565b6004546001600160a01b031681565b60036020526000908152604090205481565b6000541562000a5e5760405162461bcd60e51b8152600401620002e190620028bf565b60016000908155600254604080516306a32ffd60e01b815290516001600160a01b03909216916306a32ffd91600480820192602092909190829003018186803b15801562000aab57600080fd5b505afa15801562000ac0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ae69190620021d9565b905060005b8281101562000c7457600084848381811062000b0357fe5b905060200201602081019062000b1a9190620021ba565b90506001600160a01b03811662000b52574762000b4a815a6001600160a01b038716919063ffffffff620010d516565b505062000c6a565b6040516370a0823160e01b81526000906001600160a01b038316906370a082319062000b839030906004016200270e565b60206040518083038186803b15801562000b9c57600080fd5b505afa15801562000bb1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bd79190620024c3565b9050801562000c685760405163a9059cbb60e01b81526001600160a01b0383169063a9059cbb9062000c1090879085906004016200278d565b602060405180830381600087803b15801562000c2b57600080fd5b505af115801562000c40573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c6691906200232e565b505b505b5060010162000aeb565b5050600080555050565b606090565b6001600160a01b031660009081526003602052604090205490565b6002546001600160a01b031681565b600062000cce62000cbe83620015f8565b62000cc86200160d565b62001639565b92915050565b60006308c077a560e11b62000ce98362001648565b6001600160e01b0319161462000d135760405162461bcd60e51b8152600401620002e190620028e3565b600062000d228360006200165c565b905062000d2f8162000cad565b9392505050565b600060405162000d46906200261a565b604051809103902082600001518360200151846040015185606001518051906020012086608001518760a001518860c001518960e001518a61010001518b61012001518c610140015160405160200162000dac9c9b9a99989796959493929190620027f3565b604051602081830303815290604052805190602001209050919050565b600060405180604001604052806002815260200161190160f01b815250838360405160200162000dfc939291906200258b565b60405160208183030381529060405280519060200120905092915050565b60008062000e288462001648565b90506001600160e01b031981166316876e3160e21b141562000ecd5762000ec4856001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801562000e8257600080fd5b505afa15801562000e97573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ebd9190620021d9565b8462001676565b91505062000d2f565b62000ec485828686620016b7565b6000815183511462000f015760405162461bcd60e51b8152600401620002e1906200296d565b6000805b845181101562000fbd57816001600160a01b031685828151811062000f2657fe5b60200260200101516001600160a01b03161162000f575760405162461bcd60e51b8152600401620002e19062002a13565b84818151811062000f6457fe5b6020026020010151915062000fa38686838151811062000f8057fe5b602002602001015186848151811062000f9557fe5b602002602001015162001739565b62000fb45760009250505062000d2f565b60010162000f05565b50600195945050505050565b8162001053576001600160a01b038316600090815260036020908152604080832084845260010190915290205460ff1615620010195760405162461bcd60e51b8152600401620002e19062002b91565b6001600160a01b03831660009081526003602090815260408083208484526001908101909252909120805460ff19169091179055620010d0565b6001600160a01b03831660009081526003602052604090205482116200108d5760405162461bcd60e51b8152600401620002e190620029c3565b43608083901c1115620010b45760405162461bcd60e51b8152600401620002e19062002a42565b6001600160a01b03831660009081526003602052604090208290555b505050565b6000620010f36001600160a01b038516848463ffffffff6200187d16565b90508062000d2f5760405162461bcd60e51b8152600401620002e19062002999565b8181028215806200112f5750818382816200112c57fe5b04145b62000cce5760405162461bcd60e51b8152600401620002e19062002be3565b8181018281101562000cce5760405162461bcd60e51b8152600401620002e19062002af8565b6000620011a58360200151620011988560600151856200114e90919063ffffffff16565b9063ffffffff6200111516565b9050620011b88484600001518362001912565b60808301516000906001600160a01b031615620011da578360800151620011dc565b335b84519091506001600160a01b031662001213576200120c8582846040518060200160405280600081525062001ab5565b5062001244565b62001225858560000151838562001b50565b620012445760405162461bcd60e51b8152600401620002e19062002a6b565b5050505050565b8060606200125862000c7e565b905060005b8151811015620012ec57826001600160a01b031663b149206e8383815181106200128357fe5b6020026020010151306040518363ffffffff1660e01b8152600401620012ab92919062002873565b600060405180830381600087803b158015620012c657600080fd5b505af1158015620012db573d6000803e3d6000fd5b5050600190920191506200125d9050565b50505050565b6000620013136200130384620015f8565b6200130d6200160d565b62001bee565b604051631b2ce7f360e11b81529091506001600160a01b03821690633659cfe690620013449087906004016200270e565b600060405180830381600087803b1580156200135f57600080fd5b505af115801562001374573d6000803e3d6000fd5b50506040516378b9ce5760e11b81526001600160a01b038416925063f1739cae9150620013a69084906004016200270e565b600060405180830381600087803b158015620013c157600080fd5b505af1158015620013d6573d6000803e3d6000fd5b50506040516377b8b1c760e01b81526001600160a01b03841692506377b8b1c791506200140c9088908790879060040162002722565b600060405180830381600087803b1580156200142757600080fd5b505af11580156200143c573d6000803e3d6000fd5b50505050846001600160a01b031663ab7aa6ad6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200147a57600080fd5b505afa1580156200148f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014b59190620021d9565b6001600160a01b031663779beedf826040518263ffffffff1660e01b8152600401620014e291906200270e565b600060405180830381600087803b158015620014fd57600080fd5b505af115801562001512573d6000803e3d6000fd5b50506040516001600160a01b038087169350841691507f5b03bfed1c14a02bdeceb5fa582eb1a5765fc0bc64ca0e6af4c20afc9487f08190600090a3949350505050565b8060606200156362000c7e565b905060005b8151811015620012ec57826001600160a01b031663b149206e8383815181106200158e57fe5b602002602001015160006040518363ffffffff1660e01b8152600401620015b792919062002873565b600060405180830381600087803b158015620015d257600080fd5b505af1158015620015e7573d6000803e3d6000fd5b505060019092019150620015689050565b60008160405160200162000dac9190620025e5565b606060405180602001620016219062001fe9565b601f1982820381018352601f90910116604052905090565b600062000d2f83833062001c26565b600062000cce828263ffffffff62001c8016565b600062000d2f836010602085020163ffffffff62001c9d16565b60008151600114801562000d2f5750826001600160a01b0316826000815181106200169d57fe5b60200260200101516001600160a01b031614905092915050565b60006001600160e01b031984166308c077a560e11b141562001717576000620016e28460006200165c565b9050620016f0818462001676565b80156200170e57506200170c866001600160a01b031662001cc1565b155b91505062001731565b60405162461bcd60e51b8152600401620002e190620028e3565b949350505050565b600080620017536001845162001ccd90919063ffffffff16565b9050600062001769848363ffffffff62001cf816565b60ff1660048111156200177857fe5b90506060620017908560008563ffffffff62001d1516565b90506004826004811115620017a157fe5b1415620017c057620017b587878362001d9a565b935050505062000d2f565b6002826004811115620017cf57fe5b14156200180157856001600160a01b0316620017ec888362001ebd565b6001600160a01b031614935050505062000d2f565b60038260048111156200181057fe5b141562001870576000876040516020016200182c9190620025b4565b604051602081830303815290604052805190602001209050866001600160a01b03166200185a828462001ebd565b6001600160a01b03161494505050505062000d2f565b6000935050505062000d2f565b6000826200188e5750600162000d2f565b6000620018a4856001600160a01b031662001fa0565b9050806001600160a01b0316848490604051620018c19062001fa0565b600060405180830381858888f193505050503d806000811462001901576040519150601f19603f3d011682016040523d82523d6000602084013e62001906565b606091505b50909695505050505050565b60008111801562001936575060006200192a62001fa3565b6001600160a01b031614155b15620010d05760025460408051632630c12f60e01b815290516000926001600160a01b031691632630c12f916004808301926020929190829003018186803b1580156200198257600080fd5b505afa15801562001997573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019bd9190620021d9565b6001600160a01b031663f182178384846040518363ffffffff1660e01b8152600401620019ec9291906200278d565b60206040518083038186803b15801562001a0557600080fd5b505afa15801562001a1a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a409190620024c3565b905062001a4c62001fa3565b6001600160a01b031663c976bd9a85836040518363ffffffff1660e01b815260040162001a7b9291906200278d565b600060405180830381600087803b15801562001a9657600080fd5b505af115801562001aab573d6000803e3d6000fd5b5050505050505050565b604051631c48add360e21b81526060906001600160a01b03861690637122b74c9062001aed9060019088908890889060040162002c38565b600060405180830381600087803b15801562001b0857600080fd5b505af115801562001b1d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001b47919081019062002350565b95945050505050565b6000606063a9059cbb60e01b848460405160240162001b719291906200278d565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091529050606062001bb6878760008562001ab5565b80519091501562001bdf578080602001905181019062001bd791906200232e565b925062001be4565b600192505b5050949350505050565b600080838351602085016000f590506001600160a01b03811662000d2f5760405162461bcd60e51b8152600401620002e19062002b3f565b8151602080840191909120604051600092839162001c55916001600160f81b03199187918a9187910162002534565b60408051808303601f1901815291905280516020909101206001600160a01b03169695505050505050565b6000816004018351101562001c9457600080fd5b50016020015190565b6000816014018351101562001cb157600080fd5b500160200151600160601b900490565b3b63ffffffff16151590565b60008282111562001cf25760405162461bcd60e51b8152600401620002e190620029ec565b50900390565b6000816001018351101562001d0c57600080fd5b50016001015190565b60608183018451101562001d2857600080fd5b60608215801562001d455760405191506020820160405262001d91565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101562001d8057805183526020928301920162001d66565b5050858452601f01601f1916604052505b50949350505050565b600060606320c13b0b60e01b8560405160200162001db99190620027ea565b60408051601f198184030181529082905262001dda91869060240162002896565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050905060006060856001600160a01b03168360405162001e2d91906200256d565b600060405180830381855afa9150503d806000811462001e6a576040519150601f19603f3d011682016040523d82523d6000602084013e62001e6f565b606091505b509150915081801562001e83575080516020145b801562001eb257506320c13b0b60e01b62001ea682600063ffffffff62001c8016565b6001600160e01b031916145b979650505050505050565b6000815160411462001ed25750600062000cce565b60208201516040830151604184015160ff167f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111562001f1a576000935050505062000cce565b8060ff16601b148062001f3057508060ff16601c145b1562001f93576001868285856040516000815260200160405260405162001f5b949392919062002855565b6020604051602081039080840390855afa15801562001f7e573d6000803e3d6000fd5b50505060206040510351935050505062000cce565b6000935050505062000cce565b90565b600090565b6040518060a0016040528060006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6105bf8062002e2e83390190565b60008083601f84011262002009578182fd5b50813567ffffffffffffffff81111562002021578182fd5b60208301915083602080830285010111156200203c57600080fd5b9250929050565b600082601f83011262002054578081fd5b81356200206b620020658262002c9c565b62002c74565b8181529150602080830190848101818402860182018710156200208d57600080fd5b60005b84811015620020b9578135620020a68162002d11565b8452928201929082019060010162002090565b505050505092915050565b600082601f830112620020d5578081fd5b8135620020e6620020658262002c9c565b818152915060208083019084810160005b84811015620020b95762002111888484358a010162002167565b84529282019290820190600101620020f7565b60008083601f84011262002136578182fd5b50813567ffffffffffffffff8111156200214e578182fd5b6020830191508360208285010111156200203c57600080fd5b600082601f83011262002178578081fd5b813562002189620020658262002cbd565b9150808252836020828501011115620021a157600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215620021cc578081fd5b813562000d2f8162002d11565b600060208284031215620021eb578081fd5b815162000d2f8162002d11565b600080604083850312156200220b578081fd5b8235620022188162002d11565b915060208301356200222a8162002d11565b809150509250929050565b60008060008060008060006080888a03121562002250578283fd5b87356200225d8162002d11565b9650602088013567ffffffffffffffff808211156200227a578485fd5b620022888b838c0162002124565b909850965060408a0135915080821115620022a1578485fd5b620022af8b838c0162002124565b909650945060608a0135915080821115620022c8578384fd5b50620022d78a828b0162001ff7565b989b979a50959850939692959293505050565b60008060208385031215620022fd578182fd5b823567ffffffffffffffff81111562002314578283fd5b620023228582860162001ff7565b90969095509350505050565b60006020828403121562002340578081fd5b8151801515811462000d2f578182fd5b60006020828403121562002362578081fd5b815167ffffffffffffffff81111562002379578182fd5b80830184601f8201126200238b578283fd5b805191506200239e620020658362002cbd565b828152856020848401011115620023b3578384fd5b62001b4783602083016020850162002ce2565b6000806000806000806101408789031215620023e0578182fd5b863567ffffffffffffffff80821115620023f8578384fd5b620024068a838b0162002167565b9750602091508189013596506040890135955089607f8a011262002428578384fd5b6200243460a062002c74565b8060608b016101008c018d8111156200244b578788fd5b875b60058110156200246c578235855293860193918601916001016200244d565b5091975050359250508082111562002482578384fd5b620024908a838b01620020c4565b9350610120890135915080821115620024a7578283fd5b50620024b689828a0162002043565b9150509295509295509295565b600060208284031215620024d5578081fd5b5051919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b600081518084526200252081602086016020860162002ce2565b601f01601f19169290920160200192915050565b6001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b600082516200258181846020870162002ce2565b9190910192915050565b600084516200259f81846020890162002ce2565b91909101928352506020820152604001919050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6e2ba0a62622aa2fa1a922a0aa24a7a760891b815260609190911b6bffffffffffffffffffffffff1916600f82015260230190565b7f4d6574615472616e73616374696f6e28616464726573732077616c6c65742c6181527f646472657373206d6f64756c652c75696e743235362076616c75652c6279746560208201527f7320646174612c75696e74323536206e6f6e63652c75696e743235362076616c60408201527f6964556e74696c2c6164647265737320676173546f6b656e2c75696e7432353660608201527f2067617350726963652c75696e74323536206761734c696d69742c75696e743260808201527f3536206761734f766572686561642c616464726573732066656552656369706960a082015263656e742960e01b60c082015260c40190565b6001600160a01b0391909116815260200190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b03861681526060602082018190526000906200276c9083018688620024dc565b828103604084015262002781818587620024dc565b98975050505050505050565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015620019065783516001600160e01b03191683529284019291840191600101620027c2565b90815260200190565b9b8c526001600160a01b039a8b1660208d0152988a1660408c015260608b019790975260808a019590955260a089019390935260c0880191909152851660e0870152610100860152610120850152610140840152166101608201526101800190565b93845260ff9290921660208401526040830152606082015260800190565b6001600160e01b03199290921682526001600160a01b0316602082015260400190565b600060408252620028ab604083018562002506565b828103602084015262001b47818562002506565b6020808252600a90820152695245454e5452414e435960b01b604082015260600190565b6020808252600e908201526d1253959053125117d351551213d160921b604082015260600190565b60208082526018908201527f4e4f545f46524f4d5f4d45544154585f4f525f4f574e45520000000000000000604082015260600190565b6020808252601190820152701253959053125117d1d054d7d312535255607a1b604082015260600190565b6020808252601290820152714241445f5349474e41545552455f4441544160701b604082015260600190565b60208082526010908201526f5452414e534645525f4641494c55524560801b604082015260600190565b6020808252600f908201526e1393d390d157d513d3d7d4d3505313608a1b604082015260600190565b6020808252600d908201526c5355425f554e444552464c4f5760981b604082015260600190565b60208082526015908201527424a72b20a624a22fa9a4a3a722a929afa7a92222a960591b604082015260600190565b6020808252600f908201526e4e4f4e43455f544f4f5f4c4152474560881b604082015260600190565b6020808252600f908201526e1514905394d1915497d19052531151608a1b604082015260600190565b6020808252601f908201527f4e4f545f46524f4d5f4d45544154585f4f525f57414c4c45545f4f574e455200604082015260600190565b60208082526013908201527213515510551617d5539055551213d492569151606a1b604082015260600190565b6020808252600c908201526b4144445f4f564552464c4f5760a01b604082015260600190565b6020808252600790820152661156141254915160ca1b604082015260600190565b6020808252600e908201526d10d4915055114c97d1905253115160921b604082015260600190565b60208082526010908201526f494e53554646494349454e545f47415360801b604082015260600190565b6020808252600c908201526b0929cac82989288be9082a6960a31b604082015260600190565b602080825260129082015271494e56414c49445f5349474e41545552455360701b604082015260600190565b6020808252600c908201526b4d554c5f4f564552464c4f5760a01b604082015260600190565b6000868252856020830152846040830152831515606083015260a0608083015262001eb260a083018462002506565b600060ff8616825260018060a01b03851660208301528360408301526080606083015262002c6a608083018462002506565b9695505050505050565b60405181810167ffffffffffffffff8111828210171562002c9457600080fd5b604052919050565b600067ffffffffffffffff82111562002cb3578081fd5b5060209081020190565b600067ffffffffffffffff82111562002cd4578081fd5b50601f01601f191660200190565b60005b8381101562002cff57818101518382015260200162002ce5565b83811115620012ec5750506000910152565b6001600160a01b038116811462002d2757600080fd5b50565b604051600090469062002d3d9062002d97565b604051809103902083600001518051906020012084602001518051906020012083866040015160405160200162002d7995949392919062002e01565b60405160208183030381529060405280519060200120915050919050565b7f454950373132446f6d61696e28737472696e67206e616d652c737472696e672081527f76657273696f6e2c75696e7432353620636861696e49642c6164647265737320602082015271766572696679696e67436f6e74726163742960701b604082015260520190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a0019056fe608060405234801561001057600080fd5b50610023336001600160e01b0361002816565b61006f565b600060405161003690610046565b6040519081900390209190915550565b7f6f72672e7a657070656c696e6f732e70726f78792e6f776e65720000000000008152601a0190565b6105418061007e6000396000f3fe60806040526004361061004a5760003560e01c8063025313a21461008e5780633659cfe6146100b95780634f1ef286146100db5780635c60da1b146100ee578063f1739cae14610103575b6000610054610123565b90506001600160a01b03811661006957600080fd5b60405136600082376000803683855af43d806000843e81801561008a578184f35b8184fd5b34801561009a57600080fd5b506100a3610142565b6040516100b091906104aa565b60405180910390f35b3480156100c557600080fd5b506100d96100d4366004610339565b610151565b005b6100d96100e9366004610367565b610182565b3480156100fa57600080fd5b506100a3610123565b34801561010f57600080fd5b506100d961011e366004610339565b610220565b60008060405161013290610475565b6040519081900390205492915050565b6000806040516101329061044c565b610159610142565b6001600160a01b0316336001600160a01b03161461017657600080fd5b61017f816102a1565b50565b61018a610142565b6001600160a01b0316336001600160a01b0316146101a757600080fd5b6101b082610151565b6000306001600160a01b031634836040516101cb9190610413565b60006040518083038185875af1925050503d8060008114610208576040519150601f19603f3d011682016040523d82523d6000602084013e61020d565b606091505b505090508061021b57600080fd5b505050565b610228610142565b6001600160a01b0316336001600160a01b03161461024557600080fd5b6001600160a01b03811661025857600080fd5b7f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd9610281610142565b826040516102909291906104be565b60405180910390a161017f8161030d565b60006102ab610123565b9050816001600160a01b0316816001600160a01b031614156102cc57600080fd5b6102d58261032b565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a25050565b600060405161031b9061044c565b6040519081900390209190915550565b600060405161031b90610475565b60006020828403121561034a578081fd5b81356001600160a01b0381168114610360578182fd5b9392505050565b60008060408385031215610379578081fd5b82356001600160a01b038116811461038f578182fd5b9150602083013567ffffffffffffffff808211156103ab578283fd5b81850186601f8201126103bc578384fd5b80359250818311156103cc578384fd5b6103df601f8401601f19166020016104d8565b91508282528660208483010111156103f5578384fd5b6104068360208401602084016104ff565b5080925050509250929050565b60008251815b818110156104335760208186018101518583015201610419565b818111156104415782828501525b509190910192915050565b7f6f72672e7a657070656c696e6f732e70726f78792e6f776e65720000000000008152601a0190565b7f6f72672e7a657070656c696e6f732e70726f78792e696d706c656d656e74617481526234b7b760e91b602082015260230190565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b60405181810167ffffffffffffffff811182821017156104f757600080fd5b604052919050565b8281833750600091015256fea2646970667358221220f2866cb180971be35ca8efcd1e48412813a6a7fd09f1cddee17992e9561cd86564736f6c63430006060033a2646970667358221220e5cf4d06dbb43edb1435fbb84965911afd31aa0ea79ecf5ebd75e619b44f067564736f6c63430006060033

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

000000000000000000000000728348a947b808483365bf24f5f7886f0a9786bf000000000000000000000000f8c1f5848969bac54a5cc0178e0a36504b818db9

-----Decoded View---------------
Arg [0] : _controller (address): 0x728348A947B808483365Bf24F5f7886f0a9786Bf
Arg [1] : _walletImplementation (address): 0xF8C1F5848969baC54a5cc0178e0A36504B818Db9

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000728348a947b808483365bf24f5f7886f0a9786bf
Arg [1] : 000000000000000000000000f8c1f5848969bac54a5cc0178e0a36504b818db9


Deployed Bytecode Sourcemap

145637:2791:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;9;2:12;124050:2717:0;;;;;;;;;:::i;:::-;;115081:187;;5:9:-1;2:2;;;27:1;24;17:12;2:2;115081:187:0;;;:::i;146363:965::-;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;120709:276;;5:9:-1;2:2;;;27:1;24;17:12;2:2;120709:276:0;;;:::i;:::-;;;;;;;;120994:34;;5:9:-1;2:2;;;27:1;24;17:12;2:2;120994:34:0;;;:::i;115354:193::-;;5:9:-1;2:2;;;27:1;24;17:12;2:2;115354:193:0;;;:::i;114774:221::-;;5:9:-1;2:2;;;27:1;24;17:12;2:2;-1:-1;114774:221:0;;;;;;;;:::i;145743:35::-;;5:9:-1;2:2;;;27:1;24;17:12;2:2;145743:35:0;;;:::i;121072:47::-;;5:9:-1;2:2;;;27:1;24;17:12;2:2;-1:-1;121072:47:0;;;;;;;;:::i;127208:706::-;;5:9:-1;2:2;;;27:1;24;17:12;2:2;-1:-1;127208:706:0;;;;;;;;:::i;115868:130::-;;5:9:-1;2:2;;;27:1;24;17:12;2:2;115868:130:0;;;:::i;:::-;;;;;;;;126909:141;;5:9:-1;2:2;;;27:1;24;17:12;2:2;-1:-1;126909:141:0;;;;;;;;:::i;121035:28::-;;5:9:-1;2:2;;;27:1;24;17:12;2:2;121035:28:0;;;:::i;143965:245::-;;5:9:-1;2:2;;;27:1;24;17:12;2:2;-1:-1;143965:245:0;;;;;;;;:::i;124050:2717::-;124424:3;124410:10;:17;;124402:37;;;;-1:-1:-1;;;124402:37:0;;;;;;;;;;;;;;;;;124452:30;;:::i;:::-;-1:-1:-1;124485:180:0;;;;;;;;124519:13;;-1:-1:-1;;;;;124485:180:0;;;;;124519:13;124548;;;;124485:180;;;;124576:13;;;;124485:180;;;;;;;124604:13;;;;124485:180;;;;;124640:13;;;;124485:180;;;;;;;;124676:51;;;;-1:-1:-1;;;124676:51:0;;;;;;;;;124740:14;124757:26;124778:4;124757:20;:26::i;:::-;124740:43;;124794:18;124815:538;124847:16;;124878:464;124901:426;;;;;;;;124939:6;-1:-1:-1;;;;;124901:426:0;;;;;124976:4;-1:-1:-1;;;;;124901:426:0;;;;;125004:9;124901:426;;;;125036:4;124901:426;;;;125063:5;124901:426;;;;125091:10;124901:426;;;;125124:11;:17;;;-1:-1:-1;;;;;124901:426:0;;;;;125164:11;:17;;;124901:426;;;;125204:11;:17;;;124901:426;;;;125244:11;:20;;;124901:426;;;;125287:11;:21;;;-1:-1:-1;;;;;124901:426:0;;;;124878:4;:464::i;:::-;124815:17;:538::i;:::-;124794:559;;125439:35;125452:6;125460:4;125466:7;125439:12;:35::i;:::-;125431:67;;;;-1:-1:-1;;;125431:67:0;;;;;;;;;125517:48;:10;125545:7;125554:10;125517:48;:27;:48;:::i;:::-;125509:79;;;;-1:-1:-1;;;125509:79:0;;;;;;;;;125794:45;125813:6;125821:5;125828:10;125794:18;:45::i;:::-;125934:9;:13;125930:91;;125964:45;125988:9;125999;-1:-1:-1;;;;;125964:23:0;;;:45;;:23;:45;:::i;:::-;;125930:91;126054:43;126091:5;126083:2;126055:25;126077:2;126055:11;:17;;;:21;;:25;;;;:::i;:::-;:30;;;;;;;126054:43;:36;:43;:::i;:::-;126041:9;:56;;126033:85;;;;-1:-1:-1;;;126033:85:0;;;;;;;;;126129:12;126144:9;126129:24;;126225:12;126239:23;126274:4;-1:-1:-1;;;;;126266:18:0;126290:11;:17;;;126309:4;126266:48;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;19;14:27;;;;67:4;61:11;56:16;;134:4;130:9;123:4;105:16;101:27;97:43;94:1;90:51;84:4;77:65;157:16;154:1;147:27;211:16;208:1;201:4;198:1;194:12;179:49;5:228;;14:27;32:4;27:9;;5:228;;126224:90:0;;;;126345:9;126499:17;;;;126335:19;;;126489:27;;:57;;126529:11;:17;;;126489:57;;;126519:7;126489:57;126479:67;;126591:6;-1:-1:-1;;;;;126564:83:0;126579:10;-1:-1:-1;;;;;126564:83:0;;126599:5;126606:10;126618:7;126627;126636:10;126564:83;;;;;;;;;;;;;;;;;;;126664:17;;;;:22;126660:100;;126703:45;126719:6;126727:11;126740:7;126703:15;:45::i;:::-;124050:2717;;;;;;;;;;;;:::o;115081:187::-;115187:10;115208:19;115187:10;115208:11;:19::i;:::-;115243:17;;-1:-1:-1;;;;;115243:17:0;;;;;;;;115081:187;:::o;146363:965::-;146664:15;11828:11;;:16;11820:39;;;;-1:-1:-1;;;11820:39:0;;;;;;;;;11884:1;11870:11;:15;146638:6;114334:10:::1;114356:4;114334:27;::::0;:50:::1;;-1:-1:-1::0;114365:10:0::1;-1:-1:-1::0;;;;;114365:19:0;::::1;;114334:50;114312:114;;;;-1:-1:-1::0;;;114312:114:0::1;;;;;;;;;146742:10:::2;::::0;146767:20:::2;::::0;146707:140:::2;::::0;-1:-1:-1;;;;;146742:10:0;;::::2;::::0;146767:20:::2;146802:6:::0;146831:4:::2;146707:20;:140::i;:::-;146697:150:::0;-1:-1:-1;146697:150:0;146858:8:::2;146897:93;146913:19:::0;;::::2;146897:93;;;146954:1;-1:-1:-1::0;;;;;146954:11:0::2;;146966:8;;146975:1;146966:11;;;;;;;;;;;;;;;;;;;;;;146954:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24::::0;17:12:::2;2:2;146954:24:0;;;;8:9:-1;5:2;;;45:16;42:1;39::::0;24:38:::2;77:16;74:1;67:27;5:2;-1:-1:::0;;146934:3:0::2;::::0;;::::2;::::0;-1:-1:-1;146897:93:0::2;::::0;-1:-1:-1;146897:93:0::2;;-1:-1:-1::0;147006:24:0;;147002:188:::2;;147047:10;;;;;;;;;-1:-1:-1::0;;;;;147047:10:0::2;-1:-1:-1::0;;;;;147047:21:0::2;;:23;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24::::0;17:12:::2;2:2;147047:23:0;;;;8:9:-1;5:2;;;45:16;42:1;39::::0;24:38:::2;77:16;74:1;67:27;5:2;147047:23:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;147047:23:0;;;;;;;;;-1:-1:-1::0;;;;;147047:32:0::2;;147098:7;147124:6;;147149:14;;147047:131;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24::::0;17:12:::2;2:2;147047:131:0;;;;8:9:-1;5:2;;;45:16;42:1;39::::0;24:38:::2;77:16;74:1;67:27;5:2;147047:131:0;;;;147002:188;-1:-1:-1::0;;11922:1:0;11908:15;;146363:965;;-1:-1:-1;;;;;;;146363:965:0:o;120709:276::-;120760:225;;;;;;;;;;;;;;120709:276;:::o;120994:34::-;;;;:::o;115354:193::-;115462:10;115483:21;115462:10;115483:13;:21::i;:::-;115520:19;;-1:-1:-1;;;;;115520:19:0;;;;;;;;115354:193;:::o;114774:221::-;11828:11;;:16;11820:39;;;;-1:-1:-1;;;11820:39:0;;;;;;;;;11884:1;11870:11;:15;114931:6;114103:10:::1;114125:4;114103:27;::::0;:67:::1;;;114155:6;-1:-1:-1::0;;;;;114148:20:0::1;;:22;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24::::0;17:12:::1;2:2;114148:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39::::0;24:38:::1;77:16;74:1;67:27;5:2;114148:22:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;114148:22:0;;;;;;;;;-1:-1:-1::0;;;;;114134:36:0::1;:10;-1:-1:-1::0;;;;;114134:36:0::1;;114103:67;114081:138;;;;-1:-1:-1::0;;;114081:138:0::1;;;;;;;;;114955:32:::2;::::0;-1:-1:-1;;;114955:32:0;;-1:-1:-1;;;;;114955:24:0;::::2;::::0;::::2;::::0;:32:::2;::::0;114980:6;;114955:32:::2;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24::::0;17:12:::2;2:2;114955:32:0;;;;8:9:-1;5:2;;;45:16;42:1;39::::0;24:38:::2;77:16;74:1;67:27;5:2;-1:-1:::0;;11922:1:0;11908:15;;-1:-1:-1;;;;;114774:221:0:o;145743:35::-;;;-1:-1:-1;;;;;145743:35:0;;:::o;121072:47::-;;;;;;;;;;;;;:::o;127208:706::-;11828:11;;:16;11820:39;;;;-1:-1:-1;;;11820:39:0;;;;;;;;;11884:1;11870:11;:15;;;127327:10:::1;::::0;:22:::1;::::0;;-1:-1:-1;;;127327:22:0;;;;-1:-1:-1;;;;;127327:10:0;;::::1;::::0;:20:::1;::::0;:22:::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;;:10;:22;::::1;;2:2:-1::0;::::1;;;27:1;24::::0;17:12:::1;2:2;127327:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39::::0;24:38:::1;77:16;74:1;67:27;5:2;127327:22:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;127327:22:0;;;;;;;;;127314:35:::0;-1:-1:-1;127367:6:0::1;127362:545;127379:17:::0;;::::1;127362:545;;;127418:13;127434:6;;127441:1;127434:9;;;;;;;;;;;;;;;;;;;;;;127418:25:::0;-1:-1:-1;;;;;;127462:19:0;::::1;127458:438;;127516:21;127556:38;127516:21:::0;127584:9:::1;-1:-1:-1::0;;;;;127556:19:0;::::1;::::0;:38;::::1;:19;:38;:::i;:::-;;127458:438;;;;127649:37;::::0;-1:-1:-1;;;127649:37:0;;127635:11:::1;::::0;-1:-1:-1;;;;;127649:22:0;::::1;::::0;::::1;::::0;:37:::1;::::0;127680:4:::1;::::0;127649:37:::1;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24::::0;17:12:::1;2:2;127649:37:0;;;;8:9:-1;5:2;;;45:16;42:1;39::::0;24:38:::1;77:16;74:1;67:27;5:2;127649:37:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;127649:37:0;;;;;;;;;127635:51:::0;-1:-1:-1;127709:10:0;;127705:176:::1;;127828:33;::::0;-1:-1:-1;;;127828:33:0;;-1:-1:-1;;;;;127828:21:0;::::1;::::0;::::1;::::0;:33:::1;::::0;127850:2;;127854:6;;127828:33:::1;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24::::0;17:12:::1;2:2;127828:33:0;;;;8:9:-1;5:2;;;45:16;42:1;39::::0;24:38:::1;77:16;74:1;67:27;5:2;127828:33:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;127828:33:0;;;;;;;;;;127705:176;127458:438;;-1:-1:-1::0;127398:3:0::1;;127362:545;;;-1:-1:-1::0;;11922:1:0;11908:15;;-1:-1:-1;;127208:706:0:o;115868:130::-;115960:23;115868:130;:::o;126909:141::-;-1:-1:-1;;;;;127021:15:0;126992:4;127021:15;;;:7;:15;;;;;:21;;126909:141::o;121035:28::-;;;-1:-1:-1;;;;;121035:28:0;;:::o;143965:245::-;144078:7;144110:92;144147:14;144155:5;144147:7;:14::i;:::-;144176:15;:13;:15::i;:::-;144110:22;:92::i;:::-;144103:99;143965:245;-1:-1:-1;;143965:245:0:o;148083:342::-;148200:14;-1:-1:-1;;;148240:19:0;148254:4;148240:13;:19::i;:::-;-1:-1:-1;;;;;;148240:49:0;;148232:76;;;;-1:-1:-1;;;148232:76:0;;;;;;;;;148319:13;148335:35;148362:4;148368:1;148335:26;:35::i;:::-;148319:51;;148390:27;148411:5;148390:20;:27::i;:::-;148381:36;148083:342;-1:-1:-1;;;148083:342:0:o;130993:582::-;131085:7;120760:225;;;;;;;;;;;;;;131213:3;:10;;;131242:3;:10;;;131271:3;:9;;;131309:3;:8;;;131299:19;;;;;;131337:3;:9;;;131365:3;:14;;;131398:3;:12;;;131429:3;:12;;;131460:3;:12;;;131491:3;:15;;;131525:3;:16;;;131141:415;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;131141:415:0;;;131117:450;;;;;;131110:457;;130993:582;;;:::o;106094:331::-;106231:7;106322:13;;;;;;;;;;;;;-1:-1:-1;;;106322:13:0;;;106354:10;106383:8;106287:119;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;106287:119:0;;;106263:154;;;;;;106256:161;;106094:331;;;;:::o;132510:453::-;132686:4;132708:13;132724:19;132738:4;132724:13;:19::i;:::-;132708:35;-1:-1:-1;;;;;;;132758:33:0;;-1:-1:-1;;;132758:33:0;132754:202;;;132815:45;132835:6;-1:-1:-1;;;;;132828:20:0;;:22;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;132828:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;132828:22:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;132828:22:0;;;;;;;;;132852:7;132815:12;:45::i;:::-;132808:52;;;;;132754:202;132900:44;132914:6;132922;132930:4;132936:7;132900:13;:44::i;107739:630::-;107928:4;107976:10;:17;107958:7;:14;:35;107950:66;;;;-1:-1:-1;;;107950:66:0;;;;;;;;;108027:18;;108056:284;108077:7;:14;108073:1;:18;108056:284;;;108134:10;-1:-1:-1;;;;;108121:23:0;:7;108129:1;108121:10;;;;;;;;;;;;;;-1:-1:-1;;;;;108121:23:0;;108113:57;;;;-1:-1:-1;;;108113:57:0;;;;;;;;;108198:7;108206:1;108198:10;;;;;;;;;;;;;;108185:23;;108228:52;108244:8;108254:7;108262:1;108254:10;;;;;;;;;;;;;;108266;108277:1;108266:13;;;;;;;;;;;;;;108228:15;:52::i;:::-;108223:106;;108308:5;108301:12;;;;;;108223:106;108093:3;;108056:284;;;-1:-1:-1;108357:4:0;;107739:630;-1:-1:-1;;;;;107739:630:0:o;133254:533::-;133408:10;133404:376;;-1:-1:-1;;;;;133444:15:0;;;;;;:7;:15;;;;;;;;:38;;;:26;;:38;;;;;;;;133443:39;133435:64;;;;-1:-1:-1;;;133435:64:0;;;;;;;;;-1:-1:-1;;;;;133514:15:0;;;;;;:7;:15;;;;;;;;:38;;;133555:4;133514:26;;;:38;;;;;;:45;;-1:-1:-1;;133514:45:0;;;;;;133404:376;;;-1:-1:-1;;;;;133608:15:0;;;;;;:7;:15;;;;;:21;133600:29;;133592:57;;;;-1:-1:-1;;;133592:57:0;;;;;;;;;133691:12;133682:3;133673:5;:12;;133672:32;;133664:60;;;;-1:-1:-1;;;133664:60:0;;;;;;;;;-1:-1:-1;;;;;133739:15:0;;;;;;:7;:15;;;;;:29;;;133404:376;133254:533;;;:::o;39853:269::-;39999:12;40039:28;-1:-1:-1;;;;;40039:10:0;;40050:6;40058:8;40039:28;:10;:28;:::i;:::-;40029:38;;40086:7;40078:36;;;;-1:-1:-1;;;40078:36:0;;;;;;;;37308:205;37444:5;;;37468:6;;;:20;;;37487:1;37482;37478;:5;;;;;;:10;37468:20;37460:45;;;;-1:-1:-1;;;37460:45:0;;;;;;;;37722:191;37858:5;;;37882:6;;;;37874:31;;;;-1:-1:-1;;;37874:31:0;;;;;;;;131745:718;131914:12;131929:56;131967:11;:17;;;131929:33;131941:11;:20;;;131929:7;:11;;:33;;;;:::i;:::-;:37;:56;:37;:56;:::i;:::-;131914:71;;131996:47;132008:6;132016:11;:17;;;132035:7;131996:11;:47::i;:::-;132080:21;;;;132056:20;;-1:-1:-1;;;;;132080:35:0;;132079:74;;132132:11;:21;;;132079:74;;;132119:10;132079:74;132168:17;;132056:97;;-1:-1:-1;;;;;;132168:31:0;132164:292;;132216:47;132229:6;132237:12;132251:7;132216:47;;;;;;;;;;;;:12;:47::i;:::-;;132164:292;;;132322:71;132344:6;132352:11;:17;;;132371:12;132385:7;132322:21;:71::i;:::-;132296:148;;;;-1:-1:-1;;;132296:148:0;;;;;;;;;131745:718;;;;;:::o;116108:276::-;116197:6;116215:23;116241:17;:15;:17::i;:::-;116215:43;-1:-1:-1;116274:6:0;116269:108;116290:7;:14;116286:1;:18;116269:108;;;116326:1;-1:-1:-1;;;;;116326:12:0;;116339:7;116347:1;116339:10;;;;;;;;;;;;;;116359:4;116326:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;116326:39:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;116306:3:0;;;;;-1:-1:-1;116269:108:0;;-1:-1:-1;116269:108:0;;;116108:276;;;:::o;144218:692::-;144431:23;144512:48;144527:15;144535:6;144527:7;:15::i;:::-;144544;:13;:15::i;:::-;144512:14;:48::i;:::-;144573:59;;-1:-1:-1;;;144573:59:0;;144502:58;;-1:-1:-1;;;;;;144573:42:0;;;;;:59;;144616:15;;144573:59;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;144573:59:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;144643:64:0;;-1:-1:-1;;;144643:64:0;;-1:-1:-1;;;;;144643:55:0;;;-1:-1:-1;144643:55:0;;-1:-1:-1;144643:64:0;;144667:7;;144643:64;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;144643:64:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;144720:69:0;;-1:-1:-1;;;144720:69:0;;-1:-1:-1;;;;;144720:21:0;;;-1:-1:-1;144720:21:0;;-1:-1:-1;144720:69:0;;144750:11;;144764:6;;144772:16;;144720:69;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;144720:69:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;144720:69:0;;;;144802:11;-1:-1:-1;;;;;144802:26:0;;:28;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;144802:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;144802:28:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;144802:28:0;;;;;;;;;-1:-1:-1;;;;;144802:43:0;;144846:7;144802:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;144802:52:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;144872:30:0;;-1:-1:-1;;;;;144872:30:0;;;;-1:-1:-1;144872:30:0;;;-1:-1:-1;144872:30:0;;;;;144218:692;;;;;;:::o;116449:275::-;116540:6;116558:23;116584:17;:15;:17::i;:::-;116558:43;-1:-1:-1;116617:6:0;116612:105;116633:7;:14;116629:1;:18;116612:105;;;116669:1;-1:-1:-1;;;;;116669:12:0;;116682:7;116690:1;116682:10;;;;;;;;;;;;;;116702:1;116669:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;116669:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;116649:3:0;;;;;-1:-1:-1;116612:105:0;;-1:-1:-1;116612:105:0;144918:200;145020:12;145103:5;145067:42;;;;;;;;;145126:162;145201:12;145238:42;;;;;;;;:::i;:::-;-1:-1:-1;;21:26;;;;;7:41;;87:2;69:12;;;65:26;61:2;54:38;34:5;-1:-1;145126:162:0;:::o;142703:164::-;142787:7;142814:45;142829:4;142835:8;142853:4;142814:14;:45::i;131583:154::-;131675:13;131713:16;:4;131675:13;131713:16;:13;:16;:::i;129478:241::-;129632:12;129669:42;:4;129684:26;129688:2;:17;;129684:26;129669:42;:14;:42;:::i;128707:213::-;128838:4;128868:7;:14;128886:1;128868:19;:43;;;;;128905:6;-1:-1:-1;;;;;128891:20:0;:7;128899:1;128891:10;;;;;;;;;;;;;;-1:-1:-1;;;;;128891:20:0;;128860:52;;128707:213;;;;:::o;147336:739::-;147559:4;-1:-1:-1;;;;;;147585:36:0;;-1:-1:-1;;;147585:36:0;147581:487;;;147862:19;147884:35;147911:4;147917:1;147884:26;:35::i;:::-;147862:57;;147941:34;147954:11;147967:7;147941:12;:34::i;:::-;:58;;;;;147980:19;:6;-1:-1:-1;;;;;147980:17:0;;:19::i;:::-;147979:20;147941:58;147934:65;;;;;147581:487;148032:24;;-1:-1:-1;;;148032:24:0;;;;;;;;147581:487;147336:739;;;;;;:::o;108377:1003::-;108550:4;108572:24;108599:23;108620:1;108599:9;:16;:20;;:23;;;;:::i;:::-;108572:50;-1:-1:-1;108633:27:0;108677:38;:9;108572:50;108677:38;:17;:38;:::i;:::-;108663:53;;;;;;;;;;108633:83;-1:-1:-1;108729:21:0;108753:39;:9;108769:1;108772:19;108753:39;:15;:39;:::i;:::-;108729:63;-1:-1:-1;108826:20:0;108809:13;:37;;;;;;;;;108805:568;;;108870:50;108893:8;108903:6;108911:8;108870:22;:50::i;:::-;108863:57;;;;;;;108805:568;108959:21;108942:13;:38;;;;;;;;;108938:435;;;109046:6;-1:-1:-1;;;;;109004:48:0;:38;109023:8;109033;109004:18;:38::i;:::-;-1:-1:-1;;;;;109004:48:0;;108997:55;;;;;;;108938:435;109091:22;109074:13;:39;;;;;;;;;109070:303;;;109130:12;109226:8;109173:62;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;109173:62:0;;;109145:105;;;;;;109130:120;;109310:6;-1:-1:-1;;;;;109272:44:0;:34;109291:4;109297:8;109272:18;:34::i;:::-;-1:-1:-1;;;;;109272:44:0;;109265:51;;;;;;;;109070:303;109356:5;109349:12;;;;;;;39303:395;39440:12;39474:11;39470:55;;-1:-1:-1;39509:4:0;39502:11;;39470:55;39535:25;39563:14;:2;-1:-1:-1;;;;;39563:12:0;;:14::i;:::-;39535:42;;39642:9;-1:-1:-1;;;;;39642:14:0;39664:6;39677:8;39642:48;;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;19;14:27;;;;67:4;61:11;56:16;;134:4;130:9;123:4;105:16;101:27;97:43;94:1;90:51;84:4;77:65;157:16;154:1;147:27;211:16;208:1;201:4;198:1;194:12;179:49;5:228;;14:27;32:4;27:9;;5:228;-1:-1;39628:62:0;;39303:395;-1:-1:-1;;;;;;39303:395:0:o;133795:356::-;133948:1;133939:6;:10;:40;;;;-1:-1:-1;133977:1:0;133953:12;:10;:12::i;:::-;-1:-1:-1;;;;;133953:26:0;;;133939:40;133935:209;;;134009:10;;:24;;;-1:-1:-1;;;134009:24:0;;;;133996:10;;-1:-1:-1;;;;;134009:10:0;;:22;;:24;;;;;;;;;;;;;;:10;:24;;;2:2:-1;;;;27:1;24;17:12;2:2;134009:24:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;134009:24:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;134009:24:0;;;;;;;;;-1:-1:-1;;;;;134009:35:0;;134045:5;134052:6;134009:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;134009:50:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;134009:50:0;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;134009:50:0;;;;;;;;;133996:63;;134085:12;:10;:12::i;:::-;-1:-1:-1;;;;;134074:43:0;;134118:6;134126:5;134074:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;134074:58:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;134074:58:0;;;;133935:209;133795:356;;;:::o;116732:264::-;116938:50;;-1:-1:-1;;;116938:50:0;;116901:12;;-1:-1:-1;;;;;116938:23:0;;;;;:50;;116968:1;;116972:2;;116976:5;;116983:4;;116938:50;;;;;;;;;;;;;;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;116938:50:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;116938:50:0;;;;;;39:16:-1;36:1;17:17;2:54;101:4;116938:50:0;80:15:-1;;;-1:-1;;76:31;65:43;;120:4;113:20;116938:50:0;;;;;;;;;116931:57;116732:264;-1:-1:-1;;;;;116732:264:0:o;117085:838::-;117258:12;117288:19;117347:26;;;117388:2;117405:6;117310:112;;;;;;;;;;;;;;-1:-1:-1;;26:21;;;22:32;6:49;;117310:112:0;;;49:4:-1;25:18;;61:17;;-1:-1;;;;;182:15;-1:-1;;;;;;117310:112:0;;;179:29:-1;;;;160:49;;;117310:112:0;-1:-1:-1;117433:23:0;117459:38;117472:6;117480:5;-1:-1:-1;117310:112:0;117459:12;:38::i;:::-;117688:17;;117433:64;;-1:-1:-1;117688:21:0;117684:232;;117747:10;117736:30;;;;;;;;;;;;;;117726:40;;117684:232;;;117900:4;117890:14;;117684:232;117085:838;;;;;;;;:::o;142128:369::-;142199:15;142227:20;142396:4;142385:8;142379:15;142372:4;142362:8;142358:19;142355:1;142347:54;142339:62;-1:-1:-1;;;;;;142430:18:0;;142422:45;;;;-1:-1:-1;;;142422:45:0;;;;;;;;143116:357;143269:23;;;;;;;;;;143343:64;;143222:7;;;;143343:64;;-1:-1:-1;;;;;;143360:12:0;143374:8;;143384:4;;143269:23;;143343:64;;;;;;;26:21:-1;;;-1:-1;;22:32;6:49;;143343:64:0;;;143319:99;;49:4:-1;143319:99:0;;;;-1:-1:-1;;;;;143436:29:0;;143116:357;-1:-1:-1;;;;;;143116:357:0:o;31705:297::-;31781:6;31826;31835:1;31826:10;31808:6;:13;:29;;31800:38;;12:1:-1;9;2:12;31800:38:0;-1:-1:-1;31923:30:0;31939:4;31923:30;31917:37;;31705:297::o;29268:338::-;29345:7;29391:6;29400:2;29391:11;29373:6;:13;:30;;29365:39;;12:1:-1;9;2:12;29365:39:0;-1:-1:-1;29496:30:0;29512:4;29496:30;29490:37;-1:-1:-1;;;29486:71:0;;;29268:338::o;38750:221::-;38917:17;38954:8;;;;;38750:221::o;37521:193::-;37629:4;37664:1;37659;:6;;37651:32;;;;-1:-1:-1;;;37651:32:0;;;;;;;;;-1:-1:-1;37701:5:0;;;37521:193::o;29614:287::-;29689:5;29733:6;29742:1;29733:10;29715:6;:13;:29;;29707:38;;12:1:-1;9;2:12;29707:38:0;-1:-1:-1;29825:29:0;29841:3;29825:29;29819:36;;29614:287::o;26661:2599::-;26808:12;26873:7;26864:6;:16;26846:6;:13;:35;;26838:44;;12:1:-1;9;2:12;26838:44:0;26895:22;26961:15;;26990:2005;;;;29139:4;29133:11;29120:24;;29192:4;29181:9;29177:20;29171:4;29164:34;26954:2259;;26990:2005;27175:4;27169:11;27156:24;;27844:2;27835:7;27831:16;28232:9;28225:17;28219:4;28215:28;28203:9;28192;28188:25;28184:60;28281:7;28277:2;28273:16;28538:6;28524:9;28517:17;28511:4;28507:28;28495:9;28487:6;28483:22;28479:57;28475:70;28309:434;28572:3;28568:2;28565:11;28309:434;;;28714:9;;28703:21;;28614:4;28606:13;;;;28647;28309:434;;;-1:-1:-1;;28763:26:0;;;28975:2;28958:11;-1:-1:-1;;28954:25:0;28948:4;28941:39;-1:-1:-1;26954:2259:0;-1:-1:-1;29243:9:0;26661:2599;-1:-1:-1;;;;26661:2599:0:o;109388:595::-;109566:4;109588:21;109649:36;;;109711:8;109700:20;;;;;;;;;;;;;-1:-1:-1;;26:21;;;22:32;6:49;;109700:20:0;;;;109612:143;;109735:9;;109612:143;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;109612:143:0;;;;-1:-1:-1;;;;;109612:143:0;;38:4:-1;29:7;25:18;67:10;61:17;-1:-1;;;;;199:8;192:4;186;182:15;179:29;167:10;160:49;0:215;;;109612:143:0;109588:167;;109767:12;109781:19;109804:6;-1:-1:-1;;;;;109804:17:0;109822:8;109804:27;;;;;;;;;;;;;;;;;;;;;;12:1:-1;19;14:27;;;;67:4;61:11;56:16;;134:4;130:9;123:4;105:16;101:27;97:43;94:1;90:51;84:4;77:65;157:16;154:1;147:27;211:16;208:1;201:4;198:1;194:12;179:49;5:228;;14:27;32:4;27:9;;5:228;;109766:65:0;;;;109864:7;:43;;;;;109888:6;:13;109905:2;109888:19;109864:43;:100;;;;-1:-1:-1;;;;109924:18:0;:6;109940:1;109924:18;:15;:18;:::i;:::-;-1:-1:-1;;;;;;109924:40:0;;109864:100;109842:133;109388:595;-1:-1:-1;;;;;;;109388:595:0:o;109991:1116::-;110145:7;110174:9;:16;110194:2;110174:22;110170:72;;-1:-1:-1;110228:1:0;110213:17;;110170:72;110579:4;110564:20;;110558:27;110625:4;110610:20;;110604:27;110675:4;110660:20;;110654:27;110683:4;110650:38;110842:66;110829:79;;110825:129;;;110940:1;110925:17;;;;;;;110825:129;110968:1;:7;;110973:2;110968:7;:18;;;;110979:1;:7;;110984:2;110979:7;110968:18;110964:136;;;111010:28;111020:8;111030:1;111033;111036;111010:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;111010:28:0;;;;;;;;111003:35;;;;;;;110964:136;111086:1;111071:17;;;;;;;38979:173;39138:4;38979:173::o;121745:139::-;121834:7;121745:139;:::o;145637:2791::-;;;;;;;;;;-1:-1:-1;;;;;145637:2791:0;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;145637:2791:0;;;;;:::o;:::-;;;;;;;;:::o;301:352:-1:-;;;431:3;424:4;416:6;412:17;408:27;398:2;;-1:-1;;439:12;398:2;-1:-1;469:20;;509:18;498:30;;495:2;;;-1:-1;;531:12;495:2;575:4;567:6;563:17;551:29;;626:3;575:4;;610:6;606:17;567:6;592:32;;589:41;586:2;;;643:1;;633:12;586:2;391:262;;;;;;679:707;;796:3;789:4;781:6;777:17;773:27;763:2;;-1:-1;;804:12;763:2;851:6;838:20;873:80;888:64;945:6;888:64;;;873:80;;;981:21;;;864:89;-1:-1;1025:4;1038:14;;;;1013:17;;;1127;;;1118:27;;;;1115:36;-1:-1;1112:2;;;1164:1;;1154:12;1112:2;1189:1;1174:206;1199:6;1196:1;1193:13;1174:206;;;85:6;72:20;97:33;124:5;97:33;;;1267:50;;1331:14;;;;1359;;;;1221:1;1214:9;1174:206;;;1178:14;;;;;756:630;;;;;1410:705;;1536:3;1529:4;1521:6;1517:17;1513:27;1503:2;;-1:-1;;1544:12;1503:2;1591:6;1578:20;1613:89;1628:73;1694:6;1628:73;;1613:89;1730:21;;;1604:98;-1:-1;1774:4;1787:14;;;;1762:17;;;1882:1;1867:242;1892:6;1889:1;1886:13;1867:242;;;1999:46;2041:3;1774:4;1975:3;1962:17;1766:6;1950:30;;1999:46;;;1987:59;;2060:14;;;;2088;;;;1914:1;1907:9;1867:242;;2915:336;;;3029:3;3022:4;3014:6;3010:17;3006:27;2996:2;;-1:-1;;3037:12;2996:2;-1:-1;3067:20;;3107:18;3096:30;;3093:2;;;-1:-1;;3129:12;3093:2;3173:4;3165:6;3161:17;3149:29;;3224:3;3173:4;3204:17;3165:6;3190:32;;3187:41;3184:2;;;3241:1;;3231:12;3260:440;;3361:3;3354:4;3346:6;3342:17;3338:27;3328:2;;-1:-1;;3369:12;3328:2;3416:6;3403:20;3438:64;3453:48;3494:6;3453:48;;3438:64;3429:73;;3522:6;3515:5;3508:21;3626:3;3558:4;3617:6;3550;3608:16;;3605:25;3602:2;;;3643:1;;3633:12;3602:2;47430:6;3558:4;3550:6;3546:17;3558:4;3584:5;3580:16;47407:30;47486:1;47468:16;;;3558:4;47468:16;47461:27;3584:5;3321:379;-1:-1;;3321:379;5356:241;;5460:2;5448:9;5439:7;5435:23;5431:32;5428:2;;;-1:-1;;5466:12;5428:2;85:6;72:20;97:33;124:5;97:33;;5604:263;;5719:2;5707:9;5698:7;5694:23;5690:32;5687:2;;;-1:-1;;5725:12;5687:2;226:6;220:13;238:33;265:5;238:33;;5874:366;;;5995:2;5983:9;5974:7;5970:23;5966:32;5963:2;;;-1:-1;;6001:12;5963:2;85:6;72:20;97:33;124:5;97:33;;;6053:63;-1:-1;6153:2;6192:22;;72:20;97:33;72:20;97:33;;;6161:63;;;;5957:283;;;;;;6247:1023;;;;;;;;6476:3;6464:9;6455:7;6451:23;6447:33;6444:2;;;-1:-1;;6483:12;6444:2;85:6;72:20;97:33;124:5;97:33;;;6535:63;-1:-1;6663:2;6648:18;;6635:32;6687:18;6676:30;;;6673:2;;;-1:-1;;6709:12;6673:2;6747:65;6804:7;6795:6;6784:9;6780:22;6747:65;;;6737:75;;-1:-1;6737:75;-1:-1;6877:2;6862:18;;6849:32;;-1:-1;6890:30;;;6887:2;;;-1:-1;;6923:12;6887:2;6961:64;7017:7;7008:6;6997:9;6993:22;6961:64;;;6951:74;;-1:-1;6951:74;-1:-1;7090:2;7075:18;;7062:32;;-1:-1;7103:30;;;7100:2;;;-1:-1;;7136:12;7100:2;;7174:80;7246:7;7237:6;7226:9;7222:22;7174:80;;;6438:832;;;;-1:-1;6438:832;;-1:-1;6438:832;;;;7164:90;;-1:-1;;;6438:832;7277:397;;;7416:2;7404:9;7395:7;7391:23;7387:32;7384:2;;;-1:-1;;7422:12;7384:2;7480:17;7467:31;7518:18;7510:6;7507:30;7504:2;;;-1:-1;;7540:12;7504:2;7578:80;7650:7;7641:6;7630:9;7626:22;7578:80;;;7568:90;;;;-1:-1;7378:296;-1:-1;;;;7378:296;7681:257;;7793:2;7781:9;7772:7;7768:23;7764:32;7761:2;;;-1:-1;;7799:12;7761:2;2847:6;2841:13;48550:5;45605:13;45598:21;48528:5;48525:32;48515:2;;-1:-1;;48561:12;7945:360;;8069:2;8057:9;8048:7;8044:23;8040:32;8037:2;;;-1:-1;;8075:12;8037:2;8126:17;8120:24;8164:18;8156:6;8153:30;8150:2;;;-1:-1;;8186:12;8150:2;8272:6;8261:9;8257:22;3821:3;3814:4;3806:6;3802:17;3798:27;3788:2;;-1:-1;;3829:12;3788:2;3869:6;3863:13;3849:27;;3891:64;3906:48;3947:6;3906:48;;3891:64;3975:6;3968:5;3961:21;4079:3;8069:2;4070:6;4003;4061:16;;4058:25;4055:2;;;-1:-1;;4086:12;4055:2;4106:39;4138:6;8069:2;4037:5;4033:16;8069:2;4003:6;3999:17;4106:39;;8312:1309;;;;;;;8592:3;8580:9;8571:7;8567:23;8563:33;8560:2;;;-1:-1;;8599:12;8560:2;8657:17;8644:31;8695:18;;8687:6;8684:30;8681:2;;;-1:-1;;8717:12;8681:2;8747:62;8801:7;8792:6;8781:9;8777:22;8747:62;;;8737:72;;8846:2;;;;8889:9;8885:22;5145:20;8854:63;;8954:2;8997:9;8993:22;5145:20;8962:63;;2257:3;2238:17;9128:9;2238:17;2234:27;2224:2;;-1:-1;;2265:12;2224:2;2318:78;43567:17;2318:78;;;2402:16;9062:2;9128:9;9124:22;2490:27;9128:9;2490:27;2519:3;2490:27;2487:36;2484:2;;;-1:-1;;2526:12;2484:2;-1:-1;2546:206;2299:4;2568:1;2565:13;2546:206;;;5145:20;;2639:50;;2703:14;;;;2731;;;;2593:1;2586:9;2546:206;;;-1:-1;9070:86;;-1:-1;;9193:33;;-1:-1;;9235:30;;;9232:2;;;-1:-1;;9268:12;9232:2;9298:87;9377:7;9368:6;9357:9;9353:22;9298:87;;;9288:97;;9450:3;9439:9;9435:19;9422:33;9408:47;;8695:18;9467:6;9464:30;9461:2;;;-1:-1;;9497:12;9461:2;;9527:78;9597:7;9588:6;9577:9;9573:22;9527:78;;;9517:88;;;8554:1067;;;;;;;;;10574:263;;10689:2;10677:9;10668:7;10664:23;10660:32;10657:2;;;-1:-1;;10695:12;10657:2;-1:-1;5293:13;;10651:186;-1:-1;10651:186;12961:297;;44735:6;44730:3;44723:19;47430:6;47425:3;44772:4;44767:3;44763:14;47407:30;-1:-1;44772:4;47477:6;44767:3;47468:16;;47461:27;44772:4;48222:7;;48226:2;13244:6;48206:14;48202:28;44767:3;13213:39;;13206:46;;13061:197;;;;;;13266:343;;13408:5;44193:12;44735:6;44730:3;44723:19;13501:52;13546:6;44772:4;44767:3;44763:14;44772:4;13527:5;13523:16;13501:52;;;48222:7;48206:14;-1:-1;;48202:28;13565:39;;;;44772:4;13565:39;;13356:253;-1:-1;;13356:253;23424:656;-1:-1;;;;;;45692:78;;;;12367:56;;48317:2;48313:14;;;;-1:-1;;48313:14;23720:1;23711:11;;11380:58;23821:12;;;12506:37;23932:12;;;12506:37;24043:12;;;23613:467;24087:262;;13776:5;44193:12;13887:52;13932:6;13927:3;13920:4;13913:5;13909:16;13887:52;;;13951:16;;;;;24212:137;-1:-1;;24212:137;24356:544;;13776:5;44193:12;13887:52;13932:6;13927:3;13920:4;13913:5;13909:16;13887:52;;;13951:16;;;;12506:37;;;-1:-1;13920:4;24752:12;;12506:37;24863:12;;;24539:361;-1:-1;24539:361;24907:511;15147:66;15127:87;;15111:2;15233:12;;12506:37;;;;25381:12;;;25115:303;25425:511;-1:-1;;;17164:38;;48317:2;48313:14;;;;-1:-1;;48313:14;17148:2;17221:12;;11380:58;25899:12;;;25633:303;26320:372;21426:34;21406:55;;21495:34;21490:2;21481:12;;21474:56;21564:34;21559:2;21550:12;;21543:56;21633:34;21628:2;21619:12;;21612:56;21703:34;21697:3;21688:13;;21681:57;21773:34;21767:3;21758:13;;21751:57;-1:-1;;;21837:3;21828:13;;21821:29;21389:3;21869:13;;26500:192;26699:213;-1:-1;;;;;46436:54;;;;11242:37;;26817:2;26802:18;;26788:124;27155:435;-1:-1;;;;;46436:54;;;11242:37;;46436:54;;;27493:2;27478:18;;11242:37;46436:54;;;27576:2;27561:18;;11242:37;27329:2;27314:18;;27300:290;27597:647;-1:-1;;;;;46436:54;;11242:37;;27829:2;27947;27932:18;;27925:48;;;27597:647;;27987:88;;27814:18;;28061:6;28053;27987:88;;;28123:9;28117:4;28113:20;28108:2;28097:9;28093:18;28086:48;28148:86;28229:4;28220:6;28212;28148:86;;;28140:94;27800:444;-1:-1;;;;;;;;27800:444;28251:324;-1:-1;;;;;46436:54;;;;11242:37;;28561:2;28546:18;;12506:37;28397:2;28382:18;;28368:207;28582:357;28748:2;28762:47;;;44193:12;;28733:18;;;44723:19;;;28582:357;;28748:2;44048:14;;;;44763;;;;28582:357;11882:257;11907:6;11904:1;11901:13;11882:257;;;11968:13;;-1:-1;;;;;;45922:78;12773:36;;44579:14;;;;10994;;;;11929:1;11922:9;11882:257;;28946:213;12506:37;;;29064:2;29049:18;;29035:124;29166:1447;12506:37;;;-1:-1;;;;;46436:54;;;29759:2;29744:18;;11242:37;46436:54;;;29842:2;29827:18;;11242:37;29925:2;29910:18;;12506:37;;;;30008:3;29993:19;;12506:37;;;;48313:14;30077:19;;12506:37;;;;30176:3;30161:19;;12506:37;;;;46436:54;;30260:3;30245:19;;11242:37;30344:3;30329:19;;12506:37;30428:3;30413:19;;12506:37;30513:3;30498:19;;12506:37;46436:54;30598:3;30583:19;;11242:37;29594:3;29579:19;;29565:1048;30620:539;12506:37;;;46652:4;46641:16;;;;30979:2;30964:18;;23377:35;31062:2;31047:18;;12506:37;31145:2;31130:18;;12506:37;30818:3;30803:19;;30789:370;31166:320;-1:-1;;;;;;45922:78;;;;12773:36;;-1:-1;;;;;46436:54;31472:2;31457:18;;11242:37;31310:2;31295:18;;31281:205;31836:492;;32018:2;32039:17;32032:47;32093:76;32018:2;32007:9;32003:18;32155:6;32093:76;;;32217:9;32211:4;32207:20;32202:2;32191:9;32187:18;32180:48;32242:76;32313:4;32304:6;32242:76;;32593:407;32784:2;32798:47;;;15484:2;32769:18;;;44723:19;-1:-1;;;44763:14;;;15500:33;15552:12;;;32755:245;33007:407;33198:2;33212:47;;;15803:2;33183:18;;;44723:19;-1:-1;;;44763:14;;;15819:37;15875:12;;;33169:245;33421:407;33612:2;33626:47;;;16126:2;33597:18;;;44723:19;16162:26;44763:14;;;16142:47;16208:12;;;33583:245;33835:407;34026:2;34040:47;;;16459:2;34011:18;;;44723:19;-1:-1;;;44763:14;;;16475:40;16534:12;;;33997:245;34249:407;34440:2;34454:47;;;16785:2;34425:18;;;44723:19;-1:-1;;;44763:14;;;16801:41;16861:12;;;34411:245;34663:407;34854:2;34868:47;;;17472:2;34839:18;;;44723:19;-1:-1;;;44763:14;;;17488:39;17546:12;;;34825:245;35077:407;35268:2;35282:47;;;17797:2;35253:18;;;44723:19;-1:-1;;;44763:14;;;17813:38;17870:12;;;35239:245;35491:407;35682:2;35696:47;;;18121:2;35667:18;;;44723:19;-1:-1;;;44763:14;;;18137:36;18192:12;;;35653:245;35905:407;36096:2;36110:47;;;18443:2;36081:18;;;44723:19;-1:-1;;;44763:14;;;18459:44;18522:12;;;36067:245;36319:407;36510:2;36524:47;;;18773:2;36495:18;;;44723:19;-1:-1;;;44763:14;;;18789:38;18846:12;;;36481:245;36733:407;36924:2;36938:47;;;19097:2;36909:18;;;44723:19;-1:-1;;;44763:14;;;19113:38;19170:12;;;36895:245;37147:407;37338:2;37352:47;;;19421:2;37323:18;;;44723:19;19457:33;44763:14;;;19437:54;19510:12;;;37309:245;37561:407;37752:2;37766:47;;;19761:2;37737:18;;;44723:19;-1:-1;;;44763:14;;;19777:42;19838:12;;;37723:245;37975:407;38166:2;38180:47;;;20089:2;38151:18;;;44723:19;-1:-1;;;44763:14;;;20105:35;20159:12;;;38137:245;38389:407;38580:2;38594:47;;;20410:1;38565:18;;;44723:19;-1:-1;;;44763:14;;;20425:30;20474:12;;;38551:245;38803:407;38994:2;39008:47;;;21030:2;38979:18;;;44723:19;-1:-1;;;44763:14;;;21046:37;21102:12;;;38965:245;39217:407;39408:2;39422:47;;;22121:2;39393:18;;;44723:19;-1:-1;;;44763:14;;;22137:39;22195:12;;;39379:245;39631:407;39822:2;39836:47;;;22446:2;39807:18;;;44723:19;-1:-1;;;44763:14;;;22462:35;22516:12;;;39793:245;40045:407;40236:2;40250:47;;;22767:2;40221:18;;;44723:19;-1:-1;;;44763:14;;;22783:41;22843:12;;;40207:245;40459:407;40650:2;40664:47;;;23094:2;40635:18;;;44723:19;-1:-1;;;44763:14;;;23110:35;23164:12;;;40621:245;41093:731;;12536:5;12513:3;12506:37;12536:5;41500:2;41489:9;41485:18;12506:37;12536:5;41583:2;41572:9;41568:18;12506:37;12261:5;45605:13;45598:21;41660:2;41649:9;41645:18;12234:34;41335:3;41697;41686:9;41682:19;41675:49;41738:76;41335:3;41324:9;41320:19;41800:6;41738:76;;41831:623;;46652:4;23405:5;46641:16;23384:3;23377:35;509:18;;48313:14;;;45521:5;46436:54;42208:2;42197:9;42193:18;11242:37;12536:5;42291:2;42280:9;42276:18;12506:37;42047:3;42328:2;42317:9;42313:18;42306:48;42368:76;42047:3;42036:9;42032:19;42430:6;42368:76;;;42360:84;42018:436;-1:-1;;;;;;42018:436;42461:256;42523:2;42517:9;42549:17;;;42624:18;42609:34;;42645:22;;;42606:62;42603:2;;;42681:1;;42671:12;42603:2;42523;42690:22;42501:216;;-1:-1;42501:216;42724:304;;42883:18;42875:6;42872:30;42869:2;;;-1:-1;;42905:12;42869:2;-1:-1;42950:4;42938:17;;;43003:15;;42806:222;43606:321;;43749:18;43741:6;43738:30;43735:2;;;-1:-1;;43771:12;43735:2;-1:-1;48222:7;43825:17;-1:-1;;43821:33;43912:4;43902:15;;43672:255;47503:268;47568:1;47575:101;47589:6;47586:1;47583:13;47575:101;;;47656:11;;;47650:18;47637:11;;;47630:39;47611:2;47604:10;47575:101;;;47691:6;47688:1;47685:13;47682:2;;;-1:-1;;47568:1;47738:16;;47731:27;47552:219;48345:117;-1:-1;;;;;46436:54;;48404:35;;48394:2;;48453:1;;48443:12;48394:2;48388:74;;;105440:111:0;;105706:7;;105778:9;;105440:111;;;;;;;;;;;;105918:6;:11;;;105902:29;;;;;;105966:6;:14;;;105950:32;;;;;;106001:8;106028:6;:24;;;105832:235;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;105832:235:0;;;105808:270;;;;;;105801:277;;;105620:466;;;:::o;866:372:-1:-;542:34;522:55;;611:34;606:2;597:12;;590:56;-1:-1;;;675:2;666:12;;659:42;506:2;720:12;;1046:192;1245:659;196:37;;;1640:2;1625:18;;196:37;;;;1723:2;1708:18;;196:37;;;;1806:2;1791:18;;196:37;-1:-1;;;;;2304:54;1889:3;1874:19;;76:37;1475:3;1460:19;;1446:458

Swarm Source

ipfs://e5cf4d06dbb43edb1435fbb84965911afd31aa0ea79ecf5ebd75e619b44f0675

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.