ETH Price: $3,419.02 (-0.07%)

Contract

0x44A6999Ec971cfCA458AFf25A808F272f6d492A2
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transform ERC20137112912021-11-29 22:51:141093 days ago1638226274IN
0x44A6999E...2f6d492A2
0 ETH0.00336925106.37294714
0x60c06040131430582021-09-02 0:35:481182 days ago1630542948IN
 Create: TransformERC20Feature
0 ETH0.2549275583.71317783

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TransformERC20Feature

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
istanbul EvmVersion, Apache-2.0 license
File 1 of 28 : TransformERC20Feature.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
import "../errors/LibTransformERC20RichErrors.sol";
import "../fixins/FixinCommon.sol";
import "../fixins/FixinTokenSpender.sol";
import "../migrations/LibMigrate.sol";
import "../external/IFlashWallet.sol";
import "../external/FlashWallet.sol";
import "../storage/LibTransformERC20Storage.sol";
import "../transformers/IERC20Transformer.sol";
import "../transformers/LibERC20Transformer.sol";
import "./interfaces/IFeature.sol";
import "./interfaces/ITransformERC20Feature.sol";


/// @dev Feature to composably transform between ERC20 tokens.
contract TransformERC20Feature is
    IFeature,
    ITransformERC20Feature,
    FixinCommon,
    FixinTokenSpender
{
    using LibSafeMathV06 for uint256;
    using LibRichErrorsV06 for bytes;

    /// @dev Stack vars for `_transformERC20Private()`.
    struct TransformERC20PrivateState {
        IFlashWallet wallet;
        address transformerDeployer;
        uint256 recipientOutputTokenBalanceBefore;
        uint256 recipientOutputTokenBalanceAfter;
    }

    /// @dev Name of this feature.
    string public constant override FEATURE_NAME = "TransformERC20";
    /// @dev Version of this feature.
    uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 4, 0);

    /// @dev Initialize and register this feature.
    ///      Should be delegatecalled by `Migrate.migrate()`.
    /// @param transformerDeployer The trusted deployer for transformers.
    /// @return success `LibMigrate.SUCCESS` on success.
    function migrate(address transformerDeployer)
        external
        returns (bytes4 success)
    {
        _registerFeatureFunction(this.getTransformerDeployer.selector);
        _registerFeatureFunction(this.createTransformWallet.selector);
        _registerFeatureFunction(this.getTransformWallet.selector);
        _registerFeatureFunction(this.setTransformerDeployer.selector);
        _registerFeatureFunction(this.setQuoteSigner.selector);
        _registerFeatureFunction(this.getQuoteSigner.selector);
        _registerFeatureFunction(this.transformERC20Staging.selector);
        _registerFeatureFunction(this._transformERC20.selector);
        if (this.getTransformWallet() == IFlashWallet(address(0))) {
            // Create the transform wallet if it doesn't exist.
            this.createTransformWallet();
        }
        LibTransformERC20Storage.getStorage().transformerDeployer = transformerDeployer;
        return LibMigrate.MIGRATE_SUCCESS;
    }

    /// @dev Replace the allowed deployer for transformers.
    ///      Only callable by the owner.
    /// @param transformerDeployer The address of the trusted deployer for transformers.
    function setTransformerDeployer(address transformerDeployer)
        external
        override
        onlyOwner
    {
        LibTransformERC20Storage.getStorage().transformerDeployer = transformerDeployer;
        emit TransformerDeployerUpdated(transformerDeployer);
    }

    /// @dev Replace the optional signer for `transformERC20()` calldata.
    ///      Only callable by the owner.
    /// @param quoteSigner The address of the new calldata signer.
    function setQuoteSigner(address quoteSigner)
        external
        override
        onlyOwner
    {
        LibTransformERC20Storage.getStorage().quoteSigner = quoteSigner;
        emit QuoteSignerUpdated(quoteSigner);
    }

    /// @dev Return the allowed deployer for transformers.
    /// @return deployer The transform deployer address.
    function getTransformerDeployer()
        public
        override
        view
        returns (address deployer)
    {
        return LibTransformERC20Storage.getStorage().transformerDeployer;
    }

    /// @dev Return the optional signer for `transformERC20()` calldata.
    /// @return signer The signer address.
    function getQuoteSigner()
        public
        override
        view
        returns (address signer)
    {
        return LibTransformERC20Storage.getStorage().quoteSigner;
    }

    /// @dev Deploy a new wallet instance and replace the current one with it.
    ///      Useful if we somehow break the current wallet instance.
    ///      Only callable by the owner.
    /// @return wallet The new wallet instance.
    function createTransformWallet()
        public
        override
        onlyOwner
        returns (IFlashWallet wallet)
    {
        wallet = new FlashWallet();
        LibTransformERC20Storage.getStorage().wallet = wallet;
    }

    /// @dev Wrapper for `transformERC20`. This selector will be temporarily
    ///      registered to the Exchange Proxy so that we can migrate 0x API
    ///      with no downtime. Once 0x API has been updated to point to this
    ///      function, we can safely re-register `transformERC20`, point 
    ///      0x API back to `transformERC20`, and deregister this function.
    /// @param inputToken The token being provided by the sender.
    ///        If `0xeee...`, ETH is implied and should be provided with the call.`
    /// @param outputToken The token to be acquired by the sender.
    ///        `0xeee...` implies ETH.
    /// @param inputTokenAmount The amount of `inputToken` to take from the sender.
    ///        If set to `uint256(-1)`, the entire spendable balance of the taker
    ///        will be solt.
    /// @param minOutputTokenAmount The minimum amount of `outputToken` the sender
    ///        must receive for the entire transformation to succeed. If set to zero,
    ///        the minimum output token transfer will not be asserted.
    /// @param transformations The transformations to execute on the token balance(s)
    ///        in sequence.
    /// @return outputTokenAmount The amount of `outputToken` received by the sender.
    function transformERC20Staging(
        IERC20TokenV06 inputToken,
        IERC20TokenV06 outputToken,
        uint256 inputTokenAmount,
        uint256 minOutputTokenAmount,
        Transformation[] memory transformations
    )
        public
        payable
        returns (uint256 outputTokenAmount)
    {
        return transformERC20(
            inputToken, 
            outputToken, 
            inputTokenAmount, 
            minOutputTokenAmount, 
            transformations
        );
    }

    /// @dev Executes a series of transformations to convert an ERC20 `inputToken`
    ///      to an ERC20 `outputToken`.
    /// @param inputToken The token being provided by the sender.
    ///        If `0xeee...`, ETH is implied and should be provided with the call.`
    /// @param outputToken The token to be acquired by the sender.
    ///        `0xeee...` implies ETH.
    /// @param inputTokenAmount The amount of `inputToken` to take from the sender.
    ///        If set to `uint256(-1)`, the entire spendable balance of the taker
    ///        will be solt.
    /// @param minOutputTokenAmount The minimum amount of `outputToken` the sender
    ///        must receive for the entire transformation to succeed. If set to zero,
    ///        the minimum output token transfer will not be asserted.
    /// @param transformations The transformations to execute on the token balance(s)
    ///        in sequence.
    /// @return outputTokenAmount The amount of `outputToken` received by the sender.
    function transformERC20(
        IERC20TokenV06 inputToken,
        IERC20TokenV06 outputToken,
        uint256 inputTokenAmount,
        uint256 minOutputTokenAmount,
        Transformation[] memory transformations
    )
        public
        override
        payable
        returns (uint256 outputTokenAmount)
    {
        return _transformERC20Private(
            TransformERC20Args({
                taker: msg.sender,
                inputToken: inputToken,
                outputToken: outputToken,
                inputTokenAmount: inputTokenAmount,
                minOutputTokenAmount: minOutputTokenAmount,
                transformations: transformations,
                useSelfBalance: false,
                recipient: msg.sender
            })
        );
    }

    /// @dev Internal version of `transformERC20()`. Only callable from within.
    /// @param args A `TransformERC20Args` struct.
    /// @return outputTokenAmount The amount of `outputToken` received by the taker.
    function _transformERC20(TransformERC20Args memory args)
        public
        virtual
        override
        payable
        onlySelf
        returns (uint256 outputTokenAmount)
    {
        return _transformERC20Private(args);
    }

    /// @dev Private version of `transformERC20()`.
    /// @param args A `TransformERC20Args` struct.
    /// @return outputTokenAmount The amount of `outputToken` received by the taker.
    function _transformERC20Private(TransformERC20Args memory args)
        private
        returns (uint256 outputTokenAmount)
    {
        // If the input token amount is -1 and we are not selling ETH,
        // transform the taker's entire spendable balance.
        if (!args.useSelfBalance && args.inputTokenAmount == uint256(-1)) {
            if (LibERC20Transformer.isTokenETH(args.inputToken)) {
                // We can't pull more ETH from the taker, so we just set the
                // input token amount to the value attached to the call.
                args.inputTokenAmount = msg.value;
            } else {
                args.inputTokenAmount = _getSpendableERC20BalanceOf(
                    args.inputToken,
                    args.taker
                );
            }
        }

        TransformERC20PrivateState memory state;
        state.wallet = getTransformWallet();
        state.transformerDeployer = getTransformerDeployer();

        // Remember the initial output token balance of the recipient.
        state.recipientOutputTokenBalanceBefore =
            LibERC20Transformer.getTokenBalanceOf(args.outputToken, args.recipient);

        // Pull input tokens from the taker to the wallet and transfer attached ETH.
        _transferInputTokensAndAttachedEth(args, address(state.wallet));

        {
            // Perform transformations.
            for (uint256 i = 0; i < args.transformations.length; ++i) {
                _executeTransformation(
                    state.wallet,
                    args.transformations[i],
                    state.transformerDeployer,
                    args.recipient
                );
            }
            // Transfer output tokens from wallet to recipient
            outputTokenAmount = _executeOutputTokenTransfer(
                args.outputToken, 
                state.wallet, 
                args.recipient
            );
        }

        // Compute how much output token has been transferred to the recipient.
        state.recipientOutputTokenBalanceAfter =
            LibERC20Transformer.getTokenBalanceOf(args.outputToken, args.recipient);
        if (state.recipientOutputTokenBalanceAfter < state.recipientOutputTokenBalanceBefore) {
            LibTransformERC20RichErrors.NegativeTransformERC20OutputError(
                address(args.outputToken),
                state.recipientOutputTokenBalanceBefore - state.recipientOutputTokenBalanceAfter
            ).rrevert();
        }
        outputTokenAmount = LibSafeMathV06.min256(
            outputTokenAmount,
            state.recipientOutputTokenBalanceAfter.safeSub(state.recipientOutputTokenBalanceBefore)
        );
        // Ensure enough output token has been sent to the taker.
        if (outputTokenAmount < args.minOutputTokenAmount) {
            LibTransformERC20RichErrors.IncompleteTransformERC20Error(
                address(args.outputToken),
                outputTokenAmount,
                args.minOutputTokenAmount
            ).rrevert();
        }

        // Emit an event.
        emit TransformedERC20(
            args.taker,
            address(args.inputToken),
            address(args.outputToken),
            args.inputTokenAmount,
            outputTokenAmount
        );
    }

    /// @dev Return the current wallet instance that will serve as the execution
    ///      context for transformations.
    /// @return wallet The wallet instance.
    function getTransformWallet()
        public
        override
        view
        returns (IFlashWallet wallet)
    {
        return LibTransformERC20Storage.getStorage().wallet;
    }

    /// @dev Transfer input tokens and any attached ETH to `to`
    /// @param args A `TransformERC20Args` struct.
    /// @param to The recipient of tokens and ETH.
    function _transferInputTokensAndAttachedEth(
        TransformERC20Args memory args,
        address payable to
    )
        private
    {
        if (
            LibERC20Transformer.isTokenETH(args.inputToken) &&
            msg.value < args.inputTokenAmount
        ) {
             // Token is ETH, so the caller must attach enough ETH to the call.
            LibTransformERC20RichErrors.InsufficientEthAttachedError(
                msg.value,
                args.inputTokenAmount
            ).rrevert();
        }

        // Transfer any attached ETH.
        if (msg.value != 0) {
            to.transfer(msg.value);
        }

        // Transfer input tokens.
        if (!LibERC20Transformer.isTokenETH(args.inputToken)) {
            if (args.useSelfBalance) {
                // Use EP balance input token.
                _transferERC20Tokens(
                    args.inputToken,
                    to,
                    args.inputTokenAmount
                );
            } else {
                // Pull ERC20 tokens from taker.
                _transferERC20TokensFrom(
                    args.inputToken,
                    args.taker,
                    to,
                    args.inputTokenAmount
                );
            }
        }
    }

    /// @dev Executs a transformer in the context of `wallet`.
    /// @param wallet The wallet instance.
    /// @param transformation The transformation.
    /// @param transformerDeployer The address of the transformer deployer.
    /// @param recipient The recipient address.
    function _executeTransformation(
        IFlashWallet wallet,
        Transformation memory transformation,
        address transformerDeployer,
        address payable recipient
    )
        private
    {
        // Derive the transformer address from the deployment nonce.
        address payable transformer = LibERC20Transformer.getDeployedAddress(
            transformerDeployer,
            transformation.deploymentNonce
        );
        // Call `transformer.transform()` as the wallet.
        bytes memory resultData = wallet.executeDelegateCall(
            // The call target.
            transformer,
            // Call data.
            abi.encodeWithSelector(
                IERC20Transformer.transform.selector,
                IERC20Transformer.TransformContext({
                    sender: msg.sender,
                    recipient: recipient,
                    data: transformation.data
                })
            )
        );
        // Ensure the transformer returned the magic bytes.
        if (resultData.length != 32 ||
            abi.decode(resultData, (bytes4)) != LibERC20Transformer.TRANSFORMER_SUCCESS
        ) {
            LibTransformERC20RichErrors.TransformerFailedError(
                transformer,
                transformation.data,
                resultData
            ).rrevert();
        }
    }

    function _executeOutputTokenTransfer(
        IERC20TokenV06 outputToken,
        IFlashWallet wallet,
        address payable recipient
    )
        private
        returns (uint256 transferAmount)
    {
        transferAmount =
            LibERC20Transformer.getTokenBalanceOf(outputToken, address(wallet));
        if (LibERC20Transformer.isTokenETH(outputToken)) {
            wallet.executeCall(
                recipient,
                "",
                transferAmount
            );
        } else {
            bytes memory resultData = wallet.executeCall(
                payable(address(outputToken)),
                abi.encodeWithSelector(
                    IERC20TokenV06.transfer.selector,
                    recipient,
                    transferAmount
                ),
                0
            );
            if (resultData.length == 0) {
                // If we get back 0 returndata, this may be a non-standard ERC-20 that
                // does not return a boolean. Check that it at least contains code.
                uint256 size;
                assembly { size := extcodesize(outputToken) }
                require(size > 0, "invalid token address, contains no code");
            } else if (resultData.length >= 32) {
                // If we get back at least 32 bytes, we know the target address
                // contains code, and we assume it is a token that returned a boolean
                // success value, which must be true.
                uint256 result = LibBytesV06.readUint256(resultData, 0);
                if (result != 1) {
                    LibRichErrorsV06.rrevert(resultData);
                }
            } else {
                // If 0 < returndatasize < 32, the target is a contract, but not a
                // valid token.
                LibRichErrorsV06.rrevert(resultData);
            }
        }
    }
}

File 2 of 28 : IERC20TokenV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


interface IERC20TokenV06 {

    // solhint-disable no-simple-event-func-name
    event Transfer(
        address indexed from,
        address indexed to,
        uint256 value
    );

    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

    /// @dev send `value` token to `to` from `msg.sender`
    /// @param to The address of the recipient
    /// @param value The amount of token to be transferred
    /// @return True if transfer was successful
    function transfer(address to, uint256 value)
        external
        returns (bool);

    /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
    /// @param from The address of the sender
    /// @param to The address of the recipient
    /// @param value The amount of token to be transferred
    /// @return True if transfer was successful
    function transferFrom(
        address from,
        address to,
        uint256 value
    )
        external
        returns (bool);

    /// @dev `msg.sender` approves `spender` to spend `value` tokens
    /// @param spender The address of the account able to transfer the tokens
    /// @param value The amount of wei to be approved for transfer
    /// @return Always true if the call has enough gas to complete execution
    function approve(address spender, uint256 value)
        external
        returns (bool);

    /// @dev Query total supply of token
    /// @return Total supply of token
    function totalSupply()
        external
        view
        returns (uint256);

    /// @dev Get the balance of `owner`.
    /// @param owner The address from which the balance will be retrieved
    /// @return Balance of owner
    function balanceOf(address owner)
        external
        view
        returns (uint256);

    /// @dev Get the allowance for `spender` to spend from `owner`.
    /// @param owner The address of the account owning tokens
    /// @param spender The address of the account able to transfer the tokens
    /// @return Amount of remaining tokens allowed to spent
    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    /// @dev Get the number of decimals this token has.
    function decimals()
        external
        view
        returns (uint8);
}

File 3 of 28 : LibERC20TokenV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;

import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
import "./IERC20TokenV06.sol";


library LibERC20TokenV06 {
    bytes constant private DECIMALS_CALL_DATA = hex"313ce567";

    /// @dev Calls `IERC20TokenV06(token).approve()`.
    ///      Reverts if the return data is invalid or the call reverts.
    /// @param token The address of the token contract.
    /// @param spender The address that receives an allowance.
    /// @param allowance The allowance to set.
    function compatApprove(
        IERC20TokenV06 token,
        address spender,
        uint256 allowance
    )
        internal
    {
        bytes memory callData = abi.encodeWithSelector(
            token.approve.selector,
            spender,
            allowance
        );
        _callWithOptionalBooleanResult(address(token), callData);
    }

    /// @dev Calls `IERC20TokenV06(token).approve()` and sets the allowance to the
    ///      maximum if the current approval is not already >= an amount.
    ///      Reverts if the return data is invalid or the call reverts.
    /// @param token The address of the token contract.
    /// @param spender The address that receives an allowance.
    /// @param amount The minimum allowance needed.
    function approveIfBelow(
        IERC20TokenV06 token,
        address spender,
        uint256 amount
    )
        internal
    {
        if (token.allowance(address(this), spender) < amount) {
            compatApprove(token, spender, uint256(-1));
        }
    }

    /// @dev Calls `IERC20TokenV06(token).transfer()`.
    ///      Reverts if the return data is invalid or the call reverts.
    /// @param token The address of the token contract.
    /// @param to The address that receives the tokens
    /// @param amount Number of tokens to transfer.
    function compatTransfer(
        IERC20TokenV06 token,
        address to,
        uint256 amount
    )
        internal
    {
        bytes memory callData = abi.encodeWithSelector(
            token.transfer.selector,
            to,
            amount
        );
        _callWithOptionalBooleanResult(address(token), callData);
    }

    /// @dev Calls `IERC20TokenV06(token).transferFrom()`.
    ///      Reverts if the return data is invalid or the call reverts.
    /// @param token The address of the token contract.
    /// @param from The owner of the tokens.
    /// @param to The address that receives the tokens
    /// @param amount Number of tokens to transfer.
    function compatTransferFrom(
        IERC20TokenV06 token,
        address from,
        address to,
        uint256 amount
    )
        internal
    {
        bytes memory callData = abi.encodeWithSelector(
            token.transferFrom.selector,
            from,
            to,
            amount
        );
        _callWithOptionalBooleanResult(address(token), callData);
    }

    /// @dev Retrieves the number of decimals for a token.
    ///      Returns `18` if the call reverts.
    /// @param token The address of the token contract.
    /// @return tokenDecimals The number of decimals places for the token.
    function compatDecimals(IERC20TokenV06 token)
        internal
        view
        returns (uint8 tokenDecimals)
    {
        tokenDecimals = 18;
        (bool didSucceed, bytes memory resultData) = address(token).staticcall(DECIMALS_CALL_DATA);
        if (didSucceed && resultData.length >= 32) {
            tokenDecimals = uint8(LibBytesV06.readUint256(resultData, 0));
        }
    }

    /// @dev Retrieves the allowance for a token, owner, and spender.
    ///      Returns `0` if the call reverts.
    /// @param token The address of the token contract.
    /// @param owner The owner of the tokens.
    /// @param spender The address the spender.
    /// @return allowance_ The allowance for a token, owner, and spender.
    function compatAllowance(IERC20TokenV06 token, address owner, address spender)
        internal
        view
        returns (uint256 allowance_)
    {
        (bool didSucceed, bytes memory resultData) = address(token).staticcall(
            abi.encodeWithSelector(
                token.allowance.selector,
                owner,
                spender
            )
        );
        if (didSucceed && resultData.length >= 32) {
            allowance_ = LibBytesV06.readUint256(resultData, 0);
        }
    }

    /// @dev Retrieves the balance for a token owner.
    ///      Returns `0` if the call reverts.
    /// @param token The address of the token contract.
    /// @param owner The owner of the tokens.
    /// @return balance The token balance of an owner.
    function compatBalanceOf(IERC20TokenV06 token, address owner)
        internal
        view
        returns (uint256 balance)
    {
        (bool didSucceed, bytes memory resultData) = address(token).staticcall(
            abi.encodeWithSelector(
                token.balanceOf.selector,
                owner
            )
        );
        if (didSucceed && resultData.length >= 32) {
            balance = LibBytesV06.readUint256(resultData, 0);
        }
    }

    /// @dev Executes a call on address `target` with calldata `callData`
    ///      and asserts that either nothing was returned or a single boolean
    ///      was returned equal to `true`.
    /// @param target The call target.
    /// @param callData The abi-encoded call data.
    function _callWithOptionalBooleanResult(
        address target,
        bytes memory callData
    )
        private
    {
        (bool didSucceed, bytes memory resultData) = target.call(callData);
        // Revert if the call reverted.
        if (!didSucceed) {
            LibRichErrorsV06.rrevert(resultData);
        }
        // If we get back 0 returndata, this may be a non-standard ERC-20 that
        // does not return a boolean. Check that it at least contains code.
        if (resultData.length == 0) {
            uint256 size;
            assembly { size := extcodesize(target) }
            require(size > 0, "invalid token address, contains no code");
            return;
        }
        // If we get back at least 32 bytes, we know the target address
        // contains code, and we assume it is a token that returned a boolean
        // success value, which must be true.
        if (resultData.length >= 32) {
            uint256 result = LibBytesV06.readUint256(resultData, 0);
            if (result == 1) {
                return;
            } else {
                LibRichErrorsV06.rrevert(resultData);
            }
        }
        // If 0 < returndatasize < 32, the target is a contract, but not a
        // valid token.
        LibRichErrorsV06.rrevert(resultData);
    }
}

File 4 of 28 : LibRichErrorsV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


library LibRichErrorsV06 {

    // bytes4(keccak256("Error(string)"))
    bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0;

    // solhint-disable func-name-mixedcase
    /// @dev ABI encode a standard, string revert error payload.
    ///      This is the same payload that would be included by a `revert(string)`
    ///      solidity statement. It has the function signature `Error(string)`.
    /// @param message The error string.
    /// @return The ABI encoded error.
    function StandardError(string memory message)
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            STANDARD_ERROR_SELECTOR,
            bytes(message)
        );
    }
    // solhint-enable func-name-mixedcase

    /// @dev Reverts an encoded rich revert reason `errorData`.
    /// @param errorData ABI encoded error data.
    function rrevert(bytes memory errorData)
        internal
        pure
    {
        assembly {
            revert(add(errorData, 0x20), mload(errorData))
        }
    }
}

File 5 of 28 : LibBytesV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;

import "./errors/LibBytesRichErrorsV06.sol";
import "./errors/LibRichErrorsV06.sol";


library LibBytesV06 {

    using LibBytesV06 for bytes;

    /// @dev Gets the memory address for a byte array.
    /// @param input Byte array to lookup.
    /// @return memoryAddress Memory address of byte array. This
    ///         points to the header of the byte array which contains
    ///         the length.
    function rawAddress(bytes memory input)
        internal
        pure
        returns (uint256 memoryAddress)
    {
        assembly {
            memoryAddress := input
        }
        return memoryAddress;
    }

    /// @dev Gets the memory address for the contents of a byte array.
    /// @param input Byte array to lookup.
    /// @return memoryAddress Memory address of the contents of the byte array.
    function contentAddress(bytes memory input)
        internal
        pure
        returns (uint256 memoryAddress)
    {
        assembly {
            memoryAddress := add(input, 32)
        }
        return memoryAddress;
    }

    /// @dev Copies `length` bytes from memory location `source` to `dest`.
    /// @param dest memory address to copy bytes to.
    /// @param source memory address to copy bytes from.
    /// @param length number of bytes to copy.
    function memCopy(
        uint256 dest,
        uint256 source,
        uint256 length
    )
        internal
        pure
    {
        if (length < 32) {
            // Handle a partial word by reading destination and masking
            // off the bits we are interested in.
            // This correctly handles overlap, zero lengths and source == dest
            assembly {
                let mask := sub(exp(256, sub(32, length)), 1)
                let s := and(mload(source), not(mask))
                let d := and(mload(dest), mask)
                mstore(dest, or(s, d))
            }
        } else {
            // Skip the O(length) loop when source == dest.
            if (source == dest) {
                return;
            }

            // For large copies we copy whole words at a time. The final
            // word is aligned to the end of the range (instead of after the
            // previous) to handle partial words. So a copy will look like this:
            //
            //  ####
            //      ####
            //          ####
            //            ####
            //
            // We handle overlap in the source and destination range by
            // changing the copying direction. This prevents us from
            // overwriting parts of source that we still need to copy.
            //
            // This correctly handles source == dest
            //
            if (source > dest) {
                assembly {
                    // We subtract 32 from `sEnd` and `dEnd` because it
                    // is easier to compare with in the loop, and these
                    // are also the addresses we need for copying the
                    // last bytes.
                    length := sub(length, 32)
                    let sEnd := add(source, length)
                    let dEnd := add(dest, length)

                    // Remember the last 32 bytes of source
                    // This needs to be done here and not after the loop
                    // because we may have overwritten the last bytes in
                    // source already due to overlap.
                    let last := mload(sEnd)

                    // Copy whole words front to back
                    // Note: the first check is always true,
                    // this could have been a do-while loop.
                    // solhint-disable-next-line no-empty-blocks
                    for {} lt(source, sEnd) {} {
                        mstore(dest, mload(source))
                        source := add(source, 32)
                        dest := add(dest, 32)
                    }

                    // Write the last 32 bytes
                    mstore(dEnd, last)
                }
            } else {
                assembly {
                    // We subtract 32 from `sEnd` and `dEnd` because those
                    // are the starting points when copying a word at the end.
                    length := sub(length, 32)
                    let sEnd := add(source, length)
                    let dEnd := add(dest, length)

                    // Remember the first 32 bytes of source
                    // This needs to be done here and not after the loop
                    // because we may have overwritten the first bytes in
                    // source already due to overlap.
                    let first := mload(source)

                    // Copy whole words back to front
                    // We use a signed comparisson here to allow dEnd to become
                    // negative (happens when source and dest < 32). Valid
                    // addresses in local memory will never be larger than
                    // 2**255, so they can be safely re-interpreted as signed.
                    // Note: the first check is always true,
                    // this could have been a do-while loop.
                    // solhint-disable-next-line no-empty-blocks
                    for {} slt(dest, dEnd) {} {
                        mstore(dEnd, mload(sEnd))
                        sEnd := sub(sEnd, 32)
                        dEnd := sub(dEnd, 32)
                    }

                    // Write the first 32 bytes
                    mstore(dest, first)
                }
            }
        }
    }

    /// @dev Returns a slices from a byte array.
    /// @param b The byte array to take a slice from.
    /// @param from The starting index for the slice (inclusive).
    /// @param to The final index for the slice (exclusive).
    /// @return result The slice containing bytes at indices [from, to)
    function slice(
        bytes memory b,
        uint256 from,
        uint256 to
    )
        internal
        pure
        returns (bytes memory result)
    {
        // Ensure that the from and to positions are valid positions for a slice within
        // the byte array that is being used.
        if (from > to) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,
                from,
                to
            ));
        }
        if (to > b.length) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,
                to,
                b.length
            ));
        }

        // Create a new bytes structure and copy contents
        result = new bytes(to - from);
        memCopy(
            result.contentAddress(),
            b.contentAddress() + from,
            result.length
        );
        return result;
    }

    /// @dev Returns a slice from a byte array without preserving the input.
    ///      When `from == 0`, the original array will match the slice.
    ///      In other cases its state will be corrupted.
    /// @param b The byte array to take a slice from. Will be destroyed in the process.
    /// @param from The starting index for the slice (inclusive).
    /// @param to The final index for the slice (exclusive).
    /// @return result The slice containing bytes at indices [from, to)
    function sliceDestructive(
        bytes memory b,
        uint256 from,
        uint256 to
    )
        internal
        pure
        returns (bytes memory result)
    {
        // Ensure that the from and to positions are valid positions for a slice within
        // the byte array that is being used.
        if (from > to) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,
                from,
                to
            ));
        }
        if (to > b.length) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,
                to,
                b.length
            ));
        }

        // Create a new bytes structure around [from, to) in-place.
        assembly {
            result := add(b, from)
            mstore(result, sub(to, from))
        }
        return result;
    }

    /// @dev Pops the last byte off of a byte array by modifying its length.
    /// @param b Byte array that will be modified.
    /// @return result The byte that was popped off.
    function popLastByte(bytes memory b)
        internal
        pure
        returns (bytes1 result)
    {
        if (b.length == 0) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanZeroRequired,
                b.length,
                0
            ));
        }

        // Store last byte.
        result = b[b.length - 1];

        assembly {
            // Decrement length of byte array.
            let newLen := sub(mload(b), 1)
            mstore(b, newLen)
        }
        return result;
    }

    /// @dev Tests equality of two byte arrays.
    /// @param lhs First byte array to compare.
    /// @param rhs Second byte array to compare.
    /// @return equal True if arrays are the same. False otherwise.
    function equals(
        bytes memory lhs,
        bytes memory rhs
    )
        internal
        pure
        returns (bool equal)
    {
        // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.
        // We early exit on unequal lengths, but keccak would also correctly
        // handle this.
        return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);
    }

    /// @dev Reads an address from a position in a byte array.
    /// @param b Byte array containing an address.
    /// @param index Index in byte array of address.
    /// @return result address from byte array.
    function readAddress(
        bytes memory b,
        uint256 index
    )
        internal
        pure
        returns (address result)
    {
        if (b.length < index + 20) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,
                b.length,
                index + 20 // 20 is length of address
            ));
        }

        // Add offset to index:
        // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
        // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
        index += 20;

        // Read address from array memory
        assembly {
            // 1. Add index to address of bytes array
            // 2. Load 32-byte word from memory
            // 3. Apply 20-byte mask to obtain address
            result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
        }
        return result;
    }

    /// @dev Writes an address into a specific position in a byte array.
    /// @param b Byte array to insert address into.
    /// @param index Index in byte array of address.
    /// @param input Address to put into byte array.
    function writeAddress(
        bytes memory b,
        uint256 index,
        address input
    )
        internal
        pure
    {
        if (b.length < index + 20) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,
                b.length,
                index + 20 // 20 is length of address
            ));
        }

        // Add offset to index:
        // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
        // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
        index += 20;

        // Store address into array memory
        assembly {
            // The address occupies 20 bytes and mstore stores 32 bytes.
            // First fetch the 32-byte word where we'll be storing the address, then
            // apply a mask so we have only the bytes in the word that the address will not occupy.
            // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.

            // 1. Add index to address of bytes array
            // 2. Load 32-byte word from memory
            // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address
            let neighbors := and(
                mload(add(b, index)),
                0xffffffffffffffffffffffff0000000000000000000000000000000000000000
            )

            // Make sure input address is clean.
            // (Solidity does not guarantee this)
            input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)

            // Store the neighbors and address into memory
            mstore(add(b, index), xor(input, neighbors))
        }
    }

    /// @dev Reads a bytes32 value from a position in a byte array.
    /// @param b Byte array containing a bytes32 value.
    /// @param index Index in byte array of bytes32 value.
    /// @return result bytes32 value from byte array.
    function readBytes32(
        bytes memory b,
        uint256 index
    )
        internal
        pure
        returns (bytes32 result)
    {
        if (b.length < index + 32) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,
                b.length,
                index + 32
            ));
        }

        // Arrays are prefixed by a 256 bit length parameter
        index += 32;

        // Read the bytes32 from array memory
        assembly {
            result := mload(add(b, index))
        }
        return result;
    }

    /// @dev Writes a bytes32 into a specific position in a byte array.
    /// @param b Byte array to insert <input> into.
    /// @param index Index in byte array of <input>.
    /// @param input bytes32 to put into byte array.
    function writeBytes32(
        bytes memory b,
        uint256 index,
        bytes32 input
    )
        internal
        pure
    {
        if (b.length < index + 32) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,
                b.length,
                index + 32
            ));
        }

        // Arrays are prefixed by a 256 bit length parameter
        index += 32;

        // Read the bytes32 from array memory
        assembly {
            mstore(add(b, index), input)
        }
    }

    /// @dev Reads a uint256 value from a position in a byte array.
    /// @param b Byte array containing a uint256 value.
    /// @param index Index in byte array of uint256 value.
    /// @return result uint256 value from byte array.
    function readUint256(
        bytes memory b,
        uint256 index
    )
        internal
        pure
        returns (uint256 result)
    {
        result = uint256(readBytes32(b, index));
        return result;
    }

    /// @dev Writes a uint256 into a specific position in a byte array.
    /// @param b Byte array to insert <input> into.
    /// @param index Index in byte array of <input>.
    /// @param input uint256 to put into byte array.
    function writeUint256(
        bytes memory b,
        uint256 index,
        uint256 input
    )
        internal
        pure
    {
        writeBytes32(b, index, bytes32(input));
    }

    /// @dev Reads an unpadded bytes4 value from a position in a byte array.
    /// @param b Byte array containing a bytes4 value.
    /// @param index Index in byte array of bytes4 value.
    /// @return result bytes4 value from byte array.
    function readBytes4(
        bytes memory b,
        uint256 index
    )
        internal
        pure
        returns (bytes4 result)
    {
        if (b.length < index + 4) {
            LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(
                LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsFourRequired,
                b.length,
                index + 4
            ));
        }

        // Arrays are prefixed by a 32 byte length field
        index += 32;

        // Read the bytes4 from array memory
        assembly {
            result := mload(add(b, index))
            // Solidity does not require us to clean the trailing bytes.
            // We do it anyway
            result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
        }
        return result;
    }

    /// @dev Writes a new length to a byte array.
    ///      Decreasing length will lead to removing the corresponding lower order bytes from the byte array.
    ///      Increasing length may lead to appending adjacent in-memory bytes to the end of the byte array.
    /// @param b Bytes array to write new length to.
    /// @param length New length of byte array.
    function writeLength(bytes memory b, uint256 length)
        internal
        pure
    {
        assembly {
            mstore(b, length)
        }
    }
}

File 6 of 28 : LibBytesRichErrorsV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


library LibBytesRichErrorsV06 {

    enum InvalidByteOperationErrorCodes {
        FromLessThanOrEqualsToRequired,
        ToLessThanOrEqualsLengthRequired,
        LengthGreaterThanZeroRequired,
        LengthGreaterThanOrEqualsFourRequired,
        LengthGreaterThanOrEqualsTwentyRequired,
        LengthGreaterThanOrEqualsThirtyTwoRequired,
        LengthGreaterThanOrEqualsNestedBytesLengthRequired,
        DestinationLengthGreaterThanOrEqualSourceLengthRequired
    }

    // bytes4(keccak256("InvalidByteOperationError(uint8,uint256,uint256)"))
    bytes4 internal constant INVALID_BYTE_OPERATION_ERROR_SELECTOR =
        0x28006595;

    // solhint-disable func-name-mixedcase
    function InvalidByteOperationError(
        InvalidByteOperationErrorCodes errorCode,
        uint256 offset,
        uint256 required
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            INVALID_BYTE_OPERATION_ERROR_SELECTOR,
            errorCode,
            offset,
            required
        );
    }
}

File 7 of 28 : LibSafeMathV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;

import "./errors/LibRichErrorsV06.sol";
import "./errors/LibSafeMathRichErrorsV06.sol";


library LibSafeMathV06 {

    function safeMul(uint256 a, uint256 b)
        internal
        pure
        returns (uint256)
    {
        if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
        if (c / a != b) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
                LibSafeMathRichErrorsV06.BinOpErrorCodes.MULTIPLICATION_OVERFLOW,
                a,
                b
            ));
        }
        return c;
    }

    function safeDiv(uint256 a, uint256 b)
        internal
        pure
        returns (uint256)
    {
        if (b == 0) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
                LibSafeMathRichErrorsV06.BinOpErrorCodes.DIVISION_BY_ZERO,
                a,
                b
            ));
        }
        uint256 c = a / b;
        return c;
    }

    function safeSub(uint256 a, uint256 b)
        internal
        pure
        returns (uint256)
    {
        if (b > a) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
                LibSafeMathRichErrorsV06.BinOpErrorCodes.SUBTRACTION_UNDERFLOW,
                a,
                b
            ));
        }
        return a - b;
    }

    function safeAdd(uint256 a, uint256 b)
        internal
        pure
        returns (uint256)
    {
        uint256 c = a + b;
        if (c < a) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
                LibSafeMathRichErrorsV06.BinOpErrorCodes.ADDITION_OVERFLOW,
                a,
                b
            ));
        }
        return c;
    }

    function max256(uint256 a, uint256 b)
        internal
        pure
        returns (uint256)
    {
        return a >= b ? a : b;
    }

    function min256(uint256 a, uint256 b)
        internal
        pure
        returns (uint256)
    {
        return a < b ? a : b;
    }

    function safeMul128(uint128 a, uint128 b)
        internal
        pure
        returns (uint128)
    {
        if (a == 0) {
            return 0;
        }
        uint128 c = a * b;
        if (c / a != b) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
                LibSafeMathRichErrorsV06.BinOpErrorCodes.MULTIPLICATION_OVERFLOW,
                a,
                b
            ));
        }
        return c;
    }

    function safeDiv128(uint128 a, uint128 b)
        internal
        pure
        returns (uint128)
    {
        if (b == 0) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
                LibSafeMathRichErrorsV06.BinOpErrorCodes.DIVISION_BY_ZERO,
                a,
                b
            ));
        }
        uint128 c = a / b;
        return c;
    }

    function safeSub128(uint128 a, uint128 b)
        internal
        pure
        returns (uint128)
    {
        if (b > a) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
                LibSafeMathRichErrorsV06.BinOpErrorCodes.SUBTRACTION_UNDERFLOW,
                a,
                b
            ));
        }
        return a - b;
    }

    function safeAdd128(uint128 a, uint128 b)
        internal
        pure
        returns (uint128)
    {
        uint128 c = a + b;
        if (c < a) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
                LibSafeMathRichErrorsV06.BinOpErrorCodes.ADDITION_OVERFLOW,
                a,
                b
            ));
        }
        return c;
    }

    function max128(uint128 a, uint128 b)
        internal
        pure
        returns (uint128)
    {
        return a >= b ? a : b;
    }

    function min128(uint128 a, uint128 b)
        internal
        pure
        returns (uint128)
    {
        return a < b ? a : b;
    }

    function safeDowncastToUint128(uint256 a)
        internal
        pure
        returns (uint128)
    {
        if (a > type(uint128).max) {
            LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256DowncastError(
                LibSafeMathRichErrorsV06.DowncastErrorCodes.VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128,
                a
            ));
        }
        return uint128(a);
    }
}

File 8 of 28 : LibSafeMathRichErrorsV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


library LibSafeMathRichErrorsV06 {

    // bytes4(keccak256("Uint256BinOpError(uint8,uint256,uint256)"))
    bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR =
        0xe946c1bb;

    // bytes4(keccak256("Uint256DowncastError(uint8,uint256)"))
    bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR =
        0xc996af7b;

    enum BinOpErrorCodes {
        ADDITION_OVERFLOW,
        MULTIPLICATION_OVERFLOW,
        SUBTRACTION_UNDERFLOW,
        DIVISION_BY_ZERO
    }

    enum DowncastErrorCodes {
        VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT32,
        VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT64,
        VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96,
        VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128
    }

    // solhint-disable func-name-mixedcase
    function Uint256BinOpError(
        BinOpErrorCodes errorCode,
        uint256 a,
        uint256 b
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            UINT256_BINOP_ERROR_SELECTOR,
            errorCode,
            a,
            b
        );
    }

    function Uint256DowncastError(
        DowncastErrorCodes errorCode,
        uint256 a
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            UINT256_DOWNCAST_ERROR_SELECTOR,
            errorCode,
            a
        );
    }
}

File 9 of 28 : LibTransformERC20RichErrors.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


library LibTransformERC20RichErrors {

    // solhint-disable func-name-mixedcase,separate-by-one-line-in-contract

    function InsufficientEthAttachedError(
        uint256 ethAttached,
        uint256 ethNeeded
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("InsufficientEthAttachedError(uint256,uint256)")),
            ethAttached,
            ethNeeded
        );
    }

    function IncompleteTransformERC20Error(
        address outputToken,
        uint256 outputTokenAmount,
        uint256 minOutputTokenAmount
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("IncompleteTransformERC20Error(address,uint256,uint256)")),
            outputToken,
            outputTokenAmount,
            minOutputTokenAmount
        );
    }

    function NegativeTransformERC20OutputError(
        address outputToken,
        uint256 outputTokenLostAmount
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("NegativeTransformERC20OutputError(address,uint256)")),
            outputToken,
            outputTokenLostAmount
        );
    }

    function TransformerFailedError(
        address transformer,
        bytes memory transformerData,
        bytes memory resultData
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("TransformerFailedError(address,bytes,bytes)")),
            transformer,
            transformerData,
            resultData
        );
    }

    // Common Transformer errors ///////////////////////////////////////////////

    function OnlyCallableByDeployerError(
        address caller,
        address deployer
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("OnlyCallableByDeployerError(address,address)")),
            caller,
            deployer
        );
    }

    function InvalidExecutionContextError(
        address actualContext,
        address expectedContext
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("InvalidExecutionContextError(address,address)")),
            actualContext,
            expectedContext
        );
    }

    enum InvalidTransformDataErrorCode {
        INVALID_TOKENS,
        INVALID_ARRAY_LENGTH
    }

    function InvalidTransformDataError(
        InvalidTransformDataErrorCode errorCode,
        bytes memory transformData
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("InvalidTransformDataError(uint8,bytes)")),
            errorCode,
            transformData
        );
    }

    // FillQuoteTransformer errors /////////////////////////////////////////////

    function IncompleteFillSellQuoteError(
        address sellToken,
        uint256 soldAmount,
        uint256 sellAmount
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("IncompleteFillSellQuoteError(address,uint256,uint256)")),
            sellToken,
            soldAmount,
            sellAmount
        );
    }

    function IncompleteFillBuyQuoteError(
        address buyToken,
        uint256 boughtAmount,
        uint256 buyAmount
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("IncompleteFillBuyQuoteError(address,uint256,uint256)")),
            buyToken,
            boughtAmount,
            buyAmount
        );
    }

    function InsufficientTakerTokenError(
        uint256 tokenBalance,
        uint256 tokensNeeded
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("InsufficientTakerTokenError(uint256,uint256)")),
            tokenBalance,
            tokensNeeded
        );
    }

    function InsufficientProtocolFeeError(
        uint256 ethBalance,
        uint256 ethNeeded
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("InsufficientProtocolFeeError(uint256,uint256)")),
            ethBalance,
            ethNeeded
        );
    }

    function InvalidERC20AssetDataError(
        bytes memory assetData
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("InvalidERC20AssetDataError(bytes)")),
            assetData
        );
    }

    function InvalidTakerFeeTokenError(
        address token
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("InvalidTakerFeeTokenError(address)")),
            token
        );
    }
}

File 10 of 28 : FixinCommon.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "../errors/LibCommonRichErrors.sol";
import "../errors/LibOwnableRichErrors.sol";
import "../features/interfaces/IOwnableFeature.sol";
import "../features/interfaces/ISimpleFunctionRegistryFeature.sol";


/// @dev Common feature utilities.
abstract contract FixinCommon {

    using LibRichErrorsV06 for bytes;

    /// @dev The implementation address of this feature.
    address internal immutable _implementation;

    /// @dev The caller must be this contract.
    modifier onlySelf() virtual {
        if (msg.sender != address(this)) {
            LibCommonRichErrors.OnlyCallableBySelfError(msg.sender).rrevert();
        }
        _;
    }

    /// @dev The caller of this function must be the owner.
    modifier onlyOwner() virtual {
        {
            address owner = IOwnableFeature(address(this)).owner();
            if (msg.sender != owner) {
                LibOwnableRichErrors.OnlyOwnerError(
                    msg.sender,
                    owner
                ).rrevert();
            }
        }
        _;
    }

    constructor() internal {
        // Remember this feature's original address.
        _implementation = address(this);
    }

    /// @dev Registers a function implemented by this feature at `_implementation`.
    ///      Can and should only be called within a `migrate()`.
    /// @param selector The selector of the function whose implementation
    ///        is at `_implementation`.
    function _registerFeatureFunction(bytes4 selector)
        internal
    {
        ISimpleFunctionRegistryFeature(address(this)).extend(selector, _implementation);
    }

    /// @dev Encode a feature version as a `uint256`.
    /// @param major The major version number of the feature.
    /// @param minor The minor version number of the feature.
    /// @param revision The revision number of the feature.
    /// @return encodedVersion The encoded version number.
    function _encodeVersion(uint32 major, uint32 minor, uint32 revision)
        internal
        pure
        returns (uint256 encodedVersion)
    {
        return (uint256(major) << 64) | (uint256(minor) << 32) | uint256(revision);
    }
}

File 11 of 28 : LibCommonRichErrors.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


library LibCommonRichErrors {

    // solhint-disable func-name-mixedcase

    function OnlyCallableBySelfError(address sender)
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("OnlyCallableBySelfError(address)")),
            sender
        );
    }

    function IllegalReentrancyError(bytes4 selector, uint256 reentrancyFlags)
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("IllegalReentrancyError(bytes4,uint256)")),
            selector,
            reentrancyFlags
        );
    }
}

File 12 of 28 : LibOwnableRichErrors.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


library LibOwnableRichErrors {

    // solhint-disable func-name-mixedcase

    function OnlyOwnerError(
        address sender,
        address owner
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("OnlyOwnerError(address,address)")),
            sender,
            owner
        );
    }

    function TransferOwnerToZeroError()
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("TransferOwnerToZeroError()"))
        );
    }

    function MigrateCallFailedError(address target, bytes memory resultData)
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("MigrateCallFailedError(address,bytes)")),
            target,
            resultData
        );
    }
}

File 13 of 28 : IOwnableFeature.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol";


// solhint-disable no-empty-blocks
/// @dev Owner management and migration features.
interface IOwnableFeature is
    IOwnableV06
{
    /// @dev Emitted when `migrate()` is called.
    /// @param caller The caller of `migrate()`.
    /// @param migrator The migration contract.
    /// @param newOwner The address of the new owner.
    event Migrated(address caller, address migrator, address newOwner);

    /// @dev Execute a migration function in the context of the ZeroEx contract.
    ///      The result of the function being called should be the magic bytes
    ///      0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner.
    ///      The owner will be temporarily set to `address(this)` inside the call.
    ///      Before returning, the owner will be set to `newOwner`.
    /// @param target The migrator contract address.
    /// @param newOwner The address of the new owner.
    /// @param data The call data.
    function migrate(address target, bytes calldata data, address newOwner) external;
}

File 14 of 28 : IOwnableV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


interface IOwnableV06 {

    /// @dev Emitted by Ownable when ownership is transferred.
    /// @param previousOwner The previous owner of the contract.
    /// @param newOwner The new owner of the contract.
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /// @dev Transfers ownership of the contract to a new address.
    /// @param newOwner The address that will become the owner.
    function transferOwnership(address newOwner) external;

    /// @dev The owner of this contract.
    /// @return ownerAddress The owner address.
    function owner() external view returns (address ownerAddress);
}

File 15 of 28 : ISimpleFunctionRegistryFeature.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;


/// @dev Basic registry management features.
interface ISimpleFunctionRegistryFeature {

    /// @dev A function implementation was updated via `extend()` or `rollback()`.
    /// @param selector The function selector.
    /// @param oldImpl The implementation contract address being replaced.
    /// @param newImpl The replacement implementation contract address.
    event ProxyFunctionUpdated(bytes4 indexed selector, address oldImpl, address newImpl);

    /// @dev Roll back to a prior implementation of a function.
    /// @param selector The function selector.
    /// @param targetImpl The address of an older implementation of the function.
    function rollback(bytes4 selector, address targetImpl) external;

    /// @dev Register or replace a function.
    /// @param selector The function selector.
    /// @param impl The implementation contract for the function.
    function extend(bytes4 selector, address impl) external;

    /// @dev Retrieve the length of the rollback history for a function.
    /// @param selector The function selector.
    /// @return rollbackLength The number of items in the rollback history for
    ///         the function.
    function getRollbackLength(bytes4 selector)
        external
        view
        returns (uint256 rollbackLength);

    /// @dev Retrieve an entry in the rollback history for a function.
    /// @param selector The function selector.
    /// @param idx The index in the rollback history.
    /// @return impl An implementation address for the function at
    ///         index `idx`.
    function getRollbackEntryAtIndex(bytes4 selector, uint256 idx)
        external
        view
        returns (address impl);
}

File 16 of 28 : FixinTokenSpender.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-erc20/contracts/src/v06/IEtherTokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";


/// @dev Helpers for moving tokens around.
abstract contract FixinTokenSpender {

    // Mask of the lower 20 bytes of a bytes32.
    uint256 constant private ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;

    /// @dev Transfers ERC20 tokens from `owner` to `to`.
    /// @param token The token to spend.
    /// @param owner The owner of the tokens.
    /// @param to The recipient of the tokens.
    /// @param amount The amount of `token` to transfer.
    function _transferERC20TokensFrom(
        IERC20TokenV06 token,
        address owner,
        address to,
        uint256 amount
    )
        internal
    {
        require(address(token) != address(this), "FixinTokenSpender/CANNOT_INVOKE_SELF");

        assembly {
            let ptr := mload(0x40) // free memory pointer

            // selector for transferFrom(address,address,uint256)
            mstore(ptr, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(ptr, 0x04), and(owner, ADDRESS_MASK))
            mstore(add(ptr, 0x24), and(to, ADDRESS_MASK))
            mstore(add(ptr, 0x44), amount)

            let success := call(
                gas(),
                and(token, ADDRESS_MASK),
                0,
                ptr,
                0x64,
                ptr,
                32
            )

            let rdsize := returndatasize()

            // Check for ERC20 success. ERC20 tokens should return a boolean,
            // but some don't. We accept 0-length return data as success, or at
            // least 32 bytes that starts with a 32-byte boolean true.
            success := and(
                success,                             // call itself succeeded
                or(
                    iszero(rdsize),                  // no return data, or
                    and(
                        iszero(lt(rdsize, 32)),      // at least 32 bytes
                        eq(mload(ptr), 1)            // starts with uint256(1)
                    )
                )
            )

            if iszero(success) {
                returndatacopy(ptr, 0, rdsize)
                revert(ptr, rdsize)
            }
        }
    }

    /// @dev Transfers ERC20 tokens from ourselves to `to`.
    /// @param token The token to spend.
    /// @param to The recipient of the tokens.
    /// @param amount The amount of `token` to transfer.
    function _transferERC20Tokens(
        IERC20TokenV06 token,
        address to,
        uint256 amount
    )
        internal
    {
        require(address(token) != address(this), "FixinTokenSpender/CANNOT_INVOKE_SELF");

        assembly {
            let ptr := mload(0x40) // free memory pointer

            // selector for transfer(address,uint256)
            mstore(ptr, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(ptr, 0x04), and(to, ADDRESS_MASK))
            mstore(add(ptr, 0x24), amount)

            let success := call(
                gas(),
                and(token, ADDRESS_MASK),
                0,
                ptr,
                0x44,
                ptr,
                32
            )

            let rdsize := returndatasize()

            // Check for ERC20 success. ERC20 tokens should return a boolean,
            // but some don't. We accept 0-length return data as success, or at
            // least 32 bytes that starts with a 32-byte boolean true.
            success := and(
                success,                             // call itself succeeded
                or(
                    iszero(rdsize),                  // no return data, or
                    and(
                        iszero(lt(rdsize, 32)),      // at least 32 bytes
                        eq(mload(ptr), 1)            // starts with uint256(1)
                    )
                )
            )

            if iszero(success) {
                returndatacopy(ptr, 0, rdsize)
                revert(ptr, rdsize)
            }
        }
    }

    /// @dev Gets the maximum amount of an ERC20 token `token` that can be
    ///      pulled from `owner` by this address.
    /// @param token The token to spend.
    /// @param owner The owner of the tokens.
    /// @return amount The amount of tokens that can be pulled.
    function _getSpendableERC20BalanceOf(
        IERC20TokenV06 token,
        address owner
    )
        internal
        view
        returns (uint256)
    {
        return LibSafeMathV06.min256(
            token.allowance(owner, address(this)),
            token.balanceOf(owner)
        );
    }
}

File 17 of 28 : IEtherTokenV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;

import "./IERC20TokenV06.sol";


interface IEtherTokenV06 is
    IERC20TokenV06
{
    /// @dev Wrap ether.
    function deposit() external payable;

    /// @dev Unwrap ether.
    function withdraw(uint256 amount) external;
}

File 18 of 28 : LibMigrate.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "../errors/LibOwnableRichErrors.sol";


library LibMigrate {

    /// @dev Magic bytes returned by a migrator to indicate success.
    ///      This is `keccack('MIGRATE_SUCCESS')`.
    bytes4 internal constant MIGRATE_SUCCESS = 0x2c64c5ef;

    using LibRichErrorsV06 for bytes;

    /// @dev Perform a delegatecall and ensure it returns the magic bytes.
    /// @param target The call target.
    /// @param data The call data.
    function delegatecallMigrateFunction(
        address target,
        bytes memory data
    )
        internal
    {
        (bool success, bytes memory resultData) = target.delegatecall(data);
        if (!success ||
            resultData.length != 32 ||
            abi.decode(resultData, (bytes4)) != MIGRATE_SUCCESS)
        {
            LibOwnableRichErrors.MigrateCallFailedError(target, resultData).rrevert();
        }
    }
}

File 19 of 28 : IFlashWallet.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol";


/// @dev A contract that can execute arbitrary calls from its owner.
interface IFlashWallet {

    /// @dev Execute an arbitrary call. Only an authority can call this.
    /// @param target The call target.
    /// @param callData The call data.
    /// @param value Ether to attach to the call.
    /// @return resultData The data returned by the call.
    function executeCall(
        address payable target,
        bytes calldata callData,
        uint256 value
    )
        external
        payable
        returns (bytes memory resultData);

    /// @dev Execute an arbitrary delegatecall, in the context of this puppet.
    ///      Only an authority can call this.
    /// @param target The call target.
    /// @param callData The call data.
    /// @return resultData The data returned by the call.
    function executeDelegateCall(
        address payable target,
        bytes calldata callData
    )
        external
        payable
        returns (bytes memory resultData);

    /// @dev Allows the puppet to receive ETH.
    receive() external payable;

    /// @dev Fetch the immutable owner/deployer of this contract.
    /// @return owner_ The immutable owner/deployer/
    function owner() external view returns (address owner_);
}

File 20 of 28 : FlashWallet.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "@0x/contracts-utils/contracts/src/v06/errors/LibOwnableRichErrorsV06.sol";
import "../errors/LibWalletRichErrors.sol";
import "./IFlashWallet.sol";


/// @dev A contract that can execute arbitrary calls from its owner.
contract FlashWallet is
    IFlashWallet
{
    // solhint-disable no-unused-vars,indent,no-empty-blocks
    using LibRichErrorsV06 for bytes;

    // solhint-disable
    /// @dev Store the owner/deployer as an immutable to make this contract stateless.
    address public override immutable owner;
    // solhint-enable

    constructor() public {
        // The deployer is the owner.
        owner = msg.sender;
    }

    /// @dev Allows only the (immutable) owner to call a function.
    modifier onlyOwner() virtual {
        if (msg.sender != owner) {
            LibOwnableRichErrorsV06.OnlyOwnerError(
                msg.sender,
                owner
            ).rrevert();
        }
        _;
    }

    /// @dev Execute an arbitrary call. Only an authority can call this.
    /// @param target The call target.
    /// @param callData The call data.
    /// @param value Ether to attach to the call.
    /// @return resultData The data returned by the call.
    function executeCall(
        address payable target,
        bytes calldata callData,
        uint256 value
    )
        external
        payable
        override
        onlyOwner
        returns (bytes memory resultData)
    {
        bool success;
        (success, resultData) = target.call{value: value}(callData);
        if (!success) {
            LibWalletRichErrors
                .WalletExecuteCallFailedError(
                    address(this),
                    target,
                    callData,
                    value,
                    resultData
                )
                .rrevert();
        }
    }

    /// @dev Execute an arbitrary delegatecall, in the context of this puppet.
    ///      Only an authority can call this.
    /// @param target The call target.
    /// @param callData The call data.
    /// @return resultData The data returned by the call.
    function executeDelegateCall(
        address payable target,
        bytes calldata callData
    )
        external
        payable
        override
        onlyOwner
        returns (bytes memory resultData)
    {
        bool success;
        (success, resultData) = target.delegatecall(callData);
        if (!success) {
            LibWalletRichErrors
                .WalletExecuteDelegateCallFailedError(
                    address(this),
                    target,
                    callData,
                    resultData
                )
                .rrevert();
        }
    }

    // solhint-disable
    /// @dev Allows this contract to receive ether.
    receive() external override payable {}
    // solhint-enable

    /// @dev Signal support for receiving ERC1155 tokens.
    /// @param interfaceID The interface ID, as per ERC-165 rules.
    /// @return hasSupport `true` if this contract supports an ERC-165 interface.
    function supportsInterface(bytes4 interfaceID)
        external
        pure
        returns (bool hasSupport)
    {
        return  interfaceID == this.supportsInterface.selector ||
                interfaceID == this.onERC1155Received.selector ^ this.onERC1155BatchReceived.selector ||
                interfaceID == this.tokenFallback.selector;
    }

    ///  @dev Allow this contract to receive ERC1155 tokens.
    ///  @return success  `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
    function onERC1155Received(
        address, // operator,
        address, // from,
        uint256, // id,
        uint256, // value,
        bytes calldata //data
    )
        external
        pure
        returns (bytes4 success)
    {
        return this.onERC1155Received.selector;
    }

    ///  @dev Allow this contract to receive ERC1155 tokens.
    ///  @return success  `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
    function onERC1155BatchReceived(
        address, // operator,
        address, // from,
        uint256[] calldata, // ids,
        uint256[] calldata, // values,
        bytes calldata // data
    )
        external
        pure
        returns (bytes4 success)
    {
        return this.onERC1155BatchReceived.selector;
    }

    /// @dev Allows this contract to receive ERC223 tokens.
    function tokenFallback(
        address, // from,
        uint256, // value,
        bytes calldata // value
    )
        external
        pure
    {}
}

File 21 of 28 : LibOwnableRichErrorsV06.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/
pragma solidity ^0.6.5;


library LibOwnableRichErrorsV06 {

    // bytes4(keccak256("OnlyOwnerError(address,address)"))
    bytes4 internal constant ONLY_OWNER_ERROR_SELECTOR =
        0x1de45ad1;

    // bytes4(keccak256("TransferOwnerToZeroError()"))
    bytes internal constant TRANSFER_OWNER_TO_ZERO_ERROR_BYTES =
        hex"e69edc3e";

    // solhint-disable func-name-mixedcase
    function OnlyOwnerError(
        address sender,
        address owner
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            ONLY_OWNER_ERROR_SELECTOR,
            sender,
            owner
        );
    }

    function TransferOwnerToZeroError()
        internal
        pure
        returns (bytes memory)
    {
        return TRANSFER_OWNER_TO_ZERO_ERROR_BYTES;
    }
}

File 22 of 28 : LibWalletRichErrors.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;


library LibWalletRichErrors {

    // solhint-disable func-name-mixedcase

    function WalletExecuteCallFailedError(
        address wallet,
        address callTarget,
        bytes memory callData,
        uint256 callValue,
        bytes memory errorData
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("WalletExecuteCallFailedError(address,address,bytes,uint256,bytes)")),
            wallet,
            callTarget,
            callData,
            callValue,
            errorData
        );
    }

    function WalletExecuteDelegateCallFailedError(
        address wallet,
        address callTarget,
        bytes memory callData,
        bytes memory errorData
    )
        internal
        pure
        returns (bytes memory)
    {
        return abi.encodeWithSelector(
            bytes4(keccak256("WalletExecuteDelegateCallFailedError(address,address,bytes,bytes)")),
            wallet,
            callTarget,
            callData,
            errorData
        );
    }
}

File 23 of 28 : LibTransformERC20Storage.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "./LibStorage.sol";
import "../external/IFlashWallet.sol";


/// @dev Storage helpers for the `TransformERC20` feature.
library LibTransformERC20Storage {

    /// @dev Storage bucket for this feature.
    struct Storage {
        // The current wallet instance.
        IFlashWallet wallet;
        // The transformer deployer address.
        address transformerDeployer;
        // The optional signer for `transformERC20()` calldata.
        address quoteSigner;
    }

    /// @dev Get the storage bucket for this contract.
    function getStorage() internal pure returns (Storage storage stor) {
        uint256 storageSlot = LibStorage.getStorageSlot(
            LibStorage.StorageId.TransformERC20
        );
        // Dip into assembly to change the slot pointed to by the local
        // variable `stor`.
        // See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
        assembly { stor_slot := storageSlot }
    }
}

File 24 of 28 : LibStorage.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;


/// @dev Common storage helpers
library LibStorage {

    /// @dev What to bit-shift a storage ID by to get its slot.
    ///      This gives us a maximum of 2**128 inline fields in each bucket.
    uint256 private constant STORAGE_SLOT_EXP = 128;

    /// @dev Storage IDs for feature storage buckets.
    ///      WARNING: APPEND-ONLY.
    enum StorageId {
        Proxy,
        SimpleFunctionRegistry,
        Ownable,
        TokenSpender,
        TransformERC20,
        MetaTransactions,
        ReentrancyGuard,
        NativeOrders,
        OtcOrders
    }

    /// @dev Get the storage slot given a storage ID. We assign unique, well-spaced
    ///     slots to storage bucket variables to ensure they do not overlap.
    ///     See: https://solidity.readthedocs.io/en/v0.6.6/assembly.html#access-to-external-variables-functions-and-libraries
    /// @param storageId An entry in `StorageId`
    /// @return slot The storage slot.
    function getStorageSlot(StorageId storageId)
        internal
        pure
        returns (uint256 slot)
    {
        // This should never overflow with a reasonable `STORAGE_SLOT_EXP`
        // because Solidity will do a range check on `storageId` during the cast.
        return (uint256(storageId) + 1) << STORAGE_SLOT_EXP;
    }
}

File 25 of 28 : IERC20Transformer.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";


/// @dev A transformation callback used in `TransformERC20.transformERC20()`.
interface IERC20Transformer {

    /// @dev Context information to pass into `transform()` by `TransformERC20.transformERC20()`.
    struct TransformContext {
        // The caller of `TransformERC20.transformERC20()`.
        address payable sender;
        // The recipient address, which may be distinct from `sender` e.g. in
        // meta-transactions.
        address payable recipient;
        // Arbitrary data to pass to the transformer.
        bytes data;
    }

    /// @dev Called from `TransformERC20.transformERC20()`. This will be
    ///      delegatecalled in the context of the FlashWallet instance being used.
    /// @param context Context information.
    /// @return success The success bytes (`LibERC20Transformer.TRANSFORMER_SUCCESS`).
    function transform(TransformContext calldata context)
        external
        returns (bytes4 success);
}

File 26 of 28 : LibERC20Transformer.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";


library LibERC20Transformer {

    using LibERC20TokenV06 for IERC20TokenV06;

    /// @dev ETH pseudo-token address.
    address constant internal ETH_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    /// @dev ETH pseudo-token.
    IERC20TokenV06 constant internal ETH_TOKEN = IERC20TokenV06(ETH_TOKEN_ADDRESS);
    /// @dev Return value indicating success in `IERC20Transformer.transform()`.
    ///      This is just `keccak256('TRANSFORMER_SUCCESS')`.
    bytes4 constant internal TRANSFORMER_SUCCESS = 0x13c9929e;

    /// @dev Transfer ERC20 tokens and ETH.
    /// @param token An ERC20 or the ETH pseudo-token address (`ETH_TOKEN_ADDRESS`).
    /// @param to The recipient.
    /// @param amount The transfer amount.
    function transformerTransfer(
        IERC20TokenV06 token,
        address payable to,
        uint256 amount
    )
        internal
    {
        if (isTokenETH(token)) {
            to.transfer(amount);
        } else {
            token.compatTransfer(to, amount);
        }
    }

    /// @dev Check if a token is the ETH pseudo-token.
    /// @param token The token to check.
    /// @return isETH `true` if the token is the ETH pseudo-token.
    function isTokenETH(IERC20TokenV06 token)
        internal
        pure
        returns (bool isETH)
    {
        return address(token) == ETH_TOKEN_ADDRESS;
    }

    /// @dev Check the balance of an ERC20 token or ETH.
    /// @param token An ERC20 or the ETH pseudo-token address (`ETH_TOKEN_ADDRESS`).
    /// @param owner Holder of the tokens.
    /// @return tokenBalance The balance of `owner`.
    function getTokenBalanceOf(IERC20TokenV06 token, address owner)
        internal
        view
        returns (uint256 tokenBalance)
    {
        if (isTokenETH(token)) {
            return owner.balance;
        }
        return token.balanceOf(owner);
    }

    /// @dev RLP-encode a 32-bit or less account nonce.
    /// @param nonce A positive integer in the range 0 <= nonce < 2^32.
    /// @return rlpNonce The RLP encoding.
    function rlpEncodeNonce(uint32 nonce)
        internal
        pure
        returns (bytes memory rlpNonce)
    {
        // See https://github.com/ethereum/wiki/wiki/RLP for RLP encoding rules.
        if (nonce == 0) {
            rlpNonce = new bytes(1);
            rlpNonce[0] = 0x80;
        } else if (nonce < 0x80) {
            rlpNonce = new bytes(1);
            rlpNonce[0] = byte(uint8(nonce));
        } else if (nonce <= 0xFF) {
            rlpNonce = new bytes(2);
            rlpNonce[0] = 0x81;
            rlpNonce[1] = byte(uint8(nonce));
        } else if (nonce <= 0xFFFF) {
            rlpNonce = new bytes(3);
            rlpNonce[0] = 0x82;
            rlpNonce[1] = byte(uint8((nonce & 0xFF00) >> 8));
            rlpNonce[2] = byte(uint8(nonce));
        } else if (nonce <= 0xFFFFFF) {
            rlpNonce = new bytes(4);
            rlpNonce[0] = 0x83;
            rlpNonce[1] = byte(uint8((nonce & 0xFF0000) >> 16));
            rlpNonce[2] = byte(uint8((nonce & 0xFF00) >> 8));
            rlpNonce[3] = byte(uint8(nonce));
        } else {
            rlpNonce = new bytes(5);
            rlpNonce[0] = 0x84;
            rlpNonce[1] = byte(uint8((nonce & 0xFF000000) >> 24));
            rlpNonce[2] = byte(uint8((nonce & 0xFF0000) >> 16));
            rlpNonce[3] = byte(uint8((nonce & 0xFF00) >> 8));
            rlpNonce[4] = byte(uint8(nonce));
        }
    }

    /// @dev Compute the expected deployment address by `deployer` at
    ///      the nonce given by `deploymentNonce`.
    /// @param deployer The address of the deployer.
    /// @param deploymentNonce The nonce that the deployer had when deploying
    ///        a contract.
    /// @return deploymentAddress The deployment address.
    function getDeployedAddress(address deployer, uint32 deploymentNonce)
        internal
        pure
        returns (address payable deploymentAddress)
    {
        // The address of if a deployed contract is the lower 20 bytes of the
        // hash of the RLP-encoded deployer's account address + account nonce.
        // See: https://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
        bytes memory rlpNonce = rlpEncodeNonce(deploymentNonce);
        return address(uint160(uint256(keccak256(abi.encodePacked(
            byte(uint8(0xC0 + 21 + rlpNonce.length)),
            byte(uint8(0x80 + 20)),
            deployer,
            rlpNonce
        )))));
    }
}

File 27 of 28 : IFeature.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;


/// @dev Basic interface for a feature contract.
interface IFeature {

    // solhint-disable func-name-mixedcase

    /// @dev The name of this feature set.
    function FEATURE_NAME() external view returns (string memory name);

    /// @dev The version of this feature set.
    function FEATURE_VERSION() external view returns (uint256 version);
}

File 28 of 28 : ITransformERC20Feature.sol
// SPDX-License-Identifier: Apache-2.0
/*

  Copyright 2020 ZeroEx Intl.

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

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

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

*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "../../transformers/IERC20Transformer.sol";
import "../../external/IFlashWallet.sol";


/// @dev Feature to composably transform between ERC20 tokens.
interface ITransformERC20Feature {

    /// @dev Defines a transformation to run in `transformERC20()`.
    struct Transformation {
        // The deployment nonce for the transformer.
        // The address of the transformer contract will be derived from this
        // value.
        uint32 deploymentNonce;
        // Arbitrary data to pass to the transformer.
        bytes data;
    }

    /// @dev Arguments for `_transformERC20()`.
    struct TransformERC20Args {
        // The taker address.
        address payable taker;
        // The token being provided by the taker.
        // If `0xeee...`, ETH is implied and should be provided with the call.`
        IERC20TokenV06 inputToken;
        // The token to be acquired by the taker.
        // `0xeee...` implies ETH.
        IERC20TokenV06 outputToken;
        // The amount of `inputToken` to take from the taker.
        // If set to `uint256(-1)`, the entire spendable balance of the taker
        // will be solt.
        uint256 inputTokenAmount;
        // The minimum amount of `outputToken` the taker
        // must receive for the entire transformation to succeed. If set to zero,
        // the minimum output token transfer will not be asserted.
        uint256 minOutputTokenAmount;
        // The transformations to execute on the token balance(s)
        // in sequence.
        Transformation[] transformations;
        // Whether to use the Exchange Proxy's balance of `inputToken`.
        bool useSelfBalance;
        // The recipient of the bought `outputToken`.
        address payable recipient;
    }

    /// @dev Raised upon a successful `transformERC20`.
    /// @param taker The taker (caller) address.
    /// @param inputToken The token being provided by the taker.
    ///        If `0xeee...`, ETH is implied and should be provided with the call.`
    /// @param outputToken The token to be acquired by the taker.
    ///        `0xeee...` implies ETH.
    /// @param inputTokenAmount The amount of `inputToken` to take from the taker.
    /// @param outputTokenAmount The amount of `outputToken` received by the taker.
    event TransformedERC20(
        address indexed taker,
        address inputToken,
        address outputToken,
        uint256 inputTokenAmount,
        uint256 outputTokenAmount
    );

    /// @dev Raised when `setTransformerDeployer()` is called.
    /// @param transformerDeployer The new deployer address.
    event TransformerDeployerUpdated(address transformerDeployer);

    /// @dev Raised when `setQuoteSigner()` is called.
    /// @param quoteSigner The new quote signer.
    event QuoteSignerUpdated(address quoteSigner);

    /// @dev Replace the allowed deployer for transformers.
    ///      Only callable by the owner.
    /// @param transformerDeployer The address of the new trusted deployer
    ///        for transformers.
    function setTransformerDeployer(address transformerDeployer)
        external;

    /// @dev Replace the optional signer for `transformERC20()` calldata.
    ///      Only callable by the owner.
    /// @param quoteSigner The address of the new calldata signer.
    function setQuoteSigner(address quoteSigner)
        external;

    /// @dev Deploy a new flash wallet instance and replace the current one with it.
    ///      Useful if we somehow break the current wallet instance.
    ///       Only callable by the owner.
    /// @return wallet The new wallet instance.
    function createTransformWallet()
        external
        returns (IFlashWallet wallet);

    /// @dev Executes a series of transformations to convert an ERC20 `inputToken`
    ///      to an ERC20 `outputToken`.
    /// @param inputToken The token being provided by the sender.
    ///        If `0xeee...`, ETH is implied and should be provided with the call.`
    /// @param outputToken The token to be acquired by the sender.
    ///        `0xeee...` implies ETH.
    /// @param inputTokenAmount The amount of `inputToken` to take from the sender.
    /// @param minOutputTokenAmount The minimum amount of `outputToken` the sender
    ///        must receive for the entire transformation to succeed.
    /// @param transformations The transformations to execute on the token balance(s)
    ///        in sequence.
    /// @return outputTokenAmount The amount of `outputToken` received by the sender.
    function transformERC20(
        IERC20TokenV06 inputToken,
        IERC20TokenV06 outputToken,
        uint256 inputTokenAmount,
        uint256 minOutputTokenAmount,
        Transformation[] calldata transformations
    )
        external
        payable
        returns (uint256 outputTokenAmount);

    /// @dev Internal version of `transformERC20()`. Only callable from within.
    /// @param args A `TransformERC20Args` struct.
    /// @return outputTokenAmount The amount of `outputToken` received by the taker.
    function _transformERC20(TransformERC20Args calldata args)
        external
        payable
        returns (uint256 outputTokenAmount);

    /// @dev Return the current wallet instance that will serve as the execution
    ///      context for transformations.
    /// @return wallet The wallet instance.
    function getTransformWallet()
        external
        view
        returns (IFlashWallet wallet);

    /// @dev Return the allowed deployer for transformers.
    /// @return deployer The transform deployer address.
    function getTransformerDeployer()
        external
        view
        returns (address deployer);

    /// @dev Return the optional signer for `transformERC20()` calldata.
    /// @return signer The transform deployer address.
    function getQuoteSigner()
        external
        view
        returns (address signer);
}

Settings
{
  "remappings": [
    "@0x/contracts-utils=/Users/michaelzhu/protocol/node_modules/@0x/contracts-utils",
    "@0x/contracts-erc20=/Users/michaelzhu/protocol/contracts/zero-ex/node_modules/@0x/contracts-erc20"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000,
    "details": {
      "yul": true,
      "deduplicate": true,
      "cse": true,
      "constantOptimizer": true
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "evmVersion": "istanbul"
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"quoteSigner","type":"address"}],"name":"QuoteSignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"address","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outputTokenAmount","type":"uint256"}],"name":"TransformedERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"transformerDeployer","type":"address"}],"name":"TransformerDeployerUpdated","type":"event"},{"inputs":[],"name":"FEATURE_NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEATURE_VERSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"taker","type":"address"},{"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minOutputTokenAmount","type":"uint256"},{"components":[{"internalType":"uint32","name":"deploymentNonce","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ITransformERC20Feature.Transformation[]","name":"transformations","type":"tuple[]"},{"internalType":"bool","name":"useSelfBalance","type":"bool"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ITransformERC20Feature.TransformERC20Args","name":"args","type":"tuple"}],"name":"_transformERC20","outputs":[{"internalType":"uint256","name":"outputTokenAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"createTransformWallet","outputs":[{"internalType":"contract IFlashWallet","name":"wallet","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getQuoteSigner","outputs":[{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransformWallet","outputs":[{"internalType":"contract IFlashWallet","name":"wallet","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransformerDeployer","outputs":[{"internalType":"address","name":"deployer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"transformerDeployer","type":"address"}],"name":"migrate","outputs":[{"internalType":"bytes4","name":"success","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"quoteSigner","type":"address"}],"name":"setQuoteSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transformerDeployer","type":"address"}],"name":"setTransformerDeployer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minOutputTokenAmount","type":"uint256"},{"components":[{"internalType":"uint32","name":"deploymentNonce","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ITransformERC20Feature.Transformation[]","name":"transformations","type":"tuple[]"}],"name":"transformERC20","outputs":[{"internalType":"uint256","name":"outputTokenAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20TokenV06","name":"inputToken","type":"address"},{"internalType":"contract IERC20TokenV06","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minOutputTokenAmount","type":"uint256"},{"components":[{"internalType":"uint32","name":"deploymentNonce","type":"uint32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ITransformERC20Feature.Transformation[]","name":"transformations","type":"tuple[]"}],"name":"transformERC20Staging","outputs":[{"internalType":"uint256","name":"outputTokenAmount","type":"uint256"}],"stateMutability":"payable","type":"function"}]

60c060405261001260016004600061002e565b60a05234801561002157600080fd5b503060601b608052610060565b6bffffffff0000000000000000604084901b1667ffffffff00000000602084901b161763ffffffff8216179392505050565b60805160601c60a0516136756200008760003980610224525080610e4c52506136756000f3fe6080604052600436106100c75760003560e01c80638182b61f116100745780639f1ec78b1161004e5780639f1ec78b146101cb578063ce5494bb146101e0578063f028e9be1461020d576100c7565b80638182b61f1461018557806387c96419146101985780638aa6539b146101b8576100c7565b80634d54cdb6116100a55780634d54cdb61461012c57806356ce180a146101415780636ae4b4f714610163576100c7565b8063031b905c146100cc578063287b071b146100f7578063415565b014610119575b600080fd5b3480156100d857600080fd5b506100e1610222565b6040516100ee919061288a565b60405180910390f35b34801561010357600080fd5b5061010c610246565b6040516100ee9190612511565b6100e16101273660046122df565b610373565b34801561013857600080fd5b5061010c61041c565b34801561014d57600080fd5b5061016161015c3660046121f4565b610445565b005b34801561016f57600080fd5b5061017861057c565b6040516100ee9190612774565b6100e16101933660046122df565b6105b5565b3480156101a457600080fd5b506101616101b33660046121f4565b6105c4565b6100e16101c6366004612353565b6106f0565b3480156101d757600080fd5b5061010c610716565b3480156101ec57600080fd5b506102006101fb3660046121f4565b61073f565b6040516100ee91906126cf565b34801561021957600080fd5b5061010c610a33565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000803073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561028f57600080fd5b505afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c79190612210565b90503373ffffffffffffffffffffffffffffffffffffffff8216146102f8576102f86102f33383610a59565b610b15565b5060405161030590612033565b604051809103906000f080158015610321573d6000803e3d6000fd5b5090508061032d610b1d565b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905590565b60006104126040518061010001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020016000151581526020013373ffffffffffffffffffffffffffffffffffffffff16815250610b2a565b9695505050505050565b6000610426610b1d565b6001015473ffffffffffffffffffffffffffffffffffffffff16905090565b60003073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561048d57600080fd5b505afa1580156104a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c59190612210565b90503373ffffffffffffffffffffffffffffffffffffffff8216146104f1576104f16102f33383610a59565b50806104fb610b1d565b60020180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff929092169190911790556040517ff5550c5eea19b48ac6eb5f03abdc4f59c0a60697abb3d973cd68669703b5c8b990610571908390612511565b60405180910390a150565b6040518060400160405280600e81526020017f5472616e73666f726d455243323000000000000000000000000000000000000081525081565b60006104128686868686610373565b60003073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561060c57600080fd5b505afa158015610620573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106449190612210565b90503373ffffffffffffffffffffffffffffffffffffffff821614610670576106706102f33383610a59565b508061067a610b1d565b60010180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff929092169190911790556040517ffd45604abad79c16e23348a137ed8292661be1b8eba6e4806ebed6833b1c046a90610571908390612511565b6000333014610705576107056102f333610d5e565b61070e82610b2a565b90505b919050565b6000610720610b1d565b6002015473ffffffffffffffffffffffffffffffffffffffff16905090565b600061076a7f4d54cdb600000000000000000000000000000000000000000000000000000000610e16565b6107937f287b071b00000000000000000000000000000000000000000000000000000000610e16565b6107bc7ff028e9be00000000000000000000000000000000000000000000000000000000610e16565b6107e57f87c9641900000000000000000000000000000000000000000000000000000000610e16565b61080e7f56ce180a00000000000000000000000000000000000000000000000000000000610e16565b6108377f9f1ec78b00000000000000000000000000000000000000000000000000000000610e16565b6108607f8182b61f00000000000000000000000000000000000000000000000000000000610e16565b6108897f8aa6539b00000000000000000000000000000000000000000000000000000000610e16565b600073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663f028e9be6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108e757600080fd5b505afa1580156108fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091f9190612210565b73ffffffffffffffffffffffffffffffffffffffff1614156109bd573073ffffffffffffffffffffffffffffffffffffffff1663287b071b6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561098357600080fd5b505af1158015610997573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bb9190612210565b505b816109c6610b1d565b60010180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055507f2c64c5ef00000000000000000000000000000000000000000000000000000000919050565b6000610a3d610b1d565b5473ffffffffffffffffffffffffffffffffffffffff16905090565b60607f1de45ad18e8a4484220a3ca14f4d977641addbaba5a344b1384dc2aa78a2e34d8383604051602401610a8f929190612603565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290505b92915050565b805160208201fd5b600080610b0f6004610ea9565b60008160c00151158015610b6157507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260600151145b15610b9b57610b738260200151610ec4565b15610b8357346060830152610b9b565b610b9582602001518360000151610ef6565b60608301525b610ba3612040565b610bab610a33565b73ffffffffffffffffffffffffffffffffffffffff168152610bcb61041c565b73ffffffffffffffffffffffffffffffffffffffff166020820152604083015160e0840151610bfa919061102f565b60408201528051610c0c9084906110ff565b60005b8360a0015151811015610c5357610c4b82600001518560a001518381518110610c3457fe5b602002602001015184602001518760e001516111ca565b600101610c0f565b50610c6b836040015182600001518560e001516113ec565b9150610c7f83604001518460e0015161102f565b6060820181905260408201511115610cac57610cac6102f3846040015183606001518460400151036116a6565b610cd082610ccb836040015184606001516116dc90919063ffffffff16565b6116fb565b91508260800151821015610cf457610cf46102f38460400151848660800151611711565b826000015173ffffffffffffffffffffffffffffffffffffffff167f0f6672f78a59ba8e5e5b5d38df3ebc67f3c792e2c9259b8d97d7f00dd78ba1b384602001518560400151866060015186604051610d50949392919061262a565b60405180910390a250919050565b60607ff0ec779b0bcda6d84abf99ee2c67647d1100ebbb553a9c2d1c2ba1579592832c82604051602401610d929190612511565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b6040517f6eb224cb0000000000000000000000000000000000000000000000000000000081523090636eb224cb90610e749084907f0000000000000000000000000000000000000000000000000000000000000000906004016126fc565b600060405180830381600087803b158015610e8e57600080fd5b505af1158015610ea2573d6000803e3d6000fd5b5050505050565b60006080826008811115610eb957fe5b600101901b92915050565b73ffffffffffffffffffffffffffffffffffffffff811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14919050565b60006110288373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e84306040518363ffffffff1660e01b8152600401610f36929190612603565b60206040518083038186803b158015610f4e57600080fd5b505afa158015610f62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f869190612430565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a0823190610fd8908790600401612511565b60206040518083038186803b158015610ff057600080fd5b505afa158015611004573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ccb9190612430565b9392505050565b600061103a83610ec4565b1561105d575073ffffffffffffffffffffffffffffffffffffffff811631610b0f565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906370a08231906110af908590600401612511565b60206040518083038186803b1580156110c757600080fd5b505afa1580156110db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110289190612430565b61110c8260200151610ec4565b801561111b5750816060015134105b15611131576111316102f33484606001516117cf565b341561117b5760405173ffffffffffffffffffffffffffffffffffffffff8216903480156108fc02916000818181858888f19350505050158015611179573d6000803e3d6000fd5b505b6111888260200151610ec4565b6111c6578160c00151156111ae576111a98260200151828460600151611805565b6111c6565b6111c6826020015183600001518385606001516118df565b5050565b60006111da8385600001516119de565b905060608573ffffffffffffffffffffffffffffffffffffffff1663b68df16d8363832b24bb60e01b60405180606001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018a6020015181525060405160240161125e9190612841565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009485161790525160e085901b90921682526112ef9291600401612532565b600060405180830381600087803b15801561130957600080fd5b505af115801561131d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611363919081019061226c565b9050805160201415806113cd575080517f13c9929e00000000000000000000000000000000000000000000000000000000906113a8908301602090810190840161222c565b7fffffffff000000000000000000000000000000000000000000000000000000001614155b156113e4576113e46102f383876020015184611a4d565b505050505050565b60006113f8848461102f565b905061140384610ec4565b156114d6576040517f54132d7800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906354132d789061145c90859085906004016125a8565b600060405180830381600087803b15801561147657600080fd5b505af115801561148a573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526114d0919081019061226c565b50611028565b60608373ffffffffffffffffffffffffffffffffffffffff166354132d788663a9059cbb60e01b86866040516024016115109291906125dd565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009485161790525160e085901b90921682526115a49291600090600401612569565b600060405180830381600087803b1580156115be57600080fd5b505af11580156115d2573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611618919081019061226c565b905080516000141561166c57843b80611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d90612787565b60405180910390fd5b5061169e565b6020815110611695576000611682826000611a85565b9050806001146116665761166682610b15565b61169e81610b15565b509392505050565b60607f3ea25a3cae94e681748e39876b75ce362a9159c4618787bc1250e3d9f9c439108383604051602401610a8f9291906125dd565b6000828211156116f5576116f56102f360028585611a91565b50900390565b600081831061170a5781611028565b5090919050565b60607f990174d2378c7614a3e4722867cea0a803c0cc16ef92c4f5466ed5bc1d3496da848484604051602401611749939291906126a1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b60607f96660ab143a5c6a946233c268494b1026bfca53373c9715e0fe96b3c59c850448383604051602401610a8f929190612893565b73ffffffffffffffffffffffffffffffffffffffff8316301415611855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d906127e4565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152816024820152602081604483600073ffffffffffffffffffffffffffffffffffffffff89165af13d600183511460208210151681151782169150816113e457806000843e8083fd5b73ffffffffffffffffffffffffffffffffffffffff841630141561192f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d906127e4565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015273ffffffffffffffffffffffffffffffffffffffff83166024820152816044820152602081606483600073ffffffffffffffffffffffffffffffffffffffff8a165af13d600183511460208210151681151782169150816119d557806000843e8083fd5b50505050505050565b600060606119eb83611ab0565b9050805160d50160f81b609460f81b8583604051602001611a0f9493929190612492565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120949350505050565b60607ff21e5cb42b911ca6b3898f8618760aa7d84fe5d43a7a5ad89aa791c66cafe41384848460405160240161174993929190612660565b60006110288383611fea565b606063e946c1bb60e01b84848460405160240161174993929190612744565b606063ffffffff8216611b225760408051600180825281830190925290602082018180368337019050509050608060f81b81600081518110611aee57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610711565b60808263ffffffff161015611b6157604080516001808252818301909252906020820181803683370190505090508160f81b81600081518110611aee57fe5b60ff8263ffffffff1611611be05760408051600280825281830190925290602082018180368337019050509050608160f81b81600081518110611ba057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508160f81b81600181518110611aee57fe5b61ffff8263ffffffff1611611cc65760408051600380825281830190925290602082018180368337019050509050608260f81b81600081518110611c2057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060f084901b169082906001908110611c8657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508160f81b81600281518110611aee57fe5b62ffffff8263ffffffff1611611e135760408051600480825281830190925290602082018180368337019050509050608360f81b81600081518110611d0757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060e884901b169082906001908110611d6d57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060f084901b169082906002908110611dd357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508160f81b81600381518110611aee57fe5b60408051600580825281830190925290602082018180368337019050509050608460f81b81600081518110611e4457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060e084901b169082906001908110611eaa57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060e884901b169082906002908110611f1057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060f084901b169082906003908110611f7657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508160f81b81600481518110611fb657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350919050565b6000816020018351101561200b5761200b6102f36005855185602001612014565b50016020015190565b6060632800659560e01b84848460405160240161174993929190612766565b610ce08061296083390190565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b8035610b0f8161293a565b600082601f8301126120af578081fd5b813567ffffffffffffffff808211156120c6578283fd5b60206120d581828502016128a1565b838152935080840185820160005b8581101561217157813588016040807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838d0301121561212257600080fd5b61212b816128a1565b6121378c8885016121e0565b815290820135908782111561214b57600080fd5b6121598c888486010161218d565b818801528552505091830191908301906001016120e3565b50505050505092915050565b80358015158114610b0f57600080fd5b600082601f83011261219d578081fd5b81356121b06121ab826128c8565b6128a1565b91508082528360208285010111156121c757600080fd5b8060208401602084013760009082016020015292915050565b803563ffffffff81168114610b0f57600080fd5b600060208284031215612205578081fd5b81356110288161293a565b600060208284031215612221578081fd5b81516110288161293a565b60006020828403121561223d578081fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114611028578182fd5b60006020828403121561227d578081fd5b815167ffffffffffffffff811115612293578182fd5b8201601f810184136122a3578182fd5b80516122b16121ab826128c8565b8181528560208385010111156122c5578384fd5b6122d682602083016020860161290a565b95945050505050565b600080600080600060a086880312156122f6578081fd5b85356123018161293a565b945060208601356123118161293a565b93506040860135925060608601359150608086013567ffffffffffffffff81111561233a578182fd5b6123468882890161209f565b9150509295509295909350565b600060208284031215612364578081fd5b813567ffffffffffffffff8082111561237b578283fd5b8184019150610100808387031215612391578384fd5b61239a816128a1565b90506123a68684612094565b81526123b58660208501612094565b60208201526123c78660408501612094565b6040820152606083013560608201526080830135608082015260a0830135828111156123f1578485fd5b6123fd8782860161209f565b60a0830152506124108660c0850161217d565b60c08201526124228660e08501612094565b60e082015295945050505050565b600060208284031215612441578081fd5b5051919050565b6000815180845261246081602086016020860161290a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60007fff0000000000000000000000000000000000000000000000000000000000000080871683528086166001840152507fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008460601b166002830152825161250181601685016020870161290a565b9190910160160195945050505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff84168252604060208301526125616040830184612448565b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff85168252606060208301526125986060830185612448565b9050826040830152949350505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252606060208301819052600090830152604082015260800190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff94851681529290931660208301526040820152606081019190915260800190565b600073ffffffffffffffffffffffffffffffffffffffff851682526060602083015261268f6060830185612448565b82810360408401526104128185612448565b73ffffffffffffffffffffffffffffffffffffffff9390931683526020830191909152604082015260600190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b606081016004851061275257fe5b938152602081019290925260409091015290565b606081016008851061275257fe5b6000602082526110286020830184612448565b60208082526027908201527f696e76616c696420746f6b656e20616464726573732c20636f6e7461696e732060408201527f6e6f20636f646500000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f466978696e546f6b656e5370656e6465722f43414e4e4f545f494e564f4b455f60408201527f53454c4600000000000000000000000000000000000000000000000000000000606082015260800190565b60006020825273ffffffffffffffffffffffffffffffffffffffff8084511660208401528060208501511660408401525060408301516060808401526125616080840182612448565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156128c057600080fd5b604052919050565b600067ffffffffffffffff8211156128de578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b8381101561292557818101518382015260200161290d565b83811115612934576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461295c57600080fd5b5056fe60a060405234801561001057600080fd5b5033606081901b608052610c9b6100456000398061027952806102a7528061039952806103d552806104035250610c9b6000f3fe6080604052600436106100745760003560e01c8063b68df16d1161004e578063b68df16d146100f8578063bc197c811461010b578063c0ee0b8a14610138578063f23a6e611461015a5761007b565b806301ffc9a71461008057806354132d78146100b65780638da5cb5b146100d65761007b565b3661007b57005b600080fd5b34801561008c57600080fd5b506100a061009b366004610a3a565b61017a565b6040516100ad9190610bf5565b60405180910390f35b6100c96100c4366004610851565b61025f565b6040516100ad9190610c2d565b3480156100e257600080fd5b506100eb610397565b6040516100ad9190610afa565b6100c96101063660046107fe565b6103bb565b34801561011757600080fd5b5061012b6101263660046108ab565b6104e8565b6040516100ad9190610c00565b34801561014457600080fd5b506101586101533660046109e0565b610515565b005b34801561016657600080fd5b5061012b610175366004610966565b61051b565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061020d57507fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e000000000000000000000000000000000000000000000000000000000145b8061025957507fffffffff0000000000000000000000000000000000000000000000000000000082167fc0ee0b8a00000000000000000000000000000000000000000000000000000000145b92915050565b60603373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146102d0576102d06102cb337f0000000000000000000000000000000000000000000000000000000000000000610546565b6105e8565b60008573ffffffffffffffffffffffffffffffffffffffff168386866040516102fa929190610aea565b60006040518083038185875af1925050503d8060008114610337576040519150601f19603f3d011682016040523d82523d6000602084013e61033c565b606091505b50925090508061038e5761038e6102cb308888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a92508991506105f09050565b50949350505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60603373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610427576104276102cb337f0000000000000000000000000000000000000000000000000000000000000000610546565b60008473ffffffffffffffffffffffffffffffffffffffff168484604051610450929190610aea565b600060405180830381855af49150503d806000811461048b576040519150601f19603f3d011682016040523d82523d6000602084013e610490565b606091505b5092509050806104e0576104e06102cb308787878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508992506106b4915050565b509392505050565b7fbc197c810000000000000000000000000000000000000000000000000000000098975050505050505050565b50505050565b7ff23a6e61000000000000000000000000000000000000000000000000000000009695505050505050565b6060631de45ad160e01b8383604051602401610563929190610b1b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b805160208201fd5b60607f86945816f737646db7f2d6df01602a2212e8c75829f6940913724c13a83a8178868686868660405160240161062c959493929190610b98565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905095945050505050565b60607f61e5a7320b4cf56a2980a427f39e3071c967bf2f77fffcaae20e4467e160afcc858585856040516024016106ee9493929190610b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050949350505050565b60008083601f840112610786578182fd5b50813567ffffffffffffffff81111561079d578182fd5b60208301915083602080830285010111156107b757600080fd5b9250929050565b60008083601f8401126107cf578182fd5b50813567ffffffffffffffff8111156107e6578182fd5b6020830191508360208285010111156107b757600080fd5b600080600060408486031215610812578283fd5b833561081d81610c40565b9250602084013567ffffffffffffffff811115610838578283fd5b610844868287016107be565b9497909650939450505050565b60008060008060608587031215610866578081fd5b843561087181610c40565b9350602085013567ffffffffffffffff81111561088c578182fd5b610898878288016107be565b9598909750949560400135949350505050565b60008060008060008060008060a0898b0312156108c6578384fd5b88356108d181610c40565b975060208901356108e181610c40565b9650604089013567ffffffffffffffff808211156108fd578586fd5b6109098c838d01610775565b909850965060608b0135915080821115610921578586fd5b61092d8c838d01610775565b909650945060808b0135915080821115610945578384fd5b506109528b828c016107be565b999c989b5096995094979396929594505050565b60008060008060008060a0878903121561097e578182fd5b863561098981610c40565b9550602087013561099981610c40565b94506040870135935060608701359250608087013567ffffffffffffffff8111156109c2578283fd5b6109ce89828a016107be565b979a9699509497509295939492505050565b600080600080606085870312156109f5578384fd5b8435610a0081610c40565b935060208501359250604085013567ffffffffffffffff811115610a22578283fd5b610a2e878288016107be565b95989497509550505050565b600060208284031215610a4b578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610a7a578182fd5b9392505050565b60008151808452815b81811015610aa657602081850181015186830182015201610a8a565b81811115610ab75782602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525060806040830152610b7b6080830185610a81565b8281036060840152610b8d8185610a81565b979650505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525060a06040830152610bd160a0830186610a81565b8460608401528281036080840152610be98185610a81565b98975050505050505050565b901515815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b600060208252610a7a6020830184610a81565b73ffffffffffffffffffffffffffffffffffffffff81168114610c6257600080fd5b5056fea26469706673582212206e34fed982e92340d8ca4a82cd48075fa0c4ff24ef55fd8b82e75b17f815921864736f6c634300060c0033a26469706673582212206b1cda9d010e6c8cee2b48531426ce46880b660a08510a246c459e15b354c5d264736f6c634300060c0033

Deployed Bytecode

0x6080604052600436106100c75760003560e01c80638182b61f116100745780639f1ec78b1161004e5780639f1ec78b146101cb578063ce5494bb146101e0578063f028e9be1461020d576100c7565b80638182b61f1461018557806387c96419146101985780638aa6539b146101b8576100c7565b80634d54cdb6116100a55780634d54cdb61461012c57806356ce180a146101415780636ae4b4f714610163576100c7565b8063031b905c146100cc578063287b071b146100f7578063415565b014610119575b600080fd5b3480156100d857600080fd5b506100e1610222565b6040516100ee919061288a565b60405180910390f35b34801561010357600080fd5b5061010c610246565b6040516100ee9190612511565b6100e16101273660046122df565b610373565b34801561013857600080fd5b5061010c61041c565b34801561014d57600080fd5b5061016161015c3660046121f4565b610445565b005b34801561016f57600080fd5b5061017861057c565b6040516100ee9190612774565b6100e16101933660046122df565b6105b5565b3480156101a457600080fd5b506101616101b33660046121f4565b6105c4565b6100e16101c6366004612353565b6106f0565b3480156101d757600080fd5b5061010c610716565b3480156101ec57600080fd5b506102006101fb3660046121f4565b61073f565b6040516100ee91906126cf565b34801561021957600080fd5b5061010c610a33565b7f000000000000000000000000000000000000000000000001000000040000000081565b6000803073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561028f57600080fd5b505afa1580156102a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c79190612210565b90503373ffffffffffffffffffffffffffffffffffffffff8216146102f8576102f86102f33383610a59565b610b15565b5060405161030590612033565b604051809103906000f080158015610321573d6000803e3d6000fd5b5090508061032d610b1d565b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905590565b60006104126040518061010001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020016000151581526020013373ffffffffffffffffffffffffffffffffffffffff16815250610b2a565b9695505050505050565b6000610426610b1d565b6001015473ffffffffffffffffffffffffffffffffffffffff16905090565b60003073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561048d57600080fd5b505afa1580156104a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c59190612210565b90503373ffffffffffffffffffffffffffffffffffffffff8216146104f1576104f16102f33383610a59565b50806104fb610b1d565b60020180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff929092169190911790556040517ff5550c5eea19b48ac6eb5f03abdc4f59c0a60697abb3d973cd68669703b5c8b990610571908390612511565b60405180910390a150565b6040518060400160405280600e81526020017f5472616e73666f726d455243323000000000000000000000000000000000000081525081565b60006104128686868686610373565b60003073ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561060c57600080fd5b505afa158015610620573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106449190612210565b90503373ffffffffffffffffffffffffffffffffffffffff821614610670576106706102f33383610a59565b508061067a610b1d565b60010180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff929092169190911790556040517ffd45604abad79c16e23348a137ed8292661be1b8eba6e4806ebed6833b1c046a90610571908390612511565b6000333014610705576107056102f333610d5e565b61070e82610b2a565b90505b919050565b6000610720610b1d565b6002015473ffffffffffffffffffffffffffffffffffffffff16905090565b600061076a7f4d54cdb600000000000000000000000000000000000000000000000000000000610e16565b6107937f287b071b00000000000000000000000000000000000000000000000000000000610e16565b6107bc7ff028e9be00000000000000000000000000000000000000000000000000000000610e16565b6107e57f87c9641900000000000000000000000000000000000000000000000000000000610e16565b61080e7f56ce180a00000000000000000000000000000000000000000000000000000000610e16565b6108377f9f1ec78b00000000000000000000000000000000000000000000000000000000610e16565b6108607f8182b61f00000000000000000000000000000000000000000000000000000000610e16565b6108897f8aa6539b00000000000000000000000000000000000000000000000000000000610e16565b600073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff1663f028e9be6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108e757600080fd5b505afa1580156108fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091f9190612210565b73ffffffffffffffffffffffffffffffffffffffff1614156109bd573073ffffffffffffffffffffffffffffffffffffffff1663287b071b6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561098357600080fd5b505af1158015610997573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bb9190612210565b505b816109c6610b1d565b60010180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055507f2c64c5ef00000000000000000000000000000000000000000000000000000000919050565b6000610a3d610b1d565b5473ffffffffffffffffffffffffffffffffffffffff16905090565b60607f1de45ad18e8a4484220a3ca14f4d977641addbaba5a344b1384dc2aa78a2e34d8383604051602401610a8f929190612603565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290505b92915050565b805160208201fd5b600080610b0f6004610ea9565b60008160c00151158015610b6157507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260600151145b15610b9b57610b738260200151610ec4565b15610b8357346060830152610b9b565b610b9582602001518360000151610ef6565b60608301525b610ba3612040565b610bab610a33565b73ffffffffffffffffffffffffffffffffffffffff168152610bcb61041c565b73ffffffffffffffffffffffffffffffffffffffff166020820152604083015160e0840151610bfa919061102f565b60408201528051610c0c9084906110ff565b60005b8360a0015151811015610c5357610c4b82600001518560a001518381518110610c3457fe5b602002602001015184602001518760e001516111ca565b600101610c0f565b50610c6b836040015182600001518560e001516113ec565b9150610c7f83604001518460e0015161102f565b6060820181905260408201511115610cac57610cac6102f3846040015183606001518460400151036116a6565b610cd082610ccb836040015184606001516116dc90919063ffffffff16565b6116fb565b91508260800151821015610cf457610cf46102f38460400151848660800151611711565b826000015173ffffffffffffffffffffffffffffffffffffffff167f0f6672f78a59ba8e5e5b5d38df3ebc67f3c792e2c9259b8d97d7f00dd78ba1b384602001518560400151866060015186604051610d50949392919061262a565b60405180910390a250919050565b60607ff0ec779b0bcda6d84abf99ee2c67647d1100ebbb553a9c2d1c2ba1579592832c82604051602401610d929190612511565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b6040517f6eb224cb0000000000000000000000000000000000000000000000000000000081523090636eb224cb90610e749084907f00000000000000000000000044a6999ec971cfca458aff25a808f272f6d492a2906004016126fc565b600060405180830381600087803b158015610e8e57600080fd5b505af1158015610ea2573d6000803e3d6000fd5b5050505050565b60006080826008811115610eb957fe5b600101901b92915050565b73ffffffffffffffffffffffffffffffffffffffff811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14919050565b60006110288373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e84306040518363ffffffff1660e01b8152600401610f36929190612603565b60206040518083038186803b158015610f4e57600080fd5b505afa158015610f62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f869190612430565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a0823190610fd8908790600401612511565b60206040518083038186803b158015610ff057600080fd5b505afa158015611004573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ccb9190612430565b9392505050565b600061103a83610ec4565b1561105d575073ffffffffffffffffffffffffffffffffffffffff811631610b0f565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906370a08231906110af908590600401612511565b60206040518083038186803b1580156110c757600080fd5b505afa1580156110db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110289190612430565b61110c8260200151610ec4565b801561111b5750816060015134105b15611131576111316102f33484606001516117cf565b341561117b5760405173ffffffffffffffffffffffffffffffffffffffff8216903480156108fc02916000818181858888f19350505050158015611179573d6000803e3d6000fd5b505b6111888260200151610ec4565b6111c6578160c00151156111ae576111a98260200151828460600151611805565b6111c6565b6111c6826020015183600001518385606001516118df565b5050565b60006111da8385600001516119de565b905060608573ffffffffffffffffffffffffffffffffffffffff1663b68df16d8363832b24bb60e01b60405180606001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018a6020015181525060405160240161125e9190612841565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009485161790525160e085901b90921682526112ef9291600401612532565b600060405180830381600087803b15801561130957600080fd5b505af115801561131d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611363919081019061226c565b9050805160201415806113cd575080517f13c9929e00000000000000000000000000000000000000000000000000000000906113a8908301602090810190840161222c565b7fffffffff000000000000000000000000000000000000000000000000000000001614155b156113e4576113e46102f383876020015184611a4d565b505050505050565b60006113f8848461102f565b905061140384610ec4565b156114d6576040517f54132d7800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906354132d789061145c90859085906004016125a8565b600060405180830381600087803b15801561147657600080fd5b505af115801561148a573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526114d0919081019061226c565b50611028565b60608373ffffffffffffffffffffffffffffffffffffffff166354132d788663a9059cbb60e01b86866040516024016115109291906125dd565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009485161790525160e085901b90921682526115a49291600090600401612569565b600060405180830381600087803b1580156115be57600080fd5b505af11580156115d2573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611618919081019061226c565b905080516000141561166c57843b80611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d90612787565b60405180910390fd5b5061169e565b6020815110611695576000611682826000611a85565b9050806001146116665761166682610b15565b61169e81610b15565b509392505050565b60607f3ea25a3cae94e681748e39876b75ce362a9159c4618787bc1250e3d9f9c439108383604051602401610a8f9291906125dd565b6000828211156116f5576116f56102f360028585611a91565b50900390565b600081831061170a5781611028565b5090919050565b60607f990174d2378c7614a3e4722867cea0a803c0cc16ef92c4f5466ed5bc1d3496da848484604051602401611749939291906126a1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b60607f96660ab143a5c6a946233c268494b1026bfca53373c9715e0fe96b3c59c850448383604051602401610a8f929190612893565b73ffffffffffffffffffffffffffffffffffffffff8316301415611855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d906127e4565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152816024820152602081604483600073ffffffffffffffffffffffffffffffffffffffff89165af13d600183511460208210151681151782169150816113e457806000843e8083fd5b73ffffffffffffffffffffffffffffffffffffffff841630141561192f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d906127e4565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015273ffffffffffffffffffffffffffffffffffffffff83166024820152816044820152602081606483600073ffffffffffffffffffffffffffffffffffffffff8a165af13d600183511460208210151681151782169150816119d557806000843e8083fd5b50505050505050565b600060606119eb83611ab0565b9050805160d50160f81b609460f81b8583604051602001611a0f9493929190612492565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120949350505050565b60607ff21e5cb42b911ca6b3898f8618760aa7d84fe5d43a7a5ad89aa791c66cafe41384848460405160240161174993929190612660565b60006110288383611fea565b606063e946c1bb60e01b84848460405160240161174993929190612744565b606063ffffffff8216611b225760408051600180825281830190925290602082018180368337019050509050608060f81b81600081518110611aee57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610711565b60808263ffffffff161015611b6157604080516001808252818301909252906020820181803683370190505090508160f81b81600081518110611aee57fe5b60ff8263ffffffff1611611be05760408051600280825281830190925290602082018180368337019050509050608160f81b81600081518110611ba057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508160f81b81600181518110611aee57fe5b61ffff8263ffffffff1611611cc65760408051600380825281830190925290602082018180368337019050509050608260f81b81600081518110611c2057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060f084901b169082906001908110611c8657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508160f81b81600281518110611aee57fe5b62ffffff8263ffffffff1611611e135760408051600480825281830190925290602082018180368337019050509050608360f81b81600081518110611d0757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060e884901b169082906001908110611d6d57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060f084901b169082906002908110611dd357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508160f81b81600381518110611aee57fe5b60408051600580825281830190925290602082018180368337019050509050608460f81b81600081518110611e4457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060e084901b169082906001908110611eaa57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060e884901b169082906002908110611f1057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080517fff0000000000000000000000000000000000000000000000000000000000000060f084901b169082906003908110611f7657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508160f81b81600481518110611fb657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350919050565b6000816020018351101561200b5761200b6102f36005855185602001612014565b50016020015190565b6060632800659560e01b84848460405160240161174993929190612766565b610ce08061296083390190565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b8035610b0f8161293a565b600082601f8301126120af578081fd5b813567ffffffffffffffff808211156120c6578283fd5b60206120d581828502016128a1565b838152935080840185820160005b8581101561217157813588016040807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838d0301121561212257600080fd5b61212b816128a1565b6121378c8885016121e0565b815290820135908782111561214b57600080fd5b6121598c888486010161218d565b818801528552505091830191908301906001016120e3565b50505050505092915050565b80358015158114610b0f57600080fd5b600082601f83011261219d578081fd5b81356121b06121ab826128c8565b6128a1565b91508082528360208285010111156121c757600080fd5b8060208401602084013760009082016020015292915050565b803563ffffffff81168114610b0f57600080fd5b600060208284031215612205578081fd5b81356110288161293a565b600060208284031215612221578081fd5b81516110288161293a565b60006020828403121561223d578081fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114611028578182fd5b60006020828403121561227d578081fd5b815167ffffffffffffffff811115612293578182fd5b8201601f810184136122a3578182fd5b80516122b16121ab826128c8565b8181528560208385010111156122c5578384fd5b6122d682602083016020860161290a565b95945050505050565b600080600080600060a086880312156122f6578081fd5b85356123018161293a565b945060208601356123118161293a565b93506040860135925060608601359150608086013567ffffffffffffffff81111561233a578182fd5b6123468882890161209f565b9150509295509295909350565b600060208284031215612364578081fd5b813567ffffffffffffffff8082111561237b578283fd5b8184019150610100808387031215612391578384fd5b61239a816128a1565b90506123a68684612094565b81526123b58660208501612094565b60208201526123c78660408501612094565b6040820152606083013560608201526080830135608082015260a0830135828111156123f1578485fd5b6123fd8782860161209f565b60a0830152506124108660c0850161217d565b60c08201526124228660e08501612094565b60e082015295945050505050565b600060208284031215612441578081fd5b5051919050565b6000815180845261246081602086016020860161290a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60007fff0000000000000000000000000000000000000000000000000000000000000080871683528086166001840152507fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008460601b166002830152825161250181601685016020870161290a565b9190910160160195945050505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff84168252604060208301526125616040830184612448565b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff85168252606060208301526125986060830185612448565b9050826040830152949350505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252606060208301819052600090830152604082015260800190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff94851681529290931660208301526040820152606081019190915260800190565b600073ffffffffffffffffffffffffffffffffffffffff851682526060602083015261268f6060830185612448565b82810360408401526104128185612448565b73ffffffffffffffffffffffffffffffffffffffff9390931683526020830191909152604082015260600190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b606081016004851061275257fe5b938152602081019290925260409091015290565b606081016008851061275257fe5b6000602082526110286020830184612448565b60208082526027908201527f696e76616c696420746f6b656e20616464726573732c20636f6e7461696e732060408201527f6e6f20636f646500000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f466978696e546f6b656e5370656e6465722f43414e4e4f545f494e564f4b455f60408201527f53454c4600000000000000000000000000000000000000000000000000000000606082015260800190565b60006020825273ffffffffffffffffffffffffffffffffffffffff8084511660208401528060208501511660408401525060408301516060808401526125616080840182612448565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156128c057600080fd5b604052919050565b600067ffffffffffffffff8211156128de578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b8381101561292557818101518382015260200161290d565b83811115612934576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461295c57600080fd5b5056fe60a060405234801561001057600080fd5b5033606081901b608052610c9b6100456000398061027952806102a7528061039952806103d552806104035250610c9b6000f3fe6080604052600436106100745760003560e01c8063b68df16d1161004e578063b68df16d146100f8578063bc197c811461010b578063c0ee0b8a14610138578063f23a6e611461015a5761007b565b806301ffc9a71461008057806354132d78146100b65780638da5cb5b146100d65761007b565b3661007b57005b600080fd5b34801561008c57600080fd5b506100a061009b366004610a3a565b61017a565b6040516100ad9190610bf5565b60405180910390f35b6100c96100c4366004610851565b61025f565b6040516100ad9190610c2d565b3480156100e257600080fd5b506100eb610397565b6040516100ad9190610afa565b6100c96101063660046107fe565b6103bb565b34801561011757600080fd5b5061012b6101263660046108ab565b6104e8565b6040516100ad9190610c00565b34801561014457600080fd5b506101586101533660046109e0565b610515565b005b34801561016657600080fd5b5061012b610175366004610966565b61051b565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061020d57507fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e000000000000000000000000000000000000000000000000000000000145b8061025957507fffffffff0000000000000000000000000000000000000000000000000000000082167fc0ee0b8a00000000000000000000000000000000000000000000000000000000145b92915050565b60603373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146102d0576102d06102cb337f0000000000000000000000000000000000000000000000000000000000000000610546565b6105e8565b60008573ffffffffffffffffffffffffffffffffffffffff168386866040516102fa929190610aea565b60006040518083038185875af1925050503d8060008114610337576040519150601f19603f3d011682016040523d82523d6000602084013e61033c565b606091505b50925090508061038e5761038e6102cb308888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a92508991506105f09050565b50949350505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60603373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610427576104276102cb337f0000000000000000000000000000000000000000000000000000000000000000610546565b60008473ffffffffffffffffffffffffffffffffffffffff168484604051610450929190610aea565b600060405180830381855af49150503d806000811461048b576040519150601f19603f3d011682016040523d82523d6000602084013e610490565b606091505b5092509050806104e0576104e06102cb308787878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508992506106b4915050565b509392505050565b7fbc197c810000000000000000000000000000000000000000000000000000000098975050505050505050565b50505050565b7ff23a6e61000000000000000000000000000000000000000000000000000000009695505050505050565b6060631de45ad160e01b8383604051602401610563929190610b1b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b805160208201fd5b60607f86945816f737646db7f2d6df01602a2212e8c75829f6940913724c13a83a8178868686868660405160240161062c959493929190610b98565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905095945050505050565b60607f61e5a7320b4cf56a2980a427f39e3071c967bf2f77fffcaae20e4467e160afcc858585856040516024016106ee9493929190610b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050949350505050565b60008083601f840112610786578182fd5b50813567ffffffffffffffff81111561079d578182fd5b60208301915083602080830285010111156107b757600080fd5b9250929050565b60008083601f8401126107cf578182fd5b50813567ffffffffffffffff8111156107e6578182fd5b6020830191508360208285010111156107b757600080fd5b600080600060408486031215610812578283fd5b833561081d81610c40565b9250602084013567ffffffffffffffff811115610838578283fd5b610844868287016107be565b9497909650939450505050565b60008060008060608587031215610866578081fd5b843561087181610c40565b9350602085013567ffffffffffffffff81111561088c578182fd5b610898878288016107be565b9598909750949560400135949350505050565b60008060008060008060008060a0898b0312156108c6578384fd5b88356108d181610c40565b975060208901356108e181610c40565b9650604089013567ffffffffffffffff808211156108fd578586fd5b6109098c838d01610775565b909850965060608b0135915080821115610921578586fd5b61092d8c838d01610775565b909650945060808b0135915080821115610945578384fd5b506109528b828c016107be565b999c989b5096995094979396929594505050565b60008060008060008060a0878903121561097e578182fd5b863561098981610c40565b9550602087013561099981610c40565b94506040870135935060608701359250608087013567ffffffffffffffff8111156109c2578283fd5b6109ce89828a016107be565b979a9699509497509295939492505050565b600080600080606085870312156109f5578384fd5b8435610a0081610c40565b935060208501359250604085013567ffffffffffffffff811115610a22578283fd5b610a2e878288016107be565b95989497509550505050565b600060208284031215610a4b578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610a7a578182fd5b9392505050565b60008151808452815b81811015610aa657602081850181015186830182015201610a8a565b81811115610ab75782602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525060806040830152610b7b6080830185610a81565b8281036060840152610b8d8185610a81565b979650505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525060a06040830152610bd160a0830186610a81565b8460608401528281036080840152610be98185610a81565b98975050505050505050565b901515815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b600060208252610a7a6020830184610a81565b73ffffffffffffffffffffffffffffffffffffffff81168114610c6257600080fd5b5056fea26469706673582212206e34fed982e92340d8ca4a82cd48075fa0c4ff24ef55fd8b82e75b17f815921864736f6c634300060c0033a26469706673582212206b1cda9d010e6c8cee2b48531426ce46880b660a08510a246c459e15b354c5d264736f6c634300060c0033

Deployed Bytecode Sourcemap

1566:16744:6:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2176:75;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;5226:231;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;8256:779::-;;;;;;:::i;:::-;;:::i;4481:199::-;;;;;;;;;;;;;:::i;4132:227::-;;;;;;;;;;-1:-1:-1;4132:227:6;;;;;:::i;:::-;;:::i;:::-;;2069:63;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;6734:502::-;;;;;;:::i;:::-;;:::i;3669:275::-;;;;;;;;;;-1:-1:-1;3669:275:6;;;;;:::i;:::-;;:::i;9257:238::-;;;;;;:::i;:::-;;:::i;4802:181::-;;;;;;;;;;;;;:::i;2502:971::-;;;;;;;;;;-1:-1:-1;2502:971:6;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;13140:185::-;;;;;;;;;;;;;:::i;2176:75::-;;;:::o;5226:231::-;5326:19;1527:13:11;1567:4;1543:36;;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1527:54;-1:-1:-1;1599:10:11;:19;;;;1595:180;;1638:122;:112;1695:10;1727:5;1638:35;:112::i;:::-;:120;:122::i;:::-;5226:231:6;5370:17:::1;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;5361:26;;5444:6;5397:37;:35;:37::i;:::-;:53:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;5226:231;:::o;8256:779::-;8543:25;8591:437;8627:391;;;;;;;;8671:10;8627:391;;;;;;8711:10;8627:391;;;;;;8752:11;8627:391;;;;;;8799:16;8627:391;;;;8855:20;8627:391;;;;8910:15;8627:391;;;;8959:5;8627:391;;;;;;8993:10;8627:391;;;;;8591:22;:437::i;:::-;8584:444;8256:779;-1:-1:-1;;;;;;8256:779:6:o;4481:199::-;4577:16;4616:37;:35;:37::i;:::-;:57;;;;;;-1:-1:-1;4481:199:6;:::o;4132:227::-;1527:13:11;1567:4;1543:36;;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1527:54;-1:-1:-1;1599:10:11;:19;;;;1595:180;;1638:122;:112;1695:10;1727:5;1638:35;:112::i;:122::-;4132:227:6;4295:11:::1;4243:37;:35;:37::i;:::-;:49;;:63:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;4321:31:::1;::::0;::::1;::::0;::::1;::::0;4340:11;;4321:31:::1;:::i;:::-;;;;;;;;4132:227:::0;:::o;2069:63::-;;;;;;;;;;;;;;;;;;;:::o;6734:502::-;7011:25;7059:170;7087:10;7112:11;7138:16;7169:20;7204:15;7059:14;:170::i;3669:275::-;1527:13:11;1567:4;1543:36;;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1527:54;-1:-1:-1;1599:10:11;:19;;;;1595:180;;1638:122;:112;1695:10;1727:5;1638:35;:112::i;:122::-;3669:275:6;3856:19:::1;3796:37;:35;:37::i;:::-;:57;;:79:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;3890:47:::1;::::0;::::1;::::0;::::1;::::0;3917:19;;3890:47:::1;:::i;9257:238::-:0;9412:25;1272:10:11;1294:4;1272:27;1268:123;;1315:65;:55;1359:10;1315:43;:55::i;:65::-;9460:28:6::1;9483:4;9460:22;:28::i;:::-;9453:35;;1400:1:11;9257:238:6::0;;;:::o;4802:181::-;4890:14;4927:37;:35;:37::i;:::-;:49;;;;;;-1:-1:-1;4802:181:6;:::o;2502:971::-;2582:14;2612:62;2637:36;2612:24;:62::i;:::-;2684:61;2709:35;2684:24;:61::i;:::-;2755:58;2780:32;2755:24;:58::i;:::-;2823:62;2848:36;2823:24;:62::i;:::-;2895:54;2920:28;2895:24;:54::i;:::-;2959;2984:28;2959:24;:54::i;:::-;3023:61;3048:35;3023:24;:61::i;:::-;3094:55;3119:29;3094:24;:55::i;:::-;3213:1;3163:53;;:4;:23;;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:53;;;3159:176;;;3296:4;:26;;;:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;3159:176;3404:19;3344:37;:35;:37::i;:::-;:57;;:79;;;;;;;;;;;;;;;-1:-1:-1;3440:26:6;;2502:971;-1:-1:-1;2502:971:6:o;13140:185::-;13232:19;13274:37;:35;:37::i;:::-;:44;;;;-1:-1:-1;13140:185:6;:::o;725:303:1:-;849:12;927:44;986:6;1006:5;884:137;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;725:303:1;;;;;:::o;1531:170:25:-;1674:9;1668:16;1661:4;1650:9;1646:20;1639:46;1218:475:15;1263:20;1295:19;1317:84;1356:35;1317:25;:84::i;9689:3278:6:-;9786:25;9962:4;:19;;;9961:20;:60;;;;;10018:2;9985:4;:21;;;:36;9961:60;9957:536;;;10041:47;10072:4;:15;;;10041:30;:47::i;:::-;10037:446;;;10282:9;10258:21;;;:33;10037:446;;;10354:114;10403:4;:15;;;10440:4;:10;;;10354:27;:114::i;:::-;10330:21;;;:138;10037:446;10503:39;;:::i;:::-;10567:20;:18;:20::i;:::-;10552:35;;;;10625:24;:22;:24::i;:::-;10597:52;;:25;;;:52;10823:16;;;;10841:14;;;;10785:71;;10823:16;10785:37;:71::i;:::-;10731:39;;;:125;11001:12;;10952:63;;10987:4;;10952:34;:63::i;:::-;11085:9;11080:293;11104:4;:20;;;:27;11100:1;:31;11080:293;;;11156:202;11200:5;:12;;;11234:4;:20;;;11255:1;11234:23;;;;;;;;;;;;;;11279:5;:25;;;11326:4;:14;;;11156:22;:202::i;:::-;11133:3;;11080:293;;;;11469:139;11514:4;:16;;;11549:5;:12;;;11580:4;:14;;;11469:27;:139::i;:::-;11449:159;;11762:71;11800:4;:16;;;11818:4;:14;;;11762:37;:71::i;:::-;11709:38;;;:124;;;11888:39;;;;-1:-1:-1;11843:337:6;;;11943:226;:216;12030:4;:16;;;12107:5;:38;;;12065:5;:39;;;:80;11943:61;:216::i;:226::-;12209:163;12244:17;12275:87;12322:5;:39;;;12275:5;:38;;;:46;;:87;;;;:::i;:::-;12209:21;:163::i;:::-;12189:183;;12472:4;:25;;;12452:17;:45;12448:278;;;12513:202;:192;12596:4;:16;;;12631:17;12666:4;:25;;;12513:57;:192::i;:202::-;12797:4;:10;;;12767:193;;;12829:4;:15;;;12867:4;:16;;;12898:4;:21;;;12933:17;12767:193;;;;;;;;;:::i;:::-;;;;;;;;9689:3278;;;;:::o;724:257:0:-;820:12;898:45;958:6;855:119;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;724:257:0;;;:::o;2201:168:11:-;2283:79;;;;;2322:4;;2283:52;;:79;;2336:8;;2346:15;;2283:79;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2201:168;:::o;1625:335:14:-;1717:12;922:3;1918:9;1910:18;;;;;;;;1931:1;1910:22;1909:44;;;1625:335;-1:-1:-1;;1625:335:14:o;2012:164:17:-;2134:35;;;984:42;2134:35;2012:164;;;:::o;5137:298:12:-;5280:7;5310:118;5345:5;:15;;;5361:5;5376:4;5345:37;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;5396:22;;;;;:15;;;;;;:22;;5412:5;;5396:22;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;5310:118::-;5303:125;5137:298;-1:-1:-1;;;5137:298:12:o;2420:260:17:-;2531:20;2571:17;2582:5;2571:10;:17::i;:::-;2567:68;;;-1:-1:-1;2611:13:17;;;;2604:20;;2567:68;2651:22;;;;;:15;;;;;;:22;;2667:5;;2651:22;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;13497:1279:6:-;13662:47;13693:4;:15;;;13662:30;:47::i;:::-;:96;;;;;13737:4;:21;;;13725:9;:33;13662:96;13645:375;;;13863:146;:136;13937:9;13964:4;:21;;;13863:56;:136::i;:146::-;14072:9;:14;14068:67;;14102:22;;:11;;;;14114:9;14102:22;;;;;;;;;14114:9;14102:11;:22;;;;;;;;;;;;;;;;;;;;;14068:67;14184:47;14215:4;:15;;;14184:30;:47::i;:::-;14179:591;;14251:4;:19;;;14247:513;;;14337:142;14379:4;:15;;;14416:2;14440:4;:21;;;14337:20;:142::i;:::-;14247:513;;;14567:178;14613:4;:15;;;14650:4;:10;;;14682:2;14706:4;:21;;;14567:24;:178::i;:::-;13497:1279;;:::o;15062:1354::-;15346:27;15376:125;15428:19;15461:14;:30;;;15376:38;:125::i;:::-;15346:155;;15568:23;15594:6;:26;;;15666:11;15757:36;;;15811:183;;;;;;;;15876:10;15811:183;;;;;;15919:9;15811:183;;;;;;15956:14;:19;;;15811:183;;;15717:291;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;15594:424;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;15568:450;;16092:10;:17;16113:2;16092:23;;:114;;;-1:-1:-1;16131:32:6;;16167:39;;16131:32;;;;;;;;;;;;:::i;:::-;:75;;;;16092:114;16088:322;;;16231:168;:158;16299:11;16328:14;:19;;;16365:10;16231:50;:158::i;:168::-;15062:1354;;;;;;:::o;16422:1886::-;16598:22;16665:67;16703:11;16724:6;16665:37;:67::i;:::-;16636:96;;16746:43;16777:11;16746:30;:43::i;:::-;16742:1560;;;16805:111;;;;;:18;;;;;;:111;;16841:9;;16888:14;;16805:111;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;16742:1560;;;16947:23;16973:6;:18;;;17025:11;17100:32;;;17154:9;17185:14;17056:161;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;16973:277;;;;;;;;;;;;;-1:-1:-1;;16973:277:6;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;16947:303;;17268:10;:17;17289:1;17268:22;17264:1028;;;17530:24;;17581:8;17573:60;;;;;;;;;;;;:::i;:::-;;;;;;;;;17264:1028;;;;17679:2;17658:10;:17;:23;17654:638;;17921:14;17938:38;17962:10;17974:1;17938:23;:38::i;:::-;17921:55;;17998:6;18008:1;17998:11;17994:94;;18033:36;18058:10;18033:24;:36::i;17654:638::-;18241:36;18266:10;18241:24;:36::i;:::-;16742:1560;16422:1886;;;;;:::o;1573:383:2:-;1737:12;1815:63;1893:11;1918:21;1772:177;;;;;;;;;:::i;1625:373:22:-;1711:7;1742:1;1738;:5;1734:236;;;1759:200;1784:174;1844:62;1924:1;1943;1784:42;:174::i;1759:200::-;-1:-1:-1;1986:5:22;;;1625:373::o;2544:135::-;2629:7;2663:1;2659;:5;:13;;2671:1;2659:13;;;-1:-1:-1;2667:1:22;;2544:135;-1:-1:-1;2544:135:22:o;1120:447:2:-;1314:12;1392:67;1474:11;1499:17;1530:20;1349:211;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1120:447:2;;;;;:::o;765:349::-;912:12;990:58;1063:11;1088:9;947:160;;;;;;;;;:::i;3238:1617:12:-;3387:31;;;3413:4;3387:31;;3379:80;;;;;;;;;;;;:::i;:::-;3510:4;3504:11;3618:66;3613:3;3606:79;3729:12;3725:2;3721:21;3714:4;3709:3;3705:14;3698:45;3779:6;3772:4;3767:3;3763:14;3756:30;3985:2;3964:3;3942:4;3921:3;3902:1;3871:12;3864:5;3860:24;3837:5;3815:186;4029:16;4615:1;4609:3;4603:10;4600:17;4544:2;4536:6;4533:14;4526:22;4497:179;4429:6;4422:14;4398:296;4320:7;4299:409;4288:420;;4732:7;4722:2;;4782:6;4779:1;4774:3;4759:30;4818:6;4813:3;4806:19;1310:1717;1486:31;;;1512:4;1486:31;;1478:80;;;;;;;;;;;;:::i;:::-;1609:4;1603:11;1729:66;1724:3;1717:79;1843:12;1836:5;1832:24;1825:4;1820:3;1816:14;1809:48;1901:12;1897:2;1893:21;1886:4;1881:3;1877:14;1870:45;1951:6;1944:4;1939:3;1935:14;1928:30;2157:2;2136:3;2114:4;2093:3;2074:1;2043:12;2036:5;2032:24;2009:5;1987:186;2201:16;2787:1;2781:3;2775:10;2772:17;2716:2;2708:6;2705:14;2698:22;2669:179;2601:6;2594:14;2570:296;2492:7;2471:409;2460:420;;2904:7;2894:2;;2954:6;2951:1;2946:3;2931:30;2990:6;2985:3;2978:19;2894:2;;;;1578:1443;;;;:::o;4597:717:17:-;4714:33;5037:21;5061:31;5076:15;5061:14;:31::i;:::-;5037:55;;5196:8;:15;5184:9;:27;5173:40;;5238:9;5227:22;;5263:8;5285;5143:160;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;5133:171;;5143:160;5133:171;;;;;4597:717;-1:-1:-1;;;;4597:717:17:o;1962:415:2:-;2147:12;2225:56;2296:11;2321:15;2350:10;2182:188;;;;;;;;;;:::i;16122:220:21:-;16243:14;16290:21;16302:1;16305:5;16290:11;:21::i;1401:322:26:-;1554:12;818:10;1625:28;;1667:9;1690:1;1705;1589:127;;;;;;;;;;:::i;2857:1397:17:-;2942:21;3064:10;;;3060:1188;;3101:12;;;3111:1;3101:12;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3101:12:17;3090:23;;3141:4;3127:18;;:8;3136:1;3127:11;;;;;;;;;;;:18;;;;;;;;;;;3060:1188;;;3174:4;3166:5;:12;;;3162:1086;;;3205:12;;;3215:1;3205:12;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3205:12:17;3194:23;;3256:5;3245:18;;3231:8;3240:1;3231:11;;;;;;;3162:1086;3293:4;3284:5;:13;;;3280:968;;3324:12;;;3334:1;3324:12;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3324:12:17;3313:23;;3364:4;3350:18;;:8;3359:1;3350:11;;;;;;;;;;;:18;;;;;;;;;;;3407:5;3396:18;;3382:8;3391:1;3382:11;;;;;;;3280:968;3444:6;3435:5;:15;;;3431:817;;3477:12;;;3487:1;3477:12;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3477:12:17;3466:23;;3517:4;3503:18;;:8;3512:1;3503:11;;;;;;;;;;;:18;;;;;;;;;;-1:-1:-1;3535:11:17;;3549:34;;;;;;;3535:8;;3544:1;;3535:11;;;;;;;;;:48;;;;;;;;;;;3622:5;3611:18;;3597:8;3606:1;3597:11;;;;;;;3431:817;3659:8;3650:5;:17;;;3646:602;;3694:12;;;3704:1;3694:12;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3694:12:17;3683:23;;3734:4;3720:18;;:8;3729:1;3720:11;;;;;;;;;;;:18;;;;;;;;;;-1:-1:-1;3752:11:17;;3766:37;;;;;;;3752:8;;3761:1;;3752:11;;;;;;;;;:51;;;;;;;;;;-1:-1:-1;3817:11:17;;3831:34;;;;;;;3817:8;;3826:1;;3817:11;;;;;;;;;:48;;;;;;;;;;;3904:5;3893:18;;3879:8;3888:1;3879:11;;;;;;;3646:602;3953:12;;;3963:1;3953:12;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3953:12:17;3942:23;;3993:4;3979:18;;:8;3988:1;3979:11;;;;;;;;;;;:18;;;;;;;;;;-1:-1:-1;4011:11:17;;4025:39;;;;;;;4011:8;;4020:1;;4011:11;;;;;;;;;:53;;;;;;;;;;-1:-1:-1;4078:11:17;;4092:37;;;;;;;4078:8;;4087:1;;4078:11;;;;;;;;;:51;;;;;;;;;;-1:-1:-1;4143:11:17;;4157:34;;;;;;;4143:8;;4152:1;;4143:11;;;;;;;;;:48;;;;;;;;;;;4230:5;4219:18;;4205:8;4214:1;4205:11;;;;;;;;;;;:32;;;;;;;;;;;2857:1397;;;:::o;14301:688:21:-;14422:14;14467:5;14475:2;14467:10;14456:1;:8;:21;14452:306;;;14493:254;14518:228;14583:95;14696:1;:8;14722:5;14730:2;14722:10;14518:47;:228::i;14493:254::-;-1:-1:-1;14936:13:21;14838:2;14936:13;14930:20;;14301:688::o;1334:378:23:-;1522:12;1274:10;1593:37;;1644:9;1667:6;1687:8;1557:148;;;;;;;;;;:::i;-1:-1:-1:-;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;283:146::-;358:20;;383:41;358:20;383:41;:::i;491:774::-;;640:3;633:4;625:6;621:17;617:27;607:2;;-1:-1;;648:12;607:2;695:6;682:20;23450:18;;23442:6;23439:30;23436:2;;;-1:-1;;23472:12;23436:2;23517:4;717:112;23517:4;;23509:6;23505:17;23570:15;717:112;:::i;:::-;857:21;;;708:121;-1:-1;914:14;;;889:17;;;1009:1;994:265;1019:6;1016:1;1013:13;994:265;;;1102:3;1089:17;893:6;1077:30;4661:4;;4640:19;1077:30;4644:3;4640:19;;4636:30;4633:2;;;1009:1;;4669:12;4633:2;4697:20;4661:4;4697:20;:::i;:::-;4810:48;4854:3;23517:4;1077:30;;4810:48;:::i;:::-;4785:74;;4933:18;;;4920:32;;4961:30;;;4958:2;;;1009:1;;4994:12;4958:2;5039:58;5093:3;23517:4;5084:6;1077:30;5069:22;;5039:58;:::i;:::-;5021:16;;;5014:84;1114:82;;-1:-1;;1210:14;;;;1238;;;;1041:1;1034:9;994:265;;;998:14;;;;;;600:665;;;;:::o;1273:124::-;1337:20;;25114:13;;25107:21;28584:32;;28574:2;;28630:1;;28620:12;1544:440;;1645:3;1638:4;1630:6;1626:17;1622:27;1612:2;;-1:-1;;1653:12;1612:2;1700:6;1687:20;1722:64;1737:48;1778:6;1737:48;:::i;:::-;1722:64;:::i;:::-;1713:73;;1806:6;1799:5;1792:21;1910:3;1842:4;1901:6;1834;1892:16;;1889:25;1886:2;;;1927:1;;1917:12;1886:2;27179:6;1842:4;1834:6;1830:17;1842:4;1868:5;1864:16;27156:30;27235:1;27217:16;;;1842:4;27217:16;27210:27;1868:5;1605:379;-1:-1;;1605:379::o;5404:128::-;5470:20;;26304:10;26293:22;;29284:34;;29274:2;;29332:1;;29322:12;5539:241;;5643:2;5631:9;5622:7;5618:23;5614:32;5611:2;;;-1:-1;;5649:12;5611:2;85:6;72:20;97:33;124:5;97:33;:::i;5787:263::-;;5902:2;5890:9;5881:7;5877:23;5873:32;5870:2;;;-1:-1;;5908:12;5870:2;226:6;220:13;238:33;265:5;238:33;:::i;6057:261::-;;6171:2;6159:9;6150:7;6146:23;6142:32;6139:2;;;-1:-1;;6177:12;6139:2;1487:6;1481:13;25363:66;28731:5;25352:78;28707:5;28704:34;28694:2;;-1:-1;;28742:12;6325:360;;6449:2;6437:9;6428:7;6424:23;6420:32;6417:2;;;-1:-1;;6455:12;6417:2;6506:17;6500:24;6544:18;6536:6;6533:30;6530:2;;;-1:-1;;6566:12;6530:2;6637:22;;2098:4;2086:17;;2082:27;-1:-1;2072:2;;-1:-1;;2113:12;2072:2;2153:6;2147:13;2175:64;2190:48;2231:6;2190:48;:::i;2175:64::-;2259:6;2252:5;2245:21;2363:3;6449:2;2354:6;2287;2345:16;;2342:25;2339:2;;;-1:-1;;2370:12;2339:2;2390:39;2422:6;6449:2;2321:5;2317:16;6449:2;2287:6;2283:17;2390:39;:::i;:::-;6586:83;6411:274;-1:-1;;;;;6411:274::o;6692:1035::-;;;;;;6967:3;6955:9;6946:7;6942:23;6938:33;6935:2;;;-1:-1;;6974:12;6935:2;2546:6;2533:20;2558:56;2608:5;2558:56;:::i;:::-;7026:86;-1:-1;7149:2;7211:22;;2533:20;2558:56;2533:20;2558:56;:::i;:::-;7157:86;-1:-1;7280:2;7319:22;;5193:20;;-1:-1;7388:2;7427:22;;5193:20;;-1:-1;7524:3;7509:19;;7496:33;7549:18;7538:30;;7535:2;;;-1:-1;;7571:12;7535:2;7601:110;7703:7;7694:6;7683:9;7679:22;7601:110;:::i;:::-;7591:120;;;6929:798;;;;;;;;:::o;8044:399::-;;8184:2;8172:9;8163:7;8159:23;8155:32;8152:2;;;-1:-1;;8190:12;8152:2;8248:17;8235:31;8286:18;;8278:6;8275:30;8272:2;;;-1:-1;;8308:12;8272:2;8410:6;8399:9;8395:22;;;2987:6;;2975:9;2970:3;2966:19;2962:32;2959:2;;;-1:-1;;2997:12;2959:2;3025:22;2987:6;3025:22;:::i;:::-;3016:31;;3130:57;3183:3;3159:22;3130:57;:::i;:::-;3112:16;3105:83;3288:72;3356:3;8184:2;3336:9;3332:22;3288:72;:::i;:::-;8184:2;3274:5;3270:16;3263:98;3462:72;3530:3;3429:2;3510:9;3506:22;3462:72;:::i;:::-;3429:2;3448:5;3444:16;3437:98;3608:2;3666:9;3662:22;5193:20;3608:2;3627:5;3623:16;3616:75;3768:3;3827:9;3823:22;5193:20;3768:3;3788:5;3784:16;3777:75;3952:3;3941:9;3937:19;3924:33;8286:18;3969:6;3966:30;3963:2;;;-1:-1;;3999:12;3963:2;4044:106;4146:3;4137:6;4126:9;4122:22;4044:106;:::i;:::-;3952:3;4030:5;4026:16;4019:132;;4256:46;4298:3;4222;4278:9;4274:22;4256:46;:::i;:::-;4222:3;4242:5;4238:16;4231:72;4403:57;4456:3;4369;4436:9;4432:22;4403:57;:::i;:::-;4369:3;4385:16;;4378:83;4389:5;8146:297;-1:-1;;;;;8146:297::o;8450:263::-;;8565:2;8553:9;8544:7;8540:23;8536:32;8533:2;;;-1:-1;;8571:12;8533:2;-1:-1;5341:13;;8527:186;-1:-1;8527:186::o;9549:323::-;;9681:5;24017:12;24292:6;24287:3;24280:19;9764:52;9809:6;24329:4;24324:3;24320:14;24329:4;9790:5;9786:16;9764:52;:::i;:::-;27894:2;27874:14;27890:7;27870:28;9828:39;;;;24329:4;9828:39;;9629:243;-1:-1;;9629:243::o;13688:678::-;;25212:66;;9412:5;25201:78;9371:3;9364:56;25212:66;9412:5;25201:78;14009:1;14004:3;14000:11;9364:56;;27981:14;24924:5;27985:2;27981:14;;14108:11;14004:3;14108:11;9207:58;10389:5;24017:12;10500:52;10545:6;14218:12;14004:3;14218:12;10533:4;10526:5;10522:16;10500:52;:::i;:::-;10564:16;;;;14218:12;10564:16;;13902:464;-1:-1;;;;;13902:464::o;14373:222::-;26098:42;26087:54;;;;8797:45;;14500:2;14485:18;;14471:124::o;14602:449::-;;26098:42;24924:5;26087:54;8804:3;8797:45;14791:2;14925;14914:9;14910:18;14903:48;14965:76;14791:2;14780:9;14776:18;15027:6;14965:76;:::i;:::-;14957:84;14762:289;-1:-1;;;;14762:289::o;15058:576::-;;26098:42;24924:5;26087:54;8804:3;8797:45;15283:2;15417;15406:9;15402:18;15395:48;15457:76;15283:2;15272:9;15268:18;15519:6;15457:76;:::i;:::-;15449:84;;27061:24;15620:2;15609:9;15605:18;11228:58;15254:380;;;;;;:::o;15641:668::-;26098:42;26087:54;;;;8797:45;;15912:2;16046;16031:18;;16024:48;;;15641:668;15897:18;;;24280:19;16295:2;16280:18;;13639:37;24320:14;;;15883:426::o;16316:365::-;26098:42;26087:54;;;;8797:45;;16667:2;16652:18;;13639:37;16487:2;16472:18;;16458:223::o;16688:333::-;26098:42;26087:54;;;8797:45;;26087:54;;17007:2;16992:18;;8797:45;16843:2;16828:18;;16814:207::o;17028:556::-;26098:42;26087:54;;;8797:45;;26087:54;;;;17404:2;17389:18;;8797:45;17487:2;17472:18;;13639:37;17570:2;17555:18;;13639:37;;;;17239:3;17224:19;;17210:374::o;17591:612::-;;26098:42;8835:5;26087:54;8804:3;8797:45;17810:2;17928;17917:9;17913:18;17906:48;17968:76;17810:2;17799:9;17795:18;18030:6;17968:76;:::i;:::-;18092:9;18086:4;18082:20;18077:2;18066:9;18062:18;18055:48;18117:76;18188:4;18179:6;18117:76;:::i;18550:444::-;26098:42;26087:54;;;;8797:45;;18897:2;18882:18;;13639:37;;;;18980:2;18965:18;;13639:37;18733:2;18718:18;;18704:290::o;19001:218::-;25363:66;25352:78;;;;9501:36;;19126:2;19111:18;;19097:122::o;19226:329::-;25363:66;25352:78;;;;9501:36;;26098:42;26087:54;19541:2;19526:18;;8797:45;19379:2;19364:18;;19350:205::o;19847:480::-;20048:2;20033:18;;28102:1;28092:12;;28082:2;;28108:9;28082:2;10870:68;;;20230:2;20215:18;;13639:37;;;;20313:2;20298:18;;;13639:37;20019:308;:::o;20334:510::-;20550:2;20535:18;;28235:1;28225:12;;28215:2;;28241:9;20851:310;;20998:2;21019:17;21012:47;21073:78;20998:2;20987:9;20983:18;21137:6;21073:78;:::i;21168:416::-;21368:2;21382:47;;;11877:2;21353:18;;;24280:19;11913:34;24320:14;;;11893:55;11982:9;11968:12;;;11961:31;12011:12;;;21339:245::o;21591:416::-;21791:2;21805:47;;;12531:2;21776:18;;;24280:19;12567:34;24320:14;;;12547:55;12636:6;12622:12;;;12615:28;12662:12;;;21762:245::o;22014:406::-;;22209:2;22230:17;22223:47;26098:42;;13024:16;13018:23;26087:54;22209:2;22198:9;22194:18;8797:45;26098:42;22209:2;13203:5;13199:16;13193:23;26087:54;13286:14;22198:9;13286:14;8797:45;;13286:14;13373:5;13369:16;13363:23;12950:4;;22198:9;13406:14;13399:38;13452:71;12941:14;22198:9;12941:14;13504:12;13452:71;:::i;22427:222::-;13639:37;;;22554:2;22539:18;;22525:124::o;22656:333::-;13639:37;;;22975:2;22960:18;;13639:37;22811:2;22796:18;;22782:207::o;22996:256::-;23058:2;23052:9;23084:17;;;23159:18;23144:34;;23180:22;;;23141:62;23138:2;;;23216:1;;23206:12;23138:2;23058;23225:22;23036:216;;-1:-1;23036:216::o;23602:321::-;;23745:18;23737:6;23734:30;23731:2;;;-1:-1;;23767:12;23731:2;-1:-1;23844:4;23821:17;23840:9;23817:33;23908:4;23898:15;;23668:255::o;27252:268::-;27317:1;27324:101;27338:6;27335:1;27332:13;27324:101;;;27405:11;;;27399:18;27386:11;;;27379:39;27360:2;27353:10;27324:101;;;27440:6;27437:1;27434:13;27431:2;;;27317:1;27496:6;27491:3;27487:16;27480:27;27431:2;;27301:219;;;:::o;28264:117::-;26098:42;28351:5;26087:54;28326:5;28323:35;28313:2;;28372:1;;28362:12;28313:2;28307:74;:::o

Swarm Source

ipfs://6b1cda9d010e6c8cee2b48531426ce46880b660a08510a246c459e15b354c5d2

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.