Contract 0x6325439389e0797ab35752b4f43a14c004f22a9c 2

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x411f113bc1cf4469144aa61b00a1e6622c4ffb30936689b45522558a55d9f9c9Safe Transfer Fr...47757782022-01-18 23:21:4518 mins ago0x84411f4cb2ceabb8df877f35528a6f2338a2e18e IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001124640878 ETH
0x1a435813f64c20cb8f4be0c71f49510227cf1bbc73301d59ce55898d0a8b8593Safe Transfer Fr...47755512022-01-18 23:11:0829 mins ago0x6545c3f95c0fa51a0e4d9f7fc2f77dae133717e6 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001125392341 ETH
0xed65b271e53d17048fe95c79b8892d1467346397078874ce4bf3e0d481191fc4Safe Transfer Fr...47754432022-01-18 23:06:2933 mins ago0x84411f4cb2ceabb8df877f35528a6f2338a2e18e IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001123053809 ETH
0x2f1e506595e780b3960873c7c4b48c0169bc5e22ded1445937d81296934fb037Safe Transfer Fr...47753482022-01-18 23:03:2436 mins ago0x5234e2821f9ecb13bcd24bdd3107dec1ddba5dd5 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001123073676 ETH
0x16542a3e3193c6e0a2eeebdb03ce7bb6680b9dd120beb2553d5ebbf63ab89c3fSafe Transfer Fr...47753442022-01-18 23:03:2436 mins ago0x5234e2821f9ecb13bcd24bdd3107dec1ddba5dd5 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.00112330975 ETH
0xf49223b21c8ce484a0467082b955ef1c29756631bf41f59bf4d60ab8f8340860Safe Transfer Fr...47753402022-01-18 23:03:2436 mins ago0x5234e2821f9ecb13bcd24bdd3107dec1ddba5dd5 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001124667758 ETH
0x1569c9c5044394d0269c03dd2722d05be90e30f7fca1be4acdf983b57be0846fSafe Transfer Fr...47753282022-01-18 23:03:2436 mins ago0x5234e2821f9ecb13bcd24bdd3107dec1ddba5dd5 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001123296895 ETH
0x1ceb8c2507b61bdb3b29f13c2bbcb84da6bd86f1681f1e2c6a5d27e9156b51b0Safe Transfer Fr...47753102022-01-18 23:02:3737 mins ago0x6545c3f95c0fa51a0e4d9f7fc2f77dae133717e6 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001239205554 ETH
0x11256b0ff5fb2f9c74d580090f4045025b777d37aee5a1deb73ff39ee5f42a78Set Approval For...47752272022-01-18 22:57:4342 mins ago0x82758b7fabd4cd17b81f9deebad7e1cf970f2d58 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.000947300477 ETH
0x8e5fa34217b85bb99dcd56fa9f6891f99e43e3130424aa044effbd714fdd9d9bSafe Transfer Fr...47740012022-01-18 22:15:481 hr 24 mins ago0x70a1994c3c10ec28f31b13c962a6f8d2a791be9f IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001126289297 ETH
0xbd1aa10a1a9c62c43f4244b954e189d3531bdd13ae7022e47fe671882d0f5a33Set Approval For...47730082022-01-18 21:41:421 hr 58 mins ago0xe5a81738dcb83cbc73440f331659f362294bb7f1 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.000933238138 ETH
0x66e2bf143724e4efc6c6fc32a899a22cacc01e5ba8d979afa49b2af34f035b0cSet Approval For...47723572022-01-18 21:27:282 hrs 12 mins ago0x75eaa29db2c7b538b33cbbd11491f909a31d666a IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.000929505623 ETH
0xf034563e294c7eecde20db9a86cf463232bbc9716601ca7740ba55ed7b2576d0Safe Transfer Fr...47677242022-01-18 18:02:335 hrs 37 mins ago0x8418a464f0f51c958d1b57a5fb88d1a9896e8232 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001111563986 ETH
0x4d9e0a92ce1d05fa1008b07a05d060a55de35e0ada3de4b31e317be0e6f7d31bSafe Transfer Fr...47675672022-01-18 18:00:505 hrs 39 mins ago0x8418a464f0f51c958d1b57a5fb88d1a9896e8232 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.00122503279 ETH
0x275d36df18b9d2717019d0f3d0cfdef884329a85be69aa5720865d20ddf7bbbfSafe Transfer Fr...47653332022-01-18 17:19:226 hrs 20 mins ago0xfcd7dc740b59c543eb79c7d8035e94638155ffa6 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001103502781 ETH
0xa419116e16362538854713091ac84454e6f6302f2f80fb3c557707972b94f3ebSafe Transfer Fr...47653022022-01-18 17:18:436 hrs 21 mins ago0xfcd7dc740b59c543eb79c7d8035e94638155ffa6 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.0012204359 ETH
0x047c066efb2c727e63b9823754f1f0040914228af2a421e6c57988d3be843f83Safe Transfer Fr...47616822022-01-18 14:51:018 hrs 49 mins ago0xb4300e460e17f989919a619431b540be3e56e39b IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001122100139 ETH
0x0cd08a2aa98d557a6cd53936277bef5adc2120873026ea8190a792eed6b1e3d9Set Approval For...47604412022-01-18 14:00:029 hrs 40 mins ago0x12a0dd19d3f878697c7a1f804aaa1da84229566c IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.000944317342 ETH
0x9c5866b402e404a0097a8bc388f75753bff073d33b165d9626adbb83cff801b7Set Approval For...47589342022-01-18 12:52:3010 hrs 47 mins ago0xd4490e07b5e1064c467f69aaeb58f90a5499cbd8 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.000952612616 ETH
0x3312d47afad4fa22d83b584228a67365f9a44b004ea8509cab33b1a9b3370213Safe Transfer Fr...47588572022-01-18 12:48:0010 hrs 52 mins ago0x478f25e0856aa133f7f9f68f1dab2505b6ef9bd1 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001132205869 ETH
0xd74cfe02f3f686927d412bbefe9091e6716411f5e9fcd01083eb4ed088d13c35Set Approval For...47569922022-01-18 10:49:2912 hrs 50 mins ago0x51a52e8184cdbd1f6a534cc0d293aab4c9aee2de IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.000966375546 ETH
0x7d86431728fe27d22dd37e1d66f02ca97e87402e2bb71803b3d8bdb09c06e567Set Approval For...47561202022-01-18 9:58:1513 hrs 42 mins ago0x91099d482a6fa940e116b0c48d14730fed394273 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.000969986181 ETH
0x415eeab95a1e4c83fd6ca3fe73eb6cf641ae9b206181ba7fa8acf822398dbd23Set Approval For...47534022022-01-18 7:35:0716 hrs 5 mins ago0x169b8e5784df150e0dec0f26059b3a18272ef629 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.000880170982 ETH
0x72610f877ba3f55d276caa76c47c4617a96e3ec6ce1d43ade7bf16162df5b1bcSet Approval For...47522252022-01-18 6:18:3917 hrs 21 mins ago0x876f2fcd392205e2779f91a7e1d9e0851669148f IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.00100635393 ETH
0x6fa9bf591f83c1713971c3bce27fe5c9454d17e5503f5d0209f93fbd1c2d385aSet Approval For...47490252022-01-18 3:24:3720 hrs 15 mins ago0x1021b3846631a428d82c8bf7ad8e0ee4b19d7718 IN  0x6325439389e0797ab35752b4f43a14c004f22a9c0 ETH0.001013060617 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SmolBrain

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 20 : SmolBrain.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/utils/math/Math.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import './School.sol';
import './Land.sol';
import "./MinterControl.sol";

contract SmolBrain is MinterControl, ERC721Enumerable {
    using Strings for uint256;
    using Counters for Counters.Counter;

    uint256 constant LAST_MALE = 6710;
    uint256 constant LAST_FEMALE = 13421;

    enum Gender { Male, Female }

    Counters.Counter private _maleTokenIdTracker;
    Counters.Counter private _femaleTokenIdTracker;
    string public baseURI;

    /// @dev 18 decimals
    uint256 public brainMaxLevel;
    /// @dev 18 decimals
    uint256 public levelIQCost;

    School public school;
    Land public land;

    // tokenId => IQ
    mapping(uint256 => uint256) public brainz;

    event SmolBrainMint(address to, uint256 tokenId, Gender gender);
    event LevelIQCost(uint256 levelIQCost);
    event LandMaxLevel(uint256 brainMaxLevel);
    event SchoolSet(address school);
    event LandSet(address land);

    modifier onlySchool() {
        require(msg.sender == address(school), "SmolBrain: !school");
        _;
    }

    constructor(address _luckyWinner) ERC721("Smol Brain", "SmolBrain") {
        _femaleTokenIdTracker._value = LAST_MALE + 1;
        _mint(_luckyWinner, Gender.Male);
    }

    function supportsInterface(bytes4 interfaceId) public view override(ERC721Enumerable, AccessControl) returns (bool) {
        return ERC721Enumerable.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId);
    }

    function mintMale(address _to) external onlyMinter {
        _mint(_to, Gender.Male);
    }

    function mintFemale(address _to) external onlyMinter {
        _mint(_to, Gender.Female);
    }

    function getGender(uint256 _tokenId) public pure returns (Gender) {
        return _tokenId <= LAST_MALE ? Gender.Male : Gender.Female;
    }

    function tokenURI(uint256 _tokenId) public view override returns (string memory) {
        require(_exists(_tokenId), "SmolBrain: URI query for nonexistent token");

        uint256 level = Math.min(scanBrain(_tokenId) / levelIQCost, brainMaxLevel);
        return bytes(baseURI).length > 0 ?
            string(abi.encodePacked(
                baseURI,
                _tokenId.toString(),
                "/",
                level.toString()
            ))
            : "";
    }

    function scanBrain(uint256 _tokenId) public view returns (uint256 IQ) {
        IQ = brainz[_tokenId] + school.iqEarned(_tokenId);
    }

    function averageIQ() public view returns (uint256) {
        if (totalSupply() == 0) return 0;
        uint256 totalIQ = school.totalIQ();
        return totalIQ / totalSupply();
    }

    /// @param _tokenId tokenId of the land
    function schoolDrop(uint256 _tokenId, uint256 _iqEarned) external onlySchool {
        brainz[_tokenId] += _iqEarned;
    }

    function _mint(address _to, Gender _gender) internal {
        uint256 _tokenId;
        if (_gender == Gender.Male) {
            _tokenId = _maleTokenIdTracker.current();
            _maleTokenIdTracker.increment();
            require(_tokenId <= LAST_MALE, "SmolBrain: exceeded tokenId for male");
        } else {
            _tokenId = _femaleTokenIdTracker.current();
            _femaleTokenIdTracker.increment();
            require(_tokenId <= LAST_FEMALE, "SmolBrain: exceeded tokenId for female");
        }

        emit SmolBrainMint(_to, _tokenId, _gender);
        _safeMint(_to, _tokenId);
    }

    function _beforeTokenTransfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) internal override {
        super._beforeTokenTransfer(_from, _to, _tokenId);

        if (address(school) != address(0))
            require(!school.isAtSchool(_tokenId), "SmolBrain: is at school. Drop school to transfer.");
        if (_from != address(0))
            land.upgradeSafe(land.tokenOfOwnerByIndex(_from, 0));
    }

    function _baseURI() internal view override returns (string memory) {
        return baseURI;
    }

    // ADMIN

    function setSchool(address _school) external onlyOwner {
        school = School(_school);
        emit SchoolSet(_school);
    }

    function setLand(address _land) external onlyOwner {
        land = Land(_land);
        emit LandSet(_land);
    }

    function setLevelIQCost(uint256 _levelIQCost) external onlyOwner {
        levelIQCost = _levelIQCost;
        emit LevelIQCost(_levelIQCost);
    }

    function setMaxLevel(uint256 _brainMaxLevel) external onlyOwner {
        brainMaxLevel = _brainMaxLevel;
        emit LandMaxLevel(_brainMaxLevel);
    }

    function setBaseURI(string memory _baseURItoSet) external onlyOwner {
        baseURI = _baseURItoSet;
    }
}

File 2 of 20 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 20 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a / b + (a % b == 0 ? 0 : 1);
    }
}

File 4 of 20 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 5 of 20 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 6 of 20 : School.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

import '@openzeppelin/contracts/access/Ownable.sol';
import './SmolBrain.sol';

contract School is Ownable {
    uint256 public constant WEEK = 7 days;
    /// @dev 18 decimals
    uint256 public iqPerWeek;
    /// @dev 18 decimals
    uint256 public totalIqStored;
    /// @dev unix timestamp
    uint256 public lastRewardTimestamp;
    uint256 public smolBrainSupply;

    SmolBrain public smolBrain;

    mapping(uint256 => uint256) public timestampJoined;

    event JoinSchool(uint256 tokenId);
    event DropSchool(uint256 tokenId);
    event SetIqPerWeek(uint256 iqPerWeek);
    event SmolBrainSet(address smolBrain);

    modifier onlySmolBrainOwner(uint256 _tokenId) {
        require(smolBrain.ownerOf(_tokenId) == msg.sender, "School: only owner can send to school");
        _;
    }

    modifier atSchool(uint256 _tokenId, bool expectedAtSchool) {
        require(isAtSchool(_tokenId) == expectedAtSchool, "School: wrong school attendance");
        _;
    }

    modifier updateTotalIQ(bool isJoining) {
        if (smolBrainSupply > 0) {
            totalIqStored = totalIQ();
        }
        lastRewardTimestamp = block.timestamp;
        isJoining ? smolBrainSupply++ : smolBrainSupply--;
        _;
    }

    function totalIQ() public view returns (uint256) {
        uint256 timeDelta = block.timestamp - lastRewardTimestamp;
        return totalIqStored + smolBrainSupply * iqPerWeek * timeDelta / WEEK;
    }

    function iqEarned(uint256 _tokenId) public view returns (uint256 iq) {
        if (timestampJoined[_tokenId] == 0) return 0;
        uint256 timedelta = block.timestamp - timestampJoined[_tokenId];
        iq = iqPerWeek * timedelta / WEEK;
    }

    function isAtSchool(uint256 _tokenId) public view returns (bool) {
        return timestampJoined[_tokenId] > 0;
    }

    function join(uint256 _tokenId)
        external
        onlySmolBrainOwner(_tokenId)
        atSchool(_tokenId, false)
        updateTotalIQ(true)
    {
        timestampJoined[_tokenId] = block.timestamp;
        emit JoinSchool(_tokenId);
    }

    function drop(uint256 _tokenId)
        external
        onlySmolBrainOwner(_tokenId)
        atSchool(_tokenId, true)
        updateTotalIQ(false)
    {
        smolBrain.schoolDrop(_tokenId, iqEarned(_tokenId));
        timestampJoined[_tokenId] = 0;
        emit DropSchool(_tokenId);
    }

    // ADMIN

    function setSmolBrain(address _smolBrain) external onlyOwner {
        smolBrain = SmolBrain(_smolBrain);
        emit SmolBrainSet(_smolBrain);
    }

    /// @param _iqPerWeek NUmber of IQ points to earn a week, 18 decimals
    function setIqPerWeek(uint256 _iqPerWeek) external onlyOwner {
        iqPerWeek = _iqPerWeek;
        emit SetIqPerWeek(_iqPerWeek);
    }
}

File 7 of 20 : Land.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/utils/math/Math.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import './SmolBrain.sol';
import "./MinterControl.sol";

contract Land is MinterControl, ERC721Enumerable {
    using Strings for uint256;
    using Counters for Counters.Counter;

    Counters.Counter private _tokenIdTracker;
    string public baseURI;

    /// @dev 18 decimals
    uint256 public landMaxLevel;
    /// @dev 18 decimals
    uint256 public levelIQCost;

    /// @dev tokenId => land level
    mapping(uint256 => uint256) public landLevels;

    SmolBrain public smolBrain;

    event LandMint(address indexed to, uint256 tokenId);
    event LandUpgrade(uint256 indexed tokenId, uint256 availableLevel);
    event LandMaxLevel(uint256 landMaxLevel);
    event LevelIQCost(uint256 levelIQCost);
    event SmolBrainSet(address smolBrain);

    constructor() ERC721("Smol Brain Land", "SmolBrainLand") {}

    function supportsInterface(bytes4 interfaceId) public view override(ERC721Enumerable, AccessControl) returns (bool) {
        return ERC721Enumerable.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId);
    }

    function mint(address _to) external onlyMinter {
        emit LandMint(_to, _tokenIdTracker.current());

        _safeMint(_to, _tokenIdTracker.current());
        _tokenIdTracker.increment();
    }

    function tokenURI(uint256 _tokenId) public view override returns (string memory) {
        require(_exists(_tokenId), "Land: URI query for nonexistent token");

        (, uint256 availableLevel) = canUpgrade(_tokenId);
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, availableLevel.toString())) : "";
    }

    /// @param _tokenId tokenId of the land
    /// @return isUpgradeAvailable true if higher level is available
    /// @return availableLevel what level can land be upgraded to
    function canUpgrade(uint256 _tokenId) public view returns (bool isUpgradeAvailable, uint256 availableLevel) {
        uint256 highestIQ = findBiggestBrainIQ(ownerOf(_tokenId));
        uint256 averageIQ = smolBrain.averageIQ();
        uint256 maxLevel = Math.min(averageIQ / levelIQCost, landMaxLevel);
        availableLevel = Math.min(highestIQ / levelIQCost, maxLevel);
        uint256 storedLevel = landLevels[_tokenId];
        if (storedLevel < availableLevel) {
            isUpgradeAvailable = true;
        }
    }

    /// @param _owner owner of the land
    /// @return highestIQ IQ of the biggest brain
    function findBiggestBrainIQ(address _owner) public view returns (uint256 highestIQ) {
        uint256 length = smolBrain.balanceOf(_owner);

        for (uint256 i = 0; i < length; i++) {
            uint256 tokenId = smolBrain.tokenOfOwnerByIndex(_owner, i);
            uint256 IQ = smolBrain.scanBrain(tokenId);
            if (IQ > highestIQ) {
                highestIQ = IQ;
            }
        }
    }

    /// @param _tokenId tokenId of the land
    function upgrade(uint256 _tokenId) external {
        require(upgradeSafe(_tokenId), "Land: nothing to upgrade");
    }

    function upgradeSafe(uint256 _tokenId) public returns (bool) {
        (bool isUpgradeAvailable, uint256 availableLevel) = canUpgrade(_tokenId);
        if (isUpgradeAvailable) {
            landLevels[_tokenId] = availableLevel;
            emit LandUpgrade(_tokenId, availableLevel);
        }
        return isUpgradeAvailable;
    }

    function _beforeTokenTransfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) internal override {
        super._beforeTokenTransfer(_from, _to, _tokenId);

        require(balanceOf(_to) == 0, "Land: can own only one land");
        if (_from != address(0)) upgradeSafe(_tokenId);
    }

    function _baseURI() internal view override returns (string memory) {
        return baseURI;
    }

    // ADMIN

    function setSmolBrain(address _smolBrain) external onlyOwner {
        smolBrain = SmolBrain(_smolBrain);
        emit SmolBrainSet(_smolBrain);
    }

    function setMaxLevel(uint256 _landMaxLevel) external onlyOwner {
        landMaxLevel = _landMaxLevel;
        emit LandMaxLevel(_landMaxLevel);
    }

    function setLevelIQCost(uint256 _levelIQCost) external onlyOwner {
        levelIQCost = _levelIQCost;
        emit LevelIQCost(_levelIQCost);
    }

    function setBaseURI(string memory _baseURItoSet) external onlyOwner {
        baseURI = _baseURItoSet;
    }
}

File 8 of 20 : MinterControl.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

import "@openzeppelin/contracts/access/AccessControl.sol";

abstract contract MinterControl is AccessControl {
    bytes32 public constant SMOLBRAIN_OWNER_ROLE = keccak256("SMOLBRAIN_OWNER_ROLE");
    bytes32 public constant SMOLBRAIN_MINTER_ROLE = keccak256("SMOLBRAIN_MINTER_ROLE");

    modifier onlyOwner() {
        require(hasRole(SMOLBRAIN_OWNER_ROLE, _msgSender()), "MinterControl: not a SMOLBRAIN_OWNER_ROLE");
        _;
    }

    modifier onlyMinter() {
        require(isMinter(_msgSender()), "MinterControl: not a SMOLBRAIN_MINTER_ROLE");
        _;
    }

    constructor() {
        _setRoleAdmin(SMOLBRAIN_OWNER_ROLE, SMOLBRAIN_OWNER_ROLE);
        _setRoleAdmin(SMOLBRAIN_MINTER_ROLE, SMOLBRAIN_OWNER_ROLE);

        _setupRole(SMOLBRAIN_OWNER_ROLE, _msgSender());
    }

    function grantMinter(address _minter) external {
        grantRole(SMOLBRAIN_MINTER_ROLE, _minter);
    }

    function isMinter(address _minter) public view returns (bool) {
        return hasRole(SMOLBRAIN_MINTER_ROLE, _minter);
    }

    function grantOwner(address _owner) external {
        grantRole(SMOLBRAIN_OWNER_ROLE, _owner);
    }

    function isOwner(address _owner) public view returns (bool) {
        return hasRole(SMOLBRAIN_OWNER_ROLE, _owner);
    }
}

File 9 of 20 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

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

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

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

File 10 of 20 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 11 of 20 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 12 of 20 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 13 of 20 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 14 of 20 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 15 of 20 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 16 of 20 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 18 of 20 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 19 of 20 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 20 of 20 : IAccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_luckyWinner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"brainMaxLevel","type":"uint256"}],"name":"LandMaxLevel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"land","type":"address"}],"name":"LandSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"levelIQCost","type":"uint256"}],"name":"LevelIQCost","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"school","type":"address"}],"name":"SchoolSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"enum SmolBrain.Gender","name":"gender","type":"uint8"}],"name":"SmolBrainMint","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":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SMOLBRAIN_MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SMOLBRAIN_OWNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"averageIQ","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"brainMaxLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"brainz","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getGender","outputs":[{"internalType":"enum SmolBrain.Gender","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"grantMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"grantOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"land","outputs":[{"internalType":"contract Land","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"levelIQCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"mintFemale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"mintMale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"scanBrain","outputs":[{"internalType":"uint256","name":"IQ","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"school","outputs":[{"internalType":"contract School","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_iqEarned","type":"uint256"}],"name":"schoolDrop","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":"string","name":"_baseURItoSet","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_land","type":"address"}],"name":"setLand","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_levelIQCost","type":"uint256"}],"name":"setLevelIQCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_brainMaxLevel","type":"uint256"}],"name":"setMaxLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_school","type":"address"}],"name":"setSchool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162003c4c38038062003c4c833981016040819052620000349162000d11565b6040518060400160405280600a81526020016929b6b7b610213930b4b760b11b8152506040518060400160405280600981526020016829b6b7b6213930b4b760b91b8152506200009a60008051602062003c0c833981519152806200014660201b60201c565b620000d57f4ace3e268e2421ceda36da4af4120747b9ba01b2932e46e900cf59bc0826464260008051602062003c0c83398151915262000146565b620000f060008051602062003c0c8339815191523362000191565b81516200010590600190602085019062000c6b565b5080516200011b90600290602084019062000c6b565b505050611a3660016200012f919062000e6c565b600c556200013f816000620001a1565b5062000f36565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6200019d828262000319565b5050565b600080826001811115620001b957620001b962000ef4565b14156200024957620001d7600b620003b960201b620013801760201c565b9050620001f0600b620003bd60201b620013841760201c565b611a36811115620002435760405162461bcd60e51b81526020600482015260248082015260008051602062003c2c8339815191526044820152636d616c6560e01b60648201526084015b60405180910390fd5b620002cb565b62000260600c620003b960201b620013801760201c565b905062000279600c620003bd60201b620013841760201c565b61346d811115620002cb5760405162461bcd60e51b8152602060048201526026602482015260008051602062003c2c83398151915260448201526566656d616c6560d01b60648201526084016200023a565b7f560f11076e2121ecfa36657b5c94ab36dd72447932c1e722fe9e48d860f069d6838284604051620003009392919062000e28565b60405180910390a1620003148382620003c6565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200019d576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003753390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5490565b80546001019055565b6200019d828260405180602001604052806000815250620003e860201b60201c565b620003f483836200045b565b620004036000848484620005b1565b620003145760405162461bcd60e51b8152602060048201526032602482015260008051602062003bec83398151915260448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60648201526084016200023a565b6001600160a01b038216620004b35760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016200023a565b6000818152600360205260409020546001600160a01b0316156200051a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016200023a565b62000528600083836200071a565b6001600160a01b03821660009081526004602052604081208054600192906200055390849062000e6c565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000620005d2846001600160a01b03166200094860201b6200138d1760201c565b156200070e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906200060c90339089908890889060040162000dad565b602060405180830381600087803b1580156200062757600080fd5b505af19250505080156200065a575060408051601f3d908101601f19168201909252620006579181019062000d67565b60015b620006f3573d8080156200068b576040519150601f19603f3d011682016040523d82523d6000602084013e62000690565b606091505b508051620006eb5760405162461bcd60e51b8152602060048201526032602482015260008051602062003bec83398151915260448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60648201526084016200023a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905062000712565b5060015b949350505050565b620007328383836200094e60201b620013931760201c565b6010546001600160a01b0316156200082d57601054604051637af9928160e11b8152600481018390526001600160a01b039091169063f5f325029060240160206040518083038186803b1580156200078957600080fd5b505afa1580156200079e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007c4919062000d43565b156200082d5760405162461bcd60e51b815260206004820152603160248201527f536d6f6c427261696e3a206973206174207363686f6f6c2e2044726f702073636044820152703437b7b6103a37903a3930b739b332b91760791b60648201526084016200023a565b6001600160a01b038316156200031457601154604051632f745c5960e01b81526001600160a01b03858116600483015260006024830152909116906381151e67908290632f745c599060440160206040518083038186803b1580156200089257600080fd5b505afa158015620008a7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620008cd919062000d93565b6040518263ffffffff1660e01b8152600401620008ec91815260200190565b602060405180830381600087803b1580156200090757600080fd5b505af11580156200091c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000942919062000d43565b50505050565b3b151590565b620009668383836200031460201b6200091e1760201c565b6001600160a01b038316620009c457620009be81600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b620009ea565b816001600160a01b0316836001600160a01b031614620009ea57620009ea838262000a2a565b6001600160a01b03821662000a0457620003148162000ad7565b826001600160a01b0316826001600160a01b031614620003145762000314828262000b91565b6000600162000a448462000be260201b62000eb71760201c565b62000a50919062000e87565b60008381526008602052604090205490915080821462000aa4576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b5060009182526008602090815260408084208490556001600160a01b039094168352600781528383209183525290812055565b60095460009062000aeb9060019062000e87565b6000838152600a60205260408120546009805493945090928490811062000b165762000b1662000f20565b90600052602060002001549050806009838154811062000b3a5762000b3a62000f20565b6000918252602080832090910192909255828152600a9091526040808220849055858252812055600980548062000b755762000b7562000f0a565b6001900381819060005260206000200160009055905550505050565b600062000ba98362000be260201b62000eb71760201c565b6001600160a01b039093166000908152600760209081526040808320868452825280832085905593825260089052919091209190915550565b60006001600160a01b03821662000c4f5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016200023a565b506001600160a01b031660009081526004602052604090205490565b82805462000c799062000ea1565b90600052602060002090601f01602090048101928262000c9d576000855562000ce8565b82601f1062000cb857805160ff191683800117855562000ce8565b8280016001018555821562000ce8579182015b8281111562000ce857825182559160200191906001019062000ccb565b5062000cf692915062000cfa565b5090565b5b8082111562000cf6576000815560010162000cfb565b60006020828403121562000d2457600080fd5b81516001600160a01b038116811462000d3c57600080fd5b9392505050565b60006020828403121562000d5657600080fd5b8151801515811462000d3c57600080fd5b60006020828403121562000d7a57600080fd5b81516001600160e01b03198116811462000d3c57600080fd5b60006020828403121562000da657600080fd5b5051919050565b600060018060a01b038087168352602081871681850152856040850152608060608501528451915081608085015260005b8281101562000dfc5785810182015185820160a00152810162000dde565b8281111562000e0f57600060a084870101525b5050601f01601f19169190910160a00195945050505050565b6001600160a01b038416815260208101839052606081016002831062000e5e57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b6000821982111562000e825762000e8262000ede565b500190565b60008282101562000e9c5762000e9c62000ede565b500390565b600181811c9082168062000eb657607f821691505b6020821081141562000ed857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b612ca68062000f466000396000f3fe608060405234801561001057600080fd5b506004361061027f5760003560e01c80636c0360eb1161015c57806395d89b41116100ce578063c87b56dd11610087578063c87b56dd14610590578063d547741f146105a3578063d57cd145146105b6578063dc978059146105c9578063e06d2eb5146105dc578063e985e9c5146105fc57600080fd5b806395d89b4114610520578063a217fddf14610528578063a22cb46514610530578063a48e005114610543578063aa271e1a1461056a578063b88d4fde1461057d57600080fd5b80637dd6bda9116101205780637dd6bda9146104b8578063812c8d5f146104c157806381d9e0cf146104d4578063861b3fe7146104e75780638c980129146104fa57806391d148541461050d57600080fd5b80636c0360eb146104615780636c92120d146104695780636d6e3bf01461047c5780636f27535d1461048557806370a08231146104a557600080fd5b8063261707fa116101f557806336568abe116101b957806336568abe146103ef57806341268ea11461040257806342842e0e146104155780634f6ccce71461042857806355f804b31461043b5780636352211e1461044e57600080fd5b8063261707fa146103905780632f2ff15d146103a35780632f54bf6e146103b65780632f745c59146103c9578063344f1ba5146103dc57600080fd5b8063095ea7b311610247578063095ea7b3146103245780630ec3d6341461033757806318160ddd1461033f5780631d173ea21461034757806323b872dd1461035a578063248a9ca31461036d57600080fd5b806301ffc9a71461028457806302ed29e0146102ac57806306fdde03146102cf578063081812fc146102e4578063082955171461030f575b600080fd5b61029761029236600461268d565b610638565b60405190151581526020015b60405180910390f35b6102c1600080516020612c5183398151915281565b6040519081526020016102a3565b6102d7610658565b6040516102a39190612950565b6102f76102f2366004612651565b6106ea565b6040516001600160a01b0390911681526020016102a3565b61032261031d3660046124cd565b610784565b005b61032261033236600461260a565b61080d565b6102c1610923565b6009546102c1565b6103226103553660046124cd565b6109d0565b61032261036836600461251b565b610a03565b6102c161037b366004612651565b60009081526020819052604090206001015490565b61032261039e3660046124cd565b610a34565b6103226103b136600461266a565b610a5a565b6102976103c43660046124cd565b610a80565b6102c16103d736600461260a565b610a9a565b6103226103ea366004612651565b610b30565b6103226103fd36600461266a565b610b99565b610322610410366004612729565b610c17565b61032261042336600461251b565b610c8d565b6102c1610436366004612651565b610ca8565b6103226104493660046126c7565b610d3b565b6102f761045c366004612651565b610d82565b6102d7610df9565b6103226104773660046124cd565b610e87565b6102c1600f5481565b6102c1610493366004612651565b60126020526000908152604090205481565b6102c16104b33660046124cd565b610eb7565b6102c1600e5481565b6010546102f7906001600160a01b031681565b6103226104e23660046124cd565b610f3e565b6102c16104f5366004612651565b610fc0565b6011546102f7906001600160a01b031681565b61029761051b36600461266a565b611056565b6102d761107f565b6102c1600081565b61032261053e3660046125d3565b61108e565b6102c17f4ace3e268e2421ceda36da4af4120747b9ba01b2932e46e900cf59bc0826464281565b6102976105783660046124cd565b611153565b61032261058b366004612557565b61117f565b6102d761059e366004612651565b6111b7565b6103226105b136600461266a565b6112be565b6103226105c4366004612651565b6112e4565b6103226105d73660046124cd565b61134d565b6105ef6105ea366004612651565b611365565b6040516102a39190612942565b61029761060a3660046124e8565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b60006106438261144b565b80610652575061065282611470565b92915050565b60606001805461066790612b3e565b80601f016020809104026020016040519081016040528092919081815260200182805461069390612b3e565b80156106e05780601f106106b5576101008083540402835291602001916106e0565b820191906000526020600020905b8154815290600101906020018083116106c357829003601f168201915b5050505050905090565b6000818152600360205260408120546001600160a01b03166107685760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b61079c600080516020612c5183398151915233611056565b6107b85760405162461bcd60e51b815260040161075f906129ff565b601080546001600160a01b0319166001600160a01b0383169081179091556040519081527fbb93ca4e17ebec368688a7c3a5f0ac6e0c42141f20ef618b4098e518450a88eb906020015b60405180910390a150565b600061081882610d82565b9050806001600160a01b0316836001600160a01b031614156108865760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161075f565b336001600160a01b03821614806108a257506108a2813361060a565b6109145760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161075f565b61091e83836114a5565b505050565b600061092e60095490565b6109385750600090565b6010546040805163c12cfbef60e01b815290516000926001600160a01b03169163c12cfbef916004808301926020929190829003018186803b15801561097d57600080fd5b505afa158015610991573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b59190612710565b90506109c060095490565b6109ca9082612ab1565b91505090565b6109d933611153565b6109f55760405162461bcd60e51b815260040161075f90612963565b610a00816000611513565b50565b610a0d338261164f565b610a295760405162461bcd60e51b815260040161075f90612a48565b61091e838383611746565b610a007f4ace3e268e2421ceda36da4af4120747b9ba01b2932e46e900cf59bc08264642825b600082815260208190526040902060010154610a7681336118f1565b61091e8383611955565b6000610652600080516020612c5183398151915283611056565b6000610aa583610eb7565b8210610b075760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161075f565b506001600160a01b03919091166000908152600760209081526040808320938352929052205490565b610b48600080516020612c5183398151915233611056565b610b645760405162461bcd60e51b815260040161075f906129ff565b600e8190556040518181527f2f61ebe91f71a0e705900e252d50f1e06077072fb7f9f7d06a4d609059bb3f0d90602001610802565b6001600160a01b0381163314610c095760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161075f565b610c1382826119d9565b5050565b6010546001600160a01b03163314610c665760405162461bcd60e51b815260206004820152601260248201527114db5bdb109c985a5b8e88085cd8da1bdbdb60721b604482015260640161075f565b60008281526012602052604081208054839290610c84908490612a99565b90915550505050565b61091e8383836040518060200160405280600081525061117f565b6000610cb360095490565b8210610d165760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161075f565b60098281548110610d2957610d29612c00565b90600052602060002001549050919050565b610d53600080516020612c5183398151915233611056565b610d6f5760405162461bcd60e51b815260040161075f906129ff565b8051610c1390600d9060208401906123a2565b6000818152600360205260408120546001600160a01b0316806106525760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161075f565b600d8054610e0690612b3e565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3290612b3e565b8015610e7f5780601f10610e5457610100808354040283529160200191610e7f565b820191906000526020600020905b815481529060010190602001808311610e6257829003601f168201915b505050505081565b610e9033611153565b610eac5760405162461bcd60e51b815260040161075f90612963565b610a00816001611513565b60006001600160a01b038216610f225760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161075f565b506001600160a01b031660009081526004602052604090205490565b610f56600080516020612c5183398151915233611056565b610f725760405162461bcd60e51b815260040161075f906129ff565b601180546001600160a01b0319166001600160a01b0383169081179091556040519081527f960cb2318d7d27adc21905c96c7dbb70f68c7b6412cf0f55247dea6e213828c390602001610802565b60105460405163457cb58560e01b8152600481018390526000916001600160a01b03169063457cb5859060240160206040518083038186803b15801561100557600080fd5b505afa158015611019573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103d9190612710565b6000838152601260205260409020546106529190612a99565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60606002805461066790612b3e565b6001600160a01b0382163314156110e75760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161075f565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006106527f4ace3e268e2421ceda36da4af4120747b9ba01b2932e46e900cf59bc0826464283611056565b611189338361164f565b6111a55760405162461bcd60e51b815260040161075f90612a48565b6111b184848484611a3e565b50505050565b6000818152600360205260409020546060906001600160a01b03166112315760405162461bcd60e51b815260206004820152602a60248201527f536d6f6c427261696e3a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b606482015260840161075f565b6000611254600f5461124285610fc0565b61124c9190612ab1565b600e54611a71565b90506000600d805461126590612b3e565b90501161128157604051806020016040528060008152506112b7565b600d61128c84611a87565b61129583611a87565b6040516020016112a7939291906127b5565b6040516020818303038152906040525b9392505050565b6000828152602081905260409020600101546112da81336118f1565b61091e83836119d9565b6112fc600080516020612c5183398151915233611056565b6113185760405162461bcd60e51b815260040161075f906129ff565b600f8190556040518181527f8b417e0974ccf6cbb52930652bacdfadbcffd507164c6d693038e721f05138a690602001610802565b610a00600080516020612c5183398151915282610a5a565b6000611a36821115611378576001610652565b600092915050565b5490565b80546001019055565b3b151590565b6001600160a01b0383166113ee576113e981600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b611411565b816001600160a01b0316836001600160a01b031614611411576114118382611b85565b6001600160a01b0382166114285761091e81611c22565b826001600160a01b0316826001600160a01b03161461091e5761091e8282611cd1565b60006001600160e01b0319821663780e9d6360e01b1480610652575061065282611d15565b60006001600160e01b03198216637965db0b60e01b148061065257506301ffc9a760e01b6001600160e01b0319831614610652565b600081815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906114da82610d82565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008082600181111561152857611528612bd4565b141561159d5750600b805460018101909155611a368111156115985760405162461bcd60e51b8152602060048201526024808201527f536d6f6c427261696e3a20657863656564656420746f6b656e496420666f72206044820152636d616c6560e01b606482015260840161075f565b61160a565b50600c80546001810190915561346d81111561160a5760405162461bcd60e51b815260206004820152602660248201527f536d6f6c427261696e3a20657863656564656420746f6b656e496420666f722060448201526566656d616c6560d01b606482015260840161075f565b7f560f11076e2121ecfa36657b5c94ab36dd72447932c1e722fe9e48d860f069d683828460405161163d9392919061291e565b60405180910390a161091e8382611d54565b6000818152600360205260408120546001600160a01b03166116c85760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161075f565b60006116d383610d82565b9050806001600160a01b0316846001600160a01b0316148061170e5750836001600160a01b0316611703846106ea565b6001600160a01b0316145b8061173e57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661175982610d82565b6001600160a01b0316146117c15760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161075f565b6001600160a01b0382166118235760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161075f565b61182e838383611d6e565b6118396000826114a5565b6001600160a01b0383166000908152600460205260408120805460019290611862908490612ae4565b90915550506001600160a01b0382166000908152600460205260408120805460019290611890908490612a99565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6118fb8282611056565b610c1357611913816001600160a01b03166014611f78565b61191e836020611f78565b60405160200161192f929190612876565b60408051601f198184030181529082905262461bcd60e51b825261075f91600401612950565b61195f8282611056565b610c13576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556119953390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6119e38282611056565b15610c13576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611a49848484611746565b611a5584848484612114565b6111b15760405162461bcd60e51b815260040161075f906129ad565b6000818310611a8057816112b7565b5090919050565b606081611aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611ad55780611abf81612b79565b9150611ace9050600a83612ab1565b9150611aaf565b60008167ffffffffffffffff811115611af057611af0612c16565b6040519080825280601f01601f191660200182016040528015611b1a576020820181803683370190505b5090505b841561173e57611b2f600183612ae4565b9150611b3c600a86612b94565b611b47906030612a99565b60f81b818381518110611b5c57611b5c612c00565b60200101906001600160f81b031916908160001a905350611b7e600a86612ab1565b9450611b1e565b60006001611b9284610eb7565b611b9c9190612ae4565b600083815260086020526040902054909150808214611bef576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b5060009182526008602090815260408084208490556001600160a01b039094168352600781528383209183525290812055565b600954600090611c3490600190612ae4565b6000838152600a602052604081205460098054939450909284908110611c5c57611c5c612c00565b906000526020600020015490508060098381548110611c7d57611c7d612c00565b6000918252602080832090910192909255828152600a90915260408082208490558582528120556009805480611cb557611cb5612bea565b6001900381819060005260206000200160009055905550505050565b6000611cdc83610eb7565b6001600160a01b039093166000908152600760209081526040808320868452825280832085905593825260089052919091209190915550565b60006001600160e01b031982166380ac58cd60e01b148061064357506001600160e01b03198216635b5e139f60e01b1480610652575061065282611470565b610c13828260405180602001604052806000815250612221565b611d79838383611393565b6010546001600160a01b031615611e6d57601054604051637af9928160e11b8152600481018390526001600160a01b039091169063f5f325029060240160206040518083038186803b158015611dce57600080fd5b505afa158015611de2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e069190612634565b15611e6d5760405162461bcd60e51b815260206004820152603160248201527f536d6f6c427261696e3a206973206174207363686f6f6c2e2044726f702073636044820152703437b7b6103a37903a3930b739b332b91760791b606482015260840161075f565b6001600160a01b0383161561091e57601154604051632f745c5960e01b81526001600160a01b03858116600483015260006024830152909116906381151e67908290632f745c599060440160206040518083038186803b158015611ed057600080fd5b505afa158015611ee4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f089190612710565b6040518263ffffffff1660e01b8152600401611f2691815260200190565b602060405180830381600087803b158015611f4057600080fd5b505af1158015611f54573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b19190612634565b60606000611f87836002612ac5565b611f92906002612a99565b67ffffffffffffffff811115611faa57611faa612c16565b6040519080825280601f01601f191660200182016040528015611fd4576020820181803683370190505b509050600360fc1b81600081518110611fef57611fef612c00565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061201e5761201e612c00565b60200101906001600160f81b031916908160001a9053506000612042846002612ac5565b61204d906001612a99565b90505b60018111156120c5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061208157612081612c00565b1a60f81b82828151811061209757612097612c00565b60200101906001600160f81b031916908160001a90535060049490941c936120be81612b27565b9050612050565b5083156112b75760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161075f565b60006001600160a01b0384163b1561221657604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906121589033908990889088906004016128eb565b602060405180830381600087803b15801561217257600080fd5b505af19250505080156121a2575060408051601f3d908101601f1916820190925261219f918101906126aa565b60015b6121fc573d8080156121d0576040519150601f19603f3d011682016040523d82523d6000602084013e6121d5565b606091505b5080516121f45760405162461bcd60e51b815260040161075f906129ad565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061173e565b506001949350505050565b61222b8383612254565b6122386000848484612114565b61091e5760405162461bcd60e51b815260040161075f906129ad565b6001600160a01b0382166122aa5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161075f565b6000818152600360205260409020546001600160a01b03161561230f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161075f565b61231b60008383611d6e565b6001600160a01b0382166000908152600460205260408120805460019290612344908490612a99565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546123ae90612b3e565b90600052602060002090601f0160209004810192826123d05760008555612416565b82601f106123e957805160ff1916838001178555612416565b82800160010185558215612416579182015b828111156124165782518255916020019190600101906123fb565b50612422929150612426565b5090565b5b808211156124225760008155600101612427565b600067ffffffffffffffff8084111561245657612456612c16565b604051601f8501601f19908116603f0116810190828211818310171561247e5761247e612c16565b8160405280935085815286868601111561249757600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b03811681146124c857600080fd5b919050565b6000602082840312156124df57600080fd5b6112b7826124b1565b600080604083850312156124fb57600080fd5b612504836124b1565b9150612512602084016124b1565b90509250929050565b60008060006060848603121561253057600080fd5b612539846124b1565b9250612547602085016124b1565b9150604084013590509250925092565b6000806000806080858703121561256d57600080fd5b612576856124b1565b9350612584602086016124b1565b925060408501359150606085013567ffffffffffffffff8111156125a757600080fd5b8501601f810187136125b857600080fd5b6125c78782356020840161243b565b91505092959194509250565b600080604083850312156125e657600080fd5b6125ef836124b1565b915060208301356125ff81612c2c565b809150509250929050565b6000806040838503121561261d57600080fd5b612626836124b1565b946020939093013593505050565b60006020828403121561264657600080fd5b81516112b781612c2c565b60006020828403121561266357600080fd5b5035919050565b6000806040838503121561267d57600080fd5b82359150612512602084016124b1565b60006020828403121561269f57600080fd5b81356112b781612c3a565b6000602082840312156126bc57600080fd5b81516112b781612c3a565b6000602082840312156126d957600080fd5b813567ffffffffffffffff8111156126f057600080fd5b8201601f8101841361270157600080fd5b61173e8482356020840161243b565b60006020828403121561272257600080fd5b5051919050565b6000806040838503121561273c57600080fd5b50508035926020909101359150565b60008151808452612763816020860160208601612afb565b601f01601f19169290920160200192915050565b6002811061279557634e487b7160e01b600052602160045260246000fd5b9052565b600081516127ab818560208601612afb565b9290920192915050565b600080855481600182811c9150808316806127d157607f831692505b60208084108214156127f157634e487b7160e01b86526022600452602486fd5b818015612805576001811461281657612843565b60ff19861689528489019650612843565b60008c81526020902060005b8681101561283b5781548b820152908501908301612822565b505084890196505b50505050505061286c6128666128598388612799565b602f60f81b815260010190565b85612799565b9695505050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516128ae816017850160208801612afb565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516128df816028840160208801612afb565b01602801949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061286c9083018461274b565b6001600160a01b0384168152602081018390526060810161173e6040830184612777565b602081016106528284612777565b6020815260006112b7602083018461274b565b6020808252602a908201527f4d696e746572436f6e74726f6c3a206e6f74206120534d4f4c425241494e5f4d604082015269494e5445525f524f4c4560b01b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526029908201527f4d696e746572436f6e74726f6c3a206e6f74206120534d4f4c425241494e5f4f604082015268574e45525f524f4c4560b81b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60008219821115612aac57612aac612ba8565b500190565b600082612ac057612ac0612bbe565b500490565b6000816000190483118215151615612adf57612adf612ba8565b500290565b600082821015612af657612af6612ba8565b500390565b60005b83811015612b16578181015183820152602001612afe565b838111156111b15750506000910152565b600081612b3657612b36612ba8565b506000190190565b600181811c90821680612b5257607f821691505b60208210811415612b7357634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612b8d57612b8d612ba8565b5060010190565b600082612ba357612ba3612bbe565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114610a0057600080fd5b6001600160e01b031981168114610a0057600080fdfecffa9b50753c7b5036f84470434f5fc280bacb0c75da644f758e47448764b1fda264697066735822122029930652494c1e137b1363a560550fc581b13ac3fe1db8de02e2f1e0176d722b64736f6c634300080700334552433732313a207472616e7366657220746f206e6f6e204552433732315265cffa9b50753c7b5036f84470434f5fc280bacb0c75da644f758e47448764b1fd536d6f6c427261696e3a20657863656564656420746f6b656e496420666f72200000000000000000000000008212032375f79eaf70068c7b4182f31c2af1f164

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

0000000000000000000000008212032375f79eaf70068c7b4182f31c2af1f164

-----Decoded View---------------
Arg [0] : _luckyWinner (address): 0x8212032375f79eaf70068c7b4182f31c2af1f164

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000008212032375f79eaf70068c7b4182f31c2af1f164


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.