ETH Price: $3,365.21 (+0.09%)

Contract

0xa084811e350B0E0A07cD4BD8d762ed7ed070b73B
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

Transaction Hash
Method
Block
From
To
Transfer142150192022-02-16 4:17:391047 days ago1644985059IN
Wizards & Dragons: WnDGame 2
0.21335085 ETH0.0010363449.34972903
Add To Whitelist138261072021-12-18 1:25:431107 days ago1639790743IN
Wizards & Dragons: WnDGame 2
0 ETH0.0023455896.0203058
Mint137810302021-12-11 2:01:241114 days ago1639188084IN
Wizards & Dragons: WnDGame 2
0.176 ETH0.0021251688.64807891
Mint137487072021-12-05 22:47:401119 days ago1638744460IN
Wizards & Dragons: WnDGame 2
0.176 ETH0.00289714120.85026479
Set Treasure Che...137406782021-12-04 15:54:501120 days ago1638633290IN
Wizards & Dragons: WnDGame 2
0 ETH0.00672308260
Pay Tribute137252102021-12-02 4:14:501123 days ago1638418490IN
Wizards & Dragons: WnDGame 2
0 ETH0.00279592117.36257066
Mint137252022021-12-02 4:12:461123 days ago1638418366IN
Wizards & Dragons: WnDGame 2
0 ETH0.00340858142.11308593
Mint137243442021-12-02 0:54:371123 days ago1638406477IN
Wizards & Dragons: WnDGame 2
0 ETH0.002320196.78007046
Mint137243442021-12-02 0:54:371123 days ago1638406477IN
Wizards & Dragons: WnDGame 2
0 ETH0.002320196.78007046
Mint137243422021-12-02 0:54:121123 days ago1638406452IN
Wizards & Dragons: WnDGame 2
0 ETH0.0022935595.67236845
Mint137243302021-12-02 0:51:401123 days ago1638406300IN
Wizards & Dragons: WnDGame 2
0 ETH0.0023507598.05847607
Mint137241842021-12-02 0:21:151123 days ago1638404475IN
Wizards & Dragons: WnDGame 2
0.176 ETH0.00277398115.65496948
Mint137236702021-12-01 22:25:281123 days ago1638397528IN
Wizards & Dragons: WnDGame 2
0 ETH0.0022231392.73494369
Mint137236582021-12-01 22:24:261123 days ago1638397466IN
Wizards & Dragons: WnDGame 2
0 ETH0.00315664131.60909956
Pay Tribute137232142021-12-01 20:42:141123 days ago1638391334IN
Wizards & Dragons: WnDGame 2
0 ETH0.00333341139.92426479
Mint137229312021-12-01 19:34:231123 days ago1638387263IN
Wizards & Dragons: WnDGame 2
0.176 ETH0.0022596694.21174368
Mint137229312021-12-01 19:34:231123 days ago1638387263IN
Wizards & Dragons: WnDGame 2
0.176 ETH0.0022534694
Mint137227922021-12-01 19:05:441123 days ago1638385544IN
Wizards & Dragons: WnDGame 2
0.8414 ETH0.0023502998.03923581
Mint137226282021-12-01 18:26:481123 days ago1638383208IN
Wizards & Dragons: WnDGame 2
0 ETH0.003138130.83183022
Set Paused137226202021-12-01 18:25:331123 days ago1638383133IN
Wizards & Dragons: WnDGame 2
0 ETH0.00562804137.74652432
Mint137226102021-12-01 18:24:071123 days ago1638383047IN
Wizards & Dragons: WnDGame 2
0 ETH0.13594112280
Mint137226072021-12-01 18:23:121123 days ago1638382992IN
Wizards & Dragons: WnDGame 2
0 ETH0.06996971181.39323368
Mint137226052021-12-01 18:22:561123 days ago1638382976IN
Wizards & Dragons: WnDGame 2
0 ETH0.07124186189.39498119
Mint137226052021-12-01 18:22:561123 days ago1638382976IN
Wizards & Dragons: WnDGame 2
0 ETH0.06673597189.39498119
Mint137226052021-12-01 18:22:561123 days ago1638382976IN
Wizards & Dragons: WnDGame 2
0 ETH0.06473084189.39498119
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226102021-12-01 18:24:071123 days ago1638383047
0xa084811e...ed070b73B
0 ETH
137226072021-12-01 18:23:121123 days ago1638382992
0xa084811e...ed070b73B
0 ETH
137226072021-12-01 18:23:121123 days ago1638382992
0xa084811e...ed070b73B
0 ETH
137226072021-12-01 18:23:121123 days ago1638382992
0xa084811e...ed070b73B
0 ETH
137226072021-12-01 18:23:121123 days ago1638382992
0xa084811e...ed070b73B
0 ETH
137226072021-12-01 18:23:121123 days ago1638382992
0xa084811e...ed070b73B
0 ETH
137226072021-12-01 18:23:121123 days ago1638382992
0xa084811e...ed070b73B
0 ETH
137226072021-12-01 18:23:121123 days ago1638382992
0xa084811e...ed070b73B
0 ETH
137226072021-12-01 18:23:121123 days ago1638382992
0xa084811e...ed070b73B
0 ETH
137226052021-12-01 18:22:561123 days ago1638382976
0xa084811e...ed070b73B
0 ETH
137226052021-12-01 18:22:561123 days ago1638382976
0xa084811e...ed070b73B
0 ETH
137226052021-12-01 18:22:561123 days ago1638382976
0xa084811e...ed070b73B
0 ETH
137226052021-12-01 18:22:561123 days ago1638382976
0xa084811e...ed070b73B
0 ETH
137226052021-12-01 18:22:561123 days ago1638382976
0xa084811e...ed070b73B
0 ETH
137226052021-12-01 18:22:561123 days ago1638382976
0xa084811e...ed070b73B
0 ETH
137226052021-12-01 18:22:561123 days ago1638382976
0xa084811e...ed070b73B
0 ETH
137226052021-12-01 18:22:561123 days ago1638382976
0xa084811e...ed070b73B
0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WnDGame

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 22 : WNDGame.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./interfaces/IWnDGame.sol";
import "./interfaces/ITower.sol";
import "./interfaces/ITraits.sol";
import "./interfaces/IGP.sol";
import "./interfaces/IWnD.sol";
import "./interfaces/ISacrificialAlter.sol";
import "./interfaces/IRandomizer.sol";


contract WnDGame is IWnDGame, Ownable, ReentrancyGuard, Pausable {

  IRandomizer public randomizer; 

  struct LastWrite {
    uint64 time;
    uint64 blockNum;
  }

  struct Whitelist {
    bool isWhitelisted;
    uint16 numMinted;
  }

  mapping(address => LastWrite) private _lastWrite;

  bool public hasPublicSaleStarted;
  uint256 public presalePrice = 0.088 ether;
  uint256 public treasureChestTypeId;

  uint256 private maxPrice = 0.42069 ether;
  // uint256 private maxPrice = 0.0001 ether;
  uint256 private minPrice = 0.088 ether;
  // uint256 private minPrice = 0.0001 ether;
  uint256 private priceDecrementAmt = 0.01 ether;
  uint256 private timeToDecrementPrice = 10 minutes;
  uint256 private startedTime;
  // max $GP cost 
  uint256 private maxGpCost = 72000 ether;

  mapping(address => Whitelist) private _whitelistAddresses;

  // reference to the Tower for choosing random Dragon thieves
  ITower public tower;
  // reference to $GP for burning on mint
  IGP public gpToken;
  // reference to Traits
  ITraits public traits;
  // reference to NFT collection
  IWnD public wndNFT;
  // reference to alter collection
  ISacrificialAlter public alter;

  /** 
   * instantiates contract and rarity tables
   */
  constructor() {
    _pause();
  }

  /** CRITICAL TO SETUP */

  modifier requireContractsSet() {
      require(address(gpToken) != address(0) && address(traits) != address(0) 
        && address(wndNFT) != address(0) && address(tower) != address(0) && address(alter) != address(0)
         && address(randomizer) != address(0)
        , "Contracts not set");
      _;
  }

  function setContracts(address _gp, address _traits, address _wnd, address _tower, address _alter, address _rand) external onlyOwner {
    gpToken = IGP(_gp);
    traits = ITraits(_traits);
    wndNFT = IWnD(_wnd);
    tower = ITower(_tower);
    alter = ISacrificialAlter(_alter);
    randomizer = IRandomizer(_rand);
  }

  function setTreasureChestId(uint256 typeId) external onlyOwner {
    treasureChestTypeId = typeId;
  }
  /** EXTERNAL */

  /** 
   * mint a token - 90% Wizard, 10% Dragons
   * The first 25% are claimed with eth, the remaining cost $GP
   */
  function mint(uint256 amount, bool stake) external payable whenNotPaused nonReentrant {
    require(tx.origin == _msgSender(), "Only EOA");
    uint16 minted = wndNFT.minted();
    uint256 maxTokens = wndNFT.getMaxTokens();
    uint256 paidTokens = wndNFT.getPaidTokens();
    require(minted + amount <= maxTokens, "All tokens minted");
    require(amount > 0 && amount <= 10, "Invalid mint amount");
    if (minted < paidTokens) {
      require(minted + amount <= paidTokens, "All tokens on-sale already sold");
      if(hasPublicSaleStarted) {
        require(msg.value >= amount * currentPriceToMint(), "Invalid payment amount");
      }
      else {
        require(amount * presalePrice == msg.value, "Invalid payment amount");
        require(_whitelistAddresses[_msgSender()].isWhitelisted, "Not on whitelist");
        require(_whitelistAddresses[_msgSender()].numMinted + amount <= 2, "too many mints");
        _whitelistAddresses[_msgSender()].numMinted += uint16(amount);
      }
    } else {
      require(msg.value == 0);
    }
    LastWrite storage lw = _lastWrite[tx.origin];

    uint256 totalGpCost = 0;
    uint16[] memory tokenIds = new uint16[](amount);
    uint256 seed = 0;
    for (uint i = 0; i < amount; i++) {
      minted++;
      seed = randomizer.random();
      address recipient = selectRecipient(seed, minted, paidTokens);
      if(recipient != _msgSender() && alter.balanceOf(_msgSender(), treasureChestTypeId) > 0) {
        // If the mint is going to be stolen, there's a 50% chance 
        //  a dragon will prefer a treasure chest over it
        if(seed & 1 == 1) {
          alter.safeTransferFrom(_msgSender(), recipient, treasureChestTypeId, 1, "");
          recipient = _msgSender();
        }
      }
      tokenIds[i] = minted;
      if (!stake || recipient != _msgSender()) {
        wndNFT.mint(recipient, seed);
      } else {
        wndNFT.mint(address(tower), seed);
      }
      totalGpCost += mintCost(minted, maxTokens, paidTokens);
    }
    wndNFT.updateOriginAccess(tokenIds);
    if (totalGpCost > 0) {
      gpToken.burn(_msgSender(), totalGpCost);
      gpToken.updateOriginAccess();
    }
    if (stake) {
      tower.addManyToTowerAndFlight(_msgSender(), tokenIds);
    }
    lw.time = uint64(block.timestamp);
    lw.blockNum = uint64(block.number);
  }

  function currentPriceToMint() view public returns(uint256) {
    uint256 numDecrements = (block.timestamp - startedTime) / timeToDecrementPrice;
    uint256 decrementAmt = (priceDecrementAmt * numDecrements);
    if(decrementAmt > maxPrice) {
      return minPrice;
    }
    uint256 adjPrice = maxPrice - decrementAmt;
    return adjPrice;
  }

  function addToWhitelist(address[] calldata addressesToAdd) public onlyOwner {
    for (uint256 i = 0; i < addressesToAdd.length; i++) {
      _whitelistAddresses[addressesToAdd[i]] = Whitelist(true, 0);
    }
  }

  function setPublicSaleStart(bool started) external onlyOwner {
    hasPublicSaleStarted = started;
    if(hasPublicSaleStarted) {
      startedTime = block.timestamp;
    }
  }

  /** 
   * @param tokenId the ID to check the cost of to mint
   * @return the cost of the given token ID
   */
  function mintCost(uint256 tokenId, uint256 maxTokens, uint256 paidTokens) public view returns (uint256) {
    if (tokenId <= paidTokens) return 0;
    if (tokenId <= maxTokens * 8 / 20) return 24000 ether;
    if (tokenId <= maxTokens * 11 / 20) return 36000 ether;
    if (tokenId <= maxTokens * 14 / 20) return 48000 ether;
    if (tokenId <= maxTokens * 17 / 20) return 60000 ether; 
    if (tokenId > maxTokens * 17 / 20) return maxGpCost;
  }

  function payTribute(uint256 gpAmt) external whenNotPaused nonReentrant {
    require(tx.origin == _msgSender(), "Only EOA");
    uint16 minted = wndNFT.minted();
    uint256 maxTokens = wndNFT.getMaxTokens();
    uint256 paidTokens = wndNFT.getPaidTokens();
    uint256 gpMintCost = mintCost(minted, maxTokens, paidTokens);
    require(gpMintCost > 0, "Sacrificial alter currently closed");
    require(gpAmt >= gpMintCost, "Not enough gp given");
    gpToken.burn(_msgSender(), gpAmt);
    if(gpAmt < gpMintCost * 2) {
      alter.mint(1, 1, _msgSender());
    }
    else {
      alter.mint(2, 1, _msgSender());
    }
  }

  function makeTreasureChests(uint16 qty) external whenNotPaused {
    require(tx.origin == _msgSender(), "Only EOA");
    require(treasureChestTypeId > 0, "DEVS DO SOMETHING");
    // $GP exchange amount handled within alter contract
    // Will fail if sender doesn't have enough $GP
    // Transfer does not need approved,
    //  as there is established trust between this contract and the alter contract 
    alter.mint(treasureChestTypeId, qty, _msgSender());
  }

  function sellTreasureChests(uint16 qty) external whenNotPaused {
    require(tx.origin == _msgSender(), "Only EOA");
    require(treasureChestTypeId > 0, "DEVS DO SOMETHING");
    // $GP exchange amount handled within alter contract
    alter.burn(treasureChestTypeId, qty, _msgSender());
  }

  function sacrifice(uint256 tokenId, uint256 gpAmt) external whenNotPaused nonReentrant {
    require(tx.origin == _msgSender(), "Only EOA");
    uint64 lastTokenWrite = wndNFT.getTokenWriteBlock(tokenId);
    // Must check this, as getTokenTraits will be allowed since this contract is an admin
    require(lastTokenWrite < block.number, "hmmmm what doing?");
    IWnD.WizardDragon memory nft = wndNFT.getTokenTraits(tokenId);
    uint16 minted = wndNFT.minted();
    uint256 maxTokens = wndNFT.getMaxTokens();
    uint256 paidTokens = wndNFT.getPaidTokens();
    uint256 gpMintCost = mintCost(minted, maxTokens, paidTokens);
    require(gpMintCost > 0, "Sacrificial alter currently closed");
    if(nft.isWizard) {
      // Wizard sacrifice requires 3x $GP curve
      require(gpAmt >= gpMintCost * 3, "not enough gp provided");
      gpToken.burn(_msgSender(), gpAmt);
      // This will check if origin is the owner of the token
      wndNFT.burn(tokenId);
      alter.mint(3, 1, _msgSender());
    }
    else {
      // Dragon sacrifice requires 4x $GP curve
      require(gpAmt >= gpMintCost * 4, "not enough gp provided");
      gpToken.burn(_msgSender(), gpAmt);
      // This will check if origin is the owner of the token
      wndNFT.burn(tokenId);
      alter.mint(4, 1, _msgSender());
    }
  }

  /** INTERNAL */

  /**
   * the first 25% (ETH purchases) go to the minter
   * the remaining 80% have a 10% chance to be given to a random staked dragon
   * @param seed a random value to select a recipient from
   * @return the address of the recipient (either the minter or the Dragon thief's owner)
   */
  function selectRecipient(uint256 seed, uint256 minted, uint256 paidTokens) internal view returns (address) {
    if (minted <= paidTokens || ((seed >> 245) % 10) != 0) return _msgSender(); // top 10 bits haven't been used
    address thief = tower.randomDragonOwner(seed >> 144); // 144 bits reserved for trait selection
    if (thief == address(0x0)) return _msgSender();
    return thief;
  }

  /** ADMIN */

  /**
   * enables owner to pause / unpause contract
   */
  function setPaused(bool _paused) external requireContractsSet onlyOwner {
    if (_paused) _pause();
    else _unpause();
  }

  function setMaxGpCost(uint256 _amount) external requireContractsSet onlyOwner {
    maxGpCost = _amount;
  } 

  /**
   * allows owner to withdraw funds from minting
   */
  function withdraw() external onlyOwner {
    payable(owner()).transfer(address(this).balance);
  }
}

File 2 of 22 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 22 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 4 of 22 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 5 of 22 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

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 make 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 22 : IWnDGame.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

interface IWnDGame {
  
}

File 7 of 22 : ITower.sol
// SPDX-License-Identifier: MIT LICENSE 

pragma solidity ^0.8.0;

interface ITower {
  function addManyToTowerAndFlight(address account, uint16[] calldata tokenIds) external;
  function randomDragonOwner(uint256 seed) external view returns (address);
}

File 8 of 22 : ITraits.sol
// SPDX-License-Identifier: MIT LICENSE 

pragma solidity ^0.8.0;

interface ITraits {
  function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 9 of 22 : IGP.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

interface IGP {
    function mint(address to, uint256 amount) external;
    function burn(address from, uint256 amount) external;
    function updateOriginAccess() external;
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}

File 10 of 22 : IWnD.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

interface IWnD is IERC721Enumerable {

    // game data storage
    struct WizardDragon {
        bool isWizard;
        uint8 body;
        uint8 head;
        uint8 spell;
        uint8 eyes;
        uint8 neck;
        uint8 mouth;
        uint8 wand;
        uint8 tail;
        uint8 rankIndex;
    }

    function minted() external returns (uint16);
    function updateOriginAccess(uint16[] memory tokenIds) external;
    function mint(address recipient, uint256 seed) external;
    function burn(uint256 tokenId) external;
    function getMaxTokens() external view returns (uint256);
    function getPaidTokens() external view returns (uint256);
    function getTokenTraits(uint256 tokenId) external view returns (WizardDragon memory);
    function getTokenWriteBlock(uint256 tokenId) external view returns(uint64);
    function isWizard(uint256 tokenId) external view returns(bool);
  
}

File 11 of 22 : ISacrificialAlter.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

interface ISacrificialAlter {
    function mint(uint256 typeId, uint16 qty, address recipient) external;
    function burn(uint256 typeId, uint16 qty, address burnFrom) external;
    function updateOriginAccess() external;
    function balanceOf(address account, uint256 id) external returns (uint256);
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) external;
}

File 12 of 22 : IRandomizer.sol
pragma solidity ^0.8.0;

interface IRandomizer {
    function random() external returns (uint256);
}

File 13 of 22 : Context.sol
// SPDX-License-Identifier: MIT

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 14 of 22 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 15 of 22 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 16 of 22 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 17 of 22 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 18 of 22 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 19 of 22 : Address.sol
// SPDX-License-Identifier: MIT

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 20 of 22 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 21 of 22 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 22 of 22 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address[]","name":"addressesToAdd","type":"address[]"}],"name":"addToWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"alter","outputs":[{"internalType":"contract ISacrificialAlter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentPriceToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gpToken","outputs":[{"internalType":"contract IGP","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasPublicSaleStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"qty","type":"uint16"}],"name":"makeTreasureChests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"stake","type":"bool"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"maxTokens","type":"uint256"},{"internalType":"uint256","name":"paidTokens","type":"uint256"}],"name":"mintCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gpAmt","type":"uint256"}],"name":"payTribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"presalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomizer","outputs":[{"internalType":"contract IRandomizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"gpAmt","type":"uint256"}],"name":"sacrifice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"qty","type":"uint16"}],"name":"sellTreasureChests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gp","type":"address"},{"internalType":"address","name":"_traits","type":"address"},{"internalType":"address","name":"_wnd","type":"address"},{"internalType":"address","name":"_tower","type":"address"},{"internalType":"address","name":"_alter","type":"address"},{"internalType":"address","name":"_rand","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setMaxGpCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"started","type":"bool"}],"name":"setPublicSaleStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"typeId","type":"uint256"}],"name":"setTreasureChestId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tower","outputs":[{"internalType":"contract ITower","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traits","outputs":[{"internalType":"contract ITraits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasureChestTypeId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wndNFT","outputs":[{"internalType":"contract IWnD","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6080604052670138a388a43c00006005556705d697537a8f2000600755670138a388a43c0000600855662386f26fc10000600955610258600a55690f3f20b8dfa69d000000600c553480156200005457600080fd5b5062000060336200007e565b600180556002805460ff1916905562000078620000ce565b6200016c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60025460ff1615620001195760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640160405180910390fd5b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586200014f3390565b6040516001600160a01b03909116815260200160405180910390a1565b612a9f806200017c6000396000f3fe60806040526004361061019b5760003560e01c80637f649783116100ec578063e74c6bb51161008a578063f2fde38b11610064578063f2fde38b14610472578063f8248ad014610492578063f8b2a46e146104b2578063fdd4b0f0146104d257600080fd5b8063e74c6bb514610417578063f10fb5841461042d578063f2eea45c1461045257600080fd5b8063bdc8cbc2116100c6578063bdc8cbc2146103a2578063c71a7d67146103c2578063ca14df4f146103d7578063e1fc334f146103f757600080fd5b80637f6497831461034457806383c72a83146103645780638da5cb5b1461038457600080fd5b80633d73c75d116101595780636f7bb00a116101335780636f7bb00a146102b7578063715018a6146102ef5780637a92e551146103045780637b25e04c1461032457600080fd5b80633d73c75d146102605780635c975abb1461028057806367f68fac146102a457600080fd5b80620e7fa8146101a057806316c38b3c146101c957806318adfb62146101eb5780631f4fb37a1461020b5780632463a55a1461022b5780633ccfd60b1461024b575b600080fd5b3480156101ac57600080fd5b506101b660055481565b6040519081526020015b60405180910390f35b3480156101d557600080fd5b506101e96101e4366004612579565b6104ec565b005b3480156101f757600080fd5b506101e9610206366004612694565b6105f5565b34801561021757600080fd5b506101e9610226366004612694565b6106e5565b34801561023757600080fd5b506101e9610246366004612488565b610714565b34801561025757600080fd5b506101e96107bd565b34801561026c57600080fd5b506101e961027b366004612579565b610821565b34801561028c57600080fd5b5060025460ff165b60405190151581526020016101c0565b6101e96102b23660046126c4565b61086b565b3480156102c357600080fd5b50600f546102d7906001600160a01b031681565b6040516001600160a01b0390911681526020016101c0565b3480156102fb57600080fd5b506101e96112fe565b34801561031057600080fd5b506101b661031f366004612714565b611334565b34801561033057600080fd5b506101e961033f3660046126f3565b611427565b34801561035057600080fd5b506101e961035f366004612509565b611ae0565b34801561037057600080fd5b506101e961037f36600461265c565b611bc1565b34801561039057600080fd5b506000546001600160a01b03166102d7565b3480156103ae57600080fd5b506101e96103bd36600461265c565b611cb7565b3480156103ce57600080fd5b506101b6611d5e565b3480156103e357600080fd5b50600e546102d7906001600160a01b031681565b34801561040357600080fd5b506010546102d7906001600160a01b031681565b34801561042357600080fd5b506101b660065481565b34801561043957600080fd5b506002546102d79061010090046001600160a01b031681565b34801561045e57600080fd5b506012546102d7906001600160a01b031681565b34801561047e57600080fd5b506101e961048d366004612450565b611dbc565b34801561049e57600080fd5b506101e96104ad366004612694565b611e54565b3480156104be57600080fd5b506011546102d7906001600160a01b031681565b3480156104de57600080fd5b506004546102949060ff1681565b600f546001600160a01b03161580159061051057506010546001600160a01b031615155b801561052657506011546001600160a01b031615155b801561053c5750600e546001600160a01b031615155b801561055257506012546001600160a01b031615155b801561056d575060025461010090046001600160a01b031615155b6105b25760405162461bcd60e51b815260206004820152601160248201527010dbdb9d1c9858dd1cc81b9bdd081cd95d607a1b60448201526064015b60405180910390fd5b6000546001600160a01b031633146105dc5760405162461bcd60e51b81526004016105a99061288d565b80156105ed576105ea61222d565b50565b6105ea6122a2565b600f546001600160a01b03161580159061061957506010546001600160a01b031615155b801561062f57506011546001600160a01b031615155b80156106455750600e546001600160a01b031615155b801561065b57506012546001600160a01b031615155b8015610676575060025461010090046001600160a01b031615155b6106b65760405162461bcd60e51b815260206004820152601160248201527010dbdb9d1c9858dd1cc81b9bdd081cd95d607a1b60448201526064016105a9565b6000546001600160a01b031633146106e05760405162461bcd60e51b81526004016105a99061288d565b600c55565b6000546001600160a01b0316331461070f5760405162461bcd60e51b81526004016105a99061288d565b600655565b6000546001600160a01b0316331461073e5760405162461bcd60e51b81526004016105a99061288d565b600f80546001600160a01b039788166001600160a01b03199182161790915560108054968816968216969096179095556011805494871694861694909417909355600e805492861692851692909217909155601280549185169190931617909155600280549190921661010002610100600160a81b0319909116179055565b6000546001600160a01b031633146107e75760405162461bcd60e51b81526004016105a99061288d565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156105ea573d6000803e3d6000fd5b6000546001600160a01b0316331461084b5760405162461bcd60e51b81526004016105a99061288d565b6004805460ff191682151590811790915560ff16156105ea5742600b5550565b60025460ff161561088e5760405162461bcd60e51b81526004016105a990612863565b600260015414156108b15760405162461bcd60e51b81526004016105a9906128c2565b60026001553233146108d55760405162461bcd60e51b81526004016105a9906127ff565b60115460408051630278162160e51b815290516000926001600160a01b031691634f02c42091600480830192602092919082900301818787803b15801561091b57600080fd5b505af115801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190612678565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316636abcded16040518163ffffffff1660e01b815260040160206040518083038186803b1580156109a557600080fd5b505afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd91906126ac565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316634018b1f86040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6791906126ac565b905081610a788661ffff8616612957565b1115610aba5760405162461bcd60e51b8152602060048201526011602482015270105b1b081d1bdad95b9cc81b5a5b9d1959607a1b60448201526064016105a9565b600085118015610acb5750600a8511155b610b0d5760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081b5a5b9d08185b5bdd5b9d606a1b60448201526064016105a9565b808361ffff161015610d375780610b288661ffff8616612957565b1115610b765760405162461bcd60e51b815260206004820152601f60248201527f416c6c20746f6b656e73206f6e2d73616c6520616c726561647920736f6c640060448201526064016105a9565b60045460ff1615610be057610b89611d5e565b610b939086612983565b341015610bdb5760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081c185e5b595b9d08185b5bdd5b9d60521b60448201526064016105a9565b610d42565b3460055486610bef9190612983565b14610c355760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081c185e5b595b9d08185b5bdd5b9d60521b60448201526064016105a9565b336000908152600d602052604090205460ff16610c875760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b60448201526064016105a9565b336000908152600d6020526040902054600290610cae908790610100900461ffff16612957565b1115610ced5760405162461bcd60e51b815260206004820152600e60248201526d746f6f206d616e79206d696e747360901b60448201526064016105a9565b336000908152600d602052604090208054869190600190610d18908490610100900461ffff16612931565b92506101000a81548161ffff021916908361ffff160217905550610d42565b3415610d4257600080fd5b32600090815260036020526040812090808767ffffffffffffffff811115610d7a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610da3578160200160208202803683370190505b5090506000805b898110156111075787610dbc816129b9565b985050600260019054906101000a90046001600160a01b03166001600160a01b0316635ec01e4d6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e0f57600080fd5b505af1158015610e23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4791906126ac565b91506000610e5a838a61ffff168961231c565b90506001600160a01b0381163314801590610f0757506012546000906001600160a01b031662fdd58e336006546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610ecd57600080fd5b505af1158015610ee1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0591906126ac565b115b15610fb2578260011660011415610fb2576012546001600160a01b031663f242432a336006546040516001600160e01b031960e085901b1681526001600160a01b039283166004820152918516602483015260448201526001606482015260a06084820152600060a482015260c401600060405180830381600087803b158015610f9057600080fd5b505af1158015610fa4573d6000803e3d6000fd5b50505050610faf3390565b90505b88848381518110610fd357634e487b7160e01b600052603260045260246000fd5b602002602001019061ffff16908161ffff1681525050891580610fff57506001600160a01b0381163314155b1561106f576011546040516340c10f1960e01b81526001600160a01b03838116600483015260248201869052909116906340c10f1990604401600060405180830381600087803b15801561105257600080fd5b505af1158015611066573d6000803e3d6000fd5b505050506110d8565b601154600e546040516340c10f1960e01b81526001600160a01b039182166004820152602481018690529116906340c10f1990604401600060405180830381600087803b1580156110bf57600080fd5b505af11580156110d3573d6000803e3d6000fd5b505050505b6110e78961ffff168989611334565b6110f19086612957565b94505080806110ff906129db565b915050610daa565b506011546040516335ca838b60e01b81526001600160a01b03909116906335ca838b906111389085906004016127c9565b600060405180830381600087803b15801561115257600080fd5b505af1158015611166573d6000803e3d6000fd5b50505050600083111561124e57600f546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101869052604401600060405180830381600087803b1580156111cd57600080fd5b505af11580156111e1573d6000803e3d6000fd5b50505050600f60009054906101000a90046001600160a01b03166001600160a01b0316639c47ee3b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561123557600080fd5b505af1158015611249573d6000803e3d6000fd5b505050505b87156112b757600e546001600160a01b03166362bd92ae33846040518363ffffffff1660e01b81526004016112849291906127a5565b600060405180830381600087803b15801561129e57600080fd5b505af11580156112b2573d6000803e3d6000fd5b505050505b505081544367ffffffffffffffff90811668010000000000000000026fffffffffffffffffffffffffffffffff199092164291909116171790915550506001805550505050565b6000546001600160a01b031633146113285760405162461bcd60e51b81526004016105a99061288d565b61133260006123df565b565b600081841161134557506000611420565b6014611352846008612983565b61135c919061296f565b841161137357506905150ae84a8cdf000000611420565b601461138084600b612983565b61138a919061296f565b84116113a1575069079f905c6fd34e800000611420565b60146113ae84600e612983565b6113b8919061296f565b84116113cf5750690a2a15d09519be000000611420565b60146113dc846011612983565b6113e6919061296f565b84116113fd5750690cb49b44ba602d800000611420565b601461140a846011612983565b611414919061296f565b8411156114205750600c545b9392505050565b60025460ff161561144a5760405162461bcd60e51b81526004016105a990612863565b6002600154141561146d5760405162461bcd60e51b81526004016105a9906128c2565b60026001553233146114915760405162461bcd60e51b81526004016105a9906127ff565b601154604051631d7a2e6d60e31b8152600481018490526000916001600160a01b03169063ebd173689060240160206040518083038186803b1580156114d657600080fd5b505afa1580156114ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150e919061273f565b9050438167ffffffffffffffff161061155d5760405162461bcd60e51b8152602060048201526011602482015270686d6d6d6d207768617420646f696e673f60781b60448201526064016105a9565b6011546040516394e5684760e01b8152600481018590526000916001600160a01b0316906394e56847906024016101406040518083038186803b1580156115a357600080fd5b505afa1580156115b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115db9190612595565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316634f02c4206040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561162f57600080fd5b505af1158015611643573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116679190612678565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316636abcded16040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b957600080fd5b505afa1580156116cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f191906126ac565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316634018b1f86040518163ffffffff1660e01b815260040160206040518083038186803b15801561174357600080fd5b505afa158015611757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177b91906126ac565b9050600061178e8461ffff168484611334565b9050600081116117b05760405162461bcd60e51b81526004016105a990612821565b845115611947576117c2816003612983565b87101561180a5760405162461bcd60e51b81526020600482015260166024820152751b9bdd08195b9bdd59da0819dc081c1c9bdd9a59195960521b60448201526064016105a9565b600f546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018a9052604401600060405180830381600087803b15801561186457600080fd5b505af1158015611878573d6000803e3d6000fd5b5050601154604051630852cd8d60e31b8152600481018c90526001600160a01b0390911692506342966c689150602401600060405180830381600087803b1580156118c257600080fd5b505af11580156118d6573d6000803e3d6000fd5b5050601254604051635141601960e01b81526001600160a01b039091169250635141601991506119109060039060019033906004016127dc565b600060405180830381600087803b15801561192a57600080fd5b505af115801561193e573d6000803e3d6000fd5b50505050611ad2565b611952816004612983565b87101561199a5760405162461bcd60e51b81526020600482015260166024820152751b9bdd08195b9bdd59da0819dc081c1c9bdd9a59195960521b60448201526064016105a9565b600f546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018a9052604401600060405180830381600087803b1580156119f457600080fd5b505af1158015611a08573d6000803e3d6000fd5b5050601154604051630852cd8d60e31b8152600481018c90526001600160a01b0390911692506342966c689150602401600060405180830381600087803b158015611a5257600080fd5b505af1158015611a66573d6000803e3d6000fd5b5050601254604051635141601960e01b81526001600160a01b03909116925063514160199150611a9f90600490600190339083016127dc565b600060405180830381600087803b158015611ab957600080fd5b505af1158015611acd573d6000803e3d6000fd5b505050505b505060018055505050505050565b6000546001600160a01b03163314611b0a5760405162461bcd60e51b81526004016105a99061288d565b60005b81811015611bbc576040805180820190915260018152600060208201819052600d90858585818110611b4f57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611b649190612450565b6001600160a01b0316815260208082019290925260400160002082518154939092015161ffff166101000262ffff00199215159290921662ffffff199093169290921717905580611bb4816129db565b915050611b0d565b505050565b60025460ff1615611be45760405162461bcd60e51b81526004016105a990612863565b323314611c035760405162461bcd60e51b81526004016105a9906127ff565b600060065411611c495760405162461bcd60e51b81526020600482015260116024820152704445565320444f20534f4d455448494e4760781b60448201526064016105a9565b6012546006546001600160a01b039091169063514160199083335b6040518463ffffffff1660e01b8152600401611c82939291906127dc565b600060405180830381600087803b158015611c9c57600080fd5b505af1158015611cb0573d6000803e3d6000fd5b5050505050565b60025460ff1615611cda5760405162461bcd60e51b81526004016105a990612863565b323314611cf95760405162461bcd60e51b81526004016105a9906127ff565b600060065411611d3f5760405162461bcd60e51b81526020600482015260116024820152704445565320444f20534f4d455448494e4760781b60448201526064016105a9565b6012546006546001600160a01b03909116906306e7b953908333611c64565b600080600a54600b5442611d7291906129a2565b611d7c919061296f565b9050600081600954611d8e9190612983565b9050600754811115611da4576008549250505090565b600081600754611db491906129a2565b949350505050565b6000546001600160a01b03163314611de65760405162461bcd60e51b81526004016105a99061288d565b6001600160a01b038116611e4b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105a9565b6105ea816123df565b60025460ff1615611e775760405162461bcd60e51b81526004016105a990612863565b60026001541415611e9a5760405162461bcd60e51b81526004016105a9906128c2565b6002600155323314611ebe5760405162461bcd60e51b81526004016105a9906127ff565b60115460408051630278162160e51b815290516000926001600160a01b031691634f02c42091600480830192602092919082900301818787803b158015611f0457600080fd5b505af1158015611f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3c9190612678565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316636abcded16040518163ffffffff1660e01b815260040160206040518083038186803b158015611f8e57600080fd5b505afa158015611fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc691906126ac565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316634018b1f86040518163ffffffff1660e01b815260040160206040518083038186803b15801561201857600080fd5b505afa15801561202c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205091906126ac565b905060006120638461ffff168484611334565b9050600081116120855760405162461bcd60e51b81526004016105a990612821565b808510156120cb5760405162461bcd60e51b81526020600482015260136024820152722737ba1032b737bab3b41033b81033b4bb32b760691b60448201526064016105a9565b600f546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101889052604401600060405180830381600087803b15801561212557600080fd5b505af1158015612139573d6000803e3d6000fd5b5050505080600261214a9190612983565b8510156121bb576012546001600160a01b03166351416019600180336040518463ffffffff1660e01b8152600401612184939291906127dc565b600060405180830381600087803b15801561219e57600080fd5b505af11580156121b2573d6000803e3d6000fd5b50505050612222565b6012546001600160a01b0316635141601960026001336040518463ffffffff1660e01b81526004016121ef939291906127dc565b600060405180830381600087803b15801561220957600080fd5b505af115801561221d573d6000803e3d6000fd5b505050505b505060018055505050565b60025460ff16156122505760405162461bcd60e51b81526004016105a990612863565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122853390565b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff166122eb5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105a9565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612285565b6000818311158061233a5750612337600a60f586901c6129f6565b15155b15612346575033611420565b600e54604051638336a6cf60e01b8152609086901c60048201526000916001600160a01b031690638336a6cf9060240160206040518083038186803b15801561238e57600080fd5b505afa1580156123a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c6919061246c565b90506001600160a01b038116611db45733915050611420565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805161243a81612a4b565b919050565b805160ff8116811461243a57600080fd5b600060208284031215612461578081fd5b813561142081612a36565b60006020828403121561247d578081fd5b815161142081612a36565b60008060008060008060c087890312156124a0578182fd5b86356124ab81612a36565b955060208701356124bb81612a36565b945060408701356124cb81612a36565b935060608701356124db81612a36565b925060808701356124eb81612a36565b915060a08701356124fb81612a36565b809150509295509295509295565b6000806020838503121561251b578182fd5b823567ffffffffffffffff80821115612532578384fd5b818501915085601f830112612545578384fd5b813581811115612553578485fd5b8660208260051b8501011115612567578485fd5b60209290920196919550909350505050565b60006020828403121561258a578081fd5b813561142081612a4b565b600061014082840312156125a7578081fd5b6125af6128f9565b6125b88361242f565b81526125c66020840161243f565b60208201526125d76040840161243f565b60408201526125e86060840161243f565b60608201526125f96080840161243f565b608082015261260a60a0840161243f565b60a082015261261b60c0840161243f565b60c082015261262c60e0840161243f565b60e082015261010061263f81850161243f565b9082015261012061265184820161243f565b908201529392505050565b60006020828403121561266d578081fd5b813561142081612a59565b600060208284031215612689578081fd5b815161142081612a59565b6000602082840312156126a5578081fd5b5035919050565b6000602082840312156126bd578081fd5b5051919050565b600080604083850312156126d6578182fd5b8235915060208301356126e881612a4b565b809150509250929050565b60008060408385031215612705578182fd5b50508035926020909101359150565b600080600060608486031215612728578081fd5b505081359360208301359350604090920135919050565b600060208284031215612750578081fd5b815167ffffffffffffffff81168114611420578182fd5b6000815180845260208085019450808401835b8381101561279a57815161ffff168752958201959082019060010161277a565b509495945050505050565b6001600160a01b0383168152604060208201819052600090611db490830184612767565b6020815260006114206020830184612767565b92835261ffff9190911660208301526001600160a01b0316604082015260600190565b6020808252600890820152674f6e6c7920454f4160c01b604082015260600190565b60208082526022908201527f536163726966696369616c20616c7465722063757272656e746c7920636c6f73604082015261195960f21b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b604051610140810167ffffffffffffffff8111828210171561292b57634e487b7160e01b600052604160045260246000fd5b60405290565b600061ffff80831681851680830382111561294e5761294e612a0a565b01949350505050565b6000821982111561296a5761296a612a0a565b500190565b60008261297e5761297e612a20565b500490565b600081600019048311821515161561299d5761299d612a0a565b500290565b6000828210156129b4576129b4612a0a565b500390565b600061ffff808316818114156129d1576129d1612a0a565b6001019392505050565b60006000198214156129ef576129ef612a0a565b5060010190565b600082612a0557612a05612a20565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b03811681146105ea57600080fd5b80151581146105ea57600080fd5b61ffff811681146105ea57600080fdfea26469706673582212205e13f2c078c9daafa8d67f3302f1806f7e1026247136d0db8822a532a86a50de64736f6c63430008040033

Deployed Bytecode

0x60806040526004361061019b5760003560e01c80637f649783116100ec578063e74c6bb51161008a578063f2fde38b11610064578063f2fde38b14610472578063f8248ad014610492578063f8b2a46e146104b2578063fdd4b0f0146104d257600080fd5b8063e74c6bb514610417578063f10fb5841461042d578063f2eea45c1461045257600080fd5b8063bdc8cbc2116100c6578063bdc8cbc2146103a2578063c71a7d67146103c2578063ca14df4f146103d7578063e1fc334f146103f757600080fd5b80637f6497831461034457806383c72a83146103645780638da5cb5b1461038457600080fd5b80633d73c75d116101595780636f7bb00a116101335780636f7bb00a146102b7578063715018a6146102ef5780637a92e551146103045780637b25e04c1461032457600080fd5b80633d73c75d146102605780635c975abb1461028057806367f68fac146102a457600080fd5b80620e7fa8146101a057806316c38b3c146101c957806318adfb62146101eb5780631f4fb37a1461020b5780632463a55a1461022b5780633ccfd60b1461024b575b600080fd5b3480156101ac57600080fd5b506101b660055481565b6040519081526020015b60405180910390f35b3480156101d557600080fd5b506101e96101e4366004612579565b6104ec565b005b3480156101f757600080fd5b506101e9610206366004612694565b6105f5565b34801561021757600080fd5b506101e9610226366004612694565b6106e5565b34801561023757600080fd5b506101e9610246366004612488565b610714565b34801561025757600080fd5b506101e96107bd565b34801561026c57600080fd5b506101e961027b366004612579565b610821565b34801561028c57600080fd5b5060025460ff165b60405190151581526020016101c0565b6101e96102b23660046126c4565b61086b565b3480156102c357600080fd5b50600f546102d7906001600160a01b031681565b6040516001600160a01b0390911681526020016101c0565b3480156102fb57600080fd5b506101e96112fe565b34801561031057600080fd5b506101b661031f366004612714565b611334565b34801561033057600080fd5b506101e961033f3660046126f3565b611427565b34801561035057600080fd5b506101e961035f366004612509565b611ae0565b34801561037057600080fd5b506101e961037f36600461265c565b611bc1565b34801561039057600080fd5b506000546001600160a01b03166102d7565b3480156103ae57600080fd5b506101e96103bd36600461265c565b611cb7565b3480156103ce57600080fd5b506101b6611d5e565b3480156103e357600080fd5b50600e546102d7906001600160a01b031681565b34801561040357600080fd5b506010546102d7906001600160a01b031681565b34801561042357600080fd5b506101b660065481565b34801561043957600080fd5b506002546102d79061010090046001600160a01b031681565b34801561045e57600080fd5b506012546102d7906001600160a01b031681565b34801561047e57600080fd5b506101e961048d366004612450565b611dbc565b34801561049e57600080fd5b506101e96104ad366004612694565b611e54565b3480156104be57600080fd5b506011546102d7906001600160a01b031681565b3480156104de57600080fd5b506004546102949060ff1681565b600f546001600160a01b03161580159061051057506010546001600160a01b031615155b801561052657506011546001600160a01b031615155b801561053c5750600e546001600160a01b031615155b801561055257506012546001600160a01b031615155b801561056d575060025461010090046001600160a01b031615155b6105b25760405162461bcd60e51b815260206004820152601160248201527010dbdb9d1c9858dd1cc81b9bdd081cd95d607a1b60448201526064015b60405180910390fd5b6000546001600160a01b031633146105dc5760405162461bcd60e51b81526004016105a99061288d565b80156105ed576105ea61222d565b50565b6105ea6122a2565b600f546001600160a01b03161580159061061957506010546001600160a01b031615155b801561062f57506011546001600160a01b031615155b80156106455750600e546001600160a01b031615155b801561065b57506012546001600160a01b031615155b8015610676575060025461010090046001600160a01b031615155b6106b65760405162461bcd60e51b815260206004820152601160248201527010dbdb9d1c9858dd1cc81b9bdd081cd95d607a1b60448201526064016105a9565b6000546001600160a01b031633146106e05760405162461bcd60e51b81526004016105a99061288d565b600c55565b6000546001600160a01b0316331461070f5760405162461bcd60e51b81526004016105a99061288d565b600655565b6000546001600160a01b0316331461073e5760405162461bcd60e51b81526004016105a99061288d565b600f80546001600160a01b039788166001600160a01b03199182161790915560108054968816968216969096179095556011805494871694861694909417909355600e805492861692851692909217909155601280549185169190931617909155600280549190921661010002610100600160a81b0319909116179055565b6000546001600160a01b031633146107e75760405162461bcd60e51b81526004016105a99061288d565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156105ea573d6000803e3d6000fd5b6000546001600160a01b0316331461084b5760405162461bcd60e51b81526004016105a99061288d565b6004805460ff191682151590811790915560ff16156105ea5742600b5550565b60025460ff161561088e5760405162461bcd60e51b81526004016105a990612863565b600260015414156108b15760405162461bcd60e51b81526004016105a9906128c2565b60026001553233146108d55760405162461bcd60e51b81526004016105a9906127ff565b60115460408051630278162160e51b815290516000926001600160a01b031691634f02c42091600480830192602092919082900301818787803b15801561091b57600080fd5b505af115801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190612678565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316636abcded16040518163ffffffff1660e01b815260040160206040518083038186803b1580156109a557600080fd5b505afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd91906126ac565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316634018b1f86040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6791906126ac565b905081610a788661ffff8616612957565b1115610aba5760405162461bcd60e51b8152602060048201526011602482015270105b1b081d1bdad95b9cc81b5a5b9d1959607a1b60448201526064016105a9565b600085118015610acb5750600a8511155b610b0d5760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081b5a5b9d08185b5bdd5b9d606a1b60448201526064016105a9565b808361ffff161015610d375780610b288661ffff8616612957565b1115610b765760405162461bcd60e51b815260206004820152601f60248201527f416c6c20746f6b656e73206f6e2d73616c6520616c726561647920736f6c640060448201526064016105a9565b60045460ff1615610be057610b89611d5e565b610b939086612983565b341015610bdb5760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081c185e5b595b9d08185b5bdd5b9d60521b60448201526064016105a9565b610d42565b3460055486610bef9190612983565b14610c355760405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a59081c185e5b595b9d08185b5bdd5b9d60521b60448201526064016105a9565b336000908152600d602052604090205460ff16610c875760405162461bcd60e51b815260206004820152601060248201526f139bdd081bdb881dda1a5d195b1a5cdd60821b60448201526064016105a9565b336000908152600d6020526040902054600290610cae908790610100900461ffff16612957565b1115610ced5760405162461bcd60e51b815260206004820152600e60248201526d746f6f206d616e79206d696e747360901b60448201526064016105a9565b336000908152600d602052604090208054869190600190610d18908490610100900461ffff16612931565b92506101000a81548161ffff021916908361ffff160217905550610d42565b3415610d4257600080fd5b32600090815260036020526040812090808767ffffffffffffffff811115610d7a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610da3578160200160208202803683370190505b5090506000805b898110156111075787610dbc816129b9565b985050600260019054906101000a90046001600160a01b03166001600160a01b0316635ec01e4d6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e0f57600080fd5b505af1158015610e23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4791906126ac565b91506000610e5a838a61ffff168961231c565b90506001600160a01b0381163314801590610f0757506012546000906001600160a01b031662fdd58e336006546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610ecd57600080fd5b505af1158015610ee1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0591906126ac565b115b15610fb2578260011660011415610fb2576012546001600160a01b031663f242432a336006546040516001600160e01b031960e085901b1681526001600160a01b039283166004820152918516602483015260448201526001606482015260a06084820152600060a482015260c401600060405180830381600087803b158015610f9057600080fd5b505af1158015610fa4573d6000803e3d6000fd5b50505050610faf3390565b90505b88848381518110610fd357634e487b7160e01b600052603260045260246000fd5b602002602001019061ffff16908161ffff1681525050891580610fff57506001600160a01b0381163314155b1561106f576011546040516340c10f1960e01b81526001600160a01b03838116600483015260248201869052909116906340c10f1990604401600060405180830381600087803b15801561105257600080fd5b505af1158015611066573d6000803e3d6000fd5b505050506110d8565b601154600e546040516340c10f1960e01b81526001600160a01b039182166004820152602481018690529116906340c10f1990604401600060405180830381600087803b1580156110bf57600080fd5b505af11580156110d3573d6000803e3d6000fd5b505050505b6110e78961ffff168989611334565b6110f19086612957565b94505080806110ff906129db565b915050610daa565b506011546040516335ca838b60e01b81526001600160a01b03909116906335ca838b906111389085906004016127c9565b600060405180830381600087803b15801561115257600080fd5b505af1158015611166573d6000803e3d6000fd5b50505050600083111561124e57600f546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101869052604401600060405180830381600087803b1580156111cd57600080fd5b505af11580156111e1573d6000803e3d6000fd5b50505050600f60009054906101000a90046001600160a01b03166001600160a01b0316639c47ee3b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561123557600080fd5b505af1158015611249573d6000803e3d6000fd5b505050505b87156112b757600e546001600160a01b03166362bd92ae33846040518363ffffffff1660e01b81526004016112849291906127a5565b600060405180830381600087803b15801561129e57600080fd5b505af11580156112b2573d6000803e3d6000fd5b505050505b505081544367ffffffffffffffff90811668010000000000000000026fffffffffffffffffffffffffffffffff199092164291909116171790915550506001805550505050565b6000546001600160a01b031633146113285760405162461bcd60e51b81526004016105a99061288d565b61133260006123df565b565b600081841161134557506000611420565b6014611352846008612983565b61135c919061296f565b841161137357506905150ae84a8cdf000000611420565b601461138084600b612983565b61138a919061296f565b84116113a1575069079f905c6fd34e800000611420565b60146113ae84600e612983565b6113b8919061296f565b84116113cf5750690a2a15d09519be000000611420565b60146113dc846011612983565b6113e6919061296f565b84116113fd5750690cb49b44ba602d800000611420565b601461140a846011612983565b611414919061296f565b8411156114205750600c545b9392505050565b60025460ff161561144a5760405162461bcd60e51b81526004016105a990612863565b6002600154141561146d5760405162461bcd60e51b81526004016105a9906128c2565b60026001553233146114915760405162461bcd60e51b81526004016105a9906127ff565b601154604051631d7a2e6d60e31b8152600481018490526000916001600160a01b03169063ebd173689060240160206040518083038186803b1580156114d657600080fd5b505afa1580156114ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150e919061273f565b9050438167ffffffffffffffff161061155d5760405162461bcd60e51b8152602060048201526011602482015270686d6d6d6d207768617420646f696e673f60781b60448201526064016105a9565b6011546040516394e5684760e01b8152600481018590526000916001600160a01b0316906394e56847906024016101406040518083038186803b1580156115a357600080fd5b505afa1580156115b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115db9190612595565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316634f02c4206040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561162f57600080fd5b505af1158015611643573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116679190612678565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316636abcded16040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b957600080fd5b505afa1580156116cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f191906126ac565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316634018b1f86040518163ffffffff1660e01b815260040160206040518083038186803b15801561174357600080fd5b505afa158015611757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177b91906126ac565b9050600061178e8461ffff168484611334565b9050600081116117b05760405162461bcd60e51b81526004016105a990612821565b845115611947576117c2816003612983565b87101561180a5760405162461bcd60e51b81526020600482015260166024820152751b9bdd08195b9bdd59da0819dc081c1c9bdd9a59195960521b60448201526064016105a9565b600f546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018a9052604401600060405180830381600087803b15801561186457600080fd5b505af1158015611878573d6000803e3d6000fd5b5050601154604051630852cd8d60e31b8152600481018c90526001600160a01b0390911692506342966c689150602401600060405180830381600087803b1580156118c257600080fd5b505af11580156118d6573d6000803e3d6000fd5b5050601254604051635141601960e01b81526001600160a01b039091169250635141601991506119109060039060019033906004016127dc565b600060405180830381600087803b15801561192a57600080fd5b505af115801561193e573d6000803e3d6000fd5b50505050611ad2565b611952816004612983565b87101561199a5760405162461bcd60e51b81526020600482015260166024820152751b9bdd08195b9bdd59da0819dc081c1c9bdd9a59195960521b60448201526064016105a9565b600f546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018a9052604401600060405180830381600087803b1580156119f457600080fd5b505af1158015611a08573d6000803e3d6000fd5b5050601154604051630852cd8d60e31b8152600481018c90526001600160a01b0390911692506342966c689150602401600060405180830381600087803b158015611a5257600080fd5b505af1158015611a66573d6000803e3d6000fd5b5050601254604051635141601960e01b81526001600160a01b03909116925063514160199150611a9f90600490600190339083016127dc565b600060405180830381600087803b158015611ab957600080fd5b505af1158015611acd573d6000803e3d6000fd5b505050505b505060018055505050505050565b6000546001600160a01b03163314611b0a5760405162461bcd60e51b81526004016105a99061288d565b60005b81811015611bbc576040805180820190915260018152600060208201819052600d90858585818110611b4f57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611b649190612450565b6001600160a01b0316815260208082019290925260400160002082518154939092015161ffff166101000262ffff00199215159290921662ffffff199093169290921717905580611bb4816129db565b915050611b0d565b505050565b60025460ff1615611be45760405162461bcd60e51b81526004016105a990612863565b323314611c035760405162461bcd60e51b81526004016105a9906127ff565b600060065411611c495760405162461bcd60e51b81526020600482015260116024820152704445565320444f20534f4d455448494e4760781b60448201526064016105a9565b6012546006546001600160a01b039091169063514160199083335b6040518463ffffffff1660e01b8152600401611c82939291906127dc565b600060405180830381600087803b158015611c9c57600080fd5b505af1158015611cb0573d6000803e3d6000fd5b5050505050565b60025460ff1615611cda5760405162461bcd60e51b81526004016105a990612863565b323314611cf95760405162461bcd60e51b81526004016105a9906127ff565b600060065411611d3f5760405162461bcd60e51b81526020600482015260116024820152704445565320444f20534f4d455448494e4760781b60448201526064016105a9565b6012546006546001600160a01b03909116906306e7b953908333611c64565b600080600a54600b5442611d7291906129a2565b611d7c919061296f565b9050600081600954611d8e9190612983565b9050600754811115611da4576008549250505090565b600081600754611db491906129a2565b949350505050565b6000546001600160a01b03163314611de65760405162461bcd60e51b81526004016105a99061288d565b6001600160a01b038116611e4b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105a9565b6105ea816123df565b60025460ff1615611e775760405162461bcd60e51b81526004016105a990612863565b60026001541415611e9a5760405162461bcd60e51b81526004016105a9906128c2565b6002600155323314611ebe5760405162461bcd60e51b81526004016105a9906127ff565b60115460408051630278162160e51b815290516000926001600160a01b031691634f02c42091600480830192602092919082900301818787803b158015611f0457600080fd5b505af1158015611f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3c9190612678565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316636abcded16040518163ffffffff1660e01b815260040160206040518083038186803b158015611f8e57600080fd5b505afa158015611fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc691906126ac565b90506000601160009054906101000a90046001600160a01b03166001600160a01b0316634018b1f86040518163ffffffff1660e01b815260040160206040518083038186803b15801561201857600080fd5b505afa15801561202c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061205091906126ac565b905060006120638461ffff168484611334565b9050600081116120855760405162461bcd60e51b81526004016105a990612821565b808510156120cb5760405162461bcd60e51b81526020600482015260136024820152722737ba1032b737bab3b41033b81033b4bb32b760691b60448201526064016105a9565b600f546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101889052604401600060405180830381600087803b15801561212557600080fd5b505af1158015612139573d6000803e3d6000fd5b5050505080600261214a9190612983565b8510156121bb576012546001600160a01b03166351416019600180336040518463ffffffff1660e01b8152600401612184939291906127dc565b600060405180830381600087803b15801561219e57600080fd5b505af11580156121b2573d6000803e3d6000fd5b50505050612222565b6012546001600160a01b0316635141601960026001336040518463ffffffff1660e01b81526004016121ef939291906127dc565b600060405180830381600087803b15801561220957600080fd5b505af115801561221d573d6000803e3d6000fd5b505050505b505060018055505050565b60025460ff16156122505760405162461bcd60e51b81526004016105a990612863565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122853390565b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff166122eb5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105a9565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612285565b6000818311158061233a5750612337600a60f586901c6129f6565b15155b15612346575033611420565b600e54604051638336a6cf60e01b8152609086901c60048201526000916001600160a01b031690638336a6cf9060240160206040518083038186803b15801561238e57600080fd5b505afa1580156123a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c6919061246c565b90506001600160a01b038116611db45733915050611420565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805161243a81612a4b565b919050565b805160ff8116811461243a57600080fd5b600060208284031215612461578081fd5b813561142081612a36565b60006020828403121561247d578081fd5b815161142081612a36565b60008060008060008060c087890312156124a0578182fd5b86356124ab81612a36565b955060208701356124bb81612a36565b945060408701356124cb81612a36565b935060608701356124db81612a36565b925060808701356124eb81612a36565b915060a08701356124fb81612a36565b809150509295509295509295565b6000806020838503121561251b578182fd5b823567ffffffffffffffff80821115612532578384fd5b818501915085601f830112612545578384fd5b813581811115612553578485fd5b8660208260051b8501011115612567578485fd5b60209290920196919550909350505050565b60006020828403121561258a578081fd5b813561142081612a4b565b600061014082840312156125a7578081fd5b6125af6128f9565b6125b88361242f565b81526125c66020840161243f565b60208201526125d76040840161243f565b60408201526125e86060840161243f565b60608201526125f96080840161243f565b608082015261260a60a0840161243f565b60a082015261261b60c0840161243f565b60c082015261262c60e0840161243f565b60e082015261010061263f81850161243f565b9082015261012061265184820161243f565b908201529392505050565b60006020828403121561266d578081fd5b813561142081612a59565b600060208284031215612689578081fd5b815161142081612a59565b6000602082840312156126a5578081fd5b5035919050565b6000602082840312156126bd578081fd5b5051919050565b600080604083850312156126d6578182fd5b8235915060208301356126e881612a4b565b809150509250929050565b60008060408385031215612705578182fd5b50508035926020909101359150565b600080600060608486031215612728578081fd5b505081359360208301359350604090920135919050565b600060208284031215612750578081fd5b815167ffffffffffffffff81168114611420578182fd5b6000815180845260208085019450808401835b8381101561279a57815161ffff168752958201959082019060010161277a565b509495945050505050565b6001600160a01b0383168152604060208201819052600090611db490830184612767565b6020815260006114206020830184612767565b92835261ffff9190911660208301526001600160a01b0316604082015260600190565b6020808252600890820152674f6e6c7920454f4160c01b604082015260600190565b60208082526022908201527f536163726966696369616c20616c7465722063757272656e746c7920636c6f73604082015261195960f21b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b604051610140810167ffffffffffffffff8111828210171561292b57634e487b7160e01b600052604160045260246000fd5b60405290565b600061ffff80831681851680830382111561294e5761294e612a0a565b01949350505050565b6000821982111561296a5761296a612a0a565b500190565b60008261297e5761297e612a20565b500490565b600081600019048311821515161561299d5761299d612a0a565b500290565b6000828210156129b4576129b4612a0a565b500390565b600061ffff808316818114156129d1576129d1612a0a565b6001019392505050565b60006000198214156129ef576129ef612a0a565b5060010190565b600082612a0557612a05612a20565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b03811681146105ea57600080fd5b80151581146105ea57600080fd5b61ffff811681146105ea57600080fdfea26469706673582212205e13f2c078c9daafa8d67f3302f1806f7e1026247136d0db8822a532a86a50de64736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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