POL Price: $0.217404 (-0.42%)
Gas: 30 GWei
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Token Holdings

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Safe Mint With S...294466962022-06-11 18:47:471046 days ago1654973267IN
0x3c0f5510...9eF263077
0 POL0.0106577343.27768085
Safe Mint With S...294466832022-06-11 18:47:211046 days ago1654973241IN
0x3c0f5510...9eF263077
0 POL0.0218819837.63599891
Safe Mint With S...294465482022-06-11 18:42:431046 days ago1654972963IN
0x3c0f5510...9eF263077
0 POL0.0130189553.13405282
Safe Mint With S...294462832022-06-11 18:33:371046 days ago1654972417IN
0x3c0f5510...9eF263077
0 POL0.0074346330.00000001
Safe Mint With S...294461392022-06-11 18:28:371046 days ago1654972117IN
0x3c0f5510...9eF263077
0 POL0.0075605931.00000002
Safe Mint With S...294460802022-06-11 18:26:391046 days ago1654971999IN
0x3c0f5510...9eF263077
0 POL0.0079691532.0638754
Safe Mint With S...294460712022-06-11 18:26:171046 days ago1654971977IN
0x3c0f5510...9eF263077
0 POL0.009108437.2611096
Safe Mint With S...294460682022-06-11 18:26:111046 days ago1654971971IN
0x3c0f5510...9eF263077
0 POL0.0191897333.05554166
Safe Mint With S...294459862022-06-11 18:23:231046 days ago1654971803IN
0x3c0f5510...9eF263077
0 POL0.0110001645
Safe Mint With S...294453912022-06-11 18:02:561046 days ago1654970576IN
0x3c0f5510...9eF263077
0 POL0.0088081435.76708252
Safe Mint With S...294444792022-06-11 17:31:291046 days ago1654968689IN
0x3c0f5510...9eF263077
0 POL0.0403265137.22531403
Safe Mint With S...294440232022-06-11 17:15:491046 days ago1654967749IN
0x3c0f5510...9eF263077
0 POL0.0074283630.04418665
Safe Mint With S...294438502022-06-11 17:09:551046 days ago1654967395IN
0x3c0f5510...9eF263077
0 POL0.00781431.96589872
Safe Mint With S...294434232022-06-11 16:55:121046 days ago1654966512IN
0x3c0f5510...9eF263077
0 POL0.0585293136.92463493
Safe Mint With S...294429552022-06-11 16:39:081046 days ago1654965548IN
0x3c0f5510...9eF263077
0 POL0.015502637.68165342
Safe Mint With S...294418392022-06-11 16:00:441046 days ago1654963244IN
0x3c0f5510...9eF263077
0 POL0.0228666493.81995933
Safe Mint With S...294417212022-06-11 15:56:401046 days ago1654963000IN
0x3c0f5510...9eF263077
0 POL0.0190180878.0296275
Safe Mint With S...294410912022-06-11 15:35:041046 days ago1654961704IN
0x3c0f5510...9eF263077
0 POL0.023643696.72241972
Safe Mint With S...294409002022-06-11 15:28:301046 days ago1654961310IN
0x3c0f5510...9eF263077
0 POL0.1397056339.3119822
Safe Mint With S...294405272022-06-11 15:15:401046 days ago1654960540IN
0x3c0f5510...9eF263077
0 POL0.04530177183.22401205
Safe Mint With S...294392842022-06-11 14:30:451046 days ago1654957845IN
0x3c0f5510...9eF263077
0 POL0.0311397475.69029408
Safe Mint With S...294375812022-06-11 13:30:071046 days ago1654954207IN
0x3c0f5510...9eF263077
0 POL0.0132362831.9759423
Safe Mint With S...294373022022-06-11 13:20:291046 days ago1654953629IN
0x3c0f5510...9eF263077
0 POL0.0135420554.77112358
Safe Mint With S...294369582022-06-11 13:08:411046 days ago1654952921IN
0x3c0f5510...9eF263077
0 POL0.13263223121.92569358
Safe Mint With S...294369322022-06-11 13:07:491046 days ago1654952869IN
0x3c0f5510...9eF263077
0 POL0.5981317152
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MintChibiCitizen

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 17 : MintChibiCitizen.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

// @openzeppelin 4.4.1
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "./interfaces/IMintChibiCitizen.sol";
import "./interfaces/IChibiCitizen.sol";
import "./Base.sol";

/**
 * Mint Chibi Citizen, contain all related functions to mint citizens
 */
contract MintChibiCitizen is IMintChibiCitizen, Base {
    /** --------------------STORAGE VARIABLES-------------------- */
    /**
     * max citizens can be minted per transaction
     */
    uint16 public constant MAX_CITIZENS_MINTED_PER_TX = 100;
    /**
     * probability for minting citizen: Soldier (10%), Farmer (30%), Trader (30%), Craftsman (30%)
     */
    uint8[4] public citizenProbabilities = [1, 3, 3, 3];
    /**
     * external contracts
     */
    IChibiCitizen public chibiCitizenContract;
    IERC721 public sealContract;
    ERC20Burnable public shinContract;
    /**
     * seals already used for minting
     */
    uint16 public numberOfSealsUsed;
    /**
     * current generation data
     */
    ChibiGeneration private _currentGeneration;
    /**
     * mapping to check if Seal was already used to claim Chibi Citizen
     */
    mapping(uint256 => bool) private _sealsUsed;
    /**
     * mapping of whitelist users
     */
    mapping(address => WhitelistAddress) private _whitelist;

    uint16 private _soldierThreshold;
    uint16 private _farmerThreshold;
    uint16 private _traderThreshold;

    /** --------------------STORAGE VARIABLES-------------------- */

    /** --------------------MODIFIERS-------------------- */
    /**
     * check if having enough citizens to mint
     */
    modifier onlyWhenHaveEnoughAvailableCitizens(uint256 numberOfTokens) {
        uint16 numberOfRemainingCitizens = _getNumberOfRemainingCitizens();
        require(
            numberOfRemainingCitizens > 0 &&
                numberOfTokens <= numberOfRemainingCitizens,
            "CHIBI::NOT_ENOUGH_AVAILABLE_CITIZENS_TO_MINT"
        );
        _;
    }

    /**
     * check if exceeding maximum citizens allowed to mint per transaction
     */
    modifier onlyWhenNotExceedMaximumCitizensPerTx(uint256 numberOfTokens) {
        require(
            numberOfTokens <= MAX_CITIZENS_MINTED_PER_TX,
            "CHIBI::EXCEED_MAXIMUM_CITIZENS_PER_TRANSACTION"
        );
        _;
    }

    /** --------------------MODIFIERS-------------------- */

    /** --------------------EXTERNAL FUNCTIONS-------------------- */
    /**
     * see {IMintChibiCitizen-safeMintCitizenWithSeal}
     */
    function safeMintWithSeal(uint256[] calldata sealTokenIds)
        external
        override
        onlyWhenHaveEnoughAvailableCitizens(sealTokenIds.length)
        onlyWhenNotExceedMaximumCitizensPerTx(sealTokenIds.length)
        nonReentrant
    {
        require(
            _currentGeneration.mintWithSealEnabled,
            "CHIBI:MINTING_IS_DISABLED"
        );
        require(sealTokenIds.length > 0, "CHIBI::SEALS_ARE_REQUIRED");

        for (uint256 i = 0; i < sealTokenIds.length; i++) {
            require(
                _sealsUsed[sealTokenIds[i]] == false,
                string(
                    abi.encodePacked(
                        "CHIBI::SEAL_TOKEN_WAS_ALREADY_USED(",
                        Strings.toString(sealTokenIds[i]),
                        ")"
                    )
                )
            );
            require(
                sealContract.ownerOf(sealTokenIds[i]) == _msgSender(),
                string(
                    abi.encodePacked(
                        "CHIBI::MUST_BE_OWNER_OF_SEAL(",
                        Strings.toString(sealTokenIds[i]),
                        ")"
                    )
                )
            );
        }

        numberOfSealsUsed += uint16(sealTokenIds.length);
        for (uint256 i = 0; i < sealTokenIds.length; i++) {
            _sealsUsed[sealTokenIds[i]] = true;
            _mintCitizen(1);
        }
    }

    /**
     * see {IMintChibiCitizen-safeMintWithWhitelist}
     */
    function safeMintWithWhitelist()
        external
        override
        onlyWhenHaveEnoughAvailableCitizens(1)
        nonReentrant
    {
        require(
            _currentGeneration.mintWithWhitelistEnabled,
            "CHIBI:MINTING_IS_DISABLED"
        );
        require(_whitelist[msg.sender].isWhitelisted, "CHIBI:NOT_IN_WHITELIST");
        require(
            _whitelist[msg.sender].availableSlots >
                _whitelist[msg.sender].citizensClaimed,
            "CHIBI:NO_AVAILABLE_SLOTS_LEFT"
        );

        uint16 numberOfRemainingCitizens = _getNumberOfRemainingCitizens();
        uint256 numberOfTokens = _whitelist[msg.sender].availableSlots -
            _whitelist[msg.sender].citizensClaimed;
        // can only mint the maximum number of citizens per transaction
        if (numberOfTokens > MAX_CITIZENS_MINTED_PER_TX) {
            numberOfTokens = MAX_CITIZENS_MINTED_PER_TX;
        }
        // can only mint available citizens
        if (numberOfTokens > numberOfRemainingCitizens) {
            numberOfTokens = numberOfRemainingCitizens;
        }

        // update number of citizens claimed
        _whitelist[msg.sender].citizensClaimed += uint8(numberOfTokens);

        for (uint256 i = 0; i < numberOfTokens; i++) {
            _mintCitizen(2);
        }

        emit WhitelistUpdated(
            msg.sender,
            _whitelist[msg.sender].availableSlots,
            _whitelist[msg.sender].citizensClaimed
        );
    }

    /**
     * see {IMintChibiCitizen-safeMintWithShin}
     */
    function safeMintWithShin(uint256 numberOfTokens)
        external
        override
        onlyWhenHaveEnoughAvailableCitizens(numberOfTokens)
        onlyWhenNotExceedMaximumCitizensPerTx(numberOfTokens)
        nonReentrant
    {
        require(
            _currentGeneration.mintWithShinEnabled,
            "CHIBI:MINTING_IS_DISABLED"
        );
        uint256 shinRequired = numberOfTokens *
            _currentGeneration.costToMint *
            1 ether;
        require(
            shinContract.balanceOf(msg.sender) >= shinRequired,
            "CHIBI:NOT_ENOUGH_SHIN"
        );
        require(
            shinContract.allowance(msg.sender, address(this)) >= shinRequired,
            "CHIBI:NOT_ALLOWED_TO_BURN_SHIN"
        );

        // burn SHINs before minting citizen
        shinContract.burnFrom(msg.sender, shinRequired);

        for (uint256 i = 0; i < numberOfTokens; i++) {
            _mintCitizen(0);
        }
    }

    /**
     * see {IMintChibiCitizen-getCurrentGeneration}
     */
    function getCurrentGeneration()
        external
        view
        override
        returns (ChibiGeneration memory)
    {
        return _currentGeneration;
    }

    /**
     * see {IMintChibiCitizen-checkSealStatuses}
     */
    function checkSealStatuses(uint16[] calldata sealTokenIds)
        external
        view
        override
        returns (SealStatus memory status)
    {
        status.mintWithSealEnabled = _currentGeneration.mintWithSealEnabled;
        status.availableSlots = _getNumberOfRemainingCitizens();
        status.sealStatuses = new bool[](sealTokenIds.length);
        for (uint256 i = 0; i < sealTokenIds.length; i++) {
            status.sealStatuses[i] = !_sealsUsed[sealTokenIds[i]];
        }
    }

    /**
     * see {IMintChibiCitizen-checkWhitelistStatus}
     */
    function checkWhitelistStatus(address[] calldata addresses)
        external
        view
        override
        returns (WhitelistStatus memory status)
    {
        status.mintWithWhitelistEnabled = _currentGeneration
            .mintWithWhitelistEnabled;
        status.availableSlots = _getNumberOfRemainingCitizens();
        status.addressStatuses = new WhitelistAddress[](addresses.length);
        for (uint256 i = 0; i < addresses.length; i++) {
            status.addressStatuses[i] = _whitelist[addresses[i]];
        }
    }

    /**
     * see {IMintChibiCitizen-setExternalContractAddresses}
     */
    function setExternalContractAddresses(
        address chibiCitizenAddr,
        address sealAddr,
        address shinAddr
    ) external override onlyOwner {
        chibiCitizenContract = IChibiCitizen(chibiCitizenAddr);
        sealContract = IERC721(sealAddr);
        shinContract = ERC20Burnable(shinAddr);
    }

    /**
     * see {IMintChibiCitizen-initializeNewGeneration}
     */
    function initializeNewGeneration(
        uint8 generation,
        uint16 totalCitizens,
        bool mintWithSealEnabled,
        bool mintWithWhitelistEnabled,
        bool mintWithShinEnabled,
        uint16 costToMint
    ) external override onlyOwner {
        uint16 totalSoldiers = uint16(
            (totalCitizens * citizenProbabilities[0]) / 10
        );
        uint16 totalFarmers = uint16(
            (totalCitizens * citizenProbabilities[1]) / 10
        );
        uint16 totalTraders = uint16(
            (totalCitizens * citizenProbabilities[2]) / 10
        );
        _currentGeneration = ChibiGeneration({
            generation: generation,
            mintWithSealEnabled: mintWithSealEnabled,
            mintWithWhitelistEnabled: mintWithWhitelistEnabled,
            mintWithShinEnabled: mintWithShinEnabled,
            costToMint: costToMint,
            totalCitizens: totalCitizens,
            totalSoldiers: totalSoldiers,
            totalFarmers: totalFarmers,
            totalTraders: totalTraders,
            totalCraftsmen: totalCitizens -
                totalSoldiers -
                totalFarmers -
                totalTraders,
            soldiersMinted: 0,
            farmersMinted: 0,
            tradersMinted: 0,
            craftsmenMinted: 0
        });
        _soldierThreshold = _currentGeneration.totalSoldiers;
        _farmerThreshold =
            _currentGeneration.totalSoldiers +
            _currentGeneration.totalFarmers;
        _traderThreshold =
            _currentGeneration.totalSoldiers +
            _currentGeneration.totalFarmers +
            _currentGeneration.totalTraders;
        _emitMintEnabledEvent();
    }

    /**
     * see {IMintChibiCitizen-updateWhitelist}
     */
    function updateWhitelist(
        address[] calldata whitelistAddresses,
        uint8[] calldata availableSlots
    ) external override onlyOwner {
        require(
            whitelistAddresses.length == availableSlots.length,
            "CHIBI:ARRAY_LENGTHS_MUST_MATCH"
        );
        for (uint256 i = 0; i < whitelistAddresses.length; i++) {
            _whitelist[whitelistAddresses[i]].isWhitelisted = true;
            _whitelist[whitelistAddresses[i]].availableSlots = availableSlots[
                i
            ];
            emit WhitelistUpdated(
                whitelistAddresses[i],
                _whitelist[whitelistAddresses[i]].availableSlots,
                _whitelist[whitelistAddresses[i]].citizensClaimed
            );
        }
    }

    /**
     * see {IMintChibiCitizen-setMintCost}
     */
    function setMintCost(uint16 newCost) external override onlyOwner {
        _currentGeneration.costToMint = newCost;
        _emitMintEnabledEvent();
    }

    /**
     * see {IMintChibiCitizen-enableMintCitizenWithWhitelist}
     */
    function enableMintCitizenWithWhitelist(bool enabled)
        external
        override
        onlyOwner
    {
        _currentGeneration.mintWithWhitelistEnabled = enabled;
        _emitMintEnabledEvent();
    }

    /**
     * see {IMintChibiCitizen-enableMintCitizenWithShin}
     */
    function enableMintCitizenWithShin(bool enabled)
        external
        override
        onlyOwner
    {
        _currentGeneration.mintWithShinEnabled = enabled;
        _emitMintEnabledEvent();
    }

    /**
     * see {IMintChibiCitizen-enableMintCitizenWithSeal}
     */
    function enableMintCitizenWithSeal(bool enabled)
        external
        override
        onlyOwner
    {
        _currentGeneration.mintWithSealEnabled = enabled;
        _emitMintEnabledEvent();
    }

    /** --------------------EXTERNAL FUNCTIONS-------------------- */

    /** --------------------PRIVATE FUNCTIONS-------------------- */
    /**
     * mint chibi citizen, randomly pick one from availableSoldiersOld
     * mintMethod: 0 - Shin, 1 - Seal, 2 - Whitelist
     */
    function _mintCitizen(uint8 mintMethod) private {
        // randomize an index for a citizen
        // for example, if gen current generation is 1, total number of citizens is 10000,
        // if 0 <= random index < 1000: soldier
        // if 1000 <= random index < 4000: farmer
        // if 4000 <= random index < 7000: trader
        // else craftsman
        uint256 randomIndex = uint256(
            keccak256(
                abi.encodePacked(
                    block.difficulty,
                    block.number,
                    msg.sender,
                    _currentGeneration.soldiersMinted,
                    _currentGeneration.farmersMinted,
                    _currentGeneration.tradersMinted,
                    _currentGeneration.craftsmenMinted
                )
            )
        ) % _currentGeneration.totalCitizens;
        uint16 citizenClass;
        uint16 classId;

        // map citizen class
        if (randomIndex < _soldierThreshold) {
            citizenClass = 0;
        } else if (
            randomIndex >= _soldierThreshold && randomIndex < _farmerThreshold
        ) {
            citizenClass = 1;
        } else if (randomIndex < _traderThreshold) {
            citizenClass = 2;
        } else {
            citizenClass = 3;
        }

        // check if all citizens of the current class were minted, then change to another class if neccessary
        for (
            uint16 currentClass = citizenClass;
            currentClass < citizenClass + 4;
            currentClass++
        ) {
            uint16 class = currentClass % 4;
            if (
                class == 0 &&
                _currentGeneration.soldiersMinted <
                _currentGeneration.totalSoldiers
            ) {
                citizenClass = 0;
                break;
            }
            if (
                class == 1 &&
                _currentGeneration.farmersMinted <
                _currentGeneration.totalFarmers
            ) {
                citizenClass = 1;
                break;
            }
            if (
                class == 2 &&
                _currentGeneration.tradersMinted <
                _currentGeneration.totalTraders
            ) {
                citizenClass = 2;
                break;
            }
            if (
                class == 3 &&
                _currentGeneration.craftsmenMinted <
                _currentGeneration.totalCraftsmen
            ) {
                citizenClass = 3;
                break;
            }
        }

        // get class id
        if (citizenClass == 0) {
            classId = _currentGeneration.soldiersMinted;
            _currentGeneration.soldiersMinted += 1;
        } else if (citizenClass == 1) {
            classId = _currentGeneration.farmersMinted;
            _currentGeneration.farmersMinted += 1;
        } else if (citizenClass == 2) {
            classId = _currentGeneration.tradersMinted;
            _currentGeneration.tradersMinted += 1;
        } else {
            classId = _currentGeneration.craftsmenMinted;
            _currentGeneration.craftsmenMinted += 1;
        }

        // mint
        chibiCitizenContract.safeMint(
            msg.sender,
            _currentGeneration.generation,
            IChibiCitizen.CitizenClass(citizenClass),
            uint16(classId),
            mintMethod
        );
    }

    /**
     * remaining number of citizens
     */
    function _getNumberOfRemainingCitizens() private view returns (uint16) {
        return
            _currentGeneration.totalCitizens -
            _currentGeneration.soldiersMinted -
            _currentGeneration.farmersMinted -
            _currentGeneration.tradersMinted -
            _currentGeneration.craftsmenMinted;
    }

    /**
     * emit MintEnabled event
     */
    function _emitMintEnabledEvent() private {
        emit MintEnabled(
            _currentGeneration.generation,
            _currentGeneration.totalCitizens,
            _currentGeneration.mintWithSealEnabled,
            _currentGeneration.mintWithWhitelistEnabled,
            _currentGeneration.mintWithShinEnabled,
            _currentGeneration.costToMint
        );
    }
    /** --------------------PRIVATE FUNCTIONS-------------------- */
}

File 2 of 17 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 17 : ERC20Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        uint256 currentAllowance = allowance(account, _msgSender());
        require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
        unchecked {
            _approve(account, _msgSender(), currentAllowance - amount);
        }
        _burn(account, amount);
    }
}

File 4 of 17 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

File 5 of 17 : IMintChibiCitizen.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.2;

/**
 * Mint Chibi Citizen, contain all related functions to mint citizens
 */
interface IMintChibiCitizen {
    event MintEnabled(
        uint8 indexed currentGeneration,
        uint16 totalCitizens,
        bool mintWithSealEnabled,
        bool mintWithWhitelistEnabled,
        bool mintWithShinEnabled,
        uint16 costToMint
    );

    event WhitelistUpdated(
        address indexed walletAddress,
        uint8 availableSlots,
        uint8 citizensClaimed
    );

    struct ChibiGeneration {
        uint8 generation;
        bool mintWithSealEnabled;
        bool mintWithWhitelistEnabled;
        bool mintWithShinEnabled;
        uint16 costToMint;
        uint16 totalCitizens;
        uint16 totalSoldiers;
        uint16 totalFarmers;
        uint16 totalTraders;
        uint16 totalCraftsmen;
        uint16 soldiersMinted;
        uint16 farmersMinted;
        uint16 tradersMinted;
        uint16 craftsmenMinted;
    }

    struct SealStatus {
        bool mintWithSealEnabled;
        uint256 availableSlots;
        bool[] sealStatuses;
    }

    struct WhitelistAddress {
        bool isWhitelisted;
        uint8 availableSlots;
        uint8 citizensClaimed;
    }

    struct WhitelistStatus {
        bool mintWithWhitelistEnabled;
        uint256 availableSlots;
        WhitelistAddress[] addressStatuses;
    }

    /**
     * mint citizen with Seals. Each seal can only be used once.
     */
    function safeMintWithSeal(uint256[] calldata sealTokenIds) external;

    /**
     * mint citizen with whitelist, depending on available slots for each wallet
     */
    function safeMintWithWhitelist() external;

    /**
     * mint citizen with SHIN. Each seal can only be used once.
     */
    function safeMintWithShin(uint256 numberOfTokens) external;

    /**
     * get the current generation which is available to mint
     */
    function getCurrentGeneration()
        external
        view
        returns (ChibiGeneration memory);

    /*
     * check if Seals are egligible to claim Citizens
     */
    function checkSealStatuses(uint16[] calldata sealTokenIds)
        external
        view
        returns (SealStatus memory);

    /*
     * check if wallets are egligible to claim Citizens
     */
    function checkWhitelistStatus(address[] calldata addresses)
        external
        view
        returns (WhitelistStatus memory);

    /*
     * initialize new generation - only contract owner
     */
    function initializeNewGeneration(
        uint8 newGeneration,
        uint16 totalCitizens,
        bool mintWithSealEnabled,
        bool mintWithWhitelistEnabled,
        bool mintWithShinEnabled,
        uint16 costToMint
    ) external;

    /**
     * set external contract addresses (ChibiCitizen, Seal, Shin) - only contract owner
     */
    function setExternalContractAddresses(
        address chibiCitizenAddr,
        address sealAddr,
        address shinAddr
    ) external;

    /*
     * update whitelist - only contract owner
     */
    function updateWhitelist(
        address[] calldata whitelistAddresses,
        uint8[] calldata availableSlots
    ) external;

    /*
     * enable/disable minting with seal - only contract owner
     */
    function enableMintCitizenWithSeal(bool enabled) external;

    /*
     * enable/disable minting with whitelist - only contract owner
     */
    function enableMintCitizenWithWhitelist(bool enabled) external;

    /*
     * enable/disable minting with Shin - only contract owner
     */
    function enableMintCitizenWithShin(bool enabled) external;

    /*
     * set mint cost ($SHIN) - only contract owner
     */
    function setMintCost(uint16 newCost) external;
}

File 6 of 17 : IChibiCitizen.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.2;

interface IChibiCitizen {
    /**
     * Mint method: 0 - Shin, 1 - Seal, 2 - Whitelist
     */
    event Minted(
        uint256 indexed tokenId,
        uint8 indexed generation,
        CitizenClass indexed class,
        uint16 classId,
        uint8 mintMethod
    );
    event LevelChanged(
        uint256 indexed tokenId,
        uint8 indexed level,
        uint16 indexed exp
    );
    event MetadataChanged(
        uint256 indexed tokenId,
        uint8 indexed generation,
        CitizenClass indexed class,
        uint16 classId,
        uint8 level,
        uint16 exp
    );

    enum CitizenClass {
        SOLDIER,
        FARMER,
        TRADER,
        CRAFTSMAN
    }

    /**
     * Metadata of citizen
     */
    struct Citizen {
        CitizenClass class;
        uint16 classId;
        /** citizen generation from 0 => 5 */
        uint8 generation;
        /** default 1 */
        uint8 level;
        /** default 0 */
        uint16 exp;
        bool minted;
        uint256 tokenId;
    }

    /**
     * mint Citizen - only minters, which are other smart contracts (such as CitizenStaking contract)
     */
    function safeMint(
        address to,
        uint8 generation,
        CitizenClass citizenClass,
        uint16 classId,
        uint8 mintMethod
    ) external;

    /**
     * update citizen's level & exp - only level managers
     */
    function setLevel(
        uint256 tokenId,
        uint8 level,
        uint16 exp
    ) external;

    /**
     * update Citizen metadata - metadata managers, mostly to fix when something goes wrong
     */
    function setMetadata(
        uint256 tokenId,
        uint8 generation,
        CitizenClass citizenClass,
        uint16 classId,
        uint8 level,
        uint16 exp
    ) external;

    /**
     * set base token URI to use fixed metadata or dynamic metadata (including level, experience) - only contract owner
     */
    function setBaseTokenURI(
        string calldata baseTokenURI,
        bool useFixedMetadata
    ) external;

    /**
     * return token
     */
    function getToken(uint256 tokenId) external view returns (Citizen memory);

    /**
     * return all tokens
     */
    function getTokens(uint256 startIndex, uint256 numberOfTokens)
        external
        view
        returns (Citizen[] memory tokens);
}

File 7 of 17 : Base.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

// @openzeppelin 4.4.1
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./AccessControl.sol";
import "./interfaces/IBase.sol";

/**
 * Base contract
 */
abstract contract Base is IBase, AccessControl, ReentrancyGuard {
    /** --------------------EXTERNAL FUNCTIONS-------------------- */
    /**
     * see {IBase-withdrawAllERC20}
     */
    function withdrawAllERC20(IERC20 token)
        external
        override
        onlyOwner
        nonReentrant
    {
        uint256 balance = token.balanceOf(address(this));
        require(balance > 0, "CHIBI::BALANCE_MUST_BE_GREATER_THAN_0");

        token.transfer(owner(), balance);
    }
    /** --------------------EXTERNAL FUNCTIONS-------------------- */
}

File 8 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface 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 9 of 17 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens 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 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 12 of 17 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 14 of 17 : AccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

// @openzeppelin 4.4.1
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "./interfaces/IAccessControl.sol";

/**
 * Get the idea from Openzeppelin AccessControl
 */
abstract contract AccessControl is IAccessControl, Ownable {
    /** --------------------STORAGE VARIABLES-------------------- */
    struct RoleData {
        mapping(address => bool) members;
    }

    mapping(bytes32 => RoleData) private _roles;
    /** --------------------STORAGE VARIABLES-------------------- */

    /** --------------------MODIFIERS-------------------- */
    /**
     * 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})$/
     *
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /** --------------------MODIFIERS-------------------- */

    /** --------------------EXTERNAL FUNCTIONS-------------------- */
    /**
     * see {IAccessControl-hasRole}
     */
    function hasRole(bytes32 role, address account)
        external
        view
        override
        returns (bool)
    {
        return _roles[role].members[account];
    }

    /**
     * see {IAccessControl-grantRole}
     */
    function grantRole(bytes32 role, address account)
        external
        virtual
        override
        onlyOwner
    {
        _grantRole(role, account);
    }

    /**
     * see {IAccessControl-revokeRole}
     */
    function revokeRole(bytes32 role, address account)
        external
        virtual
        override
        onlyOwner
    {
        _revokeRole(role, account);
    }

    /**
     * see {IAccessControl-renounceRole}
     */
    function renounceRole(bytes32 role, address account)
        external
        virtual
        override
    {
        require(
            account == _msgSender(),
            "AccessControl: can only renounce roles for self"
        );

        _revokeRole(role, account);
    }

    /** --------------------EXTERNAL FUNCTIONS-------------------- */

    /** --------------------INTERNAL FUNCTIONS-------------------- */
    /**
     * @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 Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!_hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (_hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function _hasRole(bytes32 role, address account)
        internal
        view
        returns (bool)
    {
        return _roles[role].members[account];
    }
    /** --------------------INTERNAL FUNCTIONS-------------------- */
}

File 15 of 17 : IBase.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.2;

// @openzeppelin 4.4.1
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * Base contract
 */
interface IBase {
    /**
     * withdraw all ERC20 tokens - contract owner only
     */
    function withdrawAllERC20(IERC20 token) external;
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 17 of 17 : IAccessControl.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.2;

interface IAccessControl {
    /**
     * @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 Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must be owner.
     */
    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 be owner.
     */
    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 revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

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

Contract Security Audit

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"currentGeneration","type":"uint8"},{"indexed":false,"internalType":"uint16","name":"totalCitizens","type":"uint16"},{"indexed":false,"internalType":"bool","name":"mintWithSealEnabled","type":"bool"},{"indexed":false,"internalType":"bool","name":"mintWithWhitelistEnabled","type":"bool"},{"indexed":false,"internalType":"bool","name":"mintWithShinEnabled","type":"bool"},{"indexed":false,"internalType":"uint16","name":"costToMint","type":"uint16"}],"name":"MintEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":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":true,"internalType":"address","name":"walletAddress","type":"address"},{"indexed":false,"internalType":"uint8","name":"availableSlots","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"citizensClaimed","type":"uint8"}],"name":"WhitelistUpdated","type":"event"},{"inputs":[],"name":"MAX_CITIZENS_MINTED_PER_TX","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"sealTokenIds","type":"uint16[]"}],"name":"checkSealStatuses","outputs":[{"components":[{"internalType":"bool","name":"mintWithSealEnabled","type":"bool"},{"internalType":"uint256","name":"availableSlots","type":"uint256"},{"internalType":"bool[]","name":"sealStatuses","type":"bool[]"}],"internalType":"struct IMintChibiCitizen.SealStatus","name":"status","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"checkWhitelistStatus","outputs":[{"components":[{"internalType":"bool","name":"mintWithWhitelistEnabled","type":"bool"},{"internalType":"uint256","name":"availableSlots","type":"uint256"},{"components":[{"internalType":"bool","name":"isWhitelisted","type":"bool"},{"internalType":"uint8","name":"availableSlots","type":"uint8"},{"internalType":"uint8","name":"citizensClaimed","type":"uint8"}],"internalType":"struct IMintChibiCitizen.WhitelistAddress[]","name":"addressStatuses","type":"tuple[]"}],"internalType":"struct IMintChibiCitizen.WhitelistStatus","name":"status","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chibiCitizenContract","outputs":[{"internalType":"contract IChibiCitizen","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"citizenProbabilities","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"enableMintCitizenWithSeal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"enableMintCitizenWithShin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"enableMintCitizenWithWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentGeneration","outputs":[{"components":[{"internalType":"uint8","name":"generation","type":"uint8"},{"internalType":"bool","name":"mintWithSealEnabled","type":"bool"},{"internalType":"bool","name":"mintWithWhitelistEnabled","type":"bool"},{"internalType":"bool","name":"mintWithShinEnabled","type":"bool"},{"internalType":"uint16","name":"costToMint","type":"uint16"},{"internalType":"uint16","name":"totalCitizens","type":"uint16"},{"internalType":"uint16","name":"totalSoldiers","type":"uint16"},{"internalType":"uint16","name":"totalFarmers","type":"uint16"},{"internalType":"uint16","name":"totalTraders","type":"uint16"},{"internalType":"uint16","name":"totalCraftsmen","type":"uint16"},{"internalType":"uint16","name":"soldiersMinted","type":"uint16"},{"internalType":"uint16","name":"farmersMinted","type":"uint16"},{"internalType":"uint16","name":"tradersMinted","type":"uint16"},{"internalType":"uint16","name":"craftsmenMinted","type":"uint16"}],"internalType":"struct IMintChibiCitizen.ChibiGeneration","name":"","type":"tuple"}],"stateMutability":"view","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":"uint8","name":"generation","type":"uint8"},{"internalType":"uint16","name":"totalCitizens","type":"uint16"},{"internalType":"bool","name":"mintWithSealEnabled","type":"bool"},{"internalType":"bool","name":"mintWithWhitelistEnabled","type":"bool"},{"internalType":"bool","name":"mintWithShinEnabled","type":"bool"},{"internalType":"uint16","name":"costToMint","type":"uint16"}],"name":"initializeNewGeneration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"numberOfSealsUsed","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"uint256[]","name":"sealTokenIds","type":"uint256[]"}],"name":"safeMintWithSeal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfTokens","type":"uint256"}],"name":"safeMintWithShin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"safeMintWithWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealContract","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"chibiCitizenAddr","type":"address"},{"internalType":"address","name":"sealAddr","type":"address"},{"internalType":"address","name":"shinAddr","type":"address"}],"name":"setExternalContractAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"newCost","type":"uint16"}],"name":"setMintCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shinContract","outputs":[{"internalType":"contract ERC20Burnable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"whitelistAddresses","type":"address[]"},{"internalType":"uint8[]","name":"availableSlots","type":"uint8[]"}],"name":"updateWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"withdrawAllERC20","outputs":[],"stateMutability":"nonpayable","type":"function"}]

61010060405260016080908152600360a081905260c081905260e08190526200002a9160046200009f565b503480156200003857600080fd5b5062000044336200004f565b600160025562000150565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600183019183908215620001275791602002820160005b83821115620000f657835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302620000b6565b8015620001255782816101000a81549060ff0219169055600101602081600001049283019260010302620000f6565b505b506200013592915062000139565b5090565b5b808211156200013557600081556001016200013a565b612df780620001606000396000f3fe608060405234801561001057600080fd5b50600436106101485760003560e01c80624662581461014d578063072f5533146101765780632b3d19b91461018b5780632f2ff15d1461019e57806336120a39146101b157806336568abe146101c4578063485286e3146101d75780634b9a4863146101ea57806368bd580e146101fd578063715018a6146102105780637d6480c0146102185780637de26d6d14610240578063857abbd4146102535780638da5cb5b1461026657806391d148541461026e57806393cf35aa14610291578063a2ef4473146102a4578063a7688e6f146102c9578063ac722db9146102dc578063b4113b2e146102fc578063b7654dd61461045c578063c7bdecd91461046f578063d547741f14610477578063d9207dc41461048a578063df62f0b814610492578063f2fde38b146104a5578063fa3dfb30146104b8575b600080fd5b600454610160906001600160a01b031681565b60405161016d9190612794565b60405180910390f35b6101896101843660046125a4565b6104d8565b005b600654610160906001600160a01b031681565b6101896101ac3660046125dc565b610532565b6101896101bf36600461260b565b61056f565b6101896101d23660046125dc565b6105c0565b6101896101e53660046124b3565b61063a565b6101896101f836600461253c565b6106a8565b600554610160906001600160a01b031681565b610189610970565b60065461022d90600160a01b900461ffff1681565b60405161ffff909116815260200161016d565b61018961024e3660046125a4565b6109ab565b610189610261366004612474565b6109f5565b610160610bba565b61028161027c3660046125dc565b610bc9565b604051901515815260200161016d565b61018961029f36600461266f565b610bf4565b6102b76102b2366004612625565b611011565b60405160ff909116815260200161016d565b6101896102d73660046125a4565b61103b565b6102ef6102ea3660046124fd565b611087565b60405161016d9190612aeb565b61044f604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081019190915250604080516101c08101825260075460ff8082168352610100808304821615156020850152620100008304821615159484019490945263010000008204161515606083015261ffff600160201b820481166080840152600160301b8204811660a0840152600160401b8204811660c0840152600160501b8204811660e0840152600160601b8204811693830193909352600160701b81048316610120830152600160801b81048316610140830152600160901b81048316610160830152600160a01b81048316610180830152600160b01b90049091166101a082015290565b60405161016d9190612987565b61018961046a3660046124fd565b61120e565b6101896115a7565b6101896104853660046125dc565b61181b565b61022d606481565b6101896104a0366004612625565b61184a565b6101896104b3366004612474565b611b4e565b6104cb6104c63660046124fd565b611beb565b60405161016d9190612a82565b336104e1610bba565b6001600160a01b0316146105105760405162461bcd60e51b81526004016105079061284e565b60405180910390fd5b6007805463ff000000191663010000008315150217905561052f611d24565b50565b3361053b610bba565b6001600160a01b0316146105615760405162461bcd60e51b81526004016105079061284e565b61056b8282611da9565b5050565b33610578610bba565b6001600160a01b03161461059e5760405162461bcd60e51b81526004016105079061284e565b6007805461ffff60201b1916600160201b61ffff84160217905561052f611d24565b6001600160a01b03811633146106305760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610507565b61056b8282611e14565b33610643610bba565b6001600160a01b0316146106695760405162461bcd60e51b81526004016105079061284e565b600480546001600160a01b039485166001600160a01b031991821617909155600580549385169382169390931790925560068054919093169116179055565b336106b1610bba565b6001600160a01b0316146106d75760405162461bcd60e51b81526004016105079061284e565b8281146107265760405162461bcd60e51b815260206004820152601e60248201527f43484942493a41525241595f4c454e475448535f4d5553545f4d4154434800006044820152606401610507565b60005b838110156109695760016009600087878581811061075757634e487b7160e01b600052603260045260246000fd5b905060200201602081019061076c9190612474565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558282828181106107b457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906107c99190612655565b600960008787858181106107ed57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108029190612474565b6001600160a01b031681526020810191909152604001600020805460ff929092166101000261ff001990921691909117905584848281811061085457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108699190612474565b6001600160a01b0316600080516020612da2833981519152600960008888868181106108a557634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108ba9190612474565b6001600160a01b031681526020810191909152604001600090812054610100900460ff169060099089898781811061090257634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109179190612474565b6001600160a01b03168152602080820192909252604090810160002054815160ff948516815262010000909104909316918301919091520160405180910390a28061096181612d02565b915050610729565b5050505050565b33610979610bba565b6001600160a01b03161461099f5760405162461bcd60e51b81526004016105079061284e565b6109a96000611e7b565b565b336109b4610bba565b6001600160a01b0316146109da5760405162461bcd60e51b81526004016105079061284e565b6007805461ff0019166101008315150217905561052f611d24565b336109fe610bba565b6001600160a01b031614610a245760405162461bcd60e51b81526004016105079061284e565b600280541415610a465760405162461bcd60e51b815260040161050790612950565b600280556040516370a0823160e01b81526000906001600160a01b038316906370a0823190610a79903090600401612794565b60206040518083038186803b158015610a9157600080fd5b505afa158015610aa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac9919061263d565b905060008111610b295760405162461bcd60e51b815260206004820152602560248201527f43484942493a3a42414c414e43455f4d5553545f42455f475245415445525f54604482015264048414e5f360dc1b6064820152608401610507565b816001600160a01b031663a9059cbb610b40610bba565b836040518363ffffffff1660e01b8152600401610b5e9291906127a8565b602060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb091906125c0565b5050600160025550565b6000546001600160a01b031690565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b33610bfd610bba565b6001600160a01b031614610c235760405162461bcd60e51b81526004016105079061284e565b600354600090600a90610c399060ff1688612c0a565b610c439190612bd5565b600354909150600090600a90610c6190610100900460ff1689612c0a565b610c6b9190612bd5565b600354909150600090600a90610c8a9062010000900460ff168a612c0a565b610c949190612bd5565b9050604051806101c001604052808a60ff1681526020018815158152602001871515815260200186151581526020018561ffff1681526020018961ffff1681526020018461ffff1681526020018361ffff1681526020018261ffff1681526020018284868c610d039190612c53565b610d0d9190612c53565b610d179190612c53565b61ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff16815250600760008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548160ff02191690831515021790555060608201518160000160036101000a81548160ff02191690831515021790555060808201518160000160046101000a81548161ffff021916908361ffff16021790555060a08201518160000160066101000a81548161ffff021916908361ffff16021790555060c08201518160000160086101000a81548161ffff021916908361ffff16021790555060e082015181600001600a6101000a81548161ffff021916908361ffff16021790555061010082015181600001600c6101000a81548161ffff021916908361ffff16021790555061012082015181600001600e6101000a81548161ffff021916908361ffff1602179055506101408201518160000160106101000a81548161ffff021916908361ffff1602179055506101608201518160000160126101000a81548161ffff021916908361ffff1602179055506101808201518160000160146101000a81548161ffff021916908361ffff1602179055506101a08201518160000160166101000a81548161ffff021916908361ffff160217905550905050600760000160089054906101000a900461ffff16600a60006101000a81548161ffff021916908361ffff1602179055506007600001600a9054906101000a900461ffff16600760000160089054906101000a900461ffff16610f969190612b72565b600a805463ffff000019166201000061ffff93841602179055600754600160601b8104821691610fd891600160501b8104821691600160401b90910416612b72565b610fe29190612b72565b600a60046101000a81548161ffff021916908361ffff160217905550611006611d24565b505050505050505050565b6003816004811061102157600080fd5b60209182820401919006915054906101000a900460ff1681565b33611044610bba565b6001600160a01b03161461106a5760405162461bcd60e51b81526004016105079061284e565b6007805462ff00001916620100008315150217905561052f611d24565b6040805160608082018352600060208301529181019190915260075462010000900460ff16151581526110b8611ecb565b61ffff166020820152816001600160401b038111156110e757634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561113257816020015b60408051606081018252600080825260208083018290529282015282526000199092019101816111055790505b50604082015260005b82811015611207576009600085858481811061116757634e487b7160e01b600052603260045260246000fd5b905060200201602081019061117c9190612474565b6001600160a01b0316815260208082019290925260409081016000208151606081018352905460ff808216151583526101008204811694830194909452620100009004909216828201528301518051839081106111e957634e487b7160e01b600052603260045260246000fd5b602002602001018190525080806111ff90612d02565b91505061113b565b5092915050565b806000611219611ecb565b905060008161ffff1611801561123357508061ffff168211155b61124f5760405162461bcd60e51b815260040161050790612904565b8260648111156112715760405162461bcd60e51b815260040161050790612883565b6002805414156112935760405162461bcd60e51b815260040161050790612950565b60028055600754610100900460ff166112be5760405162461bcd60e51b8152600401610507906128d1565b836113075760405162461bcd60e51b815260206004820152601960248201527810d21250924e8e94d1505314d7d0549157d491545552549151603a1b6044820152606401610507565b60005b848110156114e6576008600087878481811061133657634e487b7160e01b600052603260045260246000fd5b602090810292909201358352508101919091526040016000205460ff161561138387878481811061137757634e487b7160e01b600052603260045260246000fd5b90506020020135611f30565b6040516020016113939190612738565b604051602081830303815290604052906113c05760405162461bcd60e51b8152600401610507919061281b565b5060055433906001600160a01b0316636352211e8888858181106113f457634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b815260040161141991815260200190565b60206040518083038186803b15801561143157600080fd5b505afa158015611445573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114699190612497565b6001600160a01b03161461149687878481811061137757634e487b7160e01b600052603260045260246000fd5b6040516020016114a691906126e8565b604051602081830303815290604052906114d35760405162461bcd60e51b8152600401610507919061281b565b50806114de81612d02565b91505061130a565b5060068054859190601490611507908490600160a01b900461ffff16612b72565b92506101000a81548161ffff021916908361ffff16021790555060005b8481101561159a5760016008600088888581811061155257634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055506115886001612051565b8061159281612d02565b915050611524565b5050600160025550505050565b600160006115b3611ecb565b905060008161ffff161180156115cd57508061ffff168211155b6115e95760405162461bcd60e51b815260040161050790612904565b60028054141561160b5760405162461bcd60e51b815260040161050790612950565b6002805560075462010000900460ff166116375760405162461bcd60e51b8152600401610507906128d1565b3360009081526009602052604090205460ff1661168f5760405162461bcd60e51b815260206004820152601660248201527510d21250924e9393d517d25397d5d2125511531254d560521b6044820152606401610507565b3360009081526009602052604090205460ff620100008204811661010090920416116116fd5760405162461bcd60e51b815260206004820152601d60248201527f43484942493a4e4f5f415641494c41424c455f534c4f54535f4c4546540000006044820152606401610507565b6000611707611ecb565b33600090815260096020526040812054919250906117359060ff620100008204811691610100900416612c8d565b60ff1690506064811115611747575060645b8161ffff1681111561175a575061ffff81165b336000908152600960205260409020805482919060029061178590849062010000900460ff16612bb0565b92506101000a81548160ff021916908360ff16021790555060005b818110156117c4576117b26002612051565b806117bc81612d02565b9150506117a0565b503360008181526009602090815260409182902054825160ff6101008304811682526201000090920490911691810191909152600080516020612da2833981519152910160405180910390a2505060016002555050565b33611824610bba565b6001600160a01b0316146106305760405162461bcd60e51b81526004016105079061284e565b806000611855611ecb565b905060008161ffff1611801561186f57508061ffff168211155b61188b5760405162461bcd60e51b815260040161050790612904565b8260648111156118ad5760405162461bcd60e51b815260040161050790612883565b6002805414156118cf5760405162461bcd60e51b815260040161050790612950565b600280556007546301000000900460ff166118fc5760405162461bcd60e51b8152600401610507906128d1565b60075460009061191790600160201b900461ffff1686612c34565b61192990670de0b6b3a7640000612c34565b6006546040516370a0823160e01b815291925082916001600160a01b03909116906370a082319061195e903390600401612794565b60206040518083038186803b15801561197657600080fd5b505afa15801561198a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ae919061263d565b10156119f45760405162461bcd60e51b815260206004820152601560248201527421a424a1249d2727aa2fa2a727aaa3a42fa9a424a760591b6044820152606401610507565b600654604051636eb1769f60e11b815233600482015230602482015282916001600160a01b03169063dd62ed3e9060440160206040518083038186803b158015611a3d57600080fd5b505afa158015611a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a75919061263d565b1015611ac35760405162461bcd60e51b815260206004820152601e60248201527f43484942493a4e4f545f414c4c4f5745445f544f5f4255524e5f5348494e00006044820152606401610507565b60065460405163079cc67960e41b81526001600160a01b03909116906379cc679090611af590339085906004016127a8565b600060405180830381600087803b158015611b0f57600080fd5b505af1158015611b23573d6000803e3d6000fd5b5050505060005b8581101561159a57611b3c6000612051565b80611b4681612d02565b915050611b2a565b33611b57610bba565b6001600160a01b031614611b7d5760405162461bcd60e51b81526004016105079061284e565b6001600160a01b038116611be25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610507565b61052f81611e7b565b60408051606080820183526000602083015291810191909152600754610100900460ff1615158152611c1b611ecb565b61ffff166020820152816001600160401b03811115611c4a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611c73578160200160208202803683370190505b50604082015260005b828110156112075760086000858584818110611ca857634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611cbd919061260b565b61ffff16815260200190815260200160002060009054906101000a900460ff161582604001518281518110611d0257634e487b7160e01b600052603260045260246000fd5b9115156020928302919091019091015280611d1c81612d02565b915050611c7c565b6007546040805161ffff600160301b84048116825260ff6101008504811615156020840152620100008504811615159383019390935263010000008404831615156060830152600160201b84041660808201529116907f6311d2479b3c0119caf65f9c5bd246a1ebf1738ea5abc42727d22a8e81827d169060a00160405180910390a2565b611db38282610bc9565b61056b5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611e1e8282610bc9565b1561056b5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60075460009061ffff600160b01b8204811691600160a01b8104821691600160901b8204811691611f0d91600160801b8204811691600160301b900416612c53565b611f179190612c53565b611f219190612c53565b611f2b9190612c53565b905090565b606081611f545750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611f7e5780611f6881612d02565b9150611f779050600a83612bf6565b9150611f58565b6000816001600160401b03811115611fa657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611fd0576020820181803683370190505b5090505b841561204957611fe5600183612c76565b9150611ff2600a86612d3e565b611ffd906030612b98565b60f81b81838151811061202057634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612042600a86612bf6565b9450611fd4565b949350505050565b6007546040805144602082015243918101919091526001600160601b031933606090811b91909116908201526001600160f01b0319600160801b830460f090811b82166074840152600160901b8404811b82166076840152600160a01b8404811b82166078840152600160b01b8404901b16607a820152600091600160301b900461ffff1690607c016040516020818303038152906040528051906020012060001c6120fd9190612d3e565b600a54909150600090819061ffff1683101561211c576000915061216e565b600a5461ffff16831080159061213d5750600a5462010000900461ffff1683105b1561214b576001915061216e565b600a54600160201b900461ffff16831015612169576002915061216e565b600391505b815b61217b836004612b72565b61ffff168161ffff16101561228a576000612197600483612d1d565b905061ffff81161580156121c0575060075461ffff600160401b82048116600160801b90920416105b156121cf57600093505061228a565b8061ffff1660011480156121f8575060075461ffff600160501b82048116600160901b90920416105b1561220757600193505061228a565b8061ffff166002148015612230575060075461ffff600160601b82048116600160a01b90920416105b1561223f57600293505061228a565b8061ffff166003148015612268575060075461ffff600160701b82048116600160b01b90920416105b1561227757600393505061228a565b508061228281612ce0565b915050612170565b5061ffff82166122d3575060078054600160801b900461ffff169060019060106122b48385612b72565b92506101000a81548161ffff021916908361ffff160217905550612368565b8161ffff1660011415612300575060078054600160901b900461ffff169060019060126122b48385612b72565b8161ffff166002141561232d575060078054600160a01b900461ffff169060019060146122b48385612b72565b5060078054600160b01b900461ffff1690600190601661234d8385612b72565b92506101000a81548161ffff021916908361ffff1602179055505b6004546007546001600160a01b0390911690634d18b18090339060ff1661ffff861660038111156123a957634e487b7160e01b600052602160045260246000fd5b85896040518663ffffffff1660e01b81526004016123cb9594939291906127c1565b600060405180830381600087803b1580156123e557600080fd5b505af11580156123f9573d6000803e3d6000fd5b5050505050505050565b60008083601f840112612414578182fd5b5081356001600160401b0381111561242a578182fd5b6020830191508360208260051b850101111561244557600080fd5b9250929050565b803561ffff8116811461245e57600080fd5b919050565b803560ff8116811461245e57600080fd5b600060208284031215612485578081fd5b813561249081612d7e565b9392505050565b6000602082840312156124a8578081fd5b815161249081612d7e565b6000806000606084860312156124c7578182fd5b83356124d281612d7e565b925060208401356124e281612d7e565b915060408401356124f281612d7e565b809150509250925092565b6000806020838503121561250f578182fd5b82356001600160401b03811115612524578283fd5b61253085828601612403565b90969095509350505050565b60008060008060408587031215612551578081fd5b84356001600160401b0380821115612567578283fd5b61257388838901612403565b9096509450602087013591508082111561258b578283fd5b5061259887828801612403565b95989497509550505050565b6000602082840312156125b5578081fd5b813561249081612d93565b6000602082840312156125d1578081fd5b815161249081612d93565b600080604083850312156125ee578182fd5b82359150602083013561260081612d7e565b809150509250929050565b60006020828403121561261c578081fd5b6124908261244c565b600060208284031215612636578081fd5b5035919050565b60006020828403121561264e578081fd5b5051919050565b600060208284031215612666578081fd5b61249082612463565b60008060008060008060c08789031215612687578384fd5b61269087612463565b955061269e6020880161244c565b945060408701356126ae81612d93565b935060608701356126be81612d93565b925060808701356126ce81612d93565b91506126dc60a0880161244c565b90509295509295509295565b7f43484942493a3a4d5553545f42455f4f574e45525f4f465f5345414c2800000081526000825161272081601d850160208701612cb0565b602960f81b601d939091019283015250601e01919050565b7f43484942493a3a5345414c5f544f4b454e5f5741535f414c52454144595f555381526208a88560eb1b60208201526000825161277c816023850160208701612cb0565b602960f81b6023939091019283015250602401919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038616815260ff8516602082015260a08101600485106127f857634e487b7160e01b600052602160045260246000fd5b84604083015261ffff8416606083015260ff831660808301529695505050505050565b602081526000825180602084015261283a816040850160208701612cb0565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602e908201527f43484942493a3a4558434545445f4d4158494d554d5f434954495a454e535f5060408201526d22a92faa2920a729a0a1aa24a7a760911b606082015260800190565b60208082526019908201527810d21250924e93525395125391d7d254d7d11254d050931151603a1b604082015260600190565b6020808252602c908201527f43484942493a3a4e4f545f454e4f5547485f415641494c41424c455f4349544960408201526b16915394d7d513d7d352539560a21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b815160ff1681526101c0810160208301516129a6602084018215159052565b5060408301516129ba604084018215159052565b5060608301516129ce606084018215159052565b5060808301516129e4608084018261ffff169052565b5060a08301516129fa60a084018261ffff169052565b5060c0830151612a1060c084018261ffff169052565b5060e0830151612a2660e084018261ffff169052565b506101008381015161ffff90811691840191909152610120808501518216908401526101408085015182169084015261016080850151821690840152610180808501518216908401526101a09384015116929091019190915290565b60006020808352608083018451151582850152818501516040850152604085015160608086015281815180845260a08701915084830193508592505b80831015612ae057835115158252928401926001929092019190840190612abe565b509695505050505050565b6000602080835260808301845115158285015281850151604081818701528087015191506060808188015283835180865260a08901915086850195508794505b80851015612b655785518051151583528781015160ff90811689850152908501511684830152948601946001949094019390820190612b2b565b5098975050505050505050565b600061ffff808316818516808303821115612b8f57612b8f612d52565b01949350505050565b60008219821115612bab57612bab612d52565b500190565b600060ff821660ff84168060ff03821115612bcd57612bcd612d52565b019392505050565b600061ffff80841680612bea57612bea612d68565b92169190910492915050565b600082612c0557612c05612d68565b500490565b600061ffff80831681851681830481118215151615612c2b57612c2b612d52565b02949350505050565b6000816000190483118215151615612c4e57612c4e612d52565b500290565b600061ffff83811690831681811015612c6e57612c6e612d52565b039392505050565b600082821015612c8857612c88612d52565b500390565b600060ff821660ff841680821015612ca757612ca7612d52565b90039392505050565b60005b83811015612ccb578181015183820152602001612cb3565b83811115612cda576000848401525b50505050565b600061ffff80831681811415612cf857612cf8612d52565b6001019392505050565b6000600019821415612d1657612d16612d52565b5060010190565b600061ffff80841680612d3257612d32612d68565b92169190910692915050565b600082612d4d57612d4d612d68565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461052f57600080fd5b801515811461052f57600080fdfe8a3076fe30ae874213c69601d62245a186c9729ae3d3c230d0a8d1732fe022d9a2646970667358221220c8267164d733c115157b41b93a15000e66e71a0a9ef1273f0c40d61534b350a264736f6c63430008040033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101485760003560e01c80624662581461014d578063072f5533146101765780632b3d19b91461018b5780632f2ff15d1461019e57806336120a39146101b157806336568abe146101c4578063485286e3146101d75780634b9a4863146101ea57806368bd580e146101fd578063715018a6146102105780637d6480c0146102185780637de26d6d14610240578063857abbd4146102535780638da5cb5b1461026657806391d148541461026e57806393cf35aa14610291578063a2ef4473146102a4578063a7688e6f146102c9578063ac722db9146102dc578063b4113b2e146102fc578063b7654dd61461045c578063c7bdecd91461046f578063d547741f14610477578063d9207dc41461048a578063df62f0b814610492578063f2fde38b146104a5578063fa3dfb30146104b8575b600080fd5b600454610160906001600160a01b031681565b60405161016d9190612794565b60405180910390f35b6101896101843660046125a4565b6104d8565b005b600654610160906001600160a01b031681565b6101896101ac3660046125dc565b610532565b6101896101bf36600461260b565b61056f565b6101896101d23660046125dc565b6105c0565b6101896101e53660046124b3565b61063a565b6101896101f836600461253c565b6106a8565b600554610160906001600160a01b031681565b610189610970565b60065461022d90600160a01b900461ffff1681565b60405161ffff909116815260200161016d565b61018961024e3660046125a4565b6109ab565b610189610261366004612474565b6109f5565b610160610bba565b61028161027c3660046125dc565b610bc9565b604051901515815260200161016d565b61018961029f36600461266f565b610bf4565b6102b76102b2366004612625565b611011565b60405160ff909116815260200161016d565b6101896102d73660046125a4565b61103b565b6102ef6102ea3660046124fd565b611087565b60405161016d9190612aeb565b61044f604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081019190915250604080516101c08101825260075460ff8082168352610100808304821615156020850152620100008304821615159484019490945263010000008204161515606083015261ffff600160201b820481166080840152600160301b8204811660a0840152600160401b8204811660c0840152600160501b8204811660e0840152600160601b8204811693830193909352600160701b81048316610120830152600160801b81048316610140830152600160901b81048316610160830152600160a01b81048316610180830152600160b01b90049091166101a082015290565b60405161016d9190612987565b61018961046a3660046124fd565b61120e565b6101896115a7565b6101896104853660046125dc565b61181b565b61022d606481565b6101896104a0366004612625565b61184a565b6101896104b3366004612474565b611b4e565b6104cb6104c63660046124fd565b611beb565b60405161016d9190612a82565b336104e1610bba565b6001600160a01b0316146105105760405162461bcd60e51b81526004016105079061284e565b60405180910390fd5b6007805463ff000000191663010000008315150217905561052f611d24565b50565b3361053b610bba565b6001600160a01b0316146105615760405162461bcd60e51b81526004016105079061284e565b61056b8282611da9565b5050565b33610578610bba565b6001600160a01b03161461059e5760405162461bcd60e51b81526004016105079061284e565b6007805461ffff60201b1916600160201b61ffff84160217905561052f611d24565b6001600160a01b03811633146106305760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610507565b61056b8282611e14565b33610643610bba565b6001600160a01b0316146106695760405162461bcd60e51b81526004016105079061284e565b600480546001600160a01b039485166001600160a01b031991821617909155600580549385169382169390931790925560068054919093169116179055565b336106b1610bba565b6001600160a01b0316146106d75760405162461bcd60e51b81526004016105079061284e565b8281146107265760405162461bcd60e51b815260206004820152601e60248201527f43484942493a41525241595f4c454e475448535f4d5553545f4d4154434800006044820152606401610507565b60005b838110156109695760016009600087878581811061075757634e487b7160e01b600052603260045260246000fd5b905060200201602081019061076c9190612474565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558282828181106107b457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906107c99190612655565b600960008787858181106107ed57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108029190612474565b6001600160a01b031681526020810191909152604001600020805460ff929092166101000261ff001990921691909117905584848281811061085457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108699190612474565b6001600160a01b0316600080516020612da2833981519152600960008888868181106108a557634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108ba9190612474565b6001600160a01b031681526020810191909152604001600090812054610100900460ff169060099089898781811061090257634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109179190612474565b6001600160a01b03168152602080820192909252604090810160002054815160ff948516815262010000909104909316918301919091520160405180910390a28061096181612d02565b915050610729565b5050505050565b33610979610bba565b6001600160a01b03161461099f5760405162461bcd60e51b81526004016105079061284e565b6109a96000611e7b565b565b336109b4610bba565b6001600160a01b0316146109da5760405162461bcd60e51b81526004016105079061284e565b6007805461ff0019166101008315150217905561052f611d24565b336109fe610bba565b6001600160a01b031614610a245760405162461bcd60e51b81526004016105079061284e565b600280541415610a465760405162461bcd60e51b815260040161050790612950565b600280556040516370a0823160e01b81526000906001600160a01b038316906370a0823190610a79903090600401612794565b60206040518083038186803b158015610a9157600080fd5b505afa158015610aa5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac9919061263d565b905060008111610b295760405162461bcd60e51b815260206004820152602560248201527f43484942493a3a42414c414e43455f4d5553545f42455f475245415445525f54604482015264048414e5f360dc1b6064820152608401610507565b816001600160a01b031663a9059cbb610b40610bba565b836040518363ffffffff1660e01b8152600401610b5e9291906127a8565b602060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb091906125c0565b5050600160025550565b6000546001600160a01b031690565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b33610bfd610bba565b6001600160a01b031614610c235760405162461bcd60e51b81526004016105079061284e565b600354600090600a90610c399060ff1688612c0a565b610c439190612bd5565b600354909150600090600a90610c6190610100900460ff1689612c0a565b610c6b9190612bd5565b600354909150600090600a90610c8a9062010000900460ff168a612c0a565b610c949190612bd5565b9050604051806101c001604052808a60ff1681526020018815158152602001871515815260200186151581526020018561ffff1681526020018961ffff1681526020018461ffff1681526020018361ffff1681526020018261ffff1681526020018284868c610d039190612c53565b610d0d9190612c53565b610d179190612c53565b61ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600061ffff16815250600760008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff02191690831515021790555060408201518160000160026101000a81548160ff02191690831515021790555060608201518160000160036101000a81548160ff02191690831515021790555060808201518160000160046101000a81548161ffff021916908361ffff16021790555060a08201518160000160066101000a81548161ffff021916908361ffff16021790555060c08201518160000160086101000a81548161ffff021916908361ffff16021790555060e082015181600001600a6101000a81548161ffff021916908361ffff16021790555061010082015181600001600c6101000a81548161ffff021916908361ffff16021790555061012082015181600001600e6101000a81548161ffff021916908361ffff1602179055506101408201518160000160106101000a81548161ffff021916908361ffff1602179055506101608201518160000160126101000a81548161ffff021916908361ffff1602179055506101808201518160000160146101000a81548161ffff021916908361ffff1602179055506101a08201518160000160166101000a81548161ffff021916908361ffff160217905550905050600760000160089054906101000a900461ffff16600a60006101000a81548161ffff021916908361ffff1602179055506007600001600a9054906101000a900461ffff16600760000160089054906101000a900461ffff16610f969190612b72565b600a805463ffff000019166201000061ffff93841602179055600754600160601b8104821691610fd891600160501b8104821691600160401b90910416612b72565b610fe29190612b72565b600a60046101000a81548161ffff021916908361ffff160217905550611006611d24565b505050505050505050565b6003816004811061102157600080fd5b60209182820401919006915054906101000a900460ff1681565b33611044610bba565b6001600160a01b03161461106a5760405162461bcd60e51b81526004016105079061284e565b6007805462ff00001916620100008315150217905561052f611d24565b6040805160608082018352600060208301529181019190915260075462010000900460ff16151581526110b8611ecb565b61ffff166020820152816001600160401b038111156110e757634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561113257816020015b60408051606081018252600080825260208083018290529282015282526000199092019101816111055790505b50604082015260005b82811015611207576009600085858481811061116757634e487b7160e01b600052603260045260246000fd5b905060200201602081019061117c9190612474565b6001600160a01b0316815260208082019290925260409081016000208151606081018352905460ff808216151583526101008204811694830194909452620100009004909216828201528301518051839081106111e957634e487b7160e01b600052603260045260246000fd5b602002602001018190525080806111ff90612d02565b91505061113b565b5092915050565b806000611219611ecb565b905060008161ffff1611801561123357508061ffff168211155b61124f5760405162461bcd60e51b815260040161050790612904565b8260648111156112715760405162461bcd60e51b815260040161050790612883565b6002805414156112935760405162461bcd60e51b815260040161050790612950565b60028055600754610100900460ff166112be5760405162461bcd60e51b8152600401610507906128d1565b836113075760405162461bcd60e51b815260206004820152601960248201527810d21250924e8e94d1505314d7d0549157d491545552549151603a1b6044820152606401610507565b60005b848110156114e6576008600087878481811061133657634e487b7160e01b600052603260045260246000fd5b602090810292909201358352508101919091526040016000205460ff161561138387878481811061137757634e487b7160e01b600052603260045260246000fd5b90506020020135611f30565b6040516020016113939190612738565b604051602081830303815290604052906113c05760405162461bcd60e51b8152600401610507919061281b565b5060055433906001600160a01b0316636352211e8888858181106113f457634e487b7160e01b600052603260045260246000fd5b905060200201356040518263ffffffff1660e01b815260040161141991815260200190565b60206040518083038186803b15801561143157600080fd5b505afa158015611445573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114699190612497565b6001600160a01b03161461149687878481811061137757634e487b7160e01b600052603260045260246000fd5b6040516020016114a691906126e8565b604051602081830303815290604052906114d35760405162461bcd60e51b8152600401610507919061281b565b50806114de81612d02565b91505061130a565b5060068054859190601490611507908490600160a01b900461ffff16612b72565b92506101000a81548161ffff021916908361ffff16021790555060005b8481101561159a5760016008600088888581811061155257634e487b7160e01b600052603260045260246000fd5b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055506115886001612051565b8061159281612d02565b915050611524565b5050600160025550505050565b600160006115b3611ecb565b905060008161ffff161180156115cd57508061ffff168211155b6115e95760405162461bcd60e51b815260040161050790612904565b60028054141561160b5760405162461bcd60e51b815260040161050790612950565b6002805560075462010000900460ff166116375760405162461bcd60e51b8152600401610507906128d1565b3360009081526009602052604090205460ff1661168f5760405162461bcd60e51b815260206004820152601660248201527510d21250924e9393d517d25397d5d2125511531254d560521b6044820152606401610507565b3360009081526009602052604090205460ff620100008204811661010090920416116116fd5760405162461bcd60e51b815260206004820152601d60248201527f43484942493a4e4f5f415641494c41424c455f534c4f54535f4c4546540000006044820152606401610507565b6000611707611ecb565b33600090815260096020526040812054919250906117359060ff620100008204811691610100900416612c8d565b60ff1690506064811115611747575060645b8161ffff1681111561175a575061ffff81165b336000908152600960205260409020805482919060029061178590849062010000900460ff16612bb0565b92506101000a81548160ff021916908360ff16021790555060005b818110156117c4576117b26002612051565b806117bc81612d02565b9150506117a0565b503360008181526009602090815260409182902054825160ff6101008304811682526201000090920490911691810191909152600080516020612da2833981519152910160405180910390a2505060016002555050565b33611824610bba565b6001600160a01b0316146106305760405162461bcd60e51b81526004016105079061284e565b806000611855611ecb565b905060008161ffff1611801561186f57508061ffff168211155b61188b5760405162461bcd60e51b815260040161050790612904565b8260648111156118ad5760405162461bcd60e51b815260040161050790612883565b6002805414156118cf5760405162461bcd60e51b815260040161050790612950565b600280556007546301000000900460ff166118fc5760405162461bcd60e51b8152600401610507906128d1565b60075460009061191790600160201b900461ffff1686612c34565b61192990670de0b6b3a7640000612c34565b6006546040516370a0823160e01b815291925082916001600160a01b03909116906370a082319061195e903390600401612794565b60206040518083038186803b15801561197657600080fd5b505afa15801561198a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ae919061263d565b10156119f45760405162461bcd60e51b815260206004820152601560248201527421a424a1249d2727aa2fa2a727aaa3a42fa9a424a760591b6044820152606401610507565b600654604051636eb1769f60e11b815233600482015230602482015282916001600160a01b03169063dd62ed3e9060440160206040518083038186803b158015611a3d57600080fd5b505afa158015611a51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a75919061263d565b1015611ac35760405162461bcd60e51b815260206004820152601e60248201527f43484942493a4e4f545f414c4c4f5745445f544f5f4255524e5f5348494e00006044820152606401610507565b60065460405163079cc67960e41b81526001600160a01b03909116906379cc679090611af590339085906004016127a8565b600060405180830381600087803b158015611b0f57600080fd5b505af1158015611b23573d6000803e3d6000fd5b5050505060005b8581101561159a57611b3c6000612051565b80611b4681612d02565b915050611b2a565b33611b57610bba565b6001600160a01b031614611b7d5760405162461bcd60e51b81526004016105079061284e565b6001600160a01b038116611be25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610507565b61052f81611e7b565b60408051606080820183526000602083015291810191909152600754610100900460ff1615158152611c1b611ecb565b61ffff166020820152816001600160401b03811115611c4a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611c73578160200160208202803683370190505b50604082015260005b828110156112075760086000858584818110611ca857634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611cbd919061260b565b61ffff16815260200190815260200160002060009054906101000a900460ff161582604001518281518110611d0257634e487b7160e01b600052603260045260246000fd5b9115156020928302919091019091015280611d1c81612d02565b915050611c7c565b6007546040805161ffff600160301b84048116825260ff6101008504811615156020840152620100008504811615159383019390935263010000008404831615156060830152600160201b84041660808201529116907f6311d2479b3c0119caf65f9c5bd246a1ebf1738ea5abc42727d22a8e81827d169060a00160405180910390a2565b611db38282610bc9565b61056b5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611e1e8282610bc9565b1561056b5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60075460009061ffff600160b01b8204811691600160a01b8104821691600160901b8204811691611f0d91600160801b8204811691600160301b900416612c53565b611f179190612c53565b611f219190612c53565b611f2b9190612c53565b905090565b606081611f545750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611f7e5780611f6881612d02565b9150611f779050600a83612bf6565b9150611f58565b6000816001600160401b03811115611fa657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611fd0576020820181803683370190505b5090505b841561204957611fe5600183612c76565b9150611ff2600a86612d3e565b611ffd906030612b98565b60f81b81838151811061202057634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612042600a86612bf6565b9450611fd4565b949350505050565b6007546040805144602082015243918101919091526001600160601b031933606090811b91909116908201526001600160f01b0319600160801b830460f090811b82166074840152600160901b8404811b82166076840152600160a01b8404811b82166078840152600160b01b8404901b16607a820152600091600160301b900461ffff1690607c016040516020818303038152906040528051906020012060001c6120fd9190612d3e565b600a54909150600090819061ffff1683101561211c576000915061216e565b600a5461ffff16831080159061213d5750600a5462010000900461ffff1683105b1561214b576001915061216e565b600a54600160201b900461ffff16831015612169576002915061216e565b600391505b815b61217b836004612b72565b61ffff168161ffff16101561228a576000612197600483612d1d565b905061ffff81161580156121c0575060075461ffff600160401b82048116600160801b90920416105b156121cf57600093505061228a565b8061ffff1660011480156121f8575060075461ffff600160501b82048116600160901b90920416105b1561220757600193505061228a565b8061ffff166002148015612230575060075461ffff600160601b82048116600160a01b90920416105b1561223f57600293505061228a565b8061ffff166003148015612268575060075461ffff600160701b82048116600160b01b90920416105b1561227757600393505061228a565b508061228281612ce0565b915050612170565b5061ffff82166122d3575060078054600160801b900461ffff169060019060106122b48385612b72565b92506101000a81548161ffff021916908361ffff160217905550612368565b8161ffff1660011415612300575060078054600160901b900461ffff169060019060126122b48385612b72565b8161ffff166002141561232d575060078054600160a01b900461ffff169060019060146122b48385612b72565b5060078054600160b01b900461ffff1690600190601661234d8385612b72565b92506101000a81548161ffff021916908361ffff1602179055505b6004546007546001600160a01b0390911690634d18b18090339060ff1661ffff861660038111156123a957634e487b7160e01b600052602160045260246000fd5b85896040518663ffffffff1660e01b81526004016123cb9594939291906127c1565b600060405180830381600087803b1580156123e557600080fd5b505af11580156123f9573d6000803e3d6000fd5b5050505050505050565b60008083601f840112612414578182fd5b5081356001600160401b0381111561242a578182fd5b6020830191508360208260051b850101111561244557600080fd5b9250929050565b803561ffff8116811461245e57600080fd5b919050565b803560ff8116811461245e57600080fd5b600060208284031215612485578081fd5b813561249081612d7e565b9392505050565b6000602082840312156124a8578081fd5b815161249081612d7e565b6000806000606084860312156124c7578182fd5b83356124d281612d7e565b925060208401356124e281612d7e565b915060408401356124f281612d7e565b809150509250925092565b6000806020838503121561250f578182fd5b82356001600160401b03811115612524578283fd5b61253085828601612403565b90969095509350505050565b60008060008060408587031215612551578081fd5b84356001600160401b0380821115612567578283fd5b61257388838901612403565b9096509450602087013591508082111561258b578283fd5b5061259887828801612403565b95989497509550505050565b6000602082840312156125b5578081fd5b813561249081612d93565b6000602082840312156125d1578081fd5b815161249081612d93565b600080604083850312156125ee578182fd5b82359150602083013561260081612d7e565b809150509250929050565b60006020828403121561261c578081fd5b6124908261244c565b600060208284031215612636578081fd5b5035919050565b60006020828403121561264e578081fd5b5051919050565b600060208284031215612666578081fd5b61249082612463565b60008060008060008060c08789031215612687578384fd5b61269087612463565b955061269e6020880161244c565b945060408701356126ae81612d93565b935060608701356126be81612d93565b925060808701356126ce81612d93565b91506126dc60a0880161244c565b90509295509295509295565b7f43484942493a3a4d5553545f42455f4f574e45525f4f465f5345414c2800000081526000825161272081601d850160208701612cb0565b602960f81b601d939091019283015250601e01919050565b7f43484942493a3a5345414c5f544f4b454e5f5741535f414c52454144595f555381526208a88560eb1b60208201526000825161277c816023850160208701612cb0565b602960f81b6023939091019283015250602401919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038616815260ff8516602082015260a08101600485106127f857634e487b7160e01b600052602160045260246000fd5b84604083015261ffff8416606083015260ff831660808301529695505050505050565b602081526000825180602084015261283a816040850160208701612cb0565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602e908201527f43484942493a3a4558434545445f4d4158494d554d5f434954495a454e535f5060408201526d22a92faa2920a729a0a1aa24a7a760911b606082015260800190565b60208082526019908201527810d21250924e93525395125391d7d254d7d11254d050931151603a1b604082015260600190565b6020808252602c908201527f43484942493a3a4e4f545f454e4f5547485f415641494c41424c455f4349544960408201526b16915394d7d513d7d352539560a21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b815160ff1681526101c0810160208301516129a6602084018215159052565b5060408301516129ba604084018215159052565b5060608301516129ce606084018215159052565b5060808301516129e4608084018261ffff169052565b5060a08301516129fa60a084018261ffff169052565b5060c0830151612a1060c084018261ffff169052565b5060e0830151612a2660e084018261ffff169052565b506101008381015161ffff90811691840191909152610120808501518216908401526101408085015182169084015261016080850151821690840152610180808501518216908401526101a09384015116929091019190915290565b60006020808352608083018451151582850152818501516040850152604085015160608086015281815180845260a08701915084830193508592505b80831015612ae057835115158252928401926001929092019190840190612abe565b509695505050505050565b6000602080835260808301845115158285015281850151604081818701528087015191506060808188015283835180865260a08901915086850195508794505b80851015612b655785518051151583528781015160ff90811689850152908501511684830152948601946001949094019390820190612b2b565b5098975050505050505050565b600061ffff808316818516808303821115612b8f57612b8f612d52565b01949350505050565b60008219821115612bab57612bab612d52565b500190565b600060ff821660ff84168060ff03821115612bcd57612bcd612d52565b019392505050565b600061ffff80841680612bea57612bea612d68565b92169190910492915050565b600082612c0557612c05612d68565b500490565b600061ffff80831681851681830481118215151615612c2b57612c2b612d52565b02949350505050565b6000816000190483118215151615612c4e57612c4e612d52565b500290565b600061ffff83811690831681811015612c6e57612c6e612d52565b039392505050565b600082821015612c8857612c88612d52565b500390565b600060ff821660ff841680821015612ca757612ca7612d52565b90039392505050565b60005b83811015612ccb578181015183820152602001612cb3565b83811115612cda576000848401525b50505050565b600061ffff80831681811415612cf857612cf8612d52565b6001019392505050565b6000600019821415612d1657612d16612d52565b5060010190565b600061ffff80841680612d3257612d32612d68565b92169190910692915050565b600082612d4d57612d4d612d68565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461052f57600080fd5b801515811461052f57600080fdfe8a3076fe30ae874213c69601d62245a186c9729ae3d3c230d0a8d1732fe022d9a2646970667358221220c8267164d733c115157b41b93a15000e66e71a0a9ef1273f0c40d61534b350a264736f6c63430008040033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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