Contract 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xa66f4bddd9c72412bffe1f2cc2be36b0ea56085900be01665421083684a9f7210x6080604066154632022-02-22 5:14:07766 days 2 hrs ago0xb013abd83f0bd173e9f14ce7d6e420ad711483b4 IN  Create: Summoning0 ETH0.052615411625 ETH0.779141098
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x2657b935920c5361e3ec404896bfa41c0b8d75fe6b3ae775b7a66c3a11c0f58477025462022-03-10 16:56:34749 days 14 hrs ago 0x0b13f13c0e99f24b96a835b787d1347b33d87776 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x8e8c05a88d765cea1a471468a6b77a64c0d9e094d6648c09f2514d4a97f54cbf76765742022-03-10 3:52:42750 days 3 hrs ago 0x7911670881a81f8410d06053d7b3c237ce77b9b4 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x36a4a387b289fdbf5534a2d2639c036688fb26e870117a6b1c9959a1dd9d8a5376690452022-03-10 0:17:33750 days 7 hrs ago 0xbec3ef697f58795b33dcbd6e6eb8c9992560c815 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x613ebbb4e8407a1ce8d76d08081276f4debbd928c96b5c721c0acacfa8dd2c5775495802022-03-08 5:27:35752 days 1 hr ago 0xf9ceeaf31368b870ad5762204e3d0937fb2257b8 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x174f92ef617191ed4604d0d656d12d293fb760f8d36c3342478577c3433eebdf75299672022-03-07 20:21:56752 days 11 hrs ago 0xd84e11bee5d555ccd905817cb8cbbd5b6e6c4f0d 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x8b42f55bedc3db6bdd8f9923790509424d80df7b8d331778b62420960c5d820574920612022-03-07 2:50:37753 days 4 hrs ago 0xd7d870220a28d01f2fe914f06f0418c8bbe7b261 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x65ee5f9c3ac1bdb0dc6777cf896acbfc003bebd3bc49efa9d2d285661a45de6574567522022-03-06 6:15:24754 days 1 hr ago 0x23f1045ca09e9c3206851336a2a05d35bbc812d3 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x8ba505c6b0f384d7c62d624960ed5e1388f76da2dfea7153cf08a40a6894120174121442022-03-04 18:03:43755 days 13 hrs ago 0xfe79ca675707f7cd474358149915e0e3b80ef546 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x302a91261403891b5997fd6912894605c5ee1608a18989197d614439a5e1e05773675882022-03-03 17:03:52756 days 14 hrs ago 0x1d18a0fdff04c4c462b42bccac22c1df1f5595fb 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x23021803e9b3d0584957e8ada3bf29e1120461dbed435cdd43573502d84552cf73300032022-03-03 2:12:32757 days 5 hrs ago 0xc7a0d765c3af6e2710ba05a56c5e2ca190c2e11e 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x207ced32b2160334fa8cf25e9c4ba7ae6bf4884c3257cf9bdc476c72519e916f73263232022-03-03 1:27:20757 days 5 hrs ago 0x756062d39a728aa33998ff953eab4a3bd91f726a 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x610ef3f817a6abba31269765f33bdc3a29ad66309c884d93f935d442d31089be73256432022-03-03 1:18:39757 days 6 hrs ago 0xe3262eede42a5eb5189b7a57443257d35f7fb5f7 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x7757d7155345d056baaea6b1f01b634d16fb9085a0cfef5a93744b1c88f4694572997232022-03-02 21:16:12757 days 10 hrs ago 0x838007969d43f55fe84fc09701d0f9903e9190ec 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0xc08281b7d19b562eac401d713d4839c71af05ce46e80587d0dd2879c76955cc472313612022-03-02 8:06:20757 days 23 hrs ago 0xdc18e1f94eb8ca06455216bdbb1f6b64c1081881 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x238f5a75719a6d902c750e3f2aad51953310712b286e910ed23cc1389ff8f1bb72252512022-03-02 6:05:44758 days 1 hr ago 0x19a178311e24b81874f9647ea96517e718ab27e2 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0xc9c84fb8699233db18ce31d3ee727acd6604351cca59440b53d43f03b965931172245382022-03-02 5:50:49758 days 1 hr ago 0xfa1d7f90fdd5cb77e1274cfe96c710a6a9374f48 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0xc97503ba4eb3fbe6e9bbf1e62436c748b6544fae726032e64357228ee558ed1872180192022-03-02 3:41:29758 days 3 hrs ago 0x62da82e43d41e231479cc6f4943e30912030dc5c 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x4b9ec6cf7db5092cc091d7bb17f2ff1259ba7cfb23f06910ab8f93b0f34e9dce72046192022-03-01 23:01:14758 days 8 hrs ago 0x677db4b74010c63f11a8af2025ac63badc0655f1 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x6cd8f8d323af832880edd2dca3a2d48f7e4bfe831b8e289da8f52a6e69f7fe7a71933212022-03-01 19:15:50758 days 12 hrs ago 0x34d7bceaa2b3cfb1de368baa703683edc666d3f1 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x827118c6eb64083b595225db909f086c8513449b865328b50607d712da1e3b0671837542022-03-01 16:16:46758 days 15 hrs ago 0x5bef17af024df37d6aede8e64a4bd1e7fa4bda8f 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0xc6ba35c9ce75c684e7c3b8ff3646e2d1bf51ca2615f44fa476c90a251cb62bdc71816942022-03-01 15:42:30758 days 15 hrs ago 0x70f11dbd21809ebcd4c6604581103506a6a8443a 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0xeb0e0c3959ce500e4e64246b7ebd912de8a9cbfeb3ca723dc9c00c23564aa93f71814032022-03-01 15:37:42758 days 15 hrs ago 0x8bf70cab299e353e3c69eb53f943ac62a60b91b8 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x7e9e9b52b7089570082e4ab961f87096380241ff22cb0ceae0cd3db2d510ea8e71805412022-03-01 15:19:23758 days 16 hrs ago 0x271d44c5fd756839cf75b7382f11ffa88a83aa75 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0xe23df42a5e513281006217303b0ad777d2d723835459300729bdd92beb13f52771795562022-03-01 15:05:52758 days 16 hrs ago 0x4129b4337d5a2f7278a02ff15bb1e4e548d8ee60 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
0x7362804478c47c3047e8daa6c0f2caa591c68ef2ba8020662b6e9a1f43a6141371701042022-03-01 12:40:44758 days 18 hrs ago 0xf14ff6c6c32172dfbe09e1ab2dcda4173fe9ad23 0x0a073b830cd4247d518c4f0d1bafd6edf7af507b0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Summoning

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 34 : Summoning.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./SummoningLPStakable.sol";

contract Summoning is Initializable, SummoningLPStakable {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function initialize() external initializer {
        SummoningLPStakable.__SummoningLPStakable_init();
    }

    function startSummon(
        uint256[] calldata _tokenIds,
        uint256[] calldata _crystalIds)
    external
    nonZeroLength(_tokenIds)
    whenNotPaused
    contractsAreSet
    onlyEOA
    {
        require(!isSummoningPaused, "Summoning: Summoning is paused");
        require(_tokenIds.length == _crystalIds.length, "Crystal and Tokens must be equal");
        require(treasury.isBridgeWorldPowered(), "Bridge World not powered");

        uint256 _lpNeeded = 0;
        uint256 _magicNeeded = 0;
        for(uint256 i = 0; i < _tokenIds.length; i++) {
            (uint256 _lpForSummon, uint256 _magicForSummon) = _startSummonSingle(_tokenIds[i], _crystalIds[i]);
            _lpNeeded += _lpForSummon;
            _magicNeeded += _magicForSummon;
        }

        if(_magicNeeded > 0) {
            // Send magic straight to the treasury.
            bool _magicSuccess = magic.transferFrom(msg.sender, address(treasury), _magicNeeded);
            require(_magicSuccess, "Magic failed to transfer");

            treasury.forwardCoinsToMine(_magicNeeded);
        }

        if(_lpNeeded > 0) {
            // Unlike magic, LP will be given back so we'll store on this contract.
            bool _lpSuccess = lp.transferFrom(msg.sender, address(this), _lpNeeded);
            require(_lpSuccess, "LP failed to transfer");
        }
    }

    // Returns the amount of LP that should be staked for this token.
    function _startSummonSingle(uint256 _tokenId, uint256 _crystalId) private returns(uint256, uint256) {

        require(block.timestamp >= tokenIdToCreatedTime[_tokenId] + summoningFatigueCooldown, "Summoning fatigue still active");

        LegionMetadata memory _metadata = legionMetadataStore.metadataForLegion(_tokenId);
        require(_metadata.legionGeneration != LegionGeneration.RECRUIT, "Cannot summon with recruit");

        uint32 _summoningCountCur = tokenIdToSummonCount[_tokenId];
        tokenIdToSummonCount[_tokenId]++;

        require(_summoningCountCur < generationToMaxSummons[_metadata.legionGeneration], "Reached max summons");

        uint256 _lpAmount = _lpNeeded(_metadata.legionGeneration, _summoningCountCur);

        // Set up the state before staking the legion here. If they send crap token IDs, it will revert when the transfer occurs.
        userToSummoningsInProgress[msg.sender].add(_tokenId);
        _setSummoningStartTime(_tokenId);
        uint256 _requestId = randomizer.requestRandomNumber();
        tokenIdToRequestId[_tokenId] = _requestId;
        tokenIdToLPStaked[_tokenId] = _lpAmount;

        if(_crystalId != 0) {
            require(crystalIds.contains(_crystalId), "Bad crystal ID");

            tokenIdToCrystalIdUsed[_tokenId] = _crystalId;
            consumable.adminSafeTransferFrom(msg.sender, address(treasury), _crystalId, 1);
        }

        legion.adminSafeTransferFrom(msg.sender, address(this), _tokenId);

        emit SummoningStarted(msg.sender, _tokenId, _requestId, block.timestamp + summoningDuration);

        return (_lpAmount, generationToMagicCost[_metadata.legionGeneration]);
    }

    function finishSummonTokens(uint256[] calldata _tokenIds)
    external
    nonZeroLength(_tokenIds)
    whenNotPaused
    contractsAreSet
    onlyEOA
    {
        for(uint256 i = 0; i < _tokenIds.length; i++) {
            require(userToSummoningsInProgress[msg.sender].contains(_tokenIds[i]), "Does not own token");
        }

        _finishSummon(_tokenIds);
    }


    function finishSummon()
    external
    whenNotPaused
    contractsAreSet
    onlyEOA
    {
        uint256[] memory _inProgressSummons = userToSummoningsInProgress[msg.sender].values();

        _finishSummon(_inProgressSummons);
    }

    function _finishSummon(uint256[] memory _inProgressSummons) private {
        uint256 _numberFinished = 0;
        uint256 _lpToRefund = 0;

        for(uint256 i = 0; i < _inProgressSummons.length; i++) {
            uint256 _tokenId = _inProgressSummons[i];

            (uint256 _newTokenId, uint256 _lpRefund) = _finishSummonSingle(_tokenId);
            if(_newTokenId != 0) {
                _numberFinished++;
                _lpToRefund += _lpRefund;
                userToSummoningsInProgress[msg.sender].remove(_tokenId);

                emit SummoningFinished(msg.sender, _tokenId, _newTokenId, block.timestamp + summoningFatigueCooldown);
            }
        }

        if(_lpToRefund > 0) {
            lp.transfer(msg.sender, _lpToRefund);
        }

        if(_numberFinished ==0) {
            emit NoSummoningToFinish(msg.sender);
        }
    }

    function _finishSummonSingle(
        uint256 _tokenId)
    private
    returns(uint256, uint256)
    {
        if(!isTokenDoneSummoning(_tokenId)) {
            return (0, 0);
        }

        uint256 _requestId = tokenIdToRequestId[_tokenId];

        if(!randomizer.isRandomReady(_requestId)) {
            return (0, 0);
        }

        LegionMetadata memory _metadata = legionMetadataStore.metadataForLegion(_tokenId);

        uint256 _randomNumber = randomizer.revealRandomNumber(_requestId);

        uint256 _newTokenId = legion.safeMint(msg.sender);
        LegionClass _newClass = LegionClass((_randomNumber % 5) + 1);

        uint256 _crystalId = tokenIdToCrystalIdUsed[_tokenId];

        _randomNumber = uint256(keccak256(abi.encode(_randomNumber, _randomNumber)));
        LegionRarity _newRarity = _determineRarity(_randomNumber, _metadata, _crystalId);

        legionMetadataStore.setInitialMetadataForLegion(msg.sender, _newTokenId, LegionGeneration.AUXILIARY, _newClass, _newRarity, 0);

        _randomNumber = uint256(keccak256(abi.encode(_randomNumber, _randomNumber)));
        // Check for azure dust
        uint256 _azureResult = _randomNumber % 100000;

        if(_azureResult < chanceAzuriteDustDrop) {
            require(azuriteDustId > 0, "Azurite Dust ID not set");
            consumable.mint(msg.sender, azuriteDustId, 1);
        }

        tokenIdToCreatedTime[_newTokenId] = block.timestamp;

        uint256 _lpStaked = tokenIdToLPStaked[_tokenId];

        delete tokenIdToRequestId[_tokenId];
        delete tokenIdToLPStaked[_tokenId];
        delete tokenIdToSummonStartTime[_tokenId];
        delete tokenIdToCrystalIdUsed[_tokenId];

        // Transfer the original legion back to the user.
        legion.adminSafeTransferFrom(address(this), msg.sender, _tokenId);

        return (_newTokenId, _lpStaked);
    }

    function _determineRarity(uint256 _randomNumber, LegionMetadata memory _metadata, uint256 _crystalId) private view returns(LegionRarity) {
        uint256 _commonOdds = rarityToGenerationToOddsPerRarity[_metadata.legionRarity][_metadata.legionGeneration][LegionRarity.COMMON];
        uint256 _uncommonOdds = rarityToGenerationToOddsPerRarity[_metadata.legionRarity][_metadata.legionGeneration][LegionRarity.UNCOMMON];
        uint256 _rareOdds = rarityToGenerationToOddsPerRarity[_metadata.legionRarity][_metadata.legionGeneration][LegionRarity.RARE];

        if(_crystalId != 0) {
            uint256[3] memory _changedOdds = crystalIdToChangedOdds[_crystalId];
            _commonOdds -= _changedOdds[0];
            _uncommonOdds += _changedOdds[1];
            _rareOdds += _changedOdds[2];
        }

        require(_commonOdds + _uncommonOdds + _rareOdds == 100000, "Bad Rarity odds");

        uint256 _result = _randomNumber % 100000;

        if(_result < _commonOdds) {
            return LegionRarity.COMMON;
        } else if(_result < _commonOdds + _uncommonOdds) {
            return LegionRarity.UNCOMMON;
        } else {
            return LegionRarity.RARE;
        }
    }

}

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

pragma solidity ^0.8.0;

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

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

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

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

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

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

File 3 of 34 : SummoningLPStakable.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

import "./SummoningTimeKeeper.sol";
import "../legionmetadatastore/ILegionMetadataStore.sol";

abstract contract SummoningLPStakable is Initializable, SummoningTimeKeeper {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function __SummoningLPStakable_init() internal initializer {
        SummoningTimeKeeper.__SummoningTimeKeeper_init();
    }

    function _lpNeeded(LegionGeneration _generation, uint32 _summoningCountCur) internal view returns(uint256) {
        SummoningStep[] memory _steps = generationToLPRequiredSteps[_generation];

        for(uint256 i = 0; i < _steps.length; i++) {
            SummoningStep memory _step = _steps[i];

            if(_summoningCountCur > _step.maxSummons) {
                continue;
            } else {
                return _step.value;
            }
        }

        // Shouldn't happen since the steps should go up to max value of uint32. If it does, we should not let them continue.
        revert("Bad LP step values");
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 5 of 34 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 6 of 34 : SummoningTimeKeeper.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

import "./SummoningSettings.sol";
import "../legionmetadatastore/ILegionMetadataStore.sol";

abstract contract SummoningTimeKeeper is Initializable, SummoningSettings {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function __SummoningTimeKeeper_init() internal initializer {
        SummoningSettings.__SummoningSettings_init();
    }

    function _setSummoningStartTime(uint256 _tokenId) internal {
        tokenIdToSummonStartTime[_tokenId] = block.timestamp;
    }

    function isTokenDoneSummoning(uint256 _tokenId) public view returns(bool) {
        return block.timestamp >= tokenIdToSummonStartTime[_tokenId] + summoningDuration;
    }
}

File 7 of 34 : ILegionMetadataStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./LegionMetadataStoreState.sol";

interface ILegionMetadataStore {
    // Sets the intial metadata for a token id.
    // Admin only.
    function setInitialMetadataForLegion(address _owner, uint256 _tokenId, LegionGeneration _generation, LegionClass _class, LegionRarity _rarity, uint256 _oldId) external;

    // Increases the quest level by one. It is up to the calling contract to regulate the max quest level. No validation.
    // Admin only.
    function increaseQuestLevel(uint256 _tokenId) external;

    // Increases the craft level by one. It is up to the calling contract to regulate the max craft level. No validation.
    // Admin only.
    function increaseCraftLevel(uint256 _tokenId) external;

    // Increases the rank of the given constellation to the given number. It is up to the calling contract to regulate the max constellation rank. No validation.
    // Admin only.
    function increaseConstellationRank(uint256 _tokenId, Constellation _constellation, uint8 _to) external;

    // Returns the metadata for the given legion.
    function metadataForLegion(uint256 _tokenId) external view returns(LegionMetadata memory);

    // Returns the tokenUri for the given token.
    function tokenURI(uint256 _tokenId) external view returns(string memory);
}

// As this will likely change in the future, this should not be used to store state, but rather
// as parameters and return values from functions.
struct LegionMetadata {
    LegionGeneration legionGeneration;
    LegionClass legionClass;
    LegionRarity legionRarity;
    uint8 questLevel;
    uint8 craftLevel;
    uint8[6] constellationRanks;
    uint256 oldId;
}

enum Constellation {
    FIRE,
    EARTH,
    WIND,
    WATER,
    LIGHT,
    DARK
}

enum LegionRarity {
    LEGENDARY,
    RARE,
    SPECIAL,
    UNCOMMON,
    COMMON,
    RECRUIT
}

enum LegionClass {
    RECRUIT,
    SIEGE,
    FIGHTER,
    ASSASSIN,
    RANGED,
    SPELLCASTER,
    RIVERMAN,
    NUMERAIRE,
    ALL_CLASS,
    ORIGIN
}

enum LegionGeneration {
    GENESIS,
    AUXILIARY,
    RECRUIT
}

File 8 of 34 : SummoningSettings.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./SummoningContracts.sol";

abstract contract SummoningSettings is Initializable, SummoningContracts {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function __SummoningSettings_init() internal initializer {
        SummoningContracts.__SummoningContracts_init();
    }

    function setIsSummoningPaused(bool _isSummoningPaused) external onlyAdminOrOwner {
        isSummoningPaused = _isSummoningPaused;
    }

    function setSimpleSettings(
        uint256 _summoningDuration,
        uint256 _genesisMagicCost,
        uint256 _auxiliaryMagicCost,
        uint32 _auxiliaryMaxSummons,
        uint32 _genesisMaxSummons,
        uint256 _chanceAzuriteDustDrop,
        uint256 _azuriteDustId)
    external
    onlyAdminOrOwner
    {
        require(_chanceAzuriteDustDrop <= 100000, "Bad azurite odds");
        summoningDuration = _summoningDuration;
        chanceAzuriteDustDrop = _chanceAzuriteDustDrop;
        azuriteDustId = _azuriteDustId;

        generationToMagicCost[LegionGeneration.AUXILIARY] = _auxiliaryMagicCost;
        generationToMagicCost[LegionGeneration.GENESIS] = _genesisMagicCost;

        generationToMaxSummons[LegionGeneration.AUXILIARY] = _auxiliaryMaxSummons;
        generationToMaxSummons[LegionGeneration.GENESIS] = _genesisMaxSummons;
    }

    function setLPSteps(
        SummoningStep[] calldata _auxiliarySteps,
        SummoningStep[] calldata _genesisSteps)
    external
    onlyAdminOrOwner
    {
        require(_auxiliarySteps.length > 0, "Bad auxiliary steps");
        require(_genesisSteps.length > 0, "Bad genesis steps");

        delete generationToLPRequiredSteps[LegionGeneration.AUXILIARY];
        delete generationToLPRequiredSteps[LegionGeneration.GENESIS];

        for(uint256 i = 0; i < _auxiliarySteps.length; i++) {
            generationToLPRequiredSteps[LegionGeneration.AUXILIARY].push(_auxiliarySteps[i]);
        }

        for(uint256 i = 0; i < _genesisSteps.length; i++) {
            generationToLPRequiredSteps[LegionGeneration.GENESIS].push(_genesisSteps[i]);
        }
    }

    function setCrystalOdds(
        uint256[] calldata _crystalIds,
        uint256[3][] calldata _crystalIdToOdds)
    external
    onlyAdminOrOwner
    {
        require(_crystalIds.length == _crystalIdToOdds.length, "Bad lengths");

        delete crystalIds;

        for(uint256 i = 0; i < _crystalIds.length; i++) {
            crystalIds.add(_crystalIds[i]);
            for(uint256 j = 0; j < 3; j++) {
                crystalIdToChangedOdds[_crystalIds[i]][j] = _crystalIdToOdds[i][j];
            }
        }
    }

    // The odds should be for COMMON, UNCOMMON, RARE in that order. The storage is setup to be able to handle summoning more rarities than that,
    // but we do not have a need right now. Can upgrade contract later.
    function setSummoningOdds(
        LegionRarity[] calldata _inputRarities,
        uint256[] calldata _genesisOdds,
        uint256[] calldata _auxiliaryOdds)
    external
    onlyAdminOrOwner
    {
        // Only 3 output options per input rarity
        require(_inputRarities.length > 0
            && _genesisOdds.length == _inputRarities.length * 3
            && _auxiliaryOdds.length == _genesisOdds.length, "Bad input data");

        for(uint256 i = 0; i < _inputRarities.length; i++) {
            LegionRarity _inputRarity = _inputRarities[i];

            rarityToGenerationToOddsPerRarity[_inputRarity][LegionGeneration.GENESIS][LegionRarity.COMMON] = _genesisOdds[i * 3];
            rarityToGenerationToOddsPerRarity[_inputRarity][LegionGeneration.GENESIS][LegionRarity.UNCOMMON] = _genesisOdds[(i * 3) + 1];
            rarityToGenerationToOddsPerRarity[_inputRarity][LegionGeneration.GENESIS][LegionRarity.RARE] = _genesisOdds[(i * 3) + 2];

            rarityToGenerationToOddsPerRarity[_inputRarity][LegionGeneration.AUXILIARY][LegionRarity.COMMON] = _auxiliaryOdds[i * 3];
            rarityToGenerationToOddsPerRarity[_inputRarity][LegionGeneration.AUXILIARY][LegionRarity.UNCOMMON] = _auxiliaryOdds[(i * 3) + 1];
            rarityToGenerationToOddsPerRarity[_inputRarity][LegionGeneration.AUXILIARY][LegionRarity.RARE] = _auxiliaryOdds[(i * 3) + 2];
        }
    }

    function setSummoningFatigue(
        uint256 _summoningFatigueCooldown)
    external
    onlyAdminOrOwner
    {
        summoningFatigueCooldown = _summoningFatigueCooldown;
    }
}

File 9 of 34 : SummoningContracts.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./SummoningState.sol";

abstract contract SummoningContracts is Initializable, SummoningState {

    function __SummoningContracts_init() internal initializer {
        SummoningState.__SummoningState_init();
    }

    function setContracts(
        address _legionAddress,
        address _legionMetadataStoreAddress,
        address _randomizerAddress,
        address _lpAddress,
        address _magicAddress,
        address _treasuryAddress,
        address _consumableAddress)
    external onlyAdminOrOwner
    {
        randomizer = IRandomizer(_randomizerAddress);
        legion = ILegion(_legionAddress);
        legionMetadataStore = ILegionMetadataStore(_legionMetadataStoreAddress);
        magic = IMagic(_magicAddress);
        lp = ILP(_lpAddress);
        treasury = ITreasury(_treasuryAddress);
        consumable = IConsumable(_consumableAddress);
    }

    modifier contractsAreSet() {
        require(address(randomizer) != address(0)
            && address(legion) != address(0)
            && address(magic) != address(0)
            && address(lp) != address(0)
            && address(treasury) != address(0)
            && address(consumable) != address(0)
            && address(legionMetadataStore) != address(0), "Contracts aren't set");

        _;
    }
}

File 10 of 34 : SummoningState.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol";

import "../../shared/randomizer/IRandomizer.sol";
import "./ISummoning.sol";
import "../../shared/AdminableUpgradeable.sol";
import "../legion/ILegion.sol";
import "../legionmetadatastore/ILegionMetadataStore.sol";
import "../starlighttemple/IStarlightTemple.sol";
import "../treasury/ITreasury.sol";
import "../consumable/IConsumable.sol";
import "../external/IMagic.sol";
import "../external/ILP.sol";

abstract contract SummoningState is Initializable, ISummoning, ERC721HolderUpgradeable, ERC1155HolderUpgradeable, AdminableUpgradeable {

    event SummoningStarted(address indexed _user, uint256 indexed _tokenId, uint256 indexed _requestId, uint256 _finishTime);
    event NoSummoningToFinish(address indexed _user);
    event SummoningFinished(address indexed _user, uint256 indexed _returnedId, uint256 indexed _newTokenId, uint256 _newTokenSummoningCooldown);

    IRandomizer public randomizer;
    ILegion public legion;
    ILegionMetadataStore public legionMetadataStore;
    IMagic public magic;
    ILP public lp;
    ITreasury public treasury;
    IConsumable public consumable;

    mapping(uint256 => uint32) public tokenIdToSummonCount;
    uint256 public summoningDuration;

    mapping(LegionGeneration => uint32) public generationToMaxSummons;

    // For a given rarity (gen 0 Special) and generation, these are the odds each rarity can be summoned. Out of 100000
    mapping(LegionRarity => mapping(LegionGeneration => mapping(LegionRarity => uint256))) public rarityToGenerationToOddsPerRarity;

    mapping(LegionGeneration => SummoningStep[]) public generationToLPRequiredSteps;

    // Chance is out 100,000
    uint256 public chanceAzuriteDustDrop;

    mapping(address => EnumerableSetUpgradeable.UintSet) internal userToSummoningsInProgress;

    mapping(uint256 => uint256) public tokenIdToSummonStartTime;
    // Token ID -> Random number request ID.
    mapping(uint256 => uint256) public tokenIdToRequestId;

    mapping(uint256 => uint256) public tokenIdToLPStaked;

    mapping(uint256 => uint256) public tokenIdToCrystalIdUsed;

    // Tracks when a legion was created via summoning. There is an extra cooldown
    // for summoned legions to avoid summoning themselves.
    mapping(uint256 => uint256) public tokenIdToCreatedTime;

    EnumerableSetUpgradeable.UintSet internal crystalIds;
    // Crystal Id => the amount common is reduced, the amount uncommon is increased, and
    // the amount rare is increased. Odds are in terms of 100000
    mapping(uint256 => uint256[3]) public crystalIdToChangedOdds;

    uint256 public summoningFatigueCooldown;

    uint256 public azuriteDustId;

    mapping(LegionGeneration => uint256) public generationToMagicCost;

    bool public isSummoningPaused;

    function __SummoningState_init() internal initializer {
        AdminableUpgradeable.__Adminable_init();
        ERC721HolderUpgradeable.__ERC721Holder_init();
        ERC1155HolderUpgradeable.__ERC1155Holder_init();

        summoningDuration = 7 days;
        chanceAzuriteDustDrop = 10;
        generationToMaxSummons[LegionGeneration.AUXILIARY] = 1;
        generationToMaxSummons[LegionGeneration.GENESIS] = uint32(2**32 - 1);

        // Input Common
        rarityToGenerationToOddsPerRarity[LegionRarity.COMMON][LegionGeneration.GENESIS][LegionRarity.COMMON] = 90000;
        rarityToGenerationToOddsPerRarity[LegionRarity.COMMON][LegionGeneration.GENESIS][LegionRarity.UNCOMMON] = 9000;
        rarityToGenerationToOddsPerRarity[LegionRarity.COMMON][LegionGeneration.GENESIS][LegionRarity.RARE] = 1000;

        rarityToGenerationToOddsPerRarity[LegionRarity.COMMON][LegionGeneration.AUXILIARY][LegionRarity.COMMON] = 100000;
        rarityToGenerationToOddsPerRarity[LegionRarity.COMMON][LegionGeneration.AUXILIARY][LegionRarity.UNCOMMON] = 0;
        rarityToGenerationToOddsPerRarity[LegionRarity.COMMON][LegionGeneration.AUXILIARY][LegionRarity.RARE] = 0;

        // Input Uncommon
        rarityToGenerationToOddsPerRarity[LegionRarity.UNCOMMON][LegionGeneration.GENESIS][LegionRarity.COMMON] = 80000;
        rarityToGenerationToOddsPerRarity[LegionRarity.UNCOMMON][LegionGeneration.GENESIS][LegionRarity.UNCOMMON] = 15000;
        rarityToGenerationToOddsPerRarity[LegionRarity.UNCOMMON][LegionGeneration.GENESIS][LegionRarity.RARE] = 5000;

        rarityToGenerationToOddsPerRarity[LegionRarity.UNCOMMON][LegionGeneration.AUXILIARY][LegionRarity.COMMON] = 95000;
        rarityToGenerationToOddsPerRarity[LegionRarity.UNCOMMON][LegionGeneration.AUXILIARY][LegionRarity.UNCOMMON] = 5000;
        rarityToGenerationToOddsPerRarity[LegionRarity.UNCOMMON][LegionGeneration.AUXILIARY][LegionRarity.RARE] = 0;

        // Input Rare
        rarityToGenerationToOddsPerRarity[LegionRarity.RARE][LegionGeneration.GENESIS][LegionRarity.COMMON] = 75000;
        rarityToGenerationToOddsPerRarity[LegionRarity.RARE][LegionGeneration.GENESIS][LegionRarity.UNCOMMON] = 18000;
        rarityToGenerationToOddsPerRarity[LegionRarity.RARE][LegionGeneration.GENESIS][LegionRarity.RARE] = 7000;

        rarityToGenerationToOddsPerRarity[LegionRarity.RARE][LegionGeneration.AUXILIARY][LegionRarity.COMMON] = 90000;
        rarityToGenerationToOddsPerRarity[LegionRarity.RARE][LegionGeneration.AUXILIARY][LegionRarity.UNCOMMON] = 9000;
        rarityToGenerationToOddsPerRarity[LegionRarity.RARE][LegionGeneration.AUXILIARY][LegionRarity.RARE] = 1000;

        // Input Special
        rarityToGenerationToOddsPerRarity[LegionRarity.SPECIAL][LegionGeneration.GENESIS][LegionRarity.COMMON] = 85000;
        rarityToGenerationToOddsPerRarity[LegionRarity.SPECIAL][LegionGeneration.GENESIS][LegionRarity.UNCOMMON] = 12000;
        rarityToGenerationToOddsPerRarity[LegionRarity.SPECIAL][LegionGeneration.GENESIS][LegionRarity.RARE] = 3000;

        // Input Legendary
        rarityToGenerationToOddsPerRarity[LegionRarity.LEGENDARY][LegionGeneration.GENESIS][LegionRarity.COMMON] = 70000;
        rarityToGenerationToOddsPerRarity[LegionRarity.LEGENDARY][LegionGeneration.GENESIS][LegionRarity.UNCOMMON] = 20000;
        rarityToGenerationToOddsPerRarity[LegionRarity.LEGENDARY][LegionGeneration.GENESIS][LegionRarity.RARE] = 10000;

        // Auxiliary never costs LP, but has a max summons of 1.
        generationToLPRequiredSteps[LegionGeneration.AUXILIARY].push(SummoningStep(0, 0, uint32(2**32 - 1)));

        generationToLPRequiredSteps[LegionGeneration.GENESIS].push(SummoningStep(0, 0, 5));
        generationToLPRequiredSteps[LegionGeneration.GENESIS].push(SummoningStep(10 ether, 6, 10));
        generationToLPRequiredSteps[LegionGeneration.GENESIS].push(SummoningStep(30 ether, 11, 15));
        generationToLPRequiredSteps[LegionGeneration.GENESIS].push(SummoningStep(50 ether, 16, uint32(2**32 - 1)));

        summoningFatigueCooldown = 7 days;

        generationToMagicCost[LegionGeneration.GENESIS] = 300 ether;
        generationToMagicCost[LegionGeneration.AUXILIARY] = 500 ether;
    }
}

struct SummoningStep {
    uint256 value;
    uint32 minSummons;
    uint32 maxSummons;
}

File 11 of 34 : ERC721HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721ReceiverUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
    function __ERC721Holder_init() internal onlyInitializing {
        __ERC721Holder_init_unchained();
    }

    function __ERC721Holder_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
    uint256[50] private __gap;
}

File 12 of 34 : ERC1155HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

import "./ERC1155ReceiverUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev _Available since v3.1._
 */
contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable {
    function __ERC1155Holder_init() internal onlyInitializing {
        __ERC165_init_unchained();
        __ERC1155Receiver_init_unchained();
        __ERC1155Holder_init_unchained();
    }

    function __ERC1155Holder_init_unchained() internal onlyInitializing {
    }
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
    uint256[50] private __gap;
}

File 13 of 34 : IRandomizer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IRandomizer {

    // Sets the number of blocks that must pass between increment the commitId and seeding the random
    // Admin
    function setNumBlocksAfterIncrement(uint8 _numBlocksAfterIncrement) external;

    // Increments the commit id.
    // Admin
    function incrementCommitId() external;

    // Adding the random number needs to be done AFTER incrementing the commit id on a separate transaction. If
    // these are done together, there is a potential vulnerability to front load a commit when the bad actor
    // sees the value of the random number.
    function addRandomForCommit(uint256 _seed) external;

    // Returns a request ID for a random number. This is unique.
    function requestRandomNumber() external returns(uint256);

    // Returns the random number for the given request ID. Will revert
    // if the random is not ready.
    function revealRandomNumber(uint256 _requestId) external view returns(uint256);

    // Returns if the random number for the given request ID is ready or not. Call
    // before calling revealRandomNumber.
    function isRandomReady(uint256 _requestId) external view returns(bool);
}

File 14 of 34 : ISummoning.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ISummoning {

}

File 15 of 34 : AdminableUpgradeable.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./UtilitiesUpgradeable.sol";

// Do not add state to this contract.
//
contract AdminableUpgradeable is UtilitiesUpgradeable {

    mapping(address => bool) private admins;

    function __Adminable_init() internal initializer {
        UtilitiesUpgradeable.__Utilities__init();
    }

    function addAdmin(address _address) external onlyOwner {
        admins[_address] = true;
    }

    function addAdmins(address[] calldata _addresses) external onlyOwner {
        for(uint256 i = 0; i < _addresses.length; i++) {
            admins[_addresses[i]] = true;
        }
    }

    function removeAdmin(address _address) external onlyOwner {
        admins[_address] = false;
    }

    function removeAdmins(address[] calldata _addresses) external onlyOwner {
        for(uint256 i = 0; i < _addresses.length; i++) {
            admins[_addresses[i]] = false;
        }
    }

    function setPause(bool _shouldPause) external onlyAdminOrOwner {
        if(_shouldPause) {
            _pause();
        } else {
            _unpause();
        }
    }

    function isAdmin(address _address) public view returns(bool) {
        return admins[_address];
    }

    modifier onlyAdmin() {
        require(admins[msg.sender], "Not admin");
        _;
    }

    modifier onlyAdminOrOwner() {
        require(admins[msg.sender] || isOwner(), "Not admin or owner");
        _;
    }

    uint256[50] private __gap;
}

File 16 of 34 : ILegion.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol";

interface ILegion is IERC721MetadataUpgradeable {

    // Mints a legion to the given address. Returns the token ID.
    // Admin only.
    function safeMint(address _to) external returns(uint256);

    // Sets the URI for the given token id. Token must exist.
    // Admin only.
    function setTokenURI(uint256 _tokenId, string calldata _tokenURI) external;

    // Transfers the token to the given address. Does not need approval. _from still must be the owner of the token.
    // Admin only.
    function adminSafeTransferFrom(address _from, address _to, uint256 _tokenId) external;
}

File 17 of 34 : IStarlightTemple.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IStarlightTemple {

    // Increases a specific number of constellations to the max rank
    //
    function maxRankOfConstellations(uint256 _tokenId, uint8 _numberOfConstellations) external;
}

File 18 of 34 : ITreasury.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ITreasury {

    function isBridgeWorldPowered() external view returns(bool);

    function forwardCoinsToMine(uint256 _totalMagicSent) external;
}

File 19 of 34 : IConsumable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol";

interface IConsumable is IERC1155Upgradeable {

    function mint(address _to, uint256 _id, uint256 _amount) external;

    function burn(address account, uint256 id, uint256 value) external;

    function burnBatch(address account, uint256[] memory ids, uint256[] memory values) external;

    function adminSafeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount) external;

    function adminSafeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts) external;
}

File 20 of 34 : IMagic.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IMagic {

    // Transfers the given amount to the recipient's wallet. Returns a boolean indicating if it was
    // successful or not.
    function transferFrom(address _sender, address _recipient, uint256 _amount) external returns(bool);

    // Transfer the given amount to the recipient's wallet. The sender is the caller of this function.
    // Returns a boolean indicating if it was successful or not.
    function transfer(address _recipient, uint256 _amount) external returns(bool);

    function approve(address _spender, uint256 _amount) external returns(bool);
}

File 21 of 34 : ILP.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ILP {

    // Transfers the given amount to the recipient's wallet. Returns a boolean indicating if it was
    // successful or not.
    function transferFrom(address _sender, address _recipient, uint256 _amount) external returns(bool);

    // Transfer the given amount to the recipient's wallet. The sender is the caller of this function.
    // Returns a boolean indicating if it was successful or not.
    function transfer(address _recipient, uint256 _amount) external returns(bool);
}

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

pragma solidity ^0.8.0;

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

File 23 of 34 : ERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../IERC1155ReceiverUpgradeable.sol";
import "../../../utils/introspection/ERC165Upgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155ReceiverUpgradeable is Initializable, ERC165Upgradeable, IERC1155ReceiverUpgradeable {
    function __ERC1155Receiver_init() internal onlyInitializing {
        __ERC165_init_unchained();
        __ERC1155Receiver_init_unchained();
    }

    function __ERC1155Receiver_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
        return interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }
    uint256[50] private __gap;
}

File 24 of 34 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 25 of 34 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
        __ERC165_init_unchained();
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.0;

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

File 27 of 34 : UtilitiesUpgradeable.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

contract UtilitiesUpgradeable is Initializable, OwnableUpgradeable, PausableUpgradeable {

    function __Utilities__init() internal initializer {
        OwnableUpgradeable.__Ownable_init();
        PausableUpgradeable.__Pausable_init();

        _pause();
    }

    modifier nonZeroAddress(address _address) {
        require(address(0) != _address, "0 address");
        _;
    }

    modifier nonZeroLength(uint[] memory _array) {
        require(_array.length > 0, "Empty array");
        _;
    }

    modifier lengthsAreEqual(uint[] memory _array1, uint[] memory _array2) {
        require(_array1.length == _array2.length, "Unequal lengths");
        _;
    }

    modifier onlyEOA() {
        /* solhint-disable avoid-tx-origin */
        require(msg.sender == tx.origin, "No contracts");
        _;
    }

    function isOwner() internal view returns(bool) {
        return owner() == msg.sender;
    }
}

File 28 of 34 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

File 29 of 34 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
    uint256[49] private __gap;
}

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @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 32 of 34 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 33 of 34 : LegionMetadataStoreState.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "../../shared/AdminableUpgradeable.sol";
import "./ILegionMetadataStore.sol";

abstract contract LegionMetadataStoreState is Initializable, AdminableUpgradeable {

    event LegionQuestLevelUp(uint256 indexed _tokenId, uint8 _questLevel);
    event LegionCraftLevelUp(uint256 indexed _tokenId, uint8 _craftLevel);
    event LegionConstellationRankUp(uint256 indexed _tokenId, Constellation indexed _constellation, uint8 _rank);
    event LegionCreated(address indexed _owner, uint256 indexed _tokenId, LegionGeneration _generation, LegionClass _class, LegionRarity _rarity);

    mapping(uint256 => LegionGeneration) internal idToGeneration;
    mapping(uint256 => LegionClass) internal idToClass;
    mapping(uint256 => LegionRarity) internal idToRarity;
    mapping(uint256 => uint256) internal idToOldId;
    mapping(uint256 => uint8) internal idToQuestLevel;
    mapping(uint256 => uint8) internal idToCraftLevel;
    mapping(uint256 => uint8[6]) internal idToConstellationRanks;

    mapping(LegionGeneration => mapping(LegionClass => mapping(LegionRarity => mapping(uint256 => string)))) internal _genToClassToRarityToOldIdToUri;

    function __LegionMetadataStoreState_init() internal initializer {
        AdminableUpgradeable.__Adminable_init();
    }
}

File 34 of 34 : IERC1155Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155Upgradeable is IERC165Upgradeable {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"}],"name":"NoSummoningToFinish","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"uint256","name":"_returnedId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_newTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newTokenSummoningCooldown","type":"uint256"}],"name":"SummoningFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_finishTime","type":"uint256"}],"name":"SummoningStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"addAdmins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"azuriteDustId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chanceAzuriteDustDrop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"consumable","outputs":[{"internalType":"contract IConsumable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"crystalIdToChangedOdds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finishSummon","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"finishSummonTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum LegionGeneration","name":"","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"generationToLPRequiredSteps","outputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32","name":"minSummons","type":"uint32"},{"internalType":"uint32","name":"maxSummons","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum LegionGeneration","name":"","type":"uint8"}],"name":"generationToMagicCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum LegionGeneration","name":"","type":"uint8"}],"name":"generationToMaxSummons","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSummoningPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isTokenDoneSummoning","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legion","outputs":[{"internalType":"contract ILegion","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legionMetadataStore","outputs":[{"internalType":"contract ILegionMetadataStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lp","outputs":[{"internalType":"contract ILP","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"magic","outputs":[{"internalType":"contract IMagic","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomizer","outputs":[{"internalType":"contract IRandomizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum LegionRarity","name":"","type":"uint8"},{"internalType":"enum LegionGeneration","name":"","type":"uint8"},{"internalType":"enum LegionRarity","name":"","type":"uint8"}],"name":"rarityToGenerationToOddsPerRarity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"removeAdmins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_legionAddress","type":"address"},{"internalType":"address","name":"_legionMetadataStoreAddress","type":"address"},{"internalType":"address","name":"_randomizerAddress","type":"address"},{"internalType":"address","name":"_lpAddress","type":"address"},{"internalType":"address","name":"_magicAddress","type":"address"},{"internalType":"address","name":"_treasuryAddress","type":"address"},{"internalType":"address","name":"_consumableAddress","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_crystalIds","type":"uint256[]"},{"internalType":"uint256[3][]","name":"_crystalIdToOdds","type":"uint256[3][]"}],"name":"setCrystalOdds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isSummoningPaused","type":"bool"}],"name":"setIsSummoningPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32","name":"minSummons","type":"uint32"},{"internalType":"uint32","name":"maxSummons","type":"uint32"}],"internalType":"struct SummoningStep[]","name":"_auxiliarySteps","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32","name":"minSummons","type":"uint32"},{"internalType":"uint32","name":"maxSummons","type":"uint32"}],"internalType":"struct SummoningStep[]","name":"_genesisSteps","type":"tuple[]"}],"name":"setLPSteps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_shouldPause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_summoningDuration","type":"uint256"},{"internalType":"uint256","name":"_genesisMagicCost","type":"uint256"},{"internalType":"uint256","name":"_auxiliaryMagicCost","type":"uint256"},{"internalType":"uint32","name":"_auxiliaryMaxSummons","type":"uint32"},{"internalType":"uint32","name":"_genesisMaxSummons","type":"uint32"},{"internalType":"uint256","name":"_chanceAzuriteDustDrop","type":"uint256"},{"internalType":"uint256","name":"_azuriteDustId","type":"uint256"}],"name":"setSimpleSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_summoningFatigueCooldown","type":"uint256"}],"name":"setSummoningFatigue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum LegionRarity[]","name":"_inputRarities","type":"uint8[]"},{"internalType":"uint256[]","name":"_genesisOdds","type":"uint256[]"},{"internalType":"uint256[]","name":"_auxiliaryOdds","type":"uint256[]"}],"name":"setSummoningOdds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_crystalIds","type":"uint256[]"}],"name":"startSummon","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"summoningDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"summoningFatigueCooldown","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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToCreatedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToCrystalIdUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToLPStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToSummonCount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToSummonStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"contract ITreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50614d52806100206000396000f3fe608060405234801561001057600080fd5b50600436106102bb5760003560e01c80637048027511610182578063b866b692116100e9578063d7dfe4dd116100a2578063f23a6e611161007c578063f23a6e6114610724578063f2fde38b14610743578063fadab21914610756578063ffd0d14d1461076957600080fd5b8063d7dfe4dd146106f2578063dfa43d3214610706578063f10fb5841461071057600080fd5b8063b866b69214610647578063bc197c8114610679578063bedb86fb14610698578063ca3789ca146106ab578063ccbb4225146106be578063d3ff95c7146106df57600080fd5b806391c96bf51161013b57806391c96bf5146105b3578063939a7fa1146105da5780639c54df64146105ed578063a56cb6dd14610600578063ad402cc314610613578063ad72e1a51461062657600080fd5b80637048027514610558578063715018a61461056b57806378c4a045146105735780638129fc1c146105865780638a7bf8041461058e5780638da5cb5b146105a257600080fd5b8063192be23311610226578063377e11e0116101df578063377e11e0146104e65780635772d5b2146104f95780635c975abb146105035780635fce51a31461050f57806361d027b314610530578063675857eb1461054457600080fd5b8063192be2331461042b57806324d7806c1461043e57806327f6eb8e1461046b57806329570f411461048c578063313c06a014610496578063340c2ca7146104aa57600080fd5b80630d854646116102785780630d854646146103605780630ebe11961461038c57806310e12640146103ad578063150b7a02146103c05780631785f53c146103f757806318d939e81461040a57600080fd5b806301ffc9a7146102c0578063021946db146102e8578063037a528b146102f657806309bfac0d1461030e5780630b10338f146103185780630c6263a51461032b575b600080fd5b6102d36102ce36600461408d565b61077c565b60405190151581526020015b60405180910390f35b6101ab546102d39060ff1681565b61030061019a5481565b6040519081526020016102df565b6103166107b3565b005b6103006103263660046140b7565b6108db565b61033e6103393660046140e6565b610901565b6040805193845263ffffffff92831660208501529116908201526060016102df565b61019554610374906001600160a01b031681565b6040516001600160a01b0390911681526020016102df565b61030061039a366004614112565b6101a36020526000908152604090205481565b6103166103bb36600461416f565b610950565b6103de6103ce3660046142d3565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016102df565b61031661040536600461433a565b610ed3565b610300610418366004614112565b6101a46020526000908152604090205481565b610316610439366004614363565b610f1f565b6102d361044c36600461433a565b6001600160a01b0316600090815261015f602052604090205460ff1690565b610300610479366004614112565b6101a26020526000908152604090205481565b6103006101a95481565b61019654610374906001600160a01b031681565b6104d16104b8366004614380565b61019b6020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016102df565b6103166104f436600461439d565b610f71565b61030061019e5481565b61012d5460ff166102d3565b61030061051d366004614112565b6101a06020526000908152604090205481565b61019754610374906001600160a01b031681565b61019354610374906001600160a01b031681565b61031661056636600461433a565b611013565b610316611062565b6102d3610581366004614112565b611098565b6103166110c0565b61019454610374906001600160a01b031681565b60fb546001600160a01b0316610374565b6104d16105c1366004614112565b6101996020526000908152604090205463ffffffff1681565b6103166105e8366004614112565b611139565b6103166105fb36600461439d565b61117d565b61031661060e3660046143de565b61121a565b61031661062136600461439d565b6117c2565b610300610634366004614112565b6101a16020526000908152604090205481565b610300610655366004614484565b61019c60209081526000938452604080852082529284528284209052825290205481565b6103de61068736600461454e565b63bc197c8160e01b95945050505050565b6103166106a6366004614363565b611a0f565b6103166106b936600461463b565b611a63565b6103006106cc366004614380565b6101aa6020526000908152604090205481565b6103166106ed36600461469a565b611bd1565b61019854610374906001600160a01b031681565b6103006101a85481565b61019254610374906001600160a01b031681565b6103de610732366004614720565b63f23a6e6160e01b95945050505050565b61031661075136600461433a565b611c92565b610316610764366004614784565b611d2a565b6103166107773660046147cf565b611f72565b60006001600160e01b03198216630271189760e51b14806107ad57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61012d5460ff16156107e05760405162461bcd60e51b81526004016107d790614837565b60405180910390fd5b610192546001600160a01b0316158015906108065750610193546001600160a01b031615155b801561081d5750610195546001600160a01b031615155b80156108345750610196546001600160a01b031615155b801561084b5750610197546001600160a01b031615155b80156108625750610198546001600160a01b031615155b80156108795750610194546001600160a01b031615155b6108955760405162461bcd60e51b81526004016107d790614861565b3332146108b45760405162461bcd60e51b81526004016107d79061488f565b33600090815261019f602052604081206108cd906120c2565b90506108d8816120d6565b50565b6101a760205281600052604060002081600381106108f857600080fd5b01549150829050565b61019d602052816000526040600020818154811061091e57600080fd5b60009182526020909120600290910201805460019091015490925063ffffffff80821692506401000000009091041683565b838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251151591506109c390505760405162461bcd60e51b815260206004820152600b60248201526a456d70747920617272617960a81b60448201526064016107d7565b61012d5460ff16156109e75760405162461bcd60e51b81526004016107d790614837565b610192546001600160a01b031615801590610a0d5750610193546001600160a01b031615155b8015610a245750610195546001600160a01b031615155b8015610a3b5750610196546001600160a01b031615155b8015610a525750610197546001600160a01b031615155b8015610a695750610198546001600160a01b031615155b8015610a805750610194546001600160a01b031615155b610a9c5760405162461bcd60e51b81526004016107d790614861565b333214610abb5760405162461bcd60e51b81526004016107d79061488f565b6101ab5460ff1615610b0f5760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e673a2053756d6d6f6e696e6720697320706175736564000060448201526064016107d7565b838214610b5e5760405162461bcd60e51b815260206004820181905260248201527f4372797374616c20616e6420546f6b656e73206d75737420626520657175616c60448201526064016107d7565b61019760009054906101000a90046001600160a01b03166001600160a01b031663ca1709556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bad57600080fd5b505afa158015610bc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be591906148b5565b610c315760405162461bcd60e51b815260206004820152601860248201527f42726964676520576f726c64206e6f7420706f7765726564000000000000000060448201526064016107d7565b60008060005b86811015610cae57600080610c7c8a8a85818110610c5757610c576148d2565b90506020020135898986818110610c7057610c706148d2565b90506020020135612278565b9092509050610c8b82866148fe565b9450610c9781856148fe565b935050508080610ca690614916565b915050610c37565b508015610df35761019554610197546040516323b872dd60e01b81526000926001600160a01b03908116926323b872dd92610cf192339216908790600401614931565b602060405180830381600087803b158015610d0b57600080fd5b505af1158015610d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4391906148b5565b905080610d925760405162461bcd60e51b815260206004820152601860248201527f4d61676963206661696c656420746f207472616e73666572000000000000000060448201526064016107d7565b610197546040516359193fc560e01b8152600481018490526001600160a01b03909116906359193fc590602401600060405180830381600087803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b50505050505b8115610eca57610196546040516323b872dd60e01b81526000916001600160a01b0316906323b872dd90610e2f90339030908890600401614931565b602060405180830381600087803b158015610e4957600080fd5b505af1158015610e5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8191906148b5565b905080610ec85760405162461bcd60e51b81526020600482015260156024820152742628103330b4b632b2103a37903a3930b739b332b960591b60448201526064016107d7565b505b50505050505050565b60fb546001600160a01b03163314610efd5760405162461bcd60e51b81526004016107d790614955565b6001600160a01b0316600090815261015f60205260409020805460ff19169055565b33600090815261015f602052604090205460ff1680610f415750610f41612756565b610f5d5760405162461bcd60e51b81526004016107d79061498a565b6101ab805460ff1916911515919091179055565b60fb546001600160a01b03163314610f9b5760405162461bcd60e51b81526004016107d790614955565b60005b8181101561100e57600061015f6000858585818110610fbf57610fbf6148d2565b9050602002016020810190610fd4919061433a565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061100681614916565b915050610f9e565b505050565b60fb546001600160a01b0316331461103d5760405162461bcd60e51b81526004016107d790614955565b6001600160a01b0316600090815261015f60205260409020805460ff19166001179055565b60fb546001600160a01b0316331461108c5760405162461bcd60e51b81526004016107d790614955565b611096600061277a565b565b61019a5460008281526101a0602052604081205490916110b7916148fe565b42101592915050565b600054610100900460ff166110db5760005460ff16156110df565b303b155b6110fb5760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff1615801561111d576000805461ffff19166101011790555b6111256127cc565b80156108d8576000805461ff001916905550565b33600090815261015f602052604090205460ff168061115b575061115b612756565b6111775760405162461bcd60e51b81526004016107d79061498a565b6101a855565b60fb546001600160a01b031633146111a75760405162461bcd60e51b81526004016107d790614955565b60005b8181101561100e57600161015f60008585858181106111cb576111cb6148d2565b90506020020160208101906111e0919061433a565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061121281614916565b9150506111aa565b33600090815261015f602052604090205460ff168061123c575061123c612756565b6112585760405162461bcd60e51b81526004016107d79061498a565b8415801590611270575061126d856003614a04565b83145b801561127b57508083145b6112b85760405162461bcd60e51b815260206004820152600e60248201526d42616420696e707574206461746160901b60448201526064016107d7565b60005b85811015610eca5760008787838181106112d7576112d76148d2565b90506020020160208101906112ec9190614a23565b905085856112fb846003614a04565b81811061130a5761130a6148d2565b9050602002013561019c600083600581111561132857611328614a40565b600581111561133957611339614a40565b8152602001908152602001600020600080600281111561135b5761135b614a40565b600281111561136c5761136c614a40565b815260200190815260200160002060006004600581111561138f5761138f614a40565b60058111156113a0576113a0614a40565b815260208101919091526040016000205585856113be846003614a04565b6113c99060016148fe565b8181106113d8576113d86148d2565b9050602002013561019c60008360058111156113f6576113f6614a40565b600581111561140757611407614a40565b8152602001908152602001600020600080600281111561142957611429614a40565b600281111561143a5761143a614a40565b815260200190815260200160002060006003600581111561145d5761145d614a40565b600581111561146e5761146e614a40565b8152602081019190915260400160002055858561148c846003614a04565b6114979060026148fe565b8181106114a6576114a66148d2565b9050602002013561019c60008360058111156114c4576114c4614a40565b60058111156114d5576114d5614a40565b815260200190815260200160002060008060028111156114f7576114f7614a40565b600281111561150857611508614a40565b815260200190815260200160002060006001600581111561152b5761152b614a40565b600581111561153c5761153c614a40565b8152602081019190915260400160002055838361155a846003614a04565b818110611569576115696148d2565b9050602002013561019c600083600581111561158757611587614a40565b600581111561159857611598614a40565b81526020019081526020016000206000600160028111156115bb576115bb614a40565b60028111156115cc576115cc614a40565b81526020019081526020016000206000600460058111156115ef576115ef614a40565b600581111561160057611600614a40565b8152602081019190915260400160002055838361161e846003614a04565b6116299060016148fe565b818110611638576116386148d2565b9050602002013561019c600083600581111561165657611656614a40565b600581111561166757611667614a40565b815260200190815260200160002060006001600281111561168a5761168a614a40565b600281111561169b5761169b614a40565b81526020019081526020016000206000600360058111156116be576116be614a40565b60058111156116cf576116cf614a40565b815260208101919091526040016000205583836116ed846003614a04565b6116f89060026148fe565b818110611707576117076148d2565b9050602002013561019c600083600581111561172557611725614a40565b600581111561173657611736614a40565b815260200190815260200160002060006001600281111561175957611759614a40565b600281111561176a5761176a614a40565b815260200190815260200160002060006001600581111561178d5761178d614a40565b600581111561179e5761179e614a40565b815260208101919091526040016000205550806117ba81614916565b9150506112bb565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061183590505760405162461bcd60e51b815260206004820152600b60248201526a456d70747920617272617960a81b60448201526064016107d7565b61012d5460ff16156118595760405162461bcd60e51b81526004016107d790614837565b610192546001600160a01b03161580159061187f5750610193546001600160a01b031615155b80156118965750610195546001600160a01b031615155b80156118ad5750610196546001600160a01b031615155b80156118c45750610197546001600160a01b031615155b80156118db5750610198546001600160a01b031615155b80156118f25750610194546001600160a01b031615155b61190e5760405162461bcd60e51b81526004016107d790614861565b33321461192d5760405162461bcd60e51b81526004016107d79061488f565b60005b828110156119d25761197f84848381811061194d5761194d6148d2565b33600090815261019f602090815260409091209391020135905060009081526001919091016020526040902054151590565b6119c05760405162461bcd60e51b81526020600482015260126024820152712237b2b9903737ba1037bbb7103a37b5b2b760711b60448201526064016107d7565b806119ca81614916565b915050611930565b5061100e8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506120d692505050565b33600090815261015f602052604090205460ff1680611a315750611a31612756565b611a4d5760405162461bcd60e51b81526004016107d79061498a565b8015611a5b576108d8612831565b6108d86128a8565b33600090815261015f602052604090205460ff1680611a855750611a85612756565b611aa15760405162461bcd60e51b81526004016107d79061498a565b828114611ade5760405162461bcd60e51b815260206004820152600b60248201526a426164206c656e6774687360a81b60448201526064016107d7565b6101a560008181611aef828261400d565b5050505060005b83811015611bca57611b2b858583818110611b1357611b136148d2565b905060200201356101a561292490919063ffffffff16565b5060005b6003811015611bb757838383818110611b4a57611b4a6148d2565b9050606002018160038110611b6157611b616148d2565b60200201356101a76000888886818110611b7d57611b7d6148d2565b9050602002013581526020019081526020016000208260038110611ba357611ba36148d2565b015580611baf81614916565b915050611b2f565b5080611bc281614916565b915050611af6565b5050505050565b33600090815261015f602052604090205460ff1680611bf35750611bf3612756565b611c0f5760405162461bcd60e51b81526004016107d79061498a565b61019280546001600160a01b03199081166001600160a01b039788161790915561019380548216988716989098179097556101948054881696861696909617909555610195805487169285169290921790915561019680548616928416929092179091556101978054851691831691909117905561019880549093169116179055565b60fb546001600160a01b03163314611cbc5760405162461bcd60e51b81526004016107d790614955565b6001600160a01b038116611d215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107d7565b6108d88161277a565b33600090815261015f602052604090205460ff1680611d4c5750611d4c612756565b611d685760405162461bcd60e51b81526004016107d79061498a565b82611dab5760405162461bcd60e51b815260206004820152601360248201527242616420617578696c6961727920737465707360681b60448201526064016107d7565b80611dec5760405162461bcd60e51b81526020600482015260116024820152704261642067656e6573697320737465707360781b60448201526064016107d7565b6001600090815261019d602052611e24907f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff9061402b565b600080805261019d602052611e5a907f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d9061402b565b60005b83811015611ee657600160005261019d6020527f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff858583818110611ea357611ea36148d2565b835460018101855560009485526020909420606090910292909201926002029091019050611ed18282614a56565b50508080611ede90614916565b915050611e5d565b5060005b81811015611bca576000805261019d6020527f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d838383818110611f2f57611f2f6148d2565b835460018101855560009485526020909420606090910292909201926002029091019050611f5d8282614a56565b50508080611f6a90614916565b915050611eea565b33600090815261015f602052604090205460ff1680611f945750611f94612756565b611fb05760405162461bcd60e51b81526004016107d79061498a565b620186a0821115611ff65760405162461bcd60e51b815260206004820152601060248201526f42616420617a7572697465206f64647360801b60448201526064016107d7565b61019a9690965561019e556101a9949094557f04d43b951d4b9841d09fb89cef478e37e6998a75d7f9d1fc96bb4384cfcd3c3b919091557f72a6c68455ff49f07ee58e8d48ef255a5d3d0e7e858ddaa2a08c6674acc4146b9190915561019b6020527f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef805463ffffffff92831663ffffffff1991821617909155600080527f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a6578054929093169116179055565b606060006120cf83612930565b9392505050565b60008060005b83518110156121b55760008482815181106120f9576120f96148d2565b6020026020010151905060008061210f8361298c565b915091508160001461219f578561212581614916565b9650612133905081866148fe565b33600090815261019f602052604090209095506121509084612eea565b508183336001600160a01b03167f57fb6651407add325798886abde3bb5570b272ab228220645c3046def1a620646101a8544261218d91906148fe565b60405190815260200160405180910390a45b50505080806121ad90614916565b9150506120dc565b508015612243576101965460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b15801561220957600080fd5b505af115801561221d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224191906148b5565b505b8161100e5760405133907f7ba5eb84b9ee87cb4d1f1aa87b156d8d54c57af8e0490cf9bac9a038969f13e590600090a2505050565b6101a85460008381526101a460205260408120549091829161229a91906148fe565b4210156122e95760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e672066617469677565207374696c6c20616374697665000060448201526064016107d7565b610194546040516378afdef960e11b8152600481018690526000916001600160a01b03169063f15fbdf2906024016101806040518083038186803b15801561233057600080fd5b505afa158015612344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123689190614b47565b905060028151600281111561237f5761237f614a40565b14156123cd5760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f742073756d6d6f6e2077697468207265637275697400000000000060448201526064016107d7565b600085815261019960205260408120805463ffffffff16918291906123f183614bde565b91906101000a81548163ffffffff021916908363ffffffff1602179055505061019b60008360000151600281111561242b5761242b614a40565b600281111561243c5761243c614a40565b815260208101919091526040016000205463ffffffff9081169082161061249b5760405162461bcd60e51b815260206004820152601360248201527252656163686564206d61782073756d6d6f6e7360681b60448201526064016107d7565b60006124ab836000015183612ef6565b33600090815261019f602052604090209091506124c89088612924565b5060008781526101a06020908152604080832042905561019254815163433c53d960e11b815291516001600160a01b0390911692638678a7b2926004808201939182900301818787803b15801561251e57600080fd5b505af1158015612532573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125569190614c02565b60008981526101a1602090815260408083208490556101a29091529020839055905086156126565760008781526101a660205260409020546125cb5760405162461bcd60e51b815260206004820152600e60248201526d1098590818dc9e5cdd185b08125160921b60448201526064016107d7565b60008881526101a36020526040908190208890556101985461019754915163a878b95d60e01b81523360048201526001600160a01b039283166024820152604481018a90526001606482015291169063a878b95d90608401600060405180830381600087803b15801561263d57600080fd5b505af1158015612651573d6000803e3d6000fd5b505050505b610193546040516383291f8760e01b81526001600160a01b03909116906383291f879061268b90339030908d90600401614931565b600060405180830381600087803b1580156126a557600080fd5b505af11580156126b9573d6000803e3d6000fd5b505050508088336001600160a01b03167fa65bbc6392db72d041caaed384252b6166f63d34c0012bf969b6312e8dddba7461019a54426126f991906148fe565b60405190815260200160405180910390a4816101aa60008660000151600281111561272657612726614a40565b600281111561273757612737614a40565b81526020019081526020016000205495509550505050505b9250929050565b60003361276b60fb546001600160a01b031690565b6001600160a01b031614905090565b60fb80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166127e75760005460ff16156127eb565b303b155b6128075760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff16158015612829576000805461ffff19166101011790555b611125613050565b61012d5460ff16156128555760405162461bcd60e51b81526004016107d790614837565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861288b3390565b6040516001600160a01b03909116815260200160405180910390a1565b61012d5460ff166128f25760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016107d7565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3361288b565b60006120cf83836130b5565b60608160000180548060200260200160405190810160405280929190818152602001828054801561298057602002820191906000526020600020905b81548152602001906001019080831161296c575b50505050509050919050565b60008061299883611098565b6129a757506000928392509050565b60008381526101a16020526040908190205461019254915163f030210760e01b81526004810182905290916001600160a01b03169063f03021079060240160206040518083038186803b1580156129fd57600080fd5b505afa158015612a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3591906148b5565b612a455750600093849350915050565b610194546040516378afdef960e11b8152600481018690526000916001600160a01b03169063f15fbdf2906024016101806040518083038186803b158015612a8c57600080fd5b505afa158015612aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac49190614b47565b61019254604051634ad30a7560e01b8152600481018590529192506000916001600160a01b0390911690634ad30a759060240160206040518083038186803b158015612b0f57600080fd5b505afa158015612b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b479190614c02565b610193546040516340d097c360e01b81523360048201529192506000916001600160a01b03909116906340d097c390602401602060405180830381600087803b158015612b9357600080fd5b505af1158015612ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bcb9190614c02565b90506000612bda600584614c1b565b612be59060016148fe565b6009811115612bf657612bf6614a40565b60008981526101a36020908152604091829020548251918201879052918101869052919250906060016040516020818303038152906040528051906020012060001c93506000612c47858784613104565b610194546040516307d1b76f60e41b81529192506001600160a01b031690637d1b76f090612c85903390889060019089908890600090600401614c3d565b600060405180830381600087803b158015612c9f57600080fd5b505af1158015612cb3573d6000803e3d6000fd5b505050508485604051602001612cd3929190918252602082015260400190565b60408051601f19818403018152919052805160209091012094506000612cfc620186a087614c1b565b905061019e54811015612dce5760006101a95411612d5c5760405162461bcd60e51b815260206004820152601760248201527f417a75726974652044757374204944206e6f742073657400000000000000000060448201526064016107d7565b610198546101a954604051630ab714fb60e11b81523360048201526024810191909152600160448201526001600160a01b039091169063156e29f690606401600060405180830381600087803b158015612db557600080fd5b505af1158015612dc9573d6000803e3d6000fd5b505050505b426101a460008781526020019081526020016000208190555060006101a260008d81526020019081526020016000205490506101a160008d8152602001908152602001600020600090556101a260008d8152602001908152602001600020600090556101a060008d8152602001908152602001600020600090556101a360008d81526020019081526020016000206000905561019360009054906101000a90046001600160a01b03166001600160a01b03166383291f8730338f6040518463ffffffff1660e01b8152600401612ea693929190614931565b600060405180830381600087803b158015612ec057600080fd5b505af1158015612ed4573d6000803e3d6000fd5b50979e929d50919b505050505050505050505050565b60006120cf838361343a565b60008061019d6000856002811115612f1057612f10614a40565b6002811115612f2157612f21614a40565b8152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015612fa757600084815260209081902060408051606081018252600286029092018054835260019081015463ffffffff8082168587015264010000000090910416918301919091529083529092019101612f4f565b50505050905060005b8151811015613012576000828281518110612fcd57612fcd6148d2565b60200260200101519050806040015163ffffffff168563ffffffff161115612ff55750613000565b5192506107ad915050565b8061300a81614916565b915050612fb0565b5060405162461bcd60e51b8152602060048201526012602482015271426164204c5020737465702076616c75657360701b60448201526064016107d7565b600054610100900460ff1661306b5760005460ff161561306f565b303b155b61308b5760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff161580156130ad576000805461ffff19166101011790555b61112561352d565b60008181526001830160205260408120546130fc575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107ad565b5060006107ad565b60008061019c60008560400151600581111561312257613122614a40565b600581111561313357613133614a40565b815260200190815260200160002060008560000151600281111561315957613159614a40565b600281111561316a5761316a614a40565b815260200190815260200160002060006004600581111561318d5761318d614a40565b600581111561319e5761319e614a40565b8152602001908152602001600020549050600061019c6000866040015160058111156131cc576131cc614a40565b60058111156131dd576131dd614a40565b815260200190815260200160002060008660000151600281111561320357613203614a40565b600281111561321457613214614a40565b815260200190815260200160002060006003600581111561323757613237614a40565b600581111561324857613248614a40565b8152602001908152602001600020549050600061019c60008760400151600581111561327657613276614a40565b600581111561328757613287614a40565b81526020019081526020016000206000876000015160028111156132ad576132ad614a40565b60028111156132be576132be614a40565b81526020019081526020016000206000600160058111156132e1576132e1614a40565b60058111156132f2576132f2614a40565b8152602001908152602001600020549050846000146133905760008581526101a76020526040808220815160608101928390529160039082845b81548152602001906001019080831161332c575050505050905080600060038110613359576133596148d2565b60200201516133689085614ca4565b602082015190945061337a90846148fe565b604082015190935061338c90836148fe565b9150505b8061339b83856148fe565b6133a591906148fe565b620186a0146133e85760405162461bcd60e51b815260206004820152600f60248201526e42616420526172697479206f64647360881b60448201526064016107d7565b60006133f7620186a089614c1b565b90508381101561340e5760049450505050506120cf565b61341883856148fe565b81101561342c5760039450505050506120cf565b506001979650505050505050565b6000818152600183016020526040812054801561352357600061345e600183614ca4565b855490915060009061347290600190614ca4565b90508181146134d7576000866000018281548110613492576134926148d2565b90600052602060002001549050808760000184815481106134b5576134b56148d2565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806134e8576134e8614cbb565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506107ad565b60009150506107ad565b600054610100900460ff166135485760005460ff161561354c565b303b155b6135685760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff1615801561358a576000805461ffff19166101011790555b611125600054610100900460ff166135a85760005460ff16156135ac565b303b155b6135c85760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff161580156135ea576000805461ffff19166101011790555b611125600054610100900460ff166136085760005460ff161561360c565b303b155b6136285760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff1615801561364a576000805461ffff19166101011790555b613652613dd4565b61365a613e39565b613662613e68565b62093a8061019a55600a61019e8190557f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef8054600163ffffffff1991821681179092557f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a657805463ffffffff92168217905562015f907f92ba7d3c000c0cc8d9e1dc8151b7ea9755ff00799f40e14ecd2e42eba9a6430b8190556123287fef75423777c4cbaaf239475bf1ff71a6a2d7d55f317caef41756b7774401a6288190556103e87f4a20c6e668f7dd6e7bddd50201d3ddad37ecb406e48c0bc7dfc3c774994f419c819055620186a07fee1b74751cc3a5aa70c3a9cbfa9b333cba45fdf17fc8771c9bed0ad31fd75eed5560007f5a1028a0f5ebc44f2a69e91f803daf6c7a853efb5f85733056fdf56e9e7593f58190557f9a16730bdc065e96f347922201bf0c48cc23ec91abb70524f62876fb8950dc8d819055620138807fd2197b725c02febdfc9072cadc39e07e1f70455aa071945e42d3aa4a0a47966d55613a987f22ab0f0c774a6350e3ffba0f0a82e3555ee91b83fee894d097b8b71a216245a3556113887f7268e37e9edc0071c46e13c7b8be8a3967fddb81587a7564252584c2ae65990b819055620173187fd057db82a093dff5a5c50b75cc28d0f87c701532f9199f538ccd67bc6d222a91557f2e18495cac82c92c768595199951016a13c3b60fb74847d03810b6691f428837557f2a5ca2d337f8e93fe60c5a12760950ee2341ea1f0c24ad8a6f60d1c8cb5b045c819055620124f87f8ea44f5f19ea7e0f66221b63e81924a0b29decc4022d9740928c06d0ad905906556146507f0e8ea98c7ba24f4310775ee2319dcd693ce49d9273d2b6defa20fab59e7087dd55611b587f54ec9ade77e971501bcf42a7aba591bfc1e21c118f89acd626cf43d300c465dc557f2eb50f01e9a6c23456610d7cc932654cf10b634dba8b84c8870284347c517630939093557f9c3fbc22309d3e0f7efb830ea76227b083916d1dd2af28e1246a121aee604f61919091557f3902c62920591d05fe33dfc1ed17a2e03f420b10b60fde30c7a925750ba1b1535562014c087fb2925a3dfcd73d885038ec62e54d0f653f8cb6ad6c1aef28e3f8d589420f769155612ee07fd4da45525b5231666d38b46b85110c25a747d4b24f0b8f0af140e43c699dc9e655610bb87f914e492f024dfff9a4ecd81e60bbff3cbc7e4967d6d453117de1830e60843cc055620111707faadb0fe37dc41b589d2bedb792d49d4db22a8da5366d8fabd8e9eb1ef5cebbd855614e207f348f258ed9e11b45156fb210d009b15e1bcffebc7130942dba1aaa921b74d75d556127107f60de8067a9abaa04637803c21accb88d531c34eca0d32e2c40e26ab1df15667d5561019d602081815260408051606080820183528582528184018681528284018881527f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff8054808c018255908952935160029485027ff699062a39a3e0612cb6229cde40e8ae953b97ed69b6602abb2d6c056efc9df581019190915591517ff699062a39a3e0612cb6229cde40e8ae953b97ed69b6602abb2d6c056efc9df690920180549151928a1667ffffffffffffffff1992831617640100000000938b1684021790558686528451808401865288815280870189815260058288019081527f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d8054808f018255818d5293519388027ff136f0b91155d0d1b0095c010d99f25b7365178c4cbbfdaf819bc80e91ee9cc18181019590955592517ff136f0b91155d0d1b0095c010d99f25b7365178c4cbbfdaf819bc80e91ee9cc293840180549351918f1693871693909317908e1687021790915589895287519586018852678ac7230489e80000865260069886019889529685019c8d5286549b8c01875595895292519990930291820198909855925192909101805497518616909602961693169290921793909317909155908081526020808201929092526040908101600090812082516060810184526801a055690d9db800008152600b818601908152600f948201948552825460018181018555938552958420915160029096029091019485555193018054925163ffffffff9081166401000000000267ffffffffffffffff199094169416939093179190911790915561019d90806002811115613cbc57613cbc614a40565b81526020808201929092526040908101600090812082516060810184526802b5e3af16b18800008152601081860190815263ffffffff9482018581528354600181810186559486529685209251600290970290920195865551949091018054915184166401000000000267ffffffffffffffff19909216949093169390931792909217905562093a806101a855681043561a8829300000906101aa90806002811115613d6a57613d6a614a40565b815260200190815260200160002081905550681b1ae4d6e2ef5000006101aa600060016002811115613d9e57613d9e614a40565b6002811115613daf57613daf614a40565b815260208101919091526040016000205580156108d8576000805461ff001916905550565b600054610100900460ff16613def5760005460ff1615613df3565b303b155b613e0f5760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff16158015613e31576000805461ffff19166101011790555b611125613e9f565b600054610100900460ff16613e605760405162461bcd60e51b81526004016107d790614cd1565b611096613f14565b600054610100900460ff16613e8f5760405162461bcd60e51b81526004016107d790614cd1565b613e97613f14565b613e60613f14565b600054610100900460ff16613eba5760005460ff1615613ebe565b303b155b613eda5760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff16158015613efc576000805461ffff19166101011790555b613f04613f3b565b613f0c613f72565b611125612831565b600054610100900460ff166110965760405162461bcd60e51b81526004016107d790614cd1565b600054610100900460ff16613f625760405162461bcd60e51b81526004016107d790614cd1565b613f6a613f14565b611096613fa9565b600054610100900460ff16613f995760405162461bcd60e51b81526004016107d790614cd1565b613fa1613f14565b611096613fd9565b600054610100900460ff16613fd05760405162461bcd60e51b81526004016107d790614cd1565b6110963361277a565b600054610100900460ff166140005760405162461bcd60e51b81526004016107d790614cd1565b61012d805460ff19169055565b50805460008255906000526020600020908101906108d8919061404c565b50805460008255600202906000526020600020908101906108d89190614065565b5b80821115614061576000815560010161404d565b5090565b5b80821115614061576000815560018101805467ffffffffffffffff19169055600201614066565b60006020828403121561409f57600080fd5b81356001600160e01b0319811681146120cf57600080fd5b600080604083850312156140ca57600080fd5b50508035926020909101359150565b600381106108d857600080fd5b600080604083850312156140f957600080fd5b8235614104816140d9565b946020939093013593505050565b60006020828403121561412457600080fd5b5035919050565b60008083601f84011261413d57600080fd5b5081356001600160401b0381111561415457600080fd5b6020830191508360208260051b850101111561274f57600080fd5b6000806000806040858703121561418557600080fd5b84356001600160401b038082111561419c57600080fd5b6141a88883890161412b565b909650945060208701359150808211156141c157600080fd5b506141ce8782880161412b565b95989497509550505050565b80356001600160a01b03811681146141f157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b038111828210171561422e5761422e6141f6565b60405290565b604051601f8201601f191681016001600160401b038111828210171561425c5761425c6141f6565b604052919050565b600082601f83011261427557600080fd5b81356001600160401b0381111561428e5761428e6141f6565b6142a1601f8201601f1916602001614234565b8181528460208386010111156142b657600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156142e957600080fd5b6142f2856141da565b9350614300602086016141da565b92506040850135915060608501356001600160401b0381111561432257600080fd5b61432e87828801614264565b91505092959194509250565b60006020828403121561434c57600080fd5b6120cf826141da565b80151581146108d857600080fd5b60006020828403121561437557600080fd5b81356120cf81614355565b60006020828403121561439257600080fd5b81356120cf816140d9565b600080602083850312156143b057600080fd5b82356001600160401b038111156143c657600080fd5b6143d28582860161412b565b90969095509350505050565b600080600080600080606087890312156143f757600080fd5b86356001600160401b038082111561440e57600080fd5b61441a8a838b0161412b565b9098509650602089013591508082111561443357600080fd5b61443f8a838b0161412b565b9096509450604089013591508082111561445857600080fd5b5061446589828a0161412b565b979a9699509497509295939492505050565b600681106108d857600080fd5b60008060006060848603121561449957600080fd5b83356144a481614477565b925060208401356144b4816140d9565b915060408401356144c481614477565b809150509250925092565b600082601f8301126144e057600080fd5b813560206001600160401b038211156144fb576144fb6141f6565b8160051b61450a828201614234565b928352848101820192828101908785111561452457600080fd5b83870192505b848310156145435782358252918301919083019061452a565b979650505050505050565b600080600080600060a0868803121561456657600080fd5b61456f866141da565b945061457d602087016141da565b935060408601356001600160401b038082111561459957600080fd5b6145a589838a016144cf565b945060608801359150808211156145bb57600080fd5b6145c789838a016144cf565b935060808801359150808211156145dd57600080fd5b506145ea88828901614264565b9150509295509295909350565b60008083601f84011261460957600080fd5b5081356001600160401b0381111561462057600080fd5b60208301915083602060608302850101111561274f57600080fd5b6000806000806040858703121561465157600080fd5b84356001600160401b038082111561466857600080fd5b6146748883890161412b565b9096509450602087013591508082111561468d57600080fd5b506141ce878288016145f7565b600080600080600080600060e0888a0312156146b557600080fd5b6146be886141da565b96506146cc602089016141da565b95506146da604089016141da565b94506146e8606089016141da565b93506146f6608089016141da565b925061470460a089016141da565b915061471260c089016141da565b905092959891949750929550565b600080600080600060a0868803121561473857600080fd5b614741866141da565b945061474f602087016141da565b9350604086013592506060860135915060808601356001600160401b0381111561477857600080fd5b6145ea88828901614264565b6000806000806040858703121561479a57600080fd5b84356001600160401b03808211156147b157600080fd5b614674888389016145f7565b63ffffffff811681146108d857600080fd5b600080600080600080600060e0888a0312156147ea57600080fd5b873596506020880135955060408801359450606088013561480a816147bd565b9350608088013561481a816147bd565b9699959850939692959460a0840135945060c09093013592915050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526014908201527310dbdb9d1c9858dd1cc8185c995b89dd081cd95d60621b604082015260600190565b6020808252600c908201526b4e6f20636f6e74726163747360a01b604082015260600190565b6000602082840312156148c757600080fd5b81516120cf81614355565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115614911576149116148e8565b500190565b600060001982141561492a5761492a6148e8565b5060010190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601290820152712737ba1030b236b4b71037b91037bbb732b960711b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6000816000190483118215151615614a1e57614a1e6148e8565b500290565b600060208284031215614a3557600080fd5b81356120cf81614477565b634e487b7160e01b600052602160045260246000fd5b81358155600181016020830135614a6c816147bd565b63ffffffff8116905081548163ffffffff1982161783556040850135614a91816147bd565b67ffffffff000000008160201b16836001600160401b0319841617178455505050505050565b80516141f181614477565b805160ff811681146141f157600080fd5b600082601f830112614ae457600080fd5b60405160c081018181106001600160401b0382111715614b0657614b066141f6565b6040528060c0840185811115614b1b57600080fd5b845b81811015614b3c57614b2e81614ac2565b835260209283019201614b1d565b509195945050505050565b60006101808284031215614b5a57600080fd5b614b6261420c565b8251614b6d816140d9565b81526020830151600a8110614b8157600080fd5b6020820152614b9260408401614ab7565b6040820152614ba360608401614ac2565b6060820152614bb460808401614ac2565b6080820152614bc68460a08501614ad3565b60a0820152610160929092015160c083015250919050565b600063ffffffff80831681811415614bf857614bf86148e8565b6001019392505050565b600060208284031215614c1457600080fd5b5051919050565b600082614c3857634e487b7160e01b600052601260045260246000fd5b500690565b6001600160a01b03871681526020810186905260c0810160038610614c6457614c64614a40565b856040830152600a8510614c7a57614c7a614a40565b84606083015260068410614c9057614c90614a40565b608082019390935260a00152949350505050565b600082821015614cb657614cb66148e8565b500390565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220dc683f3a95e7593e36d6221fbbfeae1118e7eb01398cfa2c455b44a1f02324f864736f6c63430008090033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102bb5760003560e01c80637048027511610182578063b866b692116100e9578063d7dfe4dd116100a2578063f23a6e611161007c578063f23a6e6114610724578063f2fde38b14610743578063fadab21914610756578063ffd0d14d1461076957600080fd5b8063d7dfe4dd146106f2578063dfa43d3214610706578063f10fb5841461071057600080fd5b8063b866b69214610647578063bc197c8114610679578063bedb86fb14610698578063ca3789ca146106ab578063ccbb4225146106be578063d3ff95c7146106df57600080fd5b806391c96bf51161013b57806391c96bf5146105b3578063939a7fa1146105da5780639c54df64146105ed578063a56cb6dd14610600578063ad402cc314610613578063ad72e1a51461062657600080fd5b80637048027514610558578063715018a61461056b57806378c4a045146105735780638129fc1c146105865780638a7bf8041461058e5780638da5cb5b146105a257600080fd5b8063192be23311610226578063377e11e0116101df578063377e11e0146104e65780635772d5b2146104f95780635c975abb146105035780635fce51a31461050f57806361d027b314610530578063675857eb1461054457600080fd5b8063192be2331461042b57806324d7806c1461043e57806327f6eb8e1461046b57806329570f411461048c578063313c06a014610496578063340c2ca7146104aa57600080fd5b80630d854646116102785780630d854646146103605780630ebe11961461038c57806310e12640146103ad578063150b7a02146103c05780631785f53c146103f757806318d939e81461040a57600080fd5b806301ffc9a7146102c0578063021946db146102e8578063037a528b146102f657806309bfac0d1461030e5780630b10338f146103185780630c6263a51461032b575b600080fd5b6102d36102ce36600461408d565b61077c565b60405190151581526020015b60405180910390f35b6101ab546102d39060ff1681565b61030061019a5481565b6040519081526020016102df565b6103166107b3565b005b6103006103263660046140b7565b6108db565b61033e6103393660046140e6565b610901565b6040805193845263ffffffff92831660208501529116908201526060016102df565b61019554610374906001600160a01b031681565b6040516001600160a01b0390911681526020016102df565b61030061039a366004614112565b6101a36020526000908152604090205481565b6103166103bb36600461416f565b610950565b6103de6103ce3660046142d3565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016102df565b61031661040536600461433a565b610ed3565b610300610418366004614112565b6101a46020526000908152604090205481565b610316610439366004614363565b610f1f565b6102d361044c36600461433a565b6001600160a01b0316600090815261015f602052604090205460ff1690565b610300610479366004614112565b6101a26020526000908152604090205481565b6103006101a95481565b61019654610374906001600160a01b031681565b6104d16104b8366004614380565b61019b6020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016102df565b6103166104f436600461439d565b610f71565b61030061019e5481565b61012d5460ff166102d3565b61030061051d366004614112565b6101a06020526000908152604090205481565b61019754610374906001600160a01b031681565b61019354610374906001600160a01b031681565b61031661056636600461433a565b611013565b610316611062565b6102d3610581366004614112565b611098565b6103166110c0565b61019454610374906001600160a01b031681565b60fb546001600160a01b0316610374565b6104d16105c1366004614112565b6101996020526000908152604090205463ffffffff1681565b6103166105e8366004614112565b611139565b6103166105fb36600461439d565b61117d565b61031661060e3660046143de565b61121a565b61031661062136600461439d565b6117c2565b610300610634366004614112565b6101a16020526000908152604090205481565b610300610655366004614484565b61019c60209081526000938452604080852082529284528284209052825290205481565b6103de61068736600461454e565b63bc197c8160e01b95945050505050565b6103166106a6366004614363565b611a0f565b6103166106b936600461463b565b611a63565b6103006106cc366004614380565b6101aa6020526000908152604090205481565b6103166106ed36600461469a565b611bd1565b61019854610374906001600160a01b031681565b6103006101a85481565b61019254610374906001600160a01b031681565b6103de610732366004614720565b63f23a6e6160e01b95945050505050565b61031661075136600461433a565b611c92565b610316610764366004614784565b611d2a565b6103166107773660046147cf565b611f72565b60006001600160e01b03198216630271189760e51b14806107ad57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61012d5460ff16156107e05760405162461bcd60e51b81526004016107d790614837565b60405180910390fd5b610192546001600160a01b0316158015906108065750610193546001600160a01b031615155b801561081d5750610195546001600160a01b031615155b80156108345750610196546001600160a01b031615155b801561084b5750610197546001600160a01b031615155b80156108625750610198546001600160a01b031615155b80156108795750610194546001600160a01b031615155b6108955760405162461bcd60e51b81526004016107d790614861565b3332146108b45760405162461bcd60e51b81526004016107d79061488f565b33600090815261019f602052604081206108cd906120c2565b90506108d8816120d6565b50565b6101a760205281600052604060002081600381106108f857600080fd5b01549150829050565b61019d602052816000526040600020818154811061091e57600080fd5b60009182526020909120600290910201805460019091015490925063ffffffff80821692506401000000009091041683565b838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251151591506109c390505760405162461bcd60e51b815260206004820152600b60248201526a456d70747920617272617960a81b60448201526064016107d7565b61012d5460ff16156109e75760405162461bcd60e51b81526004016107d790614837565b610192546001600160a01b031615801590610a0d5750610193546001600160a01b031615155b8015610a245750610195546001600160a01b031615155b8015610a3b5750610196546001600160a01b031615155b8015610a525750610197546001600160a01b031615155b8015610a695750610198546001600160a01b031615155b8015610a805750610194546001600160a01b031615155b610a9c5760405162461bcd60e51b81526004016107d790614861565b333214610abb5760405162461bcd60e51b81526004016107d79061488f565b6101ab5460ff1615610b0f5760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e673a2053756d6d6f6e696e6720697320706175736564000060448201526064016107d7565b838214610b5e5760405162461bcd60e51b815260206004820181905260248201527f4372797374616c20616e6420546f6b656e73206d75737420626520657175616c60448201526064016107d7565b61019760009054906101000a90046001600160a01b03166001600160a01b031663ca1709556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bad57600080fd5b505afa158015610bc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be591906148b5565b610c315760405162461bcd60e51b815260206004820152601860248201527f42726964676520576f726c64206e6f7420706f7765726564000000000000000060448201526064016107d7565b60008060005b86811015610cae57600080610c7c8a8a85818110610c5757610c576148d2565b90506020020135898986818110610c7057610c706148d2565b90506020020135612278565b9092509050610c8b82866148fe565b9450610c9781856148fe565b935050508080610ca690614916565b915050610c37565b508015610df35761019554610197546040516323b872dd60e01b81526000926001600160a01b03908116926323b872dd92610cf192339216908790600401614931565b602060405180830381600087803b158015610d0b57600080fd5b505af1158015610d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4391906148b5565b905080610d925760405162461bcd60e51b815260206004820152601860248201527f4d61676963206661696c656420746f207472616e73666572000000000000000060448201526064016107d7565b610197546040516359193fc560e01b8152600481018490526001600160a01b03909116906359193fc590602401600060405180830381600087803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b50505050505b8115610eca57610196546040516323b872dd60e01b81526000916001600160a01b0316906323b872dd90610e2f90339030908890600401614931565b602060405180830381600087803b158015610e4957600080fd5b505af1158015610e5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8191906148b5565b905080610ec85760405162461bcd60e51b81526020600482015260156024820152742628103330b4b632b2103a37903a3930b739b332b960591b60448201526064016107d7565b505b50505050505050565b60fb546001600160a01b03163314610efd5760405162461bcd60e51b81526004016107d790614955565b6001600160a01b0316600090815261015f60205260409020805460ff19169055565b33600090815261015f602052604090205460ff1680610f415750610f41612756565b610f5d5760405162461bcd60e51b81526004016107d79061498a565b6101ab805460ff1916911515919091179055565b60fb546001600160a01b03163314610f9b5760405162461bcd60e51b81526004016107d790614955565b60005b8181101561100e57600061015f6000858585818110610fbf57610fbf6148d2565b9050602002016020810190610fd4919061433a565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061100681614916565b915050610f9e565b505050565b60fb546001600160a01b0316331461103d5760405162461bcd60e51b81526004016107d790614955565b6001600160a01b0316600090815261015f60205260409020805460ff19166001179055565b60fb546001600160a01b0316331461108c5760405162461bcd60e51b81526004016107d790614955565b611096600061277a565b565b61019a5460008281526101a0602052604081205490916110b7916148fe565b42101592915050565b600054610100900460ff166110db5760005460ff16156110df565b303b155b6110fb5760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff1615801561111d576000805461ffff19166101011790555b6111256127cc565b80156108d8576000805461ff001916905550565b33600090815261015f602052604090205460ff168061115b575061115b612756565b6111775760405162461bcd60e51b81526004016107d79061498a565b6101a855565b60fb546001600160a01b031633146111a75760405162461bcd60e51b81526004016107d790614955565b60005b8181101561100e57600161015f60008585858181106111cb576111cb6148d2565b90506020020160208101906111e0919061433a565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061121281614916565b9150506111aa565b33600090815261015f602052604090205460ff168061123c575061123c612756565b6112585760405162461bcd60e51b81526004016107d79061498a565b8415801590611270575061126d856003614a04565b83145b801561127b57508083145b6112b85760405162461bcd60e51b815260206004820152600e60248201526d42616420696e707574206461746160901b60448201526064016107d7565b60005b85811015610eca5760008787838181106112d7576112d76148d2565b90506020020160208101906112ec9190614a23565b905085856112fb846003614a04565b81811061130a5761130a6148d2565b9050602002013561019c600083600581111561132857611328614a40565b600581111561133957611339614a40565b8152602001908152602001600020600080600281111561135b5761135b614a40565b600281111561136c5761136c614a40565b815260200190815260200160002060006004600581111561138f5761138f614a40565b60058111156113a0576113a0614a40565b815260208101919091526040016000205585856113be846003614a04565b6113c99060016148fe565b8181106113d8576113d86148d2565b9050602002013561019c60008360058111156113f6576113f6614a40565b600581111561140757611407614a40565b8152602001908152602001600020600080600281111561142957611429614a40565b600281111561143a5761143a614a40565b815260200190815260200160002060006003600581111561145d5761145d614a40565b600581111561146e5761146e614a40565b8152602081019190915260400160002055858561148c846003614a04565b6114979060026148fe565b8181106114a6576114a66148d2565b9050602002013561019c60008360058111156114c4576114c4614a40565b60058111156114d5576114d5614a40565b815260200190815260200160002060008060028111156114f7576114f7614a40565b600281111561150857611508614a40565b815260200190815260200160002060006001600581111561152b5761152b614a40565b600581111561153c5761153c614a40565b8152602081019190915260400160002055838361155a846003614a04565b818110611569576115696148d2565b9050602002013561019c600083600581111561158757611587614a40565b600581111561159857611598614a40565b81526020019081526020016000206000600160028111156115bb576115bb614a40565b60028111156115cc576115cc614a40565b81526020019081526020016000206000600460058111156115ef576115ef614a40565b600581111561160057611600614a40565b8152602081019190915260400160002055838361161e846003614a04565b6116299060016148fe565b818110611638576116386148d2565b9050602002013561019c600083600581111561165657611656614a40565b600581111561166757611667614a40565b815260200190815260200160002060006001600281111561168a5761168a614a40565b600281111561169b5761169b614a40565b81526020019081526020016000206000600360058111156116be576116be614a40565b60058111156116cf576116cf614a40565b815260208101919091526040016000205583836116ed846003614a04565b6116f89060026148fe565b818110611707576117076148d2565b9050602002013561019c600083600581111561172557611725614a40565b600581111561173657611736614a40565b815260200190815260200160002060006001600281111561175957611759614a40565b600281111561176a5761176a614a40565b815260200190815260200160002060006001600581111561178d5761178d614a40565b600581111561179e5761179e614a40565b815260208101919091526040016000205550806117ba81614916565b9150506112bb565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061183590505760405162461bcd60e51b815260206004820152600b60248201526a456d70747920617272617960a81b60448201526064016107d7565b61012d5460ff16156118595760405162461bcd60e51b81526004016107d790614837565b610192546001600160a01b03161580159061187f5750610193546001600160a01b031615155b80156118965750610195546001600160a01b031615155b80156118ad5750610196546001600160a01b031615155b80156118c45750610197546001600160a01b031615155b80156118db5750610198546001600160a01b031615155b80156118f25750610194546001600160a01b031615155b61190e5760405162461bcd60e51b81526004016107d790614861565b33321461192d5760405162461bcd60e51b81526004016107d79061488f565b60005b828110156119d25761197f84848381811061194d5761194d6148d2565b33600090815261019f602090815260409091209391020135905060009081526001919091016020526040902054151590565b6119c05760405162461bcd60e51b81526020600482015260126024820152712237b2b9903737ba1037bbb7103a37b5b2b760711b60448201526064016107d7565b806119ca81614916565b915050611930565b5061100e8383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506120d692505050565b33600090815261015f602052604090205460ff1680611a315750611a31612756565b611a4d5760405162461bcd60e51b81526004016107d79061498a565b8015611a5b576108d8612831565b6108d86128a8565b33600090815261015f602052604090205460ff1680611a855750611a85612756565b611aa15760405162461bcd60e51b81526004016107d79061498a565b828114611ade5760405162461bcd60e51b815260206004820152600b60248201526a426164206c656e6774687360a81b60448201526064016107d7565b6101a560008181611aef828261400d565b5050505060005b83811015611bca57611b2b858583818110611b1357611b136148d2565b905060200201356101a561292490919063ffffffff16565b5060005b6003811015611bb757838383818110611b4a57611b4a6148d2565b9050606002018160038110611b6157611b616148d2565b60200201356101a76000888886818110611b7d57611b7d6148d2565b9050602002013581526020019081526020016000208260038110611ba357611ba36148d2565b015580611baf81614916565b915050611b2f565b5080611bc281614916565b915050611af6565b5050505050565b33600090815261015f602052604090205460ff1680611bf35750611bf3612756565b611c0f5760405162461bcd60e51b81526004016107d79061498a565b61019280546001600160a01b03199081166001600160a01b039788161790915561019380548216988716989098179097556101948054881696861696909617909555610195805487169285169290921790915561019680548616928416929092179091556101978054851691831691909117905561019880549093169116179055565b60fb546001600160a01b03163314611cbc5760405162461bcd60e51b81526004016107d790614955565b6001600160a01b038116611d215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107d7565b6108d88161277a565b33600090815261015f602052604090205460ff1680611d4c5750611d4c612756565b611d685760405162461bcd60e51b81526004016107d79061498a565b82611dab5760405162461bcd60e51b815260206004820152601360248201527242616420617578696c6961727920737465707360681b60448201526064016107d7565b80611dec5760405162461bcd60e51b81526020600482015260116024820152704261642067656e6573697320737465707360781b60448201526064016107d7565b6001600090815261019d602052611e24907f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff9061402b565b600080805261019d602052611e5a907f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d9061402b565b60005b83811015611ee657600160005261019d6020527f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff858583818110611ea357611ea36148d2565b835460018101855560009485526020909420606090910292909201926002029091019050611ed18282614a56565b50508080611ede90614916565b915050611e5d565b5060005b81811015611bca576000805261019d6020527f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d838383818110611f2f57611f2f6148d2565b835460018101855560009485526020909420606090910292909201926002029091019050611f5d8282614a56565b50508080611f6a90614916565b915050611eea565b33600090815261015f602052604090205460ff1680611f945750611f94612756565b611fb05760405162461bcd60e51b81526004016107d79061498a565b620186a0821115611ff65760405162461bcd60e51b815260206004820152601060248201526f42616420617a7572697465206f64647360801b60448201526064016107d7565b61019a9690965561019e556101a9949094557f04d43b951d4b9841d09fb89cef478e37e6998a75d7f9d1fc96bb4384cfcd3c3b919091557f72a6c68455ff49f07ee58e8d48ef255a5d3d0e7e858ddaa2a08c6674acc4146b9190915561019b6020527f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef805463ffffffff92831663ffffffff1991821617909155600080527f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a6578054929093169116179055565b606060006120cf83612930565b9392505050565b60008060005b83518110156121b55760008482815181106120f9576120f96148d2565b6020026020010151905060008061210f8361298c565b915091508160001461219f578561212581614916565b9650612133905081866148fe565b33600090815261019f602052604090209095506121509084612eea565b508183336001600160a01b03167f57fb6651407add325798886abde3bb5570b272ab228220645c3046def1a620646101a8544261218d91906148fe565b60405190815260200160405180910390a45b50505080806121ad90614916565b9150506120dc565b508015612243576101965460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b15801561220957600080fd5b505af115801561221d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224191906148b5565b505b8161100e5760405133907f7ba5eb84b9ee87cb4d1f1aa87b156d8d54c57af8e0490cf9bac9a038969f13e590600090a2505050565b6101a85460008381526101a460205260408120549091829161229a91906148fe565b4210156122e95760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e672066617469677565207374696c6c20616374697665000060448201526064016107d7565b610194546040516378afdef960e11b8152600481018690526000916001600160a01b03169063f15fbdf2906024016101806040518083038186803b15801561233057600080fd5b505afa158015612344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123689190614b47565b905060028151600281111561237f5761237f614a40565b14156123cd5760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f742073756d6d6f6e2077697468207265637275697400000000000060448201526064016107d7565b600085815261019960205260408120805463ffffffff16918291906123f183614bde565b91906101000a81548163ffffffff021916908363ffffffff1602179055505061019b60008360000151600281111561242b5761242b614a40565b600281111561243c5761243c614a40565b815260208101919091526040016000205463ffffffff9081169082161061249b5760405162461bcd60e51b815260206004820152601360248201527252656163686564206d61782073756d6d6f6e7360681b60448201526064016107d7565b60006124ab836000015183612ef6565b33600090815261019f602052604090209091506124c89088612924565b5060008781526101a06020908152604080832042905561019254815163433c53d960e11b815291516001600160a01b0390911692638678a7b2926004808201939182900301818787803b15801561251e57600080fd5b505af1158015612532573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125569190614c02565b60008981526101a1602090815260408083208490556101a29091529020839055905086156126565760008781526101a660205260409020546125cb5760405162461bcd60e51b815260206004820152600e60248201526d1098590818dc9e5cdd185b08125160921b60448201526064016107d7565b60008881526101a36020526040908190208890556101985461019754915163a878b95d60e01b81523360048201526001600160a01b039283166024820152604481018a90526001606482015291169063a878b95d90608401600060405180830381600087803b15801561263d57600080fd5b505af1158015612651573d6000803e3d6000fd5b505050505b610193546040516383291f8760e01b81526001600160a01b03909116906383291f879061268b90339030908d90600401614931565b600060405180830381600087803b1580156126a557600080fd5b505af11580156126b9573d6000803e3d6000fd5b505050508088336001600160a01b03167fa65bbc6392db72d041caaed384252b6166f63d34c0012bf969b6312e8dddba7461019a54426126f991906148fe565b60405190815260200160405180910390a4816101aa60008660000151600281111561272657612726614a40565b600281111561273757612737614a40565b81526020019081526020016000205495509550505050505b9250929050565b60003361276b60fb546001600160a01b031690565b6001600160a01b031614905090565b60fb80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166127e75760005460ff16156127eb565b303b155b6128075760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff16158015612829576000805461ffff19166101011790555b611125613050565b61012d5460ff16156128555760405162461bcd60e51b81526004016107d790614837565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861288b3390565b6040516001600160a01b03909116815260200160405180910390a1565b61012d5460ff166128f25760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016107d7565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3361288b565b60006120cf83836130b5565b60608160000180548060200260200160405190810160405280929190818152602001828054801561298057602002820191906000526020600020905b81548152602001906001019080831161296c575b50505050509050919050565b60008061299883611098565b6129a757506000928392509050565b60008381526101a16020526040908190205461019254915163f030210760e01b81526004810182905290916001600160a01b03169063f03021079060240160206040518083038186803b1580156129fd57600080fd5b505afa158015612a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3591906148b5565b612a455750600093849350915050565b610194546040516378afdef960e11b8152600481018690526000916001600160a01b03169063f15fbdf2906024016101806040518083038186803b158015612a8c57600080fd5b505afa158015612aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac49190614b47565b61019254604051634ad30a7560e01b8152600481018590529192506000916001600160a01b0390911690634ad30a759060240160206040518083038186803b158015612b0f57600080fd5b505afa158015612b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b479190614c02565b610193546040516340d097c360e01b81523360048201529192506000916001600160a01b03909116906340d097c390602401602060405180830381600087803b158015612b9357600080fd5b505af1158015612ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bcb9190614c02565b90506000612bda600584614c1b565b612be59060016148fe565b6009811115612bf657612bf6614a40565b60008981526101a36020908152604091829020548251918201879052918101869052919250906060016040516020818303038152906040528051906020012060001c93506000612c47858784613104565b610194546040516307d1b76f60e41b81529192506001600160a01b031690637d1b76f090612c85903390889060019089908890600090600401614c3d565b600060405180830381600087803b158015612c9f57600080fd5b505af1158015612cb3573d6000803e3d6000fd5b505050508485604051602001612cd3929190918252602082015260400190565b60408051601f19818403018152919052805160209091012094506000612cfc620186a087614c1b565b905061019e54811015612dce5760006101a95411612d5c5760405162461bcd60e51b815260206004820152601760248201527f417a75726974652044757374204944206e6f742073657400000000000000000060448201526064016107d7565b610198546101a954604051630ab714fb60e11b81523360048201526024810191909152600160448201526001600160a01b039091169063156e29f690606401600060405180830381600087803b158015612db557600080fd5b505af1158015612dc9573d6000803e3d6000fd5b505050505b426101a460008781526020019081526020016000208190555060006101a260008d81526020019081526020016000205490506101a160008d8152602001908152602001600020600090556101a260008d8152602001908152602001600020600090556101a060008d8152602001908152602001600020600090556101a360008d81526020019081526020016000206000905561019360009054906101000a90046001600160a01b03166001600160a01b03166383291f8730338f6040518463ffffffff1660e01b8152600401612ea693929190614931565b600060405180830381600087803b158015612ec057600080fd5b505af1158015612ed4573d6000803e3d6000fd5b50979e929d50919b505050505050505050505050565b60006120cf838361343a565b60008061019d6000856002811115612f1057612f10614a40565b6002811115612f2157612f21614a40565b8152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015612fa757600084815260209081902060408051606081018252600286029092018054835260019081015463ffffffff8082168587015264010000000090910416918301919091529083529092019101612f4f565b50505050905060005b8151811015613012576000828281518110612fcd57612fcd6148d2565b60200260200101519050806040015163ffffffff168563ffffffff161115612ff55750613000565b5192506107ad915050565b8061300a81614916565b915050612fb0565b5060405162461bcd60e51b8152602060048201526012602482015271426164204c5020737465702076616c75657360701b60448201526064016107d7565b600054610100900460ff1661306b5760005460ff161561306f565b303b155b61308b5760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff161580156130ad576000805461ffff19166101011790555b61112561352d565b60008181526001830160205260408120546130fc575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107ad565b5060006107ad565b60008061019c60008560400151600581111561312257613122614a40565b600581111561313357613133614a40565b815260200190815260200160002060008560000151600281111561315957613159614a40565b600281111561316a5761316a614a40565b815260200190815260200160002060006004600581111561318d5761318d614a40565b600581111561319e5761319e614a40565b8152602001908152602001600020549050600061019c6000866040015160058111156131cc576131cc614a40565b60058111156131dd576131dd614a40565b815260200190815260200160002060008660000151600281111561320357613203614a40565b600281111561321457613214614a40565b815260200190815260200160002060006003600581111561323757613237614a40565b600581111561324857613248614a40565b8152602001908152602001600020549050600061019c60008760400151600581111561327657613276614a40565b600581111561328757613287614a40565b81526020019081526020016000206000876000015160028111156132ad576132ad614a40565b60028111156132be576132be614a40565b81526020019081526020016000206000600160058111156132e1576132e1614a40565b60058111156132f2576132f2614a40565b8152602001908152602001600020549050846000146133905760008581526101a76020526040808220815160608101928390529160039082845b81548152602001906001019080831161332c575050505050905080600060038110613359576133596148d2565b60200201516133689085614ca4565b602082015190945061337a90846148fe565b604082015190935061338c90836148fe565b9150505b8061339b83856148fe565b6133a591906148fe565b620186a0146133e85760405162461bcd60e51b815260206004820152600f60248201526e42616420526172697479206f64647360881b60448201526064016107d7565b60006133f7620186a089614c1b565b90508381101561340e5760049450505050506120cf565b61341883856148fe565b81101561342c5760039450505050506120cf565b506001979650505050505050565b6000818152600183016020526040812054801561352357600061345e600183614ca4565b855490915060009061347290600190614ca4565b90508181146134d7576000866000018281548110613492576134926148d2565b90600052602060002001549050808760000184815481106134b5576134b56148d2565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806134e8576134e8614cbb565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506107ad565b60009150506107ad565b600054610100900460ff166135485760005460ff161561354c565b303b155b6135685760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff1615801561358a576000805461ffff19166101011790555b611125600054610100900460ff166135a85760005460ff16156135ac565b303b155b6135c85760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff161580156135ea576000805461ffff19166101011790555b611125600054610100900460ff166136085760005460ff161561360c565b303b155b6136285760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff1615801561364a576000805461ffff19166101011790555b613652613dd4565b61365a613e39565b613662613e68565b62093a8061019a55600a61019e8190557f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef8054600163ffffffff1991821681179092557f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a657805463ffffffff92168217905562015f907f92ba7d3c000c0cc8d9e1dc8151b7ea9755ff00799f40e14ecd2e42eba9a6430b8190556123287fef75423777c4cbaaf239475bf1ff71a6a2d7d55f317caef41756b7774401a6288190556103e87f4a20c6e668f7dd6e7bddd50201d3ddad37ecb406e48c0bc7dfc3c774994f419c819055620186a07fee1b74751cc3a5aa70c3a9cbfa9b333cba45fdf17fc8771c9bed0ad31fd75eed5560007f5a1028a0f5ebc44f2a69e91f803daf6c7a853efb5f85733056fdf56e9e7593f58190557f9a16730bdc065e96f347922201bf0c48cc23ec91abb70524f62876fb8950dc8d819055620138807fd2197b725c02febdfc9072cadc39e07e1f70455aa071945e42d3aa4a0a47966d55613a987f22ab0f0c774a6350e3ffba0f0a82e3555ee91b83fee894d097b8b71a216245a3556113887f7268e37e9edc0071c46e13c7b8be8a3967fddb81587a7564252584c2ae65990b819055620173187fd057db82a093dff5a5c50b75cc28d0f87c701532f9199f538ccd67bc6d222a91557f2e18495cac82c92c768595199951016a13c3b60fb74847d03810b6691f428837557f2a5ca2d337f8e93fe60c5a12760950ee2341ea1f0c24ad8a6f60d1c8cb5b045c819055620124f87f8ea44f5f19ea7e0f66221b63e81924a0b29decc4022d9740928c06d0ad905906556146507f0e8ea98c7ba24f4310775ee2319dcd693ce49d9273d2b6defa20fab59e7087dd55611b587f54ec9ade77e971501bcf42a7aba591bfc1e21c118f89acd626cf43d300c465dc557f2eb50f01e9a6c23456610d7cc932654cf10b634dba8b84c8870284347c517630939093557f9c3fbc22309d3e0f7efb830ea76227b083916d1dd2af28e1246a121aee604f61919091557f3902c62920591d05fe33dfc1ed17a2e03f420b10b60fde30c7a925750ba1b1535562014c087fb2925a3dfcd73d885038ec62e54d0f653f8cb6ad6c1aef28e3f8d589420f769155612ee07fd4da45525b5231666d38b46b85110c25a747d4b24f0b8f0af140e43c699dc9e655610bb87f914e492f024dfff9a4ecd81e60bbff3cbc7e4967d6d453117de1830e60843cc055620111707faadb0fe37dc41b589d2bedb792d49d4db22a8da5366d8fabd8e9eb1ef5cebbd855614e207f348f258ed9e11b45156fb210d009b15e1bcffebc7130942dba1aaa921b74d75d556127107f60de8067a9abaa04637803c21accb88d531c34eca0d32e2c40e26ab1df15667d5561019d602081815260408051606080820183528582528184018681528284018881527f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff8054808c018255908952935160029485027ff699062a39a3e0612cb6229cde40e8ae953b97ed69b6602abb2d6c056efc9df581019190915591517ff699062a39a3e0612cb6229cde40e8ae953b97ed69b6602abb2d6c056efc9df690920180549151928a1667ffffffffffffffff1992831617640100000000938b1684021790558686528451808401865288815280870189815260058288019081527f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d8054808f018255818d5293519388027ff136f0b91155d0d1b0095c010d99f25b7365178c4cbbfdaf819bc80e91ee9cc18181019590955592517ff136f0b91155d0d1b0095c010d99f25b7365178c4cbbfdaf819bc80e91ee9cc293840180549351918f1693871693909317908e1687021790915589895287519586018852678ac7230489e80000865260069886019889529685019c8d5286549b8c01875595895292519990930291820198909855925192909101805497518616909602961693169290921793909317909155908081526020808201929092526040908101600090812082516060810184526801a055690d9db800008152600b818601908152600f948201948552825460018181018555938552958420915160029096029091019485555193018054925163ffffffff9081166401000000000267ffffffffffffffff199094169416939093179190911790915561019d90806002811115613cbc57613cbc614a40565b81526020808201929092526040908101600090812082516060810184526802b5e3af16b18800008152601081860190815263ffffffff9482018581528354600181810186559486529685209251600290970290920195865551949091018054915184166401000000000267ffffffffffffffff19909216949093169390931792909217905562093a806101a855681043561a8829300000906101aa90806002811115613d6a57613d6a614a40565b815260200190815260200160002081905550681b1ae4d6e2ef5000006101aa600060016002811115613d9e57613d9e614a40565b6002811115613daf57613daf614a40565b815260208101919091526040016000205580156108d8576000805461ff001916905550565b600054610100900460ff16613def5760005460ff1615613df3565b303b155b613e0f5760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff16158015613e31576000805461ffff19166101011790555b611125613e9f565b600054610100900460ff16613e605760405162461bcd60e51b81526004016107d790614cd1565b611096613f14565b600054610100900460ff16613e8f5760405162461bcd60e51b81526004016107d790614cd1565b613e97613f14565b613e60613f14565b600054610100900460ff16613eba5760005460ff1615613ebe565b303b155b613eda5760405162461bcd60e51b81526004016107d7906149b6565b600054610100900460ff16158015613efc576000805461ffff19166101011790555b613f04613f3b565b613f0c613f72565b611125612831565b600054610100900460ff166110965760405162461bcd60e51b81526004016107d790614cd1565b600054610100900460ff16613f625760405162461bcd60e51b81526004016107d790614cd1565b613f6a613f14565b611096613fa9565b600054610100900460ff16613f995760405162461bcd60e51b81526004016107d790614cd1565b613fa1613f14565b611096613fd9565b600054610100900460ff16613fd05760405162461bcd60e51b81526004016107d790614cd1565b6110963361277a565b600054610100900460ff166140005760405162461bcd60e51b81526004016107d790614cd1565b61012d805460ff19169055565b50805460008255906000526020600020908101906108d8919061404c565b50805460008255600202906000526020600020908101906108d89190614065565b5b80821115614061576000815560010161404d565b5090565b5b80821115614061576000815560018101805467ffffffffffffffff19169055600201614066565b60006020828403121561409f57600080fd5b81356001600160e01b0319811681146120cf57600080fd5b600080604083850312156140ca57600080fd5b50508035926020909101359150565b600381106108d857600080fd5b600080604083850312156140f957600080fd5b8235614104816140d9565b946020939093013593505050565b60006020828403121561412457600080fd5b5035919050565b60008083601f84011261413d57600080fd5b5081356001600160401b0381111561415457600080fd5b6020830191508360208260051b850101111561274f57600080fd5b6000806000806040858703121561418557600080fd5b84356001600160401b038082111561419c57600080fd5b6141a88883890161412b565b909650945060208701359150808211156141c157600080fd5b506141ce8782880161412b565b95989497509550505050565b80356001600160a01b03811681146141f157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b038111828210171561422e5761422e6141f6565b60405290565b604051601f8201601f191681016001600160401b038111828210171561425c5761425c6141f6565b604052919050565b600082601f83011261427557600080fd5b81356001600160401b0381111561428e5761428e6141f6565b6142a1601f8201601f1916602001614234565b8181528460208386010111156142b657600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156142e957600080fd5b6142f2856141da565b9350614300602086016141da565b92506040850135915060608501356001600160401b0381111561432257600080fd5b61432e87828801614264565b91505092959194509250565b60006020828403121561434c57600080fd5b6120cf826141da565b80151581146108d857600080fd5b60006020828403121561437557600080fd5b81356120cf81614355565b60006020828403121561439257600080fd5b81356120cf816140d9565b600080602083850312156143b057600080fd5b82356001600160401b038111156143c657600080fd5b6143d28582860161412b565b90969095509350505050565b600080600080600080606087890312156143f757600080fd5b86356001600160401b038082111561440e57600080fd5b61441a8a838b0161412b565b9098509650602089013591508082111561443357600080fd5b61443f8a838b0161412b565b9096509450604089013591508082111561445857600080fd5b5061446589828a0161412b565b979a9699509497509295939492505050565b600681106108d857600080fd5b60008060006060848603121561449957600080fd5b83356144a481614477565b925060208401356144b4816140d9565b915060408401356144c481614477565b809150509250925092565b600082601f8301126144e057600080fd5b813560206001600160401b038211156144fb576144fb6141f6565b8160051b61450a828201614234565b928352848101820192828101908785111561452457600080fd5b83870192505b848310156145435782358252918301919083019061452a565b979650505050505050565b600080600080600060a0868803121561456657600080fd5b61456f866141da565b945061457d602087016141da565b935060408601356001600160401b038082111561459957600080fd5b6145a589838a016144cf565b945060608801359150808211156145bb57600080fd5b6145c789838a016144cf565b935060808801359150808211156145dd57600080fd5b506145ea88828901614264565b9150509295509295909350565b60008083601f84011261460957600080fd5b5081356001600160401b0381111561462057600080fd5b60208301915083602060608302850101111561274f57600080fd5b6000806000806040858703121561465157600080fd5b84356001600160401b038082111561466857600080fd5b6146748883890161412b565b9096509450602087013591508082111561468d57600080fd5b506141ce878288016145f7565b600080600080600080600060e0888a0312156146b557600080fd5b6146be886141da565b96506146cc602089016141da565b95506146da604089016141da565b94506146e8606089016141da565b93506146f6608089016141da565b925061470460a089016141da565b915061471260c089016141da565b905092959891949750929550565b600080600080600060a0868803121561473857600080fd5b614741866141da565b945061474f602087016141da565b9350604086013592506060860135915060808601356001600160401b0381111561477857600080fd5b6145ea88828901614264565b6000806000806040858703121561479a57600080fd5b84356001600160401b03808211156147b157600080fd5b614674888389016145f7565b63ffffffff811681146108d857600080fd5b600080600080600080600060e0888a0312156147ea57600080fd5b873596506020880135955060408801359450606088013561480a816147bd565b9350608088013561481a816147bd565b9699959850939692959460a0840135945060c09093013592915050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526014908201527310dbdb9d1c9858dd1cc8185c995b89dd081cd95d60621b604082015260600190565b6020808252600c908201526b4e6f20636f6e74726163747360a01b604082015260600190565b6000602082840312156148c757600080fd5b81516120cf81614355565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115614911576149116148e8565b500190565b600060001982141561492a5761492a6148e8565b5060010190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601290820152712737ba1030b236b4b71037b91037bbb732b960711b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6000816000190483118215151615614a1e57614a1e6148e8565b500290565b600060208284031215614a3557600080fd5b81356120cf81614477565b634e487b7160e01b600052602160045260246000fd5b81358155600181016020830135614a6c816147bd565b63ffffffff8116905081548163ffffffff1982161783556040850135614a91816147bd565b67ffffffff000000008160201b16836001600160401b0319841617178455505050505050565b80516141f181614477565b805160ff811681146141f157600080fd5b600082601f830112614ae457600080fd5b60405160c081018181106001600160401b0382111715614b0657614b066141f6565b6040528060c0840185811115614b1b57600080fd5b845b81811015614b3c57614b2e81614ac2565b835260209283019201614b1d565b509195945050505050565b60006101808284031215614b5a57600080fd5b614b6261420c565b8251614b6d816140d9565b81526020830151600a8110614b8157600080fd5b6020820152614b9260408401614ab7565b6040820152614ba360608401614ac2565b6060820152614bb460808401614ac2565b6080820152614bc68460a08501614ad3565b60a0820152610160929092015160c083015250919050565b600063ffffffff80831681811415614bf857614bf86148e8565b6001019392505050565b600060208284031215614c1457600080fd5b5051919050565b600082614c3857634e487b7160e01b600052601260045260246000fd5b500690565b6001600160a01b03871681526020810186905260c0810160038610614c6457614c64614a40565b856040830152600a8510614c7a57614c7a614a40565b84606083015260068410614c9057614c90614a40565b608082019390935260a00152949350505050565b600082821015614cb657614cb66148e8565b500390565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220dc683f3a95e7593e36d6221fbbfeae1118e7eb01398cfa2c455b44a1f02324f864736f6c63430008090033

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