ETH Price: $2,468.05 (+0.94%)

Contract

0xe915058dF18e7Efe92aF5c44Df3F575FBA061B64
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Execute Meta Tx209494562024-10-12 12:15:2320 hrs ago1728735323IN
0xe915058d...FBA061B64
0 ETH0.001407939.76523727
Execute Meta Tx209301642024-10-09 19:35:233 days ago1728502523IN
0xe915058d...FBA061B64
0 ETH0.0040868234.08645536
Execute Meta Tx209297152024-10-09 18:05:233 days ago1728497123IN
0xe915058d...FBA061B64
0 ETH0.00668641.31730977
Execute Meta Tx209218862024-10-08 15:54:114 days ago1728402851IN
0xe915058d...FBA061B64
0 ETH0.0036167230.02979014
Execute Meta Tx209185822024-10-08 4:51:115 days ago1728363071IN
0xe915058d...FBA061B64
0 ETH0.0014203310.65214791
Execute Meta Tx209185802024-10-08 4:50:475 days ago1728363047IN
0xe915058d...FBA061B64
0 ETH0.001992810.1703893
Execute Meta Tx208901862024-10-04 5:52:359 days ago1728021155IN
0xe915058d...FBA061B64
0 ETH0.000411093.41331058
Execute Meta Tx208888102024-10-04 1:17:119 days ago1728004631IN
0xe915058d...FBA061B64
0 ETH0.00453034.33000468
Execute Meta Tx208887422024-10-04 1:03:359 days ago1728003815IN
0xe915058d...FBA061B64
0 ETH0.004252134.06422722
Execute Meta Tx208886122024-10-04 0:37:359 days ago1728002255IN
0xe915058d...FBA061B64
0 ETH0.000703854.05431707
Execute Meta Tx208884142024-10-03 23:57:599 days ago1727999879IN
0xe915058d...FBA061B64
0 ETH0.000606493.73535151
Execute Meta Tx208883982024-10-03 23:54:359 days ago1727999675IN
0xe915058d...FBA061B64
0 ETH0.000643423.60218098
Execute Meta Tx208883062024-10-03 23:36:119 days ago1727998571IN
0xe915058d...FBA061B64
0 ETH0.001062923.37218047
Execute Meta Tx208882142024-10-03 23:17:479 days ago1727997467IN
0xe915058d...FBA061B64
0 ETH0.000876093.33336955
Execute Meta Tx208880042024-10-03 22:35:479 days ago1727994947IN
0xe915058d...FBA061B64
0 ETH0.000820195.28159995
Execute Meta Tx208803082024-10-02 20:48:5910 days ago1727902139IN
0xe915058d...FBA061B64
0 ETH0.001976512.21598019
Execute Meta Tx208756352024-10-02 5:11:1111 days ago1727845871IN
0xe915058d...FBA061B64
0 ETH0.001831636.54908033
Execute Meta Tx208514812024-09-28 20:19:5914 days ago1727554799IN
0xe915058d...FBA061B64
0 ETH0.00085735.29730402
Execute Meta Tx208498642024-09-28 14:54:5914 days ago1727535299IN
0xe915058d...FBA061B64
0 ETH0.001003457.24869968
Execute Meta Tx208455212024-09-28 0:23:1115 days ago1727482991IN
0xe915058d...FBA061B64
0 ETH0.0017236814.31035191
Execute Meta Tx208235752024-09-24 22:54:3518 days ago1727218475IN
0xe915058d...FBA061B64
0 ETH0.0014683214.19811719
Execute Meta Tx208233462024-09-24 22:08:3518 days ago1727215715IN
0xe915058d...FBA061B64
0 ETH0.0024357218.28154275
Execute Meta Tx208225982024-09-24 19:38:4718 days ago1727206727IN
0xe915058d...FBA061B64
0 ETH0.0046162229.31587295
Execute Meta Tx208055572024-09-22 10:35:4720 days ago1727001347IN
0xe915058d...FBA061B64
0 ETH0.0015707410.89848287
Execute Meta Tx207798882024-09-18 20:32:3524 days ago1726691555IN
0xe915058d...FBA061B64
0 ETH0.000955187.16431799
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FinalCoreModule

Compiler Version
v0.7.0+commit.9e61f92b

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion, Apache-2.0 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-11-12
*/

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/iface/Wallet.sol

// Copyright 2017 Loopring Technology Limited.


/// @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]>
interface Wallet
{
    function version() external pure returns (string memory);

    function owner() external view returns (address);

    /// @dev Set a new owner.
    function setOwner(address newOwner) 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.
    ///
    ///      Note: 1) 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. 2) Reentrancy inside this function should
    ///      NOT cause any problems.
    ///
    /// @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);
}

// File: contracts/lib/AddressUtil.sol

// Copyright 2017 Loopring Technology Limited.


/// @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)
    {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(addr) }
        return (codehash != 0x0 &&
                codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470);
    }

    function toPayable(
        address addr
        )
        internal
        pure
        returns (address payable)
    {
        return payable(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");
    }

    // Works like call but is slightly more efficient when data
    // needs to be copied from memory to do the call.
    function fastCall(
        address to,
        uint    gasLimit,
        uint    value,
        bytes   memory data
        )
        internal
        returns (bool success, bytes memory returnData)
    {
        if (to != address(0)) {
            assembly {
                // Do the call
                success := call(gasLimit, to, value, add(data, 32), mload(data), 0, 0)
                // Copy the return data
                let size := returndatasize()
                returnData := mload(0x40)
                mstore(returnData, size)
                returndatacopy(add(returnData, 32), 0, size)
                // Update free memory pointer
                mstore(0x40, add(returnData, add(32, size)))
            }
        }
    }

    // Like fastCall, but throws when the call is unsuccessful.
    function fastCallAndVerify(
        address to,
        uint    gasLimit,
        uint    value,
        bytes   memory data
        )
        internal
        returns (bytes memory returnData)
    {
        bool success;
        (success, returnData) = fastCall(to, gasLimit, value, data);
        if (!success) {
            assembly {
                revert(add(returnData, 32), mload(returnData))
            }
        }
    }
}

// File: contracts/lib/ERC1271.sol

// Copyright 2017 Loopring Technology Limited.

abstract contract ERC1271 {
    // bytes4(keccak256("isValidSignature(bytes32,bytes)")
    bytes4 constant internal ERC1271_MAGICVALUE = 0x1626ba7e;

    function isValidSignature(
        bytes32      _hash,
        bytes memory _signature)
        public
        view
        virtual
        returns (bytes4 magicValueB32);
}

// File: contracts/thirdparty/BytesUtil.sol

//Mainly taken from https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol

library BytesUtil {
    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 toUint24(bytes memory _bytes, uint _start) internal  pure returns (uint24) {
        require(_bytes.length >= (_start + 3));
        uint24 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x3), _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 fastSHA256(
        bytes memory data
        )
        internal
        view
        returns (bytes32)
    {
        bytes32[] memory result = new bytes32[](1);
        bool success;
        assembly {
             let ptr := add(data, 32)
             success := staticcall(sub(gas(), 2000), 2, ptr, mload(data), add(result, 32), 32)
        }
        require(success, "SHA256_FAILED");
        return result[0];
    }
}

// File: contracts/lib/MathUint.sol

// Copyright 2017 Loopring Technology Limited.


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

// File: contracts/lib/SignatureUtil.sol

// Copyright 2017 Loopring Technology Limited.






/// @title SignatureUtil
/// @author Daniel Wang - <[email protected]>
/// @dev This method supports multihash standard. Each signature's last byte indicates
///      the signature's type.
library SignatureUtil
{
    using BytesUtil     for bytes;
    using MathUint      for uint;
    using AddressUtil   for address;

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

    bytes4 constant internal ERC1271_MAGICVALUE = 0x1626ba7e;

    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)
    {
        if (signer == address(0)) {
            return false;
        }

        return signer.isContract()?
            verifyERC1271Signature(signHash, signer, signature):
            verifyEOASignature(signHash, signer, signature);
    }

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

    function verifyEOASignature(
        bytes32        signHash,
        address        signer,
        bytes   memory signature
        )
        private
        pure
        returns (bool success)
    {
        if (signer == address(0)) {
            return false;
        }

        uint signatureTypeOffset = signature.length.sub(1);
        SignatureType signatureType = SignatureType(signature.toUint8(signatureTypeOffset));

        // Strip off the last byte of the signature by updating the length
        assembly {
            mstore(signature, signatureTypeOffset)
        }

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

        // Restore the signature length
        assembly {
            mstore(signature, add(signatureTypeOffset, 1))
        }

        return success;
    }

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

// File: contracts/lib/EIP712.sol

// Copyright 2017 Loopring Technology Limited.

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 domainSeperator,
        bytes   memory encodedData
        )
        internal
        pure
        returns (bytes32)
    {
        return keccak256(
            abi.encodePacked(EIP191_HEADER, domainSeperator, keccak256(encodedData))
        );
    }
}

// File: contracts/lib/Ownable.sol

// Copyright 2017 Loopring Technology Limited.


/// @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()
    {
        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);
    }
}

// File: contracts/iface/Module.sol

// Copyright 2017 Loopring Technology Limited.




/// @title Module
/// @dev Base contract for all smart wallet modules.
///
/// @author Daniel Wang - <[email protected]>
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;
}

// File: contracts/lib/ERC20.sol

// Copyright 2017 Loopring Technology Limited.


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

// File: contracts/iface/ModuleRegistry.sol

// Copyright 2017 Loopring Technology Limited.


/// @title ModuleRegistry
/// @dev A registry for modules.
///
/// @author Daniel Wang - <[email protected]>
interface ModuleRegistry
{
	/// @dev Registers and enables a new module.
    function registerModule(address module) external;

    /// @dev Disables a module
    function disableModule(address module) external;

    /// @dev Returns true if the module is registered and enabled.
    function isModuleEnabled(address module) external view returns (bool);

    /// @dev Returns the list of enabled modules.
    function enabledModules() external view returns (address[] memory _modules);

    /// @dev Returns the number of enbaled modules.
    function numOfEnabledModules() external view returns (uint);

    /// @dev Returns true if the module is ever registered.
    function isModuleRegistered(address module) external view returns (bool);
}

// File: contracts/base/Controller.sol

// Copyright 2017 Loopring Technology Limited.



/// @title Controller
///
/// @author Daniel Wang - <[email protected]>
abstract contract Controller
{
    function moduleRegistry()
        external
        view
        virtual
        returns (ModuleRegistry);

    function walletFactory()
        external
        view
        virtual
        returns (address);
}

// File: contracts/iface/PriceOracle.sol

// Copyright 2017 Loopring Technology Limited.


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

// File: contracts/lib/Claimable.sol

// Copyright 2017 Loopring Technology Limited.



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

// File: contracts/base/DataStore.sol

// Copyright 2017 Loopring Technology Limited.



/// @title DataStore
/// @dev Modules share states by accessing the same storage instance.
///      Using ModuleStorage will achieve better module decoupling.
///
/// @author Daniel Wang - <[email protected]>
abstract contract DataStore
{
    modifier onlyWalletModule(address wallet)
    {
        requireWalletModule(wallet);
        _;
    }

    function requireWalletModule(address wallet) view internal
    {
        require(Wallet(wallet).hasModule(msg.sender), "UNAUTHORIZED");
    }
}

// File: contracts/stores/HashStore.sol

// Copyright 2017 Loopring Technology Limited.




/// @title HashStore
/// @dev This store maintains all hashes for SignedRequest.
contract HashStore is DataStore
{
    // wallet => hash => consumed
    mapping(address => mapping(bytes32 => bool)) public hashes;

    constructor() {}

    function verifyAndUpdate(address wallet, bytes32 hash)
        external
    {
        require(!hashes[wallet][hash], "HASH_EXIST");
        requireWalletModule(wallet);
        hashes[wallet][hash] = true;
    }
}

// File: contracts/thirdparty/SafeCast.sol

// Taken from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/SafeCast.sol



/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value < 2**96, "SafeCast: value doesn\'t fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value < 2**40, "SafeCast: value doesn\'t fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        require(value < 2**255, "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

// File: contracts/stores/QuotaStore.sol

// Copyright 2017 Loopring Technology Limited.





/// @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;
    using SafeCast for uint;

    uint128 public constant MAX_QUOTA = uint128(-1);

    // Optimized to fit into 64 bytes (2 slots)
    struct Quota
    {
        uint128 currentQuota;
        uint128 pendingQuota;
        uint128 spentAmount;
        uint64  spentTimestamp;
        uint64  pendingUntil;
    }

    mapping (address => Quota) public quotas;

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

    constructor()
        DataStore()
    {
    }

    // 0 for newQuota indicates unlimited quota, or daily quota is disabled.
    function changeQuota(
        address wallet,
        uint    newQuota,
        uint    effectiveTime
        )
        external
        onlyWalletModule(wallet)
    {
        require(newQuota <= MAX_QUOTA, "INVALID_VALUE");
        if (newQuota == MAX_QUOTA) {
            newQuota = 0;
        }

        quotas[wallet].currentQuota = currentQuota(wallet).toUint128();
        quotas[wallet].pendingQuota = newQuota.toUint128();
        quotas[wallet].pendingUntil = effectiveTime.toUint64();

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

    function checkAndAddToSpent(
        address     wallet,
        address     token,
        uint        amount,
        PriceOracle priceOracle
        )
        external
    {
        Quota memory q = quotas[wallet];
        uint available = _availableQuota(q);
        if (available != MAX_QUOTA) {
            uint value = (token == address(0)) ?
                amount :
                priceOracle.tokenValue(token, amount);
            if (value > 0) {
                require(available >= value, "QUOTA_EXCEEDED");
                requireWalletModule(wallet);
                _addToSpent(wallet, q, value);
            }
        }
    }

    function addToSpent(
        address wallet,
        uint    amount
        )
        external
        onlyWalletModule(wallet)
    {
        _addToSpent(wallet, quotas[wallet], amount);
    }

    // Returns 0 to indiciate unlimited quota
    function currentQuota(address wallet)
        public
        view
        returns (uint)
    {
        return _currentQuota(quotas[wallet]);
    }

    // Returns 0 to indiciate unlimited quota
    function pendingQuota(address wallet)
        public
        view
        returns (
            uint __pendingQuota,
            uint __pendingUntil
        )
    {
        return _pendingQuota(quotas[wallet]);
    }

    function spentQuota(address wallet)
        public
        view
        returns (uint)
    {
        return _spentQuota(quotas[wallet]);
    }

    function availableQuota(address wallet)
        public
        view
        returns (uint)
    {
        return _availableQuota(quotas[wallet]);
    }

    function hasEnoughQuota(
        address wallet,
        uint    requiredAmount
        )
        public
        view
        returns (bool)
    {
        return _hasEnoughQuota(quotas[wallet], requiredAmount);
    }

    // Internal

    function _currentQuota(Quota memory q)
        private
        view
        returns (uint)
    {
        return q.pendingUntil <= block.timestamp ? q.pendingQuota : q.currentQuota;
    }

    function _pendingQuota(Quota memory q)
        private
        view
        returns (
            uint __pendingQuota,
            uint __pendingUntil
        )
    {
        if (q.pendingUntil > 0 && q.pendingUntil > block.timestamp) {
            __pendingQuota = q.pendingQuota;
            __pendingUntil = q.pendingUntil;
        }
    }

    function _spentQuota(Quota memory q)
        private
        view
        returns (uint)
    {
        uint timeSinceLastSpent = block.timestamp.sub(q.spentTimestamp);
        if (timeSinceLastSpent < 1 days) {
            return uint(q.spentAmount).sub(timeSinceLastSpent.mul(q.spentAmount) / 1 days);
        } else {
            return 0;
        }
    }

    function _availableQuota(Quota memory q)
        private
        view
        returns (uint)
    {
        uint quota = _currentQuota(q);
        if (quota == 0) {
            return MAX_QUOTA;
        }
        uint spent = _spentQuota(q);
        return quota > spent ? quota - spent : 0;
    }

    function _hasEnoughQuota(
        Quota   memory q,
        uint    requiredAmount
        )
        private
        view
        returns (bool)
    {
        return _availableQuota(q) >= requiredAmount;
    }

    function _addToSpent(
        address wallet,
        Quota   memory q,
        uint    amount
        )
        private
    {
        Quota storage s = quotas[wallet];
        s.spentAmount = _spentQuota(q).add(amount).toUint128();
        s.spentTimestamp = uint64(block.timestamp);
    }
}

// File: contracts/stores/Data.sol

// Copyright 2017 Loopring Technology Limited.


library Data
{
    enum GuardianStatus {
        REMOVE,    // Being removed or removed after validUntil timestamp
        ADD        // Being added or added after validSince timestamp.
    }

    // Optimized to fit into 32 bytes (1 slot)
    struct Guardian
    {
        address addr;
        uint8   status;
        uint64  timestamp; // validSince if status = ADD; validUntil if adding = REMOVE;
    }
}

// File: contracts/stores/GuardianStore.sol

// Copyright 2017 Loopring Technology Limited.






/// @title GuardianStore
///
/// @author Daniel Wang - <[email protected]>
abstract contract GuardianStore is DataStore
{
    using MathUint      for uint;
    using SafeCast      for uint;

    struct Wallet
    {
        address    inheritor;
        uint32     inheritWaitingPeriod;
        uint64     lastActive; // the latest timestamp the owner is considered to be active
        bool       locked;

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

    mapping (address => Wallet) public wallets;

    constructor() DataStore() {}

    function isGuardian(
        address wallet,
        address addr,
        bool    includePendingAddition
        )
        public
        view
        returns (bool)
    {
        Data.Guardian memory g = _getGuardian(wallet, addr);
        return _isActiveOrPendingAddition(g, includePendingAddition);
    }

    function guardians(
        address wallet,
        bool    includePendingAddition
        )
        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 (_isActiveOrPendingAddition(g, includePendingAddition)) {
                _guardians[index] = g;
                index++;
            }
        }
        assembly { mstore(_guardians, index) }
    }

    function numGuardians(
        address wallet,
        bool    includePendingAddition
        )
        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 (_isActiveOrPendingAddition(g, includePendingAddition)) {
                count++;
            }
        }
    }

    function removeAllGuardians(address wallet)
        external
    {
        Wallet storage w = wallets[wallet];
        uint size = w.guardians.length;
        if (size == 0) return;

        requireWalletModule(wallet);
        for (uint i = 0; i < w.guardians.length; i++) {
            delete w.guardianIdx[w.guardians[i].addr];
        }
        delete w.guardians;
    }

    function cancelPendingGuardians(address wallet)
        external
    {
        bool cancelled = false;
        Wallet storage w = wallets[wallet];
        for (uint i = 0; i < w.guardians.length; i++) {
            Data.Guardian memory g = w.guardians[i];
            if (_isPendingAddition(g)) {
                w.guardians[i].status = uint8(Data.GuardianStatus.REMOVE);
                w.guardians[i].timestamp = 0;
                cancelled = true;
            }
            if (_isPendingRemoval(g)) {
                w.guardians[i].status = uint8(Data.GuardianStatus.ADD);
                w.guardians[i].timestamp = 0;
                cancelled = true;
            }
        }
        if (cancelled) {
            requireWalletModule(wallet);
        }
        _cleanRemovedGuardians(wallet, true);
    }

    function cleanRemovedGuardians(address wallet)
        external
    {
        _cleanRemovedGuardians(wallet, true);
    }

    function addGuardian(
        address wallet,
        address addr,
        uint    validSince,
        bool    alwaysOverride
        )
        external
        onlyWalletModule(wallet)
        returns (uint)
    {
        require(validSince >= block.timestamp, "INVALID_VALID_SINCE");
        require(addr != address(0), "ZERO_ADDRESS");

        Wallet storage w = wallets[wallet];
        uint pos = w.guardianIdx[addr];

        if(pos == 0) {
            // Add the new guardian
            Data.Guardian memory g = Data.Guardian(
                addr,
                uint8(Data.GuardianStatus.ADD),
                validSince.toUint64()
            );
            w.guardians.push(g);
            w.guardianIdx[addr] = w.guardians.length;

            _cleanRemovedGuardians(wallet, false);
            return validSince;
        }

        Data.Guardian memory g = w.guardians[pos - 1];

        if (_isRemoved(g)) {
            w.guardians[pos - 1].status = uint8(Data.GuardianStatus.ADD);
            w.guardians[pos - 1].timestamp = validSince.toUint64();
            return validSince;
        }

        if (_isPendingRemoval(g)) {
            w.guardians[pos - 1].status = uint8(Data.GuardianStatus.ADD);
            w.guardians[pos - 1].timestamp = 0;
            return 0;
        }

        if (_isPendingAddition(g)) {
            if (!alwaysOverride) return g.timestamp;

            w.guardians[pos - 1].timestamp = validSince.toUint64();
            return validSince;
        }

        require(_isAdded(g), "UNEXPECTED_RESULT");
        return 0;
    }

    function removeGuardian(
        address wallet,
        address addr,
        uint    validUntil,
        bool    alwaysOverride
        )
        external
        onlyWalletModule(wallet)
        returns (uint)
    {
        require(validUntil >= block.timestamp, "INVALID_VALID_UNTIL");
        require(addr != address(0), "ZERO_ADDRESS");

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

        Data.Guardian memory g = w.guardians[pos - 1];

        if (_isAdded(g)) {
            w.guardians[pos - 1].status = uint8(Data.GuardianStatus.REMOVE);
            w.guardians[pos - 1].timestamp = validUntil.toUint64();
            return validUntil;
        }

        if (_isPendingAddition(g)) {
            w.guardians[pos - 1].status = uint8(Data.GuardianStatus.REMOVE);
            w.guardians[pos - 1].timestamp = 0;
            return 0;
        }

        if (_isPendingRemoval(g)) {
            if (!alwaysOverride) return g.timestamp;

            w.guardians[pos - 1].timestamp = validUntil.toUint64();
            return validUntil;
        }

        require(_isRemoved(g), "UNEXPECTED_RESULT");
        return 0;
    }

    // ---- internal functions ---

    function _getGuardian(
        address wallet,
        address addr
        )
        private
        view
        returns (Data.Guardian memory)
    {
        Wallet storage w = wallets[wallet];
        uint pos = w.guardianIdx[addr];
        if (pos > 0) {
            return w.guardians[pos - 1];
        }
    }

    function _isAdded(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
        return guardian.status == uint8(Data.GuardianStatus.ADD) &&
            guardian.timestamp <= block.timestamp;
    }

    function _isPendingAddition(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
        return guardian.status == uint8(Data.GuardianStatus.ADD) &&
            guardian.timestamp > block.timestamp;
    }

    function _isRemoved(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
        return guardian.status == uint8(Data.GuardianStatus.REMOVE) &&
            guardian.timestamp <= block.timestamp;
    }

    function _isPendingRemoval(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
         return guardian.status == uint8(Data.GuardianStatus.REMOVE) &&
            guardian.timestamp > block.timestamp;
    }

    function _isActive(Data.Guardian memory guardian)
        private
        view
        returns (bool)
    {
        return _isAdded(guardian) || _isPendingRemoval(guardian);
    }

    function _isActiveOrPendingAddition(
        Data.Guardian memory guardian,
        bool includePendingAddition
        )
        private
        view
        returns (bool)
    {
        return _isActive(guardian) || includePendingAddition && _isPendingAddition(guardian);
    }

    function _cleanRemovedGuardians(
        address wallet,
        bool    force
        )
        private
    {
        Wallet storage w = wallets[wallet];
        uint count = w.guardians.length;
        if (!force && count < 10) return;

        for (int i = int(count) - 1; i >= 0; i--) {
            Data.Guardian memory g = w.guardians[uint(i)];
            if (_isRemoved(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];
            }
        }
    }
}

// File: contracts/stores/SecurityStore.sol

// Copyright 2017 Loopring Technology Limited.


/// @title SecurityStore
///
/// @author Daniel Wang - <[email protected]>
contract SecurityStore is GuardianStore
{
    using MathUint for uint;
    using SafeCast for uint;

    constructor() GuardianStore() {}

    function setLock(
        address wallet,
        bool    locked
        )
        external
        onlyWalletModule(wallet)
    {
        wallets[wallet].locked = locked;
    }

    function touchLastActive(address wallet)
        external
        onlyWalletModule(wallet)
    {
        wallets[wallet].lastActive = uint64(block.timestamp);
    }

    function touchLastActiveWhenRequired(
        address wallet,
        uint    minInternval
        )
        external
    {
        if (wallets[wallet].inheritor != address(0) &&
            block.timestamp > lastActive(wallet) + minInternval) {
            requireWalletModule(wallet);
            wallets[wallet].lastActive = uint64(block.timestamp);
        }
    }

    function setInheritor(
        address wallet,
        address who,
        uint32 _inheritWaitingPeriod
        )
        external
        onlyWalletModule(wallet)
    {
        wallets[wallet].inheritor = who;
        wallets[wallet].inheritWaitingPeriod = _inheritWaitingPeriod;
        wallets[wallet].lastActive = uint64(block.timestamp);
    }

    function isLocked(address wallet)
        public
        view
        returns (bool)
    {
        return wallets[wallet].locked;
    }

    function lastActive(address wallet)
        public
        view
        returns (uint)
    {
        return wallets[wallet].lastActive;
    }

    function inheritor(address wallet)
        public
        view
        returns (
            address _who,
            uint    _effectiveTimestamp
        )
    {
        address _inheritor = wallets[wallet].inheritor;
        if (_inheritor == address(0)) {
             return (address(0), 0);
        }

        uint32 _inheritWaitingPeriod = wallets[wallet].inheritWaitingPeriod;
        if (_inheritWaitingPeriod == 0) {
            return (address(0), 0);
        }

        uint64 _lastActive = wallets[wallet].lastActive;

        if (_lastActive == 0) {
            _lastActive = uint64(block.timestamp);
        }

        _who = _inheritor;
        _effectiveTimestamp = _lastActive + _inheritWaitingPeriod;
    }
}

// File: contracts/lib/AddressSet.sol

// Copyright 2017 Loopring Technology Limited.


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

// File: contracts/lib/OwnerManagable.sol

// Copyright 2017 Loopring Technology Limited.




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

// File: contracts/stores/WhitelistStore.sol

// Copyright 2017 Loopring Technology Limited.





/// @title WhitelistStore
/// @dev This store maintains a wallet's whitelisted addresses.
contract WhitelistStore is DataStore, AddressSet, OwnerManagable
{
    bytes32 internal constant DAPPS = keccak256("__DAPPS__");

    // wallet => whitelisted_addr => effective_since
    mapping(address => mapping(address => uint)) public effectiveTimeMap;

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

    event DappWhitelisted(
        address addr,
        bool    whitelisted
    );

    constructor() DataStore() {}

    function addToWhitelist(
        address wallet,
        address addr,
        uint    effectiveTime
        )
        external
        onlyWalletModule(wallet)
    {
        addAddressToSet(_walletKey(wallet), addr, true);
        uint effective = effectiveTime >= block.timestamp ? effectiveTime : block.timestamp;
        effectiveTimeMap[wallet][addr] = effective;
        emit Whitelisted(wallet, addr, true, effective);
    }

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

    function addDapp(address addr)
        external
        onlyManager
    {
        addAddressToSet(DAPPS, addr, true);
        emit DappWhitelisted(addr, true);
    }

    function removeDapp(address addr)
        external
        onlyManager
    {
        removeAddressFromSet(DAPPS, addr);
        emit DappWhitelisted(addr, false);
    }

    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 <= block.timestamp;
    }

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

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

    function isDappOrWhitelisted(
        address wallet,
        address addr
        )
        public
        view
        returns (bool res)
    {
        (res,) = isWhitelisted(wallet, addr);
        return res || isAddressInSet(DAPPS, addr);
    }

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

}

// File: contracts/thirdparty/strings.sol

/*
 * @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 kblock.timestamp 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;
    }
}

// File: contracts/thirdparty/ens/ENS.sol

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


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

// File: contracts/thirdparty/ens/ENSConsumer.sol

// 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 public constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;

    // the address of the ENS registry
    address immutable 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) {
        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));
    }
}

// File: contracts/thirdparty/ens/BaseENSManager.sol

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







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

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

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

    function register(
        address _wallet,
        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 immutable 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 _wallet, address _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)
    {
        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 _wallet The wallet which owns the subdomain.
    * @param _owner The wallet's owner.
    * @param _label The subdomain label.
    * @param _approval The signature of _wallet, _owner and _label by a manager.
    */
    function register(
        address _wallet,
        address _owner,
        string  calldata _label,
        bytes   calldata _approval
        )
        external
        override
        onlyManager
    {
        verifyApproval(_wallet, _owner, _label, _approval);

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

        // Forward ENS
        _ensRegistry.setSubnodeOwner(rootNode, labelNode, address(this));
        _ensRegistry.setResolver(node, address(_ensResolver));
        _ensRegistry.setOwner(node, _wallet);
        _ensResolver.setAddr(node, _wallet);

        // 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(_wallet);
        _ensResolver.setName(reverseNode, name);

        emit Registered(_wallet, _owner, name);
    }

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

    /**
    * @dev Resolves an address to an ENS name
    * @param _wallet The ENS owner address
    */
    function resolveName(address _wallet) public view override returns (string memory) {
        bytes32 reverseNode = getENSReverseRegistrar().node(_wallet);
        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 _wallet,
        address _owner,
        string  calldata _label,
        bytes   calldata _approval
        )
        internal
        view
    {
        bytes32 messageHash = keccak256(
            abi.encodePacked(
                _wallet,
                _owner,
                _label
            )
        );

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

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

}

// File: contracts/modules/ControllerImpl.sol

// Copyright 2017 Loopring Technology Limited.










/// @title ControllerImpl
/// @dev Basic implementation of a Controller.
///
/// @author Daniel Wang - <[email protected]>
contract ControllerImpl is Claimable, Controller
{
    HashStore           public immutable hashStore;
    QuotaStore          public immutable quotaStore;
    SecurityStore       public immutable securityStore;
    WhitelistStore      public immutable whitelistStore;
    ModuleRegistry      public immutable override moduleRegistry;
    address             public override  walletFactory;
    address             public immutable feeCollector;
    BaseENSManager      public immutable ensManager;
    PriceOracle         public immutable priceOracle;

    event AddressChanged(
        string   name,
        address  addr
    );

    constructor(
        HashStore         _hashStore,
        QuotaStore        _quotaStore,
        SecurityStore     _securityStore,
        WhitelistStore    _whitelistStore,
        ModuleRegistry    _moduleRegistry,
        address           _feeCollector,
        BaseENSManager    _ensManager,
        PriceOracle       _priceOracle
        )
    {
        hashStore = _hashStore;
        quotaStore = _quotaStore;
        securityStore = _securityStore;
        whitelistStore = _whitelistStore;
        moduleRegistry = _moduleRegistry;

        require(_feeCollector != address(0), "ZERO_ADDRESS");
        feeCollector = _feeCollector;

        ensManager = _ensManager;
        priceOracle = _priceOracle;
    }

    function initWalletFactory(address _walletFactory)
        external
        onlyOwner
    {
        require(walletFactory == address(0), "INITIALIZED_ALREADY");
        require(_walletFactory != address(0), "ZERO_ADDRESS");
        walletFactory = _walletFactory;
        emit AddressChanged("WalletFactory", walletFactory);
    }
}

// File: contracts/modules/base/BaseModule.sol

// Copyright 2017 Loopring Technology Limited.








/// @title BaseModule
/// @dev This contract implements some common functions that are likely
///      be useful for all modules.
///
/// @author Daniel Wang - <[email protected]>
abstract contract BaseModule is Module
{
    using MathUint      for uint;
    using AddressUtil   for address;

    event Activated   (address wallet);
    event Deactivated (address wallet);

    ModuleRegistry public immutable moduleRegistry;
    SecurityStore  public immutable securityStore;
    WhitelistStore public immutable whitelistStore;
    QuotaStore     public immutable quotaStore;
    HashStore      public immutable hashStore;
    address        public immutable walletFactory;
    PriceOracle    public immutable priceOracle;
    address        public immutable feeCollector;

    function logicalSender()
        internal
        view
        virtual
        returns (address payable)
    {
        return msg.sender;
    }

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

    modifier eligibleWalletOwner(address addr)
    {
        require(addr != address(0) && !addr.isContract(), "INVALID_OWNER");
        _;
    }

    constructor(ControllerImpl _controller)
    {
        moduleRegistry = _controller.moduleRegistry();
        securityStore = _controller.securityStore();
        whitelistStore = _controller.whitelistStore();
        quotaStore = _controller.quotaStore();
        hashStore = _controller.hashStore();
        walletFactory = _controller.walletFactory();
        priceOracle = _controller.priceOracle();
        feeCollector = _controller.feeCollector();
    }

    /// @dev This method will cause an re-entry to the same module contract.
    function activate()
        external
        override
        virtual
    {
        address wallet = logicalSender();
        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 = logicalSender();
        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
    {
        if (token == address(0)) {
            transactCall(wallet, to, amount, "");
            return;
        }

        bytes memory txData = abi.encodeWithSelector(
            ERC20.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.
        bool success = returnData.length == 0 ? true :  abi.decode(returnData, (bool));
        require(success, "ERC20_TRANSFER_FAILED");
    }

    // Special case for transactCall to support approvals on "bad" ERC20 tokens
    function transactTokenApprove(
        address wallet,
        address token,
        address spender,
        uint    amount
        )
        internal
    {
        require(token != address(0), "INVALID_TOKEN");
        bytes memory txData = abi.encodeWithSelector(
            ERC20.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.
        bool success = returnData.length == 0 ? true :  abi.decode(returnData, (bool));
        require(success, "ERC20_APPROVE_FAILED");
    }

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

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

    function reimburseGasFee(
        address     wallet,
        address     recipient,
        address     gasToken,
        uint        gasPrice,
        uint        gasAmount
        )
        internal
    {
        uint gasCost = gasAmount.mul(gasPrice);

        quotaStore.checkAndAddToSpent(
            wallet,
            gasToken,
            gasAmount,
            priceOracle
        );

        transactTokenTransfer(wallet, gasToken, recipient, gasCost);
    }
}

// File: contracts/modules/base/MetaTxAware.sol

// Copyright 2017 Loopring Technology Limited.




/// @title MetaTxAware
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by GSN's contract codebase:
/// https://github.com/opengsn/gsn/contracts
///
/// @dev Inherit this abstract contract to make a module meta-transaction
///      aware. `msgSender()` shall be used to replace `msg.sender` for
///      verifying permissions.
abstract contract MetaTxAware
{
    using AddressUtil for address;
    using BytesUtil   for bytes;

    address public immutable metaTxForwarder;

    constructor(address _metaTxForwarder)
    {
        metaTxForwarder = _metaTxForwarder;
    }

    modifier txAwareHashNotAllowed()
    {
        require(txAwareHash() == 0, "INVALID_TX_AWARE_HASH");
        _;
    }

    /// @dev Return's the function's logicial message sender. This method should be
    // used to replace `msg.sender` for all meta-tx enabled functions.
    function msgSender()
        internal
        view
        returns (address payable)
    {
        if (msg.data.length >= 56 && msg.sender == metaTxForwarder) {
            return msg.data.toAddress(msg.data.length - 52).toPayable();
        } else {
            return msg.sender;
        }
    }

    function txAwareHash()
        internal
        view
        returns (bytes32)
    {
        if (msg.data.length >= 56 && msg.sender == metaTxForwarder) {
            return msg.data.toBytes32(msg.data.length - 32);
        } else {
            return 0;
        }
    }
}

// File: contracts/modules/base/MetaTxModule.sol

// Copyright 2017 Loopring Technology Limited.






/// @title MetaTxModule
/// @dev Base contract for all modules that support meta-transactions.
///
/// @author Daniel Wang - <[email protected]>
///
/// The design of this contract is inspired by GSN's contract codebase:
/// https://github.com/opengsn/gsn/contracts
abstract contract MetaTxModule is MetaTxAware, BaseModule
{
    using SignatureUtil for bytes32;

    constructor(
        ControllerImpl _controller,
        address        _metaTxForwarder
        )
        MetaTxAware(_metaTxForwarder)
        BaseModule(_controller)
    {
    }

   function logicalSender()
        internal
        view
        virtual
        override
        returns (address payable)
    {
        return msgSender();
    }
}

// File: contracts/modules/security/GuardianUtils.sol

// Copyright 2017 Loopring Technology Limited.




/// @title GuardianUtils
/// @author Brecht Devos - <[email protected]>
library GuardianUtils
{
    enum SigRequirement
    {
        MAJORITY_OWNER_NOT_ALLOWED,
        MAJORITY_OWNER_ALLOWED,
        MAJORITY_OWNER_REQUIRED,
        OWNER_OR_ANY_GUARDIAN,
        ANY_GUARDIAN
    }

    function requireMajority(
        SecurityStore   securityStore,
        address         wallet,
        address[]       memory signers,
        SigRequirement  requirement
        )
        internal
        view
        returns (bool)
    {
        // We always need at least one signer
        if (signers.length == 0) {
            return false;
        }

        // Calculate total group sizes
        Data.Guardian[] memory allGuardians = securityStore.guardians(wallet, false);
        require(allGuardians.length > 0, "NO_GUARDIANS");

        address lastSigner;
        bool walletOwnerSigned = false;
        address owner = Wallet(wallet).owner();
        for (uint i = 0; i < signers.length; i++) {
            // Check for duplicates
            require(signers[i] > lastSigner, "INVALID_SIGNERS_ORDER");
            lastSigner = signers[i];

            if (signers[i] == owner) {
                walletOwnerSigned = true;
            } else {
                require(_isWalletGuardian(allGuardians, signers[i]), "SIGNER_NOT_GUARDIAN");
            }
        }

        if (requirement == SigRequirement.OWNER_OR_ANY_GUARDIAN) {
            return signers.length == 1;
        } else if (requirement == SigRequirement.ANY_GUARDIAN) {
            require(!walletOwnerSigned, "WALLET_OWNER_SIGNATURE_NOT_ALLOWED");
            return signers.length == 1;
        }

        // Check owner requirements
        if (requirement == SigRequirement.MAJORITY_OWNER_REQUIRED) {
            require(walletOwnerSigned, "WALLET_OWNER_SIGNATURE_REQUIRED");
        } else if (requirement == SigRequirement.MAJORITY_OWNER_NOT_ALLOWED) {
            require(!walletOwnerSigned, "WALLET_OWNER_SIGNATURE_NOT_ALLOWED");
        }

        uint numExtendedSigners = allGuardians.length;
        if (walletOwnerSigned) {
            numExtendedSigners += 1;
            require(signers.length > 1, "NO_GUARDIAN_SIGNED_BESIDES_OWNER");
        }

        return _hasMajority(signers.length, numExtendedSigners);
    }

    function _isWalletGuardian(
        Data.Guardian[] memory allGuardians,
        address signer
        )
        private
        pure
        returns (bool)
    {
        for (uint i = 0; i < allGuardians.length; i++) {
            if (allGuardians[i].addr == signer) {
                return true;
            }
        }
        return false;
    }

    function _hasMajority(
        uint signed,
        uint total
        )
        private
        pure
        returns (bool)
    {
        return total > 0 && signed >= (total >> 1) + 1;
    }
}

// File: contracts/modules/security/SignedRequest.sol

// Copyright 2017 Loopring Technology Limited.







/// @title SignedRequest
/// @dev Utility library for better handling of signed wallet requests.
///      This library must be deployed and linked to other modules.
///
/// @author Daniel Wang - <[email protected]>
library SignedRequest {
    using SignatureUtil for bytes32;

    struct Request {
        address[] signers;
        bytes[]   signatures;
        uint      validUntil;
        address   wallet;
    }

    function verifyRequest(
        HashStore                    hashStore,
        SecurityStore                securityStore,
        bytes32                      domainSeperator,
        bytes32                      txAwareHash,
        GuardianUtils.SigRequirement sigRequirement,
        Request memory               request,
        bytes   memory               encodedRequest
        )
        public
    {
        require(block.timestamp <= request.validUntil, "EXPIRED_SIGNED_REQUEST");

        bytes32 _txAwareHash = EIP712.hashPacked(domainSeperator, encodedRequest);

        // If txAwareHash from the meta-transaction is non-zero,
        // we must verify it matches the hash signed by the respective signers.
        require(
            txAwareHash == 0 || txAwareHash == _txAwareHash,
            "TX_INNER_HASH_MISMATCH"
        );

        // Save hash to prevent replay attacks
        hashStore.verifyAndUpdate(request.wallet, _txAwareHash);

        require(
            _txAwareHash.verifySignatures(request.signers, request.signatures),
            "INVALID_SIGNATURES"
        );

        require(
            GuardianUtils.requireMajority(
                securityStore,
                request.wallet,
                request.signers,
                sigRequirement
            ),
            "PERMISSION_DENIED"
        );
    }
}

// File: contracts/modules/security/SecurityModule.sol

// Copyright 2017 Loopring Technology Limited.





/// @title SecurityStore
///
/// @author Daniel Wang - <[email protected]>
abstract contract SecurityModule is MetaTxModule
{

    // The minimal number of guardians for recovery and locking.
    uint public constant TOUCH_GRACE_PERIOD = 30 days;

    event WalletLocked(
        address indexed wallet,
        address         by,
        bool            locked
    );

    constructor(
        ControllerImpl _controller,
        address        _metaTxForwarder
        )
        MetaTxModule(_controller, _metaTxForwarder)
    {
    }

    modifier onlyFromWalletOrOwnerWhenUnlocked(address wallet)
    {
        address payable _logicalSender = logicalSender();
        // If the wallet's signature verfication passes, the wallet must be unlocked.
        require(
            _logicalSender == wallet ||
            (_logicalSender == Wallet(wallet).owner() && !_isWalletLocked(wallet)),
             "NOT_FROM_WALLET_OR_OWNER_OR_WALLET_LOCKED"
        );
        securityStore.touchLastActiveWhenRequired(wallet, TOUCH_GRACE_PERIOD);
        _;
    }

    modifier onlyWalletGuardian(address wallet, address guardian)
    {
        require(securityStore.isGuardian(wallet, guardian, false), "NOT_GUARDIAN");
        _;
    }

    modifier notWalletGuardian(address wallet, address guardian)
    {
        require(!securityStore.isGuardian(wallet, guardian, false), "IS_GUARDIAN");
        _;
    }

    // ----- internal methods -----

    function _lockWallet(address wallet, address by, bool locked)
        internal
    {
        securityStore.setLock(wallet, locked);
        emit WalletLocked(wallet, by, locked);
    }

    function _isWalletLocked(address wallet)
        internal
        view
        returns (bool)
    {
        return securityStore.isLocked(wallet);
    }

    function _updateQuota(
        QuotaStore qs,
        address    wallet,
        address    token,
        uint       amount
        )
        internal
    {
        if (amount == 0) return;
        if (qs == QuotaStore(0)) return;

        qs.checkAndAddToSpent(
            wallet,
            token,
            amount,
            priceOracle
        );
    }
}

// File: contracts/modules/core/ERC1271Module.sol

// Copyright 2017 Loopring Technology Limited.








/// @title ERC1271Module
/// @dev This module enables our smart wallets to message signers.
/// @author Brecht Devos - <[email protected]>
/// @author Daniel Wang - <[email protected]>
abstract contract ERC1271Module is ERC1271, SecurityModule
{
    using SignatureUtil for bytes;
    using SignatureUtil for bytes32;
    using AddressUtil   for address;

    function bindableMethodsForERC1271()
        internal
        pure
        returns (bytes4[] memory methods)
    {
        methods = new bytes4[](1);
        methods[0] = ERC1271.isValidSignature.selector;
    }

    // Will use msg.sender to detect the wallet, so this function should be called through
    // the bounded method on the wallet itself, not directly on this module.
    //
    // Note that we allow chained wallet ownership:
    // Wallet1 owned by Wallet2, Wallet2 owned by Wallet3, ..., WaleltN owned by an EOA.
    // The verificaiton of Wallet1's signature will succeed if the final EOA's signature is
    // valid.
    function isValidSignature(
        bytes32      _signHash,
        bytes memory _signature
        )
        public
        view
        override
        returns (bytes4 magicValue)
    {
        address wallet = msg.sender;
        if (securityStore.isLocked(wallet)) {
            return 0;
        }

        if (_signHash.verifySignature(Wallet(wallet).owner(), _signature)) {
            return ERC1271_MAGICVALUE;
        } else {
            return 0;
        }
    }
}

// File: contracts/lib/ReentrancyGuard.sol

// Copyright 2017 Loopring Technology Limited.


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

// File: contracts/base/BaseWallet.sol

// Copyright 2017 Loopring Technology Limited.







/// @title BaseWallet
/// @dev This contract provides basic implementation for a Wallet.
///
/// @author Daniel Wang - <[email protected]>
abstract contract BaseWallet is ReentrancyGuard, Wallet
{
    // WARNING: do not delete wallet state data to make this implementation
    // compatible with early versions.
    //
    //  ----- DATA LAYOUT BEGINS -----
    address internal _owner;

    mapping (address => bool) private modules;

    Controller public controller;

    mapping (bytes4  => address) internal methodToModule;
    //  ----- DATA LAYOUT ENDS -----

    event OwnerChanged          (address newOwner);
    event ControllerChanged     (address newController);
    event ModuleAdded           (address module);
    event ModuleRemoved         (address module);
    event MethodBound           (bytes4  method, address module);
    event WalletSetup           (address owner);

    modifier onlyFromModule
    {
        require(modules[msg.sender], "MODULE_UNAUTHORIZED");
        _;
    }

    modifier onlyFromFactory
    {
        require(
            msg.sender == controller.walletFactory(),
            "UNAUTHORIZED"
        );
        _;
    }

    /// @dev We need to make sure the Factory address cannot be changed without wallet owner's
    ///      explicit authorization.
    modifier onlyFromFactoryOrModule
    {
        require(
            modules[msg.sender] || msg.sender == controller.walletFactory(),
            "UNAUTHORIZED"
        );
        _;
    }

    /// @dev Set up this wallet by assigning an original owner
    ///
    ///      Note that calling this method more than once will throw.
    ///
    /// @param _initialOwner The owner of this wallet, must not be address(0).
    function initOwner(
        address _initialOwner
        )
        external
        onlyFromFactory
    {
        require(controller != Controller(0), "NO_CONTROLLER");
        require(_owner == address(0), "INITIALIZED_ALREADY");
        require(_initialOwner != address(0), "ZERO_ADDRESS");

        _owner = _initialOwner;
        emit WalletSetup(_initialOwner);
    }

    /// @dev Set up this wallet by assigning a controller and initial modules.
    ///
    ///      Note that calling this method more than once will throw.
    ///      And this method must be invoked before owner is initialized
    ///
    /// @param _controller The Controller instance.
    /// @param _modules The initial modules.
    function init(
        Controller _controller,
        address[]  calldata _modules
        )
        external
    {
        require(
            _owner == address(0) &&
            controller == Controller(0) &&
            _controller != Controller(0),
            "CONTROLLER_INIT_FAILED"
        );

        controller = _controller;

        ModuleRegistry moduleRegistry = controller.moduleRegistry();
        for (uint i = 0; i < _modules.length; i++) {
            _addModule(_modules[i], moduleRegistry);
        }
    }

    function owner()
        override
        public
        view
        returns (address)
    {
        return _owner;
    }

    function setOwner(address newOwner)
        external
        override
        onlyFromModule
    {
        require(newOwner != address(0), "ZERO_ADDRESS");
        require(newOwner != address(this), "PROHIBITED");
        require(newOwner != _owner, "SAME_ADDRESS");
        _owner = newOwner;
        emit OwnerChanged(newOwner);
    }

    function setController(Controller newController)
        external
        onlyFromModule
    {
        require(newController != controller, "SAME_CONTROLLER");
        require(newController != Controller(0), "INVALID_CONTROLLER");
        controller = newController;
        emit ControllerChanged(address(newController));
    }

    function addModule(address _module)
        external
        override
        onlyFromFactoryOrModule
    {
        _addModule(_module, controller.moduleRegistry());
    }

    function removeModule(address _module)
        external
        override
        onlyFromModule
    {
        // Allow deactivate to fail to make sure the module can be removed
        require(modules[_module], "MODULE_NOT_EXISTS");
        try Module(_module).deactivate() {} catch {}
        delete modules[_module];
        emit ModuleRemoved(_module);
    }

    function hasModule(address _module)
        public
        view
        override
        returns (bool)
    {
        return modules[_module];
    }

    function bindMethod(bytes4 _method, address _module)
        external
        override
        onlyFromModule
    {
        require(_method != bytes4(0), "BAD_METHOD");
        if (_module != address(0)) {
            require(modules[_module], "MODULE_UNAUTHORIZED");
        }

        methodToModule[_method] = _module;
        emit MethodBound(_method, _module);
    }

    function boundMethodModule(bytes4 _method)
        public
        view
        override
        returns (address)
    {
        return methodToModule[_method];
    }

    function transact(
        uint8    mode,
        address  to,
        uint     value,
        bytes    calldata data
        )
        external
        override
        onlyFromFactoryOrModule
        returns (bytes memory returnData)
    {
        bool success;
        (success, returnData) = _call(mode, to, value, data);

        if (!success) {
            assembly {
                returndatacopy(0, 0, returndatasize())
                revert(0, returndatasize())
            }
        }
    }

    receive()
        external
        payable
    {
    }

    /// @dev This default function can receive Ether or perform queries to modules
    ///      using bound methods.
    fallback()
        external
        payable
    {
        address module = methodToModule[msg.sig];
        require(modules[module], "MODULE_UNAUTHORIZED");

        (bool success, bytes memory returnData) = module.call{value: msg.value}(msg.data);
        assembly {
            switch success
            case 0 { revert(add(returnData, 32), mload(returnData)) }
            default { return(add(returnData, 32), mload(returnData)) }
        }
    }

    function _addModule(address _module, ModuleRegistry moduleRegistry)
        internal
    {
        require(_module != address(0), "NULL_MODULE");
        require(modules[_module] == false, "MODULE_EXISTS");
        require(
            moduleRegistry.isModuleEnabled(_module),
            "INVALID_MODULE"
        );
        modules[_module] = true;
        emit ModuleAdded(_module);
        Module(_module).activate();
    }

    function _call(
        uint8          mode,
        address        target,
        uint           value,
        bytes calldata data
        )
        private
        returns (
            bool success,
            bytes memory returnData
        )
    {
        if (mode == 1) {
            // solium-disable-next-line security/no-call-value
            (success, returnData) = target.call{value: value}(data);
        } else if (mode == 2) {
            // solium-disable-next-line security/no-call-value
            (success, returnData) = target.delegatecall(data);
        } else if (mode == 3) {
            require(value == 0, "INVALID_VALUE");
            // solium-disable-next-line security/no-call-value
            (success, returnData) = target.staticcall(data);
        } else {
            revert("UNSUPPORTED_MODE");
        }
    }
}

// File: contracts/thirdparty/Create2.sol

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

// File: contracts/thirdparty/proxy/CloneFactory.sol

// This code is taken from https://eips.ethereum.org/EIPS/eip-1167
// Modified to a library and generalized to support create/create2.

/*
The MIT License (MIT)

Copyright (c) 2018 Murray Software, LLC.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly

library CloneFactory {
  function getByteCode(address target) internal pure returns (bytes memory byteCode) {
    bytes20 targetBytes = bytes20(target);
    assembly {
      byteCode := mload(0x40)
      mstore(byteCode, 0x37)

      let clone := add(byteCode, 0x20)
      mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
      mstore(add(clone, 0x14), targetBytes)
      mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)

      mstore(0x40, add(byteCode, 0x60))
    }
  }
}

// File: contracts/modules/core/WalletFactory.sol

// Copyright 2017 Loopring Technology Limited.














/// @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]>
contract WalletFactory
{
    using AddressUtil for address;
    using SignatureUtil for bytes32;

    event BlankDeployed (address blank,  bytes32 version);
    event BlankConsumed (address blank);
    event WalletCreated (address wallet, string ensLabel, address owner, bool blankUsed);

    string public constant WALLET_CREATION = "WALLET_CREATION";

    bytes32 public constant CREATE_WALLET_TYPEHASH = keccak256(
        "createWallet(address owner,uint256 salt,address blankAddress,string ensLabel,bool ensRegisterReverse,address[] modules)"
    );

    mapping(address => bytes32) blanks;

    bytes32             public immutable DOMAIN_SEPERATOR;
    ControllerImpl      public immutable controller;
    address             public immutable walletImplementation;
    bool                public immutable allowEmptyENS; // MUST be false in production

    BaseENSManager      public immutable ensManager;
    address             public immutable ensResolver;
    ENSReverseRegistrar public immutable ensReverseRegistrar;

    constructor(
        ControllerImpl _controller,
        address        _walletImplementation,
        bool           _allowEmptyENS
        )
    {
        DOMAIN_SEPERATOR = EIP712.hash(
            EIP712.Domain("WalletFactory", "1.2.0", address(this))
        );
        controller = _controller;
        walletImplementation = _walletImplementation;
        allowEmptyENS = _allowEmptyENS;

        BaseENSManager _ensManager = _controller.ensManager();
        ensManager = _ensManager;
        ensResolver = _ensManager.ensResolver();
        ensReverseRegistrar = _ensManager.getENSReverseRegistrar();
    }

    /// @dev Create a set of new wallet blanks to be used in the future.
    /// @param modules The wallet's modules.
    /// @param salts The salts that can be used to generate nice addresses.
    function createBlanks(
        address[] calldata modules,
        uint[]    calldata salts
        )
        external
    {
        for (uint i = 0; i < salts.length; i++) {
            _createBlank(modules, salts[i]);
        }
    }

    /// @dev Create a new wallet by deploying a proxy.
    /// @param _owner The wallet's owner.
    /// @param _salt A salt to adjust address.
    /// @param _ensLabel The ENS subdomain to register, use "" to skip.
    /// @param _ensApproval The signature for ENS subdomain approval.
    /// @param _ensRegisterReverse True to register reverse ENS.
    /// @param _modules The wallet's modules.
    /// @param _signature The wallet owner's signature.
    /// @return _wallet The new wallet address
    function createWallet(
        address            _owner,
        uint               _salt,
        string    calldata _ensLabel,
        bytes     calldata _ensApproval,
        bool               _ensRegisterReverse,
        address[] calldata _modules,
        bytes     calldata _signature
        )
        external
        payable
        returns (address _wallet)
    {
        _validateRequest(
            _owner,
            _salt,
            address(0),
            _ensLabel,
            _ensRegisterReverse,
            _modules,
            _signature
        );

        _wallet = _deploy(_modules, _owner, _salt);

        _initializeWallet(
            _wallet,
            _owner,
            _ensLabel,
            _ensApproval,
            _ensRegisterReverse,
            false
        );
    }

    /// @dev Create a new wallet by using a pre-deployed blank.
    /// @param _owner The wallet's owner.
    /// @param _blank The address of the blank to use.
    /// @param _ensLabel The ENS subdomain to register, use "" to skip.
    /// @param _ensApproval The signature for ENS subdomain approval.
    /// @param _ensRegisterReverse True to register reverse ENS.
    /// @param _modules The wallet's modules.
    /// @param _signature The wallet owner's signature.
    /// @return _wallet The new wallet address
    function createWallet2(
        address            _owner,
        address            _blank,
        string    calldata _ensLabel,
        bytes     calldata _ensApproval,
        bool               _ensRegisterReverse,
        address[] calldata _modules,
        bytes     calldata _signature
        )
        external
        payable
        returns (address _wallet)
    {
        _validateRequest(
            _owner,
            0,
            _blank,
            _ensLabel,
            _ensRegisterReverse,
            _modules,
            _signature
        );

        _wallet = _consumeBlank(_blank, _modules);

        _initializeWallet(
            _wallet,
            _owner,
            _ensLabel,
            _ensApproval,
            _ensRegisterReverse,
            true
        );
    }

    function registerENS(
        address         _wallet,
        address         _owner,
        string calldata _ensLabel,
        bytes  calldata _ensApproval,
        bool            _ensRegisterReverse
        )
        external
    {
        _registerENS(_wallet, _owner, _ensLabel, _ensApproval, _ensRegisterReverse);
    }

    function computeWalletAddress(address owner, uint salt)
        public
        view
        returns (address)
    {
        return _computeAddress(owner, salt);
    }

    function computeBlankAddress(uint salt)
        public
        view
        returns (address)
    {
        return _computeAddress(address(0), salt);
    }

    function getWalletCreationCode()
        public
        view
        returns (bytes memory)
    {
        return CloneFactory.getByteCode(walletImplementation);
    }

    function _consumeBlank(
        address blank,
        address[] calldata modules
        )
        internal
        returns (address)
    {
        bytes32 version = keccak256(abi.encode(modules));
        require(blanks[blank] == version, "INVALID_ADOBE");
        delete blanks[blank];
        emit BlankConsumed(blank);
        return blank;
    }

    function _createBlank(
        address[] calldata modules,
        uint      salt
        )
        internal
        returns (address blank)
    {
        blank = _deploy(modules, address(0), salt);
        bytes32 version = keccak256(abi.encode(modules));
        blanks[blank] = version;

        emit BlankDeployed(blank, version);
    }

    function _deploy(
        address[] calldata modules,
        address            owner,
        uint               salt
        )
        internal
        returns (address payable wallet)
    {
        wallet = Create2.deploy(
            keccak256(abi.encodePacked(WALLET_CREATION, owner, salt)),
            CloneFactory.getByteCode(walletImplementation)
        );

        BaseWallet(wallet).init(controller, modules);
    }

    function _validateRequest(
        address            _owner,
        uint               _salt,
        address            _blankAddress,
        string    memory   _ensLabel,
        bool               _ensRegisterReverse,
        address[] memory   _modules,
        bytes     memory   _signature
        )
        private
        view
    {
        require(_owner != address(0) && !_owner.isContract(), "INVALID_OWNER");
        require(_modules.length > 0, "EMPTY_MODULES");

        bytes memory encodedRequest = abi.encode(
            CREATE_WALLET_TYPEHASH,
            _owner,
            _salt,
            _blankAddress,
            keccak256(bytes(_ensLabel)),
            _ensRegisterReverse,
            keccak256(abi.encode(_modules))
        );

        bytes32 signHash = EIP712.hashPacked(DOMAIN_SEPERATOR, encodedRequest);
        require(signHash.verifySignature(_owner, _signature), "INVALID_SIGNATURE");
    }

    function _initializeWallet(
        address       _wallet,
        address       _owner,
        string memory _ensLabel,
        bytes  memory _ensApproval,
        bool          _ensRegisterReverse,
        bool          _blankUsed
        )
        private
    {
        BaseWallet(_wallet.toPayable()).initOwner(_owner);

        if (bytes(_ensLabel).length > 0) {
            _registerENS(_wallet, _owner, _ensLabel, _ensApproval, _ensRegisterReverse);
        } else {
            require(allowEmptyENS, "EMPTY_ENS_NOT_ALLOWED");
        }

        emit WalletCreated(_wallet, _ensLabel, _owner, _blankUsed);
    }

    function _computeAddress(
        address owner,
        uint    salt
        )
        private
        view
        returns (address)
    {
        return Create2.computeAddress(
            keccak256(abi.encodePacked(WALLET_CREATION, owner, salt)),
            CloneFactory.getByteCode(walletImplementation)
        );
    }

    function _registerENS(
        address       wallet,
        address       owner,
        string memory ensLabel,
        bytes  memory ensApproval,
        bool          ensRegisterReverse
        )
        private
    {
        require(
            bytes(ensLabel).length > 0 &&
            ensApproval.length > 0,
            "INVALID_LABEL_OR_SIGNATURE"
        );

        ensManager.register(wallet, owner, ensLabel, ensApproval);

        if (ensRegisterReverse) {
            bytes memory data = abi.encodeWithSelector(
                ENSReverseRegistrar.claimWithResolver.selector,
                address(0), // the owner of the reverse record
                ensResolver
            );

            Wallet(wallet).transact(
                uint8(1),
                address(ensReverseRegistrar),
                0, // value
                data
            );
        }
    }
}

// File: contracts/modules/core/ForwarderModule.sol

// Copyright 2017 Loopring Technology Limited.









/// @title ForwarderModule
/// @dev A module to support wallet meta-transactions.
///
/// @author Daniel Wang - <[email protected]>
abstract contract ForwarderModule is SecurityModule
{
    using AddressUtil   for address;
    using BytesUtil     for bytes;
    using MathUint      for uint;
    using SignatureUtil for bytes32;

    bytes32 public immutable FORWARDER_DOMAIN_SEPARATOR;

    uint    public constant MAX_REIMBURSTMENT_OVERHEAD = 63000;

    bytes32 public constant META_TX_TYPEHASH = keccak256(
        "MetaTx(address from,address to,uint256 nonce,bytes32 txAwareHash,address gasToken,uint256 gasPrice,uint256 gasLimit,bytes data)"
    );

    mapping(address => uint) public nonces;

    event MetaTxExecuted(
        address relayer,
        address from,
        uint    nonce,
        bytes32 txAwareHash,
        bool    success,
        uint    gasUsed
    );

    struct MetaTx {
        address from; // the wallet
        address to;
        uint    nonce;
        bytes32 txAwareHash;
        address gasToken;
        uint    gasPrice;
        uint    gasLimit;
    }

    constructor(ControllerImpl _controller)
        SecurityModule(_controller, address(this))
    {
        FORWARDER_DOMAIN_SEPARATOR = EIP712.hash(
            EIP712.Domain("ForwarderModule", "1.2.0", address(this))
        );
    }

    function validateMetaTx(
        address from, // the wallet
        address to,
        uint    nonce,
        bytes32 txAwareHash,
        address gasToken,
        uint    gasPrice,
        uint    gasLimit,
        bytes   memory data,
        bytes   memory signature
        )
        public
        view
    {
        verifyTo(to, from, data);
        require(
            msg.sender != address(this) ||
            data.toBytes4(0) == ForwarderModule.batchCall.selector,
            "INVALID_TARGET"
        );

        require(
            nonce == 0 && txAwareHash != 0 ||
            nonce != 0 && txAwareHash == 0,
            "INVALID_NONCE"
        );

        bytes memory data_ = txAwareHash == 0 ? data : data.slice(0, 4); // function selector

        bytes memory encoded = abi.encode(
            META_TX_TYPEHASH,
            from,
            to,
            nonce,
            txAwareHash,
            gasToken,
            gasPrice,
            gasLimit,
            keccak256(data_)
        );

        bytes32 metaTxHash = EIP712.hashPacked(FORWARDER_DOMAIN_SEPARATOR, encoded);

        // Instead of always taking the expensive path through ER1271,
        // skip directly to the wallet owner here (which could still be another contract).
        //require(metaTxHash.verifySignature(from, signature), "INVALID_SIGNATURE");
        require(!securityStore.isLocked(from), "WALLET_LOCKED");
        require(metaTxHash.verifySignature(Wallet(from).owner(), signature), "INVALID_SIGNATURE");
    }

    function executeMetaTx(
        address from, // the wallet
        address to,
        uint    nonce,
        bytes32 txAwareHash,
        address gasToken,
        uint    gasPrice,
        uint    gasLimit,
        bytes   calldata data,
        bytes   calldata signature
        )
        external
        returns (
            bool success
        )
    {
        MetaTx memory metaTx = MetaTx(
            from,
            to,
            nonce,
            txAwareHash,
            gasToken,
            gasPrice,
            gasLimit
        );

        uint gasLeft = gasleft();
        require(gasLeft >= (gasLimit.mul(64) / 63), "OPERATOR_INSUFFICIENT_GAS");

        // Update the nonce before the call to protect against reentrancy
        if (metaTx.nonce != 0) {
            require(isNonceValid(metaTx.from, metaTx.nonce), "INVALID_NONCE");
            nonces[metaTx.from] = metaTx.nonce;
        }

        // The trick is to append the really logical message sender and the
        // transaction-aware hash to the end of the call data.
        (success, ) = metaTx.to.call{gas : metaTx.gasLimit, value : 0}(
            abi.encodePacked(data, metaTx.from, metaTx.txAwareHash)
        );

        // It's ok to do the validation after the 'call'. This is also necessary
        // in the case of creating the wallet, otherwise, wallet signature validation
        // will fail before the wallet is created.
        validateMetaTx(
            metaTx.from,
            metaTx.to,
            metaTx.nonce,
            metaTx.txAwareHash,
            metaTx.gasToken,
            metaTx.gasPrice,
            metaTx.gasLimit,
            data,
            signature
        );

        uint gasUsed = gasLeft - gasleft() +
            (signature.length + data.length + 7 * 32) * 16 + // data input cost
            447 +  // cost of MetaTxExecuted = 375 + 9 * 8
            23000; // transaction cost;

        // Fees are not to be charged by a relayer if the transaction fails with a
        // non-zero txAwareHash. The reason is that relayer can pick arbitrary 'data'
        // to make the transaction fail. Charging fees for such failures can drain
        // wallet funds.
        bool needReimburse = metaTx.gasPrice > 0 && (metaTx.txAwareHash == 0 || success);

        if (needReimburse) {
            gasUsed = gasUsed +
                MAX_REIMBURSTMENT_OVERHEAD + // near-worst case cost
                2300; // 2*SLOAD+1*CALL = 2*800+1*700=2300

            if (metaTx.gasToken == address(0)) {
                gasUsed -= 15000; // diff between an regular ERC20 transfer and an ETH send
            }

            uint gasToReimburse = gasUsed <= metaTx.gasLimit ? gasUsed : metaTx.gasLimit;

            reimburseGasFee(
                metaTx.from,
                feeCollector,
                metaTx.gasToken,
                metaTx.gasPrice,
                gasToReimburse
            );
        }

        emit MetaTxExecuted(
            msg.sender,
            metaTx.from,
            metaTx.nonce,
            metaTx.txAwareHash,
            success,
            gasUsed
        );
    }

    function batchCall(
        address   wallet,
        address[] calldata to,
        bytes[]   calldata data
        )
        external
        txAwareHashNotAllowed()
        onlyFromWalletOrOwnerWhenUnlocked(wallet)
    {
        require(to.length == data.length, "INVALID_DATA");

        for (uint i = 0; i < to.length; i++) {
            require(to[i] != address(this), "INVALID_TARGET");
            verifyTo(to[i], wallet, data[i]);
            // The trick is to append the really logical message sender and the
            // transaction-aware hash to the end of the call data.
            (bool success, ) = to[i].call(
                abi.encodePacked(data[i], wallet, bytes32(0))
            );
            require(success, "BATCHED_CALL_FAILED");
        }
    }

    function lastNonce(address wallet)
        public
        view
        returns (uint)
    {
        return nonces[wallet];
    }

    function isNonceValid(address wallet, uint nonce)
        public
        view
        returns (bool)
    {
        return nonce > nonces[wallet] && (nonce >> 128) <= block.number;
    }

    function verifyTo(
        address to,
        address wallet,
        bytes   memory data
        )
        private
        view
    {
        // Since this contract is a module, we need to prevent wallet from interacting with
        // Stores via this module. Therefore, we must carefully check the 'to' address as follows,
        // so no Store can be used as 'to'.
        require(
            moduleRegistry.isModuleRegistered(to) ||

            // We only allow the wallet to call itself to addModule
            (to == wallet) &&
            data.toBytes4(0) == Wallet.addModule.selector ||

            to == walletFactory,
            "INVALID_DESTINATION_OR_METHOD"
        );
    }
}

// File: contracts/modules/core/FinalCoreModule.sol

// Copyright 2017 Loopring Technology Limited.




/// @title FinalCoreModule
/// @dev This module combines multiple small modules to
///      minimize the number of modules to reduce gas used
///      by wallet creation.
contract FinalCoreModule is
    ERC1271Module,
    ForwarderModule
{
    ControllerImpl private immutable controller_;

    constructor(ControllerImpl _controller)
        ForwarderModule(_controller)
    {
        controller_ = _controller;
    }

    function bindableMethods()
        public
        pure
        override
        returns (bytes4[] memory)
    {
        return bindableMethodsForERC1271();
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ControllerImpl","name":"_controller","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"wallet","type":"address"}],"name":"Activated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"wallet","type":"address"}],"name":"Deactivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"txAwareHash","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"}],"name":"MetaTxExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"bool","name":"locked","type":"bool"}],"name":"WalletLocked","type":"event"},{"inputs":[],"name":"FORWARDER_DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REIMBURSTMENT_OVERHEAD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"META_TX_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOUCH_GRACE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"batchCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bindableMethods","outputs":[{"internalType":"bytes4[]","name":"","type":"bytes4[]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"deactivate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes32","name":"txAwareHash","type":"bytes32"},{"internalType":"address","name":"gasToken","type":"address"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"executeMetaTx","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hashStore","outputs":[{"internalType":"contract HashStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"isNonceValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_signHash","type":"bytes32"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"magicValue","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"lastNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metaTxForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"moduleRegistry","outputs":[{"internalType":"contract ModuleRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceOracle","outputs":[{"internalType":"contract PriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quotaStore","outputs":[{"internalType":"contract QuotaStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"securityStore","outputs":[{"internalType":"contract SecurityStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes32","name":"txAwareHash","type":"bytes32"},{"internalType":"address","name":"gasToken","type":"address"},{"internalType":"uint256","name":"gasPrice","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"validateMetaTx","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[],"name":"walletFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistStore","outputs":[{"internalType":"contract WhitelistStore","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101e06040523480156200001257600080fd5b5060405162003634380380620036348339810160408190526200003591620005fe565b80803081818181806001600160a01b03166080816001600160a01b031660601b8152505050806001600160a01b031663b95459e46040518163ffffffff1660e01b815260040160206040518083038186803b1580156200009457600080fd5b505afa158015620000a9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000cf9190620005fe565b6001600160a01b031660a0816001600160a01b031660601b81525050806001600160a01b031663d51b3a1b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200012557600080fd5b505afa1580156200013a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001609190620005fe565b6001600160a01b031660c0816001600160a01b031660601b81525050806001600160a01b03166337423d5e6040518163ffffffff1660e01b815260040160206040518083038186803b158015620001b657600080fd5b505afa158015620001cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001f19190620005fe565b6001600160a01b031660e0816001600160a01b031660601b81525050806001600160a01b031663d9d104846040518163ffffffff1660e01b815260040160206040518083038186803b1580156200024757600080fd5b505afa1580156200025c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002829190620005fe565b6001600160a01b0316610100816001600160a01b031660601b81525050806001600160a01b031663cbe45d186040518163ffffffff1660e01b815260040160206040518083038186803b158015620002d957600080fd5b505afa158015620002ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003149190620005fe565b6001600160a01b0316610120816001600160a01b031660601b81525050806001600160a01b031663c5c036996040518163ffffffff1660e01b815260040160206040518083038186803b1580156200036b57600080fd5b505afa15801562000380573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003a69190620005fe565b6001600160a01b0316610140816001600160a01b031660601b81525050806001600160a01b0316632630c12f6040518163ffffffff1660e01b815260040160206040518083038186803b158015620003fd57600080fd5b505afa15801562000412573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004389190620005fe565b6001600160a01b0316610160816001600160a01b031660601b81525050806001600160a01b031663c415b95c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200048f57600080fd5b505afa158015620004a4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004ca9190620005fe565b6001600160a01b0316610180816001600160a01b031660601b8152505050505050506200056960405180606001604052806040518060400160405280600f81526020016e466f727761726465724d6f64756c6560881b8152508152602001604051806040016040528060058152602001640312e322e360dc1b8152508152602001306001600160a01b03168152506200058560201b620012fc1760201c565b6101a0525060601b6001600160601b0319166101c05262000669565b6000804690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f836000015180519060200120846020015180519060200120838660400151604051602001620005e095949392919062000624565b60405160208183030381529060405280519060200120915050919050565b60006020828403121562000610578081fd5b81516200061d8162000650565b9392505050565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b6001600160a01b03811681146200066657600080fd5b50565b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c6101205160601c6101405160601c6101605160601c6101805160601c6101a0516101c05160601c612efa6200073a600039508061068d52806108c1525080610c4c528061124a5250806104cd528061191052508061126e52806115e95250806112925250806112da52806118dd5250806104f152508061037452806106f25280610e8c52806112b65280611a655250806111bf52806114d052508061118552806119a45280611b7b5250612efa6000f3fe608060405234801561001057600080fd5b506004361061018d5760003560e01c8063a017b3bf116100e3578063c0fd43b41161008c578063cbe45d1811610066578063cbe45d18146102cb578063d51b3a1b146102d3578063d9d10484146102db5761018d565b8063c0fd43b4146102a8578063c415b95c146102bb578063c5c03699146102c35761018d565b8063afa3363d116100bd578063afa3363d14610278578063b95459e41461028d578063bd11257c146102955761018d565b8063a017b3bf14610260578063a664eb8e14610268578063aec2bf59146102705761018d565b806351b42b0011610145578063840fdc781161011f578063840fdc781461022557806385a4b0de1461022d5780638c4751471461024d5761018d565b806351b42b00146101f557806370c62824146101fd5780637ecebe00146102125761018d565b80632630c12f116101765780632630c12f146101c557806337423d5e146101da57806345000dc8146101e25761018d565b80630f15f4c0146101925780631626ba7e1461019c575b600080fd5b61019a6102e3565b005b6101af6101aa36600461263b565b610332565b6040516101bc91906129f9565b60405180910390f35b6101cd6104cb565b6040516101bc91906127ee565b6101cd6104ef565b61019a6101f03660046124b1565b610513565b61019a61087b565b6102056108bf565b6040516101bc9190612923565b6102056102203660046123a2565b6108e3565b6102056108f5565b61024061023b3660046123da565b6108fc565b6040516101bc9190612918565b61019a61025b366004612570565b610cda565b61020561115f565b6101cd611183565b6102056111a7565b6102806111ad565b6040516101bc91906128b2565b6101cd6111bd565b6102406102a33660046125f0565b6111e1565b6102056102b63660046123a2565b611220565b6101cd611248565b6101cd61126c565b6101cd611290565b6101cd6112b4565b6101cd6112d8565b60006102ed611373565b90506102f88161137d565b7f0cc43938d137e7efade6a531f663e78c1fc75257b0d65ffda2fdaf70cb49cdf98160405161032791906127ee565b60405180910390a150565b6040517f4a4fbeec000000000000000000000000000000000000000000000000000000008152600090339073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690634a4fbeec906103a99084906004016127ee565b60206040518083038186803b1580156103c157600080fd5b505afa1580156103d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f9919061261b565b156104085750600090506104c5565b6104918173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561045157600080fd5b505afa158015610465573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048991906123be565b859085611428565b156104bf57507f1626ba7e0000000000000000000000000000000000000000000000000000000090506104c5565b50600090505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b61051e888a84611493565b333014158061057857507f8c47514700000000000000000000000000000000000000000000000000000000610554836000611672565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b6105b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612c4c565b60405180910390fd5b861580156105c457508515155b806105d7575086158015906105d7575085155b61060d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612bde565b6060861561062757610622836000600461168e565b610629565b825b905060607ff3c56bcb8317dca4d93b75989c647335ccd94939f2863c4466c7964f0d15dc958b8b8b8b8b8b8b89805190602001206040516020016106759998979695949392919061292c565b604051602081830303815290604052905060006106b27f00000000000000000000000000000000000000000000000000000000000000008361172c565b6040517f4a4fbeec00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690634a4fbeec90610727908f906004016127ee565b60206040518083038186803b15801561073f57600080fd5b505afa158015610753573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610777919061261b565b156107ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612cba565b6108378c73ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107f757600080fd5b505afa15801561080b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082f91906123be565b829086611428565b61086d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612aa5565b505050505050505050505050565b6000610885611373565b90506108908161179d565b7f749cb6b4c510bc468cf6b9c2086d6f0a54d6b18e25d37bf3200e68eab0880c008160405161032791906127ee565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006020819052908152604090205481565b62278d0081565b600061090661227f565b6040518060e001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c81526020018b81526020018a73ffffffffffffffffffffffffffffffffffffffff16815260200189815260200188815250905060005a9050603f61098f896040611843565b8161099657fe5b048110156109d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612c15565b604082015115610a50576109ec826000015183604001516111e1565b610a22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612bde565b604080830151835173ffffffffffffffffffffffffffffffffffffffff166000908152602081905291909120555b816020015173ffffffffffffffffffffffffffffffffffffffff168260c001516000898986600001518760600151604051602001610a919493929190612734565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610ac99161277a565b600060405180830381858888f193505050503d8060008114610b07576040519150601f19603f3d011682016040523d82523d6000602084013e610b0c565b606091505b505080935050610bb9826000015183602001518460400151856060015186608001518760a001518860c001518e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061051392505050565b6000601060e086890101025a8303016101bf016159d80190506000808460a00151118015610bf0575060608401511580610bf05750845b90508015610c7d57608084015161ff149092019173ffffffffffffffffffffffffffffffffffffffff16610c2657613a98820391505b60008460c00151831115610c3e578460c00151610c40565b825b9050610c7b85600001517f000000000000000000000000000000000000000000000000000000000000000087608001518860a0015185611891565b505b8351604080860151606087015191517fe685e02371cebe44a5d2cf72edfeea9b8426d318eb9b70869bc667ec5a7069a193610cbf93339391928b90899061280f565b60405180910390a1505050509b9a5050505050505050505050565b610ce261197e565b15610d19576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612a6e565b846000610d24611373565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480610e1957508173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610da157600080fd5b505afa158015610db5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd991906123be565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16148015610e195750610e1782611a25565b155b610e4f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612b81565b6040517fafaee9f100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063afaee9f190610ec690859062278d009060040161288c565b600060405180830381600087803b158015610ee057600080fd5b505af1158015610ef4573d6000803e3d6000fd5b5050508584149050610f32576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612d28565b60005b858110156111555730878783818110610f4a57fe5b9050602002016020810190610f5f91906123a2565b73ffffffffffffffffffffffffffffffffffffffff161415610fad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612c4c565b61102a878783818110610fbc57fe5b9050602002016020810190610fd191906123a2565b89878785818110610fde57fe5b9050602002810190610ff09190612da7565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061149392505050565b600087878381811061103857fe5b905060200201602081019061104d91906123a2565b73ffffffffffffffffffffffffffffffffffffffff1686868481811061106f57fe5b90506020028101906110819190612da7565b6040516110979291908d90600090602001612734565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526110cf9161277a565b6000604051808303816000865af19150503d806000811461110c576040519150601f19603f3d011682016040523d82523d6000602084013e611111565b606091505b505090508061114c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612b13565b50600101610f35565b5050505050505050565b7ff3c56bcb8317dca4d93b75989c647335ccd94939f2863c4466c7964f0d15dc9581565b7f000000000000000000000000000000000000000000000000000000000000000081565b61f61881565b60606111b7611aea565b90505b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081205482118015611219575043608083901c11155b9392505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000804690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f836000015180519060200120846020015180519060200120838660400151604051602001611355959493929190612989565b60405160208183030381529060405280519060200120915050919050565b60006111b7611b55565b8060606113886111ad565b905060005b8151811015611422578273ffffffffffffffffffffffffffffffffffffffff1663b149206e8383815181106113be57fe5b6020026020010151306040518363ffffffff1660e01b81526004016113e4929190612a26565b600060405180830381600087803b1580156113fe57600080fd5b505af1158015611412573d6000803e3d6000fd5b50506001909201915061138d9050565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff831661144d57506000611219565b61146c8373ffffffffffffffffffffffffffffffffffffffff16611c12565b6114805761147b848484611c49565b61148b565b61148b848484611d83565b949350505050565b6040517f1c5ebe2f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690631c5ebe2f906115059086906004016127ee565b60206040518083038186803b15801561151d57600080fd5b505afa158015611531573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611555919061261b565b806115e157508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156115e157507f1ed86f19000000000000000000000000000000000000000000000000000000006115bd826000611672565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b8061163757507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b61166d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612b4a565b505050565b6000816004018351101561168557600080fd5b50016020015190565b6060818301845110156116a057600080fd5b6060821580156116bb57604051915060208201604052611723565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156116f45780518352602092830192016116dc565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b60006040518060400160405280600281526020017f190100000000000000000000000000000000000000000000000000000000000081525083838051906020012060405160200161177f93929190612796565b60405160208183030381529060405280519060200120905092915050565b8060606117a86111ad565b905060005b8151811015611422578273ffffffffffffffffffffffffffffffffffffffff1663b149206e8383815181106117de57fe5b602002602001015160006040518363ffffffff1660e01b8152600401611805929190612a26565b600060405180830381600087803b15801561181f57600080fd5b505af1158015611833573d6000803e3d6000fd5b5050600190920191506117ad9050565b81810282158061185b57508183828161185857fe5b04145b6104c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612cf1565b600061189d8284611843565b6040517f71689b2b00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906371689b2b90611938908990889087907f000000000000000000000000000000000000000000000000000000000000000090600401612854565b600060405180830381600087803b15801561195257600080fd5b505af1158015611966573d6000803e3d6000fd5b5050505061197686858784611edf565b505050505050565b6000603836108015906119c657503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b15611a1d57611a1660206000369050036000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506120319050565b90506111ba565b5060006111ba565b6040517f4a4fbeec00000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690634a4fbeec90611a9a9085906004016127ee565b60206040518083038186803b158015611ab257600080fd5b505afa158015611ac6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c5919061261b565b60408051600180825281830190925260609160208083019080368337019050509050631626ba7e60e01b81600081518110611b2157fe5b7fffffffff000000000000000000000000000000000000000000000000000000009092166020928302919091019091015290565b600060383610801590611b9d57503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b15611c0b57611a16611bf060346000369050036000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506120449050565b73ffffffffffffffffffffffffffffffffffffffff166111ba565b50336111ba565b6000813f801580159061121957507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141592915050565b600073ffffffffffffffffffffffffffffffffffffffff8316611c6e57506000611219565b8151600090611c7e906001612070565b90506000611c8c84836120b2565b60ff166004811115611c9a57fe5b82855290506002816004811115611cad57fe5b1415611cf257611cbd86856120ce565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149250611d76565b6003816004811115611d0057fe5b1415611d7157600086604051602001611d1991906127bd565b604051602081830303815290604052805190602001209050611d3b81866120ce565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614935050611d76565b600092505b5060010182529392505050565b60006060631626ba7e60e01b8584604051602401611da29291906129c2565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608573ffffffffffffffffffffffffffffffffffffffff1683604051611e2a919061277a565b600060405180830381855afa9150503d8060008114611e65576040519150601f19603f3d011682016040523d82523d6000602084013e611e6a565b606091505b5091509150818015611e7d575080516020145b8015611ed457507f1626ba7e00000000000000000000000000000000000000000000000000000000611eb0826000611672565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316611f1b57611f15848383604051806020016040528060008152506121a6565b50611422565b606063a9059cbb60e01b8383604051602401611f3892919061288c565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290506060611fc686866000856121a6565b905060008151600014611fec5781806020019051810190611fe7919061261b565b611fef565b60015b905080612028576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612c83565b50505050505050565b6000816020018351101561168557600080fd5b6000816014018351101561205757600080fd5b5001602001516c01000000000000000000000000900490565b6000828211156120ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612adc565b50900390565b600081600101835110156120c557600080fd5b50016001015190565b600081516041146120e1575060006104c5565b60208201516040830151604184015160ff167f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561212757600093505050506104c5565b8060ff16601b148061213c57508060ff16601c145b1561219a576001868285856040516000815260200160405260405161216494939291906129db565b6020604051602081039080840390855afa158015612186573d6000803e3d6000fd5b5050506020604051035193505050506104c5565b600093505050506104c5565b6040517f7122b74c00000000000000000000000000000000000000000000000000000000815260609073ffffffffffffffffffffffffffffffffffffffff861690637122b74c9061220290600190889088908890600401612d5f565b600060405180830381600087803b15801561221c57600080fd5b505af1158015612230573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526122769190810190612680565b95945050505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b80356104c581612e9f565b60008083601f8401126122d7578182fd5b50813567ffffffffffffffff8111156122ee578182fd5b602083019150836020808302850101111561230857600080fd5b9250929050565b60008083601f840112612320578182fd5b50813567ffffffffffffffff811115612337578182fd5b60208301915083602082850101111561230857600080fd5b600082601f83011261235f578081fd5b813561237261236d82612e31565b612e0a565b915080825283602082850101111561238957600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156123b3578081fd5b813561121981612e9f565b6000602082840312156123cf578081fd5b815161121981612e9f565b60008060008060008060008060008060006101208c8e0312156123fb578687fd5b6124058c35612e9f565b8b359a5061241660208d0135612e9f565b60208c0135995060408c0135985060608c013597506124388d60808e016122bb565b965060a08c0135955060c08c0135945067ffffffffffffffff8060e08e01351115612461578485fd5b6124718e60e08f01358f0161230f565b90955093506101008d0135811015612487578283fd5b506124998d6101008e01358e0161230f565b81935080925050509295989b509295989b9093969950565b60008060008060008060008060006101208a8c0312156124cf578485fd5b89356124da81612e9f565b985060208a01356124ea81612e9f565b975060408a0135965060608a013595506125078b60808c016122bb565b945060a08a0135935060c08a0135925060e08a013567ffffffffffffffff80821115612531578384fd5b61253d8d838e0161234f565b93506101008c0135915080821115612553578283fd5b506125608c828d0161234f565b9150509295985092959850929598565b600080600080600060608688031215612587578081fd5b853561259281612e9f565b9450602086013567ffffffffffffffff808211156125ae578283fd5b6125ba89838a016122c6565b909650945060408801359150808211156125d2578283fd5b506125df888289016122c6565b969995985093965092949392505050565b60008060408385031215612602578182fd5b823561260d81612e9f565b946020939093013593505050565b60006020828403121561262c578081fd5b81518015158114611219578182fd5b6000806040838503121561264d578182fd5b82359150602083013567ffffffffffffffff81111561266a578182fd5b6126768582860161234f565b9150509250929050565b600060208284031215612691578081fd5b815167ffffffffffffffff8111156126a7578182fd5b8201601f810184136126b7578182fd5b80516126c561236d82612e31565b8181528560208385010111156126d9578384fd5b612276826020830160208601612e73565b60008151808452612702816020860160208601612e73565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000848683375060609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016919092019081526014810191909152603401919050565b6000825161278c818460208701612e73565b9190910192915050565b600084516127a8818460208901612e73565b91909101928352506020820152604001919050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9687168152949095166020850152604084019290925260608301521515608082015260a081019190915260c00190565b73ffffffffffffffffffffffffffffffffffffffff948516815292841660208401526040830191909152909116606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561290c5783517fffffffff0000000000000000000000000000000000000000000000000000000016835292840192918401916001016128ce565b50909695505050505050565b901515815260200190565b90815260200190565b98895273ffffffffffffffffffffffffffffffffffffffff97881660208a015295871660408901526060880194909452608087019290925290931660a085015260c084019290925260e08301919091526101008201526101200190565b94855260208501939093526040840191909152606083015273ffffffffffffffffffffffffffffffffffffffff16608082015260a00190565b60008382526040602083015261148b60408301846126ea565b93845260ff9290921660208401526040830152606082015260800190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60208082526015908201527f494e56414c49445f54585f41574152455f484153480000000000000000000000604082015260600190565b60208082526011908201527f494e56414c49445f5349474e4154555245000000000000000000000000000000604082015260600190565b6020808252600d908201527f5355425f554e444552464c4f5700000000000000000000000000000000000000604082015260600190565b60208082526013908201527f424154434845445f43414c4c5f4641494c454400000000000000000000000000604082015260600190565b6020808252601d908201527f494e56414c49445f44455354494e4154494f4e5f4f525f4d4554484f44000000604082015260600190565b60208082526029908201527f4e4f545f46524f4d5f57414c4c45545f4f525f4f574e45525f4f525f57414c4c60408201527f45545f4c4f434b45440000000000000000000000000000000000000000000000606082015260800190565b6020808252600d908201527f494e56414c49445f4e4f4e434500000000000000000000000000000000000000604082015260600190565b60208082526019908201527f4f50455241544f525f494e53554646494349454e545f47415300000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f544152474554000000000000000000000000000000000000604082015260600190565b60208082526015908201527f45524332305f5452414e534645525f4641494c45440000000000000000000000604082015260600190565b6020808252600d908201527f57414c4c45545f4c4f434b454400000000000000000000000000000000000000604082015260600190565b6020808252600c908201527f4d554c5f4f564552464c4f570000000000000000000000000000000000000000604082015260600190565b6020808252600c908201527f494e56414c49445f444154410000000000000000000000000000000000000000604082015260600190565b600060ff8616825273ffffffffffffffffffffffffffffffffffffffff8516602083015283604083015260806060830152612d9d60808301846126ea565b9695505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612ddb578283fd5b83018035915067ffffffffffffffff821115612df5578283fd5b60200191503681900382131561230857600080fd5b60405181810167ffffffffffffffff81118282101715612e2957600080fd5b604052919050565b600067ffffffffffffffff821115612e47578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015612e8e578181015183820152602001612e76565b838111156114225750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612ec157600080fd5b5056fea26469706673582212209b598f470371d5cad3e2e5137947b13a97d8f3d5d252a6498bf33044cebb822c64736f6c63430007000033000000000000000000000000b39e09279d4035c0f92307741d9dd8ed66e74de0

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061018d5760003560e01c8063a017b3bf116100e3578063c0fd43b41161008c578063cbe45d1811610066578063cbe45d18146102cb578063d51b3a1b146102d3578063d9d10484146102db5761018d565b8063c0fd43b4146102a8578063c415b95c146102bb578063c5c03699146102c35761018d565b8063afa3363d116100bd578063afa3363d14610278578063b95459e41461028d578063bd11257c146102955761018d565b8063a017b3bf14610260578063a664eb8e14610268578063aec2bf59146102705761018d565b806351b42b0011610145578063840fdc781161011f578063840fdc781461022557806385a4b0de1461022d5780638c4751471461024d5761018d565b806351b42b00146101f557806370c62824146101fd5780637ecebe00146102125761018d565b80632630c12f116101765780632630c12f146101c557806337423d5e146101da57806345000dc8146101e25761018d565b80630f15f4c0146101925780631626ba7e1461019c575b600080fd5b61019a6102e3565b005b6101af6101aa36600461263b565b610332565b6040516101bc91906129f9565b60405180910390f35b6101cd6104cb565b6040516101bc91906127ee565b6101cd6104ef565b61019a6101f03660046124b1565b610513565b61019a61087b565b6102056108bf565b6040516101bc9190612923565b6102056102203660046123a2565b6108e3565b6102056108f5565b61024061023b3660046123da565b6108fc565b6040516101bc9190612918565b61019a61025b366004612570565b610cda565b61020561115f565b6101cd611183565b6102056111a7565b6102806111ad565b6040516101bc91906128b2565b6101cd6111bd565b6102406102a33660046125f0565b6111e1565b6102056102b63660046123a2565b611220565b6101cd611248565b6101cd61126c565b6101cd611290565b6101cd6112b4565b6101cd6112d8565b60006102ed611373565b90506102f88161137d565b7f0cc43938d137e7efade6a531f663e78c1fc75257b0d65ffda2fdaf70cb49cdf98160405161032791906127ee565b60405180910390a150565b6040517f4a4fbeec000000000000000000000000000000000000000000000000000000008152600090339073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002f84f6f613280fd4df11ab2480e777ba8bb6282a1690634a4fbeec906103a99084906004016127ee565b60206040518083038186803b1580156103c157600080fd5b505afa1580156103d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f9919061261b565b156104085750600090506104c5565b6104918173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561045157600080fd5b505afa158015610465573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048991906123be565b859085611428565b156104bf57507f1626ba7e0000000000000000000000000000000000000000000000000000000090506104c5565b50600090505b92915050565b7f0000000000000000000000004ead68830f45d73478c93953ed56c532bffff4b581565b7f0000000000000000000000001663647389993181d13cb45e2113c5d92fa89e7081565b61051e888a84611493565b333014158061057857507f8c47514700000000000000000000000000000000000000000000000000000000610554836000611672565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b6105b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612c4c565b60405180910390fd5b861580156105c457508515155b806105d7575086158015906105d7575085155b61060d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612bde565b6060861561062757610622836000600461168e565b610629565b825b905060607ff3c56bcb8317dca4d93b75989c647335ccd94939f2863c4466c7964f0d15dc958b8b8b8b8b8b8b89805190602001206040516020016106759998979695949392919061292c565b604051602081830303815290604052905060006106b27f83713a68dca33ef314a9a9faab35e2a9ef37599514ba8bbec1879966ef71e6aa8361172c565b6040517f4a4fbeec00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002f84f6f613280fd4df11ab2480e777ba8bb6282a1690634a4fbeec90610727908f906004016127ee565b60206040518083038186803b15801561073f57600080fd5b505afa158015610753573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610777919061261b565b156107ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612cba565b6108378c73ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107f757600080fd5b505afa15801561080b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082f91906123be565b829086611428565b61086d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612aa5565b505050505050505050505050565b6000610885611373565b90506108908161179d565b7f749cb6b4c510bc468cf6b9c2086d6f0a54d6b18e25d37bf3200e68eab0880c008160405161032791906127ee565b7f83713a68dca33ef314a9a9faab35e2a9ef37599514ba8bbec1879966ef71e6aa81565b60006020819052908152604090205481565b62278d0081565b600061090661227f565b6040518060e001604052808e73ffffffffffffffffffffffffffffffffffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff1681526020018c81526020018b81526020018a73ffffffffffffffffffffffffffffffffffffffff16815260200189815260200188815250905060005a9050603f61098f896040611843565b8161099657fe5b048110156109d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612c15565b604082015115610a50576109ec826000015183604001516111e1565b610a22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612bde565b604080830151835173ffffffffffffffffffffffffffffffffffffffff166000908152602081905291909120555b816020015173ffffffffffffffffffffffffffffffffffffffff168260c001516000898986600001518760600151604051602001610a919493929190612734565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610ac99161277a565b600060405180830381858888f193505050503d8060008114610b07576040519150601f19603f3d011682016040523d82523d6000602084013e610b0c565b606091505b505080935050610bb9826000015183602001518460400151856060015186608001518760a001518860c001518e8e8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061051392505050565b6000601060e086890101025a8303016101bf016159d80190506000808460a00151118015610bf0575060608401511580610bf05750845b90508015610c7d57608084015161ff149092019173ffffffffffffffffffffffffffffffffffffffff16610c2657613a98820391505b60008460c00151831115610c3e578460c00151610c40565b825b9050610c7b85600001517f000000000000000000000000ee94cf48924b720af939e732e98f30f9594f87c587608001518860a0015185611891565b505b8351604080860151606087015191517fe685e02371cebe44a5d2cf72edfeea9b8426d318eb9b70869bc667ec5a7069a193610cbf93339391928b90899061280f565b60405180910390a1505050509b9a5050505050505050505050565b610ce261197e565b15610d19576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612a6e565b846000610d24611373565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480610e1957508173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610da157600080fd5b505afa158015610db5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd991906123be565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16148015610e195750610e1782611a25565b155b610e4f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612b81565b6040517fafaee9f100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002f84f6f613280fd4df11ab2480e777ba8bb6282a169063afaee9f190610ec690859062278d009060040161288c565b600060405180830381600087803b158015610ee057600080fd5b505af1158015610ef4573d6000803e3d6000fd5b5050508584149050610f32576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612d28565b60005b858110156111555730878783818110610f4a57fe5b9050602002016020810190610f5f91906123a2565b73ffffffffffffffffffffffffffffffffffffffff161415610fad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612c4c565b61102a878783818110610fbc57fe5b9050602002016020810190610fd191906123a2565b89878785818110610fde57fe5b9050602002810190610ff09190612da7565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061149392505050565b600087878381811061103857fe5b905060200201602081019061104d91906123a2565b73ffffffffffffffffffffffffffffffffffffffff1686868481811061106f57fe5b90506020028101906110819190612da7565b6040516110979291908d90600090602001612734565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290526110cf9161277a565b6000604051808303816000865af19150503d806000811461110c576040519150601f19603f3d011682016040523d82523d6000602084013e611111565b606091505b505090508061114c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612b13565b50600101610f35565b5050505050505050565b7ff3c56bcb8317dca4d93b75989c647335ccd94939f2863c4466c7964f0d15dc9581565b7f000000000000000000000000e915058df18e7efe92af5c44df3f575fba061b6481565b61f61881565b60606111b7611aea565b90505b90565b7f000000000000000000000000c8af9c2389af5710dba268050ebf9350cd0acab381565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081205482118015611219575043608083901c11155b9392505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b7f000000000000000000000000ee94cf48924b720af939e732e98f30f9594f87c581565b7f0000000000000000000000009fad9ffcea95c345d41055a63bd099e1a057610981565b7f000000000000000000000000c6ea970917451fe149537779c20f721eb5e71e7681565b7f0000000000000000000000002f84f6f613280fd4df11ab2480e777ba8bb6282a81565b7f00000000000000000000000015f50bb48ca4be1ad4a6ad5804b18fb7d198618f81565b6000804690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f836000015180519060200120846020015180519060200120838660400151604051602001611355959493929190612989565b60405160208183030381529060405280519060200120915050919050565b60006111b7611b55565b8060606113886111ad565b905060005b8151811015611422578273ffffffffffffffffffffffffffffffffffffffff1663b149206e8383815181106113be57fe5b6020026020010151306040518363ffffffff1660e01b81526004016113e4929190612a26565b600060405180830381600087803b1580156113fe57600080fd5b505af1158015611412573d6000803e3d6000fd5b50506001909201915061138d9050565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff831661144d57506000611219565b61146c8373ffffffffffffffffffffffffffffffffffffffff16611c12565b6114805761147b848484611c49565b61148b565b61148b848484611d83565b949350505050565b6040517f1c5ebe2f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c8af9c2389af5710dba268050ebf9350cd0acab31690631c5ebe2f906115059086906004016127ee565b60206040518083038186803b15801561151d57600080fd5b505afa158015611531573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611555919061261b565b806115e157508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156115e157507f1ed86f19000000000000000000000000000000000000000000000000000000006115bd826000611672565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b8061163757507f0000000000000000000000009fad9ffcea95c345d41055a63bd099e1a057610973ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b61166d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612b4a565b505050565b6000816004018351101561168557600080fd5b50016020015190565b6060818301845110156116a057600080fd5b6060821580156116bb57604051915060208201604052611723565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156116f45780518352602092830192016116dc565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b60006040518060400160405280600281526020017f190100000000000000000000000000000000000000000000000000000000000081525083838051906020012060405160200161177f93929190612796565b60405160208183030381529060405280519060200120905092915050565b8060606117a86111ad565b905060005b8151811015611422578273ffffffffffffffffffffffffffffffffffffffff1663b149206e8383815181106117de57fe5b602002602001015160006040518363ffffffff1660e01b8152600401611805929190612a26565b600060405180830381600087803b15801561181f57600080fd5b505af1158015611833573d6000803e3d6000fd5b5050600190920191506117ad9050565b81810282158061185b57508183828161185857fe5b04145b6104c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612cf1565b600061189d8284611843565b6040517f71689b2b00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000015f50bb48ca4be1ad4a6ad5804b18fb7d198618f16906371689b2b90611938908990889087907f0000000000000000000000004ead68830f45d73478c93953ed56c532bffff4b590600401612854565b600060405180830381600087803b15801561195257600080fd5b505af1158015611966573d6000803e3d6000fd5b5050505061197686858784611edf565b505050505050565b6000603836108015906119c657503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e915058df18e7efe92af5c44df3f575fba061b6416145b15611a1d57611a1660206000369050036000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506120319050565b90506111ba565b5060006111ba565b6040517f4a4fbeec00000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002f84f6f613280fd4df11ab2480e777ba8bb6282a1690634a4fbeec90611a9a9085906004016127ee565b60206040518083038186803b158015611ab257600080fd5b505afa158015611ac6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c5919061261b565b60408051600180825281830190925260609160208083019080368337019050509050631626ba7e60e01b81600081518110611b2157fe5b7fffffffff000000000000000000000000000000000000000000000000000000009092166020928302919091019091015290565b600060383610801590611b9d57503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e915058df18e7efe92af5c44df3f575fba061b6416145b15611c0b57611a16611bf060346000369050036000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506120449050565b73ffffffffffffffffffffffffffffffffffffffff166111ba565b50336111ba565b6000813f801580159061121957507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141592915050565b600073ffffffffffffffffffffffffffffffffffffffff8316611c6e57506000611219565b8151600090611c7e906001612070565b90506000611c8c84836120b2565b60ff166004811115611c9a57fe5b82855290506002816004811115611cad57fe5b1415611cf257611cbd86856120ce565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149250611d76565b6003816004811115611d0057fe5b1415611d7157600086604051602001611d1991906127bd565b604051602081830303815290604052805190602001209050611d3b81866120ce565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614935050611d76565b600092505b5060010182529392505050565b60006060631626ba7e60e01b8584604051602401611da29291906129c2565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608573ffffffffffffffffffffffffffffffffffffffff1683604051611e2a919061277a565b600060405180830381855afa9150503d8060008114611e65576040519150601f19603f3d011682016040523d82523d6000602084013e611e6a565b606091505b5091509150818015611e7d575080516020145b8015611ed457507f1626ba7e00000000000000000000000000000000000000000000000000000000611eb0826000611672565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316611f1b57611f15848383604051806020016040528060008152506121a6565b50611422565b606063a9059cbb60e01b8383604051602401611f3892919061288c565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290506060611fc686866000856121a6565b905060008151600014611fec5781806020019051810190611fe7919061261b565b611fef565b60015b905080612028576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612c83565b50505050505050565b6000816020018351101561168557600080fd5b6000816014018351101561205757600080fd5b5001602001516c01000000000000000000000000900490565b6000828211156120ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ae90612adc565b50900390565b600081600101835110156120c557600080fd5b50016001015190565b600081516041146120e1575060006104c5565b60208201516040830151604184015160ff167f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561212757600093505050506104c5565b8060ff16601b148061213c57508060ff16601c145b1561219a576001868285856040516000815260200160405260405161216494939291906129db565b6020604051602081039080840390855afa158015612186573d6000803e3d6000fd5b5050506020604051035193505050506104c5565b600093505050506104c5565b6040517f7122b74c00000000000000000000000000000000000000000000000000000000815260609073ffffffffffffffffffffffffffffffffffffffff861690637122b74c9061220290600190889088908890600401612d5f565b600060405180830381600087803b15801561221c57600080fd5b505af1158015612230573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526122769190810190612680565b95945050505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b80356104c581612e9f565b60008083601f8401126122d7578182fd5b50813567ffffffffffffffff8111156122ee578182fd5b602083019150836020808302850101111561230857600080fd5b9250929050565b60008083601f840112612320578182fd5b50813567ffffffffffffffff811115612337578182fd5b60208301915083602082850101111561230857600080fd5b600082601f83011261235f578081fd5b813561237261236d82612e31565b612e0a565b915080825283602082850101111561238957600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156123b3578081fd5b813561121981612e9f565b6000602082840312156123cf578081fd5b815161121981612e9f565b60008060008060008060008060008060006101208c8e0312156123fb578687fd5b6124058c35612e9f565b8b359a5061241660208d0135612e9f565b60208c0135995060408c0135985060608c013597506124388d60808e016122bb565b965060a08c0135955060c08c0135945067ffffffffffffffff8060e08e01351115612461578485fd5b6124718e60e08f01358f0161230f565b90955093506101008d0135811015612487578283fd5b506124998d6101008e01358e0161230f565b81935080925050509295989b509295989b9093969950565b60008060008060008060008060006101208a8c0312156124cf578485fd5b89356124da81612e9f565b985060208a01356124ea81612e9f565b975060408a0135965060608a013595506125078b60808c016122bb565b945060a08a0135935060c08a0135925060e08a013567ffffffffffffffff80821115612531578384fd5b61253d8d838e0161234f565b93506101008c0135915080821115612553578283fd5b506125608c828d0161234f565b9150509295985092959850929598565b600080600080600060608688031215612587578081fd5b853561259281612e9f565b9450602086013567ffffffffffffffff808211156125ae578283fd5b6125ba89838a016122c6565b909650945060408801359150808211156125d2578283fd5b506125df888289016122c6565b969995985093965092949392505050565b60008060408385031215612602578182fd5b823561260d81612e9f565b946020939093013593505050565b60006020828403121561262c578081fd5b81518015158114611219578182fd5b6000806040838503121561264d578182fd5b82359150602083013567ffffffffffffffff81111561266a578182fd5b6126768582860161234f565b9150509250929050565b600060208284031215612691578081fd5b815167ffffffffffffffff8111156126a7578182fd5b8201601f810184136126b7578182fd5b80516126c561236d82612e31565b8181528560208385010111156126d9578384fd5b612276826020830160208601612e73565b60008151808452612702816020860160208601612e73565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000848683375060609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016919092019081526014810191909152603401919050565b6000825161278c818460208701612e73565b9190910192915050565b600084516127a8818460208901612e73565b91909101928352506020820152604001919050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9687168152949095166020850152604084019290925260608301521515608082015260a081019190915260c00190565b73ffffffffffffffffffffffffffffffffffffffff948516815292841660208401526040830191909152909116606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561290c5783517fffffffff0000000000000000000000000000000000000000000000000000000016835292840192918401916001016128ce565b50909695505050505050565b901515815260200190565b90815260200190565b98895273ffffffffffffffffffffffffffffffffffffffff97881660208a015295871660408901526060880194909452608087019290925290931660a085015260c084019290925260e08301919091526101008201526101200190565b94855260208501939093526040840191909152606083015273ffffffffffffffffffffffffffffffffffffffff16608082015260a00190565b60008382526040602083015261148b60408301846126ea565b93845260ff9290921660208401526040830152606082015260800190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60208082526015908201527f494e56414c49445f54585f41574152455f484153480000000000000000000000604082015260600190565b60208082526011908201527f494e56414c49445f5349474e4154555245000000000000000000000000000000604082015260600190565b6020808252600d908201527f5355425f554e444552464c4f5700000000000000000000000000000000000000604082015260600190565b60208082526013908201527f424154434845445f43414c4c5f4641494c454400000000000000000000000000604082015260600190565b6020808252601d908201527f494e56414c49445f44455354494e4154494f4e5f4f525f4d4554484f44000000604082015260600190565b60208082526029908201527f4e4f545f46524f4d5f57414c4c45545f4f525f4f574e45525f4f525f57414c4c60408201527f45545f4c4f434b45440000000000000000000000000000000000000000000000606082015260800190565b6020808252600d908201527f494e56414c49445f4e4f4e434500000000000000000000000000000000000000604082015260600190565b60208082526019908201527f4f50455241544f525f494e53554646494349454e545f47415300000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f544152474554000000000000000000000000000000000000604082015260600190565b60208082526015908201527f45524332305f5452414e534645525f4641494c45440000000000000000000000604082015260600190565b6020808252600d908201527f57414c4c45545f4c4f434b454400000000000000000000000000000000000000604082015260600190565b6020808252600c908201527f4d554c5f4f564552464c4f570000000000000000000000000000000000000000604082015260600190565b6020808252600c908201527f494e56414c49445f444154410000000000000000000000000000000000000000604082015260600190565b600060ff8616825273ffffffffffffffffffffffffffffffffffffffff8516602083015283604083015260806060830152612d9d60808301846126ea565b9695505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612ddb578283fd5b83018035915067ffffffffffffffff821115612df5578283fd5b60200191503681900382131561230857600080fd5b60405181810167ffffffffffffffff81118282101715612e2957600080fd5b604052919050565b600067ffffffffffffffff821115612e47578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015612e8e578181015183820152602001612e76565b838111156114225750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612ec157600080fd5b5056fea26469706673582212209b598f470371d5cad3e2e5137947b13a97d8f3d5d252a6498bf33044cebb822c64736f6c63430007000033

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

000000000000000000000000b39e09279d4035c0f92307741d9dd8ed66e74de0

-----Decoded View---------------
Arg [0] : _controller (address): 0xb39e09279D4035c0F92307741d9dd8ed66e74de0

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000b39e09279d4035c0f92307741d9dd8ed66e74de0


Deployed Bytecode Sourcemap

149669:436:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;102046:192;;;:::i;:::-;;117821:493;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;100729:43;;;:::i;:::-;;;;;;;:::i;100527:46::-;;;:::i;142704:1570::-;;;;;;:::i;:::-;;:::i;102324:198::-;;;:::i;141662:51::-;;;:::i;:::-;;;;;;;:::i;141997:38::-;;;;;;:::i;:::-;;:::i;114632:49::-;;;:::i;144282:3225::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;147515:796::-;;;;;;:::i;:::-;;:::i;141789:199::-;;;:::i;107376:40::-;;;:::i;141722:58::-;;;:::i;149934:168::-;;;:::i;:::-;;;;;;;:::i;100422:46::-;;;:::i;148461:191::-;;;;;;:::i;:::-;;:::i;148319:134::-;;;;;;:::i;:::-;;:::i;100779:44::-;;;:::i;100677:45::-;;;:::i;100629:41::-;;;:::i;100475:45::-;;;:::i;100580:42::-;;;:::i;102046:192::-;102135:14;102152:15;:13;:15::i;:::-;102135:32;;102178:19;102190:6;102178:11;:19::i;:::-;102213:17;102223:6;102213:17;;;;;;:::i;:::-;;;;;;;;102046:192;:::o;117821:493::-;118068:30;;;;;117991:17;;118043:10;;118068:22;:13;:22;;;;:30;;118043:10;;118068:30;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;118064:71;;;-1:-1:-1;118122:1:0;;-1:-1:-1;118115:8:0;;118064:71;118151:61;118184:6;118177:20;;;:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;118151:9;;118201:10;118151:25;:61::i;:::-;118147:160;;;-1:-1:-1;118236:18:0;;-1:-1:-1;118229:25:0;;118147:160;-1:-1:-1;118294:1:0;;-1:-1:-1;117821:493:0;;;;;:::o;100729:43::-;;;:::o;100527:46::-;;;:::o;142704:1570::-;143043:24;143052:2;143056:4;143062;143043:8;:24::i;:::-;143100:10;143122:4;143100:27;;;:98;;-1:-1:-1;143164:34:0;143144:16;:4;143158:1;143144:13;:16::i;:::-;:54;;;143100:98;143078:162;;;;;;;;;;;;:::i;:::-;;;;;;;;;143275:10;;:30;;;;-1:-1:-1;143289:16:0;;;143275:30;:77;;;-1:-1:-1;143322:10:0;;;;;:30;;-1:-1:-1;143336:16:0;;143322:30;143253:140;;;;;;;;;;;;:::i;:::-;143406:18;143427:16;;:42;;143453:16;:4;143464:1;143467;143453:10;:16::i;:::-;143427:42;;;143446:4;143427:42;143406:63;;143503:20;141832:156;143582:4;143601:2;143618:5;143638:11;143664:8;143687;143710;143743:5;143733:16;;;;;;143526:234;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;143503:257;;143773:18;143794:54;143812:26;143840:7;143794:17;:54::i;:::-;144120:28;;;;;143773:75;;-1:-1:-1;144120:22:0;:13;:22;;;;:28;;144143:4;;144120:28;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;144119:29;144111:55;;;;;;;;;;;;:::i;:::-;144185:59;144219:4;144212:18;;;:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;144185:10;;144234:9;144185:26;:59::i;:::-;144177:89;;;;;;;;;;;;:::i;:::-;142704:1570;;;;;;;;;;;;:::o;102324:198::-;102415:14;102432:15;:13;:15::i;:::-;102415:32;;102458:21;102472:6;102458:13;:21::i;:::-;102495:19;102507:6;102495:19;;;;;;:::i;141662:51::-;;;:::o;141997:38::-;;;;;;;;;;;;;;:::o;114632:49::-;114674:7;114632:49;:::o;144282:3225::-;144628:12;144668:20;;:::i;:::-;144691:168;;;;;;;;144712:4;144691:168;;;;;;144731:2;144691:168;;;;;;144748:5;144691:168;;;;144768:11;144691:168;;;;144794:8;144691:168;;;;;;144817:8;144691:168;;;;144840:8;144691:168;;;144668:191;;144872:12;144887:9;144872:24;-1:-1:-1;144946:2:0;144927:16;:8;144940:2;144927:12;:16::i;:::-;:21;;;;;;144915:7;:34;;144907:72;;;;;;;;;;;;:::i;:::-;145071:12;;;;:17;145067:164;;145113:39;145126:6;:11;;;145139:6;:12;;;145113;:39::i;:::-;145105:65;;;;;;;;;;;;:::i;:::-;145207:12;;;;;145192:11;;145185:19;;:6;:19;;;;;;;;;;;:34;145067:164;145398:6;:9;;;:14;;145419:6;:15;;;145444:1;145478:4;;145484:6;:11;;;145497:6;:18;;;145461:55;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;145398:129;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;145384:143;;;;;145761:268;145790:6;:11;;;145816:6;:9;;;145840:6;:12;;;145867:6;:18;;;145900:6;:15;;;145930:6;:15;;;145960:6;:15;;;145990:4;;145761:268;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;146009:9;;145761:268;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;145761:14:0;;-1:-1:-1;;;145761:268:0:i;:::-;146042:12;146136:2;146126:6;146093:30;;;:39;146092:46;146067:9;146057:7;:19;:81;146173:3;146057:119;146233:5;146057:181;146042:196;;146553:18;146592:1;146574:6;:15;;;:19;:59;;;;-1:-1:-1;146598:18:0;;;;:23;;:34;;;146625:7;146598:34;146553:80;;146650:13;146646:656;;;146849:15;;;;146690:101;;;;;146849:29;;146845:144;;146910:5;146899:16;;;;146845:144;147005:19;147038:6;:15;;;147027:7;:26;;:54;;147066:6;:15;;;147027:54;;;147056:7;147027:54;147005:76;;147098:192;147132:6;:11;;;147162:12;147193:6;:15;;;147227:6;:15;;;147261:14;147098:15;:192::i;:::-;146646:656;;147373:11;;147399:12;;;;;147426:18;;;;147319:180;;;;;;147348:10;;147373:11;;147459:7;;147481;;147319:180;:::i;:::-;;;;;;;;144282:3225;;;;;;;;;;;;;;;;;:::o;147515:796::-;107586:13;:11;:13::i;:::-;:18;107578:52;;;;;;;;;;;;:::i;:::-;147732:6:::1;115070:30;115103:15;:13;:15::i;:::-;115070:48;;115256:6;115238:24;;:14;:24;;;:111;;;;115305:6;115298:20;;;:22;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;115280:40;;:14;:40;;;:68;;;;;115325:23;115341:6;115325:15;:23::i;:::-;115324:24;115280:68;115216:203;;;;;;;;;;;;:::i;:::-;115430:69;::::0;;;;:41:::1;:13;:41;::::0;::::1;::::0;:69:::1;::::0;115472:6;;114674:7:::1;::::0;115430:69:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;;147764:24:0;;::::2;::::0;-1:-1:-1;147756:49:0::2;;;;;;;;;;;;:::i;:::-;147823:6;147818:486;147835:13:::0;;::::2;147818:486;;;147895:4;147878:2:::0;;147881:1;147878:5;;::::2;;;;;;;;;;;;;;;;;;:::i;:::-;:22;;;;147870:49;;;;;;;;;;;;:::i;:::-;147934:32;147943:2;;147946:1;147943:5;;;;;;;;;;;;;;;;;;;;:::i;:::-;147950:6;147958:4;;147963:1;147958:7;;;;;;;;;;;;;;;;;;:::i;:::-;147934:32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;::::0;;;;-1:-1:-1;147934:8:0::2;::::0;-1:-1:-1;;;147934:32:0:i:2;:::-;148131:12;148149:2;;148152:1;148149:5;;;;;;;;;;;;;;;;;;;;:::i;:::-;:10;;148195:4;;148200:1;148195:7;;;;;;;;;;;;;;;;;;:::i;:::-;148178:45;::::0;::::2;::::0;;;148204:6;;148220:1:::2;::::0;148178:45:::2;;;:::i;:::-;;::::0;;;;;::::2;::::0;;;;;;;148149:89:::2;::::0;::::2;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;148130:108;;;148261:7;148253:39;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;147850:3:0::2;;147818:486;;;;107641:1:::1;;147515:796:::0;;;;;:::o;141789:199::-;141832:156;141789:199;:::o;107376:40::-;;;:::o;141722:58::-;141775:5;141722:58;:::o;149934:168::-;150027:15;150067:27;:25;:27::i;:::-;150060:34;;149934:168;;:::o;100422:46::-;;;:::o;148461:191::-;148596:14;;;148559:4;148596:14;;;;;;;;;;;148588:22;;:56;;;;;148632:12;148624:3;148615:5;:12;;148614:30;;148588:56;148581:63;148461:191;-1:-1:-1;;;148461:191:0:o;148319:134::-;148431:14;;148402:4;148431:14;;;;;;;;;;;;148319:134::o;100779:44::-;;;:::o;100677:45::-;;;:::o;100629:41::-;;;:::o;100475:45::-;;;:::o;100580:42::-;;;:::o;19946:466::-;20032:7;20057:13;20104:9;20092:21;;19766:111;20244:6;:11;;;20228:29;;;;;;20292:6;:14;;;20276:32;;;;;;20327:8;20354:6;:24;;;20158:235;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;20134:270;;;;;;20127:277;;;19946:466;;;:::o;109104:169::-;109214:15;109254:11;:9;:11::i;103083:276::-;103172:6;103190:23;103216:17;:15;:17::i;:::-;103190:43;;103249:6;103244:108;103265:7;:14;103261:1;:18;103244:108;;;103301:1;:12;;;103314:7;103322:1;103314:10;;;;;;;;;;;;;;103334:4;103301:39;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;103281:3:0;;;;;-1:-1:-1;103244:108:0;;-1:-1:-1;103244:108:0;;;103083:276;;;:::o;16082:448::-;16269:4;16295:20;;;16291:65;;-1:-1:-1;16339:5:0;16332:12;;16291:65;16375:19;:6;:17;;;:19::i;:::-;:147;;16475:47;16494:8;16504:6;16512:9;16475:18;:47::i;:::-;16375:147;;;16409:51;16432:8;16442:6;16450:9;16409:22;:51::i;:::-;16368:154;16082:448;-1:-1:-1;;;;16082:448:0:o;148660:716::-;149072:37;;;;;:33;:14;:33;;;;:37;;149106:2;;149072:37;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:201;;;;149204:6;149198:12;;:2;:12;;;149197:76;;;;-1:-1:-1;149248:25:0;149228:16;:4;149242:1;149228:13;:16::i;:::-;:45;;;149197:76;149072:239;;;;149298:13;149292:19;;:2;:19;;;149072:239;149050:318;;;;;;;;;;;;:::i;:::-;148660:716;;;:::o;12908:297::-;12984:6;13029;13038:1;13029:10;13011:6;:13;:29;;13003:38;;;;;;-1:-1:-1;13126:30:0;13142:4;13126:30;13120:37;;12908:297::o;7566:2599::-;7713:12;7778:7;7769:6;:16;7751:6;:13;:35;;7743:44;;;;;;7800:22;7866:15;;7895:2005;;;;10044:4;10038:11;10025:24;;10097:4;10086:9;10082:20;10076:4;10069:34;7859:2259;;7895:2005;8080:4;8074:11;8061:24;;8749:2;8740:7;8736:16;9137:9;9130:17;9124:4;9120:28;9108:9;9097;9093:25;9089:60;9186:7;9182:2;9178:16;9443:6;9429:9;9422:17;9416:4;9412:28;9400:9;9392:6;9388:22;9384:57;9380:70;9214:434;9477:3;9473:2;9470:11;9214:434;;;9619:9;;9608:21;;9519:4;9511:13;;;;9552;9214:434;;;-1:-1:-1;;9668:26:0;;;9880:2;9863:11;9876:7;9859:25;9853:4;9846:39;-1:-1:-1;7859:2259:0;-1:-1:-1;10148:9:0;7566:2599;-1:-1:-1;;;;7566:2599:0:o;20420:299::-;20572:7;20645:13;;;;;;;;;;;;;;;;;20660:15;20687:11;20677:22;;;;;;20628:72;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;20604:107;;;;;;20597:114;;20420:299;;;;:::o;103424:275::-;103515:6;103533:23;103559:17;:15;:17::i;:::-;103533:43;;103592:6;103587:105;103608:7;:14;103604:1;:18;103587:105;;;103644:1;:12;;;103657:7;103665:1;103657:10;;;;;;;;;;;;;;103677:1;103644:36;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;103624:3:0;;;;;-1:-1:-1;103587:105:0;;-1:-1:-1;103587:105:0;14180:205;14316:5;;;14340:6;;;:20;;;14359:1;14354;14350;:5;;;;;;:10;14340:20;14332:45;;;;;;;;;;;;:::i;106279:490::-;106504:12;106519:23;:9;106533:8;106519:13;:23::i;:::-;106555:134;;;;;106504:38;;-1:-1:-1;106555:29:0;:10;:29;;;;:134;;106599:6;;106620:8;;106643:9;;106667:11;;106555:134;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;106702:59;106724:6;106732:8;106742:9;106753:7;106702:21;:59::i;:::-;106279:490;;;;;;:::o;108130:280::-;108203:7;108251:2;108232:8;:21;;;;:54;;-1:-1:-1;108257:10:0;:29;108271:15;108257:29;;108232:54;108228:175;;;108310:40;108347:2;108329:8;;:15;;:20;108310:8;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;108310:18:0;;:40;-1:-1:-1;;108310:18:0;:40;-1:-1:-1;108310:40:0:i;:::-;108303:47;;;;108228:175;-1:-1:-1;108390:1:0;108383:8;;116122:158;116242:30;;;;;116213:4;;116242:22;:13;:22;;;;:30;;116265:6;;116242:30;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;117166:218::-;117304:15;;;117317:1;117304:15;;;;;;;;;117253:23;;117304:15;;;;;;;;;;;-1:-1:-1;117304:15:0;117294:25;;117343:33;;;117330:7;117338:1;117330:10;;;;;;;;:46;;;;:10;;;;;;;;;;;:46;117166:218;:::o;107815:307::-;107886:15;107942:2;107923:8;:21;;;;:54;;-1:-1:-1;107948:10:0;:29;107962:15;107948:29;;107923:54;107919:196;;;108001:52;:40;108038:2;108020:8;;:15;;:20;108001:8;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;108001:18:0;;:40;-1:-1:-1;;108001:18:0;:40;-1:-1:-1;108001:40:0:i;:::-;:50;;;:52::i;107919:196::-;-1:-1:-1;108093:10:0;108086:17;;3762:638;3866:4;4240:17;;4277:15;;;;;:114;;-1:-1:-1;4325:66:0;4313:78;;;4269:123;-1:-1:-1;;3762:638:0:o;17662:1232::-;17851:12;17885:20;;;17881:65;;-1:-1:-1;17929:5:0;17922:12;;17881:65;17985:16;;17958:24;;17985:23;;18006:1;17985:20;:23::i;:::-;17958:50;-1:-1:-1;18019:27:0;18063:38;:9;17958:50;18063:17;:38::i;:::-;18049:53;;;;;;;;;;18215:38;;;18019:83;-1:-1:-1;18297:21:0;18280:13;:38;;;;;;;;;18276:450;;;18356:39;18375:8;18385:9;18356:18;:39::i;:::-;18346:49;;:6;:49;;;18335:61;;18276:450;;;18435:22;18418:13;:39;;;;;;;;;18414:312;;;18474:12;18570:8;18517:62;;;;;;;;:::i;:::-;;;;;;;;;;;;;18489:105;;;;;;18474:120;;18630:35;18649:4;18655:9;18630:18;:35::i;:::-;18620:45;;:6;:45;;;18609:57;;18414:312;;;;18709:5;18699:15;;18414:312;-1:-1:-1;18846:1:0;18821:27;18803:46;;17662:1232;;;;;:::o;18902:581::-;19081:4;19103:21;19164:33;;;19212:8;19235:9;19127:128;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19103:152;;19267:12;19281:19;19304:6;:17;;19322:8;19304:27;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19266:65;;;;19364:7;:43;;;;;19388:6;:13;19405:2;19388:19;19364:43;:100;;;;-1:-1:-1;19446:18:0;19424;:6;19440:1;19424:15;:18::i;:::-;:40;;;19364:100;19342:133;18902:581;-1:-1:-1;;;;;;;18902:581:0:o;104060:823::-;104235:19;;;104231:109;;104271:36;104284:6;104292:2;104296:6;104271:36;;;;;;;;;;;;:12;:36::i;:::-;;104322:7;;104231:109;104352:19;104411:23;;;104449:2;104466:6;104374:109;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;104494:23:0;104520:38;104533:6;104541:5;-1:-1:-1;104374:109:0;104520:12;:38::i;:::-;104494:64;;104745:12;104760:10;:17;104781:1;104760:22;:63;;104804:10;104793:30;;;;;;;;;;;;:::i;:::-;104760:63;;;104785:4;104760:63;104745:78;;104842:7;104834:41;;;;;;;;;;;;:::i;:::-;104060:823;;;;;;;:::o;13213:304::-;13290:7;13336:6;13345:2;13336:11;13318:6;:13;:30;;13310:39;;;;;10173:338;10250:7;10296:6;10305:2;10296:11;10278:6;:13;:30;;10270:39;;;;;;-1:-1:-1;10401:30:0;10417:4;10401:30;10395:37;10434:27;10391:71;;;10173:338::o;14393:193::-;14501:4;14536:1;14531;:6;;14523:32;;;;;;;;;;;;:::i;:::-;-1:-1:-1;14573:5:0;;;14393:193::o;10519:287::-;10594:5;10638:6;10647:1;10638:10;10620:6;:13;:29;;10612:38;;;;;;-1:-1:-1;10730:29:0;10746:3;10730:29;10724:36;;10519:287::o;16538:1116::-;16692:7;16721:9;:16;16741:2;16721:22;16717:72;;-1:-1:-1;16775:1:0;16760:17;;16717:72;17126:4;17111:20;;17105:27;17172:4;17157:20;;17151:27;17222:4;17207:20;;17201:27;17230:4;17197:38;17389:66;17376:79;;17372:129;;;17487:1;17472:17;;;;;;;17372:129;17515:1;:7;;17520:2;17515:7;:18;;;;17526:1;:7;;17531:2;17526:7;17515:18;17511:136;;;17557:28;17567:8;17577:1;17580;17583;17557:28;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17550:35;;;;;;;17511:136;17633:1;17618:17;;;;;;;103707:264;103913:50;;;;;103876:12;;103913:23;;;;;;:50;;103943:1;;103947:2;;103951:5;;103958:4;;103913:50;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;103906:57;103707:264;-1:-1:-1;;;;;103707:264:0:o;-1:-1:-1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:130::-;72:20;;97:33;72:20;97:33;:::i;301:352::-;;;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;;;;;:::o;1334:336::-;;;1448:3;1441:4;1433:6;1429:17;1425:27;1415:2;;-1:-1;;1456:12;1415:2;-1:-1;1486:20;;1526:18;1515:30;;1512:2;;;-1:-1;;1548:12;1512:2;1592:4;1584:6;1580:17;1568:29;;1643:3;1592:4;1623:17;1584:6;1609:32;;1606:41;1603:2;;;1660:1;;1650:12;1679:440;;1780:3;1773:4;1765:6;1761:17;1757:27;1747:2;;-1:-1;;1788:12;1747:2;1835:6;1822:20;1857:64;1872:48;1913:6;1872:48;:::i;:::-;1857:64;:::i;:::-;1848:73;;1941:6;1934:5;1927:21;2045:3;1977:4;2036:6;1969;2027:16;;2024:25;2021:2;;;2062:1;;2052:12;2021:2;39891:6;1977:4;1969:6;1965:17;1977:4;2003:5;1999:16;39868:30;39947:1;39929:16;;;1977:4;39929:16;39922:27;2003:5;1740:379;-1:-1;;1740:379::o;2715:241::-;;2819:2;2807:9;2798:7;2794:23;2790:32;2787:2;;;-1:-1;;2825:12;2787:2;85:6;72:20;97:33;124:5;97:33;:::i;2963:263::-;;3078:2;3066:9;3057:7;3053:23;3049:32;3046:2;;;-1:-1;;3084:12;3046:2;226:6;220:13;238:33;265:5;238:33;:::i;3233:1497::-;;;;;;;;;;;;3512:3;3500:9;3491:7;3487:23;3483:33;3480:2;;;-1:-1;;3519:12;3480:2;97:33;85:6;72:20;97:33;:::i;:::-;85:6;72:20;3571:63;;97:33;3671:2;3714:9;3710:22;72:20;97:33;:::i;:::-;3671:2;3714:9;3710:22;72:20;3679:63;;3779:2;3822:9;3818:22;2645:20;3787:63;;3887:2;3930:9;3926:22;1250:20;3895:63;;4014:53;4059:7;3995:3;4039:9;4035:22;4014:53;:::i;:::-;4004:63;;4104:3;4148:9;4144:22;2645:20;4113:63;;4213:3;4257:9;4253:22;2645:20;4222:63;;4375:18;;4350:3;4339:9;4335:19;4322:33;4364:30;4361:2;;;-1:-1;;4397:12;4361:2;4435:64;4491:7;4350:3;4339:9;4335:19;4322:33;4471:9;4467:22;4435:64;:::i;:::-;4417:82;;-1:-1;4417:82;-1:-1;4564:3;4549:19;;4536:33;4578:30;-1:-1;4575:2;;;-1:-1;;4611:12;4575:2;;4650:64;4706:7;4564:3;4553:9;4549:19;4536:33;4686:9;4682:22;4650:64;:::i;:::-;4631:83;;;;;;;;3474:1256;;;;;;;;;;;;;;:::o;4737:1455::-;;;;;;;;;;4995:3;4983:9;4974:7;4970:23;4966:33;4963:2;;;-1:-1;;5002:12;4963:2;85:6;72:20;97:33;124:5;97:33;:::i;:::-;5054:63;-1:-1;5154:2;5193:22;;72:20;97:33;72:20;97:33;:::i;:::-;5162:63;-1:-1;5262:2;5301:22;;2645:20;;-1:-1;5370:2;5409:22;;1250:20;;-1:-1;5497:53;5542:7;5478:3;5518:22;;5497:53;:::i;:::-;5487:63;;5587:3;5631:9;5627:22;2645:20;5596:63;;5696:3;5740:9;5736:22;2645:20;5705:63;;5833:3;5822:9;5818:19;5805:33;5858:18;;5850:6;5847:30;5844:2;;;-1:-1;;5880:12;5844:2;5910:62;5964:7;5955:6;5944:9;5940:22;5910:62;:::i;:::-;5900:72;;6037:3;6026:9;6022:19;6009:33;5995:47;;5858:18;6054:6;6051:30;6048:2;;;-1:-1;;6084:12;6048:2;;6114:62;6168:7;6159:6;6148:9;6144:22;6114:62;:::i;:::-;6104:72;;;4957:1235;;;;;;;;;;;:::o;6199:825::-;;;;;;6418:2;6406:9;6397:7;6393:23;6389:32;6386:2;;;-1:-1;;6424:12;6386:2;85:6;72:20;97:33;124:5;97:33;:::i;:::-;6476:63;-1:-1;6604:2;6589:18;;6576:32;6628:18;6617:30;;;6614:2;;;-1:-1;;6650:12;6614:2;6688:80;6760:7;6751:6;6740:9;6736:22;6688:80;:::i;:::-;6670:98;;-1:-1;6670:98;-1:-1;6833:2;6818:18;;6805:32;;-1:-1;6846:30;;;6843:2;;;-1:-1;;6879:12;6843:2;;6917:91;7000:7;6991:6;6980:9;6976:22;6917:91;:::i;:::-;6380:644;;;;-1:-1;6380:644;;-1:-1;6899:109;;;6380:644;-1:-1;;;6380:644::o;7031:366::-;;;7152:2;7140:9;7131:7;7127:23;7123:32;7120:2;;;-1:-1;;7158:12;7120:2;85:6;72:20;97:33;124:5;97:33;:::i;:::-;7210:63;7310:2;7349:22;;;;2645:20;;-1:-1;;;7114:283::o;7404:257::-;;7516:2;7504:9;7495:7;7491:23;7487:32;7484:2;;;-1:-1;;7522:12;7484:2;1129:6;1123:13;40931:5;37046:13;37039:21;40909:5;40906:32;40896:2;;-1:-1;;40942:12;7668:470;;;7798:2;7786:9;7777:7;7773:23;7769:32;7766:2;;;-1:-1;;7804:12;7766:2;1263:6;1250:20;7856:63;;7984:2;7973:9;7969:18;7956:32;8008:18;8000:6;7997:30;7994:2;;;-1:-1;;8030:12;7994:2;8060:62;8114:7;8105:6;8094:9;8090:22;8060:62;:::i;:::-;8050:72;;;7760:378;;;;;:::o;8145:360::-;;8269:2;8257:9;8248:7;8244:23;8240:32;8237:2;;;-1:-1;;8275:12;8237:2;8326:17;8320:24;8364:18;8356:6;8353:30;8350:2;;;-1:-1;;8386:12;8350:2;8457:22;;2233:4;2221:17;;2217:27;-1:-1;2207:2;;-1:-1;;2248:12;2207:2;2288:6;2282:13;2310:64;2325:48;2366:6;2325:48;:::i;2310:64::-;2394:6;2387:5;2380:21;2498:3;8269:2;2489:6;2422;2480:16;;2477:25;2474:2;;;-1:-1;;2505:12;2474:2;2525:39;2557:6;8269:2;2456:5;2452:16;8269:2;2422:6;2418:17;2525:39;:::i;10792:343::-;;10934:5;35634:12;36176:6;36171:3;36164:19;11027:52;11072:6;36213:4;36208:3;36204:14;36213:4;11053:5;11049:16;11027:52;:::i;:::-;40607:2;40587:14;40603:7;40583:28;11091:39;;;;36213:4;11091:39;;10882:253;-1:-1;;10882:253::o;17867:569::-;;39891:6;39886:3;39881;39868:30;-1:-1;40698:2;40694:14;;;;;;39929:16;;;;9048:58;;;18297:2;18288:12;;10019:37;;;;18399:12;;;18067:369;-1:-1;18067:369::o;18443:271::-;;11302:5;35634:12;11413:52;11458:6;11453:3;11446:4;11439:5;11435:16;11413:52;:::i;:::-;11477:16;;;;;18577:137;-1:-1;;18577:137::o;18721:553::-;;11302:5;35634:12;11413:52;11458:6;11453:3;11446:4;11439:5;11435:16;11413:52;:::i;:::-;11477:16;;;;10019:37;;;-1:-1;11446:4;19126:12;;10019:37;19237:12;;;18913:361;-1:-1;18913:361::o;19281:520::-;13547:66;13527:87;;13511:2;13633:12;;10019:37;;;;19764:12;;;19498:303::o;19808:222::-;37375:42;37364:54;;;;8910:37;;19935:2;19920:18;;19906:124::o;20037:784::-;37375:42;37364:54;;;8769:58;;37364:54;;;;20479:2;20464:18;;8910:37;20562:2;20547:18;;10019:37;;;;20645:2;20630:18;;10019:37;37046:13;37039:21;20722:3;20707:19;;9902:34;20806:3;20791:19;;10019:37;;;;20306:3;20291:19;;20277:544::o;20828:596::-;37375:42;37364:54;;;8910:37;;37364:54;;;21224:2;21209:18;;8910:37;21307:2;21292:18;;10019:37;;;;37364:54;;;21410:2;21395:18;;11594:68;21059:3;21044:19;;21030:394::o;21431:333::-;37375:42;37364:54;;;;8910:37;;21750:2;21735:18;;10019:37;21586:2;21571:18;;21557:207::o;21771:366::-;21946:2;21960:47;;;35634:12;;21931:18;;;36164:19;;;21771:366;;21946:2;35489:14;;;;36204;;;;21771:366;9550:257;9575:6;9572:1;9569:13;9550:257;;;9636:13;;37223:66;37212:78;10286:36;;36020:14;;;;8662;;;;9597:1;9590:9;9550:257;;;-1:-1;22013:114;;21917:220;-1:-1;;;;;;21917:220::o;22144:210::-;37046:13;;37039:21;9902:34;;22265:2;22250:18;;22236:118::o;22361:222::-;10019:37;;;22488:2;22473:18;;22459:124::o;22590:1116::-;10019:37;;;37375:42;37364:54;;;23106:2;23091:18;;8910:37;37364:54;;;23189:2;23174:18;;8910:37;23272:2;23257:18;;10019:37;;;;23355:3;23340:19;;10019:37;;;;37364:54;;;23439:3;23424:19;;8910:37;23523:3;23508:19;;10019:37;;;;23607:3;23592:19;;10019:37;;;;23691:3;23676:19;;10019:37;22941:3;22926:19;;22912:794::o;23713:668::-;10019:37;;;24117:2;24102:18;;10019:37;;;;24200:2;24185:18;;10019:37;;;;24283:2;24268:18;;10019:37;37375:42;37364:54;24366:3;24351:19;;8910:37;23952:3;23937:19;;23923:458::o;24388:417::-;;10049:5;10026:3;10019:37;24561:2;24679;24668:9;24664:18;24657:48;24719:76;24561:2;24550:9;24546:18;24781:6;24719:76;:::i;24812:548::-;10019:37;;;37580:4;37569:16;;;;25180:2;25165:18;;17820:35;25263:2;25248:18;;10019:37;25346:2;25331:18;;10019:37;25019:3;25004:19;;24990:370::o;25367:218::-;37223:66;37212:78;;;;10286:36;;25492:2;25477:18;;25463:122::o;25592:329::-;37223:66;37212:78;;;;10286:36;;37375:42;37364:54;25907:2;25892:18;;8910:37;25745:2;25730:18;;25716:205::o;27904:416::-;28104:2;28118:47;;;13145:2;28089:18;;;36164:19;13181:23;36204:14;;;13161:44;13224:12;;;28075:245::o;28327:416::-;28527:2;28541:47;;;13884:2;28512:18;;;36164:19;13920;36204:14;;;13900:40;13959:12;;;28498:245::o;28750:416::-;28950:2;28964:47;;;14210:2;28935:18;;;36164:19;14246:15;36204:14;;;14226:36;14281:12;;;28921:245::o;29173:416::-;29373:2;29387:47;;;14532:2;29358:18;;;36164:19;14568:21;36204:14;;;14548:42;14609:12;;;29344:245::o;29596:416::-;29796:2;29810:47;;;14860:2;29781:18;;;36164:19;14896:31;36204:14;;;14876:52;14947:12;;;29767:245::o;30019:416::-;30219:2;30233:47;;;15198:2;30204:18;;;36164:19;15234:34;36204:14;;;15214:55;15303:11;15289:12;;;15282:33;15334:12;;;30190:245::o;30442:416::-;30642:2;30656:47;;;15585:2;30627:18;;;36164:19;15621:15;36204:14;;;15601:36;15656:12;;;30613:245::o;30865:416::-;31065:2;31079:47;;;15907:2;31050:18;;;36164:19;15943:27;36204:14;;;15923:48;15990:12;;;31036:245::o;31288:416::-;31488:2;31502:47;;;16241:2;31473:18;;;36164:19;16277:16;36204:14;;;16257:37;16313:12;;;31459:245::o;31711:416::-;31911:2;31925:47;;;16564:2;31896:18;;;36164:19;16600:23;36204:14;;;16580:44;16643:12;;;31882:245::o;32134:416::-;32334:2;32348:47;;;16894:2;32319:18;;;36164:19;16930:15;36204:14;;;16910:36;16965:12;;;32305:245::o;32557:416::-;32757:2;32771:47;;;17216:2;32742:18;;;36164:19;17252:14;36204;;;17232:35;17286:12;;;32728:245::o;32980:416::-;33180:2;33194:47;;;17537:2;33165:18;;;36164:19;17573:14;36204;;;17553:35;17607:12;;;33151:245::o;33632:632::-;;37580:4;17848:5;37569:16;17827:3;17820:35;37375:42;36962:5;37364:54;34018:2;34007:9;34003:18;8910:37;10049:5;34101:2;34090:9;34086:18;10019:37;33857:3;34138:2;34127:9;34123:18;34116:48;34178:76;33857:3;33846:9;33842:19;34240:6;34178:76;:::i;:::-;34170:84;33828:436;-1:-1;;;;;;33828:436::o;34271:506::-;;;34406:11;34393:25;34457:48;34481:8;34465:14;34461:29;34457:48;34437:18;34433:73;34423:2;;-1:-1;;34510:12;34423:2;34537:33;;34591:18;;;-1:-1;34629:18;34618:30;;34615:2;;;-1:-1;;34651:12;34615:2;34496:4;34679:13;;-1:-1;34465:14;34711:38;;;34701:49;;34698:2;;;34763:1;;34753:12;34784:256;34846:2;34840:9;34872:17;;;34947:18;34932:34;;34968:22;;;34929:62;34926:2;;;35004:1;;34994:12;34926:2;34846;35013:22;34824:216;;-1:-1;34824:216::o;35047:321::-;;35190:18;35182:6;35179:30;35176:2;;;-1:-1;;35212:12;35176:2;-1:-1;35289:4;35266:17;35285:9;35262:33;35353:4;35343:15;;35113:255::o;39964:268::-;40029:1;40036:101;40050:6;40047:1;40044:13;40036:101;;;40117:11;;;40111:18;40098:11;;;40091:39;40072:2;40065:10;40036:101;;;40152:6;40149:1;40146:13;40143:2;;;-1:-1;;40029:1;40199:16;;40192:27;40013:219::o;40726:117::-;37375:42;40813:5;37364:54;40788:5;40785:35;40775:2;;40834:1;;40824:12;40775:2;40769:74;:::o

Swarm Source

ipfs://9b598f470371d5cad3e2e5137947b13a97d8f3d5d252a6498bf33044cebb822c

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  ]

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.