Mumbai Testnet

Contract

0xa1A793d9Ff235FB02C570B2290Ee669144C6d053

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

Token Holdings

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Value
Buy351461342023-05-03 18:59:36329 days ago1683140376IN
0xa1A793d9...144C6d053
0.08 MATIC0.0009015730.814608
Buy351461342023-05-03 18:59:36329 days ago1683140376IN
0xa1A793d9...144C6d053
0.08 MATIC0.0009086731.05734036
Buy351461332023-05-03 18:59:34329 days ago1683140374IN
0xa1A793d9...144C6d053
0.08 MATIC0.0009178431.37060872
Buy351461332023-05-03 18:59:34329 days ago1683140374IN
0xa1A793d9...144C6d053
0.08 MATIC0.0009271831.69005673
Buy351461332023-05-03 18:59:34329 days ago1683140374IN
0xa1A793d9...144C6d053
0.9 MATIC0.000948232.4082461
Buy342487522023-04-11 17:15:17351 days ago1681233317IN
0xa1A793d9...144C6d053
0.4 MATIC0.0010198734.8580456
Buy322910012023-02-22 13:32:05399 days ago1677072725IN
0xa1A793d9...144C6d053
0.01929309 MATIC0.0011703139.99999999
Buy322910012023-02-22 13:32:05399 days ago1677072725IN
0xa1A793d9...144C6d053
0.63 MATIC0.001034835.36833112
Buy322910012023-02-22 13:32:05399 days ago1677072725IN
0xa1A793d9...144C6d053
0.71929 MATIC0.001034835.36833112
Buy322910012023-02-22 13:32:05399 days ago1677072725IN
0xa1A793d9...144C6d053
0.71929 MATIC0.0010513135.93268
Buy314418472023-01-26 19:47:39426 days ago1674762459IN
0xa1A793d9...144C6d053
1.6 MATIC0.0009458432.32761247
Buy314418472023-01-26 19:47:39426 days ago1674762459IN
0xa1A793d9...144C6d053
1.6 MATIC0.000953432.58608051
Buy314418472023-01-26 19:47:39426 days ago1674762459IN
0xa1A793d9...144C6d053
1.6 MATIC0.000968333.0954029
Buy314418472023-01-26 19:47:39426 days ago1674762459IN
0xa1A793d9...144C6d053
1.699 MATIC0.0009800133.49553758
Buy314418472023-01-26 19:47:39426 days ago1674762459IN
0xa1A793d9...144C6d053
1.699 MATIC0.0009820833.566265
Buy312048962023-01-20 23:35:13432 days ago1674257713IN
0xa1A793d9...144C6d053
0.69929309 MATIC0.0009703833.16652865
Buy312048962023-01-20 23:35:13432 days ago1674257713IN
0xa1A793d9...144C6d053
0.69929309 MATIC0.0009949234.00526409
Buy311336982023-01-19 5:31:11434 days ago1674106271IN
0xa1A793d9...144C6d053
1.69929309 MATIC0.0010057634.37568823
Buy288736202022-10-29 14:09:52515 days ago1667052592IN
0xa1A793d9...144C6d053
1.69929309 MATIC0.0014915550.97946012
Buy288736192022-10-29 14:09:47515 days ago1667052587IN
0xa1A793d9...144C6d053
1.69929309 MATIC0.0015540253.11454413
Buy288736182022-10-29 14:09:42515 days ago1667052582IN
0xa1A793d9...144C6d053
1.69929309 MATIC0.0014100148.19244076
Buy288736172022-10-29 14:09:37515 days ago1667052577IN
0xa1A793d9...144C6d053
1.69929309 MATIC0.0014628949.99999999
Buy288736162022-10-29 14:09:32515 days ago1667052572IN
0xa1A793d9...144C6d053
1.69929309 MATIC0.0014043847.99999999
Buy287627412022-10-23 3:35:06522 days ago1666496106IN
0xa1A793d9...144C6d053
1.69929309 MATIC0.0009597432.80298829
Buy287627392022-10-23 3:34:56522 days ago1666496096IN
0xa1A793d9...144C6d053
1.69929309 MATIC0.0009629232.91158792
View all transactions

Latest 25 internal transactions (View All)

Parent Txn Hash Block From To Value
278542212022-08-31 7:54:21575 days ago1661932461
0xa1A793d9...144C6d053
0.29929309 MATIC
278541902022-08-31 7:51:45575 days ago1661932305
0xa1A793d9...144C6d053
0.4 MATIC
278540992022-08-31 7:44:09575 days ago1661931849
0xa1A793d9...144C6d053
0.4 MATIC
278539952022-08-31 7:35:27575 days ago1661931327
0xa1A793d9...144C6d053
0.3 MATIC
278525522022-08-31 5:13:30575 days ago1661922810
0xa1A793d9...144C6d053
1.69929309 MATIC
278516322022-08-31 3:44:40575 days ago1661917480
0xa1A793d9...144C6d053
0.00692305 MATIC
278508502022-08-31 2:24:26575 days ago1661912666
0xa1A793d9...144C6d053
0.01699293 MATIC
278494382022-08-31 0:05:04575 days ago1661904304
0xa1A793d9...144C6d053
0.69929309 MATIC
278493182022-08-30 23:55:02575 days ago1661903702
0xa1A793d9...144C6d053
1.69929309 MATIC
278478052022-08-30 21:27:03575 days ago1661894823
0xa1A793d9...144C6d053
0.01 MATIC
278478032022-08-30 21:26:43575 days ago1661894803
0xa1A793d9...144C6d053
0.01 MATIC
278467292022-08-30 19:36:47575 days ago1661888207
0xa1A793d9...144C6d053
1.69929309 MATIC
278454842022-08-30 17:18:17575 days ago1661879897
0xa1A793d9...144C6d053
1.69929309 MATIC
278446092022-08-30 15:40:04575 days ago1661874004
0xa1A793d9...144C6d053
0.01699293 MATIC
278437762022-08-30 14:03:46575 days ago1661868226
0xa1A793d9...144C6d053
0.2 MATIC
278436742022-08-30 13:52:09575 days ago1661867529
0xa1A793d9...144C6d053
1.69929309 MATIC
278435212022-08-30 13:31:57575 days ago1661866317
0xa1A793d9...144C6d053
0.018 MATIC
278433422022-08-30 13:12:44575 days ago1661865164
0xa1A793d9...144C6d053
0.45 MATIC
278432482022-08-30 13:03:37575 days ago1661864617
0xa1A793d9...144C6d053
0.6 MATIC
278432082022-08-30 13:00:17575 days ago1661864417
0xa1A793d9...144C6d053
1.69929309 MATIC
278427312022-08-30 12:04:24575 days ago1661861064
0xa1A793d9...144C6d053
1.69929309 MATIC
278425672022-08-30 11:45:22575 days ago1661859922
0xa1A793d9...144C6d053
1 MATIC
278424872022-08-30 11:38:00575 days ago1661859480
0xa1A793d9...144C6d053
0.9 MATIC
278424502022-08-30 11:31:50575 days ago1661859110
0xa1A793d9...144C6d053
0.8 MATIC
278424482022-08-30 11:31:30575 days ago1661859090
0xa1A793d9...144C6d053
0.8 MATIC
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SaleManager

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 11 : SaleManager.sol
pragma solidity >=0.8.0 <0.9.0;
// SPDX-License-Identifier: MIT

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/PullPayment.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

contract SaleManager is ReentrancyGuard, PullPayment {
  using SafeERC20 for IERC20;

  AggregatorV3Interface priceOracle;
  IERC20 public immutable paymentToken;
  uint8 public immutable paymentTokenDecimals;

  struct Sale {
    address payable recipient; // the address that will receive sale proceeds
    address admin; // the address administering the sale
    bytes32 merkleRoot; // the merkle root used for proving access
    address claimManager; // address where purchased tokens can be claimed (optional)
    uint256 saleBuyLimit;  // max tokens that can be spent in total
    uint256 userBuyLimit;  // max tokens that can be spent per user
    uint256 purchaseMinimum; // minimum tokens that can be spent per purchase
    uint startTime; // the time at which the sale starts (seconds past the epoch)
    uint endTime; // the time at which the sale will end, regardless of tokens raised (seconds past the epoch)
    string uri; // reference to off-chain sale configuration (e.g. IPFS URI)
    uint256 price; // the price of the asset (eg if 1.0 NCT == $1.23 of USDC: 1230000)
    uint8 decimals; // the number of decimals in the asset being sold, e.g. 18
    uint256 totalSpent; // total purchases denominated in payment token
    uint256 maxQueueTime; // what is the maximum length of time a user could wait in the queue after the sale starts?
    uint160 randomValue; // reasonably random value: xor of merkle root and blockhash for transaction setting merkle root
    mapping(address => uint256) spent;
  }

  // this struct has two many members for a public getter
  mapping (bytes32 => Sale) private sales;

  // global metrics
  uint256 public saleCount = 0;
  uint256 public totalSpent = 0;

  // public version
  string public constant VERSION = '1.3';

  event NewSale(
    bytes32 indexed saleId,
    bytes32 indexed merkleRoot,
    address indexed recipient,
    address admin,
    uint256 saleBuyLimit,
    uint256 userBuyLimit,
    uint256 purchaseMinimum,
    uint256 maxQueueTime,
    uint startTime,
    uint endTime,
    string uri,
    uint256 price,
    uint8 decimals
  );

  event Deploy(address paymentToken, uint8 paymentTokenDecimals, address priceOracle);
  event UpdateStart(bytes32 indexed saleId, uint startTime);
  event UpdateEnd(bytes32 indexed saleId, uint endTime);
  event UpdateMerkleRoot(bytes32 indexed saleId, bytes32 merkleRoot);
  event UpdateMaxQueueTime(bytes32 indexed saleId, uint256 maxQueueTime);
  event Buy(bytes32 indexed saleId, address indexed buyer, uint256 value, bool native, bytes32[] proof);
  event RegisterClaimManager(bytes32 indexed saleId, address indexed claimManager);
  event UpdateUri(bytes32 indexed saleId, string uri);

  constructor(
    address _paymentToken,
    uint8 _paymentTokenDecimals,
    address _priceOracle
  ) payable {
    paymentToken = IERC20(_paymentToken);
    paymentTokenDecimals = _paymentTokenDecimals;
    priceOracle = AggregatorV3Interface(_priceOracle);
    emit Deploy(_paymentToken, _paymentTokenDecimals, _priceOracle);
  }

  modifier validSale (bytes32 saleId) {
    // if the admin is address(0) there is no sale struct at this saleId
    require(
      sales[saleId].admin != address(0),
      "invalid sale id"
    );
    _;
  }

  modifier isAdmin(bytes32 saleId) {
    // msg.sender is never address(0) so this handles uninitialized sales
    require(
      sales[saleId].admin == msg.sender,
      "must be admin"
    );
    _;
  }

  modifier canAccessSale(bytes32 saleId, bytes32[] calldata proof) {
    // make sure the buyer is an EOA
    require((msg.sender == tx.origin), "Must buy with an EOA");

    // If the merkle root is non-zero this is a private sale and requires a valid proof
    if (sales[saleId].merkleRoot != bytes32(0)) {
      require(
        this._isAllowed(
          sales[saleId].merkleRoot,
          msg.sender,
          proof
        ) == true,
        "bad merkle proof for sale"
      );
    }

    // Reduce congestion by randomly assigning each user a delay time in a virtual queue based on comparing their address and a random value
    // if sale.maxQueueTime == 0 the delay is 0
    require(block.timestamp - sales[saleId].startTime > getFairQueueTime(saleId, msg.sender), "not your turn yet");

    _;
  }

  modifier requireOpen(bytes32 saleId) {
    require(block.timestamp > sales[saleId].startTime, "sale not started yet");
    require(block.timestamp < sales[saleId].endTime, "sale ended");
    require(sales[saleId].totalSpent < sales[saleId].saleBuyLimit, "sale over");
    _;
  }

  // Get current price from chainlink oracle
  function getLatestPrice() public view returns (uint) {
    (
        uint80 roundID,
        int price,
        uint startedAt,
        uint timeStamp,
        uint80 answeredInRound
    ) = priceOracle.latestRoundData();

    require(price > 0, "negative price");
    return uint(price);
  }

  // Accessor functions
  function getAdmin(bytes32 saleId) public validSale(saleId) view returns(address) {
    return(sales[saleId].admin);
  }

  function getRecipient(bytes32 saleId) public validSale(saleId) view returns(address) {
    return(sales[saleId].recipient);
  }

  function getMerkleRoot(bytes32 saleId) public validSale(saleId) view returns(bytes32) {
    return(sales[saleId].merkleRoot);
  }

  function getPriceOracle() public view returns(address) {
    return address(priceOracle);
  }

  function getClaimManager(bytes32 saleId) public validSale(saleId) view returns(address) {
    return (sales[saleId].claimManager);
  }


  function getSaleBuyLimit(bytes32 saleId) public validSale(saleId) view returns(uint256) {
    return(sales[saleId].saleBuyLimit);
  }

  function getUserBuyLimit(bytes32 saleId) public validSale(saleId) view returns(uint256) {
    return(sales[saleId].userBuyLimit);
  }

  function getPurchaseMinimum(bytes32 saleId) public validSale(saleId) view returns(uint256) {
    return(sales[saleId].purchaseMinimum);
  }

  function getStartTime(bytes32 saleId) public validSale(saleId) view returns(uint) {
    return(sales[saleId].startTime);
  }

  function getEndTime(bytes32 saleId) public validSale(saleId) view returns(uint) {
    return(sales[saleId].endTime);
  }

  function getUri(bytes32 saleId) public validSale(saleId) view returns(string memory) {
    return sales[saleId].uri;
  }

  function getPrice(bytes32 saleId) public validSale(saleId) view returns(uint) {
    return(sales[saleId].price);
  }

  function getDecimals(bytes32 saleId) public validSale(saleId) view returns(uint256) {
    return (sales[saleId].decimals);
  }

  function getTotalSpent(bytes32 saleId) public validSale(saleId) view returns(uint256) {
    return (sales[saleId].totalSpent);
  }

  function getRandomValue(bytes32 saleId) public validSale(saleId) view returns(uint160) {
    return sales[saleId].randomValue;
  }

  function getMaxQueueTime(bytes32 saleId) public validSale(saleId) view returns(uint256) {
    return sales[saleId].maxQueueTime;
  }

  function generateRandomishValue(bytes32 merkleRoot) public view returns(uint160) {
    /**
      Generate a randomish numeric value in the range [0, 2 ^ 160 - 1]

      This is not a truly random value:
      - miners can alter the previous block's hash by holding the transaction in the mempool
      - admins can choose when to submit the transaction
      - admins can repeatedly call setMerkleRoot()
    */
    return uint160(uint256(blockhash(block.number - 1))) ^ uint160(uint256(merkleRoot));
  }

  function getFairQueueTime(bytes32 saleId, address buyer) public validSale(saleId) view returns(uint) {
    /**
      Get the delay in seconds that a specific buyer must wait after the sale begins in order to buy tokens in the sale

      Buyers cannot exploit the fair queue when:
      - The sale is private (merkle root != bytes32(0))
      - Each eligible buyer gets exactly one address in the merkle root

      Although miners and admins can minimize the delay for an arbitrary address, these are not significant threats
      - the economic opportunity to miners is zero or relatively small (only specific addresses can participate in private sales, and a better queue postion does not imply high returns)
      - admins can repeatedly set merkle roots (but admins already control the tokens being sold!)

    */
    if (sales[saleId].maxQueueTime == 0) {
      // there is no delay: all addresses may participate immediately
      return 0;
    }

    // calculate a distance between the random value and the user's address using the XOR distance metric (c.f. Kademlia)
    uint160 distance = uint160(buyer) ^ sales[saleId].randomValue;

    // calculate a speed at which the queue is exhausted such that all users complete the queue by sale.maxQueueTime
    uint160 distancePerSecond = type(uint160).max / uint160(sales[saleId].maxQueueTime);
    // return the delay (seconds)
    return distance / distancePerSecond;
  }

  function spentToBought(bytes32 saleId, uint256 spent) public view returns (uint256) {
    // Convert tokens spent (e.g. 10,000,000 USDC = $10) to tokens bought (e.g. 8.13e18) at a price of $1.23/NCT
    // convert an integer value of tokens spent to an integer value of tokens bought
    return (spent * 10 ** sales[saleId].decimals ) / (sales[saleId].price);
  }

  function nativeToPaymentToken(uint256 nativeValue) public view returns (uint256) {
    // convert a payment in the native token (eg ETH) to an integer value of the payment token
    return (nativeValue * getLatestPrice() * 10 ** paymentTokenDecimals) / (10 ** (priceOracle.decimals() + 18));
  }

  function getSpent(
      bytes32 saleId,
      address userAddress
    ) public validSale(saleId) view returns(uint256) {
    // returns the amount spent by this user in paymentToken
    return(sales[saleId].spent[userAddress]);
  }

  function getBought(
      bytes32 saleId,
      address userAddress
    ) public validSale(saleId) view returns(uint256) {
    // returns the amount bought by this user in the new token being sold
    return(spentToBought(saleId, sales[saleId].spent[userAddress]));
  }

  function isOpen(bytes32 saleId) public validSale(saleId) view returns(bool) {
    // is the sale currently open?
    return(
      block.timestamp > sales[saleId].startTime
      && block.timestamp < sales[saleId].endTime
      && sales[saleId].totalSpent < sales[saleId].saleBuyLimit
    );
  }

  function isOver(bytes32 saleId) public validSale(saleId) view returns(bool) {
    // is the sale permanently over?
    return(
      block.timestamp >= sales[saleId].endTime || sales[saleId].totalSpent >= sales[saleId].saleBuyLimit
    );
  }

  /**
  sale setup and config
  - the address calling this method is the admin: only the admin can change sale configuration
  - all payments are sent to the the recipient
  */
  function newSale(
    address payable recipient,
    bytes32 merkleRoot,
    uint256 saleBuyLimit,
    uint256 userBuyLimit,
    uint256 purchaseMinimum,
    uint startTime,
    uint endTime,
    uint160 maxQueueTime,
    string memory uri,
    uint256 price,
    uint8 decimals
  ) public returns(bytes32) {
    require(recipient != address(0), "recipient must not be zero address");
    require(startTime <= 4102444800, "max: 4102444800 (Jan 1 2100)");
    require(endTime <= 4102444800, "max: 4102444800 (Jan 1 2100)");
    require(startTime < endTime, "sale must start before it ends");
    require(endTime > block.timestamp, "sale must end in future");
    require(userBuyLimit <= saleBuyLimit, "userBuyLimit cannot exceed saleBuyLimit");
    require(purchaseMinimum <= userBuyLimit, "purchaseMinimum cannot exceed userBuyLimit");
    require(userBuyLimit > 0, "userBuyLimit must be > 0");
    require(saleBuyLimit > 0, "saleBuyLimit must be > 0");
    require(endTime - startTime > maxQueueTime, "sale must be open for longer than max queue time");

    // Generate a reorg-resistant sale ID
    bytes32 saleId = keccak256(abi.encodePacked(
      merkleRoot,
      recipient,
      saleBuyLimit,
      userBuyLimit,
      purchaseMinimum,
      startTime,
      endTime,
      uri,
      price,
      decimals
    ));

    // This ensures the Sale struct wasn't already created (msg.sender will never be the zero address)
    require(sales[saleId].admin == address(0), "a sale with these parameters already exists");

    Sale storage s = sales[saleId];

    s.merkleRoot = merkleRoot;
    s.admin = msg.sender;
    s.recipient = recipient;
    s.saleBuyLimit = saleBuyLimit;
    s.userBuyLimit = userBuyLimit;
    s.purchaseMinimum = purchaseMinimum;
    s.startTime = startTime;
    s.endTime = endTime;
    s.price = price;
    s.decimals = decimals;
    s.uri = uri;
    s.maxQueueTime = maxQueueTime;
    s.randomValue = generateRandomishValue(merkleRoot);

    saleCount++;

    emit NewSale(
      saleId,
      s.merkleRoot,
      s.recipient,
      s.admin,
      s.saleBuyLimit,
      s.userBuyLimit,
      s.purchaseMinimum,
      s.maxQueueTime,
      s.startTime,
      s.endTime,
      s.uri,
      s.price,
      s.decimals
    );

    return saleId;
  }

  function setStart(bytes32 saleId, uint startTime) public validSale(saleId) isAdmin(saleId) {
    // admin can update start time until the sale starts
    require(block.timestamp < sales[saleId].endTime, "disabled after sale close");
    require(startTime < sales[saleId].endTime, "sale start must precede end");
    require(startTime <= 4102444800, "max: 4102444800 (Jan 1 2100)");
    require(sales[saleId].endTime - startTime > sales[saleId].maxQueueTime, "sale must be open for longer than max queue time");

    sales[saleId].startTime = startTime;
    emit UpdateStart(saleId, startTime);
  }

  function setEnd(bytes32 saleId, uint endTime) public validSale(saleId) isAdmin(saleId){
    // admin can update end time until the sale ends
    require(block.timestamp < sales[saleId].endTime, "disabled after sale closes");
    require(endTime > block.timestamp, "sale must end in future");
    require(endTime <= 4102444800, "max: 4102444800 (Jan 1 2100)");
    require(sales[saleId].startTime < endTime, "sale must start before it ends");
    require(endTime - sales[saleId].startTime > sales[saleId].maxQueueTime, "sale must be open for longer than max queue time");

    sales[saleId].endTime = endTime;
    emit UpdateEnd(saleId, endTime);
  }

  function setMerkleRoot(bytes32 saleId, bytes32 merkleRoot) public validSale(saleId) isAdmin(saleId){
    require(!isOver(saleId), "cannot set merkle root once sale is over");
    sales[saleId].merkleRoot = merkleRoot;
    sales[saleId].randomValue = generateRandomishValue(merkleRoot);
    emit UpdateMerkleRoot(saleId, merkleRoot);
  }

  function setMaxQueueTime(bytes32 saleId, uint160 maxQueueTime) public validSale(saleId) isAdmin(saleId) {
    // the queue time may be adjusted after the sale begins
    require(sales[saleId].endTime > block.timestamp, "cannot adjust max queue time after sale ends");
    sales[saleId].maxQueueTime = maxQueueTime;
    emit UpdateMaxQueueTime(saleId, maxQueueTime);
  }

  function setUriAndMerkleRoot(bytes32 saleId, bytes32 merkleRoot, string calldata uri) public validSale(saleId) isAdmin(saleId) {
    sales[saleId].uri = uri;
    setMerkleRoot(saleId, merkleRoot);
    emit UpdateUri(saleId, uri);
  }

  function _isAllowed(
      bytes32 root,
      address account,
      bytes32[] calldata proof
  ) external pure returns (bool) {
    // check if the account is in the merkle tree
    bytes32 leaf = keccak256(abi.encodePacked(account));
    if (MerkleProof.verify(proof, root, leaf)) {
      return true;
    }
    return false;
  }

  // pay with the payment token (eg USDC)
  function buy(
    bytes32 saleId,
    uint256 tokenQuantity,
    bytes32[] calldata proof
  ) public validSale(saleId) requireOpen(saleId) canAccessSale(saleId, proof) nonReentrant {
    // make sure the purchase would not break any sale limits
    require(
      tokenQuantity >= sales[saleId].purchaseMinimum,
      "purchase below minimum"
    );

    require(
      tokenQuantity + sales[saleId].spent[msg.sender] <= sales[saleId].userBuyLimit,
      "purchase exceeds your limit"
    );

    require(
      tokenQuantity + sales[saleId].totalSpent <= sales[saleId].saleBuyLimit,
      "purchase exceeds sale limit"
    );

    require(paymentToken.allowance(msg.sender, address(this)) >= tokenQuantity, "allowance too low");

    // move the funds
    paymentToken.safeTransferFrom(msg.sender, sales[saleId].recipient, tokenQuantity);

    // effects after interaction: we need a reentrancy guard
    sales[saleId].spent[msg.sender] += tokenQuantity;
    sales[saleId].totalSpent += tokenQuantity;
    totalSpent += tokenQuantity;

    emit Buy(saleId, msg.sender, tokenQuantity, false, proof);
  }

  // pay with the native token
  function buy(
    bytes32 saleId,
    bytes32[] calldata proof
  ) public payable validSale(saleId) requireOpen(saleId) canAccessSale(saleId, proof) nonReentrant {
    // convert to the equivalent payment token value from wei
    uint256 tokenQuantity = nativeToPaymentToken(msg.value);
  
    // make sure the purchase would not break any sale limits
    require(
      tokenQuantity >= sales[saleId].purchaseMinimum,
      "purchase below minimum"
    );

    require(
      tokenQuantity + sales[saleId].spent[msg.sender] <= sales[saleId].userBuyLimit,
      "purchase exceeds your limit"
    );

    require(
      tokenQuantity + sales[saleId].totalSpent <= sales[saleId].saleBuyLimit,
      "purchase exceeds sale limit"
    );

    // Forward eth to PullPayment escrow for withdrawal to recipient
    /**
     * @dev OZ PullPayment._asyncTransfer
     * @dev Called by the payer to store the sent amount as credit to be pulled.
     * Funds sent in this way are stored in an intermediate {Escrow} contract,
     * so there is no danger of them being spent before withdrawal.
     *
     * @param dest The destination address of the funds.
     * @param amount The amount to transfer.
     */
    _asyncTransfer(getRecipient(saleId), msg.value);

    // account for the purchase in equivalent payment token value
    sales[saleId].spent[msg.sender] += tokenQuantity;
    sales[saleId].totalSpent += tokenQuantity;
    totalSpent += tokenQuantity;

    // flag this payment as using the native token
    emit Buy(saleId, msg.sender, tokenQuantity, true, proof);
  }

  // Tell users where they can claim tokens
  function registerClaimManager(bytes32 saleId, address claimManager) public validSale(saleId) isAdmin(saleId) {
    require(claimManager != address(0), "Claim manager must be a non-zero address");
    sales[saleId].claimManager = claimManager;
    emit RegisterClaimManager(saleId, claimManager);
  }

  function recoverERC20(bytes32 saleId, address tokenAddress, uint256 tokenAmount) public isAdmin(saleId) {
    IERC20(tokenAddress).transfer(getRecipient(saleId), tokenAmount);
  }
}

File 2 of 11 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
}

File 3 of 11 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * 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.
 */
abstract 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() {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the 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 virtual onlyOwner {
        _transferOwnership(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 virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 4 of 11 : PullPayment.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/PullPayment.sol)

pragma solidity ^0.8.0;

import "../utils/escrow/Escrow.sol";

/**
 * @dev Simple implementation of a
 * https://consensys.github.io/smart-contract-best-practices/recommendations/#favor-pull-over-push-for-external-calls[pull-payment]
 * strategy, where the paying contract doesn't interact directly with the
 * receiver account, which must withdraw its payments itself.
 *
 * Pull-payments are often considered the best practice when it comes to sending
 * Ether, security-wise. It prevents recipients from blocking execution, and
 * eliminates reentrancy concerns.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 *
 * To use, derive from the `PullPayment` contract, and use {_asyncTransfer}
 * instead of Solidity's `transfer` function. Payees can query their due
 * payments with {payments}, and retrieve them with {withdrawPayments}.
 */
abstract contract PullPayment {
    Escrow private immutable _escrow;

    constructor() {
        _escrow = new Escrow();
    }

    /**
     * @dev Withdraw accumulated payments, forwarding all gas to the recipient.
     *
     * Note that _any_ account can call this function, not just the `payee`.
     * This means that contracts unaware of the `PullPayment` protocol can still
     * receive funds this way, by having a separate account call
     * {withdrawPayments}.
     *
     * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
     * Make sure you trust the recipient, or are either following the
     * checks-effects-interactions pattern or using {ReentrancyGuard}.
     *
     * @param payee Whose payments will be withdrawn.
     */
    function withdrawPayments(address payable payee) public virtual {
        _escrow.withdraw(payee);
    }

    /**
     * @dev Returns the payments owed to an address.
     * @param dest The creditor's address.
     */
    function payments(address dest) public view returns (uint256) {
        return _escrow.depositsOf(dest);
    }

    /**
     * @dev Called by the payer to store the sent amount as credit to be pulled.
     * Funds sent in this way are stored in an intermediate {Escrow} contract, so
     * there is no danger of them being spent before withdrawal.
     *
     * @param dest The destination address of the funds.
     * @param amount The amount to transfer.
     */
    function _asyncTransfer(address dest, uint256 amount) internal virtual {
        _escrow.deposit{value: amount}(dest);
    }
}

File 5 of 11 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 6 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
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 7 of 11 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.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 IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    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));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 8 of 11 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is 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.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @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].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 9 of 11 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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 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.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 10 of 11 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }
        return computedHash;
    }
}

File 11 of 11 : Escrow.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/escrow/Escrow.sol)

pragma solidity ^0.8.0;

import "../../access/Ownable.sol";
import "../Address.sol";

/**
 * @title Escrow
 * @dev Base escrow contract, holds funds designated for a payee until they
 * withdraw them.
 *
 * Intended usage: This contract (and derived escrow contracts) should be a
 * standalone contract, that only interacts with the contract that instantiated
 * it. That way, it is guaranteed that all Ether will be handled according to
 * the `Escrow` rules, and there is no need to check for payable functions or
 * transfers in the inheritance tree. The contract that uses the escrow as its
 * payment method should be its owner, and provide public methods redirecting
 * to the escrow's deposit and withdraw.
 */
contract Escrow is Ownable {
    using Address for address payable;

    event Deposited(address indexed payee, uint256 weiAmount);
    event Withdrawn(address indexed payee, uint256 weiAmount);

    mapping(address => uint256) private _deposits;

    function depositsOf(address payee) public view returns (uint256) {
        return _deposits[payee];
    }

    /**
     * @dev Stores the sent amount as credit to be withdrawn.
     * @param payee The destination address of the funds.
     */
    function deposit(address payee) public payable virtual onlyOwner {
        uint256 amount = msg.value;
        _deposits[payee] += amount;
        emit Deposited(payee, amount);
    }

    /**
     * @dev Withdraw accumulated balance for a payee, forwarding all gas to the
     * recipient.
     *
     * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
     * Make sure you trust the recipient, or are either following the
     * checks-effects-interactions pattern or using {ReentrancyGuard}.
     *
     * @param payee The address whose funds will be withdrawn and transferred to.
     */
    function withdraw(address payable payee) public virtual onlyOwner {
        uint256 payment = _deposits[payee];

        _deposits[payee] = 0;

        payee.sendValue(payment);

        emit Withdrawn(payee, payment);
    }
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_paymentToken","type":"address"},{"internalType":"uint8","name":"_paymentTokenDecimals","type":"uint8"},{"internalType":"address","name":"_priceOracle","type":"address"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"saleId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bool","name":"native","type":"bool"},{"indexed":false,"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"paymentToken","type":"address"},{"indexed":false,"internalType":"uint8","name":"paymentTokenDecimals","type":"uint8"},{"indexed":false,"internalType":"address","name":"priceOracle","type":"address"}],"name":"Deploy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"saleId","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"saleBuyLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"userBuyLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"purchaseMinimum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxQueueTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"},{"indexed":false,"internalType":"string","name":"uri","type":"string"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"decimals","type":"uint8"}],"name":"NewSale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"saleId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"claimManager","type":"address"}],"name":"RegisterClaimManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"saleId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"UpdateEnd","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"saleId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"maxQueueTime","type":"uint256"}],"name":"UpdateMaxQueueTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"saleId","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"UpdateMerkleRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"saleId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"}],"name":"UpdateStart","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"saleId","type":"bytes32"},{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"UpdateUri","type":"event"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"_isAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"uint256","name":"tokenQuantity","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"buy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"generateRandomishValue","outputs":[{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"address","name":"userAddress","type":"address"}],"name":"getBought","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getClaimManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"address","name":"buyer","type":"address"}],"name":"getFairQueueTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getMaxQueueTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriceOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getPurchaseMinimum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getRandomValue","outputs":[{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getSaleBuyLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"address","name":"userAddress","type":"address"}],"name":"getSpent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getTotalSpent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"getUserBuyLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"isOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"}],"name":"isOver","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nativeValue","type":"uint256"}],"name":"nativeToPaymentToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"saleBuyLimit","type":"uint256"},{"internalType":"uint256","name":"userBuyLimit","type":"uint256"},{"internalType":"uint256","name":"purchaseMinimum","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint160","name":"maxQueueTime","type":"uint160"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"name":"newSale","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paymentToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentTokenDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dest","type":"address"}],"name":"payments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"address","name":"claimManager","type":"address"}],"name":"registerClaimManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"setEnd","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"uint160","name":"maxQueueTime","type":"uint160"}],"name":"setMaxQueueTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"uint256","name":"startTime","type":"uint256"}],"name":"setStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"string","name":"uri","type":"string"}],"name":"setUriAndMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"saleId","type":"bytes32"},{"internalType":"uint256","name":"spent","type":"uint256"}],"name":"spentToBought","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSpent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"payee","type":"address"}],"name":"withdrawPayments","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e0604052600060035560006004556040516200458c3803806200458c833981016040819052620000309162000139565b600160005560405162000043906200010e565b604051809103906000f08015801562000060573d6000803e3d6000fd5b50606090811b6001600160601b031990811660805284821b1660a05260f883901b7fff000000000000000000000000000000000000000000000000000000000000001660c052600180546001600160a01b0319166001600160a01b0384811691821790925560408051928716835260ff861660208401528201527f38d1aed58aae630c8dc4b743a178514156b1d122d81b1034ba958fcc0082f25b910160405180910390a150505062000188565b6105ef8062003f9d83390190565b80516001600160a01b03811681146200013457600080fd5b919050565b6000806000606084860312156200014e578283fd5b62000159846200011c565b9250602084015160ff811681146200016f578283fd5b91506200017f604085016200011c565b90509250925092565b60805160601c60a05160601c60c05160f81c613db9620001e4600039600081816104010152611ee201526000818161038d01528181612b640152612c45015260008181610dac01528181612d3d0152612ee40152613db96000f3fe60806040526004361061025c5760003560e01c8063976b205011610144578063c96c9d49116100b6578063eb28322e1161007a578063eb28322e14610763578063ef8148b214610783578063fb346eab146107a3578063fbc6da75146107b9578063fca513a8146107d9578063ffa1ad74146107f757600080fd5b8063c96c9d49146106c3578063ccc325c2146106e3578063dda513da14610703578063dee5ab4314610723578063e2982c211461074357600080fd5b8063b8f8a0b311610108578063b8f8a0b314610610578063b94c69aa14610630578063bac4dd8814610650578063bc8bf09314610670578063c83b55f314610683578063c95970be146106a357600080fd5b8063976b20501461057a578063a1e89aec1461059a578063a7206cd6146105b0578063ad9a6865146105d0578063b8211d90146105f057600080fd5b8063325cd796116101dd578063628f9fa0116101a1578063628f9fa0146104c557806375edcbe0146104e55780637c35be7a1461050557806380c6e70a146105255780638e15f47314610545578063939d60651461055a57600080fd5b8063325cd796146103ef5780633f6fdf3c146104355780634f8b50b01461045557806350fa4ff2146104855780635f0fe446146104a557600080fd5b8063231bedc711610224578063231bedc71461033b57806327e542301461035b5780633013ce291461037b57806331b3eb94146103af57806331d98b3f146103cf57600080fd5b8063080d840c14610261578063087c2be71461029e578063089ed435146102cb5780630ad0607f146102f957806312105fea1461031b575b600080fd5b34801561026d57600080fd5b5061028161027c36600461353e565b610826565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102aa57600080fd5b506102be6102b936600461353e565b61088c565b60405161029591906139d7565b3480156102d757600080fd5b506102eb6102e636600461353e565b61096a565b604051908152602001610295565b34801561030557600080fd5b50610319610314366004613556565b6109ba565b005b34801561032757600080fd5b506102eb61033636600461353e565b610b00565b34801561034757600080fd5b5061028161035636600461353e565b610b53565b34801561036757600080fd5b50610319610376366004613660565b610bac565b34801561038757600080fd5b506102817f000000000000000000000000000000000000000000000000000000000000000081565b3480156103bb57600080fd5b506103196103ca36600461344a565b610d8d565b3480156103db57600080fd5b506102eb6103ea36600461353e565b610e0b565b3480156103fb57600080fd5b506104237f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610295565b34801561044157600080fd5b506102eb610450366004613466565b610e5b565b34801561046157600080fd5b5061047561047036600461353e565b6113e3565b6040519015158152602001610295565b34801561049157600080fd5b506103196104a0366004613660565b61145a565b3480156104b157600080fd5b506102eb6104c0366004613660565b611683565b3480156104d157600080fd5b506102eb6104e036600461353e565b6116c9565b3480156104f157600080fd5b50610319610500366004613660565b611719565b34801561051157600080fd5b5061047561052036600461353e565b611874565b34801561053157600080fd5b5061028161054036600461353e565b611903565b34801561055157600080fd5b506102eb61195c565b34801561056657600080fd5b506102eb61057536600461353e565b611a40565b34801561058657600080fd5b506102eb610595366004613556565b611a90565b3480156105a657600080fd5b506102eb60035481565b3480156105bc57600080fd5b506102eb6105cb36600461353e565b611b04565b3480156105dc57600080fd5b506104756105eb366004613585565b611b55565b3480156105fc57600080fd5b506102eb61060b36600461353e565b611bee565b34801561061c57600080fd5b5061031961062b3660046135df565b611c3e565b34801561063c57600080fd5b5061031961064b366004613556565b611d11565b34801561065c57600080fd5b506102eb61066b36600461353e565b611e4a565b61031961067e366004613616565b611f2e565b34801561068f57600080fd5b506102eb61069e366004613556565b612482565b3480156106af57600080fd5b506103196106be366004613681565b6124e9565b3480156106cf57600080fd5b506102816106de36600461353e565b6125c6565b3480156106ef57600080fd5b506102eb6106fe366004613556565b6125dc565b34801561070f57600080fd5b506102eb61071e36600461353e565b612685565b34801561072f57600080fd5b5061031961073e3660046136fc565b6126d5565b34801561074f57600080fd5b506102eb61075e36600461344a565b612d1b565b34801561076f57600080fd5b506102eb61077e36600461353e565b612db9565b34801561078f57600080fd5b506102eb61079e36600461353e565b612e09565b3480156107af57600080fd5b506102eb60045481565b3480156107c557600080fd5b506102816107d436600461353e565b612e59565b3480156107e557600080fd5b506001546001600160a01b0316610281565b34801561080357600080fd5b506102be60405180604001604052806003815260200162312e3360e81b81525081565b60008181526002602052604081206001015482906001600160a01b03166108685760405162461bcd60e51b815260040161085f90613ab8565b60405180910390fd5b6000838152600260205260409020600e01546001600160a01b031691505b50919050565b60008181526002602052604090206001015460609082906001600160a01b03166108c85760405162461bcd60e51b815260040161085f90613ab8565b600083815260026020526040902060090180546108e490613cca565b80601f016020809104026020016040519081016040528092919081815260200182805461091090613cca565b801561095d5780601f106109325761010080835404028352916020019161095d565b820191906000526020600020905b81548152906001019060200180831161094057829003601f168201915b5050505050915050919050565b60008181526002602052604081206001015482906001600160a01b03166109a35760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206005015490565b60008281526002602052604090206001015482906001600160a01b03166109f35760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b03163314610a2e5760405162461bcd60e51b815260040161085f90613a0a565b6000848152600260205260409020600801544210610aa35760405162461bcd60e51b815260206004820152602c60248201527f63616e6e6f742061646a757374206d61782071756575652074696d652061667460448201526b65722073616c6520656e647360a01b606482015260840161085f565b6000848152600260209081526040918290206001600160a01b038616600d909101819055915191825285917f6039ca6720e37f558ee4c54ff612004deb49321831da1765375d1b0b6400881891015b60405180910390a250505050565b60008181526002602052604081206001015482906001600160a01b0316610b395760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600b015460ff1690565b60008181526002602052604081206001015482906001600160a01b0316610b8c5760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600301546001600160a01b031690565b60008281526002602052604090206001015482906001600160a01b0316610be55760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b03163314610c205760405162461bcd60e51b815260040161085f90613a0a565b6000848152600260205260409020600801544210610c805760405162461bcd60e51b815260206004820152601960248201527f64697361626c65642061667465722073616c6520636c6f736500000000000000604482015260640161085f565b6000848152600260205260409020600801548310610ce05760405162461bcd60e51b815260206004820152601b60248201527f73616c65207374617274206d757374207072656365646520656e640000000000604482015260640161085f565b63f4865700831115610d045760405162461bcd60e51b815260040161085f90613a31565b6000848152600260205260409020600d810154600890910154610d28908590613c87565b11610d455760405162461bcd60e51b815260040161085f90613a68565b600084815260026020526040908190206007018490555184907f141c96c7f9bc751630fe1c6e1459ac982a755dda2a919f4c7218397df988d01190610af29086815260200190565b6040516351cff8d960e01b81526001600160a01b0382811660048301527f000000000000000000000000000000000000000000000000000000000000000016906351cff8d990602401600060405180830381600087803b158015610df057600080fd5b505af1158015610e04573d6000803e3d6000fd5b5050505050565b60008181526002602052604081206001015482906001600160a01b0316610e445760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600a015490565b60006001600160a01b038c16610ebe5760405162461bcd60e51b815260206004820152602260248201527f726563697069656e74206d757374206e6f74206265207a65726f206164647265604482015261737360f01b606482015260840161085f565b63f4865700871115610ee25760405162461bcd60e51b815260040161085f90613a31565b63f4865700861115610f065760405162461bcd60e51b815260040161085f90613a31565b858710610f555760405162461bcd60e51b815260206004820152601e60248201527f73616c65206d757374207374617274206265666f726520697420656e64730000604482015260640161085f565b428611610f9e5760405162461bcd60e51b815260206004820152601760248201527673616c65206d75737420656e6420696e2066757475726560481b604482015260640161085f565b89891115610ffe5760405162461bcd60e51b815260206004820152602760248201527f757365724275794c696d69742063616e6e6f74206578636565642073616c65426044820152661d5e531a5b5a5d60ca1b606482015260840161085f565b888811156110615760405162461bcd60e51b815260206004820152602a60248201527f70757263686173654d696e696d756d2063616e6e6f7420657863656564207573604482015269195c909d5e531a5b5a5d60b21b606482015260840161085f565b600089116110b15760405162461bcd60e51b815260206004820152601860248201527f757365724275794c696d6974206d757374206265203e20300000000000000000604482015260640161085f565b60008a116111015760405162461bcd60e51b815260206004820152601860248201527f73616c654275794c696d6974206d757374206265203e20300000000000000000604482015260640161085f565b6001600160a01b0385166111158888613c87565b116111325760405162461bcd60e51b815260040161085f90613a68565b60008b8d8c8c8c8c8c8b8b8b6040516020016111579a999897969594939291906137ec565b60408051601f198184030181529181528151602092830120600081815260029093529120600101549091506001600160a01b0316156111ec5760405162461bcd60e51b815260206004820152602b60248201527f612073616c65207769746820746865736520706172616d657465727320616c7260448201526a656164792065786973747360a81b606482015260840161085f565b60006002600083815260200190815260200160002090508c8160020181905550338160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508d8160000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508b81600401819055508a81600501819055508981600601819055508881600701819055508781600801819055508481600a01819055508381600b0160006101000a81548160ff021916908360ff160217905550858160090190805190602001906112c9929190613242565b506001600160a01b038716600d8201556112e28d6125c6565b600e820180546001600160a01b0319166001600160a01b03929092169190911790556003805490600061131483613cff565b91905055508060000160009054906101000a90046001600160a01b03166001600160a01b03168160020154837f131d719b1d5851ec4f2831f990b367619ecbd7aafd05c5961cdc398298c943558460010160009054906101000a90046001600160a01b031685600401548660050154876006015488600d015489600701548a600801548b6009018c600a01548d600b0160009054906101000a900460ff166040516113c89a99989796959493929190613886565b60405180910390a45090505b9b9a5050505050505050505050565b60008181526002602052604081206001015482906001600160a01b031661141c5760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206008015442101580611453575060008381526002602052604090206004810154600c9091015410155b9392505050565b60008281526002602052604090206001015482906001600160a01b03166114935760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b031633146114ce5760405162461bcd60e51b815260040161085f90613a0a565b600084815260026020526040902060080154421061152e5760405162461bcd60e51b815260206004820152601a60248201527f64697361626c65642061667465722073616c6520636c6f736573000000000000604482015260640161085f565b4283116115775760405162461bcd60e51b815260206004820152601760248201527673616c65206d75737420656e6420696e2066757475726560481b604482015260640161085f565b63f486570083111561159b5760405162461bcd60e51b815260040161085f90613a31565b60008481526002602052604090206007015483116115fb5760405162461bcd60e51b815260206004820152601e60248201527f73616c65206d757374207374617274206265666f726520697420656e64730000604482015260640161085f565b6000848152600260205260409020600d81015460079091015461161e9085613c87565b1161163b5760405162461bcd60e51b815260040161085f90613a68565b600084815260026020526040908190206008018490555184907fa1d69aa21ab2424b05b137a387320de036a0b226f4a0d6317ea2430d99ff27a690610af29086815260200190565b6000828152600260205260408120600a80820154600b909201546116ac9160ff90911690613bbd565b6116b69084613c68565b6116c09190613b66565b90505b92915050565b60008181526002602052604081206001015482906001600160a01b03166117025760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600d015490565b60008281526002602052604090206001015482906001600160a01b03166117525760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b0316331461178d5760405162461bcd60e51b815260040161085f90613a0a565b611796846113e3565b156117f45760405162461bcd60e51b815260206004820152602860248201527f63616e6e6f7420736574206d65726b6c6520726f6f74206f6e63652073616c656044820152671034b99037bb32b960c11b606482015260840161085f565b600084815260026020819052604090912001839055611812836125c6565b600085815260026020908152604091829020600e0180546001600160a01b0319166001600160a01b0394909416939093179092555184815285917f5c25e09dfc956c1695410327dbad0359e07b240db96ced50d429a2edb560614a9101610af2565b60008181526002602052604081206001015482906001600160a01b03166118ad5760405162461bcd60e51b815260040161085f90613ab8565b600083815260026020526040902060070154421180156118dd575060008381526002602052604090206008015442105b80156114535750505060009081526002602052604090206004810154600c909101541090565b60008181526002602052604081206001015482906001600160a01b031661193c5760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600101546001600160a01b031690565b600080600080600080600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156119b357600080fd5b505afa1580156119c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119eb919061374d565b9450945094509450945060008413611a365760405162461bcd60e51b815260206004820152600e60248201526d6e6567617469766520707269636560901b604482015260640161085f565b5091949350505050565b60008181526002602052604081206001015482906001600160a01b0316611a795760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206007015490565b60008281526002602052604081206001015483906001600160a01b0316611ac95760405162461bcd60e51b815260040161085f90613ab8565b60008481526002602090815260408083206001600160a01b0387168452600f01909152902054611afa908590611683565b91505b5092915050565b60008181526002602052604081206001015482906001600160a01b0316611b3d5760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260208190526040909120015490565b6040516bffffffffffffffffffffffff19606085901b1660208201526000908190603401604051602081830303815290604052805190602001209050611bd18484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508a9250859150612eaf9050565b15611be0576001915050611be6565b60009150505b949350505050565b60008181526002602052604081206001015482906001600160a01b0316611c275760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600c015490565b60008381526002602052604090206001015483906001600160a01b03163314611c795760405162461bcd60e51b815260040161085f90613a0a565b826001600160a01b031663a9059cbb611c9186612e59565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b158015611cd957600080fd5b505af1158015611ced573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e04919061351e565b60008281526002602052604090206001015482906001600160a01b0316611d4a5760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b03163314611d855760405162461bcd60e51b815260040161085f90613a0a565b6001600160a01b038316611dec5760405162461bcd60e51b815260206004820152602860248201527f436c61696d206d616e61676572206d7573742062652061206e6f6e2d7a65726f604482015267206164647265737360c01b606482015260840161085f565b60008481526002602052604080822060030180546001600160a01b0319166001600160a01b0387169081179091559051909186917fa238e2b81a1e21f7426993fcac7cc40d45cf7f22c8d58a2345e65c7a1ed06e729190a350505050565b6001546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b158015611e8f57600080fd5b505afa158015611ea3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec7919061379c565b611ed2906012613b1b565b611edd90600a613bbd565b611f087f0000000000000000000000000000000000000000000000000000000000000000600a613bbd565b611f1061195c565b611f1a9085613c68565b611f249190613c68565b6116c39190613b66565b60008381526002602052604090206001015483906001600160a01b0316611f675760405162461bcd60e51b815260040161085f90613ab8565b60008481526002602052604090206007015484904211611fc05760405162461bcd60e51b81526020600482015260146024820152731cd85b19481b9bdd081cdd185c9d1959081e595d60621b604482015260640161085f565b600081815260026020526040902060080154421061200d5760405162461bcd60e51b815260206004820152600a6024820152691cd85b1948195b99195960b21b604482015260640161085f565b60008181526002602052604090206004810154600c909101541061205f5760405162461bcd60e51b815260206004820152600960248201526839b0b6329037bb32b960b91b604482015260640161085f565b8484843332146120a85760405162461bcd60e51b81526020600482015260146024820152734d75737420627579207769746820616e20454f4160601b604482015260640161085f565b6000838152600260208190526040909120015415612198576000838152600260208190526040918290200154905163ad9a686560e01b8152309163ad9a6865916120fb9190339087908790600401613973565b60206040518083038186803b15801561211357600080fd5b505afa158015612127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214b919061351e565b15156001146121985760405162461bcd60e51b8152602060048201526019602482015278626164206d65726b6c652070726f6f6620666f722073616c6560381b604482015260640161085f565b6121a283336125dc565b6000848152600260205260409020600701546121be9042613c87565b116121ff5760405162461bcd60e51b81526020600482015260116024820152701b9bdd081e5bdd5c881d1d5c9b881e595d607a1b604482015260640161085f565b600260005414156122525760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161085f565b6002600090815561226234611e4a565b60008a8152600260205260409020600601549091508110156122bf5760405162461bcd60e51b815260206004820152601660248201527570757263686173652062656c6f77206d696e696d756d60501b604482015260640161085f565b60008981526002602090815260408083206005810154338552600f909101909252909120546122ee9083613b03565b111561233c5760405162461bcd60e51b815260206004820152601b60248201527f7075726368617365206578636565647320796f7572206c696d69740000000000604482015260640161085f565b60008981526002602052604090206004810154600c9091015461235f9083613b03565b11156123ad5760405162461bcd60e51b815260206004820152601b60248201527f707572636861736520657863656564732073616c65206c696d69740000000000604482015260640161085f565b6123bf6123b98a612e59565b34612ec5565b6000898152600260209081526040808320338452600f01909152812080548392906123eb908490613b03565b90915550506000898152600260205260408120600c018054839290612411908490613b03565b92505081905550806004600082825461242a9190613b03565b909155505060405133908a907f626774f7294b3079307930cbec9061bd3e7342694936faae16b870083853337f9061246a9085906001908e908e90613ae1565b60405180910390a35050600160005550505050505050565b60008281526002602052604081206001015483906001600160a01b03166124bb5760405162461bcd60e51b815260040161085f90613ab8565b505060009182526002602090815260408084206001600160a01b03939093168452600f909201905290205490565b60008481526002602052604090206001015484906001600160a01b03166125225760405162461bcd60e51b815260040161085f90613ab8565b60008581526002602052604090206001015485906001600160a01b0316331461255d5760405162461bcd60e51b815260040161085f90613a0a565b60008681526002602052604090206125799060090185856132c6565b506125848686611719565b857f576e604c0ce80f5cc291a8dd68ecbb823e139b8f3063821e7f52275da64e384d85856040516125b69291906139a8565b60405180910390a2505050505050565b6000816125d4600143613c87565b401892915050565b60008281526002602052604081206001015483906001600160a01b03166126155760405162461bcd60e51b815260040161085f90613ab8565b6000848152600260205260409020600d01546126345760009150611afd565b6000848152600260205260408120600e810154600d909101546001600160a01b03918216861892916126669190613b40565b90506126728183613b40565b6001600160a01b03169695505050505050565b60008181526002602052604081206001015482906001600160a01b03166126be5760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206006015490565b60008481526002602052604090206001015484906001600160a01b031661270e5760405162461bcd60e51b815260040161085f90613ab8565b600085815260026020526040902060070154859042116127675760405162461bcd60e51b81526020600482015260146024820152731cd85b19481b9bdd081cdd185c9d1959081e595d60621b604482015260640161085f565b60008181526002602052604090206008015442106127b45760405162461bcd60e51b815260206004820152600a6024820152691cd85b1948195b99195960b21b604482015260640161085f565b60008181526002602052604090206004810154600c90910154106128065760405162461bcd60e51b815260206004820152600960248201526839b0b6329037bb32b960b91b604482015260640161085f565b85848433321461284f5760405162461bcd60e51b81526020600482015260146024820152734d75737420627579207769746820616e20454f4160601b604482015260640161085f565b600083815260026020819052604090912001541561293f576000838152600260208190526040918290200154905163ad9a686560e01b8152309163ad9a6865916128a29190339087908790600401613973565b60206040518083038186803b1580156128ba57600080fd5b505afa1580156128ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f2919061351e565b151560011461293f5760405162461bcd60e51b8152602060048201526019602482015278626164206d65726b6c652070726f6f6620666f722073616c6560381b604482015260640161085f565b61294983336125dc565b6000848152600260205260409020600701546129659042613c87565b116129a65760405162461bcd60e51b81526020600482015260116024820152701b9bdd081e5bdd5c881d1d5c9b881e595d607a1b604482015260640161085f565b600260005414156129f95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161085f565b600260008181558a81526020919091526040902060060154881015612a595760405162461bcd60e51b815260206004820152601660248201527570757263686173652062656c6f77206d696e696d756d60501b604482015260640161085f565b60008981526002602090815260408083206005810154338552600f90910190925290912054612a88908a613b03565b1115612ad65760405162461bcd60e51b815260206004820152601b60248201527f7075726368617365206578636565647320796f7572206c696d69740000000000604482015260640161085f565b60008981526002602052604090206004810154600c90910154612af9908a613b03565b1115612b475760405162461bcd60e51b815260206004820152601b60248201527f707572636861736520657863656564732073616c65206c696d69740000000000604482015260640161085f565b604051636eb1769f60e11b815233600482015230602482015288907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063dd62ed3e9060440160206040518083038186803b158015612bae57600080fd5b505afa158015612bc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be69190613735565b1015612c285760405162461bcd60e51b8152602060048201526011602482015270616c6c6f77616e636520746f6f206c6f7760781b604482015260640161085f565b600089815260026020526040902054612c70906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116913391168b612f46565b6000898152600260209081526040808320338452600f01909152812080548a9290612c9c908490613b03565b90915550506000898152600260205260408120600c0180548a9290612cc2908490613b03565b925050819055508760046000828254612cdb9190613b03565b909155505060405133908a907f626774f7294b3079307930cbec9061bd3e7342694936faae16b870083853337f9061246a908c906000908d908d90613ae1565b6040516371d4ed8d60e11b81526001600160a01b0382811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063e3a9db1a9060240160206040518083038186803b158015612d8157600080fd5b505afa158015612d95573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c39190613735565b60008181526002602052604081206001015482906001600160a01b0316612df25760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206008015490565b60008181526002602052604081206001015482906001600160a01b0316612e425760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206004015490565b60008181526002602052604081206001015482906001600160a01b0316612e925760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020546001600160a01b031690565b600082612ebc8584612fa6565b14949350505050565b60405163f340fa0160e01b81526001600160a01b0383811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063f340fa019083906024016000604051808303818588803b158015612f2957600080fd5b505af1158015612f3d573d6000803e3d6000fd5b50505050505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612fa0908590613060565b50505050565b600081815b8451811015613058576000858281518110612fd657634e487b7160e01b600052603260045260246000fd5b60200260200101519050808311613018576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250613045565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061305081613cff565b915050612fab565b509392505050565b60006130b5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131379092919063ffffffff16565b80519091501561313257808060200190518101906130d3919061351e565b6131325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161085f565b505050565b6060611be6848460008585843b6131905760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161085f565b600080866001600160a01b031685876040516131ac919061386a565b60006040518083038185875af1925050503d80600081146131e9576040519150601f19603f3d011682016040523d82523d6000602084013e6131ee565b606091505b50915091506131fe828286613209565b979650505050505050565b60608315613218575081611453565b8251156132285782518084602001fd5b8160405162461bcd60e51b815260040161085f91906139d7565b82805461324e90613cca565b90600052602060002090601f01602090048101928261327057600085556132b6565b82601f1061328957805160ff19168380011785556132b6565b828001600101855582156132b6579182015b828111156132b657825182559160200191906001019061329b565b506132c292915061333a565b5090565b8280546132d290613cca565b90600052602060002090601f0160209004810192826132f457600085556132b6565b82601f1061330d5782800160ff198235161785556132b6565b828001600101855582156132b6579182015b828111156132b657823582559160200191906001019061331f565b5b808211156132c2576000815560010161333b565b60008083601f840112613360578081fd5b50813567ffffffffffffffff811115613377578182fd5b6020830191508360208260051b850101111561339257600080fd5b9250929050565b600082601f8301126133a9578081fd5b813567ffffffffffffffff808211156133c4576133c4613d46565b604051601f8301601f19908116603f011681019082821181831017156133ec576133ec613d46565b81604052838152866020858801011115613404578485fd5b8360208701602083013792830160200193909352509392505050565b803561342b81613d74565b919050565b805169ffffffffffffffffffff8116811461342b57600080fd5b60006020828403121561345b578081fd5b813561145381613d5c565b60008060008060008060008060008060006101608c8e031215613487578687fd5b8b3561349281613d5c565b9a5060208c0135995060408c0135985060608c0135975060808c0135965060a08c0135955060c08c0135945060e08c01356134cc81613d5c565b93506101008c013567ffffffffffffffff8111156134e8578384fd5b6134f48e828f01613399565b9350506101208c0135915061350c6101408d01613420565b90509295989b509295989b9093969950565b60006020828403121561352f578081fd5b81518015158114611453578182fd5b60006020828403121561354f578081fd5b5035919050565b60008060408385031215613568578182fd5b82359150602083013561357a81613d5c565b809150509250929050565b6000806000806060858703121561359a578384fd5b8435935060208501356135ac81613d5c565b9250604085013567ffffffffffffffff8111156135c7578283fd5b6135d38782880161334f565b95989497509550505050565b6000806000606084860312156135f3578283fd5b83359250602084013561360581613d5c565b929592945050506040919091013590565b60008060006040848603121561362a578283fd5b83359250602084013567ffffffffffffffff811115613647578283fd5b6136538682870161334f565b9497909650939450505050565b60008060408385031215613672578182fd5b50508035926020909101359150565b60008060008060608587031215613696578182fd5b8435935060208501359250604085013567ffffffffffffffff808211156136bb578384fd5b818701915087601f8301126136ce578384fd5b8135818111156136dc578485fd5b8860208285010111156136ed578485fd5b95989497505060200194505050565b60008060008060608587031215613711578182fd5b8435935060208501359250604085013567ffffffffffffffff8111156135c7578283fd5b600060208284031215613746578081fd5b5051919050565b600080600080600060a08688031215613764578283fd5b61376d86613430565b945060208601519350604086015192506060860151915061379060808701613430565b90509295509295909350565b6000602082840312156137ad578081fd5b815161145381613d74565b81835260006001600160fb1b038311156137d0578081fd5b8260051b80836020870137939093016020019283525090919050565b8a81526bffffffffffffffffffffffff198a60601b1660208201528860348201528760548201528660748201528560948201528460b48201526000845161383a8160d4850160208901613c9e565b60d492019182019390935260f89190911b6001600160f81b03191660f482015260f5019998505050505050505050565b6000825161387c818460208701613c9e565b9190910192915050565b600061014060018060a01b038d16835260208c818501528b60408501528a60608501528960808501528860a08501528760c08501528160e085015282875484600182811c9150808316806138db57607f831692505b8583108114156138f957634e487b7160e01b88526022600452602488fd5b95880182815260200195808015613917576001811461392857613952565b60ff19851688528688019550613952565b60008d815260209020895b8581101561394c5781548a820152908401908801613933565b89019650505b5050505050610100850187905260ff861661012086015292506113d4915050565b8481526001600160a01b038416602082015260606040820181905260009061399e90830184866137b8565b9695505050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60208152600082518060208401526139f6816040850160208701613c9e565b601f01601f19169190910160400192915050565b6020808252600d908201526c36bab9ba1031329030b236b4b760991b604082015260600190565b6020808252601c908201527f6d61783a203431303234343438303020284a616e203120323130302900000000604082015260600190565b60208082526030908201527f73616c65206d757374206265206f70656e20666f72206c6f6e6765722074686160408201526f6e206d61782071756575652074696d6560801b606082015260800190565b6020808252600f908201526e1a5b9d985b1a59081cd85b19481a59608a1b604082015260600190565b848152831515602082015260606040820152600061399e6060830184866137b8565b60008219821115613b1657613b16613d1a565b500190565b600060ff821660ff84168060ff03821115613b3857613b38613d1a565b019392505050565b60006001600160a01b0383811680613b5a57613b5a613d30565b92169190910492915050565b600082613b7557613b75613d30565b500490565b600181815b80851115613bb5578160001904821115613b9b57613b9b613d1a565b80851615613ba857918102915b93841c9390800290613b7f565b509250929050565b60006116c060ff841683600082613bd6575060016116c3565b81613be3575060006116c3565b8160018114613bf95760028114613c0357613c1f565b60019150506116c3565b60ff841115613c1457613c14613d1a565b50506001821b6116c3565b5060208310610133831016604e8410600b8410161715613c42575081810a6116c3565b613c4c8383613b7a565b8060001904821115613c6057613c60613d1a565b029392505050565b6000816000190483118215151615613c8257613c82613d1a565b500290565b600082821015613c9957613c99613d1a565b500390565b60005b83811015613cb9578181015183820152602001613ca1565b83811115612fa05750506000910152565b600181811c90821680613cde57607f821691505b6020821081141561088657634e487b7160e01b600052602260045260246000fd5b6000600019821415613d1357613d13613d1a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114613d7157600080fd5b50565b60ff81168114613d7157600080fdfea2646970667358221220c34b1b64a31e3ad731ea7d2b9ea65a1483d6d2acb0cbbc156eced181717fc32664736f6c63430008040033608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6105718061007e6000396000f3fe6080604052600436106100555760003560e01c806351cff8d91461005a578063715018a61461007c5780638da5cb5b14610091578063e3a9db1a146100be578063f2fde38b14610102578063f340fa0114610122575b600080fd5b34801561006657600080fd5b5061007a6100753660046104aa565b610135565b005b34801561008857600080fd5b5061007a6101d7565b34801561009d57600080fd5b506000546040516001600160a01b0390911681526020015b60405180910390f35b3480156100ca57600080fd5b506100f46100d93660046104aa565b6001600160a01b031660009081526001602052604090205490565b6040519081526020016100b5565b34801561010e57600080fd5b5061007a61011d3660046104aa565b61020d565b61007a6101303660046104aa565b6102a8565b6000546001600160a01b031633146101685760405162461bcd60e51b815260040161015f906104cd565b60405180910390fd5b6001600160a01b0381166000818152600160205260408120805491905590610190908261033c565b816001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516101cb91815260200190565b60405180910390a25050565b6000546001600160a01b031633146102015760405162461bcd60e51b815260040161015f906104cd565b61020b600061045a565b565b6000546001600160a01b031633146102375760405162461bcd60e51b815260040161015f906104cd565b6001600160a01b03811661029c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161015f565b6102a58161045a565b50565b6000546001600160a01b031633146102d25760405162461bcd60e51b815260040161015f906104cd565b6001600160a01b0381166000908152600160205260408120805434928392916102fc908490610502565b90915550506040518181526001600160a01b038316907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4906020016101cb565b8047101561038c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161015f565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146103d9576040519150601f19603f3d011682016040523d82523d6000602084013e6103de565b606091505b50509050806104555760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161015f565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156104bb578081fd5b81356104c681610526565b9392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561052157634e487b7160e01b81526011600452602481fd5b500190565b6001600160a01b03811681146102a557600080fdfea2646970667358221220759dbe063ee051810bfd71ed98c5a7bfc2eab667f7914c76d1b510509548f5f164736f6c6343000804003300000000000000000000000007537efba62504425f879e9d60a25ab09d139161000000000000000000000000000000000000000000000000000000000000000600000000000000000000000017c14f6087c62666d28361697f4a9b4d39dc3bc5

Deployed Bytecode

0x60806040526004361061025c5760003560e01c8063976b205011610144578063c96c9d49116100b6578063eb28322e1161007a578063eb28322e14610763578063ef8148b214610783578063fb346eab146107a3578063fbc6da75146107b9578063fca513a8146107d9578063ffa1ad74146107f757600080fd5b8063c96c9d49146106c3578063ccc325c2146106e3578063dda513da14610703578063dee5ab4314610723578063e2982c211461074357600080fd5b8063b8f8a0b311610108578063b8f8a0b314610610578063b94c69aa14610630578063bac4dd8814610650578063bc8bf09314610670578063c83b55f314610683578063c95970be146106a357600080fd5b8063976b20501461057a578063a1e89aec1461059a578063a7206cd6146105b0578063ad9a6865146105d0578063b8211d90146105f057600080fd5b8063325cd796116101dd578063628f9fa0116101a1578063628f9fa0146104c557806375edcbe0146104e55780637c35be7a1461050557806380c6e70a146105255780638e15f47314610545578063939d60651461055a57600080fd5b8063325cd796146103ef5780633f6fdf3c146104355780634f8b50b01461045557806350fa4ff2146104855780635f0fe446146104a557600080fd5b8063231bedc711610224578063231bedc71461033b57806327e542301461035b5780633013ce291461037b57806331b3eb94146103af57806331d98b3f146103cf57600080fd5b8063080d840c14610261578063087c2be71461029e578063089ed435146102cb5780630ad0607f146102f957806312105fea1461031b575b600080fd5b34801561026d57600080fd5b5061028161027c36600461353e565b610826565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102aa57600080fd5b506102be6102b936600461353e565b61088c565b60405161029591906139d7565b3480156102d757600080fd5b506102eb6102e636600461353e565b61096a565b604051908152602001610295565b34801561030557600080fd5b50610319610314366004613556565b6109ba565b005b34801561032757600080fd5b506102eb61033636600461353e565b610b00565b34801561034757600080fd5b5061028161035636600461353e565b610b53565b34801561036757600080fd5b50610319610376366004613660565b610bac565b34801561038757600080fd5b506102817f00000000000000000000000007537efba62504425f879e9d60a25ab09d13916181565b3480156103bb57600080fd5b506103196103ca36600461344a565b610d8d565b3480156103db57600080fd5b506102eb6103ea36600461353e565b610e0b565b3480156103fb57600080fd5b506104237f000000000000000000000000000000000000000000000000000000000000000681565b60405160ff9091168152602001610295565b34801561044157600080fd5b506102eb610450366004613466565b610e5b565b34801561046157600080fd5b5061047561047036600461353e565b6113e3565b6040519015158152602001610295565b34801561049157600080fd5b506103196104a0366004613660565b61145a565b3480156104b157600080fd5b506102eb6104c0366004613660565b611683565b3480156104d157600080fd5b506102eb6104e036600461353e565b6116c9565b3480156104f157600080fd5b50610319610500366004613660565b611719565b34801561051157600080fd5b5061047561052036600461353e565b611874565b34801561053157600080fd5b5061028161054036600461353e565b611903565b34801561055157600080fd5b506102eb61195c565b34801561056657600080fd5b506102eb61057536600461353e565b611a40565b34801561058657600080fd5b506102eb610595366004613556565b611a90565b3480156105a657600080fd5b506102eb60035481565b3480156105bc57600080fd5b506102eb6105cb36600461353e565b611b04565b3480156105dc57600080fd5b506104756105eb366004613585565b611b55565b3480156105fc57600080fd5b506102eb61060b36600461353e565b611bee565b34801561061c57600080fd5b5061031961062b3660046135df565b611c3e565b34801561063c57600080fd5b5061031961064b366004613556565b611d11565b34801561065c57600080fd5b506102eb61066b36600461353e565b611e4a565b61031961067e366004613616565b611f2e565b34801561068f57600080fd5b506102eb61069e366004613556565b612482565b3480156106af57600080fd5b506103196106be366004613681565b6124e9565b3480156106cf57600080fd5b506102816106de36600461353e565b6125c6565b3480156106ef57600080fd5b506102eb6106fe366004613556565b6125dc565b34801561070f57600080fd5b506102eb61071e36600461353e565b612685565b34801561072f57600080fd5b5061031961073e3660046136fc565b6126d5565b34801561074f57600080fd5b506102eb61075e36600461344a565b612d1b565b34801561076f57600080fd5b506102eb61077e36600461353e565b612db9565b34801561078f57600080fd5b506102eb61079e36600461353e565b612e09565b3480156107af57600080fd5b506102eb60045481565b3480156107c557600080fd5b506102816107d436600461353e565b612e59565b3480156107e557600080fd5b506001546001600160a01b0316610281565b34801561080357600080fd5b506102be60405180604001604052806003815260200162312e3360e81b81525081565b60008181526002602052604081206001015482906001600160a01b03166108685760405162461bcd60e51b815260040161085f90613ab8565b60405180910390fd5b6000838152600260205260409020600e01546001600160a01b031691505b50919050565b60008181526002602052604090206001015460609082906001600160a01b03166108c85760405162461bcd60e51b815260040161085f90613ab8565b600083815260026020526040902060090180546108e490613cca565b80601f016020809104026020016040519081016040528092919081815260200182805461091090613cca565b801561095d5780601f106109325761010080835404028352916020019161095d565b820191906000526020600020905b81548152906001019060200180831161094057829003601f168201915b5050505050915050919050565b60008181526002602052604081206001015482906001600160a01b03166109a35760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206005015490565b60008281526002602052604090206001015482906001600160a01b03166109f35760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b03163314610a2e5760405162461bcd60e51b815260040161085f90613a0a565b6000848152600260205260409020600801544210610aa35760405162461bcd60e51b815260206004820152602c60248201527f63616e6e6f742061646a757374206d61782071756575652074696d652061667460448201526b65722073616c6520656e647360a01b606482015260840161085f565b6000848152600260209081526040918290206001600160a01b038616600d909101819055915191825285917f6039ca6720e37f558ee4c54ff612004deb49321831da1765375d1b0b6400881891015b60405180910390a250505050565b60008181526002602052604081206001015482906001600160a01b0316610b395760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600b015460ff1690565b60008181526002602052604081206001015482906001600160a01b0316610b8c5760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600301546001600160a01b031690565b60008281526002602052604090206001015482906001600160a01b0316610be55760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b03163314610c205760405162461bcd60e51b815260040161085f90613a0a565b6000848152600260205260409020600801544210610c805760405162461bcd60e51b815260206004820152601960248201527f64697361626c65642061667465722073616c6520636c6f736500000000000000604482015260640161085f565b6000848152600260205260409020600801548310610ce05760405162461bcd60e51b815260206004820152601b60248201527f73616c65207374617274206d757374207072656365646520656e640000000000604482015260640161085f565b63f4865700831115610d045760405162461bcd60e51b815260040161085f90613a31565b6000848152600260205260409020600d810154600890910154610d28908590613c87565b11610d455760405162461bcd60e51b815260040161085f90613a68565b600084815260026020526040908190206007018490555184907f141c96c7f9bc751630fe1c6e1459ac982a755dda2a919f4c7218397df988d01190610af29086815260200190565b6040516351cff8d960e01b81526001600160a01b0382811660048301527f0000000000000000000000008fad1c598fdd380d427db0a03846cb36483e43bc16906351cff8d990602401600060405180830381600087803b158015610df057600080fd5b505af1158015610e04573d6000803e3d6000fd5b5050505050565b60008181526002602052604081206001015482906001600160a01b0316610e445760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600a015490565b60006001600160a01b038c16610ebe5760405162461bcd60e51b815260206004820152602260248201527f726563697069656e74206d757374206e6f74206265207a65726f206164647265604482015261737360f01b606482015260840161085f565b63f4865700871115610ee25760405162461bcd60e51b815260040161085f90613a31565b63f4865700861115610f065760405162461bcd60e51b815260040161085f90613a31565b858710610f555760405162461bcd60e51b815260206004820152601e60248201527f73616c65206d757374207374617274206265666f726520697420656e64730000604482015260640161085f565b428611610f9e5760405162461bcd60e51b815260206004820152601760248201527673616c65206d75737420656e6420696e2066757475726560481b604482015260640161085f565b89891115610ffe5760405162461bcd60e51b815260206004820152602760248201527f757365724275794c696d69742063616e6e6f74206578636565642073616c65426044820152661d5e531a5b5a5d60ca1b606482015260840161085f565b888811156110615760405162461bcd60e51b815260206004820152602a60248201527f70757263686173654d696e696d756d2063616e6e6f7420657863656564207573604482015269195c909d5e531a5b5a5d60b21b606482015260840161085f565b600089116110b15760405162461bcd60e51b815260206004820152601860248201527f757365724275794c696d6974206d757374206265203e20300000000000000000604482015260640161085f565b60008a116111015760405162461bcd60e51b815260206004820152601860248201527f73616c654275794c696d6974206d757374206265203e20300000000000000000604482015260640161085f565b6001600160a01b0385166111158888613c87565b116111325760405162461bcd60e51b815260040161085f90613a68565b60008b8d8c8c8c8c8c8b8b8b6040516020016111579a999897969594939291906137ec565b60408051601f198184030181529181528151602092830120600081815260029093529120600101549091506001600160a01b0316156111ec5760405162461bcd60e51b815260206004820152602b60248201527f612073616c65207769746820746865736520706172616d657465727320616c7260448201526a656164792065786973747360a81b606482015260840161085f565b60006002600083815260200190815260200160002090508c8160020181905550338160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508d8160000160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508b81600401819055508a81600501819055508981600601819055508881600701819055508781600801819055508481600a01819055508381600b0160006101000a81548160ff021916908360ff160217905550858160090190805190602001906112c9929190613242565b506001600160a01b038716600d8201556112e28d6125c6565b600e820180546001600160a01b0319166001600160a01b03929092169190911790556003805490600061131483613cff565b91905055508060000160009054906101000a90046001600160a01b03166001600160a01b03168160020154837f131d719b1d5851ec4f2831f990b367619ecbd7aafd05c5961cdc398298c943558460010160009054906101000a90046001600160a01b031685600401548660050154876006015488600d015489600701548a600801548b6009018c600a01548d600b0160009054906101000a900460ff166040516113c89a99989796959493929190613886565b60405180910390a45090505b9b9a5050505050505050505050565b60008181526002602052604081206001015482906001600160a01b031661141c5760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206008015442101580611453575060008381526002602052604090206004810154600c9091015410155b9392505050565b60008281526002602052604090206001015482906001600160a01b03166114935760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b031633146114ce5760405162461bcd60e51b815260040161085f90613a0a565b600084815260026020526040902060080154421061152e5760405162461bcd60e51b815260206004820152601a60248201527f64697361626c65642061667465722073616c6520636c6f736573000000000000604482015260640161085f565b4283116115775760405162461bcd60e51b815260206004820152601760248201527673616c65206d75737420656e6420696e2066757475726560481b604482015260640161085f565b63f486570083111561159b5760405162461bcd60e51b815260040161085f90613a31565b60008481526002602052604090206007015483116115fb5760405162461bcd60e51b815260206004820152601e60248201527f73616c65206d757374207374617274206265666f726520697420656e64730000604482015260640161085f565b6000848152600260205260409020600d81015460079091015461161e9085613c87565b1161163b5760405162461bcd60e51b815260040161085f90613a68565b600084815260026020526040908190206008018490555184907fa1d69aa21ab2424b05b137a387320de036a0b226f4a0d6317ea2430d99ff27a690610af29086815260200190565b6000828152600260205260408120600a80820154600b909201546116ac9160ff90911690613bbd565b6116b69084613c68565b6116c09190613b66565b90505b92915050565b60008181526002602052604081206001015482906001600160a01b03166117025760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600d015490565b60008281526002602052604090206001015482906001600160a01b03166117525760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b0316331461178d5760405162461bcd60e51b815260040161085f90613a0a565b611796846113e3565b156117f45760405162461bcd60e51b815260206004820152602860248201527f63616e6e6f7420736574206d65726b6c6520726f6f74206f6e63652073616c656044820152671034b99037bb32b960c11b606482015260840161085f565b600084815260026020819052604090912001839055611812836125c6565b600085815260026020908152604091829020600e0180546001600160a01b0319166001600160a01b0394909416939093179092555184815285917f5c25e09dfc956c1695410327dbad0359e07b240db96ced50d429a2edb560614a9101610af2565b60008181526002602052604081206001015482906001600160a01b03166118ad5760405162461bcd60e51b815260040161085f90613ab8565b600083815260026020526040902060070154421180156118dd575060008381526002602052604090206008015442105b80156114535750505060009081526002602052604090206004810154600c909101541090565b60008181526002602052604081206001015482906001600160a01b031661193c5760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600101546001600160a01b031690565b600080600080600080600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156119b357600080fd5b505afa1580156119c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119eb919061374d565b9450945094509450945060008413611a365760405162461bcd60e51b815260206004820152600e60248201526d6e6567617469766520707269636560901b604482015260640161085f565b5091949350505050565b60008181526002602052604081206001015482906001600160a01b0316611a795760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206007015490565b60008281526002602052604081206001015483906001600160a01b0316611ac95760405162461bcd60e51b815260040161085f90613ab8565b60008481526002602090815260408083206001600160a01b0387168452600f01909152902054611afa908590611683565b91505b5092915050565b60008181526002602052604081206001015482906001600160a01b0316611b3d5760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260208190526040909120015490565b6040516bffffffffffffffffffffffff19606085901b1660208201526000908190603401604051602081830303815290604052805190602001209050611bd18484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508a9250859150612eaf9050565b15611be0576001915050611be6565b60009150505b949350505050565b60008181526002602052604081206001015482906001600160a01b0316611c275760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020600c015490565b60008381526002602052604090206001015483906001600160a01b03163314611c795760405162461bcd60e51b815260040161085f90613a0a565b826001600160a01b031663a9059cbb611c9186612e59565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b158015611cd957600080fd5b505af1158015611ced573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e04919061351e565b60008281526002602052604090206001015482906001600160a01b0316611d4a5760405162461bcd60e51b815260040161085f90613ab8565b60008381526002602052604090206001015483906001600160a01b03163314611d855760405162461bcd60e51b815260040161085f90613a0a565b6001600160a01b038316611dec5760405162461bcd60e51b815260206004820152602860248201527f436c61696d206d616e61676572206d7573742062652061206e6f6e2d7a65726f604482015267206164647265737360c01b606482015260840161085f565b60008481526002602052604080822060030180546001600160a01b0319166001600160a01b0387169081179091559051909186917fa238e2b81a1e21f7426993fcac7cc40d45cf7f22c8d58a2345e65c7a1ed06e729190a350505050565b6001546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b158015611e8f57600080fd5b505afa158015611ea3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec7919061379c565b611ed2906012613b1b565b611edd90600a613bbd565b611f087f0000000000000000000000000000000000000000000000000000000000000006600a613bbd565b611f1061195c565b611f1a9085613c68565b611f249190613c68565b6116c39190613b66565b60008381526002602052604090206001015483906001600160a01b0316611f675760405162461bcd60e51b815260040161085f90613ab8565b60008481526002602052604090206007015484904211611fc05760405162461bcd60e51b81526020600482015260146024820152731cd85b19481b9bdd081cdd185c9d1959081e595d60621b604482015260640161085f565b600081815260026020526040902060080154421061200d5760405162461bcd60e51b815260206004820152600a6024820152691cd85b1948195b99195960b21b604482015260640161085f565b60008181526002602052604090206004810154600c909101541061205f5760405162461bcd60e51b815260206004820152600960248201526839b0b6329037bb32b960b91b604482015260640161085f565b8484843332146120a85760405162461bcd60e51b81526020600482015260146024820152734d75737420627579207769746820616e20454f4160601b604482015260640161085f565b6000838152600260208190526040909120015415612198576000838152600260208190526040918290200154905163ad9a686560e01b8152309163ad9a6865916120fb9190339087908790600401613973565b60206040518083038186803b15801561211357600080fd5b505afa158015612127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214b919061351e565b15156001146121985760405162461bcd60e51b8152602060048201526019602482015278626164206d65726b6c652070726f6f6620666f722073616c6560381b604482015260640161085f565b6121a283336125dc565b6000848152600260205260409020600701546121be9042613c87565b116121ff5760405162461bcd60e51b81526020600482015260116024820152701b9bdd081e5bdd5c881d1d5c9b881e595d607a1b604482015260640161085f565b600260005414156122525760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161085f565b6002600090815561226234611e4a565b60008a8152600260205260409020600601549091508110156122bf5760405162461bcd60e51b815260206004820152601660248201527570757263686173652062656c6f77206d696e696d756d60501b604482015260640161085f565b60008981526002602090815260408083206005810154338552600f909101909252909120546122ee9083613b03565b111561233c5760405162461bcd60e51b815260206004820152601b60248201527f7075726368617365206578636565647320796f7572206c696d69740000000000604482015260640161085f565b60008981526002602052604090206004810154600c9091015461235f9083613b03565b11156123ad5760405162461bcd60e51b815260206004820152601b60248201527f707572636861736520657863656564732073616c65206c696d69740000000000604482015260640161085f565b6123bf6123b98a612e59565b34612ec5565b6000898152600260209081526040808320338452600f01909152812080548392906123eb908490613b03565b90915550506000898152600260205260408120600c018054839290612411908490613b03565b92505081905550806004600082825461242a9190613b03565b909155505060405133908a907f626774f7294b3079307930cbec9061bd3e7342694936faae16b870083853337f9061246a9085906001908e908e90613ae1565b60405180910390a35050600160005550505050505050565b60008281526002602052604081206001015483906001600160a01b03166124bb5760405162461bcd60e51b815260040161085f90613ab8565b505060009182526002602090815260408084206001600160a01b03939093168452600f909201905290205490565b60008481526002602052604090206001015484906001600160a01b03166125225760405162461bcd60e51b815260040161085f90613ab8565b60008581526002602052604090206001015485906001600160a01b0316331461255d5760405162461bcd60e51b815260040161085f90613a0a565b60008681526002602052604090206125799060090185856132c6565b506125848686611719565b857f576e604c0ce80f5cc291a8dd68ecbb823e139b8f3063821e7f52275da64e384d85856040516125b69291906139a8565b60405180910390a2505050505050565b6000816125d4600143613c87565b401892915050565b60008281526002602052604081206001015483906001600160a01b03166126155760405162461bcd60e51b815260040161085f90613ab8565b6000848152600260205260409020600d01546126345760009150611afd565b6000848152600260205260408120600e810154600d909101546001600160a01b03918216861892916126669190613b40565b90506126728183613b40565b6001600160a01b03169695505050505050565b60008181526002602052604081206001015482906001600160a01b03166126be5760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206006015490565b60008481526002602052604090206001015484906001600160a01b031661270e5760405162461bcd60e51b815260040161085f90613ab8565b600085815260026020526040902060070154859042116127675760405162461bcd60e51b81526020600482015260146024820152731cd85b19481b9bdd081cdd185c9d1959081e595d60621b604482015260640161085f565b60008181526002602052604090206008015442106127b45760405162461bcd60e51b815260206004820152600a6024820152691cd85b1948195b99195960b21b604482015260640161085f565b60008181526002602052604090206004810154600c90910154106128065760405162461bcd60e51b815260206004820152600960248201526839b0b6329037bb32b960b91b604482015260640161085f565b85848433321461284f5760405162461bcd60e51b81526020600482015260146024820152734d75737420627579207769746820616e20454f4160601b604482015260640161085f565b600083815260026020819052604090912001541561293f576000838152600260208190526040918290200154905163ad9a686560e01b8152309163ad9a6865916128a29190339087908790600401613973565b60206040518083038186803b1580156128ba57600080fd5b505afa1580156128ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f2919061351e565b151560011461293f5760405162461bcd60e51b8152602060048201526019602482015278626164206d65726b6c652070726f6f6620666f722073616c6560381b604482015260640161085f565b61294983336125dc565b6000848152600260205260409020600701546129659042613c87565b116129a65760405162461bcd60e51b81526020600482015260116024820152701b9bdd081e5bdd5c881d1d5c9b881e595d607a1b604482015260640161085f565b600260005414156129f95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161085f565b600260008181558a81526020919091526040902060060154881015612a595760405162461bcd60e51b815260206004820152601660248201527570757263686173652062656c6f77206d696e696d756d60501b604482015260640161085f565b60008981526002602090815260408083206005810154338552600f90910190925290912054612a88908a613b03565b1115612ad65760405162461bcd60e51b815260206004820152601b60248201527f7075726368617365206578636565647320796f7572206c696d69740000000000604482015260640161085f565b60008981526002602052604090206004810154600c90910154612af9908a613b03565b1115612b475760405162461bcd60e51b815260206004820152601b60248201527f707572636861736520657863656564732073616c65206c696d69740000000000604482015260640161085f565b604051636eb1769f60e11b815233600482015230602482015288907f00000000000000000000000007537efba62504425f879e9d60a25ab09d1391616001600160a01b03169063dd62ed3e9060440160206040518083038186803b158015612bae57600080fd5b505afa158015612bc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be69190613735565b1015612c285760405162461bcd60e51b8152602060048201526011602482015270616c6c6f77616e636520746f6f206c6f7760781b604482015260640161085f565b600089815260026020526040902054612c70906001600160a01b037f00000000000000000000000007537efba62504425f879e9d60a25ab09d1391618116913391168b612f46565b6000898152600260209081526040808320338452600f01909152812080548a9290612c9c908490613b03565b90915550506000898152600260205260408120600c0180548a9290612cc2908490613b03565b925050819055508760046000828254612cdb9190613b03565b909155505060405133908a907f626774f7294b3079307930cbec9061bd3e7342694936faae16b870083853337f9061246a908c906000908d908d90613ae1565b6040516371d4ed8d60e11b81526001600160a01b0382811660048301526000917f0000000000000000000000008fad1c598fdd380d427db0a03846cb36483e43bc9091169063e3a9db1a9060240160206040518083038186803b158015612d8157600080fd5b505afa158015612d95573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c39190613735565b60008181526002602052604081206001015482906001600160a01b0316612df25760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206008015490565b60008181526002602052604081206001015482906001600160a01b0316612e425760405162461bcd60e51b815260040161085f90613ab8565b505060009081526002602052604090206004015490565b60008181526002602052604081206001015482906001600160a01b0316612e925760405162461bcd60e51b815260040161085f90613ab8565b50506000908152600260205260409020546001600160a01b031690565b600082612ebc8584612fa6565b14949350505050565b60405163f340fa0160e01b81526001600160a01b0383811660048301527f0000000000000000000000008fad1c598fdd380d427db0a03846cb36483e43bc169063f340fa019083906024016000604051808303818588803b158015612f2957600080fd5b505af1158015612f3d573d6000803e3d6000fd5b50505050505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612fa0908590613060565b50505050565b600081815b8451811015613058576000858281518110612fd657634e487b7160e01b600052603260045260246000fd5b60200260200101519050808311613018576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250613045565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061305081613cff565b915050612fab565b509392505050565b60006130b5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166131379092919063ffffffff16565b80519091501561313257808060200190518101906130d3919061351e565b6131325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161085f565b505050565b6060611be6848460008585843b6131905760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161085f565b600080866001600160a01b031685876040516131ac919061386a565b60006040518083038185875af1925050503d80600081146131e9576040519150601f19603f3d011682016040523d82523d6000602084013e6131ee565b606091505b50915091506131fe828286613209565b979650505050505050565b60608315613218575081611453565b8251156132285782518084602001fd5b8160405162461bcd60e51b815260040161085f91906139d7565b82805461324e90613cca565b90600052602060002090601f01602090048101928261327057600085556132b6565b82601f1061328957805160ff19168380011785556132b6565b828001600101855582156132b6579182015b828111156132b657825182559160200191906001019061329b565b506132c292915061333a565b5090565b8280546132d290613cca565b90600052602060002090601f0160209004810192826132f457600085556132b6565b82601f1061330d5782800160ff198235161785556132b6565b828001600101855582156132b6579182015b828111156132b657823582559160200191906001019061331f565b5b808211156132c2576000815560010161333b565b60008083601f840112613360578081fd5b50813567ffffffffffffffff811115613377578182fd5b6020830191508360208260051b850101111561339257600080fd5b9250929050565b600082601f8301126133a9578081fd5b813567ffffffffffffffff808211156133c4576133c4613d46565b604051601f8301601f19908116603f011681019082821181831017156133ec576133ec613d46565b81604052838152866020858801011115613404578485fd5b8360208701602083013792830160200193909352509392505050565b803561342b81613d74565b919050565b805169ffffffffffffffffffff8116811461342b57600080fd5b60006020828403121561345b578081fd5b813561145381613d5c565b60008060008060008060008060008060006101608c8e031215613487578687fd5b8b3561349281613d5c565b9a5060208c0135995060408c0135985060608c0135975060808c0135965060a08c0135955060c08c0135945060e08c01356134cc81613d5c565b93506101008c013567ffffffffffffffff8111156134e8578384fd5b6134f48e828f01613399565b9350506101208c0135915061350c6101408d01613420565b90509295989b509295989b9093969950565b60006020828403121561352f578081fd5b81518015158114611453578182fd5b60006020828403121561354f578081fd5b5035919050565b60008060408385031215613568578182fd5b82359150602083013561357a81613d5c565b809150509250929050565b6000806000806060858703121561359a578384fd5b8435935060208501356135ac81613d5c565b9250604085013567ffffffffffffffff8111156135c7578283fd5b6135d38782880161334f565b95989497509550505050565b6000806000606084860312156135f3578283fd5b83359250602084013561360581613d5c565b929592945050506040919091013590565b60008060006040848603121561362a578283fd5b83359250602084013567ffffffffffffffff811115613647578283fd5b6136538682870161334f565b9497909650939450505050565b60008060408385031215613672578182fd5b50508035926020909101359150565b60008060008060608587031215613696578182fd5b8435935060208501359250604085013567ffffffffffffffff808211156136bb578384fd5b818701915087601f8301126136ce578384fd5b8135818111156136dc578485fd5b8860208285010111156136ed578485fd5b95989497505060200194505050565b60008060008060608587031215613711578182fd5b8435935060208501359250604085013567ffffffffffffffff8111156135c7578283fd5b600060208284031215613746578081fd5b5051919050565b600080600080600060a08688031215613764578283fd5b61376d86613430565b945060208601519350604086015192506060860151915061379060808701613430565b90509295509295909350565b6000602082840312156137ad578081fd5b815161145381613d74565b81835260006001600160fb1b038311156137d0578081fd5b8260051b80836020870137939093016020019283525090919050565b8a81526bffffffffffffffffffffffff198a60601b1660208201528860348201528760548201528660748201528560948201528460b48201526000845161383a8160d4850160208901613c9e565b60d492019182019390935260f89190911b6001600160f81b03191660f482015260f5019998505050505050505050565b6000825161387c818460208701613c9e565b9190910192915050565b600061014060018060a01b038d16835260208c818501528b60408501528a60608501528960808501528860a08501528760c08501528160e085015282875484600182811c9150808316806138db57607f831692505b8583108114156138f957634e487b7160e01b88526022600452602488fd5b95880182815260200195808015613917576001811461392857613952565b60ff19851688528688019550613952565b60008d815260209020895b8581101561394c5781548a820152908401908801613933565b89019650505b5050505050610100850187905260ff861661012086015292506113d4915050565b8481526001600160a01b038416602082015260606040820181905260009061399e90830184866137b8565b9695505050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60208152600082518060208401526139f6816040850160208701613c9e565b601f01601f19169190910160400192915050565b6020808252600d908201526c36bab9ba1031329030b236b4b760991b604082015260600190565b6020808252601c908201527f6d61783a203431303234343438303020284a616e203120323130302900000000604082015260600190565b60208082526030908201527f73616c65206d757374206265206f70656e20666f72206c6f6e6765722074686160408201526f6e206d61782071756575652074696d6560801b606082015260800190565b6020808252600f908201526e1a5b9d985b1a59081cd85b19481a59608a1b604082015260600190565b848152831515602082015260606040820152600061399e6060830184866137b8565b60008219821115613b1657613b16613d1a565b500190565b600060ff821660ff84168060ff03821115613b3857613b38613d1a565b019392505050565b60006001600160a01b0383811680613b5a57613b5a613d30565b92169190910492915050565b600082613b7557613b75613d30565b500490565b600181815b80851115613bb5578160001904821115613b9b57613b9b613d1a565b80851615613ba857918102915b93841c9390800290613b7f565b509250929050565b60006116c060ff841683600082613bd6575060016116c3565b81613be3575060006116c3565b8160018114613bf95760028114613c0357613c1f565b60019150506116c3565b60ff841115613c1457613c14613d1a565b50506001821b6116c3565b5060208310610133831016604e8410600b8410161715613c42575081810a6116c3565b613c4c8383613b7a565b8060001904821115613c6057613c60613d1a565b029392505050565b6000816000190483118215151615613c8257613c82613d1a565b500290565b600082821015613c9957613c99613d1a565b500390565b60005b83811015613cb9578181015183820152602001613ca1565b83811115612fa05750506000910152565b600181811c90821680613cde57607f821691505b6020821081141561088657634e487b7160e01b600052602260045260246000fd5b6000600019821415613d1357613d13613d1a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114613d7157600080fd5b50565b60ff81168114613d7157600080fdfea2646970667358221220c34b1b64a31e3ad731ea7d2b9ea65a1483d6d2acb0cbbc156eced181717fc32664736f6c63430008040033

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

00000000000000000000000007537efba62504425f879e9d60a25ab09d139161000000000000000000000000000000000000000000000000000000000000000600000000000000000000000017c14f6087c62666d28361697f4a9b4d39dc3bc5

-----Decoded View---------------
Arg [0] : _paymentToken (address): 0x07537efBa62504425f879E9D60A25aB09D139161
Arg [1] : _paymentTokenDecimals (uint8): 6
Arg [2] : _priceOracle (address): 0x17c14f6087C62666D28361697f4a9B4D39DC3Bc5

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000007537efba62504425f879e9d60a25ab09d139161
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [2] : 00000000000000000000000017c14f6087c62666d28361697f4a9b4d39dc3bc5


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.