Contract 0x16f78d75fabb869835236b5fb59c2b29f6cbbfcf

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x56d51c9f2715e58e166597b8d23b32015e98666c9af082c3d3ef25d672c0e7980x60806040295333332022-06-13 22:27:16112 days 4 hrs agoThe Sandbox: Deployer IN  Create: PolygonLandV10 MATIC0.137960448086 30.752999798
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PolygonLandV1

Compiler Version
v0.8.2+commit.661d1103

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 16 : PolygonLandV1.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.2;

import "./PolygonLandBaseToken.sol";
import "../../../common/BaseWithStorage/ERC2771Handler.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

/// @title LAND token on L2
contract PolygonLandV1 is PolygonLandBaseToken, ERC2771Handler {
    function initialize(address trustedForwarder) external initializer {
        _admin = _msgSender();
        __ERC2771Handler_initialize(trustedForwarder);
    }

    /// @dev Change the address of the trusted forwarder for meta-TX
    /// @param trustedForwarder The new trustedForwarder
    function setTrustedForwarder(address trustedForwarder) external onlyAdmin {
        _trustedForwarder = trustedForwarder;
    }

    function _msgSender() internal view override(ContextUpgradeable, ERC2771Handler) returns (address sender) {
        return ERC2771Handler._msgSender();
    }

    function _msgData() internal view override(ContextUpgradeable, ERC2771Handler) returns (bytes calldata) {
        return ERC2771Handler._msgData();
    }
}

File 2 of 16 : PolygonLandBaseToken.sol
// SPDX-License-Identifier: MIT
// solhint-disable code-complexity

pragma solidity 0.8.2;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "../../../common/BaseWithStorage/ERC721BaseTokenV2.sol";
import "../../../common/interfaces/IPolygonLand.sol";

abstract contract PolygonLandBaseToken is IPolygonLand, Initializable, ERC721BaseTokenV2 {
    using AddressUpgradeable for address;

    uint256 internal constant GRID_SIZE = 408;

    uint256 internal constant LAYER = 0xFF00000000000000000000000000000000000000000000000000000000000000;
    uint256 internal constant LAYER_1x1 = 0x0000000000000000000000000000000000000000000000000000000000000000;
    uint256 internal constant LAYER_3x3 = 0x0100000000000000000000000000000000000000000000000000000000000000;
    uint256 internal constant LAYER_6x6 = 0x0200000000000000000000000000000000000000000000000000000000000000;
    uint256 internal constant LAYER_12x12 = 0x0300000000000000000000000000000000000000000000000000000000000000;
    uint256 internal constant LAYER_24x24 = 0x0400000000000000000000000000000000000000000000000000000000000000;

    mapping(address => bool) internal _minters;

    event Minter(address minter, bool enabled);

    modifier validQuad(
        uint256 size,
        uint256 x,
        uint256 y
    ) {
        require(size == 1 || size == 3 || size == 6 || size == 12 || size == 24, "Invalid size");
        require(x % size == 0 && y % size == 0, "Invalid coordinates");
        require(x <= GRID_SIZE - size && y <= GRID_SIZE - size, "Out of bounds");

        _;
    }

    /**
     * @notice Return the name of the token contract
     * @return The name of the token contract
     */
    function name() public pure returns (string memory) {
        return "Sandbox's LANDs";
    }

    /**
     * @notice Return the symbol of the token contract
     * @return The symbol of the token contract
     */
    function symbol() public pure returns (string memory) {
        return "LAND";
    }

    /// @notice total width of the map
    /// @return width
    function width() public pure returns (uint256) {
        return GRID_SIZE;
    }

    /// @notice total height of the map
    /// @return height
    function height() public pure returns (uint256) {
        return GRID_SIZE;
    }

    /// @notice x coordinate of Land token
    /// @param id tokenId
    /// @return the x coordinates
    function getX(uint256 id) external view returns (uint256) {
        require(_ownerOf(id) != address(0), "token does not exist");
        return id % GRID_SIZE;
    }

    /// @notice y coordinate of Land token
    /// @param id tokenId
    /// @return the y coordinates
    function getY(uint256 id) external view returns (uint256) {
        require(_ownerOf(id) != address(0), "token does not exist");
        return id / GRID_SIZE;
    }

    /**
     * @notice Return the URI of a specific token
     * @param id The id of the token
     * @return The URI of the token
     */
    function tokenURI(uint256 id) public view returns (string memory) {
        require(_ownerOf(id) != address(0), "Id does not exist");
        return
            string(
                abi.encodePacked("https://api.sandbox.game/lands/", StringsUpgradeable.toString(id), "/metadata.json")
            );
    }

    /**
     * @notice Check if the contract supports an interface
     * 0x01ffc9a7 is ERC-165
     * 0x80ac58cd is ERC-721
     * 0x5b5e139f is ERC-721 metadata
     * @param id The id of the interface
     * @return True if the interface is supported
     */
    function supportsInterface(bytes4 id) public pure override returns (bool) {
        return id == 0x01ffc9a7 || id == 0x80ac58cd || id == 0x5b5e139f;
    }

    /**
     * @notice Mint a new quad (aligned to a quad tree with size 1, 3, 6, 12 or 24 only)
     * @param user The recipient of the new quad
     * @param size The size of the new quad
     * @param x The top left x coordinate of the new quad
     * @param y The top left y coordinate of the new quad
     * @param data extra data to pass to the transfer
     */
    function mintQuad(
        address user,
        uint256 size,
        uint256 x,
        uint256 y,
        bytes memory data
    ) external virtual override {
        require(isMinter(_msgSender()), "!AUTHORIZED");
        _mintQuad(user, size, x, y, data);
    }

    function _mintQuad(
        address to,
        uint256 size,
        uint256 x,
        uint256 y,
        bytes memory data
    ) internal {
        require(to != address(0), "to is zero address");
        require(!exists(size, x, y), "Already minted");

        uint256 quadId;
        uint256 id = x + y * GRID_SIZE;

        if (size == 1) {
            quadId = id;
        } else if (size == 3) {
            quadId = LAYER_3x3 + id;
        } else if (size == 6) {
            quadId = LAYER_6x6 + id;
        } else if (size == 12) {
            quadId = LAYER_12x12 + id;
        } else if (size == 24) {
            quadId = LAYER_24x24 + id;
        }

        for (uint256 i = 0; i < size * size; i++) {
            emit Transfer(address(0), to, _idInPath(i, size, x, y));
        }

        _owners[quadId] = uint256(uint160(address(to)));
        _numNFTPerAddress[to] += size * size;

        _checkBatchReceiverAcceptQuad(_msgSender(), address(0), to, size, x, y, data);
    }

    function batchTransferQuad(
        address from,
        address to,
        uint256[] calldata sizes,
        uint256[] calldata xs,
        uint256[] calldata ys,
        bytes calldata data
    ) external override {
        require(from != address(0), "from is zero address");
        require(to != address(0), "can't send to zero address");
        require(sizes.length == xs.length && xs.length == ys.length, "invalid data");
        if (_msgSender() != from) {
            require(
                _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],
                "not authorized to transferMultiQuads"
            );
        }
        uint256 numTokensTransfered = 0;
        for (uint256 i = 0; i < sizes.length; i++) {
            uint256 size = sizes[i];
            _transferQuad(from, to, size, xs[i], ys[i]);
            numTokensTransfered += size * size;
        }
        _numNFTPerAddress[from] -= numTokensTransfered;
        _numNFTPerAddress[to] += numTokensTransfered;

        if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {
            uint256[] memory ids = new uint256[](numTokensTransfered);
            uint256 counter = 0;
            for (uint256 j = 0; j < sizes.length; j++) {
                uint256 size = sizes[j];
                for (uint256 i = 0; i < size * size; i++) {
                    ids[counter] = _idInPath(i, size, xs[j], ys[j]);
                    counter++;
                }
            }
            require(
                _checkOnERC721BatchReceived(_msgSender(), from, to, ids, data),
                "erc721 batch transfer rejected by to"
            );
        }
    }

    function transferQuad(
        address from,
        address to,
        uint256 size,
        uint256 x,
        uint256 y,
        bytes calldata data
    ) external override {
        require(from != address(0), "from is zero address");
        require(to != address(0), "can't send to zero address");
        if (_msgSender() != from) {
            require(
                _operatorsForAll[from][_msgSender()] || _superOperators[_msgSender()],
                "not authorized to transferQuad"
            );
        }
        _transferQuad(from, to, size, x, y);
        _numNFTPerAddress[from] -= size * size;
        _numNFTPerAddress[to] += size * size;

        _checkBatchReceiverAcceptQuad(_msgSender(), from, to, size, x, y, data);
    }

    function batchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        bytes calldata data
    ) public override(ILandToken, ERC721BaseTokenV2) {
        super.batchTransferFrom(from, to, ids, data);
    }

    function exists(
        uint256 size,
        uint256 x,
        uint256 y
    ) public view override validQuad(size, x, y) returns (bool) {
        if (_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE] != 0) return true;
        uint256 toX = x + size;
        uint256 toY = y + size;
        if (size <= 12) {
            if (_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE] != 0) return true;
        } else {
            for (uint256 x12i = x; x12i < toX; x12i += 12) {
                for (uint256 y12i = y; y12i < toY; y12i += 12) {
                    uint256 id12x12 = LAYER_12x12 + x12i + y12i * GRID_SIZE;
                    if (_owners[id12x12] != 0) return true;
                }
            }
        }

        if (size <= 6) {
            if (_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE] != 0) return true;
        } else {
            for (uint256 x6i = x; x6i < toX; x6i += 6) {
                for (uint256 y6i = y; y6i < toY; y6i += 6) {
                    uint256 id6x6 = LAYER_6x6 + x6i + y6i * GRID_SIZE;
                    if (_owners[id6x6] != 0) return true;
                }
            }
        }

        if (size <= 3) {
            if (_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE] != 0) return true;
        } else {
            for (uint256 x3i = x; x3i < toX; x3i += 3) {
                for (uint256 y3i = y; y3i < toY; y3i += 3) {
                    uint256 id3x3 = LAYER_3x3 + x3i + y3i * GRID_SIZE;
                    if (_owners[id3x3] != 0) return true;
                }
            }
        }

        for (uint256 i = 0; i < size * size; i++) {
            if (_owners[_idInPath(i, size, x, y)] != 0) return true;
        }

        return false;
    }

    /// @notice Enable or disable the ability of `minter` to transfer tokens of all (minter rights).
    /// @param minter address that will be given/removed minter right.
    /// @param enabled set whether the minter is enabled or disabled.
    function setMinter(address minter, bool enabled) external {
        require(_msgSender() == _admin, "only admin is allowed to add minters");
        require(minter != address(0), "PolygonLand: Invalid address");
        _minters[minter] = enabled;
        emit Minter(minter, enabled);
    }

    /// @notice check whether address `who` is given minter rights.
    /// @param who The address to query.
    /// @return whether the address has minter rights.
    function isMinter(address who) public view returns (bool) {
        return _minters[who];
    }

    function _transferQuad(
        address from,
        address to,
        uint256 size,
        uint256 x,
        uint256 y
    ) internal validQuad(size, x, y) {
        if (size == 1) {
            uint256 id1x1 = x + y * GRID_SIZE;
            address owner = _ownerOf(id1x1);
            require(owner != address(0), "token does not exist");
            require(owner == from, "not owner in _transferQuad");
            _owners[id1x1] = uint256(uint160(address(to)));
        } else {
            _regroup(from, to, size, x, y);
        }
        for (uint256 i = 0; i < size * size; i++) {
            emit Transfer(from, to, _idInPath(i, size, x, y));
        }
    }

    function _idInPath(
        uint256 i,
        uint256 size,
        uint256 x,
        uint256 y
    ) internal pure returns (uint256) {
        uint256 row = i / size;
        if (row % 2 == 0) {
            // allow ids to follow a path in a quad
            return (x + (i % size)) + ((y + row) * GRID_SIZE);
        } else {
            return ((x + size) - (1 + (i % size))) + ((y + row) * GRID_SIZE);
        }
    }

    function _regroup(
        address from,
        address to,
        uint256 size,
        uint256 x,
        uint256 y
    ) internal {
        if (size == 3) {
            _regroup3x3(from, to, x, y, true);
        } else if (size == 6) {
            _regroup6x6(from, to, x, y, true);
        } else if (size == 12) {
            _regroup12x12(from, to, x, y, true);
        } else if (size == 24) {
            _regroup24x24(from, to, x, y, true);
        }
    }

    function _regroup3x3(
        address from,
        address to,
        uint256 x,
        uint256 y,
        bool set
    ) internal returns (bool) {
        uint256 id = x + y * GRID_SIZE;
        uint256 quadId = LAYER_3x3 + id;
        bool ownerOfAll = true;
        for (uint256 xi = x; xi < x + 3; xi++) {
            for (uint256 yi = y; yi < y + 3; yi++) {
                ownerOfAll = _checkAndClear(from, xi + yi * GRID_SIZE) && ownerOfAll;
            }
        }
        if (set) {
            if (!ownerOfAll) {
                require(_ownerOfQuad(3, x, y) == from, "not owner of all sub quads nor parent quads");
            }
            _owners[quadId] = uint256(uint160(address(to)));
            return true;
        }
        return ownerOfAll;
    }

    function _regroup6x6(
        address from,
        address to,
        uint256 x,
        uint256 y,
        bool set
    ) internal returns (bool) {
        uint256 id = x + y * GRID_SIZE;
        uint256 quadId = LAYER_6x6 + id;
        bool ownerOfAll = true;
        for (uint256 xi = x; xi < x + 6; xi += 3) {
            for (uint256 yi = y; yi < y + 6; yi += 3) {
                bool ownAllIndividual = _regroup3x3(from, to, xi, yi, false);
                uint256 id3x3 = LAYER_3x3 + xi + yi * GRID_SIZE;
                uint256 owner3x3 = _owners[id3x3];
                if (owner3x3 != 0) {
                    if (!ownAllIndividual) {
                        require(owner3x3 == uint256(uint160(address(from))), "not owner of 3x3 quad");
                    }
                    _owners[id3x3] = 0;
                }
                ownerOfAll = (ownAllIndividual || owner3x3 != 0) && ownerOfAll;
            }
        }
        if (set) {
            if (!ownerOfAll) {
                require(_ownerOfQuad(6, x, y) == from, "not owner of all sub quads nor parent quads");
            }
            _owners[quadId] = uint256(uint160(address(to)));
            return true;
        }
        return ownerOfAll;
    }

    function _regroup12x12(
        address from,
        address to,
        uint256 x,
        uint256 y,
        bool set
    ) internal returns (bool) {
        uint256 id = x + y * GRID_SIZE;
        uint256 quadId = LAYER_12x12 + id;
        bool ownerOfAll = true;
        for (uint256 xi = x; xi < x + 12; xi += 6) {
            for (uint256 yi = y; yi < y + 12; yi += 6) {
                bool ownAllIndividual = _regroup6x6(from, to, xi, yi, false);
                uint256 id6x6 = LAYER_6x6 + xi + yi * GRID_SIZE;
                uint256 owner6x6 = _owners[id6x6];
                if (owner6x6 != 0) {
                    if (!ownAllIndividual) {
                        require(owner6x6 == uint256(uint160(address(from))), "not owner of 6x6 quad");
                    }
                    _owners[id6x6] = 0;
                }
                ownerOfAll = (ownAllIndividual || owner6x6 != 0) && ownerOfAll;
            }
        }
        if (set) {
            if (!ownerOfAll) {
                require(_ownerOfQuad(12, x, y) == from, "not owner of all sub quads nor parent quads");
            }
            _owners[quadId] = uint256(uint160(address(to)));
            return true;
        }
        return ownerOfAll;
    }

    function _regroup24x24(
        address from,
        address to,
        uint256 x,
        uint256 y,
        bool set
    ) internal returns (bool) {
        uint256 id = x + y * GRID_SIZE;
        uint256 quadId = LAYER_24x24 + id;
        bool ownerOfAll = true;
        for (uint256 xi = x; xi < x + 24; xi += 12) {
            for (uint256 yi = y; yi < y + 24; yi += 12) {
                bool ownAllIndividual = _regroup12x12(from, to, xi, yi, false);
                uint256 id12x12 = LAYER_12x12 + xi + yi * GRID_SIZE;
                uint256 owner12x12 = _owners[id12x12];
                if (owner12x12 != 0) {
                    if (!ownAllIndividual) {
                        require(owner12x12 == uint256(uint160(address(from))), "not owner of 12x12 quad");
                    }
                    _owners[id12x12] = 0;
                }
                ownerOfAll = (ownAllIndividual || owner12x12 != 0) && ownerOfAll;
            }
        }
        if (set) {
            if (!ownerOfAll) {
                require(
                    _owners[quadId] == uint256(uint160(address(from))),
                    "not owner of all sub quads not parent quad"
                );
            }
            _owners[quadId] = uint256(uint160(address(to)));
            return true;
        }
        return ownerOfAll || _owners[quadId] == uint256(uint160(address(from)));
    }

    function _ownerOfQuad(
        uint256 size,
        uint256 x,
        uint256 y
    ) internal returns (address) {
        uint256 layer;
        uint256 parentSize = size * 2;
        if (size == 3) {
            layer = LAYER_3x3;
        } else if (size == 6) {
            layer = LAYER_6x6;
        } else if (size == 12) {
            layer = LAYER_12x12;
        } else if (size == 24) {
            layer = LAYER_24x24;
        } else {
            require(false, "Invalid size");
        }

        address owner = address(uint160(_owners[layer + (x / size) * size + ((y / size) * size) * GRID_SIZE]));
        if (owner != address(0)) {
            return owner;
        } else if (size < 24) {
            return _ownerOfQuad(parentSize, x, y);
        }
        return address(0);
    }

    function _ownerOf(uint256 id) internal view override returns (address) {
        require(id & LAYER == 0, "Invalid token id");
        uint256 x = id % GRID_SIZE;
        uint256 y = id / GRID_SIZE;
        uint256 owner1x1 = _owners[id];

        if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {
            return address(0);
        }

        if (owner1x1 != 0) {
            return address(uint160(owner1x1)); //we check if the quad exists as an 1x1 quad, then 3x3, and so on..
        } else {
            address owner3x3 = address(uint160(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]));
            if (owner3x3 != address(0)) {
                return owner3x3;
            } else {
                address owner6x6 = address(uint160(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]));
                if (owner6x6 != address(0)) {
                    return owner6x6;
                } else {
                    address owner12x12 =
                        address(uint160(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]));
                    if (owner12x12 != address(0)) {
                        return owner12x12;
                    } else {
                        return address(uint160(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]));
                    }
                }
            }
        }
    }

    function _checkAndClear(address from, uint256 id) internal returns (bool) {
        uint256 owner = _owners[id];
        if (owner != 0) {
            require((owner & BURNED_FLAG) != BURNED_FLAG, "not owner");
            require(address(uint160(owner)) == from, "not owner");
            _owners[id] = 0;
            return true;
        }
        return false;
    }

    function _checkBatchReceiverAcceptQuad(
        address operator,
        address from,
        address to,
        uint256 size,
        uint256 x,
        uint256 y,
        bytes memory data
    ) internal {
        if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {
            uint256[] memory ids = new uint256[](size * size);
            for (uint256 i = 0; i < size * size; i++) {
                ids[i] = _idInPath(i, size, x, y);
            }
            require(_checkOnERC721BatchReceived(operator, from, to, ids, data), "erc721 batch transfer rejected by to");
        }
    }

    function _ownerAndOperatorEnabledOf(uint256 id)
        internal
        view
        override
        returns (address owner, bool operatorEnabled)
    {
        require(id & LAYER == 0, "Invalid token id");
        uint256 x = id % GRID_SIZE;
        uint256 y = id / GRID_SIZE;
        uint256 owner1x1 = _owners[id];

        if ((owner1x1 & BURNED_FLAG) == BURNED_FLAG) {
            owner = address(0);
            operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;
            return (owner, operatorEnabled);
        }

        if (owner1x1 != 0) {
            owner = address(uint160(owner1x1));
            operatorEnabled = (owner1x1 & OPERATOR_FLAG) == OPERATOR_FLAG;
        } else {
            address owner3x3 = address(uint160(_owners[LAYER_3x3 + (x / 3) * 3 + ((y / 3) * 3) * GRID_SIZE]));
            if (owner3x3 != address(uint160(0))) {
                owner = owner3x3;
                operatorEnabled = false;
            } else {
                address owner6x6 = address(uint160(_owners[LAYER_6x6 + (x / 6) * 6 + ((y / 6) * 6) * GRID_SIZE]));
                if (owner6x6 != address(uint160(0))) {
                    owner = owner6x6;
                    operatorEnabled = false;
                } else {
                    address owner12x12 =
                        address(uint160(_owners[LAYER_12x12 + (x / 12) * 12 + ((y / 12) * 12) * GRID_SIZE]));
                    if (owner12x12 != address(uint160(0))) {
                        owner = owner12x12;
                        operatorEnabled = false;
                    } else {
                        owner = address(uint160(_owners[LAYER_24x24 + (x / 24) * 24 + ((y / 24) * 24) * GRID_SIZE]));
                        operatorEnabled = false;
                    }
                }
            }
        }
    }

    // Empty storage space in contracts for future enhancements
    // ref: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/13)
    uint256[49] private __gap;
}

File 3 of 16 : ERC2771Handler.sol
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.2;

/// @dev minimal ERC2771 handler to keep bytecode-size down
/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/metatx/ERC2771Context.sol
/// with an initializer for proxies and a mutable forwarder

contract ERC2771Handler {
    address internal _trustedForwarder;

    function __ERC2771Handler_initialize(address forwarder) internal {
        _trustedForwarder = forwarder;
    }

    function isTrustedForwarder(address forwarder) public view returns (bool) {
        return forwarder == _trustedForwarder;
    }

    function getTrustedForwarder() external view returns (address trustedForwarder) {
        return _trustedForwarder;
    }

    function _msgSender() internal view virtual returns (address sender) {
        if (isTrustedForwarder(msg.sender)) {
            // The assembly code is more direct than the Solidity version using `abi.decode`.
            // solhint-disable-next-line no-inline-assembly
            assembly {
                sender := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            return msg.sender;
        }
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        if (isTrustedForwarder(msg.sender)) {
            return msg.data[:msg.data.length - 20];
        } else {
            return msg.data;
        }
    }
}

File 4 of 16 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 5 of 16 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 6 of 16 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    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 7 of 16 : ERC721BaseTokenV2.sol
//SPDX-License-Identifier: MIT
/* solhint-disable func-order, code-complexity */
// solhint-disable-next-line compiler-version
pragma solidity 0.8.2;

import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "./WithSuperOperatorsV2.sol";
import "../interfaces/IERC721MandatoryTokenReceiver.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

contract ERC721BaseTokenV2 is ContextUpgradeable, IERC721Upgradeable, WithSuperOperatorsV2 {
    using AddressUpgradeable for address;

    bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;
    bytes4 internal constant _ERC721_BATCH_RECEIVED = 0x4b808c46;

    bytes4 internal constant ERC165ID = 0x01ffc9a7;
    bytes4 internal constant ERC721_MANDATORY_RECEIVER = 0x5e8bf644;

    uint256 internal constant NOT_ADDRESS = 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000;
    uint256 internal constant OPERATOR_FLAG = (2**255);
    uint256 internal constant NOT_OPERATOR_FLAG = OPERATOR_FLAG - 1;
    uint256 internal constant BURNED_FLAG = (2**160);

    mapping(address => uint256) internal _numNFTPerAddress;
    mapping(uint256 => uint256) internal _owners;
    mapping(address => mapping(address => bool)) internal _operatorsForAll;
    mapping(uint256 => address) internal _operators;

    /// @notice Approve an operator to spend tokens on the senders behalf.
    /// @param operator The address receiving the approval.
    /// @param id The id of the token.
    function approve(address operator, uint256 id) external override {
        uint256 ownerData = _owners[_storageId(id)];
        address owner = _ownerOf(id);
        address msgSender = _msgSender();
        require(owner != address(0), "NONEXISTENT_TOKEN");
        require(
            owner == msgSender || _operatorsForAll[owner][msgSender] || _superOperators[msgSender],
            "UNAUTHORIZED_APPROVAL"
        );
        _approveFor(ownerData, operator, id);
    }

    /// @notice Approve an operator to spend tokens on the sender behalf.
    /// @param sender The address giving the approval.
    /// @param operator The address receiving the approval.
    /// @param id The id of the token.
    function approveFor(
        address sender,
        address operator,
        uint256 id
    ) external {
        uint256 ownerData = _owners[_storageId(id)];
        address owner = _ownerOf(id);
        address msgSender = _msgSender();
        require(sender != address(0), "ZERO_ADDRESS_SENDER");
        require(owner != address(0), "NONEXISTENT_TOKEN");
        require(
            msgSender == sender || _operatorsForAll[sender][msgSender] || _superOperators[msgSender],
            "UNAUTHORIZED_APPROVAL"
        );
        require(address(uint160(ownerData)) == sender, "OWNER_NOT_SENDER");
        _approveFor(ownerData, operator, id);
    }

    /// @notice Transfer a token between 2 addresses.
    /// @param from The sender of the token.
    /// @param to The recipient of the token.
    /// @param id The id of the token.
    function transferFrom(
        address from,
        address to,
        uint256 id
    ) external override {
        _checkTransfer(from, to, id);
        _transferFrom(from, to, id);
        if (to.isContract() && _checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {
            require(_checkOnERC721Received(_msgSender(), from, to, id, ""), "ERC721_TRANSFER_REJECTED");
        }
    }

    /// @notice Transfer a token between 2 addresses letting the receiver know of the transfer.
    /// @param from The send of the token.
    /// @param to The recipient of the token.
    /// @param id The id of the token.
    function safeTransferFrom(
        address from,
        address to,
        uint256 id
    ) external override {
        safeTransferFrom(from, to, id, "");
    }

    /// @notice Transfer many tokens between 2 addresses.
    /// @param from The sender of the token.
    /// @param to The recipient of the token.
    /// @param ids The ids of the tokens.
    /// @param data Additional data.
    function batchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        bytes calldata data
    ) public virtual {
        _batchTransferFrom(from, to, ids, data, false);
    }

    /// @notice Transfer many tokens between 2 addresses, while
    /// ensuring the receiving contract has a receiver method.
    /// @param from The sender of the token.
    /// @param to The recipient of the token.
    /// @param ids The ids of the tokens.
    /// @param data Additional data.
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        bytes calldata data
    ) external {
        _batchTransferFrom(from, to, ids, data, true);
    }

    /// @notice Set the approval for an operator to manage all the tokens of the sender.
    /// @param sender The address giving the approval.
    /// @param operator The address receiving the approval.
    /// @param approved The determination of the approval.
    function setApprovalForAllFor(
        address sender,
        address operator,
        bool approved
    ) external {
        require(sender != address(0), "Invalid sender address");
        address msgSender = _msgSender();
        require(msgSender == sender || _superOperators[msgSender], "UNAUTHORIZED_APPROVE_FOR_ALL");

        _setApprovalForAll(sender, operator, approved);
    }

    /// @notice Set the approval for an operator to manage all the tokens of the sender.
    /// @param operator The address receiving the approval.
    /// @param approved The determination of the approval.
    function setApprovalForAll(address operator, bool approved) external override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /// @notice Burns token `id`.
    /// @param id The token which will be burnt.
    function burn(uint256 id) external virtual {
        _burn(_msgSender(), _ownerOf(id), id);
    }

    /// @notice Burn token`id` from `from`.
    /// @param from address whose token is to be burnt.
    /// @param id The token which will be burnt.
    function burnFrom(address from, uint256 id) external virtual {
        require(from != address(0), "NOT_FROM_ZEROADDRESS");
        (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);
        address msgSender = _msgSender();
        require(
            msgSender == from ||
                (operatorEnabled && _operators[id] == msgSender) ||
                _superOperators[msgSender] ||
                _operatorsForAll[from][msgSender],
            "UNAUTHORIZED_BURN"
        );
        _burn(from, owner, id);
    }

    /// @notice Get the number of tokens owned by an address.
    /// @param owner The address to look for.
    /// @return The number of tokens owned by the address.
    function balanceOf(address owner) external view override returns (uint256) {
        require(owner != address(0), "ZERO_ADDRESS_OWNER");
        return _numNFTPerAddress[owner];
    }

    /// @notice Get the owner of a token.
    /// @param id The id of the token.
    /// @return owner The address of the token owner.
    function ownerOf(uint256 id) external view override returns (address owner) {
        owner = _ownerOf(id);
        require(owner != address(0), "NONEXISTANT_TOKEN");
    }

    /// @notice Get the approved operator for a specific token.
    /// @param id The id of the token.
    /// @return The address of the operator.
    function getApproved(uint256 id) external view override returns (address) {
        (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);
        require(owner != address(0), "NONEXISTENT_TOKEN");
        if (operatorEnabled) {
            return _operators[id];
        } else {
            return address(0);
        }
    }

    /// @notice Check if the sender approved the operator.
    /// @param owner The address of the owner.
    /// @param operator The address of the operator.
    /// @return isOperator The status of the approval.
    function isApprovedForAll(address owner, address operator) external view override returns (bool isOperator) {
        return _operatorsForAll[owner][operator] || _superOperators[operator];
    }

    /// @notice Transfer a token between 2 addresses letting the receiver knows of the transfer.
    /// @param from The sender of the token.
    /// @param to The recipient of the token.
    /// @param id The id of the token.
    /// @param data Additional data.
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        bytes memory data
    ) public override {
        _checkTransfer(from, to, id);
        _transferFrom(from, to, id);
        if (to.isContract()) {
            require(_checkOnERC721Received(_msgSender(), from, to, id, data), "ERC721_TRANSFER_REJECTED");
        }
    }

    /// @notice Check if the contract supports an interface.
    /// 0x01ffc9a7 is ERC-165.
    /// 0x80ac58cd is ERC-721
    /// @param id The id of the interface.
    /// @return Whether the interface is supported.
    function supportsInterface(bytes4 id) public pure virtual override returns (bool) {
        return id == 0x01ffc9a7 || id == 0x80ac58cd;
    }

    /// @dev By overriding this function in an implementation which inherits this contract,
    /// you can enable versioned tokenIds without the extra overhead of writing to a new storage slot in _owners each time a version is incremented.
    /// See GameToken._storageId() for an example, where the storageId is the tokenId minus the version number.
    /// !!! Caution !!! Overriding this function without taking appropriate care could lead to
    /// ownerOf() returning an owner for non-existent tokens. Tests should be written to
    /// guard against introducing this bug.
    /// @param id The id of a token.
    /// @return The id used for storage mappings.
    function _storageId(uint256 id) internal view virtual returns (uint256) {
        return id;
    }

    function _updateOwnerData(
        uint256 id,
        uint256 oldData,
        address newOwner,
        bool hasOperator
    ) internal virtual {
        if (hasOperator) {
            _owners[_storageId(id)] = (oldData & NOT_ADDRESS) | OPERATOR_FLAG | uint256(uint160(newOwner));
        } else {
            _owners[_storageId(id)] = ((oldData & NOT_ADDRESS) & NOT_OPERATOR_FLAG) | uint256(uint160(newOwner));
        }
    }

    function _transferFrom(
        address from,
        address to,
        uint256 id
    ) internal {
        _numNFTPerAddress[from]--;
        _numNFTPerAddress[to]++;
        _updateOwnerData(id, _owners[_storageId(id)], to, false);
        emit Transfer(from, to, id);
    }

    /// @dev See approveFor.
    function _approveFor(
        uint256 ownerData,
        address operator,
        uint256 id
    ) internal {
        address owner = _ownerOf(id);
        if (operator == address(0)) {
            _updateOwnerData(id, ownerData, owner, false);
        } else {
            _updateOwnerData(id, ownerData, owner, true);
            _operators[id] = operator;
        }
        emit Approval(owner, operator, id);
    }

    /// @dev See batchTransferFrom.
    function _batchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        bytes memory data,
        bool safe
    ) internal {
        address msgSender = _msgSender();
        bool authorized = msgSender == from || _operatorsForAll[from][msgSender] || _superOperators[msgSender];

        require(from != address(0), "NOT_FROM_ZEROADDRESS");
        require(to != address(0), "NOT_TO_ZEROADDRESS");

        uint256 numTokens = ids.length;
        for (uint256 i = 0; i < numTokens; i++) {
            uint256 id = ids[i];
            (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);
            require(owner == from, "BATCHTRANSFERFROM_NOT_OWNER");
            require(authorized || (operatorEnabled && _operators[id] == msgSender), "NOT_AUTHORIZED");
            _updateOwnerData(id, _owners[_storageId(id)], to, false);
            emit Transfer(from, to, id);
        }
        if (from != to) {
            _numNFTPerAddress[from] -= numTokens;
            _numNFTPerAddress[to] += numTokens;
        }

        if (to.isContract()) {
            if (_checkInterfaceWith10000Gas(to, ERC721_MANDATORY_RECEIVER)) {
                require(_checkOnERC721BatchReceived(msgSender, from, to, ids, data), "ERC721_BATCH_RECEIVED_REJECTED");
            } else if (safe) {
                for (uint256 i = 0; i < numTokens; i++) {
                    require(_checkOnERC721Received(msgSender, from, to, ids[i], data), "ERC721_RECEIVED_REJECTED");
                }
            }
        }
    }

    /// @dev See setApprovalForAll.
    function _setApprovalForAll(
        address sender,
        address operator,
        bool approved
    ) internal {
        require(!_superOperators[operator], "INVALID_APPROVAL_CHANGE");
        _operatorsForAll[sender][operator] = approved;

        emit ApprovalForAll(sender, operator, approved);
    }

    /// @dev See burn.
    function _burn(
        address from,
        address owner,
        uint256 id
    ) internal {
        require(from == owner, "NOT_OWNER");
        uint256 storageId = _storageId(id);
        _owners[storageId] = (_owners[storageId] & NOT_OPERATOR_FLAG) | BURNED_FLAG; // record as non owner but keep track of last owner
        _numNFTPerAddress[from]--;
        emit Transfer(from, address(0), id);
    }

    /// @dev Check if receiving contract accepts erc721 transfers.
    /// @param operator The address of the operator.
    /// @param from The from address, may be different from msg.sender.
    /// @param to The adddress we want to transfer to.
    /// @param tokenId The id of the token we would like to transfer.
    /// @param _data Any additional data to send with the transfer.
    /// @return Whether the expected value of 0x150b7a02 is returned.
    function _checkOnERC721Received(
        address operator,
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal returns (bool) {
        bytes4 retval = IERC721ReceiverUpgradeable(to).onERC721Received(operator, from, tokenId, _data);
        return (retval == _ERC721_RECEIVED);
    }

    /// @dev Check if receiving contract accepts erc721 batch transfers.
    /// @param operator The address of the operator.
    /// @param from The from address, may be different from msg.sender.
    /// @param to The adddress we want to transfer to.
    /// @param ids The ids of the tokens we would like to transfer.
    /// @param _data Any additional data to send with the transfer.
    /// @return Whether the expected value of 0x4b808c46 is returned.
    function _checkOnERC721BatchReceived(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        bytes memory _data
    ) internal returns (bool) {
        bytes4 retval = IERC721MandatoryTokenReceiver(to).onERC721BatchReceived(operator, from, ids, _data);
        return (retval == _ERC721_BATCH_RECEIVED);
    }

    /// @dev See ownerOf
    function _ownerOf(uint256 id) internal view virtual returns (address) {
        uint256 data = _owners[_storageId(id)];
        if ((data & BURNED_FLAG) == BURNED_FLAG) {
            return address(0);
        }
        return address(uint160(data));
    }

    /// @dev Get the owner and operatorEnabled status of a token.
    /// @param id The token to query.
    /// @return owner The owner of the token.
    /// @return operatorEnabled Whether or not operators are enabled for this token.
    function _ownerAndOperatorEnabledOf(uint256 id)
        internal
        view
        virtual
        returns (address owner, bool operatorEnabled)
    {
        uint256 data = _owners[_storageId(id)];
        if ((data & BURNED_FLAG) == BURNED_FLAG) {
            owner = address(0);
        } else {
            owner = address(uint160(data));
        }
        operatorEnabled = (data & OPERATOR_FLAG) == OPERATOR_FLAG;
    }

    /// @dev Check whether a transfer is a meta Transaction or not.
    /// @param from The address who initiated the transfer (may differ from msg.sender).
    /// @param to The address recieving the token.
    /// @param id The token being transferred.
    /// @return isMetaTx Whether or not the transaction is a MetaTx.
    function _checkTransfer(
        address from,
        address to,
        uint256 id
    ) internal view returns (bool isMetaTx) {
        (address owner, bool operatorEnabled) = _ownerAndOperatorEnabledOf(id);
        address msgSender = _msgSender();
        require(owner != address(0), "NONEXISTENT_TOKEN");
        require(owner == from, "CHECKTRANSFER_NOT_OWNER");
        require(to != address(0), "NOT_TO_ZEROADDRESS");
        require(
            msgSender == owner ||
                _superOperators[msgSender] ||
                _operatorsForAll[from][msgSender] ||
                (operatorEnabled && _operators[id] == msgSender),
            "UNAUTHORIZED_TRANSFER"
        );
        return true;
    }

    /// @dev Check if there was enough gas.
    /// @param _contract The address of the contract to check.
    /// @param interfaceId The id of the interface we want to test.
    /// @return Whether or not this check succeeded.
    function _checkInterfaceWith10000Gas(address _contract, bytes4 interfaceId) internal view returns (bool) {
        bool success;
        bool result;
        bytes memory callData = abi.encodeWithSelector(ERC165ID, interfaceId);
        // solhint-disable-next-line no-inline-assembly
        assembly {
            let call_ptr := add(0x20, callData)
            let call_size := mload(callData)
            let output := mload(0x40) // Find empty storage location using "free memory pointer"
            mstore(output, 0x0)
            success := staticcall(10000, _contract, call_ptr, call_size, output, 0x20) // 32 bytes
            result := mload(output)
        }
        // (10000 / 63) "not enough for supportsInterface(...)" // consume all gas, so caller can potentially know that there was not enough gas
        assert(gasleft() > 158);
        return success && result;
    }
}

File 8 of 16 : IPolygonLand.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

import "./ILandToken.sol";

interface IPolygonLand is ILandToken {
    function mintQuad(
        address user,
        uint256 size,
        uint256 x,
        uint256 y,
        bytes memory data
    ) external;

    function exists(
        uint256 size,
        uint256 x,
        uint256 y
    ) external view returns (bool);
}

File 9 of 16 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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 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 10 of 16 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 IERC721ReceiverUpgradeable {
    /**
     * @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 11 of 16 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @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 12 of 16 : WithSuperOperatorsV2.sol
//SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.2;

import "./WithAdminV2.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

contract WithSuperOperatorsV2 is ContextUpgradeable, WithAdminV2 {
    mapping(address => bool) internal _superOperators;

    event SuperOperator(address indexed superOperator, bool indexed enabled);

    /// @notice Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights).
    /// @param superOperator address that will be given/removed superOperator right.
    /// @param enabled set whether the superOperator is enabled or disabled.
    function setSuperOperator(address superOperator, bool enabled) external {
        require(_msgSender() == _admin, "only admin is allowed to add super operators");
        _superOperators[superOperator] = enabled;
        emit SuperOperator(superOperator, enabled);
    }

    /// @notice check whether address `who` is given superOperator rights.
    /// @param who The address to query.
    /// @return whether the address has superOperator rights.
    function isSuperOperator(address who) public view returns (bool) {
        return _superOperators[who];
    }
}

File 13 of 16 : IERC721MandatoryTokenReceiver.sol
//SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.2;

/// @dev Note: The ERC-165 identifier for this interface is 0x5e8bf644.
interface IERC721MandatoryTokenReceiver {
    function onERC721BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        bytes calldata data
    ) external returns (bytes4); // needs to return 0x4b808c46

    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4); // needs to return 0x150b7a02
}

File 14 of 16 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 15 of 16 : WithAdminV2.sol
//SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity 0.8.2;

import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

contract WithAdminV2 is ContextUpgradeable {
    address internal _admin;

    /// @dev Emits when the contract administrator is changed.
    /// @param oldAdmin The address of the previous administrator.
    /// @param newAdmin The address of the new administrator.
    event AdminChanged(address indexed oldAdmin, address indexed newAdmin);

    modifier onlyAdmin() {
        require(_msgSender() == _admin, "ADMIN_ONLY");
        _;
    }

    /// @dev Get the current administrator of this contract.
    /// @return The current administrator of this contract.
    function getAdmin() external view returns (address) {
        return _admin;
    }

    /// @dev Change the administrator to be `newAdmin`.
    /// @param newAdmin The address of the new administrator.
    function changeAdmin(address newAdmin) external {
        address admin = _admin;
        require(_msgSender() == admin, "ADMIN_ACCESS_DENIED");
        emit AdminChanged(admin, newAdmin);
        _admin = newAdmin;
    }
}

File 16 of 16 : ILandToken.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

interface ILandToken {
    function batchTransferQuad(
        address from,
        address to,
        uint256[] calldata sizes,
        uint256[] calldata xs,
        uint256[] calldata ys,
        bytes calldata data
    ) external;

    function transferQuad(
        address from,
        address to,
        uint256 size,
        uint256 x,
        uint256 y,
        bytes calldata data
    ) external;

    function batchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        bytes calldata data
    ) external;
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"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":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"Minter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"superOperator","type":"address"},{"indexed":true,"internalType":"bool","name":"enabled","type":"bool"}],"name":"SuperOperator","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"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approveFor","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":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"batchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"sizes","type":"uint256[]"},{"internalType":"uint256[]","name":"xs","type":"uint256[]"},{"internalType":"uint256[]","name":"ys","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"batchTransferQuad","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTrustedForwarder","outputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"height","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"isOperator","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"who","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"who","type":"address"}],"name":"isSuperOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"mintQuad","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","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":"id","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":"sender","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAllFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"superOperator","type":"address"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setSuperOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"id","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"size","type":"uint256"},{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"transferQuad","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"width","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}]

608060405234801561001057600080fd5b5061506d806100206000396000f3fe608060405234801561001057600080fd5b50600436106102775760003560e01c806370a0823111610160578063ac9fe421116100d8578063cf456ae71161008c578063e985e9c511610071578063e985e9c514610582578063eaa5e06714610595578063eeb5a5d1146105a857610277565b8063cf456ae71461055c578063da7422281461056f57610277565b8063c4d66de8116100bd578063c4d66de814610525578063c87b56dd14610538578063ce1b815f1461054b57610277565b8063ac9fe421146104ff578063b88d4fde1461051257610277565b80638f2839701161012f5780639ededf77116101145780639ededf77146102f9578063a22cb465146104c0578063aa271e1a146104d357610277565b80638f2839701461047457806395d89b411461048757610277565b806370a082311461042857806379cc67901461043b578063845a46971461044e5780638e5cb5f61461046157610277565b806338bb305a116101f3578063572b6c05116101c2578063654b748a116101a7578063654b748a146103d85780636e1e3bbf146104045780636e9960c31461041757610277565b8063572b6c05146103a35780636352211e146103c557610277565b806338bb305a1461035757806342842e0e1461036a57806342966c681461037d57806355064d851461039057610277565b80630ef267431161024a57806323b872dd1161022f57806323b872dd1461031e57806328cfbd46146103315780632b9917461461034457610277565b80630ef26743146102f957806315ddc5351461030b57610277565b806301ffc9a71461027c57806306fdde03146102a4578063081812fc146102b9578063095ea7b3146102e4575b600080fd5b61028f61028a366004614d4a565b6105bb565b60405190151581526020015b60405180910390f35b6102ac61065a565b60405161029b9190614ef8565b6102cc6102c7366004614d82565b610692565b6040516001600160a01b03909116815260200161029b565b6102f76102f2366004614cb8565b610731565b005b6101985b60405190815260200161029b565b6102f7610319366004614a9e565b610874565b6102f761032c366004614b6e565b61088a565b6102f761033f366004614a9e565b61093f565b6102f7610352366004614b6e565b6109b4565b6102f7610365366004614c0f565b610ba7565b6102f7610378366004614b6e565b610dff565b6102f761038b366004614d82565b610e1a565b61028f61039e366004614d9a565b610e37565b61028f6103b136600461496f565b606b546001600160a01b0390811691161490565b6102cc6103d3366004614d82565b6113ac565b61028f6103e636600461496f565b6001600160a01b031660009081526034602052604090205460ff1690565b6102f7610412366004614ce1565b61140f565b6033546001600160a01b03166102cc565b6102fd61043636600461496f565b611473565b6102f7610449366004614cb8565b6114e7565b6102fd61045c366004614d82565b611644565b6102fd61046f366004614d82565b6116b3565b6102f761048236600461496f565b611722565b60408051808201909152600481527f4c414e440000000000000000000000000000000000000000000000000000000060208201526102ac565b6102f76104ce366004614c8f565b6117fd565b61028f6104e136600461496f565b6001600160a01b031660009081526039602052604090205460ff1690565b6102f761050d366004614c8f565b611813565b6102f7610520366004614ba9565b6118f7565b6102f761053336600461496f565b611984565b6102ac610546366004614d82565b611a99565b606b546001600160a01b03166102cc565b6102f761056a366004614c8f565b611b2c565b6102f761057d36600461496f565b611c74565b61028f610590366004614989565b611d0d565b6102f76105a33660046149bb565b611d64565b6102f76105b6366004614b2c565b6122cc565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316148061061e57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061065257507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b60408051808201909152600f81527f53616e64626f782773204c414e4473000000000000000000000000000000000060208201525b90565b60008060006106a0846123bd565b90925090506001600160a01b0382166107005760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064015b60405180910390fd5b8015610726575050506000818152603860205260409020546001600160a01b0316610655565b600092505050610655565b6000818152603660205260408120549061074a836126a4565b9050600061075661296d565b90506001600160a01b0382166107ae5760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b806001600160a01b0316826001600160a01b031614806107f357506001600160a01b0380831660009081526037602090815260408083209385168352929052205460ff165b8061081657506001600160a01b03811660009081526034602052604090205460ff165b6108625760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c000000000000000000000060448201526064016106f7565b61086d83868661297c565b5050505050565b610882868686868686612a32565b505050505050565b610895838383612aa4565b506108a1838383612cbe565b6001600160a01b0382163b151580156108c657506108c6826317a2fd9160e21b612d7c565b1561093a576108ee6108d661296d565b84848460405180602001604052806000815250612e43565b61093a5760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a4543544544000000000000000060448201526064016106f7565b505050565b610882868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525060019250612f03915050565b600081815260366020526040812054906109cd836126a4565b905060006109d961296d565b90506001600160a01b038616610a315760405162461bcd60e51b815260206004820152601360248201527f5a45524f5f414444524553535f53454e4445520000000000000000000000000060448201526064016106f7565b6001600160a01b038216610a875760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b856001600160a01b0316816001600160a01b03161480610acc57506001600160a01b0380871660009081526037602090815260408083209385168352929052205460ff165b80610aef57506001600160a01b03811660009081526034602052604090205460ff165b610b3b5760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f415050524f56414c000000000000000000000060448201526064016106f7565b856001600160a01b0316836001600160a01b031614610b9c5760405162461bcd60e51b815260206004820152601060248201527f4f574e45525f4e4f545f53454e4445520000000000000000000000000000000060448201526064016106f7565b61088283868661297c565b6001600160a01b038716610bfd5760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f206164647265737300000000000000000000000060448201526064016106f7565b6001600160a01b038616610c535760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f206164647265737300000000000060448201526064016106f7565b866001600160a01b0316610c6561296d565b6001600160a01b031614610d2d576001600160a01b038716600090815260376020526040812090610c9461296d565b6001600160a01b0316815260208101919091526040016000205460ff1680610ce1575060346000610cc361296d565b6001600160a01b0316815260208101919091526040016000205460ff165b610d2d5760405162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420746f207472616e7366657251756164000060448201526064016106f7565b610d3a8787878787613366565b610d448580614f37565b6001600160a01b03881660009081526035602052604081208054909190610d6c908490614f56565b90915550610d7c90508580614f37565b6001600160a01b03871660009081526035602052604081208054909190610da4908490614f0b565b90915550610df69050610db561296d565b888888888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061364792505050565b50505050505050565b61093a838383604051806020016040528060008152506118f7565b610e34610e2561296d565b610e2e836126a4565b836137ab565b50565b60008383838260011480610e4b5750826003145b80610e565750826006145b80610e61575082600c145b80610e6c5750826018145b610eb85760405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b610ec28383614fcb565b158015610ed65750610ed48382614fcb565b155b610f225760405162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e617465730000000000000000000000000060448201526064016106f7565b610f2e83610198614f56565b8211158015610f485750610f4483610198614f56565b8111155b610f945760405162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e64730000000000000000000000000000000000000060448201526064016106f7565b60366000610198610fa6601889614f23565b610fb1906018614f37565b610fbb9190614f37565b610fc660188a614f23565b610fd1906018614f37565b610fdf90600160fa1b614f0b565b610fe99190614f0b565b81526020019081526020016000205460001461100857600193506113a2565b60006110148888614f0b565b905060006110228988614f0b565b9050600c89116110a7576036600061019861103e600c8b614f23565b61104990600c614f37565b6110539190614f37565b61105e600c8c614f23565b61106990600c614f37565b61107790600360f81b614f0b565b6110819190614f0b565b8152602001908152602001600020546000146110a2576001955050506113a2565b61112e565b875b8281101561112c57875b828110156111195760006110c961019883614f37565b6110d784600360f81b614f0b565b6110e19190614f0b565b60008181526036602052604090205490915015611106576001985050505050506113a2565b50611112600c82614f0b565b90506110b3565b50611125600c82614f0b565b90506110a9565b505b600689116111b1576036600061019861114860068b614f23565b611153906006614f37565b61115d9190614f37565b61116860068c614f23565b611173906006614f37565b61118190600160f91b614f0b565b61118b9190614f0b565b8152602001908152602001600020546000146111ac576001955050506113a2565b611238565b875b8281101561123657875b828110156112235760006111d361019883614f37565b6111e184600160f91b614f0b565b6111eb9190614f0b565b60008181526036602052604090205490915015611210576001985050505050506113a2565b5061121c600682614f0b565b90506111bd565b5061122f600682614f0b565b90506111b3565b505b600389116112bb576036600061019861125260038b614f23565b61125d906003614f37565b6112679190614f37565b61127260038c614f23565b61127d906003614f37565b61128b90600160f81b614f0b565b6112959190614f0b565b8152602001908152602001600020546000146112b6576001955050506113a2565b611342565b875b8281101561134057875b8281101561132d5760006112dd61019883614f37565b6112eb84600160f81b614f0b565b6112f59190614f0b565b6000818152603660205260409020549091501561131a576001985050505050506113a2565b50611326600382614f0b565b90506112c7565b50611339600382614f0b565b90506112bd565b505b60005b61134f8a80614f37565b81101561139a5760366000611366838d8d8d6138a2565b81526020019081526020016000205460001461138857600196505050506113a2565b8061139281614fb0565b915050611345565b506000955050505b5050509392505050565b60006113b7826126a4565b90506001600160a01b0381166106555760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354414e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b61141a6104e161296d565b6114665760405162461bcd60e51b815260206004820152600b60248201527f21415554484f52495a454400000000000000000000000000000000000000000060448201526064016106f7565b61086d8585858585613945565b60006001600160a01b0382166114cb5760405162461bcd60e51b815260206004820152601260248201527f5a45524f5f414444524553535f4f574e4552000000000000000000000000000060448201526064016106f7565b506001600160a01b031660009081526035602052604090205490565b6001600160a01b03821661153d5760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f4144445245535300000000000000000000000060448201526064016106f7565b600080611549836123bd565b91509150600061155761296d565b9050846001600160a01b0316816001600160a01b0316148061159a575081801561159a57506000848152603860205260409020546001600160a01b038281169116145b806115bd57506001600160a01b03811660009081526034602052604090205460ff165b806115ed57506001600160a01b0380861660009081526037602090815260408083209385168352929052205460ff165b6116395760405162461bcd60e51b815260206004820152601160248201527f554e415554484f52495a45445f4255524e00000000000000000000000000000060448201526064016106f7565b61086d8584866137ab565b600080611650836126a4565b6001600160a01b031614156116a75760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b61065261019883614f23565b6000806116bf836126a4565b6001600160a01b031614156117165760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b61065261019883614fcb565b6033546001600160a01b03168061173761296d565b6001600160a01b03161461178d5760405162461bcd60e51b815260206004820152601360248201527f41444d494e5f4143434553535f44454e4945440000000000000000000000000060448201526064016106f7565b816001600160a01b0316816001600160a01b03167f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f60405160405180910390a3506033805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61180f61180861296d565b8383613b57565b5050565b6033546001600160a01b031661182761296d565b6001600160a01b0316146118a35760405162461bcd60e51b815260206004820152602c60248201527f6f6e6c792061646d696e20697320616c6c6f77656420746f206164642073757060448201527f6572206f70657261746f7273000000000000000000000000000000000000000060648201526084016106f7565b6001600160a01b038216600081815260346020526040808220805460ff191685151590811790915590519092917f44f92d27abdf4cfb6a7d712c3af68f3be086d4ca747ab802c36f67d6790060d891a35050565b611902848484612aa4565b5061190e848484612cbe565b6001600160a01b0383163b1561197e5761193261192961296d565b85858585612e43565b61197e5760405162461bcd60e51b815260206004820152601860248201527f4552433732315f5452414e534645525f52454a4543544544000000000000000060448201526064016106f7565b50505050565b600054610100900460ff1661199f5760005460ff16156119a3565b303b155b611a155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016106f7565b600054610100900460ff16158015611a40576000805460ff1961ff0019909116610100171660011790555b611a4861296d565b6033805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b0393841617909155606b8054909116918416919091179055801561180f576000805461ff00191690555050565b60606000611aa6836126a4565b6001600160a01b03161415611afd5760405162461bcd60e51b815260206004820152601160248201527f496420646f6573206e6f7420657869737400000000000000000000000000000060448201526064016106f7565b611b0682613c2d565b604051602001611b169190614df1565b6040516020818303038152906040529050919050565b6033546001600160a01b0316611b4061296d565b6001600160a01b031614611bbb5760405162461bcd60e51b8152602060048201526024808201527f6f6e6c792061646d696e20697320616c6c6f77656420746f20616464206d696e60448201527f746572730000000000000000000000000000000000000000000000000000000060648201526084016106f7565b6001600160a01b038216611c115760405162461bcd60e51b815260206004820152601c60248201527f506f6c79676f6e4c616e643a20496e76616c696420616464726573730000000060448201526064016106f7565b6001600160a01b038216600081815260396020908152604091829020805460ff19168515159081179091558251938452908301527fff452b3b9159b024a9098f0058c63eccd90d36b3584608202800d662f962bb60910160405180910390a15050565b6033546001600160a01b0316611c8861296d565b6001600160a01b031614611cde5760405162461bcd60e51b815260206004820152600a60248201527f41444d494e5f4f4e4c590000000000000000000000000000000000000000000060448201526064016106f7565b606b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b03808316600090815260376020908152604080832093851683529290529081205460ff1680611d5b57506001600160a01b03821660009081526034602052604090205460ff165b90505b92915050565b6001600160a01b038a16611dba5760405162461bcd60e51b815260206004820152601460248201527f66726f6d206973207a65726f206164647265737300000000000000000000000060448201526064016106f7565b6001600160a01b038916611e105760405162461bcd60e51b815260206004820152601a60248201527f63616e27742073656e6420746f207a65726f206164647265737300000000000060448201526064016106f7565b8685148015611e1e57508483145b611e6a5760405162461bcd60e51b815260206004820152600c60248201527f696e76616c69642064617461000000000000000000000000000000000000000060448201526064016106f7565b896001600160a01b0316611e7c61296d565b6001600160a01b031614611f69576001600160a01b038a16600090815260376020526040812090611eab61296d565b6001600160a01b0316815260208101919091526040016000205460ff1680611ef8575060346000611eda61296d565b6001600160a01b0316815260208101919091526040016000205460ff165b611f695760405162461bcd60e51b8152602060048201526024808201527f6e6f7420617574686f72697a656420746f207472616e736665724d756c74695160448201527f756164730000000000000000000000000000000000000000000000000000000060648201526084016106f7565b6000805b888110156120235760008a8a83818110611f9757634e487b7160e01b600052603260045260246000fd5b905060200201359050611ff98d8d838c8c87818110611fc657634e487b7160e01b600052603260045260246000fd5b905060200201358b8b88818110611fed57634e487b7160e01b600052603260045260246000fd5b90506020020135613366565b6120038180614f37565b61200d9084614f0b565b925050808061201b90614fb0565b915050611f6d565b506001600160a01b038b166000908152603560205260408120805483929061204c908490614f56565b90915550506001600160a01b038a1660009081526035602052604081208054839290612079908490614f0b565b90915550506001600160a01b038a163b151580156120a357506120a38a6317a2fd9160e21b612d7c565b156122bf5760008167ffffffffffffffff8111156120d157634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156120fa578160200160208202803683370190505b5090506000805b8a8110156122005760008c8c8381811061212b57634e487b7160e01b600052603260045260246000fd5b90506020020135905060005b6121418280614f37565b8110156121eb576121a081838e8e8781811061216d57634e487b7160e01b600052603260045260246000fd5b905060200201358d8d8881811061219457634e487b7160e01b600052603260045260246000fd5b905060200201356138a2565b8585815181106121c057634e487b7160e01b600052603260045260246000fd5b6020908102919091010152836121d581614fb0565b94505080806121e390614fb0565b915050612137565b505080806121f890614fb0565b915050612101565b5061224b61220c61296d565b8e8e8589898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613d7c92505050565b6122bc5760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a6563746564206260448201527f7920746f0000000000000000000000000000000000000000000000000000000060648201526084016106f7565b50505b5050505050505050505050565b6001600160a01b0383166123225760405162461bcd60e51b815260206004820152601660248201527f496e76616c69642073656e64657220616464726573730000000000000000000060448201526064016106f7565b600061232c61296d565b9050836001600160a01b0316816001600160a01b0316148061236657506001600160a01b03811660009081526034602052604090205460ff165b6123b25760405162461bcd60e51b815260206004820152601c60248201527f554e415554484f52495a45445f415050524f56455f464f525f414c4c0000000060448201526064016106f7565b61197e848484613b57565b6000807fff000000000000000000000000000000000000000000000000000000000000008316156124305760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016106f7565b600061243e61019885614fcb565b9050600061244e61019886614f23565b600086815260366020526040902054909150600160a01b80821614156124855760009450600160ff1b80821614935050505061269f565b801561249e57809450600160ff1b80821614935061269b565b60006036816101986124b1600387614f23565b6124bc906003614f37565b6124c69190614f37565b6124d1600388614f23565b6124dc906003614f37565b6124ea90600160f81b614f0b565b6124f49190614f0b565b815260208101919091526040016000205490506001600160a01b038116156125225780955060009450612699565b6000603681610198612535600688614f23565b612540906006614f37565b61254a9190614f37565b612555600689614f23565b612560906006614f37565b61256e90600160f91b614f0b565b6125789190614f0b565b815260208101919091526040016000205490506001600160a01b038116156125a65780965060009550612697565b60006036816101986125b9600c89614f23565b6125c490600c614f37565b6125ce9190614f37565b6125d9600c8a614f23565b6125e490600c614f37565b6125f290600360f81b614f0b565b6125fc9190614f0b565b815260208101919091526040016000205490506001600160a01b0381161561262a5780975060009650612695565b6036600061019861263c601889614f23565b612647906018614f37565b6126519190614f37565b61265c60188a614f23565b612667906018614f37565b61267590600160fa1b614f0b565b61267f9190614f0b565b8152602001908152602001600020549750600096505b505b505b505b5050505b915091565b60007fff000000000000000000000000000000000000000000000000000000000000008216156127165760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016106f7565b600061272461019884614fcb565b9050600061273461019885614f23565b600085815260366020526040902054909150600160a01b80821614156127605760009350505050610655565b8015612770579250610655915050565b6000603681610198612783600387614f23565b61278e906003614f37565b6127989190614f37565b6127a3600388614f23565b6127ae906003614f37565b6127bc90600160f81b614f0b565b6127c69190614f0b565b815260208101919091526040016000205490506001600160a01b038116156127f357935061065592505050565b6000603681610198612806600688614f23565b612811906006614f37565b61281b9190614f37565b612826600689614f23565b612831906006614f37565b61283f90600160f91b614f0b565b6128499190614f0b565b815260208101919091526040016000205490506001600160a01b038116156128775794506106559350505050565b600060368161019861288a600c89614f23565b61289590600c614f37565b61289f9190614f37565b6128aa600c8a614f23565b6128b590600c614f37565b6128c390600360f81b614f0b565b6128cd9190614f0b565b815260208101919091526040016000205490506001600160a01b038116156128fc579550610655945050505050565b6036600061019861290e601889614f23565b612919906018614f37565b6129239190614f37565b61292e60188a614f23565b612939906018614f37565b61294790600160fa1b614f0b565b6129519190614f0b565b8152602001908152602001600020549650505050505050610655565b6000612977613e3b565b905090565b6000612987826126a4565b90506001600160a01b0383166129a9576129a48285836000613e85565b6129eb565b6129b68285836001613e85565b6000828152603860205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385161790555b81836001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a450505050565b610882868686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201829052509250612f03915050565b6000806000612ab2846123bd565b915091506000612ac061296d565b90506001600160a01b038316612b185760405162461bcd60e51b815260206004820152601160248201527f4e4f4e4558495354454e545f544f4b454e00000000000000000000000000000060448201526064016106f7565b866001600160a01b0316836001600160a01b031614612b795760405162461bcd60e51b815260206004820152601760248201527f434845434b5452414e534645525f4e4f545f4f574e455200000000000000000060448201526064016106f7565b6001600160a01b038616612bcf5760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f41444452455353000000000000000000000000000060448201526064016106f7565b826001600160a01b0316816001600160a01b03161480612c0757506001600160a01b03811660009081526034602052604090205460ff165b80612c3757506001600160a01b0380881660009081526037602090815260408083209385168352929052205460ff165b80612c635750818015612c6357506000858152603860205260409020546001600160a01b038281169116145b612caf5760405162461bcd60e51b815260206004820152601560248201527f554e415554484f52495a45445f5452414e53464552000000000000000000000060448201526064016106f7565b600193505050505b9392505050565b6001600160a01b0383166000908152603560205260408120805491612ce283614f99565b90915550506001600160a01b0382166000908152603560205260408120805491612d0b83614fb0565b9190505550612d368160366000612d1f8590565b815260200190815260200160002054846000613e85565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b604080516001600160e01b031983166024808301919091528251808303909101815260449091018252602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001781528251935160008082529485948594909392908183858c612710fa955080519450505050609e5a11612e2f57634e487b7160e01b600052600160045260246000fd5b828015612e395750815b9695505050505050565b600080846001600160a01b031663150b7a02888887876040518563ffffffff1660e01b8152600401612e789493929190614ec6565b602060405180830381600087803b158015612e9257600080fd5b505af1158015612ea6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eca9190614d66565b6001600160e01b0319167f150b7a0200000000000000000000000000000000000000000000000000000000149150505b95945050505050565b6000612f0d61296d565b90506000866001600160a01b0316826001600160a01b03161480612f5657506001600160a01b0380881660009081526037602090815260408083209386168352929052205460ff165b80612f7957506001600160a01b03821660009081526034602052604090205460ff165b90506001600160a01b038716612fd15760405162461bcd60e51b815260206004820152601460248201527f4e4f545f46524f4d5f5a45524f4144445245535300000000000000000000000060448201526064016106f7565b6001600160a01b0386166130275760405162461bcd60e51b815260206004820152601260248201527f4e4f545f544f5f5a45524f41444452455353000000000000000000000000000060448201526064016106f7565b845160005b818110156131be57600087828151811061305657634e487b7160e01b600052603260045260246000fd5b6020026020010151905060008061306c836123bd565b915091508b6001600160a01b0316826001600160a01b0316146130d15760405162461bcd60e51b815260206004820152601b60248201527f42415443485452414e5346455246524f4d5f4e4f545f4f574e4552000000000060448201526064016106f7565b85806130fe57508080156130fe57506000838152603860205260409020546001600160a01b038881169116145b61314a5760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a454400000000000000000000000000000000000060448201526064016106f7565b600083815260366020526040812054613167918591908e90613e85565b828b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505080806131b690614fb0565b91505061302c565b50866001600160a01b0316886001600160a01b031614613233576001600160a01b03881660009081526035602052604081208054839290613200908490614f56565b90915550506001600160a01b0387166000908152603560205260408120805483929061322d908490614f0b565b90915550505b6001600160a01b0387163b1561335c57613254876317a2fd9160e21b612d7c565b156132b7576132668389898989613d7c565b6132b25760405162461bcd60e51b815260206004820152601e60248201527f4552433732315f42415443485f52454345495645445f52454a4543544544000060448201526064016106f7565b61335c565b831561335c5760005b8181101561335a576132fc848a8a8a85815181106132ee57634e487b7160e01b600052603260045260246000fd5b60200260200101518a612e43565b6133485760405162461bcd60e51b815260206004820152601860248201527f4552433732315f52454345495645445f52454a4543544544000000000000000060448201526064016106f7565b8061335281614fb0565b9150506132c0565b505b5050505050505050565b82828282600114806133785750826003145b806133835750826006145b8061338e575082600c145b806133995750826018145b6133e55760405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b6133ef8383614fcb565b15801561340357506134018382614fcb565b155b61344f5760405162461bcd60e51b815260206004820152601360248201527f496e76616c696420636f6f7264696e617465730000000000000000000000000060448201526064016106f7565b61345b83610198614f56565b8211158015613475575061347183610198614f56565b8111155b6134c15760405162461bcd60e51b815260206004820152600d60248201527f4f7574206f6620626f756e64730000000000000000000000000000000000000060448201526064016106f7565b85600114156135c85760006134d861019886614f37565b6134e29087614f0b565b905060006134ef826126a4565b90506001600160a01b0381166135475760405162461bcd60e51b815260206004820152601460248201527f746f6b656e20646f6573206e6f7420657869737400000000000000000000000060448201526064016106f7565b896001600160a01b0316816001600160a01b0316146135a85760405162461bcd60e51b815260206004820152601a60248201527f6e6f74206f776e657220696e205f7472616e736665725175616400000000000060448201526064016106f7565b5060009081526036602052604090206001600160a01b03881690556135d5565b6135d58888888888613f18565b60005b6135e28780614f37565b81101561335a576135f5818888886138a2565b886001600160a01b03168a6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48061363f81614fb0565b9150506135d8565b6001600160a01b0385163b1515801561366c575061366c856317a2fd9160e21b612d7c565b15610df657600061367d8580614f37565b67ffffffffffffffff8111156136a357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156136cc578160200160208202803683370190505b50905060005b6136dc8680614f37565b81101561372c576136ef818787876138a2565b82828151811061370f57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061372481614fb0565b9150506136d2565b5061373a8888888486613d7c565b61335c5760405162461bcd60e51b8152602060048201526024808201527f657263373231206261746368207472616e736665722072656a6563746564206260448201527f7920746f0000000000000000000000000000000000000000000000000000000060648201526084016106f7565b816001600160a01b0316836001600160a01b03161461380c5760405162461bcd60e51b815260206004820152600960248201527f4e4f545f4f574e4552000000000000000000000000000000000000000000000060448201526064016106f7565b80600160a01b6138216001600160ff1b614f56565b6000838152603660209081526040808320805494909416949094179092556001600160a01b0387168152603590915290812080549161385f83614f99565b909155505060405182906000906001600160a01b038716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a450505050565b6000806138af8587614f23565b90506138bc600282614fcb565b6138fd576101986138cd8285614f0b565b6138d79190614f37565b6138e18688614fcb565b6138eb9086614f0b565b6138f59190614f0b565b91505061393d565b61019861390a8285614f0b565b6139149190614f37565b61391e8688614fcb565b613929906001614f0b565b6139338787614f0b565b6138eb9190614f56565b949350505050565b6001600160a01b03851661399b5760405162461bcd60e51b815260206004820152601260248201527f746f206973207a65726f2061646472657373000000000000000000000000000060448201526064016106f7565b6139a6848484610e37565b156139f35760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e74656400000000000000000000000000000000000060448201526064016106f7565b600080613a0261019885614f37565b613a0c9086614f0b565b90508560011415613a1f57809150613a85565b8560031415613a3d57613a3681600160f81b614f0b565b9150613a85565b8560061415613a5457613a3681600160f91b614f0b565b85600c1415613a6b57613a3681600360f81b614f0b565b8560181415613a8557613a8281600160fa1b614f0b565b91505b60005b613a928780614f37565b811015613aed57613aa5818888886138a2565b6040516001600160a01b038a16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480613ae581614fb0565b915050613a88565b5060008281526036602052604090206001600160a01b0388169055613b128680614f37565b6001600160a01b03881660009081526035602052604081208054909190613b3a908490614f0b565b90915550610df69050613b4b61296d565b60008989898989613647565b6001600160a01b03821660009081526034602052604090205460ff1615613bc05760405162461bcd60e51b815260206004820152601760248201527f494e56414c49445f415050524f56414c5f4348414e474500000000000000000060448201526064016106f7565b6001600160a01b03838116600081815260376020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b606081613c6e575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610655565b8160005b8115613c985780613c8281614fb0565b9150613c919050600a83614f23565b9150613c72565b60008167ffffffffffffffff811115613cc157634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613ceb576020820181803683370190505b5090505b841561393d57613d00600183614f56565b9150613d0d600a86614fcb565b613d18906030614f0b565b60f81b818381518110613d3b57634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613d75600a86614f23565b9450613cef565b600080846001600160a01b0316634b808c46888887876040518563ffffffff1660e01b8152600401613db19493929190614e5d565b602060405180830381600087803b158015613dcb57600080fd5b505af1158015613ddf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e039190614d66565b6001600160e01b0319167f4b808c46000000000000000000000000000000000000000000000000000000001491505095945050505050565b606b546000906001600160a01b0316331415613e7e57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c61068f565b503361068f565b8015613ec9576000848152603660205260409020600160ff1b6001600160a01b03841673ffffffffffffffffffffffffffffffffffffffff1986161717905561197e565b6001600160a01b038216613ee26001600160ff1b614f56565b841673ffffffffffffffffffffffffffffffffffffffff1916176036600086815260208101919091526040016000205550505050565b8260031415613f3557613f2f858584846001613f7a565b5061086d565b8260061415613f4c57613f2f8585848460016140ef565b82600c1415613f6357613f2f858584846001614265565b826018141561086d576108828585848460016143db565b600080613f8961019885614f37565b613f939086614f0b565b90506000613fa582600160f81b614f0b565b90506001865b613fb6886003614f0b565b81101561402057865b613fca886003614f0b565b81101561400d57613ff08b613fe161019884614f37565b613feb9085614f0b565b6145f6565b8015613ff95750825b92508061400581614fb0565b915050613fbf565b508061401881614fb0565b915050613fab565b5084156140e357806140be57886001600160a01b0316614042600389896146e4565b6001600160a01b0316146140be5760405162461bcd60e51b815260206004820152602b60248201527f6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f72207060448201527f6172656e7420717561647300000000000000000000000000000000000000000060648201526084016106f7565b5060009081526036602052604090206001600160a01b03871690555060019050612efa565b98975050505050505050565b6000806140fe61019885614f37565b6141089086614f0b565b9050600061411a82600160f91b614f0b565b90506001865b61412b886006614f0b565b81101561424357865b61413f886006614f0b565b8110156142305760006141568c8c85856000613f7a565b9050600061416661019884614f37565b61417485600160f81b614f0b565b61417e9190614f0b565b600081815260366020526040902054909150801561420357826141f3578d6001600160a01b031681146141f35760405162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f66203378332071756164000000000000000000000060448201526064016106f7565b6000828152603660205260408120555b828061420e57508015155b80156142175750855b95505050506003816142299190614f0b565b9050614134565b5061423c600382614f0b565b9050614120565b5084156140e357806140be57886001600160a01b0316614042600689896146e4565b60008061427461019885614f37565b61427e9086614f0b565b9050600061429082600360f81b614f0b565b90506001865b6142a188600c614f0b565b8110156143b957865b6142b588600c614f0b565b8110156143a65760006142cc8c8c858560006140ef565b905060006142dc61019884614f37565b6142ea85600160f91b614f0b565b6142f49190614f0b565b60008181526036602052604090205490915080156143795782614369578d6001600160a01b031681146143695760405162461bcd60e51b815260206004820152601560248201527f6e6f74206f776e6572206f66203678362071756164000000000000000000000060448201526064016106f7565b6000828152603660205260408120555b828061438457508015155b801561438d5750855b955050505060068161439f9190614f0b565b90506142aa565b506143b2600682614f0b565b9050614296565b5084156140e357806140be57886001600160a01b0316614042600c89896146e4565b6000806143ea61019885614f37565b6143f49086614f0b565b9050600061440682600160fa1b614f0b565b90506001865b614417886018614f0b565b81101561452f57865b61442b886018614f0b565b81101561451c5760006144428c8c85856000614265565b9050600061445261019884614f37565b61446085600360f81b614f0b565b61446a9190614f0b565b60008181526036602052604090205490915080156144ef57826144df578d6001600160a01b031681146144df5760405162461bcd60e51b815260206004820152601760248201527f6e6f74206f776e6572206f66203132783132207175616400000000000000000060448201526064016106f7565b6000828152603660205260408120555b82806144fa57508015155b80156145035750855b9550505050600c816145159190614f0b565b9050614420565b50614528600c82614f0b565b905061440c565b5084156145c757806140be576000828152603660205260409020546001600160a01b038a16146140be5760405162461bcd60e51b815260206004820152602a60248201527f6e6f74206f776e6572206f6620616c6c20737562207175616473206e6f74207060448201527f6172656e7420717561640000000000000000000000000000000000000000000060648201526084016106f7565b80806145e957506000828152603660205260409020546001600160a01b038a16145b9998505050505050505050565b60008181526036602052604081205480156146da57600160a01b80821614156146615760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064016106f7565b836001600160a01b0316816001600160a01b0316146146c25760405162461bcd60e51b815260206004820152600960248201527f6e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064016106f7565b50506000818152603660205260408120556001611d5e565b5060009392505050565b600080806146f3866002614f37565b9050856003141561470a57600160f81b9150614791565b856006141561471f57600160f91b9150614791565b85600c141561473457600360f81b9150614791565b856018141561474957600160fa1b9150614791565b60405162461bcd60e51b815260206004820152600c60248201527f496e76616c69642073697a65000000000000000000000000000000000000000060448201526064016106f7565b6000603681610198896147a4818a614f23565b6147ae9190614f37565b6147b89190614f37565b896147c3818b614f23565b6147cd9190614f37565b6147d79087614f0b565b6147e19190614f0b565b815260208101919091526040016000205490506001600160a01b0381161561480d579250612cb7915050565b601887101561482b576148218287876146e4565b9350505050612cb7565b5060009695505050505050565b80356001600160a01b038116811461065557600080fd5b60008083601f840112614860578081fd5b50813567ffffffffffffffff811115614877578182fd5b602083019150836020808302850101111561489157600080fd5b9250929050565b8035801515811461065557600080fd5b60008083601f8401126148b9578182fd5b50813567ffffffffffffffff8111156148d0578182fd5b60208301915083602082850101111561489157600080fd5b600082601f8301126148f8578081fd5b813567ffffffffffffffff808211156149135761491361500b565b604051601f8301601f19908116603f0116810190828211818310171561493b5761493b61500b565b81604052838152866020858801011115614953578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215614980578081fd5b611d5b82614838565b6000806040838503121561499b578081fd5b6149a483614838565b91506149b260208401614838565b90509250929050565b60008060008060008060008060008060c08b8d0312156149d9578586fd5b6149e28b614838565b99506149f060208c01614838565b985060408b013567ffffffffffffffff80821115614a0c578788fd5b614a188e838f0161484f565b909a50985060608d0135915080821115614a30578788fd5b614a3c8e838f0161484f565b909850965060808d0135915080821115614a54578586fd5b614a608e838f0161484f565b909650945060a08d0135915080821115614a78578384fd5b50614a858d828e016148a8565b915080935050809150509295989b9194979a5092959850565b60008060008060008060808789031215614ab6578182fd5b614abf87614838565b9550614acd60208801614838565b9450604087013567ffffffffffffffff80821115614ae9578384fd5b614af58a838b0161484f565b90965094506060890135915080821115614b0d578384fd5b50614b1a89828a016148a8565b979a9699509497509295939492505050565b600080600060608486031215614b40578283fd5b614b4984614838565b9250614b5760208501614838565b9150614b6560408501614898565b90509250925092565b600080600060608486031215614b82578283fd5b614b8b84614838565b9250614b9960208501614838565b9150604084013590509250925092565b60008060008060808587031215614bbe578384fd5b614bc785614838565b9350614bd560208601614838565b925060408501359150606085013567ffffffffffffffff811115614bf7578182fd5b614c03878288016148e8565b91505092959194509250565b600080600080600080600060c0888a031215614c29578283fd5b614c3288614838565b9650614c4060208901614838565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff811115614c70578283fd5b614c7c8a828b016148a8565b989b979a50959850939692959293505050565b60008060408385031215614ca1578182fd5b614caa83614838565b91506149b260208401614898565b60008060408385031215614cca578182fd5b614cd383614838565b946020939093013593505050565b600080600080600060a08688031215614cf8578283fd5b614d0186614838565b9450602086013593506040860135925060608601359150608086013567ffffffffffffffff811115614d31578182fd5b614d3d888289016148e8565b9150509295509295909350565b600060208284031215614d5b578081fd5b8135612cb781615021565b600060208284031215614d77578081fd5b8151612cb781615021565b600060208284031215614d93578081fd5b5035919050565b600080600060608486031215614dae578081fd5b505081359360208301359350604090920135919050565b60008151808452614ddd816020860160208601614f6d565b601f01601f19169290920160200192915050565b60007f68747470733a2f2f6170692e73616e64626f782e67616d652f6c616e64732f0082528251614e2981601f850160208701614f6d565b7f2f6d657461646174612e6a736f6e000000000000000000000000000000000000601f939091019283015250602d01919050565b6000608082016001600160a01b03808816845260208188168186015260806040860152829150865180845260a0860192508188019350845b81811015614eb157845184529382019392820192600101614e95565b50505083810360608501526140e38186614dc5565b60006001600160a01b03808716835280861660208401525083604083015260806060830152612e396080830184614dc5565b600060208252611d5b6020830184614dc5565b60008219821115614f1e57614f1e614fdf565b500190565b600082614f3257614f32614ff5565b500490565b6000816000190483118215151615614f5157614f51614fdf565b500290565b600082821015614f6857614f68614fdf565b500390565b60005b83811015614f88578181015183820152602001614f70565b8381111561197e5750506000910152565b600081614fa857614fa8614fdf565b506000190190565b6000600019821415614fc457614fc4614fdf565b5060010190565b600082614fda57614fda614ff5565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610e3457600080fdfea26469706673582212204ea03adcbb50584bef3739879e001155077df5902cb5604c3277c30ee7f4ac8964736f6c63430008020033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.