ETH Price: $3,572.16 (+0.63%)
Gas: 5 Gwei

Contract

0x4572f2554421Bd64Bef1c22c8a81840E8D496BeA
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Swap174804792023-06-14 20:13:59371 days ago1686773639IN
AirSwap
0 ETH0.0115208253
Swap174782412023-06-14 12:40:59371 days ago1686746459IN
AirSwap
0 ETH0.0035570518.95487055
Swap174583012023-06-11 17:18:47374 days ago1686503927IN
AirSwap
0 ETH0.002912416.59175838
Cancel174432042023-06-09 14:15:35376 days ago1686320135IN
AirSwap
0 ETH0.0024589853
Swap174198042023-06-06 7:02:23379 days ago1686034943IN
AirSwap
0 ETH0.0037835420.97810183
Swap174197532023-06-06 6:52:11379 days ago1686034331IN
AirSwap
0 ETH0.0032651420
Swap174196592023-06-06 6:33:11379 days ago1686033191IN
AirSwap
0 ETH0.0037999321.64504184
Swap174163072023-06-05 19:12:11380 days ago1685992331IN
AirSwap
0 ETH0.0125761365
Swap174129882023-06-05 7:58:23380 days ago1685951903IN
AirSwap
0 ETH0.0087482853
Swap173952992023-06-02 20:05:47383 days ago1685736347IN
AirSwap
0 ETH0.0046404231
Swap173806172023-05-31 18:26:35385 days ago1685557595IN
AirSwap
0 ETH0.0014497148.79213966
Swap173806172023-05-31 18:26:35385 days ago1685557595IN
AirSwap
0 ETH0.0097182248.79213966
Swap173771742023-05-31 6:48:23385 days ago1685515703IN
AirSwap
0 ETH0.0111030253
Swap173743422023-05-30 21:14:11386 days ago1685481251IN
AirSwap
0 ETH0.0075046938.01135209
Swap173553522023-05-28 5:10:11389 days ago1685250611IN
AirSwap
0 ETH0.0102095453
Swap173518522023-05-27 17:22:47389 days ago1685208167IN
AirSwap
0 ETH0.0091450953
Swap173425262023-05-26 9:56:47390 days ago1685095007IN
AirSwap
0 ETH0.0047418427.01395948
Swap173413612023-05-26 6:01:11390 days ago1685080871IN
AirSwap
0 ETH0.0102095453
Swap173363842023-05-25 13:13:59391 days ago1685020439IN
AirSwap
0 ETH0.0093045253
Swap173332422023-05-25 2:37:59392 days ago1684982279IN
AirSwap
0 ETH0.0095809153
Cancel173330192023-05-25 1:53:11392 days ago1684979591IN
AirSwap
0 ETH0.0024589853
Swap173315642023-05-24 20:57:23392 days ago1684961843IN
AirSwap
0 ETH0.0096844753
Swap173200392023-05-23 6:03:11393 days ago1684821791IN
AirSwap
0 ETH0.0093045253
Swap172517942023-05-13 14:59:11403 days ago1683989951IN
AirSwap
0 ETH0.0015779153
Swap172517942023-05-13 14:59:11403 days ago1683989951IN
AirSwap
0 ETH0.011258153
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Swap

Compiler Version
v0.5.12+commit.7709ece9

Optimization Enabled:
Yes with 20000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-01-28
*/

pragma solidity 0.5.12;
pragma experimental ABIEncoderV2;
// File: @airswap/types/contracts/Types.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
  * @title Types: Library of Swap Protocol Types and Hashes
  */
library Types {
  bytes constant internal EIP191_HEADER = "\x19\x01";
  struct Order {
    uint256 nonce;                // Unique per order and should be sequential
    uint256 expiry;               // Expiry in seconds since 1 January 1970
    Party signer;                 // Party to the trade that sets terms
    Party sender;                 // Party to the trade that accepts terms
    Party affiliate;              // Party compensated for facilitating (optional)
    Signature signature;          // Signature of the order
  }
  struct Party {
    bytes4 kind;                  // Interface ID of the token
    address wallet;               // Wallet address of the party
    address token;                // Contract address of the token
    uint256 amount;               // Amount for ERC-20 or ERC-1155
    uint256 id;                   // ID for ERC-721 or ERC-1155
  }
  struct Signature {
    address signatory;            // Address of the wallet used to sign
    address validator;            // Address of the intended swap contract
    bytes1 version;               // EIP-191 signature version
    uint8 v;                      // `v` value of an ECDSA signature
    bytes32 r;                    // `r` value of an ECDSA signature
    bytes32 s;                    // `s` value of an ECDSA signature
  }
  bytes32 constant internal DOMAIN_TYPEHASH = keccak256(abi.encodePacked(
    "EIP712Domain(",
    "string name,",
    "string version,",
    "address verifyingContract",
    ")"
  ));
  bytes32 constant internal ORDER_TYPEHASH = keccak256(abi.encodePacked(
    "Order(",
    "uint256 nonce,",
    "uint256 expiry,",
    "Party signer,",
    "Party sender,",
    "Party affiliate",
    ")",
    "Party(",
    "bytes4 kind,",
    "address wallet,",
    "address token,",
    "uint256 amount,",
    "uint256 id",
    ")"
  ));
  bytes32 constant internal PARTY_TYPEHASH = keccak256(abi.encodePacked(
    "Party(",
    "bytes4 kind,",
    "address wallet,",
    "address token,",
    "uint256 amount,",
    "uint256 id",
    ")"
  ));
  /**
    * @notice Hash an order into bytes32
    * @dev EIP-191 header and domain separator included
    * @param order Order The order to be hashed
    * @param domainSeparator bytes32
    * @return bytes32 A keccak256 abi.encodePacked value
    */
  function hashOrder(
    Order calldata order,
    bytes32 domainSeparator
  ) external pure returns (bytes32) {
    return keccak256(abi.encodePacked(
      EIP191_HEADER,
      domainSeparator,
      keccak256(abi.encode(
        ORDER_TYPEHASH,
        order.nonce,
        order.expiry,
        keccak256(abi.encode(
          PARTY_TYPEHASH,
          order.signer.kind,
          order.signer.wallet,
          order.signer.token,
          order.signer.amount,
          order.signer.id
        )),
        keccak256(abi.encode(
          PARTY_TYPEHASH,
          order.sender.kind,
          order.sender.wallet,
          order.sender.token,
          order.sender.amount,
          order.sender.id
        )),
        keccak256(abi.encode(
          PARTY_TYPEHASH,
          order.affiliate.kind,
          order.affiliate.wallet,
          order.affiliate.token,
          order.affiliate.amount,
          order.affiliate.id
        ))
      ))
    ));
  }
  /**
    * @notice Hash domain parameters into bytes32
    * @dev Used for signature validation (EIP-712)
    * @param name bytes
    * @param version bytes
    * @param verifyingContract address
    * @return bytes32 returns a keccak256 abi.encodePacked value
    */
  function hashDomain(
    bytes calldata name,
    bytes calldata version,
    address verifyingContract
  ) external pure returns (bytes32) {
    return keccak256(abi.encode(
      DOMAIN_TYPEHASH,
      keccak256(name),
      keccak256(version),
      verifyingContract
    ));
  }
}
// File: @airswap/delegate/contracts/interfaces/IDelegate.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
interface IDelegate {
  struct Rule {
    uint256 maxSenderAmount;      // The maximum amount of ERC-20 token the delegate would send
    uint256 priceCoef;            // Number to be multiplied by 10^(-priceExp) - the price coefficient
    uint256 priceExp;             // Indicates location of the decimal priceCoef * 10^(-priceExp)
  }
  event SetRule(
    address indexed owner,
    address indexed senderToken,
    address indexed signerToken,
    uint256 maxSenderAmount,
    uint256 priceCoef,
    uint256 priceExp
  );
  event UnsetRule(
    address indexed owner,
    address indexed senderToken,
    address indexed signerToken
  );
  event ProvideOrder(
    address indexed owner,
    address tradeWallet,
    address indexed senderToken,
    address indexed signerToken,
    uint256 senderAmount,
    uint256 priceCoef,
    uint256 priceExp
  );
  function setRule(
    address senderToken,
    address signerToken,
    uint256 maxSenderAmount,
    uint256 priceCoef,
    uint256 priceExp
  ) external;
  function unsetRule(
    address senderToken,
    address signerToken
  ) external;
  function provideOrder(
    Types.Order calldata order
  ) external;
  function rules(address, address) external view returns (Rule memory);
  function getSignerSideQuote(
    uint256 senderAmount,
    address senderToken,
    address signerToken
  ) external view returns (
    uint256 signerAmount
  );
  function getSenderSideQuote(
    uint256 signerAmount,
    address signerToken,
    address senderToken
  ) external view returns (
    uint256 senderAmount
  );
  function getMaxQuote(
    address senderToken,
    address signerToken
  ) external view returns (
    uint256 senderAmount,
    uint256 signerAmount
  );
  function owner()
    external view returns (address);
  function tradeWallet()
    external view returns (address);
}
// File: @airswap/indexer/contracts/interfaces/IIndexer.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
interface IIndexer {
  event CreateIndex(
    address indexed signerToken,
    address indexed senderToken,
    bytes2 protocol,
    address indexAddress
  );
  event Stake(
    address indexed staker,
    address indexed signerToken,
    address indexed senderToken,
    bytes2 protocol,
    uint256 stakeAmount
  );
  event Unstake(
    address indexed staker,
    address indexed signerToken,
    address indexed senderToken,
    bytes2 protocol,
    uint256 stakeAmount
  );
  event AddTokenToBlacklist(
    address token
  );
  event RemoveTokenFromBlacklist(
    address token
  );
  function setLocatorWhitelist(
    bytes2 protocol,
    address newLocatorWhitelist
  ) external;
  function createIndex(
    address signerToken,
    address senderToken,
    bytes2 protocol
  ) external returns (address);
  function addTokenToBlacklist(
    address token
  ) external;
  function removeTokenFromBlacklist(
    address token
  ) external;
  function setIntent(
    address signerToken,
    address senderToken,
    bytes2 protocol,
    uint256 stakingAmount,
    bytes32 locator
  ) external;
  function unsetIntent(
    address signerToken,
    address senderToken,
    bytes2 protocol
  ) external;
  function stakingToken() external view returns (address);
  function indexes(address, address, bytes2) external view returns (address);
  function tokenBlacklist(address) external view returns (bool);
  function getStakedAmount(
    address user,
    address signerToken,
    address senderToken,
    bytes2 protocol
  ) external view returns (uint256);
  function getLocators(
    address signerToken,
    address senderToken,
    bytes2 protocol,
    address cursor,
    uint256 limit
  ) external view returns (
    bytes32[] memory,
    uint256[] memory,
    address
  );
}
// File: @airswap/transfers/contracts/interfaces/ITransferHandler.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
  * @title ITransferHandler: interface for token transfers
  */
interface ITransferHandler {
 /**
  * @notice Function to wrap token transfer for different token types
  * @param from address Wallet address to transfer from
  * @param to address Wallet address to transfer to
  * @param amount uint256 Amount for ERC-20
  * @param id token ID for ERC-721
  * @param token address Contract address of token
  * @return bool on success of the token transfer
  */
  function transferTokens(
    address from,
    address to,
    uint256 amount,
    uint256 id,
    address token
  ) external returns (bool);
}
// File: openzeppelin-solidity/contracts/GSN/Context.sol
/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks
    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }
    function _msgData() internal view returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
 * @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 applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Context {
    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 = _msgSender();
        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 _msgSender() == _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: @airswap/transfers/contracts/TransferHandlerRegistry.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
  * @title TransferHandlerRegistry: holds registry of contract to
  * facilitate token transfers
  */
contract TransferHandlerRegistry is Ownable {
  event AddTransferHandler(
    bytes4 kind,
    address contractAddress
  );
  // Mapping of bytes4 to contract interface type
  mapping (bytes4 => ITransferHandler) public transferHandlers;
  /**
  * @notice Adds handler to mapping
  * @param kind bytes4 Key value that defines a token type
  * @param transferHandler ITransferHandler
  */
  function addTransferHandler(bytes4 kind, ITransferHandler transferHandler)
    external onlyOwner {
      require(address(transferHandlers[kind]) == address(0), "HANDLER_EXISTS_FOR_KIND");
      transferHandlers[kind] = transferHandler;
      emit AddTransferHandler(kind, address(transferHandler));
    }
}
// File: @airswap/swap/contracts/interfaces/ISwap.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
interface ISwap {
  event Swap(
    uint256 indexed nonce,
    uint256 timestamp,
    address indexed signerWallet,
    uint256 signerAmount,
    uint256 signerId,
    address signerToken,
    address indexed senderWallet,
    uint256 senderAmount,
    uint256 senderId,
    address senderToken,
    address affiliateWallet,
    uint256 affiliateAmount,
    uint256 affiliateId,
    address affiliateToken
  );
  event Cancel(
    uint256 indexed nonce,
    address indexed signerWallet
  );
  event CancelUpTo(
    uint256 indexed nonce,
    address indexed signerWallet
  );
  event AuthorizeSender(
    address indexed authorizerAddress,
    address indexed authorizedSender
  );
  event AuthorizeSigner(
    address indexed authorizerAddress,
    address indexed authorizedSigner
  );
  event RevokeSender(
    address indexed authorizerAddress,
    address indexed revokedSender
  );
  event RevokeSigner(
    address indexed authorizerAddress,
    address indexed revokedSigner
  );
  /**
    * @notice Atomic Token Swap
    * @param order Types.Order
    */
  function swap(
    Types.Order calldata order
  ) external;
  /**
    * @notice Cancel one or more open orders by nonce
    * @param nonces uint256[]
    */
  function cancel(
    uint256[] calldata nonces
  ) external;
  /**
    * @notice Cancels all orders below a nonce value
    * @dev These orders can be made active by reducing the minimum nonce
    * @param minimumNonce uint256
    */
  function cancelUpTo(
    uint256 minimumNonce
  ) external;
  /**
    * @notice Authorize a delegated sender
    * @param authorizedSender address
    */
  function authorizeSender(
    address authorizedSender
  ) external;
  /**
    * @notice Authorize a delegated signer
    * @param authorizedSigner address
    */
  function authorizeSigner(
    address authorizedSigner
  ) external;
  /**
    * @notice Revoke an authorization
    * @param authorizedSender address
    */
  function revokeSender(
    address authorizedSender
  ) external;
  /**
    * @notice Revoke an authorization
    * @param authorizedSigner address
    */
  function revokeSigner(
    address authorizedSigner
  ) external;
  function senderAuthorizations(address, address) external view returns (bool);
  function signerAuthorizations(address, address) external view returns (bool);
  function signerNonceStatus(address, uint256) external view returns (byte);
  function signerMinimumNonce(address) external view returns (uint256);
  function registry() external view returns (TransferHandlerRegistry);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
 * @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) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }
    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     *
     * _Available since v2.4.0._
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        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-contracts/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) {
        return div(a, b, "SafeMath: division by zero");
    }
    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message 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.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        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) {
        return mod(a, b, "SafeMath: modulo by zero");
    }
    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
 * @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.
     *
     * IMPORTANT: 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: @airswap/delegate/contracts/Delegate.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
  * @title Delegate: Deployable Trading Rules for the AirSwap Network
  * @notice Supports fungible tokens (ERC-20)
  * @dev inherits IDelegate, Ownable uses SafeMath library
  */
contract Delegate is IDelegate, Ownable {
  using SafeMath for uint256;
  // The Swap contract to be used to settle trades
  ISwap public swapContract;
  // The Indexer to stake intent to trade on
  IIndexer public indexer;
  // Maximum integer for token transfer approval
  uint256 constant internal MAX_INT =  2**256 - 1;
  // Address holding tokens that will be trading through this delegate
  address public tradeWallet;
  // Mapping of senderToken to signerToken for rule lookup
  mapping (address => mapping (address => Rule)) public rules;
  // ERC-20 (fungible token) interface identifier (ERC-165)
  bytes4 constant internal ERC20_INTERFACE_ID = 0x36372b07;
  // The protocol identifier for setting intents on an Index
  bytes2 public protocol;
  /**
    * @notice Contract Constructor
    * @dev owner defaults to msg.sender if delegateContractOwner is provided as address(0)
    * @param delegateSwap address Swap contract the delegate will deploy with
    * @param delegateIndexer address Indexer contract the delegate will deploy with
    * @param delegateContractOwner address Owner of the delegate
    * @param delegateTradeWallet address Wallet the delegate will trade from
    * @param delegateProtocol bytes2 The protocol identifier for Delegate contracts
    */
  constructor(
    ISwap delegateSwap,
    IIndexer delegateIndexer,
    address delegateContractOwner,
    address delegateTradeWallet,
    bytes2 delegateProtocol
  ) public {
    swapContract = delegateSwap;
    indexer = delegateIndexer;
    protocol = delegateProtocol;
    // If no delegate owner is provided, the deploying address is the owner.
    if (delegateContractOwner != address(0)) {
      transferOwnership(delegateContractOwner);
    }
    // If no trade wallet is provided, the owner's wallet is the trade wallet.
    if (delegateTradeWallet != address(0)) {
      tradeWallet = delegateTradeWallet;
    } else {
      tradeWallet = owner();
    }
    // Ensure that the indexer can pull funds from delegate account.
    require(
      IERC20(indexer.stakingToken())
      .approve(address(indexer), MAX_INT), "STAKING_APPROVAL_FAILED"
    );
  }
  /**
    * @notice Set a Trading Rule
    * @dev only callable by the owner of the contract
    * @dev 1 senderToken = priceCoef * 10^(-priceExp) * signerToken
    * @param senderToken address Address of an ERC-20 token the delegate would send
    * @param signerToken address Address of an ERC-20 token the consumer would send
    * @param maxSenderAmount uint256 Maximum amount of ERC-20 token the delegate would send
    * @param priceCoef uint256 Whole number that will be multiplied by 10^(-priceExp) - the price coefficient
    * @param priceExp uint256 Exponent of the price to indicate location of the decimal priceCoef * 10^(-priceExp)
    */
  function setRule(
    address senderToken,
    address signerToken,
    uint256 maxSenderAmount,
    uint256 priceCoef,
    uint256 priceExp
  ) external onlyOwner {
    _setRule(
      senderToken,
      signerToken,
      maxSenderAmount,
      priceCoef,
      priceExp
    );
  }
  /**
    * @notice Unset a Trading Rule
    * @dev only callable by the owner of the contract, removes from a mapping
    * @param senderToken address Address of an ERC-20 token the delegate would send
    * @param signerToken address Address of an ERC-20 token the consumer would send
    */
  function unsetRule(
    address senderToken,
    address signerToken
  ) external onlyOwner {
    _unsetRule(
      senderToken,
      signerToken
    );
  }
  /**
    * @notice sets a rule on the delegate and an intent on the indexer
    * @dev only callable by owner
    * @dev delegate needs to be given allowance from msg.sender for the newStakeAmount
    * @dev swap needs to be given permission to move funds from the delegate
    * @param senderToken address Token the delgeate will send
    * @param signerToken address Token the delegate will receive
    * @param rule Rule Rule to set on a delegate
    * @param newStakeAmount uint256 Amount to stake for an intent
    */
  function setRuleAndIntent(
    address senderToken,
    address signerToken,
    Rule calldata rule,
    uint256 newStakeAmount
  ) external onlyOwner {
    _setRule(
      senderToken,
      signerToken,
      rule.maxSenderAmount,
      rule.priceCoef,
      rule.priceExp
    );
    // get currentAmount staked or 0 if never staked
    uint256 oldStakeAmount = indexer.getStakedAmount(address(this), signerToken, senderToken, protocol);
    if (oldStakeAmount == newStakeAmount && oldStakeAmount > 0) {
      return; // forgo trying to reset intent with non-zero same stake amount
    } else if (oldStakeAmount < newStakeAmount) {
      // transfer only the difference from the sender to the Delegate.
      require(
        IERC20(indexer.stakingToken())
        .transferFrom(msg.sender, address(this), newStakeAmount - oldStakeAmount), "STAKING_TRANSFER_FAILED"
      );
    }
    indexer.setIntent(
      signerToken,
      senderToken,
      protocol,
      newStakeAmount,
      bytes32(uint256(address(this)) << 96) //NOTE: this will pad 0's to the right
    );
    if (oldStakeAmount > newStakeAmount) {
      // return excess stake back
      require(
        IERC20(indexer.stakingToken())
        .transfer(msg.sender, oldStakeAmount - newStakeAmount), "STAKING_RETURN_FAILED"
      );
    }
  }
  /**
    * @notice unsets a rule on the delegate and removes an intent on the indexer
    * @dev only callable by owner
    * @param senderToken address Maker token in the token pair for rules and intents
    * @param signerToken address Taker token  in the token pair for rules and intents
    */
  function unsetRuleAndIntent(
    address senderToken,
    address signerToken
  ) external onlyOwner {
    _unsetRule(senderToken, signerToken);
    // Query the indexer for the amount staked.
    uint256 stakedAmount = indexer.getStakedAmount(address(this), signerToken, senderToken, protocol);
    indexer.unsetIntent(signerToken, senderToken, protocol);
    // Upon unstaking, the Delegate will be given the staking amount.
    // This is returned to the msg.sender.
    if (stakedAmount > 0) {
      require(
        IERC20(indexer.stakingToken())
          .transfer(msg.sender, stakedAmount),"STAKING_RETURN_FAILED"
      );
    }
  }
  /**
    * @notice Provide an Order
    * @dev Rules get reset with new maxSenderAmount
    * @param order Types.Order Order a user wants to submit to Swap.
    */
  function provideOrder(
    Types.Order calldata order
  ) external {
    Rule memory rule = rules[order.sender.token][order.signer.token];
    require(order.signature.v != 0,
      "SIGNATURE_MUST_BE_SENT");
    // Ensure the order is for the trade wallet.
    require(order.sender.wallet == tradeWallet,
      "SENDER_WALLET_INVALID");
    // Ensure the tokens are valid ERC20 tokens.
    require(order.signer.kind == ERC20_INTERFACE_ID,
      "SIGNER_KIND_MUST_BE_ERC20");
    require(order.sender.kind == ERC20_INTERFACE_ID,
      "SENDER_KIND_MUST_BE_ERC20");
    // Ensure that a rule exists.
    require(rule.maxSenderAmount != 0,
      "TOKEN_PAIR_INACTIVE");
    // Ensure the order does not exceed the maximum amount.
    require(order.sender.amount <= rule.maxSenderAmount,
      "AMOUNT_EXCEEDS_MAX");
    // Ensure the order is priced according to the rule.
    require(order.sender.amount <= _calculateSenderAmount(order.signer.amount, rule.priceCoef, rule.priceExp),
      "PRICE_INVALID");
    // Overwrite the rule with a decremented maxSenderAmount.
    rules[order.sender.token][order.signer.token] = Rule({
      maxSenderAmount: (rule.maxSenderAmount).sub(order.sender.amount),
      priceCoef: rule.priceCoef,
      priceExp: rule.priceExp
    });
    // Perform the swap.
    swapContract.swap(order);
    emit ProvideOrder(
      owner(),
      tradeWallet,
      order.sender.token,
      order.signer.token,
      order.sender.amount,
      rule.priceCoef,
      rule.priceExp
    );
  }
  /**
    * @notice Set a new trade wallet
    * @param newTradeWallet address Address of the new trade wallet
    */
  function setTradeWallet(address newTradeWallet) external onlyOwner {
    require(newTradeWallet != address(0), "TRADE_WALLET_REQUIRED");
    tradeWallet = newTradeWallet;
  }
  /**
    * @notice Get a Signer-Side Quote from the Delegate
    * @param senderAmount uint256 Amount of ERC-20 token the delegate would send
    * @param senderToken address Address of an ERC-20 token the delegate would send
    * @param signerToken address Address of an ERC-20 token the consumer would send
    * @return uint256 signerAmount Amount of ERC-20 token the consumer would send
    */
  function getSignerSideQuote(
    uint256 senderAmount,
    address senderToken,
    address signerToken
  ) external view returns (
    uint256 signerAmount
  ) {
    Rule memory rule = rules[senderToken][signerToken];
    // Ensure that a rule exists.
    if(rule.maxSenderAmount > 0) {
      // Ensure the senderAmount does not exceed maximum for the rule.
      if(senderAmount <= rule.maxSenderAmount) {
        signerAmount = _calculateSignerAmount(senderAmount, rule.priceCoef, rule.priceExp);
        // Return the quote.
        return signerAmount;
      }
    }
    return 0;
  }
  /**
    * @notice Get a Sender-Side Quote from the Delegate
    * @param signerAmount uint256 Amount of ERC-20 token the consumer would send
    * @param signerToken address Address of an ERC-20 token the consumer would send
    * @param senderToken address Address of an ERC-20 token the delegate would send
    * @return uint256 senderAmount Amount of ERC-20 token the delegate would send
    */
  function getSenderSideQuote(
    uint256 signerAmount,
    address signerToken,
    address senderToken
  ) external view returns (
    uint256 senderAmount
  ) {
    Rule memory rule = rules[senderToken][signerToken];
    // Ensure that a rule exists.
    if(rule.maxSenderAmount > 0) {
      // Calculate the senderAmount.
      senderAmount = _calculateSenderAmount(signerAmount, rule.priceCoef, rule.priceExp);
      // Ensure the senderAmount does not exceed the maximum trade amount.
      if(senderAmount <= rule.maxSenderAmount) {
        return senderAmount;
      }
    }
    return 0;
  }
  /**
    * @notice Get a Maximum Quote from the Delegate
    * @param senderToken address Address of an ERC-20 token the delegate would send
    * @param signerToken address Address of an ERC-20 token the consumer would send
    * @return uint256 senderAmount Amount the delegate would send
    * @return uint256 signerAmount Amount the consumer would send
    */
  function getMaxQuote(
    address senderToken,
    address signerToken
  ) external view returns (
    uint256 senderAmount,
    uint256 signerAmount
  ) {
    Rule memory rule = rules[senderToken][signerToken];
    senderAmount = rule.maxSenderAmount;
    // Ensure that a rule exists.
    if (senderAmount > 0) {
      // calculate the signerAmount
      signerAmount = _calculateSignerAmount(senderAmount, rule.priceCoef, rule.priceExp);
      // Return the maxSenderAmount and calculated signerAmount.
      return (
        senderAmount,
        signerAmount
      );
    }
    return (0, 0);
  }
  /**
    * @notice Set a Trading Rule
    * @dev only callable by the owner of the contract
    * @dev 1 senderToken = priceCoef * 10^(-priceExp) * signerToken
    * @param senderToken address Address of an ERC-20 token the delegate would send
    * @param signerToken address Address of an ERC-20 token the consumer would send
    * @param maxSenderAmount uint256 Maximum amount of ERC-20 token the delegate would send
    * @param priceCoef uint256 Whole number that will be multiplied by 10^(-priceExp) - the price coefficient
    * @param priceExp uint256 Exponent of the price to indicate location of the decimal priceCoef * 10^(-priceExp)
    */
  function _setRule(
    address senderToken,
    address signerToken,
    uint256 maxSenderAmount,
    uint256 priceCoef,
    uint256 priceExp
  ) internal {
    require(priceCoef > 0, "PRICE_COEF_INVALID");
    rules[senderToken][signerToken] = Rule({
      maxSenderAmount: maxSenderAmount,
      priceCoef: priceCoef,
      priceExp: priceExp
    });
    emit SetRule(
      owner(),
      senderToken,
      signerToken,
      maxSenderAmount,
      priceCoef,
      priceExp
    );
  }
  /**
    * @notice Unset a Trading Rule
    * @param senderToken address Address of an ERC-20 token the delegate would send
    * @param signerToken address Address of an ERC-20 token the consumer would send
    */
  function _unsetRule(
    address senderToken,
    address signerToken
  ) internal {
    // using non-zero rule.priceCoef for rule existence check
    if (rules[senderToken][signerToken].priceCoef > 0) {
      // Delete the rule.
      delete rules[senderToken][signerToken];
      emit UnsetRule(
        owner(),
        senderToken,
        signerToken
    );
    }
  }
  /**
    * @notice Calculate the signer amount for a given sender amount and price
    * @param senderAmount uint256 The amount the delegate would send in the swap
    * @param priceCoef uint256 Coefficient of the token price defined in the rule
    * @param priceExp uint256 Exponent of the token price defined in the rule
    */
  function _calculateSignerAmount(
    uint256 senderAmount,
    uint256 priceCoef,
    uint256 priceExp
  ) internal pure returns (
    uint256 signerAmount
  ) {
    // Calculate the signer amount using the price formula
    uint256 multiplier = senderAmount.mul(priceCoef);
    signerAmount = multiplier.div(10 ** priceExp);
    // If the div rounded down, round up
    if (multiplier.mod(10 ** priceExp) > 0) {
      signerAmount++;
    }
  }
  /**
    * @notice Calculate the sender amount for a given signer amount and price
    * @param signerAmount uint256 The amount the signer would send in the swap
    * @param priceCoef uint256 Coefficient of the token price defined in the rule
    * @param priceExp uint256 Exponent of the token price defined in the rule
    */
  function _calculateSenderAmount(
    uint256 signerAmount,
    uint256 priceCoef,
    uint256 priceExp
  ) internal pure returns (
    uint256 senderAmount
  ) {
    // Calculate the sender anount using the price formula
    senderAmount = signerAmount
      .mul(10 ** priceExp)
      .div(priceCoef);
  }
}
// File: @airswap/delegate/contracts/interfaces/IDelegateFactory.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
interface IDelegateFactory {
  event CreateDelegate(
    address indexed delegateContract,
    address swapContract,
    address indexerContract,
    address indexed delegateContractOwner,
    address delegateTradeWallet
  );
  /**
    * @notice Deploy a trusted delegate contract
    * @param delegateTradeWallet the wallet the delegate will trade from
    * @return delegateContractAddress address of the delegate contract created
    */
  function createDelegate(
    address delegateTradeWallet
  ) external returns (address delegateContractAddress);
}
// File: @airswap/indexer/contracts/interfaces/ILocatorWhitelist.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
interface ILocatorWhitelist {
  function has(
    bytes32 locator
  ) external view returns (bool);
}
// File: @airswap/delegate/contracts/DelegateFactory.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
contract DelegateFactory is IDelegateFactory, ILocatorWhitelist {
  // Mapping specifying whether an address was deployed by this factory
  mapping(address => bool) internal _deployedAddresses;
  // The swap and indexer contracts to use in the deployment of Delegates
  ISwap public swapContract;
  IIndexer public indexerContract;
  bytes2 public protocol;
  /**
    * @notice Create a new Delegate contract
    * @dev swapContract is unable to be changed after the factory sets it
    * @param factorySwapContract address Swap contract the delegate will deploy with
    * @param factoryIndexerContract address Indexer contract the delegate will deploy with
    * @param factoryProtocol bytes2 Protocol type of the delegates the factory deploys
    */
  constructor(
    ISwap factorySwapContract,
    IIndexer factoryIndexerContract,
    bytes2 factoryProtocol
  ) public {
    swapContract = factorySwapContract;
    indexerContract = factoryIndexerContract;
    protocol = factoryProtocol;
  }
  /**
    * @param delegateTradeWallet address Wallet the delegate will trade from
    * @return address delegateContractAddress Address of the delegate contract created
    */
  function createDelegate(
    address delegateTradeWallet
  ) external returns (address delegateContractAddress) {
    delegateContractAddress = address(
      new Delegate(swapContract, indexerContract, msg.sender, delegateTradeWallet, protocol)
    );
    _deployedAddresses[delegateContractAddress] = true;
    emit CreateDelegate(
      delegateContractAddress,
      address(swapContract),
      address(indexerContract),
      msg.sender,
      delegateTradeWallet
    );
    return delegateContractAddress;
  }
  /**
    * @notice To check whether a locator was deployed
    * @dev Implements ILocatorWhitelist.has
    * @param locator bytes32 Locator of the delegate in question
    * @return bool True if the delegate was deployed by this contract
    */
  function has(bytes32 locator) external view returns (bool) {
    return _deployedAddresses[address(bytes20(locator))];
  }
}
// File: @airswap/indexer/contracts/Index.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
  * @title Index: A List of Locators
  * @notice The Locators are sorted in reverse order based on the score
  * meaning that the first element in the list has the largest score
  * and final element has the smallest
  * @dev A mapping is used to mimic a circular linked list structure
  * where every mapping Entry contains a pointer to the next
  * and the previous
  */
contract Index is Ownable {
  // The number of entries in the index
  uint256 public length;
  // Identifier to use for the head of the list
  address constant internal HEAD = address(uint160(2**160-1));
  // Mapping of an identifier to its entry
  mapping(address => Entry) public entries;
  /**
    * @notice Index Entry
    * @param score uint256
    * @param locator bytes32
    * @param prev address Previous address in the linked list
    * @param next address Next address in the linked list
    */
  struct Entry {
    bytes32 locator;
    uint256 score;
    address prev;
    address next;
  }
  /**
    * @notice Contract Events
    */
  event SetLocator(
    address indexed identifier,
    uint256 score,
    bytes32 indexed locator
  );
  event UnsetLocator(
    address indexed identifier
  );
  /**
    * @notice Contract Constructor
    */
  constructor() public {
    // Create initial entry.
    entries[HEAD] = Entry(bytes32(0), 0, HEAD, HEAD);
  }
  /**
    * @notice Set a Locator
    * @param identifier address On-chain address identifying the owner of a locator
    * @param score uint256 Score for the locator being set
    * @param locator bytes32 Locator
    */
  function setLocator(
    address identifier,
    uint256 score,
    bytes32 locator
  ) external onlyOwner {
    // Ensure the entry does not already exist.
    require(!_hasEntry(identifier), "ENTRY_ALREADY_EXISTS");
    _setLocator(identifier, score, locator);
    // Increment the index length.
    length = length + 1;
    emit SetLocator(identifier, score, locator);
  }
  /**
    * @notice Unset a Locator
    * @param identifier address On-chain address identifying the owner of a locator
    */
  function unsetLocator(
    address identifier
  ) external onlyOwner {
    _unsetLocator(identifier);
    // Decrement the index length.
    length = length - 1;
    emit UnsetLocator(identifier);
  }
  /**
    * @notice Update a Locator
    * @dev score and/or locator do not need to be different from old values
    * @param identifier address On-chain address identifying the owner of a locator
    * @param score uint256 Score for the locator being set
    * @param locator bytes32 Locator
    */
  function updateLocator(
    address identifier,
    uint256 score,
    bytes32 locator
  ) external onlyOwner {
    // Don't need to update length as it is not used in set/unset logic
    _unsetLocator(identifier);
    _setLocator(identifier, score, locator);
    emit SetLocator(identifier, score, locator);
  }
  /**
    * @notice Get a Score
    * @param identifier address On-chain address identifying the owner of a locator
    * @return uint256 Score corresponding to the identifier
    */
  function getScore(
    address identifier
  ) external view returns (uint256) {
    return entries[identifier].score;
  }
    /**
    * @notice Get a Locator
    * @param identifier address On-chain address identifying the owner of a locator
    * @return bytes32 Locator information
    */
  function getLocator(
    address identifier
  ) external view returns (bytes32) {
    return entries[identifier].locator;
  }
  /**
    * @notice Get a Range of Locators
    * @dev start value of 0x0 starts at the head
    * @param cursor address Cursor to start with
    * @param limit uint256 Maximum number of locators to return
    * @return bytes32[] List of locators
    * @return uint256[] List of scores corresponding to locators
    * @return address The next cursor to provide for pagination
    */
  function getLocators(
    address cursor,
    uint256 limit
  ) external view returns (
    bytes32[] memory locators,
    uint256[] memory scores,
    address nextCursor
  ) {
    address identifier;
    // If a valid cursor is provided, start there.
    if (cursor != address(0) && cursor != HEAD) {
      // Check that the provided cursor exists.
      if (!_hasEntry(cursor)) {
        return (new bytes32[](0), new uint256[](0), address(0));
      }
      // Set the starting identifier to the provided cursor.
      identifier = cursor;
    } else {
      identifier = entries[HEAD].next;
    }
    // Although it's not known how many entries are between `cursor` and the end
    // We know that it is no more than `length`
    uint256 size = (length < limit) ? length : limit;
    locators = new bytes32[](size);
    scores = new uint256[](size);
    // Iterate over the list until the end or size.
    uint256 i;
    while (i < size && identifier != HEAD) {
      locators[i] = entries[identifier].locator;
      scores[i] = entries[identifier].score;
      i = i + 1;
      identifier = entries[identifier].next;
    }
    return (locators, scores, identifier);
  }
  /**
    * @notice Internal function to set a Locator
    * @param identifier address On-chain address identifying the owner of a locator
    * @param score uint256 Score for the locator being set
    * @param locator bytes32 Locator
    */
  function _setLocator(
    address identifier,
    uint256 score,
    bytes32 locator
  ) internal {
    // Disallow locator set to 0x0 to ensure list integrity.
    require(locator != bytes32(0), "LOCATOR_MUST_BE_SENT");
    // Find the first entry with a lower score.
    address nextEntry = _getEntryLowerThan(score);
    // Link the new entry between previous and next.
    address prevEntry = entries[nextEntry].prev;
    entries[prevEntry].next = identifier;
    entries[nextEntry].prev = identifier;
    entries[identifier] = Entry(locator, score, prevEntry, nextEntry);
  }
  /**
    * @notice Internal function to unset a Locator
    * @param identifier address On-chain address identifying the owner of a locator
    */
  function _unsetLocator(
    address identifier
  ) internal {
    // Ensure the entry exists.
    require(_hasEntry(identifier), "ENTRY_DOES_NOT_EXIST");
    // Link the previous and next entries together.
    address prevUser = entries[identifier].prev;
    address nextUser = entries[identifier].next;
    entries[prevUser].next = nextUser;
    entries[nextUser].prev = prevUser;
    // Delete entry from the index.
    delete entries[identifier];
  }
  /**
    * @notice Check if the Index has an Entry
    * @param identifier address On-chain address identifying the owner of a locator
    * @return bool True if the identifier corresponds to an Entry in the list
    */
  function _hasEntry(
    address identifier
  ) internal view returns (bool) {
    return entries[identifier].locator != bytes32(0);
  }
  /**
    * @notice Returns the largest scoring Entry Lower than a Score
    * @param score uint256 Score in question
    * @return address Identifier of the largest score lower than score
    */
  function _getEntryLowerThan(
    uint256 score
  ) internal view returns (address) {
    address identifier = entries[HEAD].next;
    // Head indicates last because the list is circular.
    if (score == 0) {
      return HEAD;
    }
    // Iterate until a lower score is found.
    while (score <= entries[identifier].score) {
      identifier = entries[identifier].next;
    }
    return identifier;
  }
}
// File: @airswap/indexer/contracts/Indexer.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
  * @title Indexer: A Collection of Index contracts by Token Pair
  */
contract Indexer is IIndexer, Ownable {
  // Token to be used for staking (ERC-20)
  IERC20 public stakingToken;
  // Mapping of signer token to sender token to protocol type to index
  mapping (address => mapping (address => mapping (bytes2 => Index))) public indexes;
  // The whitelist contract for checking whether a peer is whitelisted per peer type
  mapping (bytes2 => address) public locatorWhitelists;
  // Mapping of token address to boolean
  mapping (address => bool) public tokenBlacklist;
  /**
    * @notice Contract Constructor
    * @param indexerStakingToken address
    */
  constructor(
    address indexerStakingToken
  ) public {
    stakingToken = IERC20(indexerStakingToken);
  }
  /**
    * @notice Modifier to check an index exists
    */
  modifier indexExists(address signerToken, address senderToken, bytes2 protocol) {
    require(indexes[signerToken][senderToken][protocol] != Index(0),
      "INDEX_DOES_NOT_EXIST");
    _;
  }
  /**
    * @notice Set the address of an ILocatorWhitelist to use
    * @dev Allows removal of locatorWhitelist by passing 0x0
    * @param protocol bytes2 Protocol type for locators
    * @param newLocatorWhitelist address Locator whitelist
    */
  function setLocatorWhitelist(
    bytes2 protocol,
    address newLocatorWhitelist
  ) external onlyOwner {
    locatorWhitelists[protocol] = newLocatorWhitelist;
  }
  /**
    * @notice Create an Index (List of Locators for a Token Pair)
    * @dev Deploys a new Index contract and stores the address. If the Index already
    * @dev exists, returns its address, and does not emit a CreateIndex event
    * @param signerToken address Signer token for the Index
    * @param senderToken address Sender token for the Index
    * @param protocol bytes2 Protocol type for locators in Index
    */
  function createIndex(
    address signerToken,
    address senderToken,
    bytes2 protocol
  ) external returns (address) {
    // If the Index does not exist, create it.
    if (indexes[signerToken][senderToken][protocol] == Index(0)) {
      // Create a new Index contract for the token pair.
      indexes[signerToken][senderToken][protocol] = new Index();
      emit CreateIndex(signerToken, senderToken, protocol, address(indexes[signerToken][senderToken][protocol]));
    }
    // Return the address of the Index contract.
    return address(indexes[signerToken][senderToken][protocol]);
  }
  /**
    * @notice Add a Token to the Blacklist
    * @param token address Token to blacklist
    */
  function addTokenToBlacklist(
    address token
  ) external onlyOwner {
    if (!tokenBlacklist[token]) {
      tokenBlacklist[token] = true;
      emit AddTokenToBlacklist(token);
    }
  }
  /**
    * @notice Remove a Token from the Blacklist
    * @param token address Token to remove from the blacklist
    */
  function removeTokenFromBlacklist(
    address token
  ) external onlyOwner {
    if (tokenBlacklist[token]) {
      tokenBlacklist[token] = false;
      emit RemoveTokenFromBlacklist(token);
    }
  }
  /**
    * @notice Set an Intent to Trade
    * @dev Requires approval to transfer staking token for sender
    *
    * @param signerToken address Signer token of the Index being staked
    * @param senderToken address Sender token of the Index being staked
    * @param protocol bytes2 Protocol type for locator in Intent
    * @param stakingAmount uint256 Amount being staked
    * @param locator bytes32 Locator of the staker
    */
  function setIntent(
    address signerToken,
    address senderToken,
    bytes2 protocol,
    uint256 stakingAmount,
    bytes32 locator
  ) external indexExists(signerToken, senderToken, protocol) {
    // If whitelist set, ensure the locator is valid.
    if (locatorWhitelists[protocol] != address(0)) {
      require(ILocatorWhitelist(locatorWhitelists[protocol]).has(locator),
      "LOCATOR_NOT_WHITELISTED");
    }
    // Ensure neither of the tokens are blacklisted.
    require(!tokenBlacklist[signerToken] && !tokenBlacklist[senderToken],
      "PAIR_IS_BLACKLISTED");
    bool notPreviouslySet = (indexes[signerToken][senderToken][protocol].getLocator(msg.sender) == bytes32(0));
    if (notPreviouslySet) {
      // Only transfer for staking if stakingAmount is set.
      if (stakingAmount > 0) {
        // Transfer the stakingAmount for staking.
        require(stakingToken.transferFrom(msg.sender, address(this), stakingAmount),
          "STAKING_FAILED");
      }
      // Set the locator on the index.
      indexes[signerToken][senderToken][protocol].setLocator(msg.sender, stakingAmount, locator);
      emit Stake(msg.sender, signerToken, senderToken, protocol, stakingAmount);
    } else {
      uint256 oldStake = indexes[signerToken][senderToken][protocol].getScore(msg.sender);
      _updateIntent(msg.sender, signerToken, senderToken, protocol, stakingAmount, locator, oldStake);
    }
  }
  /**
    * @notice Unset an Intent to Trade
    * @dev Users are allowed to unstake from blacklisted indexes
    *
    * @param signerToken address Signer token of the Index being unstaked
    * @param senderToken address Sender token of the Index being staked
    * @param protocol bytes2 Protocol type for locators in Intent
    */
  function unsetIntent(
    address signerToken,
    address senderToken,
    bytes2 protocol
  ) external {
    _unsetIntent(msg.sender, signerToken, senderToken, protocol);
  }
  /**
    * @notice Get the locators of those trading a token pair
    * @dev Users are allowed to unstake from blacklisted indexes
    *
    * @param signerToken address Signer token of the trading pair
    * @param senderToken address Sender token of the trading pair
    * @param protocol bytes2 Protocol type for locators in Intent
    * @param cursor address Address to start from
    * @param limit uint256 Total number of locators to return
    * @return bytes32[] List of locators
    * @return uint256[] List of scores corresponding to locators
    * @return address The next cursor to provide for pagination
    */
  function getLocators(
    address signerToken,
    address senderToken,
    bytes2 protocol,
    address cursor,
    uint256 limit
  ) external view returns (
    bytes32[] memory locators,
    uint256[] memory scores,
    address nextCursor
  ) {
    // Ensure neither token is blacklisted.
    if (tokenBlacklist[signerToken] || tokenBlacklist[senderToken]) {
      return (new bytes32[](0), new uint256[](0), address(0));
    }
    // Ensure the index exists.
    if (indexes[signerToken][senderToken][protocol] == Index(0)) {
      return (new bytes32[](0), new uint256[](0), address(0));
    }
    return indexes[signerToken][senderToken][protocol].getLocators(cursor, limit);
  }
  /**
    * @notice Gets the Stake Amount for a User
    * @param user address User who staked
    * @param signerToken address Signer token the user staked on
    * @param senderToken address Sender token the user staked on
    * @param protocol bytes2 Protocol type for locators in Intent
    * @return uint256 Amount the user staked
    */
  function getStakedAmount(
    address user,
    address signerToken,
    address senderToken,
    bytes2 protocol
  ) public view returns (uint256 stakedAmount) {
    if (indexes[signerToken][senderToken][protocol] == Index(0)) {
      return 0;
    }
    // Return the score, equivalent to the stake amount.
    return indexes[signerToken][senderToken][protocol].getScore(user);
  }
  function _updateIntent(
    address user,
    address signerToken,
    address senderToken,
    bytes2 protocol,
    uint256 newAmount,
    bytes32 newLocator,
    uint256 oldAmount
  ) internal {
    // If the new stake is bigger, collect the difference.
    if (oldAmount < newAmount) {
      // Note: SafeMath not required due to the inequality check above
      require(stakingToken.transferFrom(user, address(this), newAmount - oldAmount),
        "STAKING_FAILED");
    }
    // If the old stake is bigger, return the excess.
    if (newAmount < oldAmount) {
      // Note: SafeMath not required due to the inequality check above
      require(stakingToken.transfer(user, oldAmount - newAmount));
    }
    // Update their intent.
    indexes[signerToken][senderToken][protocol].updateLocator(user, newAmount, newLocator);
    emit Stake(user, signerToken, senderToken, protocol, newAmount);
  }
  /**
    * @notice Unset intents and return staked tokens
    * @param user address Address of the user who staked
    * @param signerToken address Signer token of the trading pair
    * @param senderToken address Sender token of the trading pair
    * @param protocol bytes2 Protocol type for locators in Intent
    */
  function _unsetIntent(
    address user,
    address signerToken,
    address senderToken,
    bytes2 protocol
  ) internal indexExists(signerToken, senderToken, protocol) {
     // Get the score for the user.
    uint256 score = indexes[signerToken][senderToken][protocol].getScore(user);
    // Unset the locator on the index.
    indexes[signerToken][senderToken][protocol].unsetLocator(user);
    if (score > 0) {
      // Return the staked tokens. Reverts on failure.
      require(stakingToken.transfer(user, score));
    }
    emit Unstake(user, signerToken, senderToken, protocol, score);
  }
}
// File: @airswap/swap/contracts/Swap.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
  * @title Swap: The Atomic Swap used on the AirSwap Network
  */
contract Swap is ISwap {
  // Domain and version for use in signatures (EIP-712)
  bytes constant internal DOMAIN_NAME = "SWAP";
  bytes constant internal DOMAIN_VERSION = "2";
  // Unique domain identifier for use in signatures (EIP-712)
  bytes32 private _domainSeparator;
  // Possible nonce statuses
  byte constant internal AVAILABLE = 0x00;
  byte constant internal UNAVAILABLE = 0x01;
  // Mapping of sender address to a delegated sender address and bool
  mapping (address => mapping (address => bool)) public senderAuthorizations;
  // Mapping of signer address to a delegated signer and bool
  mapping (address => mapping (address => bool)) public signerAuthorizations;
  // Mapping of signers to nonces with value AVAILABLE (0x00) or UNAVAILABLE (0x01)
  mapping (address => mapping (uint256 => byte)) public signerNonceStatus;
  // Mapping of signer addresses to an optionally set minimum valid nonce
  mapping (address => uint256) public signerMinimumNonce;
  // A registry storing a transfer handler for different token kinds
  TransferHandlerRegistry public registry;
  /**
    * @notice Contract Constructor
    * @dev Sets domain for signature validation (EIP-712)
    * @param swapRegistry TransferHandlerRegistry
    */
  constructor(TransferHandlerRegistry swapRegistry) public {
    _domainSeparator = Types.hashDomain(
      DOMAIN_NAME,
      DOMAIN_VERSION,
      address(this)
    );
    registry = swapRegistry;
  }
  /**
    * @notice Atomic Token Swap
    * @param order Types.Order Order to settle
    */
  function swap(
    Types.Order calldata order
  ) external {
    // Ensure the order is not expired.
    require(order.expiry > block.timestamp,
      "ORDER_EXPIRED");
    // Ensure the nonce is AVAILABLE (0x00).
    require(signerNonceStatus[order.signer.wallet][order.nonce] == AVAILABLE,
      "ORDER_TAKEN_OR_CANCELLED");
    // Ensure the order nonce is above the minimum.
    require(order.nonce >= signerMinimumNonce[order.signer.wallet],
      "NONCE_TOO_LOW");
    // Mark the nonce UNAVAILABLE (0x01).
    signerNonceStatus[order.signer.wallet][order.nonce] = UNAVAILABLE;
    // Validate the sender side of the trade.
    address finalSenderWallet;
    if (order.sender.wallet == address(0)) {
      /**
        * Sender is not specified. The msg.sender of the transaction becomes
        * the sender of the order.
        */
      finalSenderWallet = msg.sender;
    } else {
      /**
        * Sender is specified. If the msg.sender is not the specified sender,
        * this determines whether the msg.sender is an authorized sender.
        */
      require(isSenderAuthorized(order.sender.wallet, msg.sender),
          "SENDER_UNAUTHORIZED");
      // The msg.sender is authorized.
      finalSenderWallet = order.sender.wallet;
    }
    // Validate the signer side of the trade.
    if (order.signature.v == 0) {
      /**
        * Signature is not provided. The signer may have authorized the
        * msg.sender to swap on its behalf, which does not require a signature.
        */
      require(isSignerAuthorized(order.signer.wallet, msg.sender),
        "SIGNER_UNAUTHORIZED");
    } else {
      /**
        * The signature is provided. Determine whether the signer is
        * authorized and if so validate the signature itself.
        */
      require(isSignerAuthorized(order.signer.wallet, order.signature.signatory),
        "SIGNER_UNAUTHORIZED");
      // Ensure the signature is valid.
      require(isValid(order, _domainSeparator),
        "SIGNATURE_INVALID");
    }
    // Transfer token from sender to signer.
    transferToken(
      finalSenderWallet,
      order.signer.wallet,
      order.sender.amount,
      order.sender.id,
      order.sender.token,
      order.sender.kind
    );
    // Transfer token from signer to sender.
    transferToken(
      order.signer.wallet,
      finalSenderWallet,
      order.signer.amount,
      order.signer.id,
      order.signer.token,
      order.signer.kind
    );
    // Transfer token from signer to affiliate if specified.
    if (order.affiliate.token != address(0)) {
      transferToken(
        order.signer.wallet,
        order.affiliate.wallet,
        order.affiliate.amount,
        order.affiliate.id,
        order.affiliate.token,
        order.affiliate.kind
      );
    }
    emit Swap(
      order.nonce,
      block.timestamp,
      order.signer.wallet,
      order.signer.amount,
      order.signer.id,
      order.signer.token,
      finalSenderWallet,
      order.sender.amount,
      order.sender.id,
      order.sender.token,
      order.affiliate.wallet,
      order.affiliate.amount,
      order.affiliate.id,
      order.affiliate.token
    );
  }
  /**
    * @notice Cancel one or more open orders by nonce
    * @dev Cancelled nonces are marked UNAVAILABLE (0x01)
    * @dev Emits a Cancel event
    * @dev Out of gas may occur in arrays of length > 400
    * @param nonces uint256[] List of nonces to cancel
    */
  function cancel(
    uint256[] calldata nonces
  ) external {
    for (uint256 i = 0; i < nonces.length; i++) {
      if (signerNonceStatus[msg.sender][nonces[i]] == AVAILABLE) {
        signerNonceStatus[msg.sender][nonces[i]] = UNAVAILABLE;
        emit Cancel(nonces[i], msg.sender);
      }
    }
  }
  /**
    * @notice Cancels all orders below a nonce value
    * @dev Emits a CancelUpTo event
    * @param minimumNonce uint256 Minimum valid nonce
    */
  function cancelUpTo(
    uint256 minimumNonce
  ) external {
    signerMinimumNonce[msg.sender] = minimumNonce;
    emit CancelUpTo(minimumNonce, msg.sender);
  }
  /**
    * @notice Authorize a delegated sender
    * @dev Emits an AuthorizeSender event
    * @param authorizedSender address Address to authorize
    */
  function authorizeSender(
    address authorizedSender
  ) external {
    require(msg.sender != authorizedSender, "SELF_AUTH_INVALID");
    if (!senderAuthorizations[msg.sender][authorizedSender]) {
      senderAuthorizations[msg.sender][authorizedSender] = true;
      emit AuthorizeSender(msg.sender, authorizedSender);
    }
  }
  /**
    * @notice Authorize a delegated signer
    * @dev Emits an AuthorizeSigner event
    * @param authorizedSigner address Address to authorize
    */
  function authorizeSigner(
    address authorizedSigner
  ) external {
    require(msg.sender != authorizedSigner, "SELF_AUTH_INVALID");
    if (!signerAuthorizations[msg.sender][authorizedSigner]) {
      signerAuthorizations[msg.sender][authorizedSigner] = true;
      emit AuthorizeSigner(msg.sender, authorizedSigner);
    }
  }
  /**
    * @notice Revoke an authorized sender
    * @dev Emits a RevokeSender event
    * @param authorizedSender address Address to revoke
    */
  function revokeSender(
    address authorizedSender
  ) external {
    if (senderAuthorizations[msg.sender][authorizedSender]) {
      delete senderAuthorizations[msg.sender][authorizedSender];
      emit RevokeSender(msg.sender, authorizedSender);
    }
  }
  /**
    * @notice Revoke an authorized signer
    * @dev Emits a RevokeSigner event
    * @param authorizedSigner address Address to revoke
    */
  function revokeSigner(
    address authorizedSigner
  ) external {
    if (signerAuthorizations[msg.sender][authorizedSigner]) {
      delete signerAuthorizations[msg.sender][authorizedSigner];
      emit RevokeSigner(msg.sender, authorizedSigner);
    }
  }
  /**
    * @notice Determine whether a sender delegate is authorized
    * @param authorizer address Address doing the authorization
    * @param delegate address Address being authorized
    * @return bool True if a delegate is authorized to send
    */
  function isSenderAuthorized(
    address authorizer,
    address delegate
  ) internal view returns (bool) {
    return ((authorizer == delegate) ||
      senderAuthorizations[authorizer][delegate]);
  }
  /**
    * @notice Determine whether a signer delegate is authorized
    * @param authorizer address Address doing the authorization
    * @param delegate address Address being authorized
    * @return bool True if a delegate is authorized to sign
    */
  function isSignerAuthorized(
    address authorizer,
    address delegate
  ) internal view returns (bool) {
    return ((authorizer == delegate) ||
      signerAuthorizations[authorizer][delegate]);
  }
  /**
    * @notice Validate signature using an EIP-712 typed data hash
    * @param order Types.Order Order to validate
    * @param domainSeparator bytes32 Domain identifier used in signatures (EIP-712)
    * @return bool True if order has a valid signature
    */
  function isValid(
    Types.Order memory order,
    bytes32 domainSeparator
  ) internal pure returns (bool) {
    if (order.signature.version == byte(0x01)) {
      return order.signature.signatory == ecrecover(
        Types.hashOrder(
          order,
          domainSeparator
        ),
        order.signature.v,
        order.signature.r,
        order.signature.s
      );
    }
    if (order.signature.version == byte(0x45)) {
      return order.signature.signatory == ecrecover(
        keccak256(
          abi.encodePacked(
            "\x19Ethereum Signed Message:\n32",
            Types.hashOrder(order, domainSeparator)
          )
        ),
        order.signature.v,
        order.signature.r,
        order.signature.s
      );
    }
    return false;
  }
  /**
    * @notice Perform token transfer for tokens in registry
    * @dev Transfer type specified by the bytes4 kind param
    * @dev ERC721: uses transferFrom for transfer
    * @dev ERC20: Takes into account non-standard ERC-20 tokens.
    * @param from address Wallet address to transfer from
    * @param to address Wallet address to transfer to
    * @param amount uint256 Amount for ERC-20
    * @param id token ID for ERC-721
    * @param token address Contract address of token
    * @param kind bytes4 EIP-165 interface ID of the token
    */
  function transferToken(
      address from,
      address to,
      uint256 amount,
      uint256 id,
      address token,
      bytes4 kind
  ) internal {
    // Ensure the transfer is not to self.
    require(from != to, "SELF_TRANSFER_INVALID");
    ITransferHandler transferHandler = registry.transferHandlers(kind);
    require(address(transferHandler) != address(0), "TOKEN_KIND_UNKNOWN");
    // delegatecall required to pass msg.sender as Swap contract to handle the
    // token transfer in the calling contract
    (bool success, bytes memory data) = address(transferHandler).
      delegatecall(abi.encodeWithSelector(
        transferHandler.transferTokens.selector,
        from,
        to,
        amount,
        id,
        token
    ));
    require(success && abi.decode(data, (bool)), "TRANSFER_FAILED");
  }
}
// File: @airswap/tokens/contracts/interfaces/IWETH.sol
interface IWETH {
  function deposit() external payable;
  function withdraw(uint256) external;
  function totalSupply() external view returns (uint256);
  function balanceOf(address account) external view returns (uint256);
  function transfer(address recipient, uint256 amount) external returns (bool);
  function allowance(address owner, address spender) external view returns (uint256);
  function approve(address spender, uint256 amount) external returns (bool);
  function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @airswap/wrapper/contracts/Wrapper.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
  * @title Wrapper: Send and receive ether for WETH trades
  */
contract Wrapper {
  // The Swap contract to settle trades
  ISwap public swapContract;
  // The WETH contract to wrap ether
  IWETH public wethContract;
  /**
    * @notice Contract Constructor
    * @param wrapperSwapContract address
    * @param wrapperWethContract address
    */
  constructor(
    address wrapperSwapContract,
    address wrapperWethContract
  ) public {
    swapContract = ISwap(wrapperSwapContract);
    wethContract = IWETH(wrapperWethContract);
  }
  /**
    * @notice Required when withdrawing from WETH
    * @dev During unwraps, WETH.withdraw transfers ether to msg.sender (this contract)
    */
  function() external payable {
    // Ensure the message sender is the WETH contract.
    if(msg.sender != address(wethContract)) {
      revert("DO_NOT_SEND_ETHER");
    }
  }
  /**
    * @notice Send an Order to be forwarded to Swap
    * @dev Sender must authorize this contract on the swapContract
    * @dev Sender must approve this contract on the wethContract
    * @param order Types.Order The Order
    */
  function swap(
    Types.Order calldata order
  ) external payable {
    // Ensure msg.sender is sender wallet.
    require(order.sender.wallet == msg.sender,
      "MSG_SENDER_MUST_BE_ORDER_SENDER");
    // Ensure that the signature is present.
    // The signature will be explicitly checked in Swap.
    require(order.signature.v != 0,
      "SIGNATURE_MUST_BE_SENT");
    // Wraps ETH to WETH when the sender provides ETH and the order is WETH
    _wrapEther(order.sender);
    // Perform the swap.
    swapContract.swap(order);
    // Unwraps WETH to ETH when the sender receives WETH
    _unwrapEther(order.sender.wallet, order.signer.token, order.signer.amount);
  }
  /**
    * @notice Send an Order to be forwarded to a Delegate
    * @dev Sender must authorize the Delegate contract on the swapContract
    * @dev Sender must approve this contract on the wethContract
    * @dev Delegate's tradeWallet must be order.sender - checked in Delegate
    * @param order Types.Order The Order
    * @param delegate IDelegate The Delegate to provide the order to
    */
  function provideDelegateOrder(
    Types.Order calldata order,
    IDelegate delegate
  ) external payable {
    // Ensure that the signature is present.
    // The signature will be explicitly checked in Swap.
    require(order.signature.v != 0,
      "SIGNATURE_MUST_BE_SENT");
    // Wraps ETH to WETH when the signer provides ETH and the order is WETH
    _wrapEther(order.signer);
    // Provide the order to the Delegate.
    delegate.provideOrder(order);
    // Unwraps WETH to ETH when the signer receives WETH
    _unwrapEther(order.signer.wallet, order.sender.token, order.sender.amount);
  }
  /**
    * @notice Wraps ETH to WETH when a trade requires it
    * @param party Types.Party The side of the trade that may need wrapping
    */
  function _wrapEther(Types.Party memory party) internal {
    // Check whether ether needs wrapping
    if (party.token == address(wethContract)) {
      // Ensure message value is param.
      require(party.amount == msg.value,
        "VALUE_MUST_BE_SENT");
      // Wrap (deposit) the ether.
      wethContract.deposit.value(msg.value)();
      // Transfer the WETH from the wrapper to party.
      // Return value not checked - WETH throws on error and does not return false
      wethContract.transfer(party.wallet, party.amount);
    } else {
      // Ensure no unexpected ether is sent.
      require(msg.value == 0,
        "VALUE_MUST_BE_ZERO");
    }
  }
  /**
    * @notice Unwraps WETH to ETH when a trade requires it
    * @dev The unwrapping only succeeds if recipientWallet has approved transferFrom
    * @param recipientWallet address The trade recipient, who may have received WETH
    * @param receivingToken address The token address the recipient received
    * @param amount uint256 The amount of token the recipient received
    */
  function _unwrapEther(address recipientWallet, address receivingToken, uint256 amount) internal {
    // Check whether ether needs unwrapping
    if (receivingToken == address(wethContract)) {
      // Transfer weth from the recipient to the wrapper.
      wethContract.transferFrom(recipientWallet, address(this), amount);
      // Unwrap (withdraw) the ether.
      wethContract.withdraw(amount);
      // Transfer ether to the recipient.
      // solium-disable-next-line security/no-call-value
      (bool success, ) = recipientWallet.call.value(amount)("");
      require(success, "ETH_RETURN_FAILED");
    }
  }
}
// File: openzeppelin-solidity/contracts/introspection/IERC165.sol
/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @airswap/tokens/contracts/interfaces/IERC1155.sol
/**
 *
 * Copied from OpenZeppelin ERC1155 feature branch from (20642cca30fa18fb167df6db1889b558742d189a)
 * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/feature-erc1155/contracts/token/ERC1155/ERC1155.sol
 */
/**
    @title ERC-1155 Multi Token Standard basic interface
    @dev See https://eips.ethereum.org/EIPS/eip-1155
 */
contract IERC1155 is IERC165 {
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
    event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);
    event URI(string value, uint256 indexed id);
    function balanceOf(address account, uint256 id) public view returns (uint256);
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view returns (uint256[] memory);
    function setApprovalForAll(address operator, bool approved) external;
    function isApprovedForAll(address account, address operator) external view returns (bool);
    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
    function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data) external;
}
// File: @airswap/transfers/contracts/handlers/ERC1155TransferHandler.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
contract ERC1155TransferHandler is ITransferHandler {
 /**
  * @notice Function to wrap safeTransferFrom for ERC1155
  * @param from address Wallet address to transfer from
  * @param to address Wallet address to transfer to
  * @param amount uint256 Amount for ERC-1155
  * @param id uint256 token ID for ERC-1155
  * @param token address Contract address of token
  * @return bool on success of the token transfer
  */
  function transferTokens(
    address from,
    address to,
    uint256 amount,
    uint256 id,
    address token
  ) external returns (bool) {
    IERC1155(token).safeTransferFrom(
      from,
      to,
      id,
      amount,
      "" // bytes are empty
    );
    return true;
  }
}
// File: openzeppelin-solidity/contracts/utils/Address.sol
/**
 * @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.
     *
     * IMPORTANT: 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.
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != 0x0 && codehash != accountHash);
    }
    /**
     * @dev Converts an `address` into `address payable`. Note that this is
     * simply a type cast: the actual underlying value is not changed.
     *
     * _Available since v2.4.0._
     */
    function toPayable(address account) internal pure returns (address payable) {
        return address(uint160(account));
    }
    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     *
     * _Available since v2.4.0._
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");
        // solhint-disable-next-line avoid-call-value
        (bool success, ) = recipient.call.value(amount)("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }
}
// File: openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol
/**
 * @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, "SafeERC20: decreased allowance below zero");
        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: @airswap/transfers/contracts/handlers/ERC20TransferHandler.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
contract ERC20TransferHandler is ITransferHandler {
  using SafeERC20 for IERC20;
 /**
  * @notice Function to wrap safeTransferFrom for ERC20
  * @param from address Wallet address to transfer from
  * @param to address Wallet address to transfer to
  * @param amount uint256 Amount for ERC-20
  * @param id uint256 ID, must be 0 for this contract
  * @param token address Contract address of token
  * @return bool on success of the token transfer
  */
  function transferTokens(
    address from,
    address to,
    uint256 amount,
    uint256 id,
    address token
  ) external returns (bool) {
    require(id == 0, "ID_INVALID");
    IERC20(token).safeTransferFrom(from, to, amount);
    return true;
  }
}
// File: openzeppelin-solidity/contracts/token/ERC721/IERC721.sol
/**
 * @dev Required interface of an ERC721 compliant contract.
 */
contract IERC721 is IERC165 {
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
    /**
     * @dev Returns the number of NFTs in `owner`'s account.
     */
    function balanceOf(address owner) public view returns (uint256 balance);
    /**
     * @dev Returns the owner of the NFT specified by `tokenId`.
     */
    function ownerOf(uint256 tokenId) public view returns (address owner);
    /**
     * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
     * another (`to`).
     *
     *
     *
     * Requirements:
     * - `from`, `to` cannot be zero.
     * - `tokenId` must be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this
     * NFT by either {approve} or {setApprovalForAll}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public;
    /**
     * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
     * another (`to`).
     *
     * Requirements:
     * - If the caller is not `from`, it must be approved to move this NFT by
     * either {approve} or {setApprovalForAll}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public;
    function approve(address to, uint256 tokenId) public;
    function getApproved(uint256 tokenId) public view returns (address operator);
    function setApprovalForAll(address operator, bool _approved) public;
    function isApprovedForAll(address owner, address operator) public view returns (bool);
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
}
// File: @airswap/transfers/contracts/handlers/ERC721TransferHandler.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
contract ERC721TransferHandler is ITransferHandler {
 /**
  * @notice Function to wrap safeTransferFrom for ERC721
  * @param from address Wallet address to transfer from
  * @param to address Wallet address to transfer to
  * @param amount uint256, must be 0 for this contract
  * @param id uint256 ID for ERC721
  * @param token address Contract address of token
  * @return bool on success of the token transfer
  */
  function transferTokens(
    address from,
    address to,
    uint256 amount,
    uint256 id,
    address token)
  external returns (bool) {
    require(amount == 0, "AMOUNT_INVALID");
    IERC721(token).safeTransferFrom(from, to, id);
    return true;
  }
}
// File: @airswap/transfers/contracts/interfaces/IKittyCoreTokenTransfer.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
/**
 * @title IKittyCoreTokenTransfer
 * @dev transferFrom function from KittyCore
 */
contract IKittyCoreTokenTransfer {
  function transferFrom(address from, address to, uint256 tokenId) external;
}
// File: @airswap/transfers/contracts/handlers/KittyCoreTransferHandler.sol
/*
  Copyright 2020 Swap Holdings Ltd.
  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.
*/
contract KittyCoreTransferHandler is ITransferHandler {
 /**
  * @notice Function to wrap transferFrom for CKitty
  * @param from address Wallet address to transfer from
  * @param to address Wallet address to transfer to
  * @param amount uint256, must be 0 for this contract
  * @param id uint256 ID for ERC721
  * @param token address Contract address of token
  * @return bool on success of the token transfer
  */
  function transferTokens(
    address from,
    address to,
    uint256 amount,
    uint256 id,
    address token
  ) external returns (bool) {
    require(amount == 0, "AMOUNT_INVALID");
    IKittyCoreTokenTransfer(token).transferFrom(from, to, id);
    return true;
  }
}
// File: contracts/Imports.sol
//Import all the contracts desired to be deployed
contract Imports {}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract TransferHandlerRegistry","name":"swapRegistry","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizerAddress","type":"address"},{"indexed":true,"internalType":"address","name":"authorizedSender","type":"address"}],"name":"AuthorizeSender","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizerAddress","type":"address"},{"indexed":true,"internalType":"address","name":"authorizedSigner","type":"address"}],"name":"AuthorizeSigner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":true,"internalType":"address","name":"signerWallet","type":"address"}],"name":"Cancel","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":true,"internalType":"address","name":"signerWallet","type":"address"}],"name":"CancelUpTo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizerAddress","type":"address"},{"indexed":true,"internalType":"address","name":"revokedSender","type":"address"}],"name":"RevokeSender","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizerAddress","type":"address"},{"indexed":true,"internalType":"address","name":"revokedSigner","type":"address"}],"name":"RevokeSigner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":true,"internalType":"address","name":"signerWallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"signerAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"signerId","type":"uint256"},{"indexed":false,"internalType":"address","name":"signerToken","type":"address"},{"indexed":true,"internalType":"address","name":"senderWallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"senderAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"senderId","type":"uint256"},{"indexed":false,"internalType":"address","name":"senderToken","type":"address"},{"indexed":false,"internalType":"address","name":"affiliateWallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"affiliateAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"affiliateId","type":"uint256"},{"indexed":false,"internalType":"address","name":"affiliateToken","type":"address"}],"name":"Swap","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"authorizedSender","type":"address"}],"name":"authorizeSender","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"authorizedSigner","type":"address"}],"name":"authorizeSigner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256[]","name":"nonces","type":"uint256[]"}],"name":"cancel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"minimumNonce","type":"uint256"}],"name":"cancelUpTo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"internalType":"contract TransferHandlerRegistry","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"authorizedSender","type":"address"}],"name":"revokeSender","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"authorizedSigner","type":"address"}],"name":"revokeSigner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"senderAuthorizations","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"signerAuthorizations","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"signerMinimumNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"signerNonceStatus","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"components":[{"internalType":"bytes4","name":"kind","type":"bytes4"},{"internalType":"address","name":"wallet","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"id","type":"uint256"}],"internalType":"struct Types.Party","name":"signer","type":"tuple"},{"components":[{"internalType":"bytes4","name":"kind","type":"bytes4"},{"internalType":"address","name":"wallet","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"id","type":"uint256"}],"internalType":"struct Types.Party","name":"sender","type":"tuple"},{"components":[{"internalType":"bytes4","name":"kind","type":"bytes4"},{"internalType":"address","name":"wallet","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"id","type":"uint256"}],"internalType":"struct Types.Party","name":"affiliate","type":"tuple"},{"components":[{"internalType":"address","name":"signatory","type":"address"},{"internalType":"address","name":"validator","type":"address"},{"internalType":"bytes1","name":"version","type":"bytes1"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Types.Signature","name":"signature","type":"tuple"}],"internalType":"struct Types.Order","name":"order","type":"tuple"}],"name":"swap","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200232e3803806200232e8339810160408190526200003491620001a1565b73a42d613d8b8b6cb9507f46a5dd3fd98276570fd763a8cce2146040518060400160405280600481526020017f53574150000000000000000000000000000000000000000000000000000000008152506040518060400160405280600181526020017f3200000000000000000000000000000000000000000000000000000000000000815250306040518463ffffffff1660e01b8152600401620000db9392919062000213565b60206040518083038186803b158015620000f457600080fd5b505af415801562000109573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200012f919081019062000178565b600055600580546001600160a01b0319166001600160a01b0392909216919091179055620002e5565b80516200016581620002c0565b92915050565b80516200016581620002da565b6000602082840312156200018b57600080fd5b600062000199848462000158565b949350505050565b600060208284031215620001b457600080fd5b60006200019984846200016b565b620001cd816200025a565b82525050565b6000620001e0826200024d565b620001ec818562000251565b9350620001fe81856020860162000283565b6200020981620002b6565b9093019392505050565b60608082528101620002268186620001d3565b905081810360208301526200023c8185620001d3565b9050620001996040830184620001c2565b5190565b90815260200190565b6000620001658262000277565b90565b600062000165826200025a565b6001600160a01b031690565b60005b83811015620002a057818101518382015260200162000286565b83811115620002b0576000848401525b50505050565b601f01601f191690565b620002cb8162000267565b8114620002d757600080fd5b50565b620002cb816200026a565b61203980620002f56000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806367641c2f11610081578063bfb962791161005b578063bfb96279146101ab578063bfe51c10146101cb578063c34b44a0146101de576100d4565b806367641c2f146101705780637b10399914610183578063ab20428214610198576100d4565b80634f94c536116100b25780634f94c5361461012a57806353755b8f1461013d5780635e68e11f14610150576100d4565b80632e340823146100d95780633c641910146100ee57806341ac49a314610101575b600080fd5b6100ec6100e73660046116ea565b6101f1565b005b6100ec6100fc3660046117e2565b610331565b61011461010f366004611680565b61036d565b6040516101219190611cdb565b60405180910390f35b610114610138366004611680565b61038d565b6100ec61014b36600461165a565b6103ad565b61016361015e36600461165a565b6104c5565b6040516101219190611e0e565b6100ec61017e3660046117a4565b6104d7565b61018b610a80565b6040516101219190611d43565b6100ec6101a636600461165a565b610a9c565b6101be6101b93660046116ba565b610b56565b6040516101219190611ce9565b6100ec6101d936600461165a565b610b76565b6100ec6101ec36600461165a565b610c82565b60005b8181101561032c573360009081526003602052604081208185858581811061021857fe5b90506020020135815260200190815260200160002060009054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610324573360009081526003602052604081207f0100000000000000000000000000000000000000000000000000000000000000918585858181106102a057fe5b90506020020135815260200190815260200160002060006101000a81548160ff021916908360f81c02179055503373ffffffffffffffffffffffffffffffffffffffff168383838181106102f057fe5b905060200201357f8dd3c361eb2366ff27c2db0eb07b9261f1d052570742ab8c9a0c326f37aa576d60405160405180910390a35b6001016101f4565b505050565b336000818152600460205260408082208490555183917f863123978d9b13946753a916c935c0688a01802440d3ffc668d04d2720c4e11091a350565b600260209081526000928352604080842090915290825290205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff82161415610406576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d61565b60405180910390fd5b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166104c25733600081815260016020818152604080842073ffffffffffffffffffffffffffffffffffffffff8716808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690931790925590519092917fbe9299809b40c2eeb1ae326da30a511c24d70cbe3cd4ff384e4839b91de3b32591a35b50565b60046020526000908152604090205481565b42816020013511610514576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611da1565b6000600381610529608085016060860161165a565b73ffffffffffffffffffffffffffffffffffffffff168152602080820192909252604090810160009081208535825290925290205460f81b7fff0000000000000000000000000000000000000000000000000000000000000016146105ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d51565b600460006105ce608084016060850161165a565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020548135101561062f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611de1565b7f010000000000000000000000000000000000000000000000000000000000000060036000610664608085016060860161165a565b73ffffffffffffffffffffffffffffffffffffffff1681526020808201929092526040908101600090812085358252909252812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660f89390931c92909217909155806106dc6101208401610100850161165a565b73ffffffffffffffffffffffffffffffffffffffff1614156106ff575033610765565b61071a6107146101208401610100850161165a565b33610d3c565b610750576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d81565b6107626101208301610100840161165a565b90505b6107776102a083016102808401611800565b60ff166107d257610797610791608084016060850161165a565b33610db3565b6107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611dc1565b610882565b6107fc6107e5608084016060850161165a565b6107f76102408501610220860161165a565b610db3565b610832576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611dc1565b61084c610844368490038401846117c3565b600054610e26565b610882576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611db1565b6108c981610896608085016060860161165a565b6101408501803590610160870135906108b390610120890161165a565b6108c4610100890160e08a01611768565b611118565b6109076108dc608084016060850161165a565b8260a0850180359060c0870135906108f7906080890161165a565b6108c46060890160408a01611768565b600061091b6101e084016101c0850161165a565b73ffffffffffffffffffffffffffffffffffffffff161461098a5761098a610949608084016060850161165a565b61095b6101c085016101a0860161165a565b6101e0850180359061020087013590610978906101c0890161165a565b6108c46101a089016101808a01611768565b73ffffffffffffffffffffffffffffffffffffffff81166109b1608084016060850161165a565b73ffffffffffffffffffffffffffffffffffffffff1683357fd5fe17cd50e0d3d39b905ea598bbabccf2f8cda62a3b2fc64e09de00247a47244260a0870180359060c089013590610a059060808b0161165a565b6101408a018035906101608c013590610a22906101208e0161165a565b610a346101c08e016101a08f0161165a565b8d61018001606001358e61018001608001358f610180016040016020610a5d919081019061165a565b604051610a749b9a99989796959493929190611e1c565b60405180910390a45050565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156104c25733600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055519092917f92b544a2f54114da47550f9ee5b45cc343e5db8bfd148a7aba43219e33fceccd91a350565b600360209081526000928352604080842090915290825290205460f81b81565b3373ffffffffffffffffffffffffffffffffffffffff82161415610bc6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d61565b33600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166104c25733600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055519092917fb9bdd0621c52f9a047fe2a048fa04cdf987438d068ac524be8ea382aa3e94d2c91a350565b33600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156104c25733600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055519092917ffe558292b85125b7cf178f3456b09ce2fa79ca4b4fe2d7bb5da670ffecdb765e91a350565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480610daa575073ffffffffffffffffffffffffffffffffffffffff80841660009081526001602090815260408083209386168352929052205460ff165b90505b92915050565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480610daa57505073ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205460ff1690565b60a0820151604001516000907fff00000000000000000000000000000000000000000000000000000000000000167f01000000000000000000000000000000000000000000000000000000000000001415610fba576040517f8663ca4c00000000000000000000000000000000000000000000000000000000815260019073a42d613d8b8b6cb9507f46a5dd3fd98276570fd790638663ca4c90610ed09087908790600401611df1565b60206040518083038186803b158015610ee857600080fd5b505af4158015610efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f20919081019061174a565b60a080860151606081015160808201519190920151604080516000815260200190819052610f519493929190611cf7565b6020604051602081039080840390855afa158015610f73573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168360a001516000015173ffffffffffffffffffffffffffffffffffffffff16149050610dad565b60a0830151604001517fff00000000000000000000000000000000000000000000000000000000000000167f4500000000000000000000000000000000000000000000000000000000000000141561110f576040517f8663ca4c00000000000000000000000000000000000000000000000000000000815260019073a42d613d8b8b6cb9507f46a5dd3fd98276570fd790638663ca4c906110619087908790600401611df1565b60206040518083038186803b15801561107957600080fd5b505af415801561108d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110b1919081019061174a565b6040516020016110c19190611c6f565b604051602081830303815290604052805190602001208460a00151606001518560a00151608001518660a0015160a0015160405160008152602001604052604051610f519493929190611cf7565b50600092915050565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611dd1565b6005546040517feed1dd7800000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063eed1dd78906111d5908590600401611d35565b60206040518083038186803b1580156111ed57600080fd5b505afa158015611201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112259190810190611786565b905073ffffffffffffffffffffffffffffffffffffffff8116611274576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d91565b60405160009060609073ffffffffffffffffffffffffffffffffffffffff8416907fe2ecf09300000000000000000000000000000000000000000000000000000000906112cd908c908c908c908c908c90602401611c8f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516113569190611c5c565b600060405180830381855af49150503d8060008114611391576040519150601f19603f3d011682016040523d82523d6000602084013e611396565b606091505b50915091508180156113b75750808060200190516113b7919081019061172c565b6113ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d71565b505050505050505050565b8035610dad81611fac565b60008083601f84011261141557600080fd5b50813567ffffffffffffffff81111561142d57600080fd5b60208301915083602082028301111561144557600080fd5b9250929050565b8051610dad81611fc0565b8035610dad81611fc9565b8035610dad81611fd2565b8051610dad81611fd2565b8035610dad81611fdb565b8051610dad81611fe4565b60006102e082840312156114a157600080fd5b50919050565b60006102e082840312156114ba57600080fd5b6114c460c0611ec0565b905060006114d28484611462565b82525060206114e384848301611462565b60208301525060406114f784828501611541565b60408301525060e061150b84828501611541565b60608301525061018061152084828501611541565b608083015250610220611535848285016115c4565b60a08301525092915050565b600060a0828403121561155357600080fd5b61155d60a0611ec0565b9050600061156b8484611478565b825250602061157c848483016113f8565b6020830152506040611590848285016113f8565b60408301525060606115a484828501611462565b60608301525060806115b884828501611462565b60808301525092915050565b600060c082840312156115d657600080fd5b6115e060c0611ec0565b905060006115ee84846113f8565b82525060206115ff848483016113f8565b602083015250604061161384828501611457565b60408301525060606116278482850161164f565b606083015250608061163b84828501611462565b60808301525060a061153584828501611462565b8035610dad81611fed565b60006020828403121561166c57600080fd5b600061167884846113f8565b949350505050565b6000806040838503121561169357600080fd5b600061169f85856113f8565b92505060206116b0858286016113f8565b9150509250929050565b600080604083850312156116cd57600080fd5b60006116d985856113f8565b92505060206116b085828601611462565b600080602083850312156116fd57600080fd5b823567ffffffffffffffff81111561171457600080fd5b61172085828601611403565b92509250509250929050565b60006020828403121561173e57600080fd5b6000611678848461144c565b60006020828403121561175c57600080fd5b6000611678848461146d565b60006020828403121561177a57600080fd5b60006116788484611478565b60006020828403121561179857600080fd5b60006116788484611483565b60006102e082840312156117b757600080fd5b6000611678848461148e565b60006102e082840312156117d657600080fd5b600061167884846114a7565b6000602082840312156117f457600080fd5b60006116788484611462565b60006020828403121561181257600080fd5b6000611678848461164f565b61182781611ef9565b82525050565b61182781611f04565b61182781611f09565b61182781611f2e565b61182761185482611f2e565b611f2e565b61182781611f31565b600061186d82611ee7565b6118778185611eeb565b9350611887818560208601611f80565b9290920192915050565b61182781611f56565b60006118a7601883611ef0565b7f4f524445525f54414b454e5f4f525f43414e43454c4c45440000000000000000815260200192915050565b60006118e0601c83611eeb565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c0192915050565b6000611919601183611ef0565b7f53454c465f415554485f494e56414c4944000000000000000000000000000000815260200192915050565b6000611952600f83611ef0565b7f5452414e534645525f4641494c45440000000000000000000000000000000000815260200192915050565b600061198b601383611ef0565b7f53454e4445525f554e415554484f52495a454400000000000000000000000000815260200192915050565b60006119c4601283611ef0565b7f544f4b454e5f4b494e445f554e4b4e4f574e0000000000000000000000000000815260200192915050565b60006119fd600d83611ef0565b7f4f524445525f4558504952454400000000000000000000000000000000000000815260200192915050565b6000611a36601183611ef0565b7f5349474e41545552455f494e56414c4944000000000000000000000000000000815260200192915050565b6000611a6f601383611ef0565b7f5349474e45525f554e415554484f52495a454400000000000000000000000000815260200192915050565b6000611aa8601583611ef0565b7f53454c465f5452414e534645525f494e56414c49440000000000000000000000815260200192915050565b6000611ae1600d83611ef0565b7f4e4f4e43455f544f4f5f4c4f5700000000000000000000000000000000000000815260200192915050565b80516102e0830190611b1f848261183f565b506020820151611b32602085018261183f565b506040820151611b456040850182611b86565b506060820151611b5860e0850182611b86565b506080820151611b6c610180850182611b86565b5060a0820151611b80610220850182611be3565b50505050565b805160a0830190611b978482611859565b506020820151611baa602085018261181e565b506040820151611bbd604085018261181e565b506060820151611bd0606085018261183f565b506080820151611b80608085018261183f565b805160c0830190611bf4848261181e565b506020820151611c07602085018261181e565b506040820151611c1a6040850182611836565b506060820151611c2d6060850182611c53565b506080820151611c40608085018261183f565b5060a0820151611b8060a085018261183f565b61182781611f7a565b6000611c688284611862565b9392505050565b6000611c7a826118d3565b9150611c868284611848565b50602001919050565b60a08101611c9d828861181e565b611caa602083018761181e565b611cb7604083018661183f565b611cc4606083018561183f565b611cd1608083018461181e565b9695505050505050565b60208101610dad828461182d565b60208101610dad8284611836565b60808101611d05828761183f565b611d126020830186611c53565b611d1f604083018561183f565b611d2c606083018461183f565b95945050505050565b60208101610dad8284611859565b60208101610dad8284611891565b60208082528101610dad8161189a565b60208082528101610dad8161190c565b60208082528101610dad81611945565b60208082528101610dad8161197e565b60208082528101610dad816119b7565b60208082528101610dad816119f0565b60208082528101610dad81611a29565b60208082528101610dad81611a62565b60208082528101610dad81611a9b565b60208082528101610dad81611ad4565b6103008101611e008285611b0d565b611c686102e083018461183f565b60208101610dad828461183f565b6101608101611e2b828e61183f565b611e38602083018d61183f565b611e45604083018c61183f565b611e52606083018b61181e565b611e5f608083018a61183f565b611e6c60a083018961183f565b611e7960c083018861181e565b611e8660e083018761181e565b611e9461010083018661183f565b611ea261012083018561183f565b611eb061014083018461181e565b9c9b505050505050505050505050565b60405181810167ffffffffffffffff81118282101715611edf57600080fd5b604052919050565b5190565b919050565b90815260200190565b6000610dad82611f61565b151590565b7fff000000000000000000000000000000000000000000000000000000000000001690565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b6000610dad82611ef9565b73ffffffffffffffffffffffffffffffffffffffff1690565b60ff1690565b60005b83811015611f9b578181015183820152602001611f83565b83811115611b805750506000910152565b611fb581611ef9565b81146104c257600080fd5b611fb581611f04565b611fb581611f09565b611fb581611f2e565b611fb581611f31565b611fb581611f56565b611fb581611f7a56fea365627a7a72315820438bbb5e5c5d5ec475b36e237776cf53ab6b06e283c86e88d5ae71e326b0062c6c6578706572696d656e74616cf564736f6c634300050c0040000000000000000000000000b8bccf216f2788bb6df9fa15666a0a785730dcc0

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100d45760003560e01c806367641c2f11610081578063bfb962791161005b578063bfb96279146101ab578063bfe51c10146101cb578063c34b44a0146101de576100d4565b806367641c2f146101705780637b10399914610183578063ab20428214610198576100d4565b80634f94c536116100b25780634f94c5361461012a57806353755b8f1461013d5780635e68e11f14610150576100d4565b80632e340823146100d95780633c641910146100ee57806341ac49a314610101575b600080fd5b6100ec6100e73660046116ea565b6101f1565b005b6100ec6100fc3660046117e2565b610331565b61011461010f366004611680565b61036d565b6040516101219190611cdb565b60405180910390f35b610114610138366004611680565b61038d565b6100ec61014b36600461165a565b6103ad565b61016361015e36600461165a565b6104c5565b6040516101219190611e0e565b6100ec61017e3660046117a4565b6104d7565b61018b610a80565b6040516101219190611d43565b6100ec6101a636600461165a565b610a9c565b6101be6101b93660046116ba565b610b56565b6040516101219190611ce9565b6100ec6101d936600461165a565b610b76565b6100ec6101ec36600461165a565b610c82565b60005b8181101561032c573360009081526003602052604081208185858581811061021857fe5b90506020020135815260200190815260200160002060009054906101000a900460f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610324573360009081526003602052604081207f0100000000000000000000000000000000000000000000000000000000000000918585858181106102a057fe5b90506020020135815260200190815260200160002060006101000a81548160ff021916908360f81c02179055503373ffffffffffffffffffffffffffffffffffffffff168383838181106102f057fe5b905060200201357f8dd3c361eb2366ff27c2db0eb07b9261f1d052570742ab8c9a0c326f37aa576d60405160405180910390a35b6001016101f4565b505050565b336000818152600460205260408082208490555183917f863123978d9b13946753a916c935c0688a01802440d3ffc668d04d2720c4e11091a350565b600260209081526000928352604080842090915290825290205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff82161415610406576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d61565b60405180910390fd5b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166104c25733600081815260016020818152604080842073ffffffffffffffffffffffffffffffffffffffff8716808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690931790925590519092917fbe9299809b40c2eeb1ae326da30a511c24d70cbe3cd4ff384e4839b91de3b32591a35b50565b60046020526000908152604090205481565b42816020013511610514576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611da1565b6000600381610529608085016060860161165a565b73ffffffffffffffffffffffffffffffffffffffff168152602080820192909252604090810160009081208535825290925290205460f81b7fff0000000000000000000000000000000000000000000000000000000000000016146105ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d51565b600460006105ce608084016060850161165a565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020548135101561062f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611de1565b7f010000000000000000000000000000000000000000000000000000000000000060036000610664608085016060860161165a565b73ffffffffffffffffffffffffffffffffffffffff1681526020808201929092526040908101600090812085358252909252812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660f89390931c92909217909155806106dc6101208401610100850161165a565b73ffffffffffffffffffffffffffffffffffffffff1614156106ff575033610765565b61071a6107146101208401610100850161165a565b33610d3c565b610750576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d81565b6107626101208301610100840161165a565b90505b6107776102a083016102808401611800565b60ff166107d257610797610791608084016060850161165a565b33610db3565b6107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611dc1565b610882565b6107fc6107e5608084016060850161165a565b6107f76102408501610220860161165a565b610db3565b610832576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611dc1565b61084c610844368490038401846117c3565b600054610e26565b610882576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611db1565b6108c981610896608085016060860161165a565b6101408501803590610160870135906108b390610120890161165a565b6108c4610100890160e08a01611768565b611118565b6109076108dc608084016060850161165a565b8260a0850180359060c0870135906108f7906080890161165a565b6108c46060890160408a01611768565b600061091b6101e084016101c0850161165a565b73ffffffffffffffffffffffffffffffffffffffff161461098a5761098a610949608084016060850161165a565b61095b6101c085016101a0860161165a565b6101e0850180359061020087013590610978906101c0890161165a565b6108c46101a089016101808a01611768565b73ffffffffffffffffffffffffffffffffffffffff81166109b1608084016060850161165a565b73ffffffffffffffffffffffffffffffffffffffff1683357fd5fe17cd50e0d3d39b905ea598bbabccf2f8cda62a3b2fc64e09de00247a47244260a0870180359060c089013590610a059060808b0161165a565b6101408a018035906101608c013590610a22906101208e0161165a565b610a346101c08e016101a08f0161165a565b8d61018001606001358e61018001608001358f610180016040016020610a5d919081019061165a565b604051610a749b9a99989796959493929190611e1c565b60405180910390a45050565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156104c25733600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055519092917f92b544a2f54114da47550f9ee5b45cc343e5db8bfd148a7aba43219e33fceccd91a350565b600360209081526000928352604080842090915290825290205460f81b81565b3373ffffffffffffffffffffffffffffffffffffffff82161415610bc6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d61565b33600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166104c25733600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055519092917fb9bdd0621c52f9a047fe2a048fa04cdf987438d068ac524be8ea382aa3e94d2c91a350565b33600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156104c25733600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055519092917ffe558292b85125b7cf178f3456b09ce2fa79ca4b4fe2d7bb5da670ffecdb765e91a350565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480610daa575073ffffffffffffffffffffffffffffffffffffffff80841660009081526001602090815260408083209386168352929052205460ff165b90505b92915050565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480610daa57505073ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205460ff1690565b60a0820151604001516000907fff00000000000000000000000000000000000000000000000000000000000000167f01000000000000000000000000000000000000000000000000000000000000001415610fba576040517f8663ca4c00000000000000000000000000000000000000000000000000000000815260019073a42d613d8b8b6cb9507f46a5dd3fd98276570fd790638663ca4c90610ed09087908790600401611df1565b60206040518083038186803b158015610ee857600080fd5b505af4158015610efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f20919081019061174a565b60a080860151606081015160808201519190920151604080516000815260200190819052610f519493929190611cf7565b6020604051602081039080840390855afa158015610f73573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168360a001516000015173ffffffffffffffffffffffffffffffffffffffff16149050610dad565b60a0830151604001517fff00000000000000000000000000000000000000000000000000000000000000167f4500000000000000000000000000000000000000000000000000000000000000141561110f576040517f8663ca4c00000000000000000000000000000000000000000000000000000000815260019073a42d613d8b8b6cb9507f46a5dd3fd98276570fd790638663ca4c906110619087908790600401611df1565b60206040518083038186803b15801561107957600080fd5b505af415801561108d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110b1919081019061174a565b6040516020016110c19190611c6f565b604051602081830303815290604052805190602001208460a00151606001518560a00151608001518660a0015160a0015160405160008152602001604052604051610f519493929190611cf7565b50600092915050565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611dd1565b6005546040517feed1dd7800000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063eed1dd78906111d5908590600401611d35565b60206040518083038186803b1580156111ed57600080fd5b505afa158015611201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112259190810190611786565b905073ffffffffffffffffffffffffffffffffffffffff8116611274576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d91565b60405160009060609073ffffffffffffffffffffffffffffffffffffffff8416907fe2ecf09300000000000000000000000000000000000000000000000000000000906112cd908c908c908c908c908c90602401611c8f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516113569190611c5c565b600060405180830381855af49150503d8060008114611391576040519150601f19603f3d011682016040523d82523d6000602084013e611396565b606091505b50915091508180156113b75750808060200190516113b7919081019061172c565b6113ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fd90611d71565b505050505050505050565b8035610dad81611fac565b60008083601f84011261141557600080fd5b50813567ffffffffffffffff81111561142d57600080fd5b60208301915083602082028301111561144557600080fd5b9250929050565b8051610dad81611fc0565b8035610dad81611fc9565b8035610dad81611fd2565b8051610dad81611fd2565b8035610dad81611fdb565b8051610dad81611fe4565b60006102e082840312156114a157600080fd5b50919050565b60006102e082840312156114ba57600080fd5b6114c460c0611ec0565b905060006114d28484611462565b82525060206114e384848301611462565b60208301525060406114f784828501611541565b60408301525060e061150b84828501611541565b60608301525061018061152084828501611541565b608083015250610220611535848285016115c4565b60a08301525092915050565b600060a0828403121561155357600080fd5b61155d60a0611ec0565b9050600061156b8484611478565b825250602061157c848483016113f8565b6020830152506040611590848285016113f8565b60408301525060606115a484828501611462565b60608301525060806115b884828501611462565b60808301525092915050565b600060c082840312156115d657600080fd5b6115e060c0611ec0565b905060006115ee84846113f8565b82525060206115ff848483016113f8565b602083015250604061161384828501611457565b60408301525060606116278482850161164f565b606083015250608061163b84828501611462565b60808301525060a061153584828501611462565b8035610dad81611fed565b60006020828403121561166c57600080fd5b600061167884846113f8565b949350505050565b6000806040838503121561169357600080fd5b600061169f85856113f8565b92505060206116b0858286016113f8565b9150509250929050565b600080604083850312156116cd57600080fd5b60006116d985856113f8565b92505060206116b085828601611462565b600080602083850312156116fd57600080fd5b823567ffffffffffffffff81111561171457600080fd5b61172085828601611403565b92509250509250929050565b60006020828403121561173e57600080fd5b6000611678848461144c565b60006020828403121561175c57600080fd5b6000611678848461146d565b60006020828403121561177a57600080fd5b60006116788484611478565b60006020828403121561179857600080fd5b60006116788484611483565b60006102e082840312156117b757600080fd5b6000611678848461148e565b60006102e082840312156117d657600080fd5b600061167884846114a7565b6000602082840312156117f457600080fd5b60006116788484611462565b60006020828403121561181257600080fd5b6000611678848461164f565b61182781611ef9565b82525050565b61182781611f04565b61182781611f09565b61182781611f2e565b61182761185482611f2e565b611f2e565b61182781611f31565b600061186d82611ee7565b6118778185611eeb565b9350611887818560208601611f80565b9290920192915050565b61182781611f56565b60006118a7601883611ef0565b7f4f524445525f54414b454e5f4f525f43414e43454c4c45440000000000000000815260200192915050565b60006118e0601c83611eeb565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c0192915050565b6000611919601183611ef0565b7f53454c465f415554485f494e56414c4944000000000000000000000000000000815260200192915050565b6000611952600f83611ef0565b7f5452414e534645525f4641494c45440000000000000000000000000000000000815260200192915050565b600061198b601383611ef0565b7f53454e4445525f554e415554484f52495a454400000000000000000000000000815260200192915050565b60006119c4601283611ef0565b7f544f4b454e5f4b494e445f554e4b4e4f574e0000000000000000000000000000815260200192915050565b60006119fd600d83611ef0565b7f4f524445525f4558504952454400000000000000000000000000000000000000815260200192915050565b6000611a36601183611ef0565b7f5349474e41545552455f494e56414c4944000000000000000000000000000000815260200192915050565b6000611a6f601383611ef0565b7f5349474e45525f554e415554484f52495a454400000000000000000000000000815260200192915050565b6000611aa8601583611ef0565b7f53454c465f5452414e534645525f494e56414c49440000000000000000000000815260200192915050565b6000611ae1600d83611ef0565b7f4e4f4e43455f544f4f5f4c4f5700000000000000000000000000000000000000815260200192915050565b80516102e0830190611b1f848261183f565b506020820151611b32602085018261183f565b506040820151611b456040850182611b86565b506060820151611b5860e0850182611b86565b506080820151611b6c610180850182611b86565b5060a0820151611b80610220850182611be3565b50505050565b805160a0830190611b978482611859565b506020820151611baa602085018261181e565b506040820151611bbd604085018261181e565b506060820151611bd0606085018261183f565b506080820151611b80608085018261183f565b805160c0830190611bf4848261181e565b506020820151611c07602085018261181e565b506040820151611c1a6040850182611836565b506060820151611c2d6060850182611c53565b506080820151611c40608085018261183f565b5060a0820151611b8060a085018261183f565b61182781611f7a565b6000611c688284611862565b9392505050565b6000611c7a826118d3565b9150611c868284611848565b50602001919050565b60a08101611c9d828861181e565b611caa602083018761181e565b611cb7604083018661183f565b611cc4606083018561183f565b611cd1608083018461181e565b9695505050505050565b60208101610dad828461182d565b60208101610dad8284611836565b60808101611d05828761183f565b611d126020830186611c53565b611d1f604083018561183f565b611d2c606083018461183f565b95945050505050565b60208101610dad8284611859565b60208101610dad8284611891565b60208082528101610dad8161189a565b60208082528101610dad8161190c565b60208082528101610dad81611945565b60208082528101610dad8161197e565b60208082528101610dad816119b7565b60208082528101610dad816119f0565b60208082528101610dad81611a29565b60208082528101610dad81611a62565b60208082528101610dad81611a9b565b60208082528101610dad81611ad4565b6103008101611e008285611b0d565b611c686102e083018461183f565b60208101610dad828461183f565b6101608101611e2b828e61183f565b611e38602083018d61183f565b611e45604083018c61183f565b611e52606083018b61181e565b611e5f608083018a61183f565b611e6c60a083018961183f565b611e7960c083018861181e565b611e8660e083018761181e565b611e9461010083018661183f565b611ea261012083018561183f565b611eb061014083018461181e565b9c9b505050505050505050505050565b60405181810167ffffffffffffffff81118282101715611edf57600080fd5b604052919050565b5190565b919050565b90815260200190565b6000610dad82611f61565b151590565b7fff000000000000000000000000000000000000000000000000000000000000001690565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b6000610dad82611ef9565b73ffffffffffffffffffffffffffffffffffffffff1690565b60ff1690565b60005b83811015611f9b578181015183820152602001611f83565b83811115611b805750506000910152565b611fb581611ef9565b81146104c257600080fd5b611fb581611f04565b611fb581611f09565b611fb581611f2e565b611fb581611f31565b611fb581611f56565b611fb581611f7a56fea365627a7a72315820438bbb5e5c5d5ec475b36e237776cf53ab6b06e283c86e88d5ae71e326b0062c6c6578706572696d656e74616cf564736f6c634300050c0040

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

000000000000000000000000b8bccf216f2788bb6df9fa15666a0a785730dcc0

-----Decoded View---------------
Arg [0] : swapRegistry (address): 0xB8bCcF216f2788Bb6df9fA15666a0a785730dcC0

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


Swarm Source

bzzr://438bbb5e5c5d5ec475b36e237776cf53ab6b06e283c86e88d5ae71e326b0062c

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

OVERVIEW

Peer-to-peer trading on Ethereum

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.