ETH Price: $3,456.52 (+1.70%)

Token

HouseNFT (House)
 

Overview

Max Total Supply

2,719 House

Holders

130

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
2 House
0xa91332336a3203a03ee73d65f951238ed9348405
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
House

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : House.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 "./interfaces/IHouse.sol";
import "./interfaces/IHabitat.sol";
import "./interfaces/IHouseTraits.sol";
import "./interfaces/IRandomizer.sol";

contract House is IHouse, ERC721Enumerable, Ownable, Pausable {

    struct LastWrite {
        uint64 time;
        uint64 blockNum;
    }

    event TokenMinted(address indexed owner, uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event TestTokenMinted(address indexed owner, uint256 indexed tokenId);

    event ShackMinted(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event RanchMinted(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event MansionMinted(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);

    event ShackStolen(address indexed owner, address indexed previous, uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event RanchStolen(address indexed owner, address  indexed previous, uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event MansionStolen(address indexed owner, address  indexed previous, uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);

    event ShackBurned(uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event RanchBurned(uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event MansionBurned(uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);

    event ShackStaked(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event RanchStaked(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event MansionStaked(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);

    event ShackUnStaked(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event RanchUnStaked(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);
    event MansionUnStaked(address indexed owner,uint256 indexed tokenId, uint256 blockNum, uint256 timeStamp);

    // max number of tokens that can be minted: 10,000 in production
    uint256 public maxTokens;

    // number of tokens have been minted so far
    uint16 public override minted;

    // mapping tokenId => token's traits
    mapping(uint256 => HouseStruct) private tokenTraits;

    // mapping from hashed(tokenTrait) to the tokenId it's associated with
    // used to ensure there are no duplicates
    mapping(uint256 => uint256) public existingCombinations;

    // Tracks the last block and timestamp that a caller has written to state.
    // Disallow some access to functions if they occur while a change is being written.
    mapping(address => LastWrite) private lastWriteAddress;
    mapping(uint256 => LastWrite) private lastWriteToken;


    // list of probabilities for each trait type
    // 0 is associated with Shack, 1 is associated with Ranch, 2 is associated with Mansion
    uint8[][3] public rarities;


    // list of aliases for Walker's Alias algorithm
    // 0 is associated with Shack, 1 is associated with Ranch, 2 is associated with Mansion
    uint8[][3] public aliases;

    // reference to the Habitat contract to allow transfers to it without any approval
    IHabitat public habitat;
    // reference to House Traits
    IHouseTraits public houseTraits;
    // reference to Randomizer
    IRandomizer public randomizer;
    

    // mapping address => allowedToCallFunctions
    mapping(address => bool) private admins;


    constructor(uint256 _maxTokens) ERC721("HouseNFT", "House") {
        maxTokens = _maxTokens;
        _pause();


        // A.J. Walker's Alias Algorithm


        // Shack

        // body
        rarities[0] = [80];
        aliases[0] = [0];



        // Ranch

        // body
        rarities[1] = [100];
        aliases[1] = [0];





        // Mansion
        rarities[2] = [100];
        aliases[2] = [0];
    }


    /** CRITICAL TO SETUP / MODIFIERS */

    modifier requireContractsSet() {
        require(address(houseTraits) != address(0) && address(habitat) != address(0) && address(randomizer) != address(0), "Contracts not set");
        _;
    }

    modifier blockIfChangingAddress() {
        // frens can always call whenever they want :)
        require(admins[_msgSender()] || lastWriteAddress[tx.origin].blockNum < block.number, "hmmmm what doing?");
        _;
    }

    modifier blockIfChangingToken(uint256 tokenId) {
        // frens can always call whenever they want :)
        require(admins[_msgSender()] || lastWriteToken[tokenId].blockNum < block.number, "hmmmm what doing?");
        _;
    }

    function setContracts(address _houseTraits, address _habitat, address _rand) external onlyOwner {
        houseTraits = IHouseTraits(_houseTraits);
        habitat = IHabitat(_habitat);
        randomizer = IRandomizer(_rand);
    }

    function getTokenWriteBlock(uint256 tokenId) external view override returns(uint64) {
        require(admins[_msgSender()], "Only admins can call this");
        return lastWriteToken[tokenId].blockNum;
    }


    /** 
    * Mint a token - any payment / game logic should be handled in the game contract. 
    * This will just generate random traits and mint a token to a designated address.
    */
    function mint(address recipient, uint256 seed) external override whenNotPaused {
        require(admins[_msgSender()], "Only admins can call this");
        require(minted + 1 <= maxTokens, "All tokens minted");
        minted++;
        generate(recipient, minted, seed);
        if(tx.origin != recipient && recipient != address(habitat)) {
            // Stolen!
            if(tokenTraits[minted].roll == 0) {
                emit ShackStolen(recipient, tx.origin, minted, block.number, block.timestamp);
            } else if(tokenTraits[minted].roll == 1) {
                emit RanchStolen(recipient, tx.origin, minted, block.number, block.timestamp);
            } else {
                emit MansionStolen(recipient, tx.origin, minted, block.number, block.timestamp);
            }
        }
        _safeMint(recipient, minted);
    }

     /**
    * generates traits for a specific token, checking to make sure it's unique
    * @param tokenId the id of the token to generate traits for
    * @param seed a pseudorandom 256 bit number to derive traits from
    * @return t - a struct of traits for the given token ID
    */
    function generate(address recipient, uint256 tokenId, uint256 seed) public returns (HouseStruct memory t) {
        t = selectTraits(seed);
        tokenTraits[tokenId] = t;
        emit TokenMinted(recipient, tokenId, block.number, block.timestamp);
        emit TestTokenMinted(recipient, tokenId);
        if(t.roll == 0) {
            emit ShackMinted(recipient, tokenId, block.number, block.timestamp);
        } else if(t.roll == 1) {
            emit RanchMinted(recipient, tokenId, block.number, block.timestamp);
        } else {
            emit MansionMinted(recipient, tokenId, block.number, block.timestamp);
        }
        return t;
    }

    /**
    * selects the species and all of its traits based on the seed value
    * @param seed a pseudorandom 256 bit number to derive traits from
    * @return t -  a struct of randomly selected traits
    */
    function selectTraits(uint256 seed) internal view returns (HouseStruct memory t) {    
        // Shack & Ranch & Mansion percet is 70% & 25% & 5%

        if (uint16(seed & 0xFFFF) % 100 < 5) {
            t.roll = 2;
        } else if(uint16(seed & 0xFFFF) % 100 < 30) {
            t.roll = 1;
        } else {
            t.roll = 0;
        }

        uint8 shift = 0;
        if (t.roll == 0) {
            shift = 0;
        } else if (t.roll == 1) {
            shift = 1;
        } else {
            shift = 2;
        }
        seed >>= 16;
        t.body = selectTrait(uint16(seed & 0xFFFF), 0 + shift);

    }

    /**
    * uses A.J. Walker's Alias algorithm for O(1) rarity table lookup
    * ensuring O(1) instead of O(n) reduces mint cost by more than 50%
    * probability & alias tables are generated off-chain beforehand
    * @param seed portion of the 256 bit seed to remove trait correlation
    * @param traitType the trait type to select a trait for 
    * @return the ID of the randomly selected trait
    */
    function selectTrait(uint16 seed, uint8 traitType) internal view returns (uint8) {
        uint8 trait = uint8(seed) % uint8(rarities[traitType].length);
        return aliases[traitType][trait];
    }


    /**
    * converts a struct to a 256 bit hash to check for uniqueness
    * @param s the struct to pack into a hash
    * @return the 256 bit hash of the struct
    */
    function structToHash(HouseStruct memory s) internal pure returns (uint256) {
        return uint256(keccak256(
            abi.encodePacked(
                s.roll,
                s.body)
        ));
    }

    /** 
    * Burn a token - any game logic should be handled before this function.
    */
    function burn(uint256 tokenId) external override whenNotPaused {
        require(admins[_msgSender()], "Only admins can call this");
        _burn(tokenId);
        minted -= 1;
        if(tokenTraits[tokenId].roll == 2) {
            emit MansionBurned(tokenId, block.number, block.timestamp);
        } else if (tokenTraits[tokenId].roll == 1) {
            emit RanchBurned(tokenId, block.number, block.timestamp);
        } else {
            emit ShackBurned(tokenId, block.number, block.timestamp);
        }
    }



    function updateOriginAccess(uint16[] memory tokenIds) external override {
        require(admins[_msgSender()], "Only admins can call this");
        uint64 blockNum = uint64(block.number);
        uint64 time = uint64(block.timestamp);
        lastWriteAddress[tx.origin] = LastWrite(time, blockNum);
        for (uint256 i = 0; i < tokenIds.length; i++) {
            lastWriteToken[tokenIds[i]] = LastWrite(time, blockNum);
        }
    }


    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override(ERC721, IERC721) blockIfChangingToken(tokenId) {
        // allow admin contracts to be send without approval
        if(!admins[_msgSender()]) {
            require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        }
        _transfer(from, to, tokenId);
    }


    /**
    * checks if a token is a Shack
    * @param tokenId the ID of the token to check
    * @return bool - whether or not a token is a Shack
    */
    function isShack(uint256 tokenId) external view override blockIfChangingToken(tokenId) returns (bool) {
        // Sneaky cats will be slain if they try to peep this after mint. Nice try.
        IHouse.HouseStruct memory s = tokenTraits[tokenId];
        return s.roll == 0;
    }


    /**
    * checks if a token is a Ranch
    * @param tokenId the ID of the token to check
    * @return bool - whether or not a token is a Ranch
    */
    function isRanch(uint256 tokenId) external view override blockIfChangingToken(tokenId) returns (bool) {
        // Sneaky cats will be slain if they try to peep this after mint. Nice try.
        IHouse.HouseStruct memory s = tokenTraits[tokenId];
        return s.roll == 1;
    }


    /**
    * checks if a token is a Mansion
    * @param tokenId the ID of the token to check
    * @return bool - whether or not a token is a Mansion
    */
    function isMansion(uint256 tokenId) external view override blockIfChangingToken(tokenId) returns (bool) {
        // Sneaky cats will be slain if they try to peep this after mint. Nice try.
        IHouse.HouseStruct memory s = tokenTraits[tokenId];
        return s.roll == 2;
    }


    function getMaxTokens() external view override returns (uint256) {
        return maxTokens;
    }


    /** ADMIN */


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

    /**
    * enables an address to mint / burn
    * @param addr the address to enable
    */
    function addAdmin(address addr) external onlyOwner {
        admins[addr] = true;
    }


    /**
    * disables an address from minting / burning
    * @param addr the address to disbale
    */
    function removeAdmin(address addr) external onlyOwner {
        admins[addr] = false;
    }

    /** Traits */

    function getTokenTraits(uint256 tokenId) external view override blockIfChangingAddress blockIfChangingToken(tokenId) returns (HouseStruct memory) {
        return tokenTraits[tokenId];
    }

    function tokenURI(uint256 tokenId) public view override blockIfChangingAddress blockIfChangingToken(tokenId) returns (string memory) {
        require(_exists(tokenId), "Token ID does not exist");
        return houseTraits.tokenURI(tokenId);
    }



    /** OVERRIDES FOR SAFETY */

    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override(ERC721Enumerable, IERC721Enumerable) blockIfChangingAddress returns (uint256) {
        // Y U checking on this address in the same block it's being modified... hmmmm
        require(admins[_msgSender()] || lastWriteAddress[owner].blockNum < block.number, "hmmmm what doing?");
        uint256 tokenId = super.tokenOfOwnerByIndex(owner, index);
        require(admins[_msgSender()] || lastWriteToken[tokenId].blockNum < block.number, "hmmmm what doing?");
        return tokenId;
    }


    function balanceOf(address owner) public view virtual override(ERC721, IERC721) blockIfChangingAddress returns (uint256) {
        // Y U checking on this address in the same block it's being modified... hmmmm
        require(admins[_msgSender()] || lastWriteAddress[owner].blockNum < block.number, "hmmmm what doing?");
        return super.balanceOf(owner);
    }


    function ownerOf(uint256 tokenId) public view virtual override(ERC721, IERC721) blockIfChangingAddress blockIfChangingToken(tokenId) returns (address) {
        address addr = super.ownerOf(tokenId);
        // Y U checking on this address in the same block it's being modified... hmmmm
        require(admins[_msgSender()] || lastWriteAddress[addr].blockNum < block.number, "hmmmm what doing?");
        return addr;
    }


    function tokenByIndex(uint256 index) public view virtual override(ERC721Enumerable, IERC721Enumerable) returns (uint256) {
        uint256 tokenId = super.tokenByIndex(index);
        // NICE TRY TOAD DRAGON
        require(admins[_msgSender()] || lastWriteToken[tokenId].blockNum < block.number, "hmmmm what doing?");
        return tokenId;
    }

    function approve(address to, uint256 tokenId) public virtual override(ERC721, IERC721) blockIfChangingToken(tokenId) {
        super.approve(to, tokenId);
    }

    function getApproved(uint256 tokenId) public view virtual override(ERC721, IERC721) blockIfChangingToken(tokenId) returns (address) {
        return super.getApproved(tokenId);
    }

    function setApprovalForAll(address operator, bool approved) public virtual override(ERC721, IERC721) blockIfChangingAddress {
        super.setApprovalForAll(operator, approved);
    }

    function isApprovedForAll(address owner, address operator) public view virtual override(ERC721, IERC721) blockIfChangingAddress returns (bool) {
        return super.isApprovedForAll(owner, operator);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override(ERC721, IERC721) blockIfChangingToken(tokenId) {
        super.safeTransferFrom(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override(ERC721, IERC721) blockIfChangingToken(tokenId) {
        super.safeTransferFrom(from, to, tokenId, _data);
    }

    //----------friedrich-----------
    /**
    * Event
    * @param tokenId the ID of the token stacked
    */
    function emitShackStakedEvent(address owner, uint256 tokenId) external override whenNotPaused {
        emit ShackStaked(owner, tokenId, block.number, block.timestamp);
    }
    
    /**
    * Event
    * @param tokenId the ID of the token stacked
    */
    function emitRanchStakedEvent(address owner, uint256 tokenId) external override whenNotPaused {
        emit RanchStaked(owner, tokenId, block.number, block.timestamp);
    }
  
    /**
    * Event
    * @param tokenId the ID of the token stacked
    */
    function emitMansionStakedEvent(address owner, uint256 tokenId) external override whenNotPaused {
        emit MansionStaked(owner, tokenId, block.number, block.timestamp);
    }

    /**
    * Event
    * @param tokenId the ID of the token stacked
    */
    function emitShackUnStakedEvent(address owner, uint256 tokenId) external override whenNotPaused {
        emit ShackUnStaked(owner, tokenId, block.number, block.timestamp);
    }
    
    /**
    * Event
    * @param tokenId the ID of the token stacked
    */
    function emitRanchUnStakedEvent(address owner, uint256 tokenId) external override whenNotPaused {
        emit RanchUnStaked(owner, tokenId, block.number, block.timestamp);
    }
  
    /**
    * Event
    * @param tokenId the ID of the token stacked
    */
    function emitMansionUnStakedEvent(address owner, uint256 tokenId) external override whenNotPaused {
        emit MansionUnStaked(owner, tokenId, block.number, block.timestamp);
    }
}

File 2 of 18 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 3 of 18 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/Pausable.sol)

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 18 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Enumerable.sol)

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 18 : IHouse.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

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

interface IHouse is IERC721Enumerable {
    
    // House NFT struct
    struct HouseStruct {
        uint8 roll; //0 - Shack, 1 - Ranch, 2 - Mansion
        uint8 body;
    }

    function getTokenWriteBlock(uint256 tokenId) external view returns(uint64);
    function mint(address recipient, uint256 seed) external;
    function burn(uint256 tokenId) external;
    function updateOriginAccess(uint16[] memory tokenIds) external;
    function isShack(uint256 tokenId) external view returns(bool);
    function isRanch(uint256 tokenId) external view returns(bool);
    function isMansion(uint256 tokenId) external view returns(bool);
    function getMaxTokens() external view returns (uint256);
    function getTokenTraits(uint256 tokenId) external view returns (HouseStruct memory);
    function minted() external view returns (uint16);

    function emitShackStakedEvent(address owner, uint256 tokenId) external;
    function emitRanchStakedEvent(address owner, uint256 tokenId) external;
    function emitMansionStakedEvent(address owner, uint256 tokenId) external;

    function emitShackUnStakedEvent(address owner, uint256 tokenId) external;
    function emitRanchUnStakedEvent(address owner, uint256 tokenId) external;
    function emitMansionUnStakedEvent(address owner, uint256 tokenId) external;

}

File 6 of 18 : IHabitat.sol
// SPDX-License-Identifier: MIT LICENSE 

pragma solidity ^0.8.0;

interface IHabitat {
  function addManyToStakingPool(address account, uint16[] calldata tokenIds) external;
  function addManyHouseToStakingPool(address account, uint16[] calldata tokenIds) external;
  function randomCatOwner(uint256 seed) external view returns (address);
  function randomCrazyCatOwner(uint256 seed) external view returns (address);
  function isOwner(uint256 tokenId, address owner) external view returns (bool);
}

File 7 of 18 : IHouseTraits.sol
// SPDX-License-Identifier: MIT LICENSE 

pragma solidity ^0.8.0;

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

File 8 of 18 : IRandomizer.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

interface IRandomizer {
    function commitId() external view returns (uint16);
    function getCommitRandom(uint16 id) external view returns (uint256);
    function random() external returns (uint256);
    function sRandom(uint256 tokenId) external returns (uint256);
}

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

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

File 10 of 18 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)

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 {
        _setApprovalForAll(_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 Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @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 11 of 18 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Enumerable.sol)

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 12 of 18 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)

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 13 of 18 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol)

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 14 of 18 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol)

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 15 of 18 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 16 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)

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 17 of 18 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)

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 18 of 18 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)

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"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_maxTokens","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"MansionBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"MansionMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"MansionStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"previous","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"MansionStolen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"MansionUnStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"RanchBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"RanchMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"RanchStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"previous","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"RanchStolen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"RanchUnStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"ShackBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"ShackMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"ShackStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"previous","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"ShackStolen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"ShackUnStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TestTokenMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeStamp","type":"uint256"}],"name":"TokenMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"aliases","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"emitMansionStakedEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"emitMansionUnStakedEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"emitRanchStakedEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"emitRanchUnStakedEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"emitShackStakedEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"emitShackUnStakedEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"existingCombinations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"seed","type":"uint256"}],"name":"generate","outputs":[{"components":[{"internalType":"uint8","name":"roll","type":"uint8"},{"internalType":"uint8","name":"body","type":"uint8"}],"internalType":"struct IHouse.HouseStruct","name":"t","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenTraits","outputs":[{"components":[{"internalType":"uint8","name":"roll","type":"uint8"},{"internalType":"uint8","name":"body","type":"uint8"}],"internalType":"struct IHouse.HouseStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenWriteBlock","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"habitat","outputs":[{"internalType":"contract IHabitat","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"houseTraits","outputs":[{"internalType":"contract IHouseTraits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isMansion","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isRanch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isShack","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"seed","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minted","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomizer","outputs":[{"internalType":"contract IRandomizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rarities","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_houseTraits","type":"address"},{"internalType":"address","name":"_habitat","type":"address"},{"internalType":"address","name":"_rand","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"updateOriginAccess","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162003c7538038062003c758339810160408190526200003491620003e8565b6040805180820182526008815267121bdd5cd953919560c21b602080830191825283518085019094526005845264486f75736560d81b90840152815191929162000081916000916200029f565b508051620000979060019060208401906200029f565b505050620000b4620000ae6200019760201b60201c565b6200019b565b600a805460ff60a01b19169055600b819055620000d0620001ed565b604080516020810190915260508152620000ef9060119060016200032e565b506040805160208101909152600081526200010f9060149060016200032e565b506040805160208101909152606481526200012f9060129060016200032e565b506040805160208101909152600081526200014f9060159060016200032e565b506040805160208101909152606481526200016f9060139060016200032e565b506040805160208101909152600081526200018f9060169060016200032e565b50506200043e565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000201600a54600160a01b900460ff1690565b15620002465760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640160405180910390fd5b600a805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620002823390565b6040516001600160a01b03909116815260200160405180910390a1565b828054620002ad9062000401565b90600052602060002090601f016020900481019282620002d157600085556200031c565b82601f10620002ec57805160ff19168380011785556200031c565b828001600101855582156200031c579182015b828111156200031c578251825591602001919060010190620002ff565b506200032a929150620003d1565b5090565b82805482825590600052602060002090601f016020900481019282156200031c5791602002820160005b838211156200039857835183826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030262000358565b8015620003c75782816101000a81549060ff021916905560010160208160000104928301926001030262000398565b50506200032a9291505b5b808211156200032a5760008155600101620003d2565b600060208284031215620003fa578081fd5b5051919050565b600181811c908216806200041657607f821691505b602082108114156200043857634e487b7160e01b600052602260045260246000fd5b50919050565b613827806200044e6000396000f3fe608060405234801561001057600080fd5b50600436106102a05760003560e01c80636abcded111610167578063b3066d49116100ce578063e831574211610087578063e83157421461061d578063e86eadcd14610626578063e985e9c514610639578063ebd173681461064c578063f10fb58414610677578063f2fde38b1461068a57600080fd5b8063b3066d49146105ab578063b88d4fde146105be578063bc94b39c146105d1578063c87b56dd146105e4578063dd9c2ca1146105f7578063e3812bec1461060a57600080fd5b80638da5cb5b116101205780638da5cb5b1461051857806394e568471461052957806395d89b411461055d5780639cdd6f8f14610565578063a1b8f37414610578578063a22cb4651461059857600080fd5b80636abcded1146104bc57806370480275146104c457806370a08231146104d7578063715018a6146104ea578063816de0e5146104f2578063869bed0f1461050557600080fd5b80632f745c591161020b57806342966c68116101c457806342966c681461043d5780634c606793146104505780634f02c420146104635780634f6ccce7146104845780635c975abb146104975780636352211e146104a957600080fd5b80632f745c59146103b957806333df4b2c146103cc57806335ca838b146103f1578063368383911461040457806340c10f191461041757806342842e0e1461042a57600080fd5b806316c38b3c1161025d57806316c38b3c146103485780631785f53c1461035b57806318160ddd1461036e5780631f4382a61461038057806323b872dd14610393578063260c8f6d146103a657600080fd5b806301ffc9a7146102a55780630265c858146102cd57806302c2a4a3146102e257806306fdde03146102f5578063081812fc1461030a578063095ea7b314610335575b600080fd5b6102b86102b3366004613301565b61069d565b60405190151581526020015b60405180910390f35b6102e06102db3660046131d3565b6106c8565b005b6102e06102f03660046131d3565b610745565b6102fd6107b1565b6040516102c4919061344d565b61031d6103183660046133ab565b610843565b6040516001600160a01b0390911681526020016102c4565b6102e06103433660046131d3565b6108af565b6102e06103563660046132e7565b610918565b6102e061036936600461303f565b6109d5565b6008545b6040519081526020016102c4565b6102b861038e3660046133ab565b610a20565b6102e06103a13660046130cd565b610ab4565b6102e06103b43660046131d3565b610b5d565b6103726103c73660046131d3565b610bc9565b6103df6103da3660046133c3565b610cf2565b60405160ff90911681526020016102c4565b6102e06103ff36600461322e565b610d38565b6103df6104123660046133c3565b610e78565b6102e06104253660046131d3565b610e88565b6102e06104383660046130cd565b6110ee565b6102e061044b3660046133ab565b611153565b6102b861045e3660046133ab565b6112d4565b600c546104719061ffff1681565b60405161ffff90911681526020016102c4565b6103726104923660046133ab565b611366565b600a54600160a01b900460ff166102b8565b61031d6104b73660046133ab565b6113cd565b600b54610372565b6102e06104d236600461303f565b6114f0565b6103726104e536600461303f565b61153e565b6102e0611607565b60185461031d906001600160a01b031681565b6102e06105133660046131d3565b61163d565b600a546001600160a01b031661031d565b61053c6105373660046133ab565b6116a9565b60408051825160ff90811682526020938401511692810192909252016102c4565b6102fd6117a0565b6102e06105733660046131d3565b6117af565b6103726105863660046133ab565b600e6020526000908152604090205481565b6102e06105a63660046131aa565b61181b565b6102e06105b936600461308b565b61187e565b6102e06105cc366004613108565b6118e7565b61053c6105df3660046131fc565b611954565b6102fd6105f23660046133ab565b611b1d565b6102e06106053660046131d3565b611cb7565b6102b86106183660046133ab565b611d23565b610372600b5481565b60175461031d906001600160a01b031681565b6102b8610647366004613059565b611db7565b61065f61065a3660046133ab565b611e3e565b6040516001600160401b0390911681526020016102c4565b60195461031d906001600160a01b031681565b6102e061069836600461303f565b611e90565b60006001600160e01b0319821663780e9d6360e01b14806106c257506106c282611f28565b92915050565b600a54600160a01b900460ff16156106fb5760405162461bcd60e51b81526004016106f290613514565b60405180910390fd5b6040805143815242602082015282916001600160a01b038516917fc84d84e11b0f46c488c24d907151ab65af2df2a4f749d7993fed3899a987245c91015b60405180910390a35050565b600a54600160a01b900460ff161561076f5760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917fdb6025d7a6b281c8b55b3bb621d84cf33e24d0faef12b466fe8905c59fa841169101610739565b6060600080546107c0906136e4565b80601f01602080910402602001604051908101604052809291908181526020018280546107ec906136e4565b80156108395780601f1061080e57610100808354040283529160200191610839565b820191906000526020600020905b81548152906001019060200180831161081c57829003601f168201915b5050505050905090565b336000908152601a6020526040812054829060ff1680610881575060008181526010602052604090205443600160401b9091046001600160401b0316105b61089d5760405162461bcd60e51b81526004016106f2906134e9565b6108a683611f78565b91505b50919050565b336000908152601a6020526040902054819060ff16806108ed575060008181526010602052604090205443600160401b9091046001600160401b0316105b6109095760405162461bcd60e51b81526004016106f2906134e9565b610913838361200d565b505050565b6018546001600160a01b03161580159061093c57506017546001600160a01b031615155b801561095257506019546001600160a01b031615155b6109925760405162461bcd60e51b815260206004820152601160248201527010dbdb9d1c9858dd1cc81b9bdd081cd95d607a1b60448201526064016106f2565b600a546001600160a01b031633146109bc5760405162461bcd60e51b81526004016106f29061353e565b80156109cd576109ca61211e565b50565b6109ca6121a0565b600a546001600160a01b031633146109ff5760405162461bcd60e51b81526004016106f29061353e565b6001600160a01b03166000908152601a60205260409020805460ff19169055565b336000908152601a6020526040812054829060ff1680610a5e575060008181526010602052604090205443600160401b9091046001600160401b0316105b610a7a5760405162461bcd60e51b81526004016106f2906134e9565b50506000908152600d602090815260409182902082518084019093525460ff80821680855261010090920416929091019190915260011490565b336000908152601a6020526040902054819060ff1680610af2575060008181526010602052604090205443600160401b9091046001600160401b0316105b610b0e5760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a602052604090205460ff16610b4c57610b30335b83612224565b610b4c5760405162461bcd60e51b81526004016106f290613573565b610b578484846122fb565b50505050565b600a54600160a01b900460ff1615610b875760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917f2253d01cda42192b9d26e57cdf9d4232d69d07577f3d9d1de814d974399d15ff9101610739565b336000908152601a602052604081205460ff1680610c065750326000908152600f602052604090205443600160401b9091046001600160401b0316105b610c225760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a602052604090205460ff1680610c6857506001600160a01b0383166000908152600f602052604090205443600160401b9091046001600160401b0316105b610c845760405162461bcd60e51b81526004016106f2906134e9565b6000610c9084846124a6565b336000908152601a602052604090205490915060ff1680610ccf575060008181526010602052604090205443600160401b9091046001600160401b0316105b610ceb5760405162461bcd60e51b81526004016106f2906134e9565b9392505050565b60118260038110610d0257600080fd5b018181548110610d1157600080fd5b9060005260206000209060209182820401919006915091509054906101000a900460ff1681565b336000908152601a602052604090205460ff16610d675760405162461bcd60e51b81526004016106f2906134b2565b6040805180820182526001600160401b03428181168352438281166020808601918252326000908152600f9091529586209451855491518516600160401b026001600160801b031990921694169390931792909217909255915b8351811015610b57576040518060400160405280836001600160401b03168152602001846001600160401b031681525060106000868481518110610e1557634e487b7160e01b600052603260045260246000fd5b60209081029190910181015161ffff168252818101929092526040016000208251815493909201516001600160401b03908116600160401b026001600160801b031990941692169190911791909117905580610e708161373b565b915050610dc1565b60148260038110610d0257600080fd5b600a54600160a01b900460ff1615610eb25760405162461bcd60e51b81526004016106f290613514565b336000908152601a602052604090205460ff16610ee15760405162461bcd60e51b81526004016106f2906134b2565b600b54600c54610ef69061ffff16600161361b565b61ffff161115610f3c5760405162461bcd60e51b8152602060048201526011602482015270105b1b081d1bdad95b9cc81b5a5b9d1959607a1b60448201526064016106f2565b600c805461ffff16906000610f5083613719565b82546101009290920a61ffff818102199093169183160217909155600c54610f7c925084911683611954565b50326001600160a01b03831614801590610fa457506017546001600160a01b03838116911614155b156110d857600c5461ffff166000908152600d602052604090205460ff1661101b57600c546040805143815242602082015261ffff9092169132916001600160a01b038616917f5d52cb63ca14a343fa9ebfbe24ac6be8e9603934a0f5b5fbf69e8b2c1e671d4891015b60405180910390a46110d8565b600c5461ffff166000908152600d602052604090205460ff166001141561108857600c546040805143815242602082015261ffff9092169132916001600160a01b038616917f7e2df746a08d4297a5a58d487b7424cb442fd65ecf7e83c81882f42abaa2a9b6910161100e565b600c546040805143815242602082015261ffff9092169132916001600160a01b038616917f7c9d1f0366db2fb03653384d4821349458e280af01a4403185103d2436a8bc83910160405180910390a45b600c546110ea90839061ffff1661253c565b5050565b336000908152601a6020526040902054819060ff168061112c575060008181526010602052604090205443600160401b9091046001600160401b0316105b6111485760405162461bcd60e51b81526004016106f2906134e9565b610b57848484612556565b600a54600160a01b900460ff161561117d5760405162461bcd60e51b81526004016106f290613514565b336000908152601a602052604090205460ff166111ac5760405162461bcd60e51b81526004016106f2906134b2565b6111b581612571565b600c8054600191906000906111cf90849061ffff1661367e565b82546101009290920a61ffff818102199093169190921691909102179055506000818152600d602052604090205460ff1660021415611246576040805143815242602082015282917fe75022bbc5e1b59754b85df351c77e1a7ef69e9995b7e3f00e9ed89130e3e97991015b60405180910390a250565b6000818152600d602052604090205460ff1660011415611297576040805143815242602082015282917f6c91916f0c14df8742efd4425acfce7677d8ec04a75dce844e1ab48be607537b910161123b565b6040805143815242602082015282917fa9772db06160923c793633014caf9fffa5f1bd91d8fccb2441cf58692f9f748c910160405180910390a250565b336000908152601a6020526040812054829060ff1680611312575060008181526010602052604090205443600160401b9091046001600160401b0316105b61132e5760405162461bcd60e51b81526004016106f2906134e9565b50506000908152600d602090815260409182902082518084019093525460ff8082168085526101009092041692909101919091521590565b60008061137283612618565b336000908152601a602052604090205490915060ff16806113b1575060008181526010602052604090205443600160401b9091046001600160401b0316105b6106c25760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a602052604081205460ff168061140a5750326000908152600f602052604090205443600160401b9091046001600160401b0316105b6114265760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a6020526040902054829060ff1680611464575060008181526010602052604090205443600160401b9091046001600160401b0316105b6114805760405162461bcd60e51b81526004016106f2906134e9565b600061148b846126b9565b336000908152601a602052604090205490915060ff16806114d457506001600160a01b0381166000908152600f602052604090205443600160401b9091046001600160401b0316105b6108a65760405162461bcd60e51b81526004016106f2906134e9565b600a546001600160a01b0316331461151a5760405162461bcd60e51b81526004016106f29061353e565b6001600160a01b03166000908152601a60205260409020805460ff19166001179055565b336000908152601a602052604081205460ff168061157b5750326000908152600f602052604090205443600160401b9091046001600160401b0316105b6115975760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a602052604090205460ff16806115dd57506001600160a01b0382166000908152600f602052604090205443600160401b9091046001600160401b0316105b6115f95760405162461bcd60e51b81526004016106f2906134e9565b6106c282612730565b919050565b600a546001600160a01b031633146116315760405162461bcd60e51b81526004016106f29061353e565b61163b60006127b7565b565b600a54600160a01b900460ff16156116675760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917f8384271e3779637512a0cabf7f837bd1c34a34878b8db348fcaa2677c9f392b79101610739565b60408051808201825260008082526020808301829052338252601a9052919091205460ff16806116f85750326000908152600f602052604090205443600160401b9091046001600160401b0316105b6117145760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a6020526040902054829060ff1680611752575060008181526010602052604090205443600160401b9091046001600160401b0316105b61176e5760405162461bcd60e51b81526004016106f2906134e9565b50506000908152600d602090815260409182902082518084019093525460ff8082168452610100909104169082015290565b6060600180546107c0906136e4565b600a54600160a01b900460ff16156117d95760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917fc1528a0621c9c4634c9fca5b9c28a7cef95dd48e5200f975c9968bded7d4eb209101610739565b336000908152601a602052604090205460ff16806118585750326000908152600f602052604090205443600160401b9091046001600160401b0316105b6118745760405162461bcd60e51b81526004016106f2906134e9565b6110ea8282612809565b600a546001600160a01b031633146118a85760405162461bcd60e51b81526004016106f29061353e565b601880546001600160a01b039485166001600160a01b031991821617909155601780549385169382169390931790925560198054919093169116179055565b336000908152601a6020526040902054829060ff1680611925575060008181526010602052604090205443600160401b9091046001600160401b0316105b6119415760405162461bcd60e51b81526004016106f2906134e9565b61194d85858585612814565b5050505050565b604080518082019091526000808252602082015261197182612845565b6000848152600d6020908152604091829020835181549285015160ff9081166101000261ffff199094169116179190911790555190915083906001600160a01b038616907f10546b1a6f5245ff0ffa18c256b9e46859c585cbb473b453fcd4c2dc39ae08db906119ed9043904290918252602082015260400190565b60405180910390a360405183906001600160a01b038616907f1d04698a6dbf374136f42777ac79734bb996c66d2a6fca12e56889849a59fbb790600090a3805160ff16611a7f576040805143815242602082015284916001600160a01b038716917f3fdb8d245e09ba1d7a124d4c6bca0430bbc46260c1e47b07065791aa6f5ed46d91015b60405180910390a3610ceb565b806000015160ff1660011415611ad1576040805143815242602082015284916001600160a01b038716917f32f248d49a57ed8f822cf8f656e7dcec775a47262537ffa33e54d30eeac817c99101611a72565b6040805143815242602082015284916001600160a01b038716917fc0359f81f6e2dfa82d1ea82600c32f0038b9ece5c0d48c0bb47f62269a55891e910160405180910390a39392505050565b336000908152601a602052604090205460609060ff1680611b5d5750326000908152600f602052604090205443600160401b9091046001600160401b0316105b611b795760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a6020526040902054829060ff1680611bb7575060008181526010602052604090205443600160401b9091046001600160401b0316105b611bd35760405162461bcd60e51b81526004016106f2906134e9565b6000838152600260205260409020546001600160a01b0316611c375760405162461bcd60e51b815260206004820152601760248201527f546f6b656e20494420646f6573206e6f7420657869737400000000000000000060448201526064016106f2565b60185460405163c87b56dd60e01b8152600481018590526001600160a01b039091169063c87b56dd9060240160006040518083038186803b158015611c7b57600080fd5b505afa158015611c8f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108a69190810190613339565b600a54600160a01b900460ff1615611ce15760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917f375e17a794b39faec5f2754d77925c1ca241b108c0b4f68eade6bee2ce11b9ea9101610739565b336000908152601a6020526040812054829060ff1680611d61575060008181526010602052604090205443600160401b9091046001600160401b0316105b611d7d5760405162461bcd60e51b81526004016106f2906134e9565b50506000908152600d602090815260409182902082518084019093525460ff80821680855261010090920416929091019190915260021490565b336000908152601a602052604081205460ff1680611df45750326000908152600f602052604090205443600160401b9091046001600160401b0316105b611e105760405162461bcd60e51b81526004016106f2906134e9565b6001600160a01b0380841660009081526005602090815260408083209386168352929052205460ff16610ceb565b336000908152601a602052604081205460ff16611e6d5760405162461bcd60e51b81526004016106f2906134b2565b50600090815260106020526040902054600160401b90046001600160401b031690565b600a546001600160a01b03163314611eba5760405162461bcd60e51b81526004016106f29061353e565b6001600160a01b038116611f1f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106f2565b6109ca816127b7565b60006001600160e01b031982166380ac58cd60e01b1480611f5957506001600160e01b03198216635b5e139f60e01b145b806106c257506301ffc9a760e01b6001600160e01b03198316146106c2565b6000818152600260205260408120546001600160a01b0316611ff15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106f2565b506000908152600460205260409020546001600160a01b031690565b6000612018826126b9565b9050806001600160a01b0316836001600160a01b031614156120865760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016106f2565b336001600160a01b03821614806120a257506120a28133611db7565b6121145760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016106f2565b6109138383612903565b600a54600160a01b900460ff16156121485760405162461bcd60e51b81526004016106f290613514565b600a805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121833390565b6040516001600160a01b03909116815260200160405180910390a1565b600a54600160a01b900460ff166121f05760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106f2565b600a805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612183565b6000818152600260205260408120546001600160a01b031661229d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106f2565b60006122a8836126b9565b9050806001600160a01b0316846001600160a01b031614806122e35750836001600160a01b03166122d884610843565b6001600160a01b0316145b806122f357506122f38185611db7565b949350505050565b826001600160a01b031661230e826126b9565b6001600160a01b0316146123765760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016106f2565b6001600160a01b0382166123d85760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016106f2565b6123e3838383612971565b6123ee600082612903565b6001600160a01b03831660009081526003602052604081208054600192906124179084906136a1565b90915550506001600160a01b0382166000908152600360205260408120805460019290612445908490613641565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006124b183612730565b82106125135760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016106f2565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6110ea828260405180602001604052806000815250612a29565b610913838383604051806020016040528060008152506118e7565b600061257c826126b9565b905061258a81600084612971565b612595600083612903565b6001600160a01b03811660009081526003602052604081208054600192906125be9084906136a1565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600061262360085490565b82106126865760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016106f2565b600882815481106126a757634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806106c25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016106f2565b60006001600160a01b03821661279b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016106f2565b506001600160a01b031660009081526003602052604090205490565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6110ea338383612a5c565b61281d33610b2a565b6128395760405162461bcd60e51b81526004016106f290613573565b610b5784848484612b2b565b6040805180820190915260008082526020820152600561286a606461ffff8516613756565b61ffff16101561287d57600281526128a6565b601e61288e606461ffff8516613756565b61ffff1610156128a157600181526128a6565b600081525b805160009060ff166128ba575060006128d6565b816000015160ff16600114156128d2575060016128d6565b5060025b60109290921c916128f561ffff84166128f0836000613659565b612b5e565b60ff16602083015250919050565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612938826126b9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6001600160a01b0383166129cc576129c781600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6129ef565b816001600160a01b0316836001600160a01b0316146129ef576129ef8382612c03565b6001600160a01b038216612a065761091381612ca0565b826001600160a01b0316826001600160a01b031614610913576109138282612d79565b612a338383612dbd565b612a406000848484612f0b565b6109135760405162461bcd60e51b81526004016106f290613460565b816001600160a01b0316836001600160a01b03161415612abe5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016106f2565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612b368484846122fb565b612b4284848484612f0b565b610b575760405162461bcd60e51b81526004016106f290613460565b60008060118360ff1660038110612b8557634e487b7160e01b600052603260045260246000fd5b0154612b919085613777565b905060148360ff1660038110612bb757634e487b7160e01b600052603260045260246000fd5b018160ff1681548110612bda57634e487b7160e01b600052603260045260246000fd5b90600052602060002090602091828204019190069054906101000a900460ff1691505092915050565b60006001612c1084612730565b612c1a91906136a1565b600083815260076020526040902054909150808214612c6d576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612cb2906001906136a1565b60008381526009602052604081205460088054939450909284908110612ce857634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110612d1757634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612d5d57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612d8483612730565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216612e135760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016106f2565b6000818152600260205260409020546001600160a01b031615612e785760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016106f2565b612e8460008383612971565b6001600160a01b0382166000908152600360205260408120805460019290612ead908490613641565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b1561300d57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612f4f903390899088908890600401613410565b602060405180830381600087803b158015612f6957600080fd5b505af1925050508015612f99575060408051601f3d908101601f19168201909252612f969181019061331d565b60015b612ff3573d808015612fc7576040519150601f19603f3d011682016040523d82523d6000602084013e612fcc565b606091505b508051612feb5760405162461bcd60e51b81526004016106f290613460565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506122f3565b506001949350505050565b80356001600160a01b038116811461160257600080fd5b8035801515811461160257600080fd5b600060208284031215613050578081fd5b610ceb82613018565b6000806040838503121561306b578081fd5b61307483613018565b915061308260208401613018565b90509250929050565b60008060006060848603121561309f578081fd5b6130a884613018565b92506130b660208501613018565b91506130c460408501613018565b90509250925092565b6000806000606084860312156130e1578283fd5b6130ea84613018565b92506130f860208501613018565b9150604084013590509250925092565b6000806000806080858703121561311d578081fd5b61312685613018565b935061313460208601613018565b92506040850135915060608501356001600160401b03811115613155578182fd5b8501601f81018713613165578182fd5b8035613178613173826135f4565b6135c4565b81815288602083850101111561318c578384fd5b81602084016020830137908101602001929092525092959194509250565b600080604083850312156131bc578182fd5b6131c583613018565b91506130826020840161302f565b600080604083850312156131e5578182fd5b6131ee83613018565b946020939093013593505050565b600080600060608486031215613210578283fd5b61321984613018565b95602085013595506040909401359392505050565b60006020808385031215613240578182fd5b82356001600160401b0380821115613256578384fd5b818501915085601f830112613269578384fd5b81358181111561327b5761327b6137c5565b8060051b915061328c8483016135c4565b8181528481019084860184860187018a10156132a6578788fd5b8795505b838610156132da578035945061ffff851685146132c5578788fd5b848352600195909501949186019186016132aa565b5098975050505050505050565b6000602082840312156132f8578081fd5b610ceb8261302f565b600060208284031215613312578081fd5b8135610ceb816137db565b60006020828403121561332e578081fd5b8151610ceb816137db565b60006020828403121561334a578081fd5b81516001600160401b0381111561335f578182fd5b8201601f8101841361336f578182fd5b805161337d613173826135f4565b818152856020838501011115613391578384fd5b6133a28260208301602086016136b8565b95945050505050565b6000602082840312156133bc578081fd5b5035919050565b600080604083850312156133d5578182fd5b50508035926020909101359150565b600081518084526133fc8160208601602086016136b8565b601f01601f19169290920160200192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613443908301846133e4565b9695505050505050565b602081526000610ceb60208301846133e4565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526019908201527f4f6e6c792061646d696e732063616e2063616c6c207468697300000000000000604082015260600190565b602080825260119082015270686d6d6d6d207768617420646f696e673f60781b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f191681016001600160401b03811182821017156135ec576135ec6137c5565b604052919050565b60006001600160401b0382111561360d5761360d6137c5565b50601f01601f191660200190565b600061ffff80831681851680830382111561363857613638613799565b01949350505050565b6000821982111561365457613654613799565b500190565b600060ff821660ff84168060ff0382111561367657613676613799565b019392505050565b600061ffff8381169083168181101561369957613699613799565b039392505050565b6000828210156136b3576136b3613799565b500390565b60005b838110156136d35781810151838201526020016136bb565b83811115610b575750506000910152565b600181811c908216806136f857607f821691505b602082108114156108a957634e487b7160e01b600052602260045260246000fd5b600061ffff8083168181141561373157613731613799565b6001019392505050565b600060001982141561374f5761374f613799565b5060010190565b600061ffff8084168061376b5761376b6137af565b92169190910692915050565b600060ff83168061378a5761378a6137af565b8060ff84160691505092915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146109ca57600080fdfea2646970667358221220451c17dc2d54a3d03d193b095f0dcb99380a8c6a7302228e70e28336e8c8c48864736f6c63430008040033000000000000000000000000000000000000000000000000000000000000c350

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102a05760003560e01c80636abcded111610167578063b3066d49116100ce578063e831574211610087578063e83157421461061d578063e86eadcd14610626578063e985e9c514610639578063ebd173681461064c578063f10fb58414610677578063f2fde38b1461068a57600080fd5b8063b3066d49146105ab578063b88d4fde146105be578063bc94b39c146105d1578063c87b56dd146105e4578063dd9c2ca1146105f7578063e3812bec1461060a57600080fd5b80638da5cb5b116101205780638da5cb5b1461051857806394e568471461052957806395d89b411461055d5780639cdd6f8f14610565578063a1b8f37414610578578063a22cb4651461059857600080fd5b80636abcded1146104bc57806370480275146104c457806370a08231146104d7578063715018a6146104ea578063816de0e5146104f2578063869bed0f1461050557600080fd5b80632f745c591161020b57806342966c68116101c457806342966c681461043d5780634c606793146104505780634f02c420146104635780634f6ccce7146104845780635c975abb146104975780636352211e146104a957600080fd5b80632f745c59146103b957806333df4b2c146103cc57806335ca838b146103f1578063368383911461040457806340c10f191461041757806342842e0e1461042a57600080fd5b806316c38b3c1161025d57806316c38b3c146103485780631785f53c1461035b57806318160ddd1461036e5780631f4382a61461038057806323b872dd14610393578063260c8f6d146103a657600080fd5b806301ffc9a7146102a55780630265c858146102cd57806302c2a4a3146102e257806306fdde03146102f5578063081812fc1461030a578063095ea7b314610335575b600080fd5b6102b86102b3366004613301565b61069d565b60405190151581526020015b60405180910390f35b6102e06102db3660046131d3565b6106c8565b005b6102e06102f03660046131d3565b610745565b6102fd6107b1565b6040516102c4919061344d565b61031d6103183660046133ab565b610843565b6040516001600160a01b0390911681526020016102c4565b6102e06103433660046131d3565b6108af565b6102e06103563660046132e7565b610918565b6102e061036936600461303f565b6109d5565b6008545b6040519081526020016102c4565b6102b861038e3660046133ab565b610a20565b6102e06103a13660046130cd565b610ab4565b6102e06103b43660046131d3565b610b5d565b6103726103c73660046131d3565b610bc9565b6103df6103da3660046133c3565b610cf2565b60405160ff90911681526020016102c4565b6102e06103ff36600461322e565b610d38565b6103df6104123660046133c3565b610e78565b6102e06104253660046131d3565b610e88565b6102e06104383660046130cd565b6110ee565b6102e061044b3660046133ab565b611153565b6102b861045e3660046133ab565b6112d4565b600c546104719061ffff1681565b60405161ffff90911681526020016102c4565b6103726104923660046133ab565b611366565b600a54600160a01b900460ff166102b8565b61031d6104b73660046133ab565b6113cd565b600b54610372565b6102e06104d236600461303f565b6114f0565b6103726104e536600461303f565b61153e565b6102e0611607565b60185461031d906001600160a01b031681565b6102e06105133660046131d3565b61163d565b600a546001600160a01b031661031d565b61053c6105373660046133ab565b6116a9565b60408051825160ff90811682526020938401511692810192909252016102c4565b6102fd6117a0565b6102e06105733660046131d3565b6117af565b6103726105863660046133ab565b600e6020526000908152604090205481565b6102e06105a63660046131aa565b61181b565b6102e06105b936600461308b565b61187e565b6102e06105cc366004613108565b6118e7565b61053c6105df3660046131fc565b611954565b6102fd6105f23660046133ab565b611b1d565b6102e06106053660046131d3565b611cb7565b6102b86106183660046133ab565b611d23565b610372600b5481565b60175461031d906001600160a01b031681565b6102b8610647366004613059565b611db7565b61065f61065a3660046133ab565b611e3e565b6040516001600160401b0390911681526020016102c4565b60195461031d906001600160a01b031681565b6102e061069836600461303f565b611e90565b60006001600160e01b0319821663780e9d6360e01b14806106c257506106c282611f28565b92915050565b600a54600160a01b900460ff16156106fb5760405162461bcd60e51b81526004016106f290613514565b60405180910390fd5b6040805143815242602082015282916001600160a01b038516917fc84d84e11b0f46c488c24d907151ab65af2df2a4f749d7993fed3899a987245c91015b60405180910390a35050565b600a54600160a01b900460ff161561076f5760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917fdb6025d7a6b281c8b55b3bb621d84cf33e24d0faef12b466fe8905c59fa841169101610739565b6060600080546107c0906136e4565b80601f01602080910402602001604051908101604052809291908181526020018280546107ec906136e4565b80156108395780601f1061080e57610100808354040283529160200191610839565b820191906000526020600020905b81548152906001019060200180831161081c57829003601f168201915b5050505050905090565b336000908152601a6020526040812054829060ff1680610881575060008181526010602052604090205443600160401b9091046001600160401b0316105b61089d5760405162461bcd60e51b81526004016106f2906134e9565b6108a683611f78565b91505b50919050565b336000908152601a6020526040902054819060ff16806108ed575060008181526010602052604090205443600160401b9091046001600160401b0316105b6109095760405162461bcd60e51b81526004016106f2906134e9565b610913838361200d565b505050565b6018546001600160a01b03161580159061093c57506017546001600160a01b031615155b801561095257506019546001600160a01b031615155b6109925760405162461bcd60e51b815260206004820152601160248201527010dbdb9d1c9858dd1cc81b9bdd081cd95d607a1b60448201526064016106f2565b600a546001600160a01b031633146109bc5760405162461bcd60e51b81526004016106f29061353e565b80156109cd576109ca61211e565b50565b6109ca6121a0565b600a546001600160a01b031633146109ff5760405162461bcd60e51b81526004016106f29061353e565b6001600160a01b03166000908152601a60205260409020805460ff19169055565b336000908152601a6020526040812054829060ff1680610a5e575060008181526010602052604090205443600160401b9091046001600160401b0316105b610a7a5760405162461bcd60e51b81526004016106f2906134e9565b50506000908152600d602090815260409182902082518084019093525460ff80821680855261010090920416929091019190915260011490565b336000908152601a6020526040902054819060ff1680610af2575060008181526010602052604090205443600160401b9091046001600160401b0316105b610b0e5760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a602052604090205460ff16610b4c57610b30335b83612224565b610b4c5760405162461bcd60e51b81526004016106f290613573565b610b578484846122fb565b50505050565b600a54600160a01b900460ff1615610b875760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917f2253d01cda42192b9d26e57cdf9d4232d69d07577f3d9d1de814d974399d15ff9101610739565b336000908152601a602052604081205460ff1680610c065750326000908152600f602052604090205443600160401b9091046001600160401b0316105b610c225760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a602052604090205460ff1680610c6857506001600160a01b0383166000908152600f602052604090205443600160401b9091046001600160401b0316105b610c845760405162461bcd60e51b81526004016106f2906134e9565b6000610c9084846124a6565b336000908152601a602052604090205490915060ff1680610ccf575060008181526010602052604090205443600160401b9091046001600160401b0316105b610ceb5760405162461bcd60e51b81526004016106f2906134e9565b9392505050565b60118260038110610d0257600080fd5b018181548110610d1157600080fd5b9060005260206000209060209182820401919006915091509054906101000a900460ff1681565b336000908152601a602052604090205460ff16610d675760405162461bcd60e51b81526004016106f2906134b2565b6040805180820182526001600160401b03428181168352438281166020808601918252326000908152600f9091529586209451855491518516600160401b026001600160801b031990921694169390931792909217909255915b8351811015610b57576040518060400160405280836001600160401b03168152602001846001600160401b031681525060106000868481518110610e1557634e487b7160e01b600052603260045260246000fd5b60209081029190910181015161ffff168252818101929092526040016000208251815493909201516001600160401b03908116600160401b026001600160801b031990941692169190911791909117905580610e708161373b565b915050610dc1565b60148260038110610d0257600080fd5b600a54600160a01b900460ff1615610eb25760405162461bcd60e51b81526004016106f290613514565b336000908152601a602052604090205460ff16610ee15760405162461bcd60e51b81526004016106f2906134b2565b600b54600c54610ef69061ffff16600161361b565b61ffff161115610f3c5760405162461bcd60e51b8152602060048201526011602482015270105b1b081d1bdad95b9cc81b5a5b9d1959607a1b60448201526064016106f2565b600c805461ffff16906000610f5083613719565b82546101009290920a61ffff818102199093169183160217909155600c54610f7c925084911683611954565b50326001600160a01b03831614801590610fa457506017546001600160a01b03838116911614155b156110d857600c5461ffff166000908152600d602052604090205460ff1661101b57600c546040805143815242602082015261ffff9092169132916001600160a01b038616917f5d52cb63ca14a343fa9ebfbe24ac6be8e9603934a0f5b5fbf69e8b2c1e671d4891015b60405180910390a46110d8565b600c5461ffff166000908152600d602052604090205460ff166001141561108857600c546040805143815242602082015261ffff9092169132916001600160a01b038616917f7e2df746a08d4297a5a58d487b7424cb442fd65ecf7e83c81882f42abaa2a9b6910161100e565b600c546040805143815242602082015261ffff9092169132916001600160a01b038616917f7c9d1f0366db2fb03653384d4821349458e280af01a4403185103d2436a8bc83910160405180910390a45b600c546110ea90839061ffff1661253c565b5050565b336000908152601a6020526040902054819060ff168061112c575060008181526010602052604090205443600160401b9091046001600160401b0316105b6111485760405162461bcd60e51b81526004016106f2906134e9565b610b57848484612556565b600a54600160a01b900460ff161561117d5760405162461bcd60e51b81526004016106f290613514565b336000908152601a602052604090205460ff166111ac5760405162461bcd60e51b81526004016106f2906134b2565b6111b581612571565b600c8054600191906000906111cf90849061ffff1661367e565b82546101009290920a61ffff818102199093169190921691909102179055506000818152600d602052604090205460ff1660021415611246576040805143815242602082015282917fe75022bbc5e1b59754b85df351c77e1a7ef69e9995b7e3f00e9ed89130e3e97991015b60405180910390a250565b6000818152600d602052604090205460ff1660011415611297576040805143815242602082015282917f6c91916f0c14df8742efd4425acfce7677d8ec04a75dce844e1ab48be607537b910161123b565b6040805143815242602082015282917fa9772db06160923c793633014caf9fffa5f1bd91d8fccb2441cf58692f9f748c910160405180910390a250565b336000908152601a6020526040812054829060ff1680611312575060008181526010602052604090205443600160401b9091046001600160401b0316105b61132e5760405162461bcd60e51b81526004016106f2906134e9565b50506000908152600d602090815260409182902082518084019093525460ff8082168085526101009092041692909101919091521590565b60008061137283612618565b336000908152601a602052604090205490915060ff16806113b1575060008181526010602052604090205443600160401b9091046001600160401b0316105b6106c25760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a602052604081205460ff168061140a5750326000908152600f602052604090205443600160401b9091046001600160401b0316105b6114265760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a6020526040902054829060ff1680611464575060008181526010602052604090205443600160401b9091046001600160401b0316105b6114805760405162461bcd60e51b81526004016106f2906134e9565b600061148b846126b9565b336000908152601a602052604090205490915060ff16806114d457506001600160a01b0381166000908152600f602052604090205443600160401b9091046001600160401b0316105b6108a65760405162461bcd60e51b81526004016106f2906134e9565b600a546001600160a01b0316331461151a5760405162461bcd60e51b81526004016106f29061353e565b6001600160a01b03166000908152601a60205260409020805460ff19166001179055565b336000908152601a602052604081205460ff168061157b5750326000908152600f602052604090205443600160401b9091046001600160401b0316105b6115975760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a602052604090205460ff16806115dd57506001600160a01b0382166000908152600f602052604090205443600160401b9091046001600160401b0316105b6115f95760405162461bcd60e51b81526004016106f2906134e9565b6106c282612730565b919050565b600a546001600160a01b031633146116315760405162461bcd60e51b81526004016106f29061353e565b61163b60006127b7565b565b600a54600160a01b900460ff16156116675760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917f8384271e3779637512a0cabf7f837bd1c34a34878b8db348fcaa2677c9f392b79101610739565b60408051808201825260008082526020808301829052338252601a9052919091205460ff16806116f85750326000908152600f602052604090205443600160401b9091046001600160401b0316105b6117145760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a6020526040902054829060ff1680611752575060008181526010602052604090205443600160401b9091046001600160401b0316105b61176e5760405162461bcd60e51b81526004016106f2906134e9565b50506000908152600d602090815260409182902082518084019093525460ff8082168452610100909104169082015290565b6060600180546107c0906136e4565b600a54600160a01b900460ff16156117d95760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917fc1528a0621c9c4634c9fca5b9c28a7cef95dd48e5200f975c9968bded7d4eb209101610739565b336000908152601a602052604090205460ff16806118585750326000908152600f602052604090205443600160401b9091046001600160401b0316105b6118745760405162461bcd60e51b81526004016106f2906134e9565b6110ea8282612809565b600a546001600160a01b031633146118a85760405162461bcd60e51b81526004016106f29061353e565b601880546001600160a01b039485166001600160a01b031991821617909155601780549385169382169390931790925560198054919093169116179055565b336000908152601a6020526040902054829060ff1680611925575060008181526010602052604090205443600160401b9091046001600160401b0316105b6119415760405162461bcd60e51b81526004016106f2906134e9565b61194d85858585612814565b5050505050565b604080518082019091526000808252602082015261197182612845565b6000848152600d6020908152604091829020835181549285015160ff9081166101000261ffff199094169116179190911790555190915083906001600160a01b038616907f10546b1a6f5245ff0ffa18c256b9e46859c585cbb473b453fcd4c2dc39ae08db906119ed9043904290918252602082015260400190565b60405180910390a360405183906001600160a01b038616907f1d04698a6dbf374136f42777ac79734bb996c66d2a6fca12e56889849a59fbb790600090a3805160ff16611a7f576040805143815242602082015284916001600160a01b038716917f3fdb8d245e09ba1d7a124d4c6bca0430bbc46260c1e47b07065791aa6f5ed46d91015b60405180910390a3610ceb565b806000015160ff1660011415611ad1576040805143815242602082015284916001600160a01b038716917f32f248d49a57ed8f822cf8f656e7dcec775a47262537ffa33e54d30eeac817c99101611a72565b6040805143815242602082015284916001600160a01b038716917fc0359f81f6e2dfa82d1ea82600c32f0038b9ece5c0d48c0bb47f62269a55891e910160405180910390a39392505050565b336000908152601a602052604090205460609060ff1680611b5d5750326000908152600f602052604090205443600160401b9091046001600160401b0316105b611b795760405162461bcd60e51b81526004016106f2906134e9565b336000908152601a6020526040902054829060ff1680611bb7575060008181526010602052604090205443600160401b9091046001600160401b0316105b611bd35760405162461bcd60e51b81526004016106f2906134e9565b6000838152600260205260409020546001600160a01b0316611c375760405162461bcd60e51b815260206004820152601760248201527f546f6b656e20494420646f6573206e6f7420657869737400000000000000000060448201526064016106f2565b60185460405163c87b56dd60e01b8152600481018590526001600160a01b039091169063c87b56dd9060240160006040518083038186803b158015611c7b57600080fd5b505afa158015611c8f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108a69190810190613339565b600a54600160a01b900460ff1615611ce15760405162461bcd60e51b81526004016106f290613514565b6040805143815242602082015282916001600160a01b038516917f375e17a794b39faec5f2754d77925c1ca241b108c0b4f68eade6bee2ce11b9ea9101610739565b336000908152601a6020526040812054829060ff1680611d61575060008181526010602052604090205443600160401b9091046001600160401b0316105b611d7d5760405162461bcd60e51b81526004016106f2906134e9565b50506000908152600d602090815260409182902082518084019093525460ff80821680855261010090920416929091019190915260021490565b336000908152601a602052604081205460ff1680611df45750326000908152600f602052604090205443600160401b9091046001600160401b0316105b611e105760405162461bcd60e51b81526004016106f2906134e9565b6001600160a01b0380841660009081526005602090815260408083209386168352929052205460ff16610ceb565b336000908152601a602052604081205460ff16611e6d5760405162461bcd60e51b81526004016106f2906134b2565b50600090815260106020526040902054600160401b90046001600160401b031690565b600a546001600160a01b03163314611eba5760405162461bcd60e51b81526004016106f29061353e565b6001600160a01b038116611f1f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106f2565b6109ca816127b7565b60006001600160e01b031982166380ac58cd60e01b1480611f5957506001600160e01b03198216635b5e139f60e01b145b806106c257506301ffc9a760e01b6001600160e01b03198316146106c2565b6000818152600260205260408120546001600160a01b0316611ff15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106f2565b506000908152600460205260409020546001600160a01b031690565b6000612018826126b9565b9050806001600160a01b0316836001600160a01b031614156120865760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016106f2565b336001600160a01b03821614806120a257506120a28133611db7565b6121145760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016106f2565b6109138383612903565b600a54600160a01b900460ff16156121485760405162461bcd60e51b81526004016106f290613514565b600a805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121833390565b6040516001600160a01b03909116815260200160405180910390a1565b600a54600160a01b900460ff166121f05760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106f2565b600a805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612183565b6000818152600260205260408120546001600160a01b031661229d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106f2565b60006122a8836126b9565b9050806001600160a01b0316846001600160a01b031614806122e35750836001600160a01b03166122d884610843565b6001600160a01b0316145b806122f357506122f38185611db7565b949350505050565b826001600160a01b031661230e826126b9565b6001600160a01b0316146123765760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016106f2565b6001600160a01b0382166123d85760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016106f2565b6123e3838383612971565b6123ee600082612903565b6001600160a01b03831660009081526003602052604081208054600192906124179084906136a1565b90915550506001600160a01b0382166000908152600360205260408120805460019290612445908490613641565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006124b183612730565b82106125135760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016106f2565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6110ea828260405180602001604052806000815250612a29565b610913838383604051806020016040528060008152506118e7565b600061257c826126b9565b905061258a81600084612971565b612595600083612903565b6001600160a01b03811660009081526003602052604081208054600192906125be9084906136a1565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600061262360085490565b82106126865760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016106f2565b600882815481106126a757634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806106c25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016106f2565b60006001600160a01b03821661279b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016106f2565b506001600160a01b031660009081526003602052604090205490565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6110ea338383612a5c565b61281d33610b2a565b6128395760405162461bcd60e51b81526004016106f290613573565b610b5784848484612b2b565b6040805180820190915260008082526020820152600561286a606461ffff8516613756565b61ffff16101561287d57600281526128a6565b601e61288e606461ffff8516613756565b61ffff1610156128a157600181526128a6565b600081525b805160009060ff166128ba575060006128d6565b816000015160ff16600114156128d2575060016128d6565b5060025b60109290921c916128f561ffff84166128f0836000613659565b612b5e565b60ff16602083015250919050565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612938826126b9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6001600160a01b0383166129cc576129c781600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6129ef565b816001600160a01b0316836001600160a01b0316146129ef576129ef8382612c03565b6001600160a01b038216612a065761091381612ca0565b826001600160a01b0316826001600160a01b031614610913576109138282612d79565b612a338383612dbd565b612a406000848484612f0b565b6109135760405162461bcd60e51b81526004016106f290613460565b816001600160a01b0316836001600160a01b03161415612abe5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016106f2565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612b368484846122fb565b612b4284848484612f0b565b610b575760405162461bcd60e51b81526004016106f290613460565b60008060118360ff1660038110612b8557634e487b7160e01b600052603260045260246000fd5b0154612b919085613777565b905060148360ff1660038110612bb757634e487b7160e01b600052603260045260246000fd5b018160ff1681548110612bda57634e487b7160e01b600052603260045260246000fd5b90600052602060002090602091828204019190069054906101000a900460ff1691505092915050565b60006001612c1084612730565b612c1a91906136a1565b600083815260076020526040902054909150808214612c6d576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612cb2906001906136a1565b60008381526009602052604081205460088054939450909284908110612ce857634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508060088381548110612d1757634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612d5d57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000612d8483612730565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216612e135760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016106f2565b6000818152600260205260409020546001600160a01b031615612e785760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016106f2565b612e8460008383612971565b6001600160a01b0382166000908152600360205260408120805460019290612ead908490613641565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b1561300d57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612f4f903390899088908890600401613410565b602060405180830381600087803b158015612f6957600080fd5b505af1925050508015612f99575060408051601f3d908101601f19168201909252612f969181019061331d565b60015b612ff3573d808015612fc7576040519150601f19603f3d011682016040523d82523d6000602084013e612fcc565b606091505b508051612feb5760405162461bcd60e51b81526004016106f290613460565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506122f3565b506001949350505050565b80356001600160a01b038116811461160257600080fd5b8035801515811461160257600080fd5b600060208284031215613050578081fd5b610ceb82613018565b6000806040838503121561306b578081fd5b61307483613018565b915061308260208401613018565b90509250929050565b60008060006060848603121561309f578081fd5b6130a884613018565b92506130b660208501613018565b91506130c460408501613018565b90509250925092565b6000806000606084860312156130e1578283fd5b6130ea84613018565b92506130f860208501613018565b9150604084013590509250925092565b6000806000806080858703121561311d578081fd5b61312685613018565b935061313460208601613018565b92506040850135915060608501356001600160401b03811115613155578182fd5b8501601f81018713613165578182fd5b8035613178613173826135f4565b6135c4565b81815288602083850101111561318c578384fd5b81602084016020830137908101602001929092525092959194509250565b600080604083850312156131bc578182fd5b6131c583613018565b91506130826020840161302f565b600080604083850312156131e5578182fd5b6131ee83613018565b946020939093013593505050565b600080600060608486031215613210578283fd5b61321984613018565b95602085013595506040909401359392505050565b60006020808385031215613240578182fd5b82356001600160401b0380821115613256578384fd5b818501915085601f830112613269578384fd5b81358181111561327b5761327b6137c5565b8060051b915061328c8483016135c4565b8181528481019084860184860187018a10156132a6578788fd5b8795505b838610156132da578035945061ffff851685146132c5578788fd5b848352600195909501949186019186016132aa565b5098975050505050505050565b6000602082840312156132f8578081fd5b610ceb8261302f565b600060208284031215613312578081fd5b8135610ceb816137db565b60006020828403121561332e578081fd5b8151610ceb816137db565b60006020828403121561334a578081fd5b81516001600160401b0381111561335f578182fd5b8201601f8101841361336f578182fd5b805161337d613173826135f4565b818152856020838501011115613391578384fd5b6133a28260208301602086016136b8565b95945050505050565b6000602082840312156133bc578081fd5b5035919050565b600080604083850312156133d5578182fd5b50508035926020909101359150565b600081518084526133fc8160208601602086016136b8565b601f01601f19169290920160200192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613443908301846133e4565b9695505050505050565b602081526000610ceb60208301846133e4565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526019908201527f4f6e6c792061646d696e732063616e2063616c6c207468697300000000000000604082015260600190565b602080825260119082015270686d6d6d6d207768617420646f696e673f60781b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f191681016001600160401b03811182821017156135ec576135ec6137c5565b604052919050565b60006001600160401b0382111561360d5761360d6137c5565b50601f01601f191660200190565b600061ffff80831681851680830382111561363857613638613799565b01949350505050565b6000821982111561365457613654613799565b500190565b600060ff821660ff84168060ff0382111561367657613676613799565b019392505050565b600061ffff8381169083168181101561369957613699613799565b039392505050565b6000828210156136b3576136b3613799565b500390565b60005b838110156136d35781810151838201526020016136bb565b83811115610b575750506000910152565b600181811c908216806136f857607f821691505b602082108114156108a957634e487b7160e01b600052602260045260246000fd5b600061ffff8083168181141561373157613731613799565b6001019392505050565b600060001982141561374f5761374f613799565b5060010190565b600061ffff8084168061376b5761376b6137af565b92169190910692915050565b600060ff83168061378a5761378a6137af565b8060ff84160691505092915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146109ca57600080fdfea2646970667358221220451c17dc2d54a3d03d193b095f0dcb99380a8c6a7302228e70e28336e8c8c48864736f6c63430008040033

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

000000000000000000000000000000000000000000000000000000000000c350

-----Decoded View---------------
Arg [0] : _maxTokens (uint256): 50000

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000000c350


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.