ETH Price: $3,227.02 (+1.75%)

Contract

0x27111bfF17D42a689B3Ff934F87d9253165388f0
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

> 10 Internal Transactions and > 10 Token Transfers found.

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
109481852020-09-28 1:46:221570 days ago1601257582
0x27111bfF...3165388f0
0.00014 ETH
109481852020-09-28 1:46:221570 days ago1601257582
0x27111bfF...3165388f0
0.00014 ETH
109481852020-09-28 1:46:221570 days ago1601257582
0x27111bfF...3165388f0
0.00001 ETH
109481852020-09-28 1:46:221570 days ago1601257582
0x27111bfF...3165388f0
0.00015 ETH
106807552020-08-18 0:24:421611 days ago1597710282
0x27111bfF...3165388f0
5.77315556 ETH
106807552020-08-18 0:24:421611 days ago1597710282
0x27111bfF...3165388f0
5.73990556 ETH
106807552020-08-18 0:24:421611 days ago1597710282
0x27111bfF...3165388f0
0.03325 ETH
106807552020-08-18 0:24:421611 days ago1597710282
0x27111bfF...3165388f0
0.0931 ETH
106807552020-08-18 0:24:421611 days ago1597710282
0x27111bfF...3165388f0
0.0931 ETH
106769852020-08-17 10:15:261611 days ago1597659326
0x27111bfF...3165388f0
0.00763 ETH
106769852020-08-17 10:15:261611 days ago1597659326
0x27111bfF...3165388f0
0.00763 ETH
106769852020-08-17 10:15:261611 days ago1597659326
0x27111bfF...3165388f0
0.00763 ETH
106769852020-08-17 10:15:261611 days ago1597659326
0x27111bfF...3165388f0
0.00763 ETH
106743462020-08-17 0:26:361612 days ago1597623996
0x27111bfF...3165388f0
0.01148 ETH
106743462020-08-17 0:26:361612 days ago1597623996
0x27111bfF...3165388f0
0.01148 ETH
106743252020-08-17 0:20:381612 days ago1597623638
0x27111bfF...3165388f0
0.01148 ETH
106743252020-08-17 0:20:381612 days ago1597623638
0x27111bfF...3165388f0
0.01148 ETH
106743252020-08-17 0:20:381612 days ago1597623638
0x27111bfF...3165388f0
0.01148 ETH
106737352020-08-16 22:09:091612 days ago1597615749
0x27111bfF...3165388f0
0.00574 ETH
106737352020-08-16 22:09:091612 days ago1597615749
0x27111bfF...3165388f0
0.00574 ETH
106737282020-08-16 22:06:481612 days ago1597615608
0x27111bfF...3165388f0
0.01302 ETH
106737282020-08-16 22:06:481612 days ago1597615608
0x27111bfF...3165388f0
0.01302 ETH
106737282020-08-16 22:06:481612 days ago1597615608
0x27111bfF...3165388f0
0.01302 ETH
106678602020-08-16 0:28:211613 days ago1597537701
0x27111bfF...3165388f0
0.01218 ETH
106678602020-08-16 0:28:211613 days ago1597537701
0x27111bfF...3165388f0
0.01218 ETH
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x410B953E...752f73aa3
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ZeroxV3

Compiler Version
v0.5.11+commit.c082d0b4

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-05-23
*/

// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol

pragma solidity ^0.5.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see `ERC20Detailed`.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a `Transfer` event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through `transferFrom`. This is
     * zero by default.
     *
     * This value changes when `approve` or `transferFrom` are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * > Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an `Approval` event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a `Transfer` event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to `approve`. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

// File: openzeppelin-solidity/contracts/utils/Address.sol

pragma solidity ^0.5.0;

/**
 * @dev Collection of functions related to the address type,
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * This test is non-exhaustive, and there may be false-negatives: during the
     * execution of a contract's constructor, its address will be reported as
     * not containing a contract.
     *
     * > It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }
}

// File: original_contracts/IWETH.sol

pragma solidity 0.5.11;



contract IWETH is IERC20 {
    function deposit() external payable;
    function withdraw(uint256 amount) external;
}

// File: original_contracts/lib/zeroxv3/LibOrderV3.sol

/* solium-disable */

pragma solidity 0.5.11;


library LibOrderV3{

    
    struct Order {
        address makerAddress;           // Address that created the order.
        address takerAddress;           // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order.
        address feeRecipientAddress;    // Address that will recieve fees when order is filled.
        address senderAddress;          // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.
        uint256 makerAssetAmount;       // Amount of makerAsset being offered by maker. Must be greater than 0.
        uint256 takerAssetAmount;       // Amount of takerAsset being bid on by maker. Must be greater than 0.
        uint256 makerFee;               // Fee paid to feeRecipient by maker when order is filled.
        uint256 takerFee;               // Fee paid to feeRecipient by taker when order is filled.
        uint256 expirationTimeSeconds;  // Timestamp in seconds at which order expires.
        uint256 salt;                   // Arbitrary number to facilitate uniqueness of the order's hash.
        bytes makerAssetData;           // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The leading bytes4 references the id of the asset proxy.
        bytes takerAssetData;           // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The leading bytes4 references the id of the asset proxy.
        bytes makerFeeAssetData;        // Encoded data that can be decoded by a specified proxy contract when transferring makerFeeAsset. The leading bytes4 references the id of the asset proxy.
        bytes takerFeeAssetData;        // Encoded data that can be decoded by a specified proxy contract when transferring takerFeeAsset. The leading bytes4 references the id of the asset proxy.
    }

    struct FillResults {
        uint256 makerAssetFilledAmount;  // Total amount of makerAsset(s) filled.
        uint256 takerAssetFilledAmount;  // Total amount of takerAsset(s) filled.
        uint256 makerFeePaid;            // Total amount of fees paid by maker(s) to feeRecipient(s).
        uint256 takerFeePaid;            // Total amount of fees paid by taker to feeRecipients(s).
        uint256 protocolFeePaid;         // Total amount of fees paid by taker to the staking contract.
       }
}

// File: original_contracts/lib/zeroxv3/IZeroxV3.sol

pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;



interface IZeroxV3 {

    function marketSellOrdersNoThrow(
        LibOrderV3.Order[] calldata orders,
        uint256 takerAssetFillAmount,
        bytes[] calldata signatures
    )
        external
        payable
        returns(LibOrderV3.FillResults memory);
}

// File: openzeppelin-solidity/contracts/math/SafeMath.sol

pragma solidity ^0.5.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, "SafeMath: division by zero");
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0, "SafeMath: modulo by zero");
        return a % b;
    }
}

// File: openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol

pragma solidity ^0.5.0;




/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require((value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value);
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// File: original_contracts/ITokenTransferProxy.sol

pragma solidity 0.5.11;


interface ITokenTransferProxy {

    function transferFrom(
        address token,
        address from,
        address to,
        uint256 amount
    )
        external;

    function freeGSTTokens(uint256 tokensToFree) external;
}

// File: original_contracts/lib/Utils.sol

pragma solidity 0.5.11;







library Utils {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    address constant ETH_ADDRESS = address(
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
    );

    uint256 constant MAX_UINT = 2 ** 256 - 1;

    struct Route {
        address payable exchange;
        address targetExchange;
        uint percent;
        bytes payload;
        uint256 networkFee;
    }

    struct Path {
        address to;
        Route[] routes;
    }

    function ethAddress() internal pure returns (address) {return ETH_ADDRESS;}

    function maxUint() internal pure returns (uint256) {return MAX_UINT;}

    function approve(
        address addressToApprove,
        address token
    ) internal {
        if (token != ETH_ADDRESS) {
            IERC20 _token = IERC20(token);

            uint allowance = _token.allowance(address(this), addressToApprove);

            if (allowance < MAX_UINT / 10) {
                _token.safeApprove(addressToApprove, MAX_UINT);
            }
        }
    }

    function transferTokens(
        address token,
        address payable destination,
        uint256 amount
    )
    internal
    {
        if (token == ETH_ADDRESS) {
            destination.transfer(amount);
        }
        else {
            IERC20(token).safeTransfer(destination, amount);
        }
    }

    function tokenBalance(
        address token,
        address account
    )
    internal
    view
    returns (uint256)
    {
        if (token == ETH_ADDRESS) {
            return account.balance;
        } else {
            return IERC20(token).balanceOf(account);
        }
    }

    /**
    * @dev Helper method to refund gas using gas tokens
    */
    function refundGas(address tokenProxy, uint256 initialGas, uint256 mintPrice) internal {

        uint256 mintBase = 32254;
        uint256 mintToken = 36543;
        uint256 freeBase = 14154;
        uint256 freeToken = 6870;
        uint256 reimburse = 24000;

        uint256 tokens = initialGas.sub(
            gasleft()).add(freeBase).div(reimburse.mul(2).sub(freeToken)
        );

        uint256 mintCost = mintBase.add(tokens.mul(mintToken));
        uint256 freeCost = freeBase.add(tokens.mul(freeToken));
        uint256 maxreimburse = tokens.mul(reimburse);

        uint256 efficiency = maxreimburse.mul(tx.gasprice).mul(100).div(
            mintCost.mul(mintPrice).add(freeCost.mul(tx.gasprice))
        );

        if (efficiency > 100) {
            freeGasTokens(tokenProxy, tokens);
        }
    }
    
    /**
    * @dev Helper method to free gas tokens
    */
    function freeGasTokens(address tokenProxy, uint256 tokens) internal {

        uint256 tokensToFree = tokens;
        uint256 safeNumTokens = 0;
        uint256 gas = gasleft();

        if (gas >= 27710) {
            safeNumTokens = gas.sub(27710).div(1148 + 5722 + 150);
        }

        if (tokensToFree > safeNumTokens) {
            tokensToFree = safeNumTokens;
        }

        ITokenTransferProxy(tokenProxy).freeGSTTokens(tokensToFree);

    }
}

// File: original_contracts/lib/IExchange.sol

pragma solidity 0.5.11;



/**
* @dev This interface should be implemented by all exchanges which needs to integrate with the paraswap protocol
*/
interface IExchange {

    /**
   * @dev The function which performs the swap on an exchange.
   * Exchange needs to implement this method in order to support swapping of tokens through it
   * @param fromToken Address of the source token
   * @param toToken Address of the destination token
   * @param fromAmount Amount of source tokens to be swapped
   * @param toAmount Minimum destination token amount expected out of this swap
   * @param exchange Internal exchange or factory contract address for the exchange. For example Registry address for the Uniswap
   * @param payload Any exchange specific data which is required can be passed in this argument in encoded format which
   * will be decoded by the exchange. Each exchange will publish it's own decoding/encoding mechanism
   */
    function swap(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        uint256 toAmount,
        address exchange,
        bytes calldata payload) external payable returns (uint256);
}

// File: openzeppelin-solidity/contracts/ownership/Ownable.sol

pragma solidity ^0.5.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be aplied to your functions to restrict their use to
 * the owner.
 */
contract Ownable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(isOwner(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return msg.sender == _owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * > Note: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// File: original_contracts/lib/TokenFetcher.sol

pragma solidity 0.5.11;




contract TokenFetcher is Ownable {

    /**
    * @dev Allows owner of the contract to transfer tokens any tokens which are assigned to the contract
    * This method is for saftey if by any chance tokens or ETHs are assigned to the contract by mistake
    * @dev token Address of the token to be transferred
    * @dev destination Recepient of the token
    * @dev amount Amount of tokens to be transferred
    */
    function transferTokens(
        address token,
        address payable destination,
        uint256 amount
    )
        external
        onlyOwner
    {
        Utils.transferTokens(token, destination, amount);
    }
}

// File: original_contracts/lib/libraries/LibBytesRichErrors.sol

/*
  Copyright 2019 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.5.11;


library LibBytesRichErrors {

    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: original_contracts/lib/libraries/LibRichErrors.sol

/*
  Copyright 2019 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.5.11;


library LibRichErrors {

    // 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: original_contracts/lib/libraries/LibBytes.sol

/*
  Copyright 2019 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.5.11;




library LibBytes {

    using LibBytes for bytes;

    /// @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 address from byte array.
    function readAddress(
        bytes memory b,
        uint256 index
    )
        internal
        pure
        returns (address result)
    {
        if (b.length < index + 20) {
            LibRichErrors.rrevert(LibBytesRichErrors.InvalidByteOperationError(
                LibBytesRichErrors.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;
    }

}

// File: original_contracts/lib/zeroxv3/ZeroxV3.sol

pragma solidity 0.5.11;











contract ZeroxV3 is IExchange, TokenFetcher {
    using Address for address;
    using LibBytes for bytes;

    address public weth;
    address public erc20Proxy;

    struct ZeroxData {
        LibOrderV3.Order[] orders;
        bytes[] signatures;
        uint256 networkFee;
    }

    constructor(address _weth, address _erc20Proxy) public {
        weth = _weth;
        erc20Proxy = _erc20Proxy;
    }

    /**
    * @dev Fallback method to allow exchanges to transfer back ethers for a particular swap
    * It will only allow contracts to send funds to it
    */
    function() external payable {
        address account = msg.sender;
        require(
            account.isContract(),
            "Sender is not a contract"
        );
    }

    function swap(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        uint256 toAmount,
        address exchange,
        bytes calldata payload) external payable returns (uint256) {

        ZeroxData memory data = abi.decode(payload, (ZeroxData));

        address _fromToken = address(fromToken);
        address _toToken = address(toToken);

        if (address(fromToken) == Utils.ethAddress()) {
            IWETH(weth).deposit.value(fromAmount)();
            _fromToken = weth;
        }

        else if (address(toToken) == Utils.ethAddress()) {
            _toToken = weth;
        }

        for (uint256 i = 0; i < data.orders.length; i++) {
            address srcToken = data.orders[i].takerAssetData.readAddress(16);
            require(srcToken == address(_fromToken), "Invalid from token!!");

            address destToken = data.orders[i].makerAssetData.readAddress(16);
            require(destToken == address(_toToken), "Invalid to token!!");
        }

        Utils.approve(erc20Proxy, address(_fromToken));

        IZeroxV3(exchange).marketSellOrdersNoThrow.value(data.networkFee)(
            data.orders,
            fromAmount,
            data.signatures
        );

        if (address(toToken) == Utils.ethAddress()) {
            uint256 wethReceived = Utils.tokenBalance(address(weth), address(this));
            IWETH(weth).withdraw(wethReceived);
        }

        uint256 receivedAmount = Utils.tokenBalance(address(toToken), address(this));

        Utils.transferTokens(address(toToken), msg.sender, receivedAmount);

        return receivedAmount;
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"erc20Proxy","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address payable","name":"destination","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"toAmount","type":"uint256"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"swap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_erc20Proxy","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

Deployed Bytecode

0x60806040526004361061007b5760003560e01c80638f32d59b1161004e5780638f32d59b14610119578063a64b6e5f1461013b578063b69cbf9f1461015b578063f2fde38b1461017b5761007b565b80633fc8cef3146100ad578063715018a6146100d85780637f555b03146100ef5780638da5cb5b14610104575b336100858161019b565b6100aa5760405162461bcd60e51b81526004016100a190611710565b60405180910390fd5b50005b3480156100b957600080fd5b506100c26101a5565b6040516100cf9190611654565b60405180910390f35b3480156100e457600080fd5b506100ed6101b4565b005b3480156100fb57600080fd5b506100c2610222565b34801561011057600080fd5b506100c2610231565b34801561012557600080fd5b5061012e610240565b6040516100cf91906116ca565b34801561014757600080fd5b506100ed610156366004610fe6565b610251565b61016e610169366004611051565b610285565b6040516100cf9190611790565b34801561018757600080fd5b506100ed610196366004610fc0565b6105b9565b803b15155b919050565b6001546001600160a01b031681565b6101bc610240565b6101d85760405162461bcd60e51b81526004016100a190611750565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6002546001600160a01b031681565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b610259610240565b6102755760405162461bcd60e51b81526004016100a190611750565b6102808383836105e9565b505050565b600061028f610b55565b61029b83850185611114565b905088886102a7610664565b6001600160a01b03168b6001600160a01b0316141561033d57600160009054906101000a90046001600160a01b03166001600160a01b031663d0e30db08a6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561031057600080fd5b505af1158015610324573d6000803e3d6000fd5b50506001546001600160a01b0316945061036c92505050565b610345610664565b6001600160a01b03168a6001600160a01b0316141561036c57506001546001600160a01b03165b60005b83515181101561044d5760006103ab60108660000151848151811061039057fe5b6020026020010151610160015161067c90919063ffffffff16565b9050836001600160a01b0316816001600160a01b0316146103de5760405162461bcd60e51b81526004016100a190611730565b60006104106010876000015185815181106103f557fe5b6020026020010151610140015161067c90919063ffffffff16565b9050836001600160a01b0316816001600160a01b0316146104435760405162461bcd60e51b81526004016100a190611740565b505060010161036f565b50600254610464906001600160a01b0316836106be565b60408084015184516020860151925163369da09960e01b81526001600160a01b038b169363369da099939261049f9290918f91600401611698565b60a0604051808303818588803b1580156104b857600080fd5b505af11580156104cc573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052506104f191908101906110f6565b506104fa610664565b6001600160a01b03168a6001600160a01b031614156105915760015460009061052c906001600160a01b0316306107b2565b600154604051632e1a7d4d60e01b81529192506001600160a01b031690632e1a7d4d9061055d908490600401611790565b600060405180830381600087803b15801561057757600080fd5b505af115801561058b573d6000803e3d6000fd5b50505050505b600061059d8b306107b2565b90506105aa8b33836105e9565b9b9a5050505050505050505050565b6105c1610240565b6105dd5760405162461bcd60e51b81526004016100a190611750565b6105e68161086d565b50565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561064a576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610644573d6000803e3d6000fd5b50610280565b6102806001600160a01b038416838363ffffffff6108ee16565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90565b600081601401835110156106a2576106a261069d6004855185601401610947565b6109a2565b5060148183018101519101906001600160a01b03165b92915050565b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146107ae57604051636eb1769f60e11b815281906000906001600160a01b0383169063dd62ed3e906107159030908890600401611662565b60206040518083038186803b15801561072d57600080fd5b505afa158015610741573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107659190810190611149565b90507f19999999999999999999999999999999999999999999999999999999999999998110156107ab576107ab6001600160a01b0383168560001963ffffffff6109aa16565b50505b5050565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156107ea57506001600160a01b038116316106b8565b6040516370a0823160e01b81526001600160a01b038416906370a0823190610816908590600401611654565b60206040518083038186803b15801561082e57600080fd5b505afa158015610842573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506108669190810190611149565b90506106b8565b6001600160a01b0381166108935760405162461bcd60e51b81526004016100a190611700565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60405161028090849063a9059cbb60e01b90610910908690869060240161167d565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610a70565b6060632800659560e01b848484604051602401610966939291906116d8565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915290505b9392505050565b805160208201fd5b801580610a325750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e906109e09030908690600401611662565b60206040518083038186803b1580156109f857600080fd5b505afa158015610a0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a309190810190611149565b155b610a4e5760405162461bcd60e51b81526004016100a190611770565b60405161028090849063095ea7b360e01b90610910908690869060240161167d565b610a82826001600160a01b031661019b565b610a9e5760405162461bcd60e51b81526004016100a190611780565b60006060836001600160a01b031683604051610aba9190611648565b6000604051808303816000865af19150503d8060008114610af7576040519150601f19603f3d011682016040523d82523d6000602084013e610afc565b606091505b509150915081610b1e5760405162461bcd60e51b81526004016100a190611720565b8051156107ab5780806020019051610b399190810190611033565b6107ab5760405162461bcd60e51b81526004016100a190611760565b60405180606001604052806060815260200160608152602001600081525090565b80356106b8816118ac565b600082601f830112610b9257600080fd5b8135610ba5610ba0826117c5565b61179e565b81815260209384019390925082018360005b83811015610be35781358601610bcd8882610c9e565b8452506020928301929190910190600101610bb7565b5050505092915050565b600082601f830112610bfe57600080fd5b8135610c0c610ba0826117c5565b81815260209384019390925082018360005b83811015610be35781358601610c348882610d7b565b8452506020928301929190910190600101610c1e565b80516106b8816118c0565b60008083601f840112610c6757600080fd5b50813567ffffffffffffffff811115610c7f57600080fd5b602083019150836001820283011115610c9757600080fd5b9250929050565b600082601f830112610caf57600080fd5b8135610cbd610ba0826117e6565b91508082526020830160208301858383011115610cd957600080fd5b610ce4838284611860565b50505092915050565b80356106b8816118c9565b600060a08284031215610d0a57600080fd5b610d1460a061179e565b90506000610d228484610fb5565b8252506020610d3384848301610fb5565b6020830152506040610d4784828501610fb5565b6040830152506060610d5b84828501610fb5565b6060830152506080610d6f84828501610fb5565b60808301525092915050565b60006101c08284031215610d8e57600080fd5b610d996101c061179e565b90506000610da78484610b76565b8252506020610db884848301610b76565b6020830152506040610dcc84828501610b76565b6040830152506060610de084828501610b76565b6060830152506080610df484828501610faa565b60808301525060a0610e0884828501610faa565b60a08301525060c0610e1c84828501610faa565b60c08301525060e0610e3084828501610faa565b60e083015250610100610e4584828501610faa565b61010083015250610120610e5b84828501610faa565b6101208301525061014082013567ffffffffffffffff811115610e7d57600080fd5b610e8984828501610c9e565b6101408301525061016082013567ffffffffffffffff811115610eab57600080fd5b610eb784828501610c9e565b6101608301525061018082013567ffffffffffffffff811115610ed957600080fd5b610ee584828501610c9e565b610180830152506101a082013567ffffffffffffffff811115610f0757600080fd5b610f1384828501610c9e565b6101a08301525092915050565b600060608284031215610f3257600080fd5b610f3c606061179e565b9050813567ffffffffffffffff811115610f5557600080fd5b610f6184828501610bed565b825250602082013567ffffffffffffffff811115610f7e57600080fd5b610f8a84828501610b81565b6020830152506040610f9e84828501610faa565b60408301525092915050565b80356106b8816118d2565b80516106b8816118d2565b600060208284031215610fd257600080fd5b6000610fde8484610b76565b949350505050565b600080600060608486031215610ffb57600080fd5b60006110078686610b76565b935050602061101886828701610b76565b925050604061102986828701610faa565b9150509250925092565b60006020828403121561104557600080fd5b6000610fde8484610c4a565b600080600080600080600060c0888a03121561106c57600080fd5b60006110788a8a610ced565b97505060206110898a828b01610ced565b965050604061109a8a828b01610faa565b95505060606110ab8a828b01610faa565b94505060806110bc8a828b01610b76565b93505060a088013567ffffffffffffffff8111156110d957600080fd5b6110e58a828b01610c55565b925092505092959891949750929550565b600060a0828403121561110857600080fd5b6000610fde8484610cf8565b60006020828403121561112657600080fd5b813567ffffffffffffffff81111561113d57600080fd5b610fde84828501610f20565b60006020828403121561115b57600080fd5b6000610fde8484610fb5565b600061099b8383611295565b600061099b8383611504565b61118881611821565b82525050565b600061119982611814565b6111a38185611818565b9350836020820285016111b58561180e565b8060005b858110156111ef57848403895281516111d28582611167565b94506111dd8361180e565b60209a909a01999250506001016111b9565b5091979650505050505050565b600061120782611814565b6112118185611818565b9350836020820285016112238561180e565b8060005b858110156111ef57848403895281516112408582611173565b945061124b8361180e565b60209a909a0199925050600101611227565b6111888161182c565b600061127182611814565b61127b81856101a0565b935061128b81856020860161186c565b9290920192915050565b60006112a082611814565b6112aa8185611818565b93506112ba81856020860161186c565b6112c381611898565b9093019392505050565b61118881611855565b60006112e3602683611818565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015260400192915050565b600061132b601883611818565b7f53656e646572206973206e6f74206120636f6e74726163740000000000000000815260200192915050565b6000611364602083611818565b7f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815260200192915050565b600061139d601483611818565b73496e76616c69642066726f6d20746f6b656e212160601b815260200192915050565b60006113cd601283611818565b71496e76616c696420746f20746f6b656e212160701b815260200192915050565b60006113fb602083611818565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000611434602a83611818565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b602082015260400192915050565b6000611480603683611818565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f81527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b602082015260400192915050565b60006114d8601f83611818565b7f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400815260200192915050565b80516000906101c0840190611519858261117f565b50602083015161152c602086018261117f565b50604083015161153f604086018261117f565b506060830151611552606086018261117f565b506080830151611565608086018261163f565b5060a083015161157860a086018261163f565b5060c083015161158b60c086018261163f565b5060e083015161159e60e086018261163f565b506101008301516115b361010086018261163f565b506101208301516115c861012086018261163f565b506101408301518482036101408601526115e28282611295565b9150506101608301518482036101608601526115fe8282611295565b91505061018083015184820361018086015261161a8282611295565b9150506101a08301518482036101a08601526116368282611295565b95945050505050565b61118881611852565b600061099b8284611266565b602081016106b8828461117f565b60408101611670828561117f565b61099b602083018461117f565b6040810161168b828561117f565b61099b602083018461163f565b606080825281016116a981866111fc565b90506116b8602083018561163f565b8181036040830152611636818461118e565b602081016106b8828461125d565b606081016116e682866112cd565b6116f3602083018561163f565b610fde604083018461163f565b602080825281016106b8816112d6565b602080825281016106b88161131e565b602080825281016106b881611357565b602080825281016106b881611390565b602080825281016106b8816113c0565b602080825281016106b8816113ee565b602080825281016106b881611427565b602080825281016106b881611473565b602080825281016106b8816114cb565b602081016106b8828461163f565b60405181810167ffffffffffffffff811182821017156117bd57600080fd5b604052919050565b600067ffffffffffffffff8211156117dc57600080fd5b5060209081020190565b600067ffffffffffffffff8211156117fd57600080fd5b506020601f91909101601f19160190565b60200190565b5190565b90815260200190565b60006106b882611846565b151590565b60006106b882611821565b806101a0816118a2565b6001600160a01b031690565b90565b60006106b88261183c565b82818337506000910152565b60005b8381101561188757818101518382015260200161186f565b838111156107ab5750506000910152565b601f01601f191690565b600881106105e657fe5b6118b581611821565b81146105e657600080fd5b6118b58161182c565b6118b581611831565b6118b58161185256fea365627a7a723158205c4690c8dc5215279f8a5112db932f86dc94dd5e65f27fcd1abb4fa66a93b4346c6578706572696d656e74616cf564736f6c634300050b0040

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.