ETH Price: $3,442.71 (-1.01%)
Gas: 3 Gwei

Contract

0xbA9aB9710Bd461F30C247f4cA2Cb7f453C22570e
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Create Index152612292022-08-02 5:32:42700 days ago1659418362IN
AirSwap: Indexer
0 ETH0.000252589.89163084
Create Index152612282022-08-02 5:32:16700 days ago1659418336IN
AirSwap: Indexer
0 ETH0.0002553510
Create Index152611872022-08-02 5:19:56700 days ago1659417596IN
AirSwap: Indexer
0 ETH0.000195167.63951984
Create Index152611822022-08-02 5:18:38700 days ago1659417518IN
AirSwap: Indexer
0 ETH0.000193077.53998166
Create Index152611782022-08-02 5:17:46700 days ago1659417466IN
AirSwap: Indexer
0 ETH0.000194527.61439611
Create Index133171762021-09-28 23:20:491007 days ago1632871249IN
AirSwap: Indexer
0 ETH0.0869119587
Create Index132258382021-09-14 19:53:331021 days ago1631649213IN
AirSwap: Indexer
0 ETH0.0859129686
Set Intent128474032021-07-18 0:19:401080 days ago1626567580IN
AirSwap: Indexer
0 ETH0.0037032228
Set Intent128474012021-07-18 0:19:231080 days ago1626567563IN
AirSwap: Indexer
0 ETH0.0037032228
Set Intent128473992021-07-18 0:19:031080 days ago1626567543IN
AirSwap: Indexer
0 ETH0.0037032228
Set Intent128473982021-07-18 0:18:051080 days ago1626567485IN
AirSwap: Indexer
0 ETH0.0037032228
Set Intent128450972021-07-17 15:36:211080 days ago1626536181IN
AirSwap: Indexer
0 ETH0.0037032228
Set Intent128449612021-07-17 15:10:321080 days ago1626534632IN
AirSwap: Indexer
0 ETH0.0059516145
Create Index126330912021-06-14 14:23:441113 days ago1623680624IN
AirSwap: Indexer
0 ETH0.0269726727
Create Index126267622021-06-13 14:51:161114 days ago1623595876IN
AirSwap: Indexer
0 ETH0.0109888611
Create Index126242432021-06-13 5:27:311115 days ago1623562051IN
AirSwap: Indexer
0 ETH0.009889989.9
Create Index125867182021-06-07 9:55:511120 days ago1623059751IN
AirSwap: Indexer
0 ETH0.016083716.1
Create Index125850442021-06-07 3:33:221121 days ago1623036802IN
AirSwap: Indexer
0 ETH0.016183616.2
Create Index125849522021-06-07 3:10:381121 days ago1623035438IN
AirSwap: Indexer
0 ETH0.015983816
Create Index125378352021-05-30 20:28:331128 days ago1622406513IN
AirSwap: Indexer
0 ETH0.0189807719
Create Index125151592021-05-27 7:43:291132 days ago1622101409IN
AirSwap: Indexer
0 ETH0.0239754224
Create Index124508932021-05-17 8:45:201142 days ago1621241120IN
AirSwap: Indexer
0 ETH0.057940658
Create Index123708632021-05-05 0:00:051154 days ago1620172805IN
AirSwap: Indexer
0 ETH0.0759230876
Set Intent123165482021-04-26 14:39:571162 days ago1619447997IN
AirSwap: Indexer
0 ETH0.0103443455
Set Intent123165282021-04-26 14:35:391162 days ago1619447739IN
AirSwap: Indexer
0 ETH0.0103443455
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
133171762021-09-28 23:20:491007 days ago1632871249
AirSwap: Indexer
 Contract Creation0 ETH
132258382021-09-14 19:53:331021 days ago1631649213
AirSwap: Indexer
 Contract Creation0 ETH
126330912021-06-14 14:23:441113 days ago1623680624
AirSwap: Indexer
 Contract Creation0 ETH
126267622021-06-13 14:51:161114 days ago1623595876
AirSwap: Indexer
 Contract Creation0 ETH
126242432021-06-13 5:27:311115 days ago1623562051
AirSwap: Indexer
 Contract Creation0 ETH
125867182021-06-07 9:55:511120 days ago1623059751
AirSwap: Indexer
 Contract Creation0 ETH
125850442021-06-07 3:33:221121 days ago1623036802
AirSwap: Indexer
 Contract Creation0 ETH
125849522021-06-07 3:10:381121 days ago1623035438
AirSwap: Indexer
 Contract Creation0 ETH
125378352021-05-30 20:28:331128 days ago1622406513
AirSwap: Indexer
 Contract Creation0 ETH
125151592021-05-27 7:43:291132 days ago1622101409
AirSwap: Indexer
 Contract Creation0 ETH
124508932021-05-17 8:45:201142 days ago1621241120
AirSwap: Indexer
 Contract Creation0 ETH
123708632021-05-05 0:00:051154 days ago1620172805
AirSwap: Indexer
 Contract Creation0 ETH
121658412021-04-03 9:36:391186 days ago1617442599
AirSwap: Indexer
 Contract Creation0 ETH
121651482021-04-03 7:01:001186 days ago1617433260
AirSwap: Indexer
 Contract Creation0 ETH
121651262021-04-03 6:55:111186 days ago1617432911
AirSwap: Indexer
 Contract Creation0 ETH
121650982021-04-03 6:46:581186 days ago1617432418
AirSwap: Indexer
 Contract Creation0 ETH
121650852021-04-03 6:43:381186 days ago1617432218
AirSwap: Indexer
 Contract Creation0 ETH
121650852021-04-03 6:43:381186 days ago1617432218
AirSwap: Indexer
 Contract Creation0 ETH
121650642021-04-03 6:38:141186 days ago1617431894
AirSwap: Indexer
 Contract Creation0 ETH
121650522021-04-03 6:36:111186 days ago1617431771
AirSwap: Indexer
 Contract Creation0 ETH
120771192021-03-20 17:45:551199 days ago1616262355
AirSwap: Indexer
 Contract Creation0 ETH
119428872021-02-28 1:30:421220 days ago1614475842
AirSwap: Indexer
 Contract Creation0 ETH
118830082021-02-18 20:41:311229 days ago1613680891
AirSwap: Indexer
 Contract Creation0 ETH
118803942021-02-18 10:52:031229 days ago1613645523
AirSwap: Indexer
 Contract Creation0 ETH
118803902021-02-18 10:51:321229 days ago1613645492
AirSwap: Indexer
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Indexer

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 2019-12-19
*/

pragma solidity 0.5.12;
pragma experimental ABIEncoderV2;
// File: @airswap/types/contracts/Types.sol
/*
  Copyright 2019 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 2019 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 2019 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/swap/contracts/interfaces/ISwap.sol
/*
  Copyright 2019 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);
}
// 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: 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 2019 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,
      "INVALID_SENDER_WALLET");
    // 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, "INVALID_PRICE_COEF");
    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 2019 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 2019 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 2019 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 2019 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 2019 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 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
    */
  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 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),
          "UNABLE_TO_STAKE");
      }
      // 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
    */
  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 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
    * @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),
        "UNABLE_TO_STAKE");
    }
    // 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
    */
  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: 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: 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: 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/swap/contracts/Swap.sol
/*
  Copyright 2019 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 {
  using SafeMath for uint256;
  using SafeERC20 for IERC20;
  // 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;
  // ERC-721 (non-fungible token) interface identifier (EIP-165)
  bytes4 constant internal ERC721_INTERFACE_ID = 0x80ac58cd;
  // 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;
  /**
    * @notice Contract Constructor
    * @dev Sets domain for signature validation (EIP-712)
    */
  constructor() public {
    _domainSeparator = Types.hashDomain(
      DOMAIN_NAME,
      DOMAIN_VERSION,
      address(this)
    );
  }
  /**
    * @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, "INVALID_AUTH_SENDER");
    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, "INVALID_AUTH_SIGNER");
    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 an ERC-20 or ERC-721 token transfer
    * @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, "INVALID_SELF_TRANSFER");
    if (kind == ERC721_INTERFACE_ID) {
      require(amount == 0, "NO_AMOUNT_FIELD_IN_ERC721");
      // Attempt to transfer an ERC-721 token.
      IERC721(token).transferFrom(from, to, id);
    } else {
      require(id == 0, "NO_ID_FIELD_IN_ERC20");
      // Attempt to transfer an ERC-20 token, underlying SafeERC20 calls require.
      IERC20(token).safeTransferFrom(from, to, amount);
    }
  }
}
// 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 2019 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: contracts/Imports.sol
//Import all the contracts desired to be deployed
contract Imports {}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"indexerStakingToken","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"AddTokenToBlacklist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signerToken","type":"address"},{"indexed":true,"internalType":"address","name":"senderToken","type":"address"},{"indexed":false,"internalType":"bytes2","name":"protocol","type":"bytes2"},{"indexed":false,"internalType":"address","name":"indexAddress","type":"address"}],"name":"CreateIndex","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"RemoveTokenFromBlacklist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"address","name":"signerToken","type":"address"},{"indexed":true,"internalType":"address","name":"senderToken","type":"address"},{"indexed":false,"internalType":"bytes2","name":"protocol","type":"bytes2"},{"indexed":false,"internalType":"uint256","name":"stakeAmount","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"address","name":"signerToken","type":"address"},{"indexed":true,"internalType":"address","name":"senderToken","type":"address"},{"indexed":false,"internalType":"bytes2","name":"protocol","type":"bytes2"},{"indexed":false,"internalType":"uint256","name":"stakeAmount","type":"uint256"}],"name":"Unstake","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"addTokenToBlacklist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"signerToken","type":"address"},{"internalType":"address","name":"senderToken","type":"address"},{"internalType":"bytes2","name":"protocol","type":"bytes2"}],"name":"createIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"signerToken","type":"address"},{"internalType":"address","name":"senderToken","type":"address"},{"internalType":"bytes2","name":"protocol","type":"bytes2"},{"internalType":"address","name":"cursor","type":"address"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"getLocators","outputs":[{"internalType":"bytes32[]","name":"locators","type":"bytes32[]"},{"internalType":"uint256[]","name":"scores","type":"uint256[]"},{"internalType":"address","name":"nextCursor","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"signerToken","type":"address"},{"internalType":"address","name":"senderToken","type":"address"},{"internalType":"bytes2","name":"protocol","type":"bytes2"}],"name":"getStakedAmount","outputs":[{"internalType":"uint256","name":"stakedAmount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"bytes2","name":"","type":"bytes2"}],"name":"indexes","outputs":[{"internalType":"contract Index","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes2","name":"","type":"bytes2"}],"name":"locatorWhitelists","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"removeTokenFromBlacklist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"signerToken","type":"address"},{"internalType":"address","name":"senderToken","type":"address"},{"internalType":"bytes2","name":"protocol","type":"bytes2"},{"internalType":"uint256","name":"stakingAmount","type":"uint256"},{"internalType":"bytes32","name":"locator","type":"bytes32"}],"name":"setIntent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes2","name":"protocol","type":"bytes2"},{"internalType":"address","name":"newLocatorWhitelist","type":"address"}],"name":"setLocatorWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenBlacklist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"signerToken","type":"address"},{"internalType":"address","name":"senderToken","type":"address"},{"internalType":"bytes2","name":"protocol","type":"bytes2"}],"name":"unsetIntent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200385e3803806200385e8339810160408190526200003491620000cc565b620000476001600160e01b03620000b516565b600080546001600160a01b0319166001600160a01b03928316178082556040519216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600180546001600160a01b0319166001600160a01b039290921691909117905562000121565b3390565b8051620000c68162000107565b92915050565b600060208284031215620000df57600080fd5b6000620000ed8484620000b9565b949350505050565b60006001600160a01b038216620000c6565b6200011281620000f5565b81146200011e57600080fd5b50565b61372d80620001316000396000f3fe60806040523480156200001157600080fd5b5060043610620001185760003560e01c80639dc9762a11620000a5578063cffaf5f5116200006f578063cffaf5f51462000244578063d57cfaad146200026c578063df9d6d671462000283578063f2fde38b146200029a5762000118565b80639dc9762a14620001e85780639f80679f14620001ff5780639fa451021462000216578063cd135549146200022d5762000118565b80638da5cb5b11620000e75780638da5cb5b14620001885780638f32d59b14620001a15780639173deca14620001ba578063948ee3f614620001d15762000118565b806303f868f7146200011d578063715018a6146200014c57806372f702f31462000158578063854437dc1462000171575b600080fd5b620001346200012e36600462001cfb565b620002b1565b60405162000143919062002380565b60405180910390f35b620001566200041d565b005b62000162620004d8565b60405162000143919062002390565b620001566200018236600462001cda565b620004f4565b62000192620005f1565b6040516200014391906200225b565b620001ab6200060d565b60405162000143919062002341565b62000192620001cb36600462001f35565b6200064d565b62000156620001e236600462001e39565b62000675565b62000162620001f936600462001d65565b62000d6b565b620001926200021036600462001d65565b62000da4565b620001ab6200022736600462001cda565b62000f71565b620001566200023e36600462001f56565b62000f86565b6200025b6200025536600462001db9565b62001040565b604051620001439392919062002307565b620001566200027d36600462001cda565b62001279565b620001566200029436600462001d65565b62001368565b62000156620002ab36600462001cda565b6200137b565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600260209081526040808320868516845282528083207fffff00000000000000000000000000000000000000000000000000000000000086168452909152812054909116620003205750600062000415565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600260209081526040808320878516845282528083207fffff00000000000000000000000000000000000000000000000000000000000087168452909152908190205490517fd47875d000000000000000000000000000000000000000000000000000000000815291169063d47875d090620003be9088906004016200225b565b60206040518083038186803b158015620003d757600080fd5b505afa158015620003ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000412919081019062001f95565b90505b949350505050565b620004276200060d565b62000469576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b60405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b620004fe6200060d565b62000537576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090205460ff16620005ee5773ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517fe53b519de693da0496205f0705fa49c937a9045cb26b6f67711cd2205195540190620005e59083906200225b565b60405180910390a15b50565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000805473ffffffffffffffffffffffffffffffffffffffff1662000631620013c9565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60036020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600260209081526040808320848916845282528083207fffff000000000000000000000000000000000000000000000000000000000000881684529091529020548691869186911662000713576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023c4565b7fffff000000000000000000000000000000000000000000000000000000000000861660009081526003602052604090205473ffffffffffffffffffffffffffffffffffffffff161562000876577fffff0000000000000000000000000000000000000000000000000000000000008616600090815260036020526040908190205490517fb7dc560f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063b7dc560f90620007e990879060040162002380565b60206040518083038186803b1580156200080257600080fd5b505afa15801562000817573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200083d919081019062001f14565b62000876576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023b2565b73ffffffffffffffffffffffffffffffffffffffff881660009081526004602052604090205460ff16158015620008d3575073ffffffffffffffffffffffffffffffffffffffff871660009081526004602052604090205460ff16155b6200090c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023fa565b73ffffffffffffffffffffffffffffffffffffffff80891660009081526002602090815260408083208b8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008b1684529091528082205490517f4ec63ffe00000000000000000000000000000000000000000000000000000000815291928392911690634ec63ffe90620009ad9033906004016200226b565b60206040518083038186803b158015620009c657600080fd5b505afa158015620009db573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000a01919081019062001f95565b149050801562000c5957851562000afd576001546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd9062000a6e90339030908b906004016200227b565b602060405180830381600087803b15801562000a8957600080fd5b505af115801562000a9e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000ac4919081019062001f14565b62000afd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023e8565b73ffffffffffffffffffffffffffffffffffffffff808a1660009081526002602090815260408083208c8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008c168452909152908190205490517f0589912a000000000000000000000000000000000000000000000000000000008152911690630589912a9062000b9f9033908a908a90600401620022a9565b600060405180830381600087803b15801562000bba57600080fd5b505af115801562000bcf573d6000803e3d6000fd5b505050508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f5065254984dfd953a97f48da9330ed3a61d8bc8cd2df88176b58f99d3ce81c3e8a8a60405162000c4b92919062002370565b60405180910390a462000d60565b73ffffffffffffffffffffffffffffffffffffffff808a1660009081526002602090815260408083208c8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008c1684529091528082205490517fd47875d00000000000000000000000000000000000000000000000000000000081529192169063d47875d09062000cf79033906004016200226b565b60206040518083038186803b15801562000d1057600080fd5b505afa15801562000d25573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000d4b919081019062001f95565b905062000d5e338b8b8b8b8b87620013cd565b505b505050505050505050565b600260209081526000938452604080852082529284528284209052825290205473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600260209081526040808320868516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008616845290915281205490911662000f095760405162000e189062001b76565b604051809103906000f08015801562000e35573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff85811660008181526002602090815260408083208986168085529083528184207fffff0000000000000000000000000000000000000000000000000000000000008a1685529092529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001695851695909517948590559051909391927f7a28ddb7cee538734c8afbb914e80f6fa30503635c435868db561163b5a7e84b9262000f00928892919091169062002351565b60405180910390a35b5073ffffffffffffffffffffffffffffffffffffffff8084166000908152600260209081526040808320868516845282528083207fffff00000000000000000000000000000000000000000000000000000000000086168452909152902054165b9392505050565b60046020526000908152604090205460ff1681565b62000f906200060d565b62000fc9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b7fffff00000000000000000000000000000000000000000000000000000000000091909116600090815260036020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260046020526040812054606091829160ff16806200109f575073ffffffffffffffffffffffffffffffffffffffff871660009081526004602052604090205460ff165b15620010d65760408051600080825260208201909252905b506040805160008082526020820190925291945090925090506200126e565b73ffffffffffffffffffffffffffffffffffffffff88811660009081526002602090815260408083208b8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008b1684529091529020541662001151576040805160008082526020820190925290620010b7565b73ffffffffffffffffffffffffffffffffffffffff80891660009081526002602090815260408083208b8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008b168452909152908190205490517f0b30a8d7000000000000000000000000000000000000000000000000000000008152911690630b30a8d790620011f19088908890600401620022d8565b60006040518083038186803b1580156200120a57600080fd5b505afa1580156200121f573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405262001267919081019062001e99565b9250925092505b955095509592505050565b620012836200060d565b620012bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090205460ff1615620005ee5773ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517fa1f26e166f408721b7578234199103d95e0aea4308d683b2f6c0ec86ac9e9e7390620005e59083906200225b565b6200137633848484620016e7565b505050565b620013856200060d565b620013be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b620005ee8162001a99565b3390565b82811015620014c3576001546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd9062001434908a90309086890390600401620022c8565b602060405180830381600087803b1580156200144f57600080fd5b505af115801562001464573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200148a919081019062001f14565b620014c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023e8565b8083101562001588576001546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb9062001528908a9087860390600401620022d8565b602060405180830381600087803b1580156200154357600080fd5b505af115801562001558573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200157e919081019062001f14565b6200158857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8087166000908152600260209081526040808320898516845282528083207fffff00000000000000000000000000000000000000000000000000000000000089168452909152908190205490517fb4decab600000000000000000000000000000000000000000000000000000000815291169063b4decab6906200162a908a9087908790600401620022f7565b600060405180830381600087803b1580156200164557600080fd5b505af11580156200165a573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f5065254984dfd953a97f48da9330ed3a61d8bc8cd2df88176b58f99d3ce81c3e8787604051620016d692919062002370565b60405180910390a450505050505050565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260209081526040808320848716845282528083207fffff000000000000000000000000000000000000000000000000000000000000861684529091529020548491849184911662001785576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023c4565b73ffffffffffffffffffffffffffffffffffffffff8087166000908152600260209081526040808320898516845282528083207fffff000000000000000000000000000000000000000000000000000000000000891684529091528082205490517fd47875d00000000000000000000000000000000000000000000000000000000081529192169063d47875d09062001823908b906004016200225b565b60206040518083038186803b1580156200183c57600080fd5b505afa15801562001851573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062001877919081019062001f95565b73ffffffffffffffffffffffffffffffffffffffff80891660009081526002602090815260408083208b8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008b168452909152908190205490517f0ddcecf00000000000000000000000000000000000000000000000000000000081529293501690630ddcecf09062001917908b906004016200225b565b600060405180830381600087803b1580156200193257600080fd5b505af115801562001947573d6000803e3d6000fd5b50505050600081111562001a0f576001546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb90620019af908b908590600401620022d8565b602060405180830381600087803b158015620019ca57600080fd5b505af1158015620019df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062001a05919081019062001f14565b62001a0f57600080fd5b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f71735c1604645e893048a8e669bd75b5c1829b76fe6bd5a6cc0f2ac86eca6ff6888560405162001a8792919062002370565b60405180910390a45050505050505050565b73ffffffffffffffffffffffffffffffffffffffff811662001ae9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023a0565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6111e1806200250a83390190565b803562001b9181620024d1565b92915050565b805162001b9181620024d1565b600082601f83011262001bb657600080fd5b815162001bcd62001bc78262002434565b6200240c565b9150818183526020840193506020810190508385602084028201111562001bf357600080fd5b60005b8381101562001c23578162001c0c888262001ccd565b845250602092830192919091019060010162001bf6565b5050505092915050565b600082601f83011262001c3f57600080fd5b815162001c5062001bc78262002434565b9150818183526020840193506020810190508385602084028201111562001c7657600080fd5b60005b8381101562001c23578162001c8f888262001ccd565b845250602092830192919091019060010162001c79565b805162001b9181620024e8565b803562001b9181620024f3565b803562001b9181620024fe565b805162001b9181620024fe565b60006020828403121562001ced57600080fd5b600062000415848462001b84565b6000806000806080858703121562001d1257600080fd5b600062001d20878762001b84565b945050602062001d338782880162001b84565b935050604062001d468782880162001b84565b925050606062001d598782880162001cb3565b91505092959194509250565b60008060006060848603121562001d7b57600080fd5b600062001d89868662001b84565b935050602062001d9c8682870162001b84565b925050604062001daf8682870162001cb3565b9150509250925092565b600080600080600060a0868803121562001dd257600080fd5b600062001de0888862001b84565b955050602062001df38882890162001b84565b945050604062001e068882890162001cb3565b935050606062001e198882890162001b84565b925050608062001e2c8882890162001cc0565b9150509295509295909350565b600080600080600060a0868803121562001e5257600080fd5b600062001e60888862001b84565b955050602062001e738882890162001b84565b945050604062001e868882890162001cb3565b935050606062001e198882890162001cc0565b60008060006060848603121562001eaf57600080fd5b835167ffffffffffffffff81111562001ec757600080fd5b62001ed58682870162001ba4565b935050602084015167ffffffffffffffff81111562001ef357600080fd5b62001f018682870162001c2d565b925050604062001daf8682870162001b97565b60006020828403121562001f2757600080fd5b600062000415848462001ca6565b60006020828403121562001f4857600080fd5b600062000415848462001cb3565b6000806040838503121562001f6a57600080fd5b600062001f78858562001cb3565b925050602062001f8b8582860162001b84565b9150509250929050565b60006020828403121562001fa857600080fd5b600062000415848462001ccd565b600062001fc48383620020bd565b505060200190565b62001fd781620024bc565b82525050565b62001fd78162002469565b600062001ff5826200245c565b62002001818562002460565b93506200200e8362002456565b8060005b838110156200204257815162002029888262001fb6565b9750620020368362002456565b92505060010162002012565b509495945050505050565b60006200205a826200245c565b62002066818562002460565b9350620020738362002456565b8060005b83811015620020425781516200208e888262001fb6565b97506200209b8362002456565b92505060010162002077565b62001fd78162002476565b62001fd7816200247b565b62001fd781620024a0565b62001fd781620024c4565b6000620020e260268362002460565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015260400192915050565b60006200214360178362002460565b7f4c4f4341544f525f4e4f545f57484954454c4953544544000000000000000000815260200192915050565b60006200217e60148362002460565b7f494e4445585f444f45535f4e4f545f4558495354000000000000000000000000815260200192915050565b6000620021b960208362002460565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000620021f4600f8362002460565b7f554e41424c455f544f5f5354414b450000000000000000000000000000000000815260200192915050565b60006200222f60138362002460565b7f504149525f49535f424c41434b4c495354454400000000000000000000000000815260200192915050565b6020810162001b91828462001fdd565b6020810162001b91828462001fcc565b606081016200228b828662001fcc565b6200229a602083018562001fdd565b620004156040830184620020bd565b60608101620022b9828662001fcc565b6200229a6020830185620020bd565b606081016200228b828662001fdd565b60408101620022e8828562001fdd565b62000f6a6020830184620020bd565b60608101620022b9828662001fdd565b606080825281016200231a818662001fe8565b905081810360208301526200233081856200204d565b905062000415604083018462001fdd565b6020810162001b918284620020a7565b60408101620023618285620020b2565b62000f6a602083018462001fdd565b60408101620022e88285620020b2565b6020810162001b918284620020bd565b6020810162001b918284620020c8565b6020808252810162001b9181620020d3565b6020808252810162001b918162002134565b6020808252810162001b91816200216f565b6020808252810162001b9181620021aa565b6020808252810162001b9181620021e5565b6020808252810162001b918162002220565b60405181810167ffffffffffffffff811182821017156200242c57600080fd5b604052919050565b600067ffffffffffffffff8211156200244c57600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b600062001b9182620024a3565b151590565b7fffff0000000000000000000000000000000000000000000000000000000000001690565b90565b73ffffffffffffffffffffffffffffffffffffffff1690565b600062001b91825b600062001b918262002469565b620024dc8162002469565b8114620005ee57600080fd5b620024dc8162002476565b620024dc816200247b565b620024dc81620024a056fe608060405234801561001057600080fd5b506100226001600160e01b0361015116565b600080546001600160a01b0319166001600160a01b03928316178082556040519216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a360408051608081018252600080825260208083018281526001600160a01b039484018581526060850186815293869052600290925292517f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f15591517f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f25590517f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f380549184166001600160a01b031992831617905590517f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f48054919093169116179055610155565b3390565b61107d806101646000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80638da5cb5b11610081578063d47875d01161005b578063d47875d014610199578063f29ee125146101ac578063f2fde38b146101cf576100d4565b80638da5cb5b1461015c5780638f32d59b14610171578063b4decab614610186576100d4565b80631f7b6d32116100b25780631f7b6d321461012c5780634ec63ffe14610141578063715018a614610154576100d4565b80630589912a146100d95780630b30a8d7146100ee5780630ddcecf014610119575b600080fd5b6100ec6100e7366004610c86565b6101e2565b005b6101016100fc366004610c4c565b6102d4565b60405161011093929190610f00565b60405180910390f35b6100ec610127366004610c26565b610514565b6101346105c7565b6040516101109190610f42565b61013461014f366004610c26565b6105cd565b6100ec6105f9565b6101646106a6565b6040516101109190610ef2565b6101796106c2565b6040516101109190610f34565b6100ec610194366004610c86565b610700565b6101346101a7366004610c26565b610799565b6101bf6101ba366004610c26565b6107c4565b6040516101109493929190610f50565b6100ec6101dd366004610c26565b610806565b6101ea6106c2565b610229576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b60405180910390fd5b61023283610850565b15610269576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fce565b61027483838361087a565b600154600101600181905550808373ffffffffffffffffffffffffffffffffffffffff167f62d8270f77cd1e7351e3e92e7001b363e90eed2ef3394dbd51201ceee3672630846040516102c79190610f42565b60405180910390a3505050565b60608060008073ffffffffffffffffffffffffffffffffffffffff861615801590610315575073ffffffffffffffffffffffffffffffffffffffff86811614155b156103515761032386610850565b61034a5750506040805160008082526020820181815282840190935290935090915061050d565b5084610395565b5073ffffffffffffffffffffffffffffffffffffffff600081905260026020527f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f454165b600085600154106103a657856103aa565b6001545b9050806040519080825280602002602001820160405280156103d6578160200160208202803883390190505b50945080604051908082528060200260200182016040528015610403578160200160208202803883390190505b50935060005b818110801561042e575073ffffffffffffffffffffffffffffffffffffffff83811614155b156105075773ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054865187908390811061046757fe5b602002602001018181525050600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101548582815181106104c257fe5b60209081029190910181019190915273ffffffffffffffffffffffffffffffffffffffff93841660009081526002909152604090206003015490921691600101610409565b50909150505b9250925092565b61051c6106c2565b610552576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b61055b81610987565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905560405173ffffffffffffffffffffffffffffffffffffffff8216907fded788c834b3ea8a384c1495466a3a4a827c378cd9eafe5c159d90291ce0184490600090a250565b60015481565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260409020545b919050565b6106016106c2565b610637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000805473ffffffffffffffffffffffffffffffffffffffff166106e4610a66565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6107086106c2565b61073e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b61074783610987565b61075283838361087a565b808373ffffffffffffffffffffffffffffffffffffffff167f62d8270f77cd1e7351e3e92e7001b363e90eed2ef3394dbd51201ceee3672630846040516102c79190610f42565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090206001015490565b6002602081905260009182526040909120805460018201549282015460039092015490929173ffffffffffffffffffffffffffffffffffffffff908116911684565b61080e6106c2565b610844576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b61084d81610a6a565b50565b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902054151590565b806108b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610f9e565b60006108bc83610b44565b73ffffffffffffffffffffffffffffffffffffffff9081166000818152600260208181526040808420830180548716808652828620600390810180547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169e8b169e8f17909155835481168e1790935583516080810185529a8b528a85019b8c528a840191825260608b019788529b8652928490529320965187559651600187015595519585018054821696841696909617909555519290940180549093169190931617905550565b61099081610850565b6109c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fae565b73ffffffffffffffffffffffffffffffffffffffff9081166000818152600260208190526040808320808301805460038084018054928a16808952868920909201805493909a167fffffffffffffffffffffffff00000000000000000000000000000000000000009384168117909a5598875293862090940180548516909317909255938352828455600190930191909155815481169091558154169055565b3390565b73ffffffffffffffffffffffffffffffffffffffff8116610ab7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610f8e565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff600081815260026020527f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f45490911682610baa5773ffffffffffffffffffffffffffffffffffffffff9150506105f4565b5b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260409020600101548311610c0a5773ffffffffffffffffffffffffffffffffffffffff90811660009081526002602052604090206003015416610bab565b92915050565b8035610c0a8161101d565b8035610c0a81611031565b600060208284031215610c3857600080fd5b6000610c448484610c10565b949350505050565b60008060408385031215610c5f57600080fd5b6000610c6b8585610c10565b9250506020610c7c85828601610c1b565b9150509250929050565b600080600060608486031215610c9b57600080fd5b6000610ca78686610c10565b9350506020610cb886828701610c1b565b9250506040610cc986828701610c1b565b9150509250925092565b6000610cdf8383610da6565b505060200190565b610cf081610ff1565b82525050565b6000610d0182610fe4565b610d0b8185610fe8565b9350610d1683610fde565b8060005b83811015610d44578151610d2e8882610cd3565b9750610d3983610fde565b925050600101610d1a565b509495945050505050565b6000610d5a82610fe4565b610d648185610fe8565b9350610d6f83610fde565b8060005b83811015610d44578151610d878882610cd3565b9750610d9283610fde565b925050600101610d73565b610cf081610ffc565b610cf081611001565b6000610dbc602683610fe8565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015260400192915050565b6000610e1b601483610fe8565b7f4c4f4341544f525f4d5553545f42455f53454e54000000000000000000000000815260200192915050565b6000610e54601483610fe8565b7f454e5452595f444f45535f4e4f545f4558495354000000000000000000000000815260200192915050565b6000610e8d602083610fe8565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000610ec6601483610fe8565b7f454e5452595f414c52454144595f455849535453000000000000000000000000815260200192915050565b60208101610c0a8284610ce7565b60608082528101610f118186610cf6565b90508181036020830152610f258185610d4f565b9050610c446040830184610ce7565b60208101610c0a8284610d9d565b60208101610c0a8284610da6565b60808101610f5e8287610da6565b610f6b6020830186610da6565b610f786040830185610ce7565b610f856060830184610ce7565b95945050505050565b60208082528101610c0a81610daf565b60208082528101610c0a81610e0e565b60208082528101610c0a81610e47565b60208082528101610c0a81610e80565b60208082528101610c0a81610eb9565b60200190565b5190565b90815260200190565b6000610c0a82611004565b151590565b90565b73ffffffffffffffffffffffffffffffffffffffff1690565b61102681610ff1565b811461084d57600080fd5b6110268161100156fea365627a7a723158209a24c39b3554cf22113d7cb28ec95dbb1bacd8ef0b3d3e3023f0d3761f0191fc6c6578706572696d656e74616cf564736f6c634300050c0040a365627a7a72315820e0d27be72aa0cc6ff0659522d810af67b12252e75b05e96c37ccab45ff71b39a6c6578706572696d656e74616cf564736f6c634300050c004000000000000000000000000027054b13b1b798b345b591a4d22e6562d47ea75a

Deployed Bytecode

0x60806040523480156200001157600080fd5b5060043610620001185760003560e01c80639dc9762a11620000a5578063cffaf5f5116200006f578063cffaf5f51462000244578063d57cfaad146200026c578063df9d6d671462000283578063f2fde38b146200029a5762000118565b80639dc9762a14620001e85780639f80679f14620001ff5780639fa451021462000216578063cd135549146200022d5762000118565b80638da5cb5b11620000e75780638da5cb5b14620001885780638f32d59b14620001a15780639173deca14620001ba578063948ee3f614620001d15762000118565b806303f868f7146200011d578063715018a6146200014c57806372f702f31462000158578063854437dc1462000171575b600080fd5b620001346200012e36600462001cfb565b620002b1565b60405162000143919062002380565b60405180910390f35b620001566200041d565b005b62000162620004d8565b60405162000143919062002390565b620001566200018236600462001cda565b620004f4565b62000192620005f1565b6040516200014391906200225b565b620001ab6200060d565b60405162000143919062002341565b62000192620001cb36600462001f35565b6200064d565b62000156620001e236600462001e39565b62000675565b62000162620001f936600462001d65565b62000d6b565b620001926200021036600462001d65565b62000da4565b620001ab6200022736600462001cda565b62000f71565b620001566200023e36600462001f56565b62000f86565b6200025b6200025536600462001db9565b62001040565b604051620001439392919062002307565b620001566200027d36600462001cda565b62001279565b620001566200029436600462001d65565b62001368565b62000156620002ab36600462001cda565b6200137b565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600260209081526040808320868516845282528083207fffff00000000000000000000000000000000000000000000000000000000000086168452909152812054909116620003205750600062000415565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600260209081526040808320878516845282528083207fffff00000000000000000000000000000000000000000000000000000000000087168452909152908190205490517fd47875d000000000000000000000000000000000000000000000000000000000815291169063d47875d090620003be9088906004016200225b565b60206040518083038186803b158015620003d757600080fd5b505afa158015620003ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000412919081019062001f95565b90505b949350505050565b620004276200060d565b62000469576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b60405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b620004fe6200060d565b62000537576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090205460ff16620005ee5773ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517fe53b519de693da0496205f0705fa49c937a9045cb26b6f67711cd2205195540190620005e59083906200225b565b60405180910390a15b50565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000805473ffffffffffffffffffffffffffffffffffffffff1662000631620013c9565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60036020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600260209081526040808320848916845282528083207fffff000000000000000000000000000000000000000000000000000000000000881684529091529020548691869186911662000713576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023c4565b7fffff000000000000000000000000000000000000000000000000000000000000861660009081526003602052604090205473ffffffffffffffffffffffffffffffffffffffff161562000876577fffff0000000000000000000000000000000000000000000000000000000000008616600090815260036020526040908190205490517fb7dc560f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063b7dc560f90620007e990879060040162002380565b60206040518083038186803b1580156200080257600080fd5b505afa15801562000817573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200083d919081019062001f14565b62000876576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023b2565b73ffffffffffffffffffffffffffffffffffffffff881660009081526004602052604090205460ff16158015620008d3575073ffffffffffffffffffffffffffffffffffffffff871660009081526004602052604090205460ff16155b6200090c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023fa565b73ffffffffffffffffffffffffffffffffffffffff80891660009081526002602090815260408083208b8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008b1684529091528082205490517f4ec63ffe00000000000000000000000000000000000000000000000000000000815291928392911690634ec63ffe90620009ad9033906004016200226b565b60206040518083038186803b158015620009c657600080fd5b505afa158015620009db573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000a01919081019062001f95565b149050801562000c5957851562000afd576001546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd9062000a6e90339030908b906004016200227b565b602060405180830381600087803b15801562000a8957600080fd5b505af115801562000a9e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000ac4919081019062001f14565b62000afd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023e8565b73ffffffffffffffffffffffffffffffffffffffff808a1660009081526002602090815260408083208c8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008c168452909152908190205490517f0589912a000000000000000000000000000000000000000000000000000000008152911690630589912a9062000b9f9033908a908a90600401620022a9565b600060405180830381600087803b15801562000bba57600080fd5b505af115801562000bcf573d6000803e3d6000fd5b505050508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f5065254984dfd953a97f48da9330ed3a61d8bc8cd2df88176b58f99d3ce81c3e8a8a60405162000c4b92919062002370565b60405180910390a462000d60565b73ffffffffffffffffffffffffffffffffffffffff808a1660009081526002602090815260408083208c8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008c1684529091528082205490517fd47875d00000000000000000000000000000000000000000000000000000000081529192169063d47875d09062000cf79033906004016200226b565b60206040518083038186803b15801562000d1057600080fd5b505afa15801562000d25573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000d4b919081019062001f95565b905062000d5e338b8b8b8b8b87620013cd565b505b505050505050505050565b600260209081526000938452604080852082529284528284209052825290205473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600260209081526040808320868516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008616845290915281205490911662000f095760405162000e189062001b76565b604051809103906000f08015801562000e35573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff85811660008181526002602090815260408083208986168085529083528184207fffff0000000000000000000000000000000000000000000000000000000000008a1685529092529182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001695851695909517948590559051909391927f7a28ddb7cee538734c8afbb914e80f6fa30503635c435868db561163b5a7e84b9262000f00928892919091169062002351565b60405180910390a35b5073ffffffffffffffffffffffffffffffffffffffff8084166000908152600260209081526040808320868516845282528083207fffff00000000000000000000000000000000000000000000000000000000000086168452909152902054165b9392505050565b60046020526000908152604090205460ff1681565b62000f906200060d565b62000fc9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b7fffff00000000000000000000000000000000000000000000000000000000000091909116600090815260036020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260046020526040812054606091829160ff16806200109f575073ffffffffffffffffffffffffffffffffffffffff871660009081526004602052604090205460ff165b15620010d65760408051600080825260208201909252905b506040805160008082526020820190925291945090925090506200126e565b73ffffffffffffffffffffffffffffffffffffffff88811660009081526002602090815260408083208b8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008b1684529091529020541662001151576040805160008082526020820190925290620010b7565b73ffffffffffffffffffffffffffffffffffffffff80891660009081526002602090815260408083208b8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008b168452909152908190205490517f0b30a8d7000000000000000000000000000000000000000000000000000000008152911690630b30a8d790620011f19088908890600401620022d8565b60006040518083038186803b1580156200120a57600080fd5b505afa1580156200121f573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405262001267919081019062001e99565b9250925092505b955095509592505050565b620012836200060d565b620012bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090205460ff1615620005ee5773ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517fa1f26e166f408721b7578234199103d95e0aea4308d683b2f6c0ec86ac9e9e7390620005e59083906200225b565b6200137633848484620016e7565b505050565b620013856200060d565b620013be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023d6565b620005ee8162001a99565b3390565b82811015620014c3576001546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd9062001434908a90309086890390600401620022c8565b602060405180830381600087803b1580156200144f57600080fd5b505af115801562001464573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200148a919081019062001f14565b620014c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023e8565b8083101562001588576001546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb9062001528908a9087860390600401620022d8565b602060405180830381600087803b1580156200154357600080fd5b505af115801562001558573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200157e919081019062001f14565b6200158857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8087166000908152600260209081526040808320898516845282528083207fffff00000000000000000000000000000000000000000000000000000000000089168452909152908190205490517fb4decab600000000000000000000000000000000000000000000000000000000815291169063b4decab6906200162a908a9087908790600401620022f7565b600060405180830381600087803b1580156200164557600080fd5b505af11580156200165a573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f5065254984dfd953a97f48da9330ed3a61d8bc8cd2df88176b58f99d3ce81c3e8787604051620016d692919062002370565b60405180910390a450505050505050565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600260209081526040808320848716845282528083207fffff000000000000000000000000000000000000000000000000000000000000861684529091529020548491849184911662001785576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023c4565b73ffffffffffffffffffffffffffffffffffffffff8087166000908152600260209081526040808320898516845282528083207fffff000000000000000000000000000000000000000000000000000000000000891684529091528082205490517fd47875d00000000000000000000000000000000000000000000000000000000081529192169063d47875d09062001823908b906004016200225b565b60206040518083038186803b1580156200183c57600080fd5b505afa15801562001851573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062001877919081019062001f95565b73ffffffffffffffffffffffffffffffffffffffff80891660009081526002602090815260408083208b8516845282528083207fffff0000000000000000000000000000000000000000000000000000000000008b168452909152908190205490517f0ddcecf00000000000000000000000000000000000000000000000000000000081529293501690630ddcecf09062001917908b906004016200225b565b600060405180830381600087803b1580156200193257600080fd5b505af115801562001947573d6000803e3d6000fd5b50505050600081111562001a0f576001546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb90620019af908b908590600401620022d8565b602060405180830381600087803b158015620019ca57600080fd5b505af1158015620019df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062001a05919081019062001f14565b62001a0f57600080fd5b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f71735c1604645e893048a8e669bd75b5c1829b76fe6bd5a6cc0f2ac86eca6ff6888560405162001a8792919062002370565b60405180910390a45050505050505050565b73ffffffffffffffffffffffffffffffffffffffff811662001ae9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200046090620023a0565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6111e1806200250a83390190565b803562001b9181620024d1565b92915050565b805162001b9181620024d1565b600082601f83011262001bb657600080fd5b815162001bcd62001bc78262002434565b6200240c565b9150818183526020840193506020810190508385602084028201111562001bf357600080fd5b60005b8381101562001c23578162001c0c888262001ccd565b845250602092830192919091019060010162001bf6565b5050505092915050565b600082601f83011262001c3f57600080fd5b815162001c5062001bc78262002434565b9150818183526020840193506020810190508385602084028201111562001c7657600080fd5b60005b8381101562001c23578162001c8f888262001ccd565b845250602092830192919091019060010162001c79565b805162001b9181620024e8565b803562001b9181620024f3565b803562001b9181620024fe565b805162001b9181620024fe565b60006020828403121562001ced57600080fd5b600062000415848462001b84565b6000806000806080858703121562001d1257600080fd5b600062001d20878762001b84565b945050602062001d338782880162001b84565b935050604062001d468782880162001b84565b925050606062001d598782880162001cb3565b91505092959194509250565b60008060006060848603121562001d7b57600080fd5b600062001d89868662001b84565b935050602062001d9c8682870162001b84565b925050604062001daf8682870162001cb3565b9150509250925092565b600080600080600060a0868803121562001dd257600080fd5b600062001de0888862001b84565b955050602062001df38882890162001b84565b945050604062001e068882890162001cb3565b935050606062001e198882890162001b84565b925050608062001e2c8882890162001cc0565b9150509295509295909350565b600080600080600060a0868803121562001e5257600080fd5b600062001e60888862001b84565b955050602062001e738882890162001b84565b945050604062001e868882890162001cb3565b935050606062001e198882890162001cc0565b60008060006060848603121562001eaf57600080fd5b835167ffffffffffffffff81111562001ec757600080fd5b62001ed58682870162001ba4565b935050602084015167ffffffffffffffff81111562001ef357600080fd5b62001f018682870162001c2d565b925050604062001daf8682870162001b97565b60006020828403121562001f2757600080fd5b600062000415848462001ca6565b60006020828403121562001f4857600080fd5b600062000415848462001cb3565b6000806040838503121562001f6a57600080fd5b600062001f78858562001cb3565b925050602062001f8b8582860162001b84565b9150509250929050565b60006020828403121562001fa857600080fd5b600062000415848462001ccd565b600062001fc48383620020bd565b505060200190565b62001fd781620024bc565b82525050565b62001fd78162002469565b600062001ff5826200245c565b62002001818562002460565b93506200200e8362002456565b8060005b838110156200204257815162002029888262001fb6565b9750620020368362002456565b92505060010162002012565b509495945050505050565b60006200205a826200245c565b62002066818562002460565b9350620020738362002456565b8060005b83811015620020425781516200208e888262001fb6565b97506200209b8362002456565b92505060010162002077565b62001fd78162002476565b62001fd7816200247b565b62001fd781620024a0565b62001fd781620024c4565b6000620020e260268362002460565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015260400192915050565b60006200214360178362002460565b7f4c4f4341544f525f4e4f545f57484954454c4953544544000000000000000000815260200192915050565b60006200217e60148362002460565b7f494e4445585f444f45535f4e4f545f4558495354000000000000000000000000815260200192915050565b6000620021b960208362002460565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000620021f4600f8362002460565b7f554e41424c455f544f5f5354414b450000000000000000000000000000000000815260200192915050565b60006200222f60138362002460565b7f504149525f49535f424c41434b4c495354454400000000000000000000000000815260200192915050565b6020810162001b91828462001fdd565b6020810162001b91828462001fcc565b606081016200228b828662001fcc565b6200229a602083018562001fdd565b620004156040830184620020bd565b60608101620022b9828662001fcc565b6200229a6020830185620020bd565b606081016200228b828662001fdd565b60408101620022e8828562001fdd565b62000f6a6020830184620020bd565b60608101620022b9828662001fdd565b606080825281016200231a818662001fe8565b905081810360208301526200233081856200204d565b905062000415604083018462001fdd565b6020810162001b918284620020a7565b60408101620023618285620020b2565b62000f6a602083018462001fdd565b60408101620022e88285620020b2565b6020810162001b918284620020bd565b6020810162001b918284620020c8565b6020808252810162001b9181620020d3565b6020808252810162001b918162002134565b6020808252810162001b91816200216f565b6020808252810162001b9181620021aa565b6020808252810162001b9181620021e5565b6020808252810162001b918162002220565b60405181810167ffffffffffffffff811182821017156200242c57600080fd5b604052919050565b600067ffffffffffffffff8211156200244c57600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b600062001b9182620024a3565b151590565b7fffff0000000000000000000000000000000000000000000000000000000000001690565b90565b73ffffffffffffffffffffffffffffffffffffffff1690565b600062001b91825b600062001b918262002469565b620024dc8162002469565b8114620005ee57600080fd5b620024dc8162002476565b620024dc816200247b565b620024dc81620024a056fe608060405234801561001057600080fd5b506100226001600160e01b0361015116565b600080546001600160a01b0319166001600160a01b03928316178082556040519216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a360408051608081018252600080825260208083018281526001600160a01b039484018581526060850186815293869052600290925292517f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f15591517f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f25590517f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f380549184166001600160a01b031992831617905590517f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f48054919093169116179055610155565b3390565b61107d806101646000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80638da5cb5b11610081578063d47875d01161005b578063d47875d014610199578063f29ee125146101ac578063f2fde38b146101cf576100d4565b80638da5cb5b1461015c5780638f32d59b14610171578063b4decab614610186576100d4565b80631f7b6d32116100b25780631f7b6d321461012c5780634ec63ffe14610141578063715018a614610154576100d4565b80630589912a146100d95780630b30a8d7146100ee5780630ddcecf014610119575b600080fd5b6100ec6100e7366004610c86565b6101e2565b005b6101016100fc366004610c4c565b6102d4565b60405161011093929190610f00565b60405180910390f35b6100ec610127366004610c26565b610514565b6101346105c7565b6040516101109190610f42565b61013461014f366004610c26565b6105cd565b6100ec6105f9565b6101646106a6565b6040516101109190610ef2565b6101796106c2565b6040516101109190610f34565b6100ec610194366004610c86565b610700565b6101346101a7366004610c26565b610799565b6101bf6101ba366004610c26565b6107c4565b6040516101109493929190610f50565b6100ec6101dd366004610c26565b610806565b6101ea6106c2565b610229576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b60405180910390fd5b61023283610850565b15610269576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fce565b61027483838361087a565b600154600101600181905550808373ffffffffffffffffffffffffffffffffffffffff167f62d8270f77cd1e7351e3e92e7001b363e90eed2ef3394dbd51201ceee3672630846040516102c79190610f42565b60405180910390a3505050565b60608060008073ffffffffffffffffffffffffffffffffffffffff861615801590610315575073ffffffffffffffffffffffffffffffffffffffff86811614155b156103515761032386610850565b61034a5750506040805160008082526020820181815282840190935290935090915061050d565b5084610395565b5073ffffffffffffffffffffffffffffffffffffffff600081905260026020527f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f454165b600085600154106103a657856103aa565b6001545b9050806040519080825280602002602001820160405280156103d6578160200160208202803883390190505b50945080604051908082528060200260200182016040528015610403578160200160208202803883390190505b50935060005b818110801561042e575073ffffffffffffffffffffffffffffffffffffffff83811614155b156105075773ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054865187908390811061046757fe5b602002602001018181525050600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101548582815181106104c257fe5b60209081029190910181019190915273ffffffffffffffffffffffffffffffffffffffff93841660009081526002909152604090206003015490921691600101610409565b50909150505b9250925092565b61051c6106c2565b610552576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b61055b81610987565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905560405173ffffffffffffffffffffffffffffffffffffffff8216907fded788c834b3ea8a384c1495466a3a4a827c378cd9eafe5c159d90291ce0184490600090a250565b60015481565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260409020545b919050565b6106016106c2565b610637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000805473ffffffffffffffffffffffffffffffffffffffff166106e4610a66565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6107086106c2565b61073e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b61074783610987565b61075283838361087a565b808373ffffffffffffffffffffffffffffffffffffffff167f62d8270f77cd1e7351e3e92e7001b363e90eed2ef3394dbd51201ceee3672630846040516102c79190610f42565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090206001015490565b6002602081905260009182526040909120805460018201549282015460039092015490929173ffffffffffffffffffffffffffffffffffffffff908116911684565b61080e6106c2565b610844576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fbe565b61084d81610a6a565b50565b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902054151590565b806108b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610f9e565b60006108bc83610b44565b73ffffffffffffffffffffffffffffffffffffffff9081166000818152600260208181526040808420830180548716808652828620600390810180547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169e8b169e8f17909155835481168e1790935583516080810185529a8b528a85019b8c528a840191825260608b019788529b8652928490529320965187559651600187015595519585018054821696841696909617909555519290940180549093169190931617905550565b61099081610850565b6109c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610fae565b73ffffffffffffffffffffffffffffffffffffffff9081166000818152600260208190526040808320808301805460038084018054928a16808952868920909201805493909a167fffffffffffffffffffffffff00000000000000000000000000000000000000009384168117909a5598875293862090940180548516909317909255938352828455600190930191909155815481169091558154169055565b3390565b73ffffffffffffffffffffffffffffffffffffffff8116610ab7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022090610f8e565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff600081815260026020527f86cf984b44bed1f7f8b143f6052803e8b74964b2ee297832a77790be6d6308f45490911682610baa5773ffffffffffffffffffffffffffffffffffffffff9150506105f4565b5b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260409020600101548311610c0a5773ffffffffffffffffffffffffffffffffffffffff90811660009081526002602052604090206003015416610bab565b92915050565b8035610c0a8161101d565b8035610c0a81611031565b600060208284031215610c3857600080fd5b6000610c448484610c10565b949350505050565b60008060408385031215610c5f57600080fd5b6000610c6b8585610c10565b9250506020610c7c85828601610c1b565b9150509250929050565b600080600060608486031215610c9b57600080fd5b6000610ca78686610c10565b9350506020610cb886828701610c1b565b9250506040610cc986828701610c1b565b9150509250925092565b6000610cdf8383610da6565b505060200190565b610cf081610ff1565b82525050565b6000610d0182610fe4565b610d0b8185610fe8565b9350610d1683610fde565b8060005b83811015610d44578151610d2e8882610cd3565b9750610d3983610fde565b925050600101610d1a565b509495945050505050565b6000610d5a82610fe4565b610d648185610fe8565b9350610d6f83610fde565b8060005b83811015610d44578151610d878882610cd3565b9750610d9283610fde565b925050600101610d73565b610cf081610ffc565b610cf081611001565b6000610dbc602683610fe8565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015260400192915050565b6000610e1b601483610fe8565b7f4c4f4341544f525f4d5553545f42455f53454e54000000000000000000000000815260200192915050565b6000610e54601483610fe8565b7f454e5452595f444f45535f4e4f545f4558495354000000000000000000000000815260200192915050565b6000610e8d602083610fe8565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b6000610ec6601483610fe8565b7f454e5452595f414c52454144595f455849535453000000000000000000000000815260200192915050565b60208101610c0a8284610ce7565b60608082528101610f118186610cf6565b90508181036020830152610f258185610d4f565b9050610c446040830184610ce7565b60208101610c0a8284610d9d565b60208101610c0a8284610da6565b60808101610f5e8287610da6565b610f6b6020830186610da6565b610f786040830185610ce7565b610f856060830184610ce7565b95945050505050565b60208082528101610c0a81610daf565b60208082528101610c0a81610e0e565b60208082528101610c0a81610e47565b60208082528101610c0a81610e80565b60208082528101610c0a81610eb9565b60200190565b5190565b90815260200190565b6000610c0a82611004565b151590565b90565b73ffffffffffffffffffffffffffffffffffffffff1690565b61102681610ff1565b811461084d57600080fd5b6110268161100156fea365627a7a723158209a24c39b3554cf22113d7cb28ec95dbb1bacd8ef0b3d3e3023f0d3761f0191fc6c6578706572696d656e74616cf564736f6c634300050c0040a365627a7a72315820e0d27be72aa0cc6ff0659522d810af67b12252e75b05e96c37ccab45ff71b39a6c6578706572696d656e74616cf564736f6c634300050c0040

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

00000000000000000000000027054b13b1b798b345b591a4d22e6562d47ea75a

-----Decoded View---------------
Arg [0] : indexerStakingToken (address): 0x27054b13b1B798B345b591a4d22e6562d47eA75a

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000027054b13b1b798b345b591a4d22e6562d47ea75a


Swarm Source

bzzr://e0d27be72aa0cc6ff0659522d810af67b12252e75b05e96c37ccab45ff71b39a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.