ETH Price: $2,393.53 (-0.86%)
Gas: 1.43 Gwei

Token

Adam Riches Genesis (ARG)
 

Overview

Max Total Supply

405 ARG

Holders

152

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
4 ARG
0x7c23b1174d22d18964f80e0cc1b77dbb02582d06
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
AdamRichesGenesis

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 36 : AdamRichesGenesis.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "../../core/OmmgArtistContract.sol";

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'
//               _                   _____  _      _                  _____                      _
//      /\      | |                 |  __ \(_)    | |                / ____|                    (_)
//     /  \   __| | __ _ _ __ ___   | |__) |_  ___| |__   ___  ___  | |  __  ___ _ __   ___  ___ _ ___
//    / /\ \ / _` |/ _` | '_ ` _ \  |  _  /| |/ __| '_ \ / _ \/ __| | | |_ |/ _ \ '_ \ / _ \/ __| / __|
//   / ____ \ (_| | (_| | | | | | | | | \ \| | (__| | | |  __/\__ \ | |__| |  __/ | | |  __/\__ \ \__ \
//  /_/    \_\__,_|\__,_|_| |_| |_| |_|  \_\_|\___|_| |_|\___||___/  \_____|\___|_| |_|\___||___/_|___/

/// @title AdamRichesGenesis
/// @author NotAMeme aka nxlogixnick
/// @notice Adam Riches is an emerging British painter and draughtsman who primarily works in monochromatic color palette.
/// The characteristically stylized portraits and figurative works he creates are based on a sensitive response to the human condition,
/// ranging from furious expressive moments to poignant, melancholy reflections.
/// This is his NFT genesis collection. It contains excellent and rare pieces made in his famous drawing style.
/// Riches has taken part in numerous international exhibitions and artist residencies.
/// His works can be found in private collections around the world. Learn more at http://adamrichesartist.com/
contract AdamRichesGenesis is OmmgArtistContract {
    string public constant Artist = "Adam Riches";

    constructor(ArtistContractConfig memory config)
        OmmgArtistContract(config)
    {}
}

File 2 of 36 : OmmgArtistContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

// implementations
import "./impl/ERC721OmmgSnapshot.sol";
import "./impl/OmmgAccessControl.sol";
import "./impl/ERC721Ommg.sol";

// interfaces
import "./interfaces/IERC721OmmgEnumerable.sol";
import "./interfaces/IERC721OmmgMetadata.sol";
import "./interfaces/IERC721OmmgMetadataFreezable.sol";

import "./interfaces/IOmmgAcquirable.sol";
import "./interfaces/IOmmgAcquirableWithToken.sol";
import "./interfaces/IOmmgEmergencyTokenRecoverable.sol";
import "./interfaces/IOmmgWithdrawable.sol";

import "./interfaces/IOmmgProvenanceHash.sol";
import "./interfaces/IOmmgMutablePrice.sol";
import "./interfaces/IOmmgSalePausable.sol";
import "./interfaces/IOmmgSupplyCap.sol";
import "./interfaces/IOmmgFrontEnd.sol";

import "./def/ArtistContractConfig.sol";
import "./def/CustomErrors.sol";

// utility
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

contract OmmgArtistContract is
    IOmmgFrontEnd,
    OmmgAccessControl,
    ERC721Ommg,
    ERC721OmmgSnapshot,
    IERC721OmmgEnumerable,
    IERC721OmmgMetadata,
    IERC721OmmgMetadataFreezable,
    IOmmgSalePausable,
    IOmmgSupplyCap,
    IOmmgMutablePrice,
    IOmmgProvenanceHash,
    IOmmgAcquirable,
    IOmmgAcquirableWithToken,
    IOmmgEmergencyTokenRecoverable,
    IOmmgWithdrawable
{
    using Strings for uint256;
    using SafeERC20 for IERC20;

    /// @notice The identifying hash of the state administrator role. The state
    /// administrator role empowers the accounts that hold it to change state variables.
    /// @dev is just keccak256("CONTRACT_STATE_ADMIN")
    bytes32 public constant CONTRACT_STATE_ADMIN_ROLE =
        0x7e69b879a040173b938f56bb64bfa62bcd758c08ae6ed7cfdf7da6d7dba92708;

    /// @notice The identifying hash of the withdrawal administrator role. The
    /// role empowers the accounts that hold it to withdraw eth.
    /// @dev is just keccak256("CONTRACT_WITHDRAW_ADMIN")
    bytes32 public constant CONTRACT_WITHDRAW_ADMIN_ROLE =
        0x7c13537556c77ef3fb98601c3356887ddbe5991e86dc065741ce77e1dd2554a3;

    /// @notice The identifying hash of the free acquire role. The role empowers
    /// the accounts that hold it to mint tokens for free, for example for marketing purposes.
    /// @dev is just keccak256("CONTRACT_FREE_ACQUIRE")
    bytes32 public constant CONTRACT_FREE_ACQUIRE_ROLE =
        0xfdd7b2ba629c0a0b84029cda831836222e5708c95d3e782c0762066b472dad0e;

    /// @dev the immutable max supply cap of this token
    uint256 private immutable _supplyCap;
    /// @dev the mutable public mint price of this token
    uint256 private _price;
    /// @dev the total number of shares held by all shareholders
    uint256 private _totalShares;

    /// @dev indicates whether the token metadata is revealed
    bool private _revealed;
    /// @dev indicates whether the public sale is active
    bool private _saleIsActive;
    /// @dev indicates whether the token metadata is frozen
    bool private _metadataFrozen;
    /// @dev indicates whether the provenance hash is frozen
    bool private _provenanceFrozen;

    /// @dev the name of the token contract
    string private _name;
    /// @dev the symbol of the token contract
    string private _symbol;
    /// @dev the base URI of the token metadata which is prepended to the tokenID,
    /// unless overridden for a token. Only shows when the token is revealed
    string private _baseURI;
    /// @dev the URI of the token metadata for the unrevealed state
    string private _unrevealedTokenURI;
    /// @dev the provenance hash
    string private _provenanceHash;

    /// @dev optional mapping for token URIs to override the default behavior
    mapping(uint256 => string) private _tokenURIs;
    /// @dev whether the token URI for this item is a full override or simply gets appended to the `_baseURI`
    mapping(uint256 => bool) private _overrideFullURI;
    /// @dev Optional mapping for token reveal override, to indicate if an individual token has been revealed
    mapping(uint256 => bool) private _tokenRevealed;

    /// @dev the list of all shareholders who will receive eth when `withdraw` is called
    Shareholder[] private _shareholders;

    /// @dev the list of all configured tokens for the token discount mechanic
    IERC721[] private _configuredTokens;
    /// @dev a shorthand way to check if a token is configured
    mapping(IERC721 => bool) _tokenConfigured;
    /// @dev a mapping per configured token to indicate whether a specific token of that token contract has been used as
    /// a discount token already or not. It goes as follows: `_tokenIdsUsed[address][version][tokenId]`
    mapping(IERC721 => mapping(uint256 => mapping(uint256 => bool))) _tokenIdsUsed;
    /// @dev a mapping per configured token to its tokenIdsUsed version, needed for resets.
    mapping(IERC721 => uint256) _tokensUsedVersion;
    /// @dev a mapping per configured token to its used number.
    mapping(IERC721 => uint256) _tokensUsedNumber;
    /// @dev the configurations (price, active state) of a token discount
    mapping(IERC721 => TokenDiscountConfig) _tokenConfigurations;

    /// @notice Initializes the contract with the given configuration.
    /// @dev The config is the 'magic' behind this contract and the core of it's flexibility
    /// @param config the config of this contract as an {ArtistContractConfig} struct
    /// `config.name` will be the name of the contract.
    /// `config.symbol` will be the symbol.
    /// `config.withdrawAdmins` can be a list of users who will be assigned the `CONTRACT_WITHDRAW_ADMIN_ROLE` on construction.
    /// `config.stateAdmins` can be a list of users who will be assigned the `CONTRACT_STATE_ADMIN_ROLE` on construction.
    /// `config.mintForFree` can be a list of users who will be assigned the `CONTRACT_FREE_ACQUIRE_ROLE` on construction.
    /// `config.initialPrice` is the initial value assigned to the mutable price property.
    /// `config.supplyCap` is the immutable supply cap.
    /// `config.maxBatchSize` is the maximum number of tokens mintable in one transaction.
    /// `config.shareholders` is a list of the shareholders (see {Shareholder} struct).
    /// `config.tokenDiscounts` is a list of token discounts (see {TokenDiscount} struct) which will be usable to mint tokens.
    constructor(ArtistContractConfig memory config)
        ERC721Ommg(config.maxBatchSize)
    {
        _name = config.name;
        _symbol = config.symbol;
        _price = config.initialPrice;
        _supplyCap = config.supplyCap;

        _addRoleToAll(config.withdrawAdmins, CONTRACT_WITHDRAW_ADMIN_ROLE);
        _addRoleToAll(config.stateAdmins, CONTRACT_STATE_ADMIN_ROLE);
        _addRoleToAll(config.mintForFree, CONTRACT_FREE_ACQUIRE_ROLE);

        uint256 amount = config.shareholders.length;
        for (uint256 i = 0; i < config.shareholders.length; i++) {
            _addShareholder(config.shareholders[i]);
        }

        amount = config.tokenDiscounts.length;
        for (uint256 i = 0; i < amount; i++) {
            _addTokenDiscount(
                config.tokenDiscounts[i].tokenAddress,
                config.tokenDiscounts[i].config
            );
        }
    }

    /// @inheritdoc ERC721Ommg
    function maxBatchSize()
        public
        view
        override(ERC721Ommg, IOmmgFrontEnd)
        returns (uint256)
    {
        return super.maxBatchSize();
    }

    function tokensAvailable()
        external
        view
        override
        returns (uint256 amount)
    {
        return supplyCap() - _currentIndex();
    }

    /// @dev little helper function to add `role` to all accounts supplied
    function _addRoleToAll(address[] memory accounts, bytes32 role) private {
        uint256 len = accounts.length;
        if (len > 0) {
            for (uint256 i = 0; i < len; i++) {
                grantRole(role, accounts[i]);
            }
        }
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IOmmgWithdrawable //////////////////////////////////////////////

    /// @dev Only callable by the contract owner or someone with the
    /// `CONTRACT_STATE_ADMIN_ROLE`.
    /// @inheritdoc IOmmgWithdrawable
    function addShareholder(address walletAddress, uint256 shares)
        external
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _addShareholder(Shareholder(walletAddress, shares));
    }

    /// @dev Only callable by the contract owner or someone with the
    /// `CONTRACT_STATE_ADMIN_ROLE`.
    /// @inheritdoc IOmmgWithdrawable
    function removeShareholder(address walletAddress)
        external
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        if (walletAddress == address(0)) revert NullAddress();
        uint256 length = _shareholders.length;
        for (uint256 i = 0; i < length; i++) {
            if (_shareholders[i].addr == walletAddress) {
                _removeShareholderAt(i);
                return;
            }
        }
        revert ShareholderDoesNotExist(walletAddress);
    }

    /// @dev Only callable by the contract owner or someone with the
    /// `CONTRACT_STATE_ADMIN_ROLE`.
    /// @inheritdoc IOmmgWithdrawable
    function updateShareholder(address walletAddress, uint256 updatedShares)
        external
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        if (walletAddress == address(0)) revert NullAddress();
        uint256 length = _shareholders.length;
        for (uint256 i = 0; i < length; i++) {
            if (_shareholders[i].addr == walletAddress) {
                _shareholders[i].shares = updatedShares;
                emit ShareholderUpdated(walletAddress, updatedShares);
                return;
            }
        }
        revert ShareholderDoesNotExist(walletAddress);
    }

    /// @dev Only callable by the contract owner or someone with the
    /// `CONTRACT_STATE_ADMIN_ROLE`. Reverts if the address is the null address,
    /// or if a shareholder with this address does not exist.
    /// @inheritdoc IOmmgWithdrawable
    function shares(address walletAddress)
        external
        view
        override
        returns (uint256)
    {
        uint256 length = _shareholders.length;
        for (uint256 i = 0; i < length; i++) {
            if (_shareholders[i].addr == walletAddress) {
                return _shareholders[i].shares;
            }
        }
        revert ShareholderDoesNotExist(walletAddress);
    }

    /// @inheritdoc IOmmgWithdrawable
    function shareholders()
        external
        view
        override
        returns (Shareholder[] memory)
    {
        return _shareholders;
    }

    /// @inheritdoc IOmmgWithdrawable
    function totalShares() external view override returns (uint256) {
        return _totalShares;
    }

    function emergencyWithdraw()
        external
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        uint256 balance = address(this).balance;
        payable(_msgSender()).transfer(balance);
        emit EmergencyWithdrawn(msg.sender, balance);
    }

    /// @inheritdoc IOmmgWithdrawable
    function withdraw()
        external
        override
        onlyOwnerOrRole(CONTRACT_WITHDRAW_ADMIN_ROLE)
    {
        uint256 balance = address(this).balance;
        uint256 totalShares_ = _totalShares;
        uint256 length = _shareholders.length;
        if (totalShares_ == 0 || length == 0) revert ZeroShares();
        uint256 amountPerShare = balance / totalShares_;
        for (uint256 i = 0; i < length; i++) {
            Shareholder memory sh = _shareholders[i];
            uint256 shareholderAmount = sh.shares * amountPerShare;
            payable(sh.addr).transfer(shareholderAmount);
            emit PaidOut(_msgSender(), sh.addr, shareholderAmount);
        }
        emit Withdrawn(_msgSender(), amountPerShare * _totalShares);
    }

    function _removeShareholderAt(uint256 index) private {
        uint256 length = _shareholders.length;
        Shareholder memory sh = _shareholders[index];
        for (uint256 i = index; i < length - 1; i++) {
            _shareholders[i] = _shareholders[i + 1];
        }
        _shareholders.pop();
        _totalShares -= sh.shares;
        emit ShareholderRemoved(sh.addr, sh.shares);
    }

    function _addShareholder(Shareholder memory shareholder) internal {
        if (shareholder.shares == 0) revert ZeroShares();
        if (shareholder.addr == address(0)) revert NullAddress();
        uint256 length = _shareholders.length;
        for (uint256 i = 0; i < length; i++) {
            if (_shareholders[i].addr == shareholder.addr)
                revert ShareholderAlreadyExists(shareholder.addr);
        }
        _shareholders.push(shareholder);
        _totalShares += shareholder.shares;
        emit ShareholderAdded(shareholder.addr, shareholder.shares);
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IOmmgEmergencyTokenRecoverable /////////////////////////////////

    /// @inheritdoc IOmmgEmergencyTokenRecoverable
    function emergencyRecoverTokens(
        IERC20 token,
        address receiver,
        uint256 amount
    ) public virtual override onlyOwnerOrRole(CONTRACT_WITHDRAW_ADMIN_ROLE) {
        if (receiver == address(0)) revert NullAddress();
        token.safeTransfer(receiver, amount);
        emit TokensRecovered(token, receiver, amount);
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IOmmgAcquirableWithToken //////////////////////////////////////

    /// @inheritdoc IOmmgAcquirableWithToken
    function acquireWithToken(IERC721 token, uint256[] memory tokenIds)
        external
        payable
        override(IOmmgAcquirableWithToken, IOmmgFrontEnd)
    {
        uint256 amount = tokenIds.length;
        if (amount == 0) revert InvalidAmount(0, 1, maxBatchSize());
        _checkSupplyCapAndMaxBatch(amount);
        _revertIfTokenNotActive(token);
        uint256 price_ = _getTokenDiscountInfo(token).price;
        if (msg.value != price_ * amount) {
            revert InvalidMessageValue(msg.value, price_ * amount);
        }
        _checkTokenElegibility(msg.sender, token, tokenIds);
        _setTokensUsedForDiscount(token, tokenIds);
        _safeMint(msg.sender, amount);
    }

    /// @inheritdoc IOmmgAcquirableWithToken
    function tokenDiscounts()
        external
        view
        override(IOmmgAcquirableWithToken, IOmmgFrontEnd)
        returns (TokenDiscountOutput[] memory)
    {
        uint256 len = _configuredTokens.length;
        IERC721[] memory localCopy = _configuredTokens;
        TokenDiscountOutput[] memory td = new TokenDiscountOutput[](len);
        for (uint256 i = 0; i < len; i++) {
            address addr = address(localCopy[i]);
            td[i] = TokenDiscountOutput(
                IERC721(addr),
                _getRemoteNameOrEmpty(address(addr)),
                _getRemoteSymbolOrEmpty(address(addr)),
                _tokensUsedNumber[localCopy[i]],
                _tokenConfigurations[localCopy[i]]
            );
        }
        return td;
    }

    /// @inheritdoc IOmmgAcquirableWithToken
    function addTokenDiscount(
        IERC721 tokenAddress,
        TokenDiscountConfig memory config
    ) public onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE) {
        _addTokenDiscount(tokenAddress, config);
    }

    /// @inheritdoc IOmmgAcquirableWithToken
    function setTokenDiscountActive(IERC721 tokenAddress, bool active)
        external
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _revertIfTokenNotConfigured(tokenAddress);
        if (_tokenConfigurations[tokenAddress].active != active) {
            _tokenConfigurations[tokenAddress].active = active;
            emit TokenDiscountUpdated(
                tokenAddress,
                _tokenConfigurations[tokenAddress]
            );
        }
    }

    function _getRemoteNameOrEmpty(address remote)
        internal
        view
        returns (string memory)
    {
        try IERC721Metadata(remote).name() returns (string memory name_) {
            return name_;
        } catch {
            return "";
        }
    }

    function _getRemoteSymbolOrEmpty(address remote)
        internal
        view
        returns (string memory)
    {
        try IERC721Metadata(remote).symbol() returns (string memory symbol_) {
            return symbol_;
        } catch {
            return "";
        }
    }

    /// @inheritdoc IOmmgAcquirableWithToken
    function tokensUsedForDiscount(
        IERC721 tokenAddress,
        uint256[] memory tokenIds
    )
        external
        view
        virtual
        override(IOmmgAcquirableWithToken, IOmmgFrontEnd)
        returns (bool[] memory used)
    {
        _revertIfTokenNotConfigured(tokenAddress);
        uint256 length = tokenIds.length;
        bool[] memory arr = new bool[](length);
        for (uint256 i = 0; i < length; i++) {
            arr[i] = _tokenIdsUsed[tokenAddress][
                _tokensUsedVersion[tokenAddress]
            ][tokenIds[i]];
        }
        return arr;
    }

    /// @inheritdoc IOmmgAcquirableWithToken
    function removeTokenDiscount(IERC721 tokenAddress)
        external
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _revertIfTokenNotConfigured(tokenAddress);
        uint256 length = _configuredTokens.length;
        for (uint256 i = 0; i < length; i++) {
            if (_configuredTokens[i] == tokenAddress) {
                _tokenConfigured[tokenAddress] = false;
                _popTokenConfigAt(i);
                emit TokenDiscountRemoved(tokenAddress);
                return;
            }
        }
        revert TokenNotConfigured(tokenAddress);
    }

    /// @inheritdoc IOmmgAcquirableWithToken
    function tokenDiscountInfo(IERC721 tokenAddress)
        external
        view
        returns (TokenDiscountOutput memory)
    {
        _revertIfTokenNotConfigured(tokenAddress);
        return
            TokenDiscountOutput(
                tokenAddress,
                _getRemoteNameOrEmpty(address(tokenAddress)),
                _getRemoteSymbolOrEmpty(address(tokenAddress)),
                _tokensUsedNumber[tokenAddress],
                _getTokenDiscountInfo(tokenAddress)
            );
    }

    function _getTokenDiscountInfo(IERC721 tokenAddress)
        internal
        view
        returns (TokenDiscountConfig memory)
    {
        return _tokenConfigurations[tokenAddress];
    }

    /// @inheritdoc IOmmgAcquirableWithToken
    function updateTokenDiscount(
        IERC721 tokenAddress,
        TokenDiscountConfig memory config
    ) external override onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE) {
        _revertIfTokenNotConfigured(tokenAddress);
        _tokenConfigurations[tokenAddress] = config;
        emit TokenDiscountUpdated(tokenAddress, config);
    }

    /// @inheritdoc IOmmgAcquirableWithToken
    function resetTokenDiscountUsed(IERC721 tokenAddress)
        external
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _revertIfTokenNotConfigured(tokenAddress);
        _tokensUsedVersion[tokenAddress]++;
        _tokensUsedNumber[tokenAddress] = 0;
        emit TokenDiscountReset(tokenAddress);
    }

    function _checkTokenElegibility(
        address account,
        IERC721 tokenAddress,
        uint256[] memory tokenIds
    ) internal view {
        uint256 length = tokenIds.length;
        if (
            _tokensUsedNumber[tokenAddress] + length >
            _tokenConfigurations[tokenAddress].supply
        )
            revert TokenSupplyExceeded(
                tokenAddress,
                _tokenConfigurations[tokenAddress].supply
            );
        for (uint256 i = 0; i < length; i++) {
            uint256 tokenId = tokenIds[i];
            // try catch for reverts in ownerOf
            try tokenAddress.ownerOf(tokenId) returns (address owner) {
                if (owner != account)
                    revert TokenNotOwned(tokenAddress, tokenId);
            } catch {
                revert TokenNotOwned(tokenAddress, tokenId);
            }
            if (
                _tokenIdsUsed[tokenAddress][_tokensUsedVersion[tokenAddress]][
                    tokenId
                ]
            ) revert TokenAlreadyUsed(tokenAddress, tokenId);
        }
    }

    function _popTokenConfigAt(uint256 index) private {
        uint256 length = _configuredTokens.length;
        if (index >= length) return;
        for (uint256 i = index; i < length - 1; i++) {
            _configuredTokens[i] = _configuredTokens[i + 1];
        }
        _configuredTokens.pop();
    }

    // no checks
    function _setTokensUsedForDiscount(
        IERC721 token,
        uint256[] memory tokenIds
    ) internal {
        uint256 length = tokenIds.length;
        for (uint256 i = 0; i < length; i++) {
            _tokenIdsUsed[token][_tokensUsedVersion[token]][
                tokenIds[i]
            ] = true;
            emit TokenUsedForDiscount(msg.sender, token, tokenIds[i]);
        }
        _tokensUsedNumber[token] += length;
    }

    function _addTokenDiscount(
        IERC721 tokenAddress,
        TokenDiscountConfig memory config
    ) internal {
        if (address(tokenAddress) == address(0)) revert NullAddress();
        if (_tokenConfigured[tokenAddress])
            revert TokenAlreadyConfigured(tokenAddress);
        _tokenConfigured[tokenAddress] = true;
        _tokensUsedVersion[tokenAddress]++;
        _tokenConfigurations[tokenAddress] = config;
        _configuredTokens.push(tokenAddress);
        emit TokenDiscountAdded(tokenAddress, config);
    }

    function _revertIfTokenNotConfigured(IERC721 tokenAddress) internal view {
        if (address(tokenAddress) == address(0)) revert NullAddress();
        if (!_tokenConfigured[tokenAddress])
            revert TokenNotConfigured(tokenAddress);
    }

    function _revertIfTokenNotActive(IERC721 tokenAddress) internal view {
        if (!_tokenConfigured[tokenAddress])
            revert TokenNotConfigured(tokenAddress);
        if (!_tokenConfigurations[tokenAddress].active)
            revert TokenNotActive(tokenAddress);
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IOmmgProvenanceHash ///////////////////////////////////////////

    function whenProvenanceIsNotFrozen() private view {
        if (_provenanceFrozen) revert ProvenanceHashIsFrozen();
    }

    /// @inheritdoc IOmmgProvenanceHash
    function provenanceHash() public view override returns (string memory) {
        return _provenanceHash;
    }

    /// @inheritdoc IOmmgProvenanceHash
    function provenanceFrozen() public view override returns (bool) {
        return _provenanceFrozen;
    }

    /// @inheritdoc IOmmgProvenanceHash
    function setProvenanceHash(string memory provenanceHash_)
        public
        virtual
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        whenProvenanceIsNotFrozen();
        _provenanceHash = provenanceHash_;
        emit ProvenanceHashSet(_provenanceHash);
    }

    /// @inheritdoc IOmmgProvenanceHash
    function freezeProvenance()
        public
        virtual
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        whenProvenanceIsNotFrozen();
        _provenanceFrozen = true;
        emit ProvenanceHashFrozen();
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IOmmgMutablePrice //////////////////////////////////////////////

    /// @inheritdoc IOmmgMutablePrice
    function price()
        public
        view
        override(IOmmgMutablePrice, IOmmgFrontEnd)
        returns (uint256)
    {
        return _price;
    }

    /// @inheritdoc IOmmgMutablePrice
    function setPrice(uint256 price)
        public
        virtual
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _price = price;
        emit PriceChanged(_price);
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IOmmgSupplyCap /////////////////////////////////////////////////

    /// @inheritdoc IOmmgSupplyCap
    function supplyCap()
        public
        view
        virtual
        override(IOmmgSupplyCap, IOmmgFrontEnd)
        returns (uint256)
    {
        return _supplyCap;
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IOmmgSalePausable //////////////////////////////////////////////

    /// @inheritdoc IOmmgSalePausable
    function saleIsActive()
        public
        view
        override(IOmmgSalePausable, IOmmgFrontEnd)
        returns (bool)
    {
        return _saleIsActive;
    }

    /// @inheritdoc IOmmgSalePausable
    function setSaleIsActive(bool newValue)
        public
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _saleIsActive = newValue;
        emit SaleIsActiveSet(_saleIsActive);
    }

    modifier whenSaleIsActive() {
        if (!_saleIsActive) {
            revert SaleNotActive();
        }
        _;
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IOmmgAcquirable ////////////////////////////////////////////////

    /// @inheritdoc IOmmgAcquirable
    function acquireForCommunity(address receiver, uint256 amount)
        external
        override
        onlyOwnerOrRole(CONTRACT_FREE_ACQUIRE_ROLE)
    {
        _checkSupplyCapAndMaxBatch(amount);
        _safeMint(receiver, amount);
    }

    /// @inheritdoc IOmmgAcquirable
    function acquire(uint256 amount)
        external
        payable
        override(IOmmgAcquirable, IOmmgFrontEnd)
        whenSaleIsActive
    {
        _checkSupplyCapAndMaxBatch(amount);
        if (msg.value != price() * amount) {
            revert InvalidMessageValue(msg.value, price() * amount);
        }

        _safeMint(msg.sender, amount);
    }

    function _checkSupplyCapAndMaxBatch(uint256 amount) private view {
        if (amount > maxBatchSize() || amount == 0) {
            revert InvalidAmount(amount, 1, maxBatchSize());
        }
        if (_currentIndex() + amount > supplyCap()) {
            // +1 because 0 based index
            revert AmountExceedsCap(
                amount,
                supplyCap() - _currentIndex(),
                supplyCap()
            );
        }
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IERC721OmmgEnumerable //////////////////////////////////////////

    /// @inheritdoc IERC721Enumerable
    function totalSupply() public view override returns (uint256) {
        return _currentIndex() - _burned();
    }

    /// @inheritdoc IERC721Enumerable
    function tokenByIndex(uint256 index)
        public
        view
        override
        returns (uint256)
    {
        if (index >= totalSupply())
            revert IndexOutOfBounds(index, totalSupply());
        if (_burned() == 0) return index + 1;
        uint256 j = 0;
        uint256 maxIndex = _currentIndex();
        for (uint256 i = 0; i < maxIndex; i++) {
            if (j == index) return i;
            if (_exists(i)) j++;
        }
        revert OperationFailed();
    }

    /// @inheritdoc IERC721Enumerable
    function tokenOfOwnerByIndex(address owner, uint256 index)
        public
        view
        override
        returns (uint256)
    {
        if (index > balanceOf(owner))
            revert IndexOutOfBounds(index, balanceOf(owner));

        uint256 limit = _currentIndex();
        uint256 tokenIdsIdx = 0;
        for (uint256 i = 0; i < limit; i++) {
            if (_exists(i)) {
                if (_ownershipOf(i).addr == owner) {
                    if (tokenIdsIdx == index) {
                        return i;
                    }
                    tokenIdsIdx++;
                }
            }
        }
        revert OperationFailed();
    }

    /// @inheritdoc IERC721OmmgEnumerable
    function exists(uint256 tokenId) public view override returns (bool) {
        return _exists(tokenId);
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IERC721OmmgMetadata ////////////////////////////////////////////

    /// @inheritdoc IERC721Metadata
    function name()
        public
        view
        virtual
        override(IERC721Metadata, IOmmgFrontEnd)
        returns (string memory)
    {
        return _name;
    }

    /// @inheritdoc IERC721Metadata
    function symbol()
        public
        view
        virtual
        override(IERC721Metadata, IOmmgFrontEnd)
        returns (string memory)
    {
        return _symbol;
    }

    /// @inheritdoc IERC721OmmgMetadata
    function revealed() public view returns (bool) {
        return _revealed;
    }

    /// @inheritdoc IERC721OmmgMetadata
    function tokenRevealed(uint256 tokenId)
        public
        view
        override
        returns (bool)
    {
        if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);
        return _tokenRevealed[tokenId] || _revealed;
    }

    /// @inheritdoc IERC721OmmgMetadata
    function overridesFullURI(uint256 tokenId)
        public
        view
        override
        returns (bool)
    {
        if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);
        return _overrideFullURI[tokenId];
    }

    /// @inheritdoc IERC721Metadata
    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory _base = _baseURI;

        if (!_revealed && !_tokenRevealed[tokenId]) {
            return _unrevealedTokenURI;
        } else {
            if (bytes(_tokenURI).length > 0) {
                if (_overrideFullURI[tokenId]) return _tokenURI;
                else return string(abi.encodePacked(_base, _tokenURI));
            } else {
                if (bytes(_baseURI).length > 0)
                    return string(abi.encodePacked(_base, tokenId.toString()));
                else return _tokenURI;
            }
        }
    }

    /// @inheritdoc IERC721OmmgMetadata
    function reveal()
        external
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _revealed = true;
        emit Revealed();
    }

    /// @inheritdoc IERC721OmmgMetadata
    function revealToken(uint256 tokenId)
        external
        override
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);
        _tokenRevealed[tokenId] = true;
        emit TokenRevealed(tokenId);
    }

    /// @inheritdoc IERC721OmmgMetadata
    function setTokenURI(
        uint256 tokenId,
        bool overrideBaseURI,
        bool overrideReveal,
        string memory _tokenURI
    )
        external
        override
        whenMetadataIsNotFrozen
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);
        _tokenURIs[tokenId] = _tokenURI;
        _overrideFullURI[tokenId] = overrideBaseURI;
        if (overrideReveal && !_tokenRevealed[tokenId]) {
            _tokenRevealed[tokenId] = true;
            emit TokenRevealed(tokenId);
        }
        emit SetTokenUri(tokenId, false, false, _tokenURI);
    }

    /// @inheritdoc IERC721OmmgMetadata
    function setUnrevealedTokenURI(string memory unrevealedTokenURI)
        external
        override
        whenMetadataIsNotFrozen
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _unrevealedTokenURI = unrevealedTokenURI;
        emit UnrevealedTokenUriSet(_unrevealedTokenURI);
    }

    /// @inheritdoc IERC721OmmgMetadata
    function setBaseURI(string memory baseURI)
        external
        override
        whenMetadataIsNotFrozen
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _baseURI = baseURI;
        emit SetBaseUri(baseURI);
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IERC721OmmgMetadataFreezable ///////////////////////////////////

    modifier whenMetadataIsNotFrozen() {
        if (_metadataFrozen) revert MetadataIsFrozen();
        _;
    }

    /// @inheritdoc IERC721OmmgMetadataFreezable
    function metadataFrozen() public view returns (bool) {
        return _metadataFrozen;
    }

    /// @inheritdoc IERC721OmmgMetadataFreezable
    function freezeMetadata()
        public
        virtual
        whenMetadataIsNotFrozen
        onlyOwnerOrRole(CONTRACT_STATE_ADMIN_ROLE)
    {
        _metadataFrozen = true;
        emit MetadataFrozen();
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////// IERC165 ////////////////////////////////////////////////////////

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(IERC165, ERC721Ommg, ERC721OmmgSnapshot, OmmgAccessControl)
        returns (bool)
    {
        return
            interfaceId == type(IOmmgEmergencyTokenRecoverable).interfaceId ||
            interfaceId == type(IERC721OmmgMetadataFreezable).interfaceId ||
            interfaceId == type(IOmmgAcquirableWithToken).interfaceId ||
            interfaceId == type(IERC721OmmgEnumerable).interfaceId ||
            interfaceId == type(IERC721OmmgMetadata).interfaceId ||
            interfaceId == type(IOmmgProvenanceHash).interfaceId ||
            interfaceId == type(IOmmgMutablePrice).interfaceId ||
            interfaceId == type(IOmmgWithdrawable).interfaceId ||
            interfaceId == type(IOmmgSalePausable).interfaceId ||
            interfaceId == type(IERC721Enumerable).interfaceId ||
            interfaceId == type(IOmmgAcquirable).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            interfaceId == type(IOmmgSupplyCap).interfaceId ||
            interfaceId == type(IOmmgFrontEnd).interfaceId ||
            interfaceId == type(IOmmgOwnable).interfaceId ||
            super.supportsInterface(interfaceId);
    }
}

File 3 of 36 : ERC721OmmgSnapshot.sol
// SPDX-License-Identifier: BSD-3-Clause

pragma solidity ^0.8.0;

import "./ERC721Ommg.sol";
import "../interfaces/IOmmgSnapshot.sol";

abstract contract ERC721OmmgSnapshot is IOmmgSnapshot, ERC721Ommg {
    function snapshot() external view returns (TokenInfo[] memory) {
        uint256 curIndex = _currentIndex();
        TokenInfo[] memory tokenInfo = new TokenInfo[](curIndex);
        for (uint256 i = 1; i <= curIndex; i++) {
            if (_exists(i)) {
                tokenInfo[i - 1] = TokenInfo(i, TokenStatus.OWNED, ownerOf(i));
            } else {
                tokenInfo[i - 1] = TokenInfo(
                    i,
                    TokenStatus.BURNED,
                    address(this)
                );
            }
        }
        return tokenInfo;
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == type(IOmmgSnapshot).interfaceId ||
            super.supportsInterface(interfaceId);
    }
}

File 4 of 36 : OmmgAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/Strings.sol";

import "./OmmgOwnable.sol";
import "../interfaces/IOmmgAccessControl.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

/// @dev custom role access / ownable
abstract contract OmmgAccessControl is OmmgOwnable, IOmmgAccessControl {
    mapping(bytes32 => RoleData) private _roles;

    /// @dev Reverts if called by any account other than the owner or `role`
    /// @param role The role which is allowed access
    modifier onlyOwnerOrRole(bytes32 role) {
        if (owner() != _msgSender() && !_roles[role].members[_msgSender()])
            revert Unauthorized(_msgSender(), role);
        _;
    }

    /// @dev Reverts if called by any account other than the owner or `role`
    /// @param role The role which is allowed access
    modifier onlyRole(bytes32 role) {
        if (!_roles[role].members[_msgSender()])
            revert Unauthorized(_msgSender(), role);
        _;
    }

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

    /// @dev Grants `role` to `account`.
    function grantRole(bytes32 role, address account)
        public
        override
        onlyOwner
    {
        _grantRole(role, account);
    }

    /// @dev Revokes `role` from `account`
    function revokeRole(bytes32 role, address account)
        public
        override
        onlyOwner
    {
        _revokeRole(role, account);
    }

    /// @dev Revokes `role` from the calling account.
    function renounceRole(bytes32 role) public override {
        _revokeRole(role, _msgSender());
    }

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

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == type(IOmmgAccessControl).interfaceId ||
            super.supportsInterface(interfaceId);
    }
}

File 5 of 36 : ERC721Ommg.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "../def/CustomErrors.sol";

abstract contract ERC721Ommg is Context, ERC165, IERC721 {
    using Address for address;
    using Strings for uint256;

    struct TokenOwnership {
        address addr;
        uint64 startTimestamp;
    }

    struct AddressData {
        uint128 balance;
        uint128 numberMinted;
    }

    uint256 private currentIndex = 1;
    uint256 private burned;

    uint256 private immutable _maxBatchSize;
    // Mapping from token ID to ownership details
    // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
    mapping(uint256 => TokenOwnership) private _ownerOf;
    // Mapping owner address to address data
    mapping(address => AddressData) private _balanceOf;
    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;
    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    constructor(uint256 maxBatchSize_) {
        _maxBatchSize = maxBatchSize_;
    }

    function _currentIndex() internal view returns (uint256) {
        return currentIndex - 1;
    }

    function _burned() internal view returns (uint256) {
        return burned;
    }

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

    function maxBatchSize() public view virtual returns (uint256) {
        return _maxBatchSize;
    }

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (owner == address(0)) revert NullAddress();
        return _balanceOf[owner].balance;
    }

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) public view returns (address) {
        return _ownershipOf(tokenId).addr;
    }

    function _ownershipOf(uint256 tokenId)
        internal
        view
        returns (TokenOwnership memory)
    {
        if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);

        uint256 lowestTokenToCheck;
        if (tokenId >= _maxBatchSize) {
            lowestTokenToCheck = tokenId - _maxBatchSize + 1;
        }

        for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
            TokenOwnership memory ownership = _ownerOf[curr];
            if (ownership.addr != address(0)) return ownership;
        }
        revert OperationFailed();
    }

    /**
     * @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
    ) public override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @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 memory data
    ) public override {
        _transfer(from, to, tokenId);
        if (!_checkOnERC721Received(from, to, tokenId, data))
            revert SafeTransferFailed(from, to, tokenId);
    }

    /**
     * @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
    ) public override {
        _transfer(from, to, tokenId);
    }

    /**
     * @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 {
        address owner = ownerOf(tokenId);
        // is in ownerOf
        // if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);
        if (to == owner) revert ApprovalInvalid(_msgSender(), tokenId);

        if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender()))
            revert ApprovalUnauthorized(owner, to, tokenId, _msgSender());

        _approve(to, tokenId, owner);
    }

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId)
        public
        view
        returns (address operator)
    {
        if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);
        return _tokenApprovals[tokenId];
    }

    /**
     * @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)
        public
        override
    {
        if (operator == _msgSender())
            revert ApprovalForAllInvalid(_msgSender(), approved);

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

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

    function _exists(uint256 tokenId) internal view returns (bool) {
        return
            tokenId > 0 &&
            tokenId < currentIndex &&
            _ownerOf[tokenId].addr != address(this);
    }

    // function _hasBeenMinted(uint256 tokenId) internal view returns (bool) {
    //     return tokenId < currentIndex;
    // }

    // function _ownerAddress(uint256 tokenId) internal view returns (address) {
    //     return _ownerOf[tokenId].addr;
    // }

    function _burn(uint256 tokenId) internal {
        if (!_exists(tokenId)) revert TokenDoesNotExist(tokenId);

        TokenOwnership memory owner = _ownershipOf(tokenId);

        _beforeTokenTransfers(owner.addr, address(this), tokenId, 1);

        // Clear approvals
        _approve(address(0), tokenId, owner.addr);

        _balanceOf[owner.addr].balance -= 1;
        _ownerOf[tokenId].addr = address(this);
        burned++;
        uint256 nextTokenId = tokenId + 1;
        if (_ownerOf[nextTokenId].addr == address(0)) {
            if (_exists(nextTokenId)) {
                _ownerOf[nextTokenId] = TokenOwnership(
                    owner.addr,
                    owner.startTimestamp
                );
            }
        }
        emit Transfer(owner.addr, address(this), tokenId);

        _afterTokenTransfers(owner.addr, address(this), tokenId, 1);
    }

    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, quantity, "");
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` cannot be larger than the max batch size.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory data
    ) internal {
        uint256 startTokenId = currentIndex;
        if (to == address(0)) revert NullAddress();
        // We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
        // TODO can this even happen?
        // if (_exists(startTokenId)) revert TokenAlreadyExists(startTokenId);

        if (quantity > _maxBatchSize || quantity == 0)
            revert InvalidAmount(quantity, 1, _maxBatchSize);

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        AddressData memory oldData = _balanceOf[to];
        _balanceOf[to] = AddressData(
            oldData.balance + uint128(quantity),
            oldData.numberMinted + uint128(quantity)
        );
        _ownerOf[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
        uint256 updatedIndex = startTokenId;
        for (uint256 i = 0; i < quantity; i++) {
            emit Transfer(address(0), to, updatedIndex);
            if (!_checkOnERC721Received(address(0), to, updatedIndex, data))
                revert SafeTransferFailed(address(0), to, updatedIndex);
            updatedIndex++;
        }
        currentIndex = updatedIndex;
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) private {
        if (to == address(0)) revert NullAddress();

        TokenOwnership memory prevOwner = _ownershipOf(tokenId);

        if (prevOwner.addr != from)
            revert TransferUnauthorized(
                _msgSender(),
                from,
                to,
                tokenId,
                prevOwner.addr
            );

        if (
            _msgSender() != prevOwner.addr &&
            getApproved(tokenId) != _msgSender() &&
            !isApprovedForAll(prevOwner.addr, _msgSender())
        )
            revert TransferUnauthorized(
                _msgSender(),
                from,
                to,
                tokenId,
                prevOwner.addr
            );

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        _balanceOf[from].balance -= 1;
        _balanceOf[to].balance += 1;
        _ownerOf[tokenId] = TokenOwnership(to, uint64(block.timestamp));

        // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
        // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
        uint256 nextTokenId = tokenId + 1;
        if (_ownerOf[nextTokenId].addr == address(0)) {
            if (_exists(nextTokenId)) {
                _ownerOf[nextTokenId] = TokenOwnership(
                    prevOwner.addr,
                    prevOwner.startTimestamp
                );
            }
        }
        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

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

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

    /**
     * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 tokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
     * minting.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 tokenId,
        uint256 quantity
    ) internal virtual {}
}

File 6 of 36 : IERC721OmmgEnumerable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IERC721OmmgEnumerable
/// @author NotAMeme aka nxlogixnick
/// @notice This interface serves as an extension to {IERC721Enumerable} and adds
/// functionality to check if a token exists.
interface IERC721OmmgEnumerable is IERC721Enumerable {
    /// @notice Returns whether the token `tokenId` exists.
    /// @param tokenId the token id to check
    /// @return exists whether the token exists
    function exists(uint256 tokenId) external view returns (bool exists);
}

File 7 of 36 : IERC721OmmgMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IERC721OmmgMetadata
/// @author NotAMeme aka nxlogixnick
/// @notice This interface serves as an extension to {IERC721Metadata} and adds
/// functionality to reveal tokens as well as add more logic to the token uri.
interface IERC721OmmgMetadata is IERC721Metadata {
    /// @notice Triggers when the base uri is updated.
    /// @param baseURI the new base uri
    event SetBaseUri(string indexed baseURI);

    /// @notice Triggers when the URI for a token is overridden.
    /// @param tokenId the token where the URI is overridden
    /// @param fullOverride fullOverride whether the override overrides the base URI or is appended
    /// @param tokenRevealedOverride whether the token should be individually revealed
    /// @param tokenURI the override token URI
    event SetTokenUri(
        uint256 indexed tokenId,
        bool fullOverride,
        bool tokenRevealedOverride,
        string indexed tokenURI
    );
    /// @notice Triggers when the unrevealed token uri is updated.
    /// @param unrevealedTokenURI the new unrevealed token uri
    event UnrevealedTokenUriSet(string indexed unrevealedTokenURI);

    /// @notice Triggers when the collection is revealed.
    event Revealed();

    /// @notice Triggers when a singular token is revealed.
    /// @param tokenId the token which is revealed
    event TokenRevealed(uint256 indexed tokenId);

    /// @notice Returns whether the collection as a whole is revealed.
    /// @param revealed whether the collection is revealed
    function revealed() external view returns (bool revealed);

    /// @notice Reveals the collection. Emits {Revealed}.
    function reveal() external;

    /// @notice Reveals an individual token. Fails if the token does not exist.
    /// Emits {TokenRevealed}.
    /// @param tokenId the id of the revealed token
    function revealToken(uint256 tokenId) external;

    /// @notice Overrides the token URI for an individual token and optionally sets whether the base uri
    /// should be overridden too, and whether the token should be revealed individually. Emits {SetTokenUri}
    /// and {TokenRevealed} if it is revealed in the process.
    /// @param tokenId the id of the token to override these things for
    /// @param overrideBaseURI whether the base URI should be overridden or `_tokenURI` should be
    /// appended to it
    /// @param overrideReveal whether the token should be individually revealed
    /// @param _tokenURI the new token URI
    function setTokenURI(
        uint256 tokenId,
        bool overrideBaseURI,
        bool overrideReveal,
        string memory _tokenURI
    ) external;

    /// @notice Sets the unrevealed token uri. Emits {UnrevealedTokenUriSet}.
    /// @param unrevealedTokenURI the new unrevealed token URI
    function setUnrevealedTokenURI(string memory unrevealedTokenURI) external;

    /// @notice Sets the base URI. Emits {SetBaseURI}.
    /// @param baseURI the new base uri
    function setBaseURI(string memory baseURI) external;

    /// @notice Returns whether the token `tokenId` overrides the full base URI.
    /// @param tokenId the id of the token to check
    /// @return overridesBaseURI whether the token overrides the full base URI
    function overridesFullURI(uint256 tokenId)
        external
        view
        returns (bool overridesBaseURI);

    /// @notice Returns whether the token `tokenId` is revealed.
    /// @param tokenId the id of the token to check
    /// @return revealed whether the token is revealed
    function tokenRevealed(uint256 tokenId)
        external
        view
        returns (bool revealed);
}

File 8 of 36 : IERC721OmmgMetadataFreezable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IERC721OmmgMetadataFreezable
/// @author NotAMeme aka nxlogixnick
/// @notice This interface serves as an extension to {IERC721OmmgMetadata} and adds
/// functionality to freeze the metadata, effectively making it immutable.
interface IERC721OmmgMetadataFreezable {
    error MetadataIsFrozen();
    /// @notice Triggers when the metadata is frozen
    event MetadataFrozen();

    /// @notice Returns whether the metadata is frozen.
    /// @return frozen whether the metadata is frozen or not
    function metadataFrozen() external view returns (bool frozen);

    /// @notice Freezes the metadata to effectively turn it immutable. Emits {MetadataFrozen}.
    /// Fails if the metadata is already frozen.
    function freezeMetadata() external;
}

File 9 of 36 : IOmmgAcquirable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgAcquirable
/// @author NotAMeme aka nxlogixnick
/// @notice This interface serves for the simple minting functionality of the OMMG Artist Contracts.
interface IOmmgAcquirable {
    /// @notice Mints `amount` NFTs of this contract. The more minted at once, the cheaper gas is for each token.
    /// However, the upper limit for `amount` can be queried via `maxBatchSize`. Fails if the user does not provide
    /// the correct amount of eth, if sale is paused, if the supply catch is reached, or if `maxBatchSize` is exceeded.
    /// @param amount the amount of NFTs to mint.
    function acquire(uint256 amount) external payable;

    /// @notice Mints `amount` NFTs of this contract to `receiver`. The more minted at once, the cheaper gas is for each token.
    /// However, the upper limit for `amount` can be queried via `maxBatchSize`. Fails if the supply catch is reached,
    /// or if `maxBatchSize` is exceeded.
    /// @param receiver the receiver of the NFTs.
    /// @param amount the amount of NFTs to mint.
    function acquireForCommunity(address receiver, uint256 amount) external;
}

File 10 of 36 : IOmmgAcquirableWithToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../def/TokenDiscount.sol";

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgAcquirableWithToken
/// @author NotAMeme aka nxlogixnick
/// @notice This interface serves for the extended minting functionality of the Ommg Artist Contracts.
/// The general functionality is that special prices can be configured for users to mint if they hold other
/// NFTs. Each NFT can only be used once to receive this discount, unless specifically reset.
interface IOmmgAcquirableWithToken {
    error TokenNotOwned(IERC721 token, uint256 tokenIds);
    error TokenAlreadyUsed(IERC721 token, uint256 tokenId);
    error TokenNotConfigured(IERC721 token);
    error TokenNotActive(IERC721 token);
    error TokenAlreadyConfigured(IERC721 token);
    error TokenSupplyExceeded(IERC721 token, uint256 supplyCap);

    /// @notice Triggers when a token discount is added.
    /// @param tokenAddress the addres of the added NFT contract for discounts
    /// @param config a tuple [uint256 price, uint256 limit, bool active] that represents the configuration for
    /// the discount
    event TokenDiscountAdded(
        IERC721 indexed tokenAddress,
        TokenDiscountConfig config
    );
    /// @notice Triggers when a token discount is updated.
    /// @param tokenAddress the addres of the added NFT contract for discounts
    /// @param config a tuple [uint256 price, uint256 limit, bool active] that represents the new configuration for
    /// the discount
    event TokenDiscountUpdated(
        IERC721 indexed tokenAddress,
        TokenDiscountConfig config
    );
    /// @notice Triggers when a token discount is removed.
    /// @param tokenAddress the addres of the NFT contract
    event TokenDiscountRemoved(IERC721 indexed tokenAddress);
    /// @notice Triggers when a token discount is reset - meaning all token usage data is reset and all tokens
    /// are marked as unused again.
    /// @param tokenAddress the addres of the NFT contract
    event TokenDiscountReset(IERC721 indexed tokenAddress);
    /// @notice Triggers when a token discount is used for a discount and then marked as used
    /// @param sender the user who used the token
    /// @param tokenAddress the addres of the NFT contract
    /// @param tokenId the id of the NFT used for the discount
    event TokenUsedForDiscount(
        address indexed sender,
        IERC721 indexed tokenAddress,
        uint256 indexed tokenId
    );

    /// @notice Adds an NFT contract and thus all of it's tokens to the discount list.
    /// Emits a {TokenDiscountAdded} event and fails if `tokenAddress` is the zero address
    /// or is already configured.
    /// @param tokenAddress the address of the NFT contract
    /// @param config the initial configuration as [uint256 price, uint256 limit, bool active]
    function addTokenDiscount(
        IERC721 tokenAddress,
        TokenDiscountConfig memory config
    ) external;

    /// @notice Removes an NFT contract from the discount list.
    /// Emits a {TokenDiscountRemoved} event and fails if `tokenAddress` is the zero address
    /// or is not already configured.
    /// @param tokenAddress the address of the NFT contract
    function removeTokenDiscount(IERC721 tokenAddress) external;

    /// @notice Updates an NFT contracts configuration of the discount.
    /// Emits a {TokenDiscountUpdated} event and fails if `tokenAddress` is the zero address
    /// or is not already configured.
    /// @param tokenAddress the address of the NFT contract
    /// @param config the new configuration as [uint256 price, uint256 limit, bool active]
    function updateTokenDiscount(
        IERC721 tokenAddress,
        TokenDiscountConfig memory config
    ) external;

    /// @notice Resets the usage state of all NFTs of the contract at `tokenAddress`. This allows all token ids
    /// to be used again.
    /// Emits a {TokenDiscountReset} event and fails if `tokenAddress` is the zero address
    /// or is not already configured.
    /// @param tokenAddress the address of the NFT contract
    function resetTokenDiscountUsed(IERC721 tokenAddress) external;

    /// @notice Returns the current configuration of the token discount of `tokenAddress`
    /// @return config the configuration as [uint256 price, uint256 limit, bool active]
    function tokenDiscountInfo(IERC721 tokenAddress)
        external
        view
        returns (TokenDiscountOutput memory config);

    /// @notice Returns a list of all current tokens configured for discounts and their configurations.
    /// @return discounts the configuration as [IERC721 tokenAddress, [uint256 price, uint256 limit, bool active]]
    function tokenDiscounts()
        external
        view
        returns (TokenDiscountOutput[] memory discounts);

    /// @notice Acquires an NFT of this contract by proving ownership of the tokens in `tokenIds` belonging to
    /// a contract `tokenAddress` that has a configured discount. This way cheaper prices can be achieved for OMMG holders
    /// and potentially other partners. Emits {TokenUsedForDiscount} and requires the user to send the correct amount of
    /// eth as well as to own the tokens within `tokenIds` from `tokenAddress`, and for `tokenAddress` to be a configured token for discounts.
    /// @param tokenAddress the address of the contract which is the reference for `tokenIds`
    /// @param tokenIds the token ids which are to be used to get the discount
    function acquireWithToken(IERC721 tokenAddress, uint256[] memory tokenIds)
        external
        payable;

    /// @notice Sets the active status of the token discount of `tokenAddress`.
    /// Fails if `tokenAddress` is the zero address or is not already configured.
    /// @param tokenAddress the configured token address
    /// @param active the new desired activity state
    function setTokenDiscountActive(IERC721 tokenAddress, bool active)
        external;

    /// @notice Returns whether the tokens `tokenIds` of `tokenAddress` have already been used for a discount.
    /// Fails if `tokenAddress` is the zero address or is not already configured.
    /// @param tokenAddress the address of the token contract
    /// @param tokenIds the ids to check
    /// @return used if the tokens have already been used, each index corresponding to the
    /// token id index in the array
    function tokensUsedForDiscount(
        IERC721 tokenAddress,
        uint256[] memory tokenIds
    ) external view returns (bool[] memory used);
}

File 11 of 36 : IOmmgEmergencyTokenRecoverable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgEmergencyTokenRecoverable
/// @author NotAMeme aka nxlogixnick
/// @notice An interface for emergency ERC20 token recovery. This is needed
/// in the case that someone accidentally sent ERC20 tokens to this contract.
interface IOmmgEmergencyTokenRecoverable {
    /// @notice Triggers when ERC20 tokens are recovered
    /// @param token The address of the ERC20 token contract
    /// @param receiver The recipient of the tokens
    /// @param amount the amount of tokens recovered
    event TokensRecovered(
        IERC20 indexed token,
        address indexed receiver,
        uint256 amount
    );

    /// @notice Recovers ERC20 tokens
    /// @param token The address of the ERC20 token contract
    /// @param receiver The recipient of the tokens
    /// @param amount the amount of tokens to recover
    function emergencyRecoverTokens(
        IERC20 token,
        address receiver,
        uint256 amount
    ) external;
}

File 12 of 36 : IOmmgWithdrawable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "../def/Shareholder.sol";

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgWithdrawable
/// @author NotAMeme aka nxlogixnick
/// @notice An interface for automatic distribution of the contract balance
/// to shareholders based on their held shares
interface IOmmgWithdrawable {
    /// @notice triggers whenever a shareholder is added to the contract
    /// @param addr the address of the shareholder
    /// @param shares the number of shares held by the holder
    event ShareholderAdded(address indexed addr, uint256 shares);
    /// @notice triggers whenever a shareholder is added to the contract
    /// @param addr the address of the former shareholder
    /// @param shares the number of shares that was held by the former holder
    event ShareholderRemoved(address indexed addr, uint256 shares);
    /// @notice triggers whenever a shareholder is updated
    /// @param addr the address of the shareholder
    /// @param shares the new number of shares held by the holder
    event ShareholderUpdated(address indexed addr, uint256 shares);
    /// @notice triggers whenever funds are withdrawn
    /// @param txSender the sender of the transaction
    /// @param amount the amount of eth withdrawn
    event Withdrawn(address indexed txSender, uint256 amount);
    /// @notice triggers whenever an emergency withdraw is executed
    /// @param txSender the transaction sender
    /// @param amount the amount of eth withdrawn
    event EmergencyWithdrawn(address indexed txSender, uint256 amount);
    /// @notice triggers whenever a shareholder receives their share of a withdrawal
    /// @param txSender the address that initiated the withdrawal
    /// @param to the address of the shareholder receiving this part of the withdrawal
    /// @param amount the amount of eth received by `to`
    event PaidOut(
        address indexed txSender,
        address indexed to,
        uint256 amount
    );
    /// @notice fires whenever a shareholder already exists but is attempted to be added
    /// @param addr the address already added
    error ShareholderAlreadyExists(address addr);
    /// @notice fires whenever a shareholder does not exist but an access is attempted
    /// @param addr the address of the attempted shareholder acces
    error ShareholderDoesNotExist(address addr);

    /// @notice withdraws the current balance from this contract and distributes it to shareholders
    /// according to their held shares. Triggers a {Withdrawn} event and a {PaidOut} event per shareholder.
    function withdraw() external;

    /// @notice withdraws the current balance from this contract and sends it to the
    /// initiator of the transaction. Triggers an {EmergencyWithdrawn} event.
    function emergencyWithdraw() external;

    /// @notice Adds a shareholder to the contract. When `withdraw` is called,
    /// the shareholder will receive an amount of native tokens proportional to
    /// their shares. Triggers a {ShareholderAdded} event.
    /// Requires `walletAddress` to not be the ZeroAddress and for the shareholder to not already exist,
    /// as well as for `shares` to be greater than 0.
    /// @param walletAddress the address of the shareholder
    /// @param shares the number of shares assigned to that shareholder
    function addShareholder(address walletAddress, uint256 shares) external;

    /// @notice Removes a shareholder from the contract. Triggers a {ShareholderRemoved} event.
    /// Requires `walletAddress` to not be the ZeroAddress and for the shareholder to exist.
    /// @param walletAddress the address of the shareholder to remove
    function removeShareholder(address walletAddress) external;

    /// @notice Updates a shareholder of the contract. Triggers a {ShareholderUpdated} event.
    /// Requires `walletAddress` to not be the ZeroAddress and for the shareholder to exist.
    /// @param walletAddress the address of the shareholder to remove
    /// @param updatedShares the new amount of shares the shareholder will have
    function updateShareholder(address walletAddress, uint256 updatedShares)
        external;

    /// @notice returns a list of all shareholders with their shares
    /// @return shareholders An array of tuples [address, shares], see the {Shareholder} struct
    function shareholders()
        external
        view
        returns (Shareholder[] memory shareholders);

    /// @notice returns the total amount of shares that exist
    /// @return shares the total number of shares in the contract
    function totalShares() external view returns (uint256 shares);

    /// @notice returns the number of shares held by `shareholderAddress`
    /// @return shares the number of shares held by `shareholderAddress`
    function shares(address shareholderAddress)
        external
        view
        returns (uint256 shares);
}

File 13 of 36 : IOmmgProvenanceHash.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgProvenanceHash
/// @author NotAMeme aka nxlogixnick
/// @notice An interface for a freezable provenance hash, to enable full trust that
/// the metadata of the underlying token is not predetermined or tampered with.
interface IOmmgProvenanceHash {
    /// @notice Triggers when an attempt is made to change the provenance
    /// hash after it has been frozen
    error ProvenanceHashIsFrozen();
    /// @notice Triggers when the provenance hash is set to a new value.
    /// @param provenanceHash the new provenance hash.
    event ProvenanceHashSet(string indexed provenanceHash);
    /// @notice Triggers when the provenance hash is frozen.
    event ProvenanceHashFrozen();

    /// @notice Returns the current provenance hash. The idea is for this to be
    /// the proof that the order of token metada has not been tampered with and
    /// that it has not been predetermined.
    /// @return provenanceHash the provenance hash
    function provenanceHash()
        external
        view
        returns (string memory provenanceHash);

    /// @notice Returns a boolean value indicating whether the provenance hash
    /// has been frozen or not. A frozen provenance hash is immutable.
    /// @return isFrozen whether it is frozen or not
    function provenanceFrozen() external view returns (bool isFrozen);

    /// @notice Updates the provenance hash to the new value `provenanceHash`.
    /// Also triggers the event {ProvenanceHashSet} and reverts if the provenance
    /// hash has already been frozen.
    function setProvenanceHash(string memory provenanceHash) external;

    /// @notice freezes the provenance hash and thus makes it immutable.
    /// Triggers a {ProvenanceHashFrozen} event and reverts if the hash is already frozen.
    function freezeProvenance() external;
}

File 14 of 36 : IOmmgMutablePrice.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgMutablePrice
/// @author NotAMeme aka nxlogixnick
/// @notice An interface for a simple mutable price implementation.
interface IOmmgMutablePrice {
    /// @notice Triggers when the price gets changes.
    /// @param newPrice the new price
    event PriceChanged(uint256 newPrice);

    /// @notice Returns the current price.
    /// @return price the current price
    function price() external view returns (uint256 price);

    /// @notice Sets the price to `price`.
    function setPrice(uint256 price) external;
}

File 15 of 36 : IOmmgSalePausable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgSalePausable
/// @author NotAMeme aka nxlogixnick
/// @notice An interface for a simple mutable sale state on any contract
interface IOmmgSalePausable {
    error SaleNotActive();
    /// @notice This event gets triggered whenever the sale state changes
    /// @param newValue the new sale state
    event SaleIsActiveSet(bool newValue);

    /// @notice This function returns a boolean value indicating whether
    /// the public sale is currently active or not
    /// returns currentState whether the sale is active or not
    function saleIsActive() external view returns (bool currentState);

    /// @notice This function can be used to change the sale state to `newValue`.
    /// Triggers a {SaleIsActiveSet} event.
    /// @param newValue the desired new value for the sale state
    function setSaleIsActive(bool newValue) external;
}

File 16 of 36 : IOmmgSupplyCap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgSupplyCap
/// @author NotAMeme aka nxlogixnick
/// @notice An interface for a supply cap on any contract
interface IOmmgSupplyCap {
    /// @notice this returns the supply cap of the token
    /// @return supplyCap the supply cap of the token
    function supplyCap() external view returns (uint256 supplyCap);
}

File 17 of 36 : IOmmgFrontEnd.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../def/TokenDiscount.sol";

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgFrontEnd
/// @author NotAMeme aka nxlogixnick
/// @notice This interface is for the minting front end
interface IOmmgFrontEnd {
    /// @notice Returns a list of all current tokens configured for discounts and their configurations.
    /// @return discounts the configuration as [IERC721 tokenAddress, [uint256 price, uint256 limit, bool active]]
    function tokenDiscounts()
        external
        view
        returns (TokenDiscountOutput[] memory discounts);

    /// @notice Returns the maximum number of tokens mintable in one transaction
    /// @return maxBatch the maximum amount
    function maxBatchSize() external view returns (uint256 maxBatch);

    /// @notice Acquires an NFT of this contract by proving ownership of the tokens in `tokenIds` belonging to
    /// a contract `tokenAddress` that has a configured discount. This way cheaper prices can be achieved for OMMG holders
    /// and potentially other partners. Emits {TokenUsedForDiscount} and requires the user to send the correct amount of
    /// eth as well as to own the tokens within `tokenIds` from `tokenAddress`, and for `tokenAddress` to be a configured token for discounts.
    /// @param tokenAddress the address of the contract which is the reference for `tokenIds`
    /// @param tokenIds the token ids which are to be used to get the discount
    function acquireWithToken(IERC721 tokenAddress, uint256[] memory tokenIds)
        external
        payable;

    /// @notice Returns whether the tokens `tokenIds` of `tokenAddress` have already been used for a discount.
    /// Fails if `tokenAddress` is the zero address or is not already configured.
    /// @param tokenAddress the address of the token contract
    /// @param tokenIds the ids to check
    /// @return used if the tokens have already been used, each index corresponding to the
    /// token id index in the array
    function tokensUsedForDiscount(
        IERC721 tokenAddress,
        uint256[] memory tokenIds
    ) external view returns (bool[] memory used);

    /// @notice Mints `amount` NFTs of this contract. The more minted at once, the cheaper gas is for each token.
    /// However, the upper limit for `amount` can be queried via `maxBatchSize`. Fails if the user does not provide
    /// the correct amount of eth, if sale is paused, if the supply catch is reached, or if `maxBatchSize` is exceeded.
    /// @param amount the amount of NFTs to mint.
    function acquire(uint256 amount) external payable;

    /// @notice this returns the supply cap of the token
    /// @return supplyCap the supply cap of the token
    function supplyCap() external view returns (uint256 supplyCap);

    /// @notice Returns the current price.
    /// @return price the current price
    function price() external view returns (uint256 price);

    /// @notice This function returns a boolean value indicating whether
    /// the public sale is currently active or not
    /// returns currentState whether the sale is active or not
    function saleIsActive() external view returns (bool currentState);

    /// @notice This function returns the total amount of tokens still available
    /// of the total supply
    function tokensAvailable() external view returns (uint256 amount);

    // docs are in IERC721Metadata
    function name() external view returns (string memory name);

    // docs are in IERC721Metadata
    function symbol() external view returns (string memory name);
}

File 18 of 36 : ArtistContractConfig.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

import "../def/Shareholder.sol";
import "../def/TokenDiscount.sol";

struct ArtistContractConfig {
    string name;
    string symbol;
    address[] withdrawAdmins;
    address[] stateAdmins;
    address[] mintForFree;
    uint256 initialPrice;
    uint256 supplyCap;
    uint256 maxBatchSize;
    Shareholder[] shareholders;
    TokenDiscountInput[] tokenDiscounts;
}

File 19 of 36 : CustomErrors.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.11;

/// @dev triggered when an address is the null address
error NullAddress();

error TokenDoesNotExist(uint256 tokenId);
error TokenAlreadyExists(uint256 tokenId);

error SafeTransferFailed(address from, address to, uint256 tokenId);

error TargetNonERC721Receiver(address target);

error TransferUnauthorized(
    address sender,
    address from,
    address to,
    uint256 tokenId,
    address tokenOwner
);

error IndexOutOfBounds(uint256 index, uint256 max);

error ApprovalForAllInvalid(address target, bool targetState);
error ApprovalInvalid(address account, uint256 tokenId);
error ApprovalUnauthorized(
    address from,
    address to,
    uint256 tokenId,
    address sender
);
error OperationFailed();

error InvalidAmount(uint256 amount, uint256 minAmount, uint256 maxAmount);
error AmountExceedsCap(uint256 amount, uint256 available, uint256 cap);
error InvalidMessageValue(uint256 value, uint256 needed);
error ZeroShares();

File 20 of 36 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 21 of 36 : IOmmgSnapshot.sol
// SPDX-License-Identifier: BSD-3-Clause

pragma solidity ^0.8.0;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title ISnapshottable
/// @author NotAMeme aka nxlogixnick
/// @notice An interface for simple snapshots of all tokens
interface IOmmgSnapshot {
    enum TokenStatus {
        OWNED,
        BURNED
    }
    struct TokenInfo {
        uint256 tokenId;
        TokenStatus status;
        address owner;
    }

    /// @notice Returns an array of tuples [tokenId, tokenStatus, owner] with the
    /// current state of each minted token. A tokenStatus of 0 means it exists, 1 signals that
    /// the token has been burned.
    /// @return tokenStates the states of all minted tokens
    function snapshot() external view returns (TokenInfo[] memory tokenStates);
}

File 22 of 36 : 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 23 of 36 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 24 of 36 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 25 of 36 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 26 of 36 : 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 27 of 36 : 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 28 of 36 : 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 29 of 36 : OmmgOwnable.sol
// SPDX-License-Identifier: MIT

import "@openzeppelin/contracts/utils/Context.sol";
import "../interfaces/IOmmgOwnable.sol";
import "../def/CustomErrors.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

pragma solidity ^0.8.11;

abstract contract OmmgOwnable is IOmmgOwnable, Context, ERC165 {
    address private _owner;

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

    ///@dev Reverts if called by any account other than the owner
    modifier onlyOwner() {
        if (owner() != _msgSender())
            revert OwnershipUnauthorized(_msgSender());
        _;
    }

    /// @dev Returns the address of the current owner.
    function owner() public view override returns (address) {
        return _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
    function renounceOwnershipPermanently() public override onlyOwner {
        _setOwner(address(0));
    }

    /// @dev Transfers ownership of the contract to a new account (`newOwner`).
    /// Can only be called by the current owner.
    function transferOwnership(address newOwner) public override onlyOwner {
        if (newOwner == address(0)) revert NullAddress();
        _setOwner(newOwner);
    }

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

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == type(IOmmgOwnable).interfaceId ||
            super.supportsInterface(interfaceId);
    }
}

File 30 of 36 : IOmmgAccessControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgAccessControl
/// @author NotAMeme aka nxlogixnick
/// @notice This interface serves for a lightweight custom implementation of role based permissions.
interface IOmmgAccessControl {
    struct RoleData {
        mapping(address => bool) members;
    }

    /// @notice Triggers when an unauthorized address attempts
    /// a restricted action
    /// @param account initiated the unauthorized action
    /// @param missingRole the missing role identifier
    error Unauthorized(address account, bytes32 missingRole);

    /// @notice Emitted when `account` is granted `role`
    /// @param role the role granted
    /// @param account the account that is granted `role`
    /// @param sender the address that initiated this action
    event RoleGranted(
        bytes32 indexed role,
        address indexed account,
        address indexed sender
    );

    /// @notice Emitted when `account` is revoked `role`
    /// @param role the role revoked
    /// @param account the account that is revoked `role`
    /// @param sender the address that initiated this action
    event RoleRevoked(
        bytes32 indexed role,
        address indexed account,
        address indexed sender
    );

    /// @notice Returns `true` if `account` has been granted `role`.
    /// @param role the role identifier
    /// @param account the account to check
    /// @return hasRole whether `account` has `role` or not.
    function hasRole(bytes32 role, address account)
        external
        view
        returns (bool hasRole);

    /// @notice Grants `role` to `account`. Emits {RoleGranted}.
    /// @param role the role identifier
    /// @param account the account to grant `role` to
    function grantRole(bytes32 role, address account) external;

    /// @notice Grants `role` to `account`. Emits {RoleRevoked}.
    /// @param role the role identifier
    /// @param account the account to revoke `role` from
    function revokeRole(bytes32 role, address account) external;

    /// @notice Rennounces `role` from the calling account. Emits {RoleRevoked}.
    /// @param role the role identifier of the role to rennounce
    function renounceRole(bytes32 role) external;
}

File 31 of 36 : IOmmgOwnable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

//  .----------------.  .----------------.  .----------------.  .----------------.
// | .--------------. || .--------------. || .--------------. || .--------------. |
// | |     ____     | || | ____    ____ | || | ____    ____ | || |    ______    | |
// | |   .'    `.   | || ||_   \  /   _|| || ||_   \  /   _|| || |  .' ___  |   | |
// | |  /  .--.  \  | || |  |   \/   |  | || |  |   \/   |  | || | / .'   \_|   | |
// | |  | |    | |  | || |  | |\  /| |  | || |  | |\  /| |  | || | | |    ____  | |
// | |  \  `--'  /  | || | _| |_\/_| |_ | || | _| |_\/_| |_ | || | \ `.___]  _| | |
// | |   `.____.'   | || ||_____||_____|| || ||_____||_____|| || |  `._____.'   | |
// | |              | || |              | || |              | || |              | |
// | '--------------' || '--------------' || '--------------' || '--------------' |
//  '----------------'  '----------------'  '----------------'  '----------------'

/// @title IOmmgProvenanceHash
/// @author NotAMeme aka nxlogixnick
/// @notice An interface for a custom implementation of Ownable contracts.
interface IOmmgOwnable {
    /// @dev Triggers when an unauthorized address attempts
    /// a restricted action
    /// @param account initiated the unauthorized action
    error OwnershipUnauthorized(address account);
    /// @dev Triggers when the ownership is transferred
    /// @param previousOwner the previous owner of the contract
    /// @param newOwner the new owner of the contract
    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    /// @notice Returns the current owner address.
    /// @return owner the address of the current owner
    function owner() external view returns (address owner);

    /// @notice Leaves the contract without owner. It will not be possible to call
    /// `onlyOwner` functions anymore. Can only be called by the current owner.
    /// Triggers the {OwnershipTransferred} event.
    function renounceOwnershipPermanently() external;

    /// @notice Transfers the ownership to `newOwner`.
    /// Triggers the {OwnershipTransferred} event.
    /// `newOwner` can not be the zero address.
    /// @param newOwner the new owner of the contract
    function transferOwnership(address newOwner) external;
}

File 32 of 36 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 33 of 36 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 34 of 36 : TokenDiscount.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

struct TokenDiscountConfig {
    uint256 price;
    uint256 supply;
    bool active;
}
struct TokenDiscountInput {
    IERC721 tokenAddress;
    TokenDiscountConfig config;
}
struct TokenDiscountOutput {
    IERC721 tokenAddress;
    string name;
    string symbol;
    uint256 usedAmount;
    TokenDiscountConfig config;
}

File 35 of 36 : 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 36 of 36 : Shareholder.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

struct Shareholder {
    address addr;
    uint256 shares;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address[]","name":"withdrawAdmins","type":"address[]"},{"internalType":"address[]","name":"stateAdmins","type":"address[]"},{"internalType":"address[]","name":"mintForFree","type":"address[]"},{"internalType":"uint256","name":"initialPrice","type":"uint256"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"maxBatchSize","type":"uint256"},{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"internalType":"struct Shareholder[]","name":"shareholders","type":"tuple[]"},{"components":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct TokenDiscountConfig","name":"config","type":"tuple"}],"internalType":"struct TokenDiscountInput[]","name":"tokenDiscounts","type":"tuple[]"}],"internalType":"struct ArtistContractConfig","name":"config","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"cap","type":"uint256"}],"name":"AmountExceedsCap","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"targetState","type":"bool"}],"name":"ApprovalForAllInvalid","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ApprovalInvalid","type":"error"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"sender","type":"address"}],"name":"ApprovalUnauthorized","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"IndexOutOfBounds","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"maxAmount","type":"uint256"}],"name":"InvalidAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InvalidMessageValue","type":"error"},{"inputs":[],"name":"MetadataIsFrozen","type":"error"},{"inputs":[],"name":"NullAddress","type":"error"},{"inputs":[],"name":"OperationFailed","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnershipUnauthorized","type":"error"},{"inputs":[],"name":"ProvenanceHashIsFrozen","type":"error"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"SafeTransferFailed","type":"error"},{"inputs":[],"name":"SaleNotActive","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"ShareholderAlreadyExists","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"ShareholderDoesNotExist","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"TargetNonERC721Receiver","type":"error"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"}],"name":"TokenAlreadyConfigured","type":"error"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenAlreadyUsed","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenDoesNotExist","type":"error"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"}],"name":"TokenNotActive","type":"error"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"}],"name":"TokenNotConfigured","type":"error"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"uint256","name":"tokenIds","type":"uint256"}],"name":"TokenNotOwned","type":"error"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"uint256","name":"supplyCap","type":"uint256"}],"name":"TokenSupplyExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"tokenOwner","type":"address"}],"name":"TransferUnauthorized","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"missingRole","type":"bytes32"}],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroShares","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"txSender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdrawn","type":"event"},{"anonymous":false,"inputs":[],"name":"MetadataFrozen","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":"address","name":"txSender","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaidOut","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"ProvenanceHashFrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"provenanceHash","type":"string"}],"name":"ProvenanceHashSet","type":"event"},{"anonymous":false,"inputs":[],"name":"Revealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"SaleIsActiveSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"baseURI","type":"string"}],"name":"SetBaseUri","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"fullOverride","type":"bool"},{"indexed":false,"internalType":"bool","name":"tokenRevealedOverride","type":"bool"},{"indexed":true,"internalType":"string","name":"tokenURI","type":"string"}],"name":"SetTokenUri","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"ShareholderAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"ShareholderRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"ShareholderUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"indexed":false,"internalType":"struct TokenDiscountConfig","name":"config","type":"tuple"}],"name":"TokenDiscountAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC721","name":"tokenAddress","type":"address"}],"name":"TokenDiscountRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC721","name":"tokenAddress","type":"address"}],"name":"TokenDiscountReset","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"indexed":false,"internalType":"struct TokenDiscountConfig","name":"config","type":"tuple"}],"name":"TokenDiscountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenRevealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenUsedForDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"unrevealedTokenURI","type":"string"}],"name":"UnrevealedTokenUriSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"txSender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"Artist","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTRACT_FREE_ACQUIRE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTRACT_STATE_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTRACT_WITHDRAW_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"acquire","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"acquireForCommunity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"acquireWithToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"walletAddress","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"addShareholder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct TokenDiscountConfig","name":"config","type":"tuple"}],"name":"addTokenDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyRecoverTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freezeMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"freezeProvenance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"operator","type":"address"}],"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":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadataFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"overridesFullURI","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"walletAddress","type":"address"}],"name":"removeShareholder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"}],"name":"removeTokenDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnershipPermanently","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"}],"name":"resetTokenDiscountUsed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"revealToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleIsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"provenanceHash_","type":"string"}],"name":"setProvenanceHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"newValue","type":"bool"}],"name":"setSaleIsActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"internalType":"bool","name":"active","type":"bool"}],"name":"setTokenDiscountActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"overrideBaseURI","type":"bool"},{"internalType":"bool","name":"overrideReveal","type":"bool"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"unrevealedTokenURI","type":"string"}],"name":"setUnrevealedTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shareholders","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"internalType":"struct Shareholder[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"walletAddress","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"snapshot","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"enum IOmmgSnapshot.TokenStatus","name":"status","type":"uint8"},{"internalType":"address","name":"owner","type":"address"}],"internalType":"struct IOmmgSnapshot.TokenInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supplyCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"}],"name":"tokenDiscountInfo","outputs":[{"components":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"usedAmount","type":"uint256"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct TokenDiscountConfig","name":"config","type":"tuple"}],"internalType":"struct TokenDiscountOutput","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenDiscounts","outputs":[{"components":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"usedAmount","type":"uint256"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct TokenDiscountConfig","name":"config","type":"tuple"}],"internalType":"struct TokenDiscountOutput[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenRevealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensAvailable","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"tokensUsedForDiscount","outputs":[{"internalType":"bool[]","name":"used","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"walletAddress","type":"address"},{"internalType":"uint256","name":"updatedShares","type":"uint256"}],"name":"updateShareholder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"bool","name":"active","type":"bool"}],"internalType":"struct TokenDiscountConfig","name":"config","type":"tuple"}],"name":"updateTokenDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c060405260016002553480156200001657600080fd5b50604051620064bf380380620064bf833981016040819052620000399162000af3565b60e081015181906200004b3362000213565b608052805180516200006691600b91602090910190620006ca565b5060208082015180516200007f92600c920190620006ca565b5060a08082015160085560c082015190526040810151620000c1907f7c13537556c77ef3fb98601c3356887ddbe5991e86dc065741ce77e1dd2554a362000263565b6060810151620000f2907f7e69b879a040173b938f56bb64bfa62bcd758c08ae6ed7cfdf7da6d7dba9270862000263565b608081015162000123907ffdd7b2ba629c0a0b84029cda831836222e5708c95d3e782c0762066b472dad0e62000263565b6101008101515160005b8261010001515181101562000183576200016e83610100015182815181106200015a576200015a62000c76565b6020026020010151620002c260201b60201c565b806200017a8162000ca2565b9150506200012d565b50506101208101515160005b818110156200020957620001f48361012001518281518110620001b657620001b662000c76565b6020026020010151600001518461012001518381518110620001dc57620001dc62000c76565b6020026020010151602001516200048b60201b60201c565b80620002008162000ca2565b9150506200018f565b5050505062000d18565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b81518015620002bd5760005b81811015620002bb57620002a68385838151811062000292576200029262000c76565b60200260200101516200060360201b60201c565b80620002b28162000ca2565b9150506200026f565b505b505050565b6020810151620002e557604051639811e0c760e01b815260040160405180910390fd5b80516001600160a01b03166200030e5760405163e99d5ac560e01b815260040160405180910390fd5b60135460005b81811015620003a35782600001516001600160a01b03166013828154811062000341576200034162000c76565b60009182526020909120600290910201546001600160a01b031614156200038e5782516040516370d2049160e01b81526001600160a01b0390911660048201526024015b60405180910390fd5b806200039a8162000ca2565b91505062000314565b5060138054600181018255600091825283517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a090600290920291820180546001600160a01b0319166001600160a01b0390921691909117905560208401517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09190910181905560098054919290916200043c90849062000cc0565b909155505081516020808401516040519081526001600160a01b03909216917f3bc19114ca6a687ffd9445c87615db284e96364365d72b010ec53244b45e561b91015b60405180910390a25050565b6001600160a01b038216620004b35760405163e99d5ac560e01b815260040160405180910390fd5b6001600160a01b03821660009081526015602052604090205460ff1615620004fa576040516354d67cef60e01b81526001600160a01b038316600482015260240162000385565b6001600160a01b0382166000908152601560209081526040808320805460ff1916600117905560179091528120805491620005358362000ca2565b90915550506001600160a01b038216600081815260196020908152604080832085518155858301805160018084019190915587840180516002909401805460ff1916941515949094179093556014805491820181559095527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec90940180546001600160a01b0319168617905581518651815293519284019290925290511515908201527fab109b1e3dd4bf279798315182b336f138e930aec9aaeafe98f768450d9fd9b7906060016200047f565b6000546001600160a01b031633146200063257604051630e60d8d360e41b815233600482015260240162000385565b6200063e828262000642565b5050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff166200063e5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b828054620006d89062000cdb565b90600052602060002090601f016020900481019282620006fc576000855562000747565b82601f106200071757805160ff191683800117855562000747565b8280016001018555821562000747579182015b82811115620007475782518255916020019190600101906200072a565b506200075592915062000759565b5090565b5b808211156200075557600081556001016200075a565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715620007ab57620007ab62000770565b60405290565b604051606081016001600160401b0381118282101715620007ab57620007ab62000770565b60405161014081016001600160401b0381118282101715620007ab57620007ab62000770565b604051601f8201601f191681016001600160401b038111828210171562000827576200082762000770565b604052919050565b600082601f8301126200084157600080fd5b81516001600160401b038111156200085d576200085d62000770565b602062000873601f8301601f19168201620007fc565b82815285828487010111156200088857600080fd5b60005b83811015620008a85785810183015182820184015282016200088b565b83811115620008ba5760008385840101525b5095945050505050565b60006001600160401b03821115620008e057620008e062000770565b5060051b60200190565b6001600160a01b03811681146200090057600080fd5b50565b600082601f8301126200091557600080fd5b815160206200092e6200092883620008c4565b620007fc565b82815260059290921b840181019181810190868411156200094e57600080fd5b8286015b84811015620009765780516200096881620008ea565b835291830191830162000952565b509695505050505050565b600082601f8301126200099357600080fd5b81516020620009a66200092883620008c4565b82815260069290921b84018101918181019086841115620009c657600080fd5b8286015b84811015620009765760408189031215620009e55760008081fd5b620009ef62000786565b8151620009fc81620008ea565b81528185015185820152835291830191604001620009ca565b600082601f83011262000a2757600080fd5b8151602062000a3a6200092883620008c4565b82815260079290921b8401810191818101908684111562000a5a57600080fd5b8286015b848110156200097657808803608081121562000a7a5760008081fd5b62000a8462000786565b825162000a9181620008ea565b81526060601f19830181131562000aa85760008081fd5b62000ab2620007b1565b925086840151835260408085015188850152818501519150811515821462000ada5760008081fd5b8301528086019190915283529183019160800162000a5e565b60006020828403121562000b0657600080fd5b81516001600160401b038082111562000b1e57600080fd5b90830190610140828603121562000b3457600080fd5b62000b3e620007d6565b82518281111562000b4e57600080fd5b62000b5c878286016200082f565b82525060208301518281111562000b7257600080fd5b62000b80878286016200082f565b60208301525060408301518281111562000b9957600080fd5b62000ba78782860162000903565b60408301525060608301518281111562000bc057600080fd5b62000bce8782860162000903565b60608301525060808301518281111562000be757600080fd5b62000bf58782860162000903565b60808301525060a083015160a082015260c083015160c082015260e083015160e0820152610100808401518381111562000c2e57600080fd5b62000c3c8882870162000981565b828401525050610120808401518381111562000c5757600080fd5b62000c658882870162000a15565b918301919091525095945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141562000cb95762000cb962000c8c565b5060010190565b6000821982111562000cd65762000cd662000c8c565b500190565b600181811c9082168062000cf057607f821691505b6020821081141562000d1257634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05161573462000d8b6000396000818161096b01528181611cc70152818161341b0152818161346201526134a201526000818161061301528181611fa7015281816133c1015281816133f501528181613889015281816138b30152818161463f015261468b01526157346000f3fe6080604052600436106104055760003560e01c806383085d0911610213578063b88d4fde11610123578063db2e21bc116100ab578063e985e9c51161007a578063e985e9c514610c60578063eb8d244414610ca9578063f2fde38b14610cc6578063f6b9782d14610ce6578063fb3cc6c214610d1357600080fd5b8063db2e21bc14610be2578063e110976f14610bf7578063e35bd96b14610c17578063e7d773a014610c4b57600080fd5b8063ce7c2ac2116100f2578063ce7c2ac214610b4b578063d111515d14610b6b578063d2369e0414610b80578063d547741f14610ba2578063d6a6346e14610bc257600080fd5b8063b88d4fde14610ad6578063be52be2e14610af6578063c6ab67a314610b16578063c87b56dd14610b2b57600080fd5b806391d14854116101a65780639d897351116101755780639d89735114610a4c578063a035b1fe14610a6c578063a22cb46514610a81578063a4451df114610aa1578063a475b5dd14610ac157600080fd5b806391d14854146109af57806395d89b41146109f55780639711715a14610a0a5780639babdad614610a2c57600080fd5b80638bb9c5bf116101e25780638bb9c5bf1461091e5780638da5cb5b1461093e5780638f770ad01461095c57806391b7f5ed1461098f57600080fd5b806383085d09146108a957806385f52846146108c9578063871b015a146108dc5780638987470e146108fc57600080fd5b8063327f64f31161031957806355f804b3116102a15780636352211e116102705780636352211e1461080957806370a08231146108295780637572499014610849578063820de0c51461086957806382dc439a1461088957600080fd5b806355f804b31461077d5780635a46cf3d1461079d5780635f74606c146107bd57806360659a92146107f457600080fd5b80633ccfd60b116102e85780633ccfd60b146106f057806342842e0e146107055780634f558e79146107255780634f6ccce714610745578063518302271461076557600080fd5b8063327f64f31461067757806334d2c0a3146106a45780633723bc0e146106b95780633a98ef39146106db57600080fd5b806314ea928a1161039c57806322be83b71161036b57806322be83b7146105c457806323b872dd146105e45780632913daa0146106045780632f2ff15d146106375780632f745c591461065757600080fd5b806314ea928a1461055d57806318160ddd1461057c5780631a729e671461059157806320889d3b146105b157600080fd5b8063095ea7b3116103d8578063095ea7b3146104bb5780630adeeae8146104db57806310355a43146104fb578063109695231461053d57600080fd5b806301ffc9a71461040a57806302c889891461043f57806306fdde0314610461578063081812fc14610483575b600080fd5b34801561041657600080fd5b5061042a610425366004614c25565b610d31565b60405190151581526020015b60405180910390f35b34801561044b57600080fd5b5061045f61045a366004614c50565b610ed5565b005b34801561046d57600080fd5b50610476610fab565b6040516104369190614cc5565b34801561048f57600080fd5b506104a361049e366004614cd8565b61103d565b6040516001600160a01b039091168152602001610436565b3480156104c757600080fd5b5061045f6104d6366004614d06565b611084565b3480156104e757600080fd5b5061045f6104f6366004614d32565b61113b565b34801561050757600080fd5b5061052f7f7c13537556c77ef3fb98601c3356887ddbe5991e86dc065741ce77e1dd2554a381565b604051908152602001610436565b34801561054957600080fd5b5061045f610558366004614e1a565b611278565b34801561056957600080fd5b50600a546301000000900460ff1661042a565b34801561058857600080fd5b5061052f611327565b34801561059d57600080fd5b5061045f6105ac366004614e4e565b611349565b61045f6105bf366004614cd8565b6114df565b3480156105d057600080fd5b5061045f6105df366004614d06565b61156e565b3480156105f057600080fd5b5061045f6105ff366004614eb9565b6115e3565b34801561061057600080fd5b507f000000000000000000000000000000000000000000000000000000000000000061052f565b34801561064357600080fd5b5061045f610652366004614efa565b6115ee565b34801561066357600080fd5b5061052f610672366004614d06565b611631565b34801561068357600080fd5b50610697610692366004614f2a565b611704565b6040516104369190614fe4565b3480156106b057600080fd5b5061045f611804565b3480156106c557600080fd5b506106ce611828565b604051610436919061502a565b3480156106e757600080fd5b5060095461052f565b3480156106fc57600080fd5b5061045f61189d565b34801561071157600080fd5b5061045f610720366004614eb9565b611a87565b34801561073157600080fd5b5061042a610740366004614cd8565b611aa2565b34801561075157600080fd5b5061052f610760366004614cd8565b611aad565b34801561077157600080fd5b50600a5460ff1661042a565b34801561078957600080fd5b5061045f610798366004614e1a565b611b2e565b3480156107a957600080fd5b5061045f6107b8366004614cd8565b611bfe565b3480156107c957600080fd5b506104766040518060400160405280600b81526020016a4164616d2052696368657360a81b81525081565b34801561080057600080fd5b5061052f611cbb565b34801561081557600080fd5b506104a3610824366004614cd8565b611ceb565b34801561083557600080fd5b5061052f610844366004614d32565b611cfd565b34801561085557600080fd5b5061045f610864366004614d06565b611d4b565b34801561087557600080fd5b5061045f610884366004614e1a565b611dc1565b34801561089557600080fd5b5061042a6108a4366004614cd8565b611e92565b3480156108b557600080fd5b5061045f6108c4366004614d32565b611ed3565b61045f6108d7366004614f2a565b611f9a565b3480156108e857600080fd5b5061045f6108f7366004615082565b612051565b34801561090857600080fd5b5061052f6000805160206156df83398151915281565b34801561092a57600080fd5b5061045f610939366004614cd8565b6120ab565b34801561094a57600080fd5b506000546001600160a01b03166104a3565b34801561096857600080fd5b507f000000000000000000000000000000000000000000000000000000000000000061052f565b34801561099b57600080fd5b5061045f6109aa366004614cd8565b6120b5565b3480156109bb57600080fd5b5061042a6109ca366004614efa565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b348015610a0157600080fd5b5061047661213a565b348015610a1657600080fd5b50610a1f612149565b604051610436919061510c565b348015610a3857600080fd5b5061045f610a47366004614d32565b61228c565b348015610a5857600080fd5b5061042a610a67366004614cd8565b61238e565b348015610a7857600080fd5b5060085461052f565b348015610a8d57600080fd5b5061045f610a9c36600461518c565b6123dd565b348015610aad57600080fd5b5061045f610abc366004614d06565b61247d565b348015610acd57600080fd5b5061045f6125da565b348015610ae257600080fd5b5061045f610af13660046151ba565b612663565b348015610b0257600080fd5b5061045f610b1136600461518c565b6126b1565b348015610b2257600080fd5b506104766127b8565b348015610b3757600080fd5b50610476610b46366004614cd8565b6127c7565b348015610b5757600080fd5b5061052f610b66366004614d32565b612a5b565b348015610b7757600080fd5b5061045f612ae8565b348015610b8c57600080fd5b50610b95612b9f565b60405161043691906152a2565b348015610bae57600080fd5b5061045f610bbd366004614efa565b612d95565b348015610bce57600080fd5b5061045f610bdd366004615082565b612db7565b348015610bee57600080fd5b5061045f612e7f565b348015610c0357600080fd5b5061045f610c12366004614eb9565b612f39565b348015610c2357600080fd5b5061052f7ffdd7b2ba629c0a0b84029cda831836222e5708c95d3e782c0762066b472dad0e81565b348015610c5757600080fd5b5061045f613029565b348015610c6c57600080fd5b5061042a610c7b366004615304565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610cb557600080fd5b50600a54610100900460ff1661042a565b348015610cd257600080fd5b5061045f610ce1366004614d32565b6130c0565b348015610cf257600080fd5b50610d06610d01366004614d32565b613108565b6040516104369190615332565b348015610d1f57600080fd5b50600a5462010000900460ff1661042a565b60006001600160e01b0319821663e110976f60e01b1480610d6257506001600160e01b03198216632a2d979f60e01b145b80610d7d57506001600160e01b0319821663f53c966760e01b145b80610d9857506001600160e01b03198216634f558e7960e01b145b80610db357506001600160e01b03198216637d62321d60e01b145b80610dce57506001600160e01b0319821663128009d560e11b145b80610de957506001600160e01b03198216633182441360e01b145b80610e0457506001600160e01b03198216636eba00f560e01b145b80610e1f57506001600160e01b0319821663e945adcd60e01b145b80610e3a57506001600160e01b0319821663780e9d6360e01b145b80610e5457506001600160e01b03198216628d87a360e21b145b80610e6f57506001600160e01b03198216635b5e139f60e01b145b80610e8a57506001600160e01b031982166308f770ad60e41b145b80610ea557506001600160e01b031982166305ba8d5960e41b145b80610ec057506001600160e01b03198216634b8ae87360e01b145b80610ecf5750610ecf8261317f565b92915050565b6000546000805160206156df833981519152906001600160a01b03163314801590610f1a5750600081815260016020908152604080832033845290915290205460ff16155b15610f5257335b60405163122994e360e11b81526001600160a01b039091166004820152602481018290526044015b60405180910390fd5b600a805461ff0019166101008415158102919091179182905560405160ff9190920416151581527f9ea33dbe4d69c7808ed9609b1dedcb7440e12568855e708b8e8b50825e104329906020015b60405180910390a15050565b6060600b8054610fba90615345565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe690615345565b80156110335780601f1061100857610100808354040283529160200191611033565b820191906000526020600020905b81548152906001019060200180831161101657829003601f168201915b5050505050905090565b6000611048826131a4565b6110685760405163c927e5bf60e01b815260048101839052602401610f49565b506000908152600660205260409020546001600160a01b031690565b600061108f82611ceb565b9050806001600160a01b0316836001600160a01b031614156110cd5760405163307134a760e21b815233600482015260248101839052604401610f49565b336001600160a01b038216148015906110ed57506110eb8133610c7b565b155b1561112b5760405163322c2e2960e11b81526001600160a01b0380831660048301528416602482015260448101839052336064820152608401610f49565b6111368383836131de565b505050565b6000546000805160206156df833981519152906001600160a01b031633148015906111805750600081815260016020908152604080832033845290915290205460ff16155b1561118b5733610f21565b6111948261323a565b60145460005b8181101561124f57836001600160a01b0316601482815481106111bf576111bf615380565b6000918252602090912001546001600160a01b0316141561123d576001600160a01b0384166000908152601560205260409020805460ff19169055611203816132a5565b6040516001600160a01b038516907fc8dde7702ada02e3271777e080f36befb2dfe4975ff5a35cdcc61f7116c893d390600090a250505050565b80611247816153ac565b91505061119a565b5060405163a5be5e0f60e01b81526001600160a01b0384166004820152602401610f49565b5050565b6000546000805160206156df833981519152906001600160a01b031633148015906112bd5750600081815260016020908152604080832033845290915290205460ff16155b156112c85733610f21565b6112d0613383565b81516112e390600f906020850190614b1b565b50600f6040516112f391906153c7565b604051908190038120907f8aef9948275592a4a1496813f92b3c13911528c06421256850f9f611e001874090600090a25050565b600061133260035490565b61133a6133ae565b6113449190615463565b905090565b600a5462010000900460ff16156113735760405163b087bbf360e01b815260040160405180910390fd5b6000546000805160206156df833981519152906001600160a01b031633148015906113b85750600081815260016020908152604080832033845290915290205460ff16155b156113c35733610f21565b6113cc856131a4565b6113ec5760405163c927e5bf60e01b815260048101869052602401610f49565b6000858152601060209081526040909120835161140b92850190614b1b565b506000858152601160205260409020805460ff1916851515179055828015611442575060008581526012602052604090205460ff16155b1561148857600085815260126020526040808220805460ff191660011790555186917fafd1af0d18662bc4cbe66cd3885857264bb71d267eb57c0add879e84a5be317791a25b81604051611496919061547a565b60408051918290038220600080845260208401529187917f2a228bf8ab34c4401425e787b89ef2b1cad5e2e93daf585a1e62dd9ce87fcedd910160405180910390a35050505050565b600a54610100900460ff166115075760405163b7b2409760e01b815260040160405180910390fd5b611510816133bf565b8061151a60085490565b6115249190615496565b341461156157348161153560085490565b61153f9190615496565b60405163e763535560e01b815260048101929092526024820152604401610f49565b61156b33826134ce565b50565b6000547ffdd7b2ba629c0a0b84029cda831836222e5708c95d3e782c0762066b472dad0e906001600160a01b031633148015906115c55750600081815260016020908152604080832033845290915290205460ff16155b156115d05733610f21565b6115d9826133bf565b61113683836134ce565b6111368383836134e8565b6000546001600160a01b0316331461162757335b604051630e60d8d360e41b81526001600160a01b039091166004820152602401610f49565b61127482826137c1565b600061163c83611cfd565b82111561166f578161164d84611cfd565b6040516363a056dd60e01b815260048101929092526024820152604401610f49565b60006116796133ae565b90506000805b828110156116ea57611690816131a4565b156116d857856001600160a01b03166116a882613848565b516001600160a01b031614156116d857848214156116ca579250610ecf915050565b816116d4816153ac565b9250505b806116e2816153ac565b91505061167f565b506040516301b2776960e11b815260040160405180910390fd5b606061170f8361323a565b81516000816001600160401b0381111561172b5761172b614d4f565b604051908082528060200260200182016040528015611754578160200160208202803683370190505b50905060005b828110156117fb576001600160a01b038616600090815260166020908152604080832060178352818420548452909152812086519091908790849081106117a3576117a3615380565b6020026020010151815260200190815260200160002060009054906101000a900460ff168282815181106117d9576117d9615380565b91151560209283029190910190910152806117f3816153ac565b91505061175a565b50949350505050565b6000546001600160a01b0316331461181c5733611602565b611826600061394f565b565b60606013805480602002602001604051908101604052809291908181526020016000905b82821015611894576000848152602090819020604080518082019091526002850290910180546001600160a01b0316825260019081015482840152908352909201910161184c565b50505050905090565b6000547f7c13537556c77ef3fb98601c3356887ddbe5991e86dc065741ce77e1dd2554a3906001600160a01b031633148015906118f45750600081815260016020908152604080832033845290915290205460ff16155b156118ff5733610f21565b600954601354479190811580611913575080155b1561193157604051639811e0c760e01b815260040160405180910390fd5b600061193d83856154cb565b905060005b82811015611a3c5760006013828154811061195f5761195f615380565b600091825260208083206040805180820190915260029093020180546001600160a01b031683526001015490820181905290925061199e908590615496565b82516040519192506001600160a01b03169082156108fc029083906000818181858888f193505050501580156119d8573d6000803e3d6000fd5b5081516001600160a01b0316336001600160a01b03167f8957f76027b186a481886d5e1dfef5a49a9b792649df75e9dd5e53cde75c71ea83604051611a1f91815260200190565b60405180910390a350508080611a34906153ac565b915050611942565b5060095433907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d590611a6e9084615496565b6040519081526020015b60405180910390a25050505050565b61113683838360405180602001604052806000815250612663565b6000610ecf826131a4565b6000611ab7611327565b8210611ac6578161164d611327565b600354611ad857610ecf8260016154df565b600080611ae36133ae565b905060005b818110156116ea5784831415611b0057949350505050565b611b09816131a4565b15611b1c5782611b18816153ac565b9350505b80611b26816153ac565b915050611ae8565b600a5462010000900460ff1615611b585760405163b087bbf360e01b815260040160405180910390fd5b6000546000805160206156df833981519152906001600160a01b03163314801590611b9d5750600081815260016020908152604080832033845290915290205460ff16155b15611ba85733610f21565b8151611bbb90600d906020850190614b1b565b5081604051611bca919061547a565b604051908190038120907fafa35f42f46f5052816d7c6a2e9406eca98294b20726677862d83b4a7418d8d590600090a25050565b6000546000805160206156df833981519152906001600160a01b03163314801590611c435750600081815260016020908152604080832033845290915290205460ff16155b15611c4e5733610f21565b611c57826131a4565b611c775760405163c927e5bf60e01b815260048101839052602401610f49565b600082815260126020526040808220805460ff191660011790555183917fafd1af0d18662bc4cbe66cd3885857264bb71d267eb57c0add879e84a5be317791a25050565b6000611cc56133ae565b7f000000000000000000000000000000000000000000000000000000000000000061133a565b6000611cf682613848565b5192915050565b60006001600160a01b038216611d265760405163e99d5ac560e01b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160801b031690565b6000546000805160206156df833981519152906001600160a01b03163314801590611d905750600081815260016020908152604080832033845290915290205460ff16155b15611d9b5733610f21565b6111366040518060400160405280856001600160a01b031681526020018481525061399f565b600a5462010000900460ff1615611deb5760405163b087bbf360e01b815260040160405180910390fd5b6000546000805160206156df833981519152906001600160a01b03163314801590611e305750600081815260016020908152604080832033845290915290205460ff16155b15611e3b5733610f21565b8151611e4e90600e906020850190614b1b565b50600e604051611e5e91906153c7565b604051908190038120907fb6b2b7d0cff2ae8f651bd60fb4eb42b79f6e366900a72af6156ea30044179e8e90600090a25050565b6000611e9d826131a4565b611ebd5760405163c927e5bf60e01b815260048101839052602401610f49565b5060009081526011602052604090205460ff1690565b6000546000805160206156df833981519152906001600160a01b03163314801590611f185750600081815260016020908152604080832033845290915290205460ff16155b15611f235733610f21565b611f2c8261323a565b6001600160a01b0382166000908152601760205260408120805491611f50836153ac565b90915550506001600160a01b038216600081815260186020526040808220829055517ff1d918039d4ced601abd661af27bad3fa7cd09c72e6052e04d27348656f9b7069190a25050565b805180611ff157600060017f00000000000000000000000000000000000000000000000000000000000000005b6040516346f4384b60e01b8152600481019390935260248301919091526044820152606401610f49565b611ffa816133bf565b61200383613b4f565b600061200e84613bda565b51905061201b8282615496565b341461202c573461153f8383615496565b612037338585613c47565b6120418484613e3e565b61204b33836134ce565b50505050565b6000546000805160206156df833981519152906001600160a01b031633148015906120965750600081815260016020908152604080832033845290915290205460ff16155b156120a15733610f21565b6111368383613f59565b61156b81336140b4565b6000546000805160206156df833981519152906001600160a01b031633148015906120fa5750600081815260016020908152604080832033845290915290205460ff16155b156121055733610f21565b60088290556040518281527fa6dc15bdb68da224c66db4b3838d9a2b205138e8cff6774e57d0af91e196d62290602001610f9f565b6060600c8054610fba90615345565b606060006121556133ae565b90506000816001600160401b0381111561217157612171614d4f565b6040519080825280602002602001820160405280156121bc57816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161218f5790505b50905060015b828111612285576121d2816131a4565b1561222e5760408051606081018252828152600060208201529081016121f783611ceb565b6001600160a01b031690528261220e600184615463565b8151811061221e5761221e615380565b6020026020010181905250612273565b604080516060810190915281815260208101600181523060209091015282612257600184615463565b8151811061226757612267615380565b60200260200101819052505b8061227d816153ac565b9150506121c2565b5092915050565b6000546000805160206156df833981519152906001600160a01b031633148015906122d15750600081815260016020908152604080832033845290915290205460ff16155b156122dc5733610f21565b6001600160a01b0382166123035760405163e99d5ac560e01b815260040160405180910390fd5b60135460005b8181101561236957836001600160a01b03166013828154811061232e5761232e615380565b60009182526020909120600290910201546001600160a01b031614156123575761204b81614137565b80612361816153ac565b915050612309565b506040516354a932f560e01b81526001600160a01b0384166004820152602401610f49565b6000612399826131a4565b6123b95760405163c927e5bf60e01b815260048101839052602401610f49565b60008281526012602052604090205460ff1680610ecf5750600a5460ff1692915050565b6001600160a01b038216331415612411576040516372b3985f60e01b81523360048201528115156024820152604401610f49565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000546000805160206156df833981519152906001600160a01b031633148015906124c25750600081815260016020908152604080832033845290915290205460ff16155b156124cd5733610f21565b6001600160a01b0383166124f45760405163e99d5ac560e01b815260040160405180910390fd5b60135460005b818110156125b557846001600160a01b03166013828154811061251f5761251f615380565b60009182526020909120600290910201546001600160a01b031614156125a357836013828154811061255357612553615380565b906000526020600020906002020160010181905550846001600160a01b03167f06945c82029753372decfeace485696553ab08354f682b4fa8e08d277e25498585604051611a7891815260200190565b806125ad816153ac565b9150506124fa565b506040516354a932f560e01b81526001600160a01b0385166004820152602401610f49565b6000546000805160206156df833981519152906001600160a01b0316331480159061261f5750600081815260016020908152604080832033845290915290205460ff16155b1561262a5733610f21565b600a805460ff191660011790556040517fe2a7169cedebe39671840370ae19ca4fc41be6191d4c77f174f189a4d8cd08c890600090a150565b61266e8484846134e8565b61267a848484846142bd565b61204b5760405163a371886b60e01b81526001600160a01b0380861660048301528416602482015260448101839052606401610f49565b6000546000805160206156df833981519152906001600160a01b031633148015906126f65750600081815260016020908152604080832033845290915290205460ff16155b156127015733610f21565b61270a8361323a565b6001600160a01b03831660009081526019602052604090206002015460ff16151582151514611136576001600160a01b0383166000818152601960205260409081902060028101805486151560ff1990911617905590517f0e26d8e2549574e8d6493ef972ea195acde7d56ff6b7a7114978c2b5edf9ea8e916127ab91815481526001820154602082015260029091015460ff161515604082015260600190565b60405180910390a2505050565b6060600f8054610fba90615345565b60606127d2826131a4565b6127f25760405163c927e5bf60e01b815260048101839052602401610f49565b6000828152601060205260408120805461280b90615345565b80601f016020809104026020016040519081016040528092919081815260200182805461283790615345565b80156128845780601f1061285957610100808354040283529160200191612884565b820191906000526020600020905b81548152906001019060200180831161286757829003601f168201915b505050505090506000600d805461289a90615345565b80601f01602080910402602001604051908101604052809291908181526020018280546128c690615345565b80156129135780601f106128e857610100808354040283529160200191612913565b820191906000526020600020905b8154815290600101906020018083116128f657829003601f168201915b5050600a54939450505060ff9091161590508015612940575060008481526012602052604090205460ff16155b156129d957600e805461295290615345565b80601f016020809104026020016040519081016040528092919081815260200182805461297e90615345565b80156129cb5780601f106129a0576101008083540402835291602001916129cb565b820191906000526020600020905b8154815290600101906020018083116129ae57829003601f168201915b505050505092505050919050565b815115612a295760008481526011602052604090205460ff16156129fe575092915050565b8082604051602001612a119291906154f7565b60405160208183030381529060405292505050919050565b6000600d8054612a3890615345565b905011156122855780612a4a856143c8565b604051602001612a119291906154f7565b601354600090815b8181101561236957836001600160a01b031660138281548110612a8857612a88615380565b60009182526020909120600290910201546001600160a01b03161415612ad65760138181548110612abb57612abb615380565b90600052602060002090600202016001015492505050919050565b80612ae0816153ac565b915050612a63565b600a5462010000900460ff1615612b125760405163b087bbf360e01b815260040160405180910390fd5b6000546000805160206156df833981519152906001600160a01b03163314801590612b575750600081815260016020908152604080832033845290915290205460ff16155b15612b625733610f21565b600a805462ff00001916620100001790556040517feef043febddf4e1d1cf1f72ff1407b84e036e805aa0934418cb82095da8d716490600090a150565b60148054604080516020808402820181019092528281526060936000928490830182828015612bf757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612bd9575b505050505090506000826001600160401b03811115612c1857612c18614d4f565b604051908082528060200260200182016040528015612c5157816020015b612c3e614b9f565b815260200190600190039081612c365790505b50905060005b83811015612d8d576000838281518110612c7357612c73615380565b602002602001015190506040518060a00160405280826001600160a01b03168152602001612ca0836144c5565b8152602001612cae8361453e565b815260200160186000878681518110612cc957612cc9615380565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054815260200160196000878681518110612d0d57612d0d615380565b6020908102919091018101516001600160a01b031682528181019290925260409081016000208151606081018352815481526001820154938101939093526002015460ff1615159082015290528351849084908110612d6e57612d6e615380565b6020026020010181905250508080612d85906153ac565b915050612c57565b509392505050565b6000546001600160a01b03163314612dad5733611602565b61127482826140b4565b6000546000805160206156df833981519152906001600160a01b03163314801590612dfc5750600081815260016020908152604080832033845290915290205460ff16155b15612e075733610f21565b612e108361323a565b6001600160a01b03831660008181526019602090815260409182902085518155908501516001820155848201516002909101805460ff1916911515919091179055517f0e26d8e2549574e8d6493ef972ea195acde7d56ff6b7a7114978c2b5edf9ea8e906127ab908590615526565b6000546000805160206156df833981519152906001600160a01b03163314801590612ec45750600081815260016020908152604080832033845290915290205460ff16155b15612ecf5733610f21565b6040514790339082156108fc029083906000818181858888f19350505050158015612efe573d6000803e3d6000fd5b5060405181815233907f2e39961a70a10f4d46383948095ac2752b3ee642a7c76aa827410aaff08c2e51906020015b60405180910390a25050565b6000547f7c13537556c77ef3fb98601c3356887ddbe5991e86dc065741ce77e1dd2554a3906001600160a01b03163314801590612f905750600081815260016020908152604080832033845290915290205460ff16155b15612f9b5733610f21565b6001600160a01b038316612fc25760405163e99d5ac560e01b815260040160405180910390fd5b612fd66001600160a01b038516848461459c565b826001600160a01b0316846001600160a01b03167f401f439d865a766757ec78675925bd67198d5e78805aa41691b34b5d6a6cbbe68460405161301b91815260200190565b60405180910390a350505050565b6000546000805160206156df833981519152906001600160a01b0316331480159061306e5750600081815260016020908152604080832033845290915290205460ff16155b156130795733610f21565b613081613383565b600a805463ff000000191663010000001790556040517f294f0756ade420332ef086187515f4a3af6e693dfe5ca7e10990f5d61bf06dd390600090a150565b6000546001600160a01b031633146130d85733611602565b6001600160a01b0381166130ff5760405163e99d5ac560e01b815260040160405180910390fd5b61156b8161394f565b613110614b9f565b6131198261323a565b6040518060a00160405280836001600160a01b0316815260200161313c846144c5565b815260200161314a8461453e565b81526001600160a01b03841660009081526018602090815260409182902054908301520161317784613bda565b905292915050565b60006001600160e01b03198216634b88b8ad60e11b1480610ecf5750610ecf826145ee565b600080821180156131b6575060025482105b8015610ecf57506000828152600460205260409020546001600160a01b031630141592915050565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6001600160a01b0381166132615760405163e99d5ac560e01b815260040160405180910390fd5b6001600160a01b03811660009081526015602052604090205460ff1661156b5760405163a5be5e0f60e01b81526001600160a01b0382166004820152602401610f49565b6014548082106132b3575050565b815b6132c0600183615463565b81101561334b5760146132d48260016154df565b815481106132e4576132e4615380565b600091825260209091200154601480546001600160a01b03909216918390811061331057613310615380565b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905580613343816153ac565b9150506132b5565b50601480548061335d5761335d615549565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b600a546301000000900460ff161561182657604051632edca92560e01b815260040160405180910390fd5b600060016002546113449190615463565b7f00000000000000000000000000000000000000000000000000000000000000008111806133eb575080155b15613419578060017f0000000000000000000000000000000000000000000000000000000000000000611fc7565b7f0000000000000000000000000000000000000000000000000000000000000000816134436133ae565b61344d91906154df565b111561156b578061345c6133ae565b613486907f0000000000000000000000000000000000000000000000000000000000000000615463565b6040516302d95a3b60e11b8152600481019290925260248201527f00000000000000000000000000000000000000000000000000000000000000006044820152606401610f49565b611274828260405180602001604052806000815250614613565b6001600160a01b03821661350f5760405163e99d5ac560e01b815260040160405180910390fd5b600061351a82613848565b9050836001600160a01b031681600001516001600160a01b03161461358057335b815160405163753e1c4f60e11b81526001600160a01b03928316600482015282871660248201528286166044820152606481018590529116608482015260a401610f49565b80516001600160a01b0316336001600160a01b0316141580156135b45750336135a88361103d565b6001600160a01b031614155b80156135c9575080516135c79033610c7b565b155b156135d4573361353b565b6135e460008383600001516131de565b6001600160a01b03841660009081526005602052604081208054600192906136169084906001600160801b031661555f565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0385166000908152600560205260408120805460019450909261366291859116615587565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b0380861682526001600160401b03428116602080850191825260008881526004909152948520935184549151909216600160a01b026001600160e01b031990911691909216171790556136e98360016154df565b6000818152600460205260409020549091506001600160a01b031661377857613711816131a4565b156137785760408051808201825283516001600160a01b0390811682526020808601516001600160401b039081168285019081526000878152600490935294909120925183549451909116600160a01b026001600160e01b03199094169116179190911790555b82846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff166112745760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6040805180820190915260008082526020820152613865826131a4565b6138855760405163c927e5bf60e01b815260048101839052602401610f49565b60007f000000000000000000000000000000000000000000000000000000000000000083106138e6576138d87f000000000000000000000000000000000000000000000000000000000000000084615463565b6138e39060016154df565b90505b825b8181106116ea576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b9091046001600160401b0316918301919091521561393c57949350505050565b5080613947816155a9565b9150506138e8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60208101516139c157604051639811e0c760e01b815260040160405180910390fd5b80516001600160a01b03166139e95760405163e99d5ac560e01b815260040160405180910390fd5b60135460005b81811015613a715782600001516001600160a01b031660138281548110613a1857613a18615380565b60009182526020909120600290910201546001600160a01b03161415613a5f5782516040516370d2049160e01b81526001600160a01b039091166004820152602401610f49565b80613a69816153ac565b9150506139ef565b5060138054600181018255600091825283517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a090600290920291820180546001600160a01b0319166001600160a01b0390921691909117905560208401517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0919091018190556009805491929091613b089084906154df565b909155505081516020808401516040519081526001600160a01b03909216917f3bc19114ca6a687ffd9445c87615db284e96364365d72b010ec53244b45e561b9101612f2d565b6001600160a01b03811660009081526015602052604090205460ff16613b935760405163a5be5e0f60e01b81526001600160a01b0382166004820152602401610f49565b6001600160a01b03811660009081526019602052604090206002015460ff1661156b57604051637a08c0fb60e11b81526001600160a01b0382166004820152602401610f49565b613c00604051806060016040528060008152602001600081526020016000151581525090565b506001600160a01b03166000908152601960209081526040918290208251606081018452815481526001820154928101929092526002015460ff1615159181019190915290565b80516001600160a01b038316600090815260196020908152604080832060010154601890925290912054613c7c9083906154df565b1115613cc1576001600160a01b03831660008181526019602052604090819020600101549051635ca6c35960e01b815260048101929092526024820152604401610f49565b60005b818110156137ba576000838281518110613ce057613ce0615380565b60200260200101519050846001600160a01b0316636352211e826040518263ffffffff1660e01b8152600401613d1891815260200190565b602060405180830381865afa925050508015613d51575060408051601f3d908101601f19168201909252613d4e918101906155c0565b60015b613d80576040516302682da560e41b81526001600160a01b038616600482015260248101829052604401610f49565b866001600160a01b0316816001600160a01b031614613dc4576040516302682da560e41b81526001600160a01b038716600482015260248101839052604401610f49565b506001600160a01b038516600090815260166020908152604080832060178352818420548452825280832084845290915290205460ff1615613e2b5760405163cf3571af60e01b81526001600160a01b038616600482015260248101829052604401610f49565b5080613e36816153ac565b915050613cc4565b805160005b81811015613f26576001600160a01b0384166000908152601660209081526040808320601783528184205484529091528120845160019290869085908110613e8d57613e8d615380565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550828181518110613ecc57613ecc615380565b6020026020010151846001600160a01b0316336001600160a01b03167f728e641386299b5070162250083c0abc8f1d93cd543b23eaed63336575ca994c60405160405180910390a480613f1e816153ac565b915050613e43565b506001600160a01b03831660009081526018602052604081208054839290613f4f9084906154df565b9091555050505050565b6001600160a01b038216613f805760405163e99d5ac560e01b815260040160405180910390fd5b6001600160a01b03821660009081526015602052604090205460ff1615613fc5576040516354d67cef60e01b81526001600160a01b0383166004820152602401610f49565b6001600160a01b0382166000908152601560209081526040808320805460ff1916600117905560179091528120805491613ffe836153ac565b90915550506001600160a01b03821660008181526019602090815260408083208551815591850151600180840191909155858201516002909301805460ff1916931515939093179092556014805492830181559092527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec0180546001600160a01b03191683179055517fab109b1e3dd4bf279798315182b336f138e930aec9aaeafe98f768450d9fd9b790612f2d908490615526565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16156112745760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60138054906000908383811061414f5761414f615380565b60009182526020918290206040805180820190915260029092020180546001600160a01b0316825260010154918101919091529050825b614191600184615463565b8110156142205760136141a58260016154df565b815481106141b5576141b5615380565b9060005260206000209060020201601382815481106141d6576141d6615380565b60009182526020909120825460029092020180546001600160a01b0319166001600160a01b0390921691909117815560019182015491015580614218816153ac565b915050614186565b50601380548061423257614232615549565b6000828152602080822060026000199094019384020180546001600160a01b0319168155600101829055919092558201516009805491929091614276908490615463565b909155505080516020808301516040519081526001600160a01b03909216917f775539f018602cb5533761287430a74c8cc49b559ee2fbcd32e086789206382a91016127ab565b60006001600160a01b0384163b156143bc57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906143019033908990889088906004016155dd565b6020604051808303816000875af192505050801561433c575060408051601f3d908101601f191682019092526143399181019061561a565b60015b6143a2573d80801561436a576040519150601f19603f3d011682016040523d82523d6000602084013e61436f565b606091505b50805161439a57604051634e1cb28960e11b81526001600160a01b0386166004820152602401610f49565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506143c0565b5060015b949350505050565b6060816143ec5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156144165780614400816153ac565b915061440f9050600a836154cb565b91506143f0565b6000816001600160401b0381111561443057614430614d4f565b6040519080825280601f01601f19166020018201604052801561445a576020820181803683370190505b5090505b84156143c05761446f600183615463565b915061447c600a86615637565b6144879060306154df565b60f81b81838151811061449c5761449c615380565b60200101906001600160f81b031916908160001a9053506144be600a866154cb565b945061445e565b6060816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561452657506040513d6000823e601f3d908101601f19168201604052614523919081019061564b565b60015b610ecf57505060408051602081019091526000815290565b6060816001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561452657506040513d6000823e601f3d908101601f19168201604052614523919081019061564b565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611136908490614875565b60006001600160e01b031982166380ac58cd60e01b1480610ecf5750610ecf82614947565b6002546001600160a01b03841661463d5760405163e99d5ac560e01b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000831180614669575082155b156146b7576040516346f4384b60e01b815260048101849052600160248201527f00000000000000000000000000000000000000000000000000000000000000006044820152606401610f49565b6001600160a01b0384166000908152600560209081526040918290208251808401845290546001600160801b038082168352600160801b9091041691810191909152815180830190925280519091908190614713908790615587565b6001600160801b031681526020018583602001516147319190615587565b6001600160801b039081169091526001600160a01b0380881660008181526005602090815260408083208751978301518716600160801b029790961696909617909455845180860186529182526001600160401b034281168386019081528883526004909552948120915182549451909516600160a01b026001600160e01b031990941694909216939093179190911790915582905b8581101561486a5760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a461481460008884886142bd565b61484a5760405163a371886b60e01b8152600060048201526001600160a01b038816602482015260448101839052606401610f49565b81614854816153ac565b9250508080614862906153ac565b9150506147c7565b506002555050505050565b60006148ca826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661496c9092919063ffffffff16565b80519091501561113657808060200190518101906148e891906156c1565b6111365760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610f49565b60006001600160e01b0319821663e00008a960e01b1480610ecf5750610ecf82614985565b606061497b84846000856149ba565b90505b9392505050565b60006001600160e01b03198216634b8ae87360e01b1480610ecf57506301ffc9a760e01b6001600160e01b0319831614610ecf565b606082471015614a1b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610f49565b843b614a695760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f49565b600080866001600160a01b03168587604051614a85919061547a565b60006040518083038185875af1925050503d8060008114614ac2576040519150601f19603f3d011682016040523d82523d6000602084013e614ac7565b606091505b5091509150614ad7828286614ae2565b979650505050505050565b60608315614af157508161497e565b825115614b015782518084602001fd5b8160405162461bcd60e51b8152600401610f499190614cc5565b828054614b2790615345565b90600052602060002090601f016020900481019282614b495760008555614b8f565b82601f10614b6257805160ff1916838001178555614b8f565b82800160010185558215614b8f579182015b82811115614b8f578251825591602001919060010190614b74565b50614b9b929150614bfa565b5090565b6040518060a0016040528060006001600160a01b03168152602001606081526020016060815260200160008152602001614bf5604051806060016040528060008152602001600081526020016000151581525090565b905290565b5b80821115614b9b5760008155600101614bfb565b6001600160e01b03198116811461156b57600080fd5b600060208284031215614c3757600080fd5b813561497e81614c0f565b801515811461156b57600080fd5b600060208284031215614c6257600080fd5b813561497e81614c42565b60005b83811015614c88578181015183820152602001614c70565b8381111561204b5750506000910152565b60008151808452614cb1816020860160208601614c6d565b601f01601f19169290920160200192915050565b60208152600061497e6020830184614c99565b600060208284031215614cea57600080fd5b5035919050565b6001600160a01b038116811461156b57600080fd5b60008060408385031215614d1957600080fd5b8235614d2481614cf1565b946020939093013593505050565b600060208284031215614d4457600080fd5b813561497e81614cf1565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614d8d57614d8d614d4f565b604052919050565b60006001600160401b03821115614dae57614dae614d4f565b50601f01601f191660200190565b6000614dcf614dca84614d95565b614d65565b9050828152838383011115614de357600080fd5b828260208301376000602084830101529392505050565b600082601f830112614e0b57600080fd5b61497e83833560208501614dbc565b600060208284031215614e2c57600080fd5b81356001600160401b03811115614e4257600080fd5b6143c084828501614dfa565b60008060008060808587031215614e6457600080fd5b843593506020850135614e7681614c42565b92506040850135614e8681614c42565b915060608501356001600160401b03811115614ea157600080fd5b614ead87828801614dfa565b91505092959194509250565b600080600060608486031215614ece57600080fd5b8335614ed981614cf1565b92506020840135614ee981614cf1565b929592945050506040919091013590565b60008060408385031215614f0d57600080fd5b823591506020830135614f1f81614cf1565b809150509250929050565b60008060408385031215614f3d57600080fd5b8235614f4881614cf1565b91506020838101356001600160401b0380821115614f6557600080fd5b818601915086601f830112614f7957600080fd5b813581811115614f8b57614f8b614d4f565b8060051b9150614f9c848301614d65565b8181529183018401918481019089841115614fb657600080fd5b938501935b83851015614fd457843582529385019390850190614fbb565b8096505050505050509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561501e578351151583529284019291840191600101615000565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b8281101561507557815180516001600160a01b03168552860151868501529284019290850190600101615047565b5091979650505050505050565b600080828403608081121561509657600080fd5b83356150a181614cf1565b92506060601f19820112156150b557600080fd5b50604051606081018181106001600160401b03821117156150d8576150d8614d4f565b8060405250602084013581526040840135602082015260608401356150fc81614c42565b6040820152919491935090915050565b60208082528251828201819052600091906040908185019086840185805b8381101561517e57825180518652878101516002811061515857634e487b7160e01b84526021600452602484fd5b868901528601516001600160a01b0316868601526060909401939186019160010161512a565b509298975050505050505050565b6000806040838503121561519f57600080fd5b82356151aa81614cf1565b91506020830135614f1f81614c42565b600080600080608085870312156151d057600080fd5b84356151db81614cf1565b935060208501356151eb81614cf1565b92506040850135915060608501356001600160401b0381111561520d57600080fd5b8501601f8101871361521e57600080fd5b614ead87823560208401614dbc565b60018060a01b0381511682526000602082015160e0602085015261525460e0850182614c99565b90506040830151848203604086015261526d8282614c99565b915050606083015160608501526080830151612d8d608086018280518252602080820151908301526040908101511515910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156152f757603f198886030184526152e585835161522d565b945092850192908501906001016152c9565b5092979650505050505050565b6000806040838503121561531757600080fd5b823561532281614cf1565b91506020830135614f1f81614cf1565b60208152600061497e602083018461522d565b600181811c9082168061535957607f821691505b6020821081141561537a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156153c0576153c0615396565b5060010190565b600080835481600182811c9150808316806153e357607f831692505b602080841082141561540357634e487b7160e01b86526022600452602486fd5b818015615417576001811461542857615455565b60ff19861689528489019650615455565b60008a81526020902060005b8681101561544d5781548b820152908501908301615434565b505084890196505b509498975050505050505050565b60008282101561547557615475615396565b500390565b6000825161548c818460208701614c6d565b9190910192915050565b60008160001904831182151516156154b0576154b0615396565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826154da576154da6154b5565b500490565b600082198211156154f2576154f2615396565b500190565b60008351615509818460208801614c6d565b83519083019061551d818360208801614c6d565b01949350505050565b815181526020808301519082015260408083015115159082015260608101610ecf565b634e487b7160e01b600052603160045260246000fd5b60006001600160801b038381169083168181101561557f5761557f615396565b039392505050565b60006001600160801b0380831681851680830382111561551d5761551d615396565b6000816155b8576155b8615396565b506000190190565b6000602082840312156155d257600080fd5b815161497e81614cf1565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061561090830184614c99565b9695505050505050565b60006020828403121561562c57600080fd5b815161497e81614c0f565b600082615646576156466154b5565b500690565b60006020828403121561565d57600080fd5b81516001600160401b0381111561567357600080fd5b8201601f8101841361568457600080fd5b8051615692614dca82614d95565b8181528560208385010111156156a757600080fd5b6156b8826020830160208601614c6d565b95945050505050565b6000602082840312156156d357600080fd5b815161497e81614c4256fe7e69b879a040173b938f56bb64bfa62bcd758c08ae6ed7cfdf7da6d7dba92708a264697066735822122008e48a99b1101002ec49a84dc6e82e4624ba8287df5e2e39615c1fd678ff1aae64736f6c634300080b003300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000011c37937e08000000000000000000000000000000000000000000000000000000000000000002da000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000134164616d205269636865732047656e65736973000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003415247000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad00000000000000000000000000000000000000000000000000000000000000010000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad00000000000000000000000000000000000000000000000000000000000000010000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5651a4a8c4ce095f56558a08a1fd1defd2fc6b7000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000310b3bd4d1db6d144c00f11d59d1261630e8698a000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f7cf6747c81829585f18e8021d267fd4866e518900000000000000000000000000000000000000000000000000470de4df82000000000000000000000000000000000000000000000000000000000000000000960000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106104055760003560e01c806383085d0911610213578063b88d4fde11610123578063db2e21bc116100ab578063e985e9c51161007a578063e985e9c514610c60578063eb8d244414610ca9578063f2fde38b14610cc6578063f6b9782d14610ce6578063fb3cc6c214610d1357600080fd5b8063db2e21bc14610be2578063e110976f14610bf7578063e35bd96b14610c17578063e7d773a014610c4b57600080fd5b8063ce7c2ac2116100f2578063ce7c2ac214610b4b578063d111515d14610b6b578063d2369e0414610b80578063d547741f14610ba2578063d6a6346e14610bc257600080fd5b8063b88d4fde14610ad6578063be52be2e14610af6578063c6ab67a314610b16578063c87b56dd14610b2b57600080fd5b806391d14854116101a65780639d897351116101755780639d89735114610a4c578063a035b1fe14610a6c578063a22cb46514610a81578063a4451df114610aa1578063a475b5dd14610ac157600080fd5b806391d14854146109af57806395d89b41146109f55780639711715a14610a0a5780639babdad614610a2c57600080fd5b80638bb9c5bf116101e25780638bb9c5bf1461091e5780638da5cb5b1461093e5780638f770ad01461095c57806391b7f5ed1461098f57600080fd5b806383085d09146108a957806385f52846146108c9578063871b015a146108dc5780638987470e146108fc57600080fd5b8063327f64f31161031957806355f804b3116102a15780636352211e116102705780636352211e1461080957806370a08231146108295780637572499014610849578063820de0c51461086957806382dc439a1461088957600080fd5b806355f804b31461077d5780635a46cf3d1461079d5780635f74606c146107bd57806360659a92146107f457600080fd5b80633ccfd60b116102e85780633ccfd60b146106f057806342842e0e146107055780634f558e79146107255780634f6ccce714610745578063518302271461076557600080fd5b8063327f64f31461067757806334d2c0a3146106a45780633723bc0e146106b95780633a98ef39146106db57600080fd5b806314ea928a1161039c57806322be83b71161036b57806322be83b7146105c457806323b872dd146105e45780632913daa0146106045780632f2ff15d146106375780632f745c591461065757600080fd5b806314ea928a1461055d57806318160ddd1461057c5780631a729e671461059157806320889d3b146105b157600080fd5b8063095ea7b3116103d8578063095ea7b3146104bb5780630adeeae8146104db57806310355a43146104fb578063109695231461053d57600080fd5b806301ffc9a71461040a57806302c889891461043f57806306fdde0314610461578063081812fc14610483575b600080fd5b34801561041657600080fd5b5061042a610425366004614c25565b610d31565b60405190151581526020015b60405180910390f35b34801561044b57600080fd5b5061045f61045a366004614c50565b610ed5565b005b34801561046d57600080fd5b50610476610fab565b6040516104369190614cc5565b34801561048f57600080fd5b506104a361049e366004614cd8565b61103d565b6040516001600160a01b039091168152602001610436565b3480156104c757600080fd5b5061045f6104d6366004614d06565b611084565b3480156104e757600080fd5b5061045f6104f6366004614d32565b61113b565b34801561050757600080fd5b5061052f7f7c13537556c77ef3fb98601c3356887ddbe5991e86dc065741ce77e1dd2554a381565b604051908152602001610436565b34801561054957600080fd5b5061045f610558366004614e1a565b611278565b34801561056957600080fd5b50600a546301000000900460ff1661042a565b34801561058857600080fd5b5061052f611327565b34801561059d57600080fd5b5061045f6105ac366004614e4e565b611349565b61045f6105bf366004614cd8565b6114df565b3480156105d057600080fd5b5061045f6105df366004614d06565b61156e565b3480156105f057600080fd5b5061045f6105ff366004614eb9565b6115e3565b34801561061057600080fd5b507f000000000000000000000000000000000000000000000000000000000000000a61052f565b34801561064357600080fd5b5061045f610652366004614efa565b6115ee565b34801561066357600080fd5b5061052f610672366004614d06565b611631565b34801561068357600080fd5b50610697610692366004614f2a565b611704565b6040516104369190614fe4565b3480156106b057600080fd5b5061045f611804565b3480156106c557600080fd5b506106ce611828565b604051610436919061502a565b3480156106e757600080fd5b5060095461052f565b3480156106fc57600080fd5b5061045f61189d565b34801561071157600080fd5b5061045f610720366004614eb9565b611a87565b34801561073157600080fd5b5061042a610740366004614cd8565b611aa2565b34801561075157600080fd5b5061052f610760366004614cd8565b611aad565b34801561077157600080fd5b50600a5460ff1661042a565b34801561078957600080fd5b5061045f610798366004614e1a565b611b2e565b3480156107a957600080fd5b5061045f6107b8366004614cd8565b611bfe565b3480156107c957600080fd5b506104766040518060400160405280600b81526020016a4164616d2052696368657360a81b81525081565b34801561080057600080fd5b5061052f611cbb565b34801561081557600080fd5b506104a3610824366004614cd8565b611ceb565b34801561083557600080fd5b5061052f610844366004614d32565b611cfd565b34801561085557600080fd5b5061045f610864366004614d06565b611d4b565b34801561087557600080fd5b5061045f610884366004614e1a565b611dc1565b34801561089557600080fd5b5061042a6108a4366004614cd8565b611e92565b3480156108b557600080fd5b5061045f6108c4366004614d32565b611ed3565b61045f6108d7366004614f2a565b611f9a565b3480156108e857600080fd5b5061045f6108f7366004615082565b612051565b34801561090857600080fd5b5061052f6000805160206156df83398151915281565b34801561092a57600080fd5b5061045f610939366004614cd8565b6120ab565b34801561094a57600080fd5b506000546001600160a01b03166104a3565b34801561096857600080fd5b507f00000000000000000000000000000000000000000000000000000000000002da61052f565b34801561099b57600080fd5b5061045f6109aa366004614cd8565b6120b5565b3480156109bb57600080fd5b5061042a6109ca366004614efa565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b348015610a0157600080fd5b5061047661213a565b348015610a1657600080fd5b50610a1f612149565b604051610436919061510c565b348015610a3857600080fd5b5061045f610a47366004614d32565b61228c565b348015610a5857600080fd5b5061042a610a67366004614cd8565b61238e565b348015610a7857600080fd5b5060085461052f565b348015610a8d57600080fd5b5061045f610a9c36600461518c565b6123dd565b348015610aad57600080fd5b5061045f610abc366004614d06565b61247d565b348015610acd57600080fd5b5061045f6125da565b348015610ae257600080fd5b5061045f610af13660046151ba565b612663565b348015610b0257600080fd5b5061045f610b1136600461518c565b6126b1565b348015610b2257600080fd5b506104766127b8565b348015610b3757600080fd5b50610476610b46366004614cd8565b6127c7565b348015610b5757600080fd5b5061052f610b66366004614d32565b612a5b565b348015610b7757600080fd5b5061045f612ae8565b348015610b8c57600080fd5b50610b95612b9f565b60405161043691906152a2565b348015610bae57600080fd5b5061045f610bbd366004614efa565b612d95565b348015610bce57600080fd5b5061045f610bdd366004615082565b612db7565b348015610bee57600080fd5b5061045f612e7f565b348015610c0357600080fd5b5061045f610c12366004614eb9565b612f39565b348015610c2357600080fd5b5061052f7ffdd7b2ba629c0a0b84029cda831836222e5708c95d3e782c0762066b472dad0e81565b348015610c5757600080fd5b5061045f613029565b348015610c6c57600080fd5b5061042a610c7b366004615304565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610cb557600080fd5b50600a54610100900460ff1661042a565b348015610cd257600080fd5b5061045f610ce1366004614d32565b6130c0565b348015610cf257600080fd5b50610d06610d01366004614d32565b613108565b6040516104369190615332565b348015610d1f57600080fd5b50600a5462010000900460ff1661042a565b60006001600160e01b0319821663e110976f60e01b1480610d6257506001600160e01b03198216632a2d979f60e01b145b80610d7d57506001600160e01b0319821663f53c966760e01b145b80610d9857506001600160e01b03198216634f558e7960e01b145b80610db357506001600160e01b03198216637d62321d60e01b145b80610dce57506001600160e01b0319821663128009d560e11b145b80610de957506001600160e01b03198216633182441360e01b145b80610e0457506001600160e01b03198216636eba00f560e01b145b80610e1f57506001600160e01b0319821663e945adcd60e01b145b80610e3a57506001600160e01b0319821663780e9d6360e01b145b80610e5457506001600160e01b03198216628d87a360e21b145b80610e6f57506001600160e01b03198216635b5e139f60e01b145b80610e8a57506001600160e01b031982166308f770ad60e41b145b80610ea557506001600160e01b031982166305ba8d5960e41b145b80610ec057506001600160e01b03198216634b8ae87360e01b145b80610ecf5750610ecf8261317f565b92915050565b6000546000805160206156df833981519152906001600160a01b03163314801590610f1a5750600081815260016020908152604080832033845290915290205460ff16155b15610f5257335b60405163122994e360e11b81526001600160a01b039091166004820152602481018290526044015b60405180910390fd5b600a805461ff0019166101008415158102919091179182905560405160ff9190920416151581527f9ea33dbe4d69c7808ed9609b1dedcb7440e12568855e708b8e8b50825e104329906020015b60405180910390a15050565b6060600b8054610fba90615345565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe690615345565b80156110335780601f1061100857610100808354040283529160200191611033565b820191906000526020600020905b81548152906001019060200180831161101657829003601f168201915b5050505050905090565b6000611048826131a4565b6110685760405163c927e5bf60e01b815260048101839052602401610f49565b506000908152600660205260409020546001600160a01b031690565b600061108f82611ceb565b9050806001600160a01b0316836001600160a01b031614156110cd5760405163307134a760e21b815233600482015260248101839052604401610f49565b336001600160a01b038216148015906110ed57506110eb8133610c7b565b155b1561112b5760405163322c2e2960e11b81526001600160a01b0380831660048301528416602482015260448101839052336064820152608401610f49565b6111368383836131de565b505050565b6000546000805160206156df833981519152906001600160a01b031633148015906111805750600081815260016020908152604080832033845290915290205460ff16155b1561118b5733610f21565b6111948261323a565b60145460005b8181101561124f57836001600160a01b0316601482815481106111bf576111bf615380565b6000918252602090912001546001600160a01b0316141561123d576001600160a01b0384166000908152601560205260409020805460ff19169055611203816132a5565b6040516001600160a01b038516907fc8dde7702ada02e3271777e080f36befb2dfe4975ff5a35cdcc61f7116c893d390600090a250505050565b80611247816153ac565b91505061119a565b5060405163a5be5e0f60e01b81526001600160a01b0384166004820152602401610f49565b5050565b6000546000805160206156df833981519152906001600160a01b031633148015906112bd5750600081815260016020908152604080832033845290915290205460ff16155b156112c85733610f21565b6112d0613383565b81516112e390600f906020850190614b1b565b50600f6040516112f391906153c7565b604051908190038120907f8aef9948275592a4a1496813f92b3c13911528c06421256850f9f611e001874090600090a25050565b600061133260035490565b61133a6133ae565b6113449190615463565b905090565b600a5462010000900460ff16156113735760405163b087bbf360e01b815260040160405180910390fd5b6000546000805160206156df833981519152906001600160a01b031633148015906113b85750600081815260016020908152604080832033845290915290205460ff16155b156113c35733610f21565b6113cc856131a4565b6113ec5760405163c927e5bf60e01b815260048101869052602401610f49565b6000858152601060209081526040909120835161140b92850190614b1b565b506000858152601160205260409020805460ff1916851515179055828015611442575060008581526012602052604090205460ff16155b1561148857600085815260126020526040808220805460ff191660011790555186917fafd1af0d18662bc4cbe66cd3885857264bb71d267eb57c0add879e84a5be317791a25b81604051611496919061547a565b60408051918290038220600080845260208401529187917f2a228bf8ab34c4401425e787b89ef2b1cad5e2e93daf585a1e62dd9ce87fcedd910160405180910390a35050505050565b600a54610100900460ff166115075760405163b7b2409760e01b815260040160405180910390fd5b611510816133bf565b8061151a60085490565b6115249190615496565b341461156157348161153560085490565b61153f9190615496565b60405163e763535560e01b815260048101929092526024820152604401610f49565b61156b33826134ce565b50565b6000547ffdd7b2ba629c0a0b84029cda831836222e5708c95d3e782c0762066b472dad0e906001600160a01b031633148015906115c55750600081815260016020908152604080832033845290915290205460ff16155b156115d05733610f21565b6115d9826133bf565b61113683836134ce565b6111368383836134e8565b6000546001600160a01b0316331461162757335b604051630e60d8d360e41b81526001600160a01b039091166004820152602401610f49565b61127482826137c1565b600061163c83611cfd565b82111561166f578161164d84611cfd565b6040516363a056dd60e01b815260048101929092526024820152604401610f49565b60006116796133ae565b90506000805b828110156116ea57611690816131a4565b156116d857856001600160a01b03166116a882613848565b516001600160a01b031614156116d857848214156116ca579250610ecf915050565b816116d4816153ac565b9250505b806116e2816153ac565b91505061167f565b506040516301b2776960e11b815260040160405180910390fd5b606061170f8361323a565b81516000816001600160401b0381111561172b5761172b614d4f565b604051908082528060200260200182016040528015611754578160200160208202803683370190505b50905060005b828110156117fb576001600160a01b038616600090815260166020908152604080832060178352818420548452909152812086519091908790849081106117a3576117a3615380565b6020026020010151815260200190815260200160002060009054906101000a900460ff168282815181106117d9576117d9615380565b91151560209283029190910190910152806117f3816153ac565b91505061175a565b50949350505050565b6000546001600160a01b0316331461181c5733611602565b611826600061394f565b565b60606013805480602002602001604051908101604052809291908181526020016000905b82821015611894576000848152602090819020604080518082019091526002850290910180546001600160a01b0316825260019081015482840152908352909201910161184c565b50505050905090565b6000547f7c13537556c77ef3fb98601c3356887ddbe5991e86dc065741ce77e1dd2554a3906001600160a01b031633148015906118f45750600081815260016020908152604080832033845290915290205460ff16155b156118ff5733610f21565b600954601354479190811580611913575080155b1561193157604051639811e0c760e01b815260040160405180910390fd5b600061193d83856154cb565b905060005b82811015611a3c5760006013828154811061195f5761195f615380565b600091825260208083206040805180820190915260029093020180546001600160a01b031683526001015490820181905290925061199e908590615496565b82516040519192506001600160a01b03169082156108fc029083906000818181858888f193505050501580156119d8573d6000803e3d6000fd5b5081516001600160a01b0316336001600160a01b03167f8957f76027b186a481886d5e1dfef5a49a9b792649df75e9dd5e53cde75c71ea83604051611a1f91815260200190565b60405180910390a350508080611a34906153ac565b915050611942565b5060095433907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d590611a6e9084615496565b6040519081526020015b60405180910390a25050505050565b61113683838360405180602001604052806000815250612663565b6000610ecf826131a4565b6000611ab7611327565b8210611ac6578161164d611327565b600354611ad857610ecf8260016154df565b600080611ae36133ae565b905060005b818110156116ea5784831415611b0057949350505050565b611b09816131a4565b15611b1c5782611b18816153ac565b9350505b80611b26816153ac565b915050611ae8565b600a5462010000900460ff1615611b585760405163b087bbf360e01b815260040160405180910390fd5b6000546000805160206156df833981519152906001600160a01b03163314801590611b9d5750600081815260016020908152604080832033845290915290205460ff16155b15611ba85733610f21565b8151611bbb90600d906020850190614b1b565b5081604051611bca919061547a565b604051908190038120907fafa35f42f46f5052816d7c6a2e9406eca98294b20726677862d83b4a7418d8d590600090a25050565b6000546000805160206156df833981519152906001600160a01b03163314801590611c435750600081815260016020908152604080832033845290915290205460ff16155b15611c4e5733610f21565b611c57826131a4565b611c775760405163c927e5bf60e01b815260048101839052602401610f49565b600082815260126020526040808220805460ff191660011790555183917fafd1af0d18662bc4cbe66cd3885857264bb71d267eb57c0add879e84a5be317791a25050565b6000611cc56133ae565b7f00000000000000000000000000000000000000000000000000000000000002da61133a565b6000611cf682613848565b5192915050565b60006001600160a01b038216611d265760405163e99d5ac560e01b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160801b031690565b6000546000805160206156df833981519152906001600160a01b03163314801590611d905750600081815260016020908152604080832033845290915290205460ff16155b15611d9b5733610f21565b6111366040518060400160405280856001600160a01b031681526020018481525061399f565b600a5462010000900460ff1615611deb5760405163b087bbf360e01b815260040160405180910390fd5b6000546000805160206156df833981519152906001600160a01b03163314801590611e305750600081815260016020908152604080832033845290915290205460ff16155b15611e3b5733610f21565b8151611e4e90600e906020850190614b1b565b50600e604051611e5e91906153c7565b604051908190038120907fb6b2b7d0cff2ae8f651bd60fb4eb42b79f6e366900a72af6156ea30044179e8e90600090a25050565b6000611e9d826131a4565b611ebd5760405163c927e5bf60e01b815260048101839052602401610f49565b5060009081526011602052604090205460ff1690565b6000546000805160206156df833981519152906001600160a01b03163314801590611f185750600081815260016020908152604080832033845290915290205460ff16155b15611f235733610f21565b611f2c8261323a565b6001600160a01b0382166000908152601760205260408120805491611f50836153ac565b90915550506001600160a01b038216600081815260186020526040808220829055517ff1d918039d4ced601abd661af27bad3fa7cd09c72e6052e04d27348656f9b7069190a25050565b805180611ff157600060017f000000000000000000000000000000000000000000000000000000000000000a5b6040516346f4384b60e01b8152600481019390935260248301919091526044820152606401610f49565b611ffa816133bf565b61200383613b4f565b600061200e84613bda565b51905061201b8282615496565b341461202c573461153f8383615496565b612037338585613c47565b6120418484613e3e565b61204b33836134ce565b50505050565b6000546000805160206156df833981519152906001600160a01b031633148015906120965750600081815260016020908152604080832033845290915290205460ff16155b156120a15733610f21565b6111368383613f59565b61156b81336140b4565b6000546000805160206156df833981519152906001600160a01b031633148015906120fa5750600081815260016020908152604080832033845290915290205460ff16155b156121055733610f21565b60088290556040518281527fa6dc15bdb68da224c66db4b3838d9a2b205138e8cff6774e57d0af91e196d62290602001610f9f565b6060600c8054610fba90615345565b606060006121556133ae565b90506000816001600160401b0381111561217157612171614d4f565b6040519080825280602002602001820160405280156121bc57816020015b604080516060810182526000808252602080830182905292820152825260001990920191018161218f5790505b50905060015b828111612285576121d2816131a4565b1561222e5760408051606081018252828152600060208201529081016121f783611ceb565b6001600160a01b031690528261220e600184615463565b8151811061221e5761221e615380565b6020026020010181905250612273565b604080516060810190915281815260208101600181523060209091015282612257600184615463565b8151811061226757612267615380565b60200260200101819052505b8061227d816153ac565b9150506121c2565b5092915050565b6000546000805160206156df833981519152906001600160a01b031633148015906122d15750600081815260016020908152604080832033845290915290205460ff16155b156122dc5733610f21565b6001600160a01b0382166123035760405163e99d5ac560e01b815260040160405180910390fd5b60135460005b8181101561236957836001600160a01b03166013828154811061232e5761232e615380565b60009182526020909120600290910201546001600160a01b031614156123575761204b81614137565b80612361816153ac565b915050612309565b506040516354a932f560e01b81526001600160a01b0384166004820152602401610f49565b6000612399826131a4565b6123b95760405163c927e5bf60e01b815260048101839052602401610f49565b60008281526012602052604090205460ff1680610ecf5750600a5460ff1692915050565b6001600160a01b038216331415612411576040516372b3985f60e01b81523360048201528115156024820152604401610f49565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000546000805160206156df833981519152906001600160a01b031633148015906124c25750600081815260016020908152604080832033845290915290205460ff16155b156124cd5733610f21565b6001600160a01b0383166124f45760405163e99d5ac560e01b815260040160405180910390fd5b60135460005b818110156125b557846001600160a01b03166013828154811061251f5761251f615380565b60009182526020909120600290910201546001600160a01b031614156125a357836013828154811061255357612553615380565b906000526020600020906002020160010181905550846001600160a01b03167f06945c82029753372decfeace485696553ab08354f682b4fa8e08d277e25498585604051611a7891815260200190565b806125ad816153ac565b9150506124fa565b506040516354a932f560e01b81526001600160a01b0385166004820152602401610f49565b6000546000805160206156df833981519152906001600160a01b0316331480159061261f5750600081815260016020908152604080832033845290915290205460ff16155b1561262a5733610f21565b600a805460ff191660011790556040517fe2a7169cedebe39671840370ae19ca4fc41be6191d4c77f174f189a4d8cd08c890600090a150565b61266e8484846134e8565b61267a848484846142bd565b61204b5760405163a371886b60e01b81526001600160a01b0380861660048301528416602482015260448101839052606401610f49565b6000546000805160206156df833981519152906001600160a01b031633148015906126f65750600081815260016020908152604080832033845290915290205460ff16155b156127015733610f21565b61270a8361323a565b6001600160a01b03831660009081526019602052604090206002015460ff16151582151514611136576001600160a01b0383166000818152601960205260409081902060028101805486151560ff1990911617905590517f0e26d8e2549574e8d6493ef972ea195acde7d56ff6b7a7114978c2b5edf9ea8e916127ab91815481526001820154602082015260029091015460ff161515604082015260600190565b60405180910390a2505050565b6060600f8054610fba90615345565b60606127d2826131a4565b6127f25760405163c927e5bf60e01b815260048101839052602401610f49565b6000828152601060205260408120805461280b90615345565b80601f016020809104026020016040519081016040528092919081815260200182805461283790615345565b80156128845780601f1061285957610100808354040283529160200191612884565b820191906000526020600020905b81548152906001019060200180831161286757829003601f168201915b505050505090506000600d805461289a90615345565b80601f01602080910402602001604051908101604052809291908181526020018280546128c690615345565b80156129135780601f106128e857610100808354040283529160200191612913565b820191906000526020600020905b8154815290600101906020018083116128f657829003601f168201915b5050600a54939450505060ff9091161590508015612940575060008481526012602052604090205460ff16155b156129d957600e805461295290615345565b80601f016020809104026020016040519081016040528092919081815260200182805461297e90615345565b80156129cb5780601f106129a0576101008083540402835291602001916129cb565b820191906000526020600020905b8154815290600101906020018083116129ae57829003601f168201915b505050505092505050919050565b815115612a295760008481526011602052604090205460ff16156129fe575092915050565b8082604051602001612a119291906154f7565b60405160208183030381529060405292505050919050565b6000600d8054612a3890615345565b905011156122855780612a4a856143c8565b604051602001612a119291906154f7565b601354600090815b8181101561236957836001600160a01b031660138281548110612a8857612a88615380565b60009182526020909120600290910201546001600160a01b03161415612ad65760138181548110612abb57612abb615380565b90600052602060002090600202016001015492505050919050565b80612ae0816153ac565b915050612a63565b600a5462010000900460ff1615612b125760405163b087bbf360e01b815260040160405180910390fd5b6000546000805160206156df833981519152906001600160a01b03163314801590612b575750600081815260016020908152604080832033845290915290205460ff16155b15612b625733610f21565b600a805462ff00001916620100001790556040517feef043febddf4e1d1cf1f72ff1407b84e036e805aa0934418cb82095da8d716490600090a150565b60148054604080516020808402820181019092528281526060936000928490830182828015612bf757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612bd9575b505050505090506000826001600160401b03811115612c1857612c18614d4f565b604051908082528060200260200182016040528015612c5157816020015b612c3e614b9f565b815260200190600190039081612c365790505b50905060005b83811015612d8d576000838281518110612c7357612c73615380565b602002602001015190506040518060a00160405280826001600160a01b03168152602001612ca0836144c5565b8152602001612cae8361453e565b815260200160186000878681518110612cc957612cc9615380565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054815260200160196000878681518110612d0d57612d0d615380565b6020908102919091018101516001600160a01b031682528181019290925260409081016000208151606081018352815481526001820154938101939093526002015460ff1615159082015290528351849084908110612d6e57612d6e615380565b6020026020010181905250508080612d85906153ac565b915050612c57565b509392505050565b6000546001600160a01b03163314612dad5733611602565b61127482826140b4565b6000546000805160206156df833981519152906001600160a01b03163314801590612dfc5750600081815260016020908152604080832033845290915290205460ff16155b15612e075733610f21565b612e108361323a565b6001600160a01b03831660008181526019602090815260409182902085518155908501516001820155848201516002909101805460ff1916911515919091179055517f0e26d8e2549574e8d6493ef972ea195acde7d56ff6b7a7114978c2b5edf9ea8e906127ab908590615526565b6000546000805160206156df833981519152906001600160a01b03163314801590612ec45750600081815260016020908152604080832033845290915290205460ff16155b15612ecf5733610f21565b6040514790339082156108fc029083906000818181858888f19350505050158015612efe573d6000803e3d6000fd5b5060405181815233907f2e39961a70a10f4d46383948095ac2752b3ee642a7c76aa827410aaff08c2e51906020015b60405180910390a25050565b6000547f7c13537556c77ef3fb98601c3356887ddbe5991e86dc065741ce77e1dd2554a3906001600160a01b03163314801590612f905750600081815260016020908152604080832033845290915290205460ff16155b15612f9b5733610f21565b6001600160a01b038316612fc25760405163e99d5ac560e01b815260040160405180910390fd5b612fd66001600160a01b038516848461459c565b826001600160a01b0316846001600160a01b03167f401f439d865a766757ec78675925bd67198d5e78805aa41691b34b5d6a6cbbe68460405161301b91815260200190565b60405180910390a350505050565b6000546000805160206156df833981519152906001600160a01b0316331480159061306e5750600081815260016020908152604080832033845290915290205460ff16155b156130795733610f21565b613081613383565b600a805463ff000000191663010000001790556040517f294f0756ade420332ef086187515f4a3af6e693dfe5ca7e10990f5d61bf06dd390600090a150565b6000546001600160a01b031633146130d85733611602565b6001600160a01b0381166130ff5760405163e99d5ac560e01b815260040160405180910390fd5b61156b8161394f565b613110614b9f565b6131198261323a565b6040518060a00160405280836001600160a01b0316815260200161313c846144c5565b815260200161314a8461453e565b81526001600160a01b03841660009081526018602090815260409182902054908301520161317784613bda565b905292915050565b60006001600160e01b03198216634b88b8ad60e11b1480610ecf5750610ecf826145ee565b600080821180156131b6575060025482105b8015610ecf57506000828152600460205260409020546001600160a01b031630141592915050565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6001600160a01b0381166132615760405163e99d5ac560e01b815260040160405180910390fd5b6001600160a01b03811660009081526015602052604090205460ff1661156b5760405163a5be5e0f60e01b81526001600160a01b0382166004820152602401610f49565b6014548082106132b3575050565b815b6132c0600183615463565b81101561334b5760146132d48260016154df565b815481106132e4576132e4615380565b600091825260209091200154601480546001600160a01b03909216918390811061331057613310615380565b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905580613343816153ac565b9150506132b5565b50601480548061335d5761335d615549565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b600a546301000000900460ff161561182657604051632edca92560e01b815260040160405180910390fd5b600060016002546113449190615463565b7f000000000000000000000000000000000000000000000000000000000000000a8111806133eb575080155b15613419578060017f000000000000000000000000000000000000000000000000000000000000000a611fc7565b7f00000000000000000000000000000000000000000000000000000000000002da816134436133ae565b61344d91906154df565b111561156b578061345c6133ae565b613486907f00000000000000000000000000000000000000000000000000000000000002da615463565b6040516302d95a3b60e11b8152600481019290925260248201527f00000000000000000000000000000000000000000000000000000000000002da6044820152606401610f49565b611274828260405180602001604052806000815250614613565b6001600160a01b03821661350f5760405163e99d5ac560e01b815260040160405180910390fd5b600061351a82613848565b9050836001600160a01b031681600001516001600160a01b03161461358057335b815160405163753e1c4f60e11b81526001600160a01b03928316600482015282871660248201528286166044820152606481018590529116608482015260a401610f49565b80516001600160a01b0316336001600160a01b0316141580156135b45750336135a88361103d565b6001600160a01b031614155b80156135c9575080516135c79033610c7b565b155b156135d4573361353b565b6135e460008383600001516131de565b6001600160a01b03841660009081526005602052604081208054600192906136169084906001600160801b031661555f565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0385166000908152600560205260408120805460019450909261366291859116615587565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b0380861682526001600160401b03428116602080850191825260008881526004909152948520935184549151909216600160a01b026001600160e01b031990911691909216171790556136e98360016154df565b6000818152600460205260409020549091506001600160a01b031661377857613711816131a4565b156137785760408051808201825283516001600160a01b0390811682526020808601516001600160401b039081168285019081526000878152600490935294909120925183549451909116600160a01b026001600160e01b03199094169116179190911790555b82846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff166112745760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6040805180820190915260008082526020820152613865826131a4565b6138855760405163c927e5bf60e01b815260048101839052602401610f49565b60007f000000000000000000000000000000000000000000000000000000000000000a83106138e6576138d87f000000000000000000000000000000000000000000000000000000000000000a84615463565b6138e39060016154df565b90505b825b8181106116ea576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b9091046001600160401b0316918301919091521561393c57949350505050565b5080613947816155a9565b9150506138e8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60208101516139c157604051639811e0c760e01b815260040160405180910390fd5b80516001600160a01b03166139e95760405163e99d5ac560e01b815260040160405180910390fd5b60135460005b81811015613a715782600001516001600160a01b031660138281548110613a1857613a18615380565b60009182526020909120600290910201546001600160a01b03161415613a5f5782516040516370d2049160e01b81526001600160a01b039091166004820152602401610f49565b80613a69816153ac565b9150506139ef565b5060138054600181018255600091825283517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a090600290920291820180546001600160a01b0319166001600160a01b0390921691909117905560208401517f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a0919091018190556009805491929091613b089084906154df565b909155505081516020808401516040519081526001600160a01b03909216917f3bc19114ca6a687ffd9445c87615db284e96364365d72b010ec53244b45e561b9101612f2d565b6001600160a01b03811660009081526015602052604090205460ff16613b935760405163a5be5e0f60e01b81526001600160a01b0382166004820152602401610f49565b6001600160a01b03811660009081526019602052604090206002015460ff1661156b57604051637a08c0fb60e11b81526001600160a01b0382166004820152602401610f49565b613c00604051806060016040528060008152602001600081526020016000151581525090565b506001600160a01b03166000908152601960209081526040918290208251606081018452815481526001820154928101929092526002015460ff1615159181019190915290565b80516001600160a01b038316600090815260196020908152604080832060010154601890925290912054613c7c9083906154df565b1115613cc1576001600160a01b03831660008181526019602052604090819020600101549051635ca6c35960e01b815260048101929092526024820152604401610f49565b60005b818110156137ba576000838281518110613ce057613ce0615380565b60200260200101519050846001600160a01b0316636352211e826040518263ffffffff1660e01b8152600401613d1891815260200190565b602060405180830381865afa925050508015613d51575060408051601f3d908101601f19168201909252613d4e918101906155c0565b60015b613d80576040516302682da560e41b81526001600160a01b038616600482015260248101829052604401610f49565b866001600160a01b0316816001600160a01b031614613dc4576040516302682da560e41b81526001600160a01b038716600482015260248101839052604401610f49565b506001600160a01b038516600090815260166020908152604080832060178352818420548452825280832084845290915290205460ff1615613e2b5760405163cf3571af60e01b81526001600160a01b038616600482015260248101829052604401610f49565b5080613e36816153ac565b915050613cc4565b805160005b81811015613f26576001600160a01b0384166000908152601660209081526040808320601783528184205484529091528120845160019290869085908110613e8d57613e8d615380565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550828181518110613ecc57613ecc615380565b6020026020010151846001600160a01b0316336001600160a01b03167f728e641386299b5070162250083c0abc8f1d93cd543b23eaed63336575ca994c60405160405180910390a480613f1e816153ac565b915050613e43565b506001600160a01b03831660009081526018602052604081208054839290613f4f9084906154df565b9091555050505050565b6001600160a01b038216613f805760405163e99d5ac560e01b815260040160405180910390fd5b6001600160a01b03821660009081526015602052604090205460ff1615613fc5576040516354d67cef60e01b81526001600160a01b0383166004820152602401610f49565b6001600160a01b0382166000908152601560209081526040808320805460ff1916600117905560179091528120805491613ffe836153ac565b90915550506001600160a01b03821660008181526019602090815260408083208551815591850151600180840191909155858201516002909301805460ff1916931515939093179092556014805492830181559092527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec0180546001600160a01b03191683179055517fab109b1e3dd4bf279798315182b336f138e930aec9aaeafe98f768450d9fd9b790612f2d908490615526565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16156112745760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60138054906000908383811061414f5761414f615380565b60009182526020918290206040805180820190915260029092020180546001600160a01b0316825260010154918101919091529050825b614191600184615463565b8110156142205760136141a58260016154df565b815481106141b5576141b5615380565b9060005260206000209060020201601382815481106141d6576141d6615380565b60009182526020909120825460029092020180546001600160a01b0319166001600160a01b0390921691909117815560019182015491015580614218816153ac565b915050614186565b50601380548061423257614232615549565b6000828152602080822060026000199094019384020180546001600160a01b0319168155600101829055919092558201516009805491929091614276908490615463565b909155505080516020808301516040519081526001600160a01b03909216917f775539f018602cb5533761287430a74c8cc49b559ee2fbcd32e086789206382a91016127ab565b60006001600160a01b0384163b156143bc57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906143019033908990889088906004016155dd565b6020604051808303816000875af192505050801561433c575060408051601f3d908101601f191682019092526143399181019061561a565b60015b6143a2573d80801561436a576040519150601f19603f3d011682016040523d82523d6000602084013e61436f565b606091505b50805161439a57604051634e1cb28960e11b81526001600160a01b0386166004820152602401610f49565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506143c0565b5060015b949350505050565b6060816143ec5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156144165780614400816153ac565b915061440f9050600a836154cb565b91506143f0565b6000816001600160401b0381111561443057614430614d4f565b6040519080825280601f01601f19166020018201604052801561445a576020820181803683370190505b5090505b84156143c05761446f600183615463565b915061447c600a86615637565b6144879060306154df565b60f81b81838151811061449c5761449c615380565b60200101906001600160f81b031916908160001a9053506144be600a866154cb565b945061445e565b6060816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561452657506040513d6000823e601f3d908101601f19168201604052614523919081019061564b565b60015b610ecf57505060408051602081019091526000815290565b6060816001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561452657506040513d6000823e601f3d908101601f19168201604052614523919081019061564b565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611136908490614875565b60006001600160e01b031982166380ac58cd60e01b1480610ecf5750610ecf82614947565b6002546001600160a01b03841661463d5760405163e99d5ac560e01b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000a831180614669575082155b156146b7576040516346f4384b60e01b815260048101849052600160248201527f000000000000000000000000000000000000000000000000000000000000000a6044820152606401610f49565b6001600160a01b0384166000908152600560209081526040918290208251808401845290546001600160801b038082168352600160801b9091041691810191909152815180830190925280519091908190614713908790615587565b6001600160801b031681526020018583602001516147319190615587565b6001600160801b039081169091526001600160a01b0380881660008181526005602090815260408083208751978301518716600160801b029790961696909617909455845180860186529182526001600160401b034281168386019081528883526004909552948120915182549451909516600160a01b026001600160e01b031990941694909216939093179190911790915582905b8581101561486a5760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a461481460008884886142bd565b61484a5760405163a371886b60e01b8152600060048201526001600160a01b038816602482015260448101839052606401610f49565b81614854816153ac565b9250508080614862906153ac565b9150506147c7565b506002555050505050565b60006148ca826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661496c9092919063ffffffff16565b80519091501561113657808060200190518101906148e891906156c1565b6111365760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610f49565b60006001600160e01b0319821663e00008a960e01b1480610ecf5750610ecf82614985565b606061497b84846000856149ba565b90505b9392505050565b60006001600160e01b03198216634b8ae87360e01b1480610ecf57506301ffc9a760e01b6001600160e01b0319831614610ecf565b606082471015614a1b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610f49565b843b614a695760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f49565b600080866001600160a01b03168587604051614a85919061547a565b60006040518083038185875af1925050503d8060008114614ac2576040519150601f19603f3d011682016040523d82523d6000602084013e614ac7565b606091505b5091509150614ad7828286614ae2565b979650505050505050565b60608315614af157508161497e565b825115614b015782518084602001fd5b8160405162461bcd60e51b8152600401610f499190614cc5565b828054614b2790615345565b90600052602060002090601f016020900481019282614b495760008555614b8f565b82601f10614b6257805160ff1916838001178555614b8f565b82800160010185558215614b8f579182015b82811115614b8f578251825591602001919060010190614b74565b50614b9b929150614bfa565b5090565b6040518060a0016040528060006001600160a01b03168152602001606081526020016060815260200160008152602001614bf5604051806060016040528060008152602001600081526020016000151581525090565b905290565b5b80821115614b9b5760008155600101614bfb565b6001600160e01b03198116811461156b57600080fd5b600060208284031215614c3757600080fd5b813561497e81614c0f565b801515811461156b57600080fd5b600060208284031215614c6257600080fd5b813561497e81614c42565b60005b83811015614c88578181015183820152602001614c70565b8381111561204b5750506000910152565b60008151808452614cb1816020860160208601614c6d565b601f01601f19169290920160200192915050565b60208152600061497e6020830184614c99565b600060208284031215614cea57600080fd5b5035919050565b6001600160a01b038116811461156b57600080fd5b60008060408385031215614d1957600080fd5b8235614d2481614cf1565b946020939093013593505050565b600060208284031215614d4457600080fd5b813561497e81614cf1565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614d8d57614d8d614d4f565b604052919050565b60006001600160401b03821115614dae57614dae614d4f565b50601f01601f191660200190565b6000614dcf614dca84614d95565b614d65565b9050828152838383011115614de357600080fd5b828260208301376000602084830101529392505050565b600082601f830112614e0b57600080fd5b61497e83833560208501614dbc565b600060208284031215614e2c57600080fd5b81356001600160401b03811115614e4257600080fd5b6143c084828501614dfa565b60008060008060808587031215614e6457600080fd5b843593506020850135614e7681614c42565b92506040850135614e8681614c42565b915060608501356001600160401b03811115614ea157600080fd5b614ead87828801614dfa565b91505092959194509250565b600080600060608486031215614ece57600080fd5b8335614ed981614cf1565b92506020840135614ee981614cf1565b929592945050506040919091013590565b60008060408385031215614f0d57600080fd5b823591506020830135614f1f81614cf1565b809150509250929050565b60008060408385031215614f3d57600080fd5b8235614f4881614cf1565b91506020838101356001600160401b0380821115614f6557600080fd5b818601915086601f830112614f7957600080fd5b813581811115614f8b57614f8b614d4f565b8060051b9150614f9c848301614d65565b8181529183018401918481019089841115614fb657600080fd5b938501935b83851015614fd457843582529385019390850190614fbb565b8096505050505050509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561501e578351151583529284019291840191600101615000565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b8281101561507557815180516001600160a01b03168552860151868501529284019290850190600101615047565b5091979650505050505050565b600080828403608081121561509657600080fd5b83356150a181614cf1565b92506060601f19820112156150b557600080fd5b50604051606081018181106001600160401b03821117156150d8576150d8614d4f565b8060405250602084013581526040840135602082015260608401356150fc81614c42565b6040820152919491935090915050565b60208082528251828201819052600091906040908185019086840185805b8381101561517e57825180518652878101516002811061515857634e487b7160e01b84526021600452602484fd5b868901528601516001600160a01b0316868601526060909401939186019160010161512a565b509298975050505050505050565b6000806040838503121561519f57600080fd5b82356151aa81614cf1565b91506020830135614f1f81614c42565b600080600080608085870312156151d057600080fd5b84356151db81614cf1565b935060208501356151eb81614cf1565b92506040850135915060608501356001600160401b0381111561520d57600080fd5b8501601f8101871361521e57600080fd5b614ead87823560208401614dbc565b60018060a01b0381511682526000602082015160e0602085015261525460e0850182614c99565b90506040830151848203604086015261526d8282614c99565b915050606083015160608501526080830151612d8d608086018280518252602080820151908301526040908101511515910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156152f757603f198886030184526152e585835161522d565b945092850192908501906001016152c9565b5092979650505050505050565b6000806040838503121561531757600080fd5b823561532281614cf1565b91506020830135614f1f81614cf1565b60208152600061497e602083018461522d565b600181811c9082168061535957607f821691505b6020821081141561537a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156153c0576153c0615396565b5060010190565b600080835481600182811c9150808316806153e357607f831692505b602080841082141561540357634e487b7160e01b86526022600452602486fd5b818015615417576001811461542857615455565b60ff19861689528489019650615455565b60008a81526020902060005b8681101561544d5781548b820152908501908301615434565b505084890196505b509498975050505050505050565b60008282101561547557615475615396565b500390565b6000825161548c818460208701614c6d565b9190910192915050565b60008160001904831182151516156154b0576154b0615396565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826154da576154da6154b5565b500490565b600082198211156154f2576154f2615396565b500190565b60008351615509818460208801614c6d565b83519083019061551d818360208801614c6d565b01949350505050565b815181526020808301519082015260408083015115159082015260608101610ecf565b634e487b7160e01b600052603160045260246000fd5b60006001600160801b038381169083168181101561557f5761557f615396565b039392505050565b60006001600160801b0380831681851680830382111561551d5761551d615396565b6000816155b8576155b8615396565b506000190190565b6000602082840312156155d257600080fd5b815161497e81614cf1565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061561090830184614c99565b9695505050505050565b60006020828403121561562c57600080fd5b815161497e81614c0f565b600082615646576156466154b5565b500690565b60006020828403121561565d57600080fd5b81516001600160401b0381111561567357600080fd5b8201601f8101841361568457600080fd5b8051615692614dca82614d95565b8181528560208385010111156156a757600080fd5b6156b8826020830160208601614c6d565b95945050505050565b6000602082840312156156d357600080fd5b815161497e81614c4256fe7e69b879a040173b938f56bb64bfa62bcd758c08ae6ed7cfdf7da6d7dba92708a264697066735822122008e48a99b1101002ec49a84dc6e82e4624ba8287df5e2e39615c1fd678ff1aae64736f6c634300080b0033

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

00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000011c37937e08000000000000000000000000000000000000000000000000000000000000000002da000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000134164616d205269636865732047656e65736973000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003415247000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad00000000000000000000000000000000000000000000000000000000000000010000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad00000000000000000000000000000000000000000000000000000000000000010000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b5651a4a8c4ce095f56558a08a1fd1defd2fc6b7000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000310b3bd4d1db6d144c00f11d59d1261630e8698a000000000000000000000000000000000000000000000000000000000000005a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f7cf6747c81829585f18e8021d267fd4866e518900000000000000000000000000000000000000000000000000470de4df82000000000000000000000000000000000000000000000000000000000000000000960000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : config (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]

-----Encoded View---------------
31 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000200
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000240
Arg [6] : 000000000000000000000000000000000000000000000000011c37937e080000
Arg [7] : 00000000000000000000000000000000000000000000000000000000000002da
Arg [8] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000280
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000320
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000013
Arg [12] : 4164616d205269636865732047656e6573697300000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [14] : 4152470000000000000000000000000000000000000000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [16] : 0000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [18] : 0000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [20] : 0000000000000000000000009fd9cc665de25da487a9953307a26f3ef2c831ad
Arg [21] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [22] : 000000000000000000000000b5651a4a8c4ce095f56558a08a1fd1defd2fc6b7
Arg [23] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [24] : 000000000000000000000000310b3bd4d1db6d144c00f11d59d1261630e8698a
Arg [25] : 000000000000000000000000000000000000000000000000000000000000005a
Arg [26] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [27] : 000000000000000000000000f7cf6747c81829585f18e8021d267fd4866e5189
Arg [28] : 00000000000000000000000000000000000000000000000000470de4df820000
Arg [29] : 0000000000000000000000000000000000000000000000000000000000000096
Arg [30] : 0000000000000000000000000000000000000000000000000000000000000000


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

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