Contract 0x40e47cab2f03dddd167bf70f637b4cac1b724016

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xa3a195ccfb304f0e15f8268ab56d21573b731bd0628c220667773f1b633feece0x6080604097591602022-04-13 20:39:11168 days 8 hrs ago0xb013abd83f0bd173e9f14ce7d6e420ad711483b4 IN  Create: Questing0 ETH0.034207218322 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x51e42552fdc8f465c26c19fab84934538209cf9e34f812faaff12a94e4780f0f113704032022-05-07 0:06:38145 days 4 hrs ago 0xb5ee4f2681042395517aa4daa00c9474c803f858 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x43413bb500e1c098cd7261d20c4dc38a713e48e812690d3427261ad046459757113703962022-05-07 0:06:38145 days 4 hrs ago 0xd773e2f5b5ffe1a8296984e53015d803ef989bb0 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x85211a87a6f650efe1aa244395cbe6d35629387d526be170cfd2749fd4d5e42c113703772022-05-07 0:06:38145 days 4 hrs ago 0x23749535c3ffedb99d8088907bb5ebb40f1d7b8e 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xfcbe2b5d2a60e333063b1ac7f06960aa67b9b517356688f8e63b047f5bd7d794113703552022-05-07 0:05:51145 days 4 hrs ago 0x23749535c3ffedb99d8088907bb5ebb40f1d7b8e 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x56ce52f23d51c3ca384088f6a4e4ffd10016f27325b5cb419e13a782154b1de3113703472022-05-07 0:05:51145 days 4 hrs ago 0x585fcac095302cdbc3a7b0ce4e1703913fa3e804 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x18ae14433fb5f51626827448dc1ce7e201265297e4cbe85f6711bb311ac334d7113703332022-05-07 0:05:51145 days 4 hrs ago 0xf2fb34c4323f9bf4a5c04fe277f96588dde5316f 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xf0d63b445b446ff917f14b3249cc6ecb0bf77cbb85e4c3e5a69397da454ec7d0113703252022-05-07 0:04:47145 days 4 hrs ago 0x01f21afe5fec3e09eebf07432f781d40c7fcfdfb 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x04290cc1c14baa6057fea9f7c53de5a40e7b1e92bc18c17ebe4be8e42208a229113703182022-05-07 0:04:47145 days 4 hrs ago 0x3d6b35dacc2c8079e073aea6b0208e1cc734a5c5 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x19a7d59b3c78e212d5dbbb2adae866472fd89297b19d7965c69e3a23fbfe9046113703162022-05-07 0:04:47145 days 4 hrs ago 0x4090e4fb07d3f8252f18110360ffccadd5137cb7 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xa04e42a7828ee7274358eca0e559efdcac4a775f62e802c61c26fd908ac4c77a113702992022-05-07 0:04:47145 days 4 hrs ago 0xc4fafdbc4f2123876b4384092d1b93a4748b7e85 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xc7cf746fad061e7d6abf475cfe8210913fd20d42c50ab95248e3b2e0bd9f16f7113702792022-05-07 0:04:10145 days 4 hrs ago 0xc4fafdbc4f2123876b4384092d1b93a4748b7e85 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x0bdbcc171f47f01f8d66115909dcc92b783aa43a434187211e858d1d2f1385ee113702722022-05-07 0:02:59145 days 4 hrs ago 0xec5daf644790259c160e95fec7aa3835767cb742 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xdd4b683e62e5d1996ad8362cd1ae6b792fe73302c4af953e10173673b91d9cb2113702542022-05-07 0:02:59145 days 4 hrs ago 0xec5daf644790259c160e95fec7aa3835767cb742 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x7d860e5efa2b8fc2b32a6b4eecb0558e57dd50255f873ca547f34d58c44c4260113701542022-05-07 0:01:08145 days 4 hrs ago 0x668e961736454a2444adb485340cb7f0844ddd3d 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xc1cd7cf54661e8f69f48806836477887ecabfd25fcabfba6d43d5f361f4adc06113701522022-05-07 0:01:08145 days 4 hrs ago 0x031ee7975fb94847a620ee017441610e97d66605 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x7a65b9a95268005bb508add02f306e62cdf31fae2d08887eb771da6191ce46a5113701442022-05-07 0:01:08145 days 4 hrs ago 0x97735db6fbbc87eb32ac63b28510ab5da2829a52 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x74de370bd23d5c9d4d4bab29970a5d009787a4e3246207440aab0dd4d2a28acc113700332022-05-06 23:58:09145 days 4 hrs ago 0x019b1e3e2bddd9aa7f68c9601ced6e470d7a3be5 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xec409e465154faf6ed492504694d065bdece786ff594a72bddd2e18252a3761e113699922022-05-06 23:57:26145 days 4 hrs ago 0xa789e44de9655aa66a99ce93acc9d96b6b34a336 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xf4ba93b7d1ad1e4e2d3523a46d21d74d453c63f7e69f18d21a65bfcd3a5f94da113699602022-05-06 23:56:28145 days 4 hrs ago 0x206d9561422ff224b262ee0571e595c4de367b77 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x6a557b53a0d1622943823399ff9fd9c924d3770cf170748a3ef947c12fe4ecd7113699592022-05-06 23:56:28145 days 4 hrs ago 0x0a5abc4eef196994abb9cd34fa8fe9229ce53e4f 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x85ca2b0f3d8aa17d45ab2af3f577ac8d6c86f362d1ccea9ac2fcd2538dc5623c113699522022-05-06 23:56:28145 days 4 hrs ago 0x92dc59566cc193211bcb43b1325a1f1d5bc10b96 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0xd3407d7088a3f634a23dd4cbe3d79ab3b2c7077f316c74856e284bb803960e37113699502022-05-06 23:56:28145 days 4 hrs ago 0xf2fb34c4323f9bf4a5c04fe277f96588dde5316f 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x46d3c5a30c808eb34dcf4cf67562f7a766b09b4870cd29a4e7f66761c3f81f85113699492022-05-06 23:56:28145 days 4 hrs ago 0x0a5abc4eef196994abb9cd34fa8fe9229ce53e4f 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x25640583e18ff6e0043507331e28a337f066cd2dc10faa22fa38e6deb9da65e7113699272022-05-06 23:55:36145 days 4 hrs ago 0x52b941dfcfedb261d9b49b26b400793af674dd89 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
0x1961287ac418b007e85b4077340f1b50dd49e8a4bb14974aac8ecc6df04035a0113699152022-05-06 23:55:17145 days 4 hrs ago 0xa0ba1136ab6f4ea2deba227f123ec42e827020e7 0x40e47cab2f03dddd167bf70f637b4cac1b7240160 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Questing

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

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

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

import "./QuestingTimeKeeper.sol";

contract Questing is Initializable, QuestingTimeKeeper {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function initialize() external initializer {
        QuestingTimeKeeper.__QuestingTimeKeeper_init();
    }

    function startQuests(
        uint256[] calldata _tokenIds,
        QuestDifficulty[] calldata _difficulties,
        uint256[] calldata _questLoops)
    external
    nonZeroLength(_tokenIds)
    contractsAreSet
    whenNotPaused
    onlyEOA
    {
        require(_tokenIds.length == _difficulties.length
            && _questLoops.length == _difficulties.length, "Bad number of difficulties");

        require(treasury.isBridgeWorldPowered(), "Bridge World not powered.");

        for(uint256 i = 0; i < _tokenIds.length; i++) {
            LegionMetadata memory _legionMetadata = legionMetadataStore.metadataForLegion(_tokenIds[i]);

            if(_legionMetadata.legionGeneration == LegionGeneration.RECRUIT) {
                _startQuestRecruit(_tokenIds[i], _difficulties[i], _questLoops[i], true);
            } else {
                _startQuest(_tokenIds[i], _difficulties[i], _questLoops[i], _legionMetadata, true);
            }
        }
    }

    function _startQuestRecruit(
        uint256 _tokenId,
        QuestDifficulty _difficulty,
        uint256 _numberLoops,
        bool _transferLegionToContract)
    private
    {
        require(_numberLoops == 1, "Max 1 loop for recruit legion");
        require(_difficulty == QuestDifficulty.EASY, "Easy only for recruit");

        _startQuestTime(_tokenId);

        uint256 _requestId = randomizer.requestRandomNumber();
        tokenIdToRequestId[_tokenId] = _requestId;

        tokenIdToQuestDifficulty[_tokenId] = _difficulty;
        tokenIdToNumberLoops[_tokenId] = _numberLoops;

        if(_transferLegionToContract) {
            userToQuestsInProgress[msg.sender].add(_tokenId);

            // Transfer the legion to be staked in this contract. This will handle
            // cases when the user doesn't own the tokens
            legion.adminSafeTransferFrom(msg.sender, address(this), _tokenId);
        }

        emit QuestStarted(msg.sender, _tokenId, _requestId, block.timestamp + (difficultyToQuestLength[_difficulty] * _numberLoops), _difficulty);
    }

    function _startQuest(
        uint256 _tokenId,
        QuestDifficulty _difficulty,
        uint256 _numberLoops,
        LegionMetadata memory _legionMetadata,
        bool _transferLegionToContract)
    private
    {
        uint256 _lpStaked = 0;

        // 1 loop does not require any staked LP
        if(_numberLoops != 1) {
            require(availableAutoQuestLoops.contains(_numberLoops), "Invalid number of loops");

            _lpStaked = difficultyToLPNeeded[_difficulty] * _numberLoops;
            if(_lpStaked > 0) {
                bool _lpSuccess = lp.transferFrom(msg.sender, address(this), _lpStaked);
                require(_lpSuccess, "LP transfer failed");
            }
        }

        uint8 _levelNeededForDifficulty = difficultyToLevelUnlocked[_difficulty];
        require(_legionMetadata.questLevel >= _levelNeededForDifficulty, "Difficulty not unlocked.");

        _startQuestTime(_tokenId);

        uint256 _requestId = randomizer.requestRandomNumber();
        tokenIdToRequestId[_tokenId] = _requestId;

        tokenIdToQuestDifficulty[_tokenId] = _difficulty;
        tokenIdToLPStaked[_tokenId] = _lpStaked;
        tokenIdToNumberLoops[_tokenId] = _numberLoops;

        if(_transferLegionToContract) {
            userToQuestsInProgress[msg.sender].add(_tokenId);

            // Transfer the legion to be staked in this contract. This will handle
            // cases when the user doesn't own the tokens
            legion.adminSafeTransferFrom(msg.sender, address(this), _tokenId);
        }

        emit QuestStarted(msg.sender, _tokenId, _requestId, block.timestamp + difficultyToQuestLength[_difficulty], _difficulty);
    }

    function revealTokensQuests(uint256[] calldata _tokenIds)
    external
    contractsAreSet
    whenNotPaused
    nonZeroLength(_tokenIds)
    onlyEOA
    {
        for(uint256 i = 0; i < _tokenIds.length; i++) {
            require(userToQuestsInProgress[msg.sender].contains(_tokenIds[i]), "Not owned by user");

            _revealQuest(_tokenIds[i]);
        }
    }

    function _revealQuest(uint256 _tokenId) private {
        uint256 _requestId = tokenIdToRequestId[_tokenId];

        require(_requestId != 0, "Already revealed quests");
        require(randomizer.isRandomReady(_requestId), "Random is not ready!");

        QuestDifficulty _difficulty = tokenIdToQuestDifficulty[_tokenId];
        uint256 _randomNumber = randomizer.revealRandomNumber(_requestId);
        LegionMetadata memory _legionMetadata = legionMetadataStore.metadataForLegion(_tokenId);

        for(uint256 i = 0; i < tokenIdToNumberLoops[_tokenId]; i++) {
            // Ensure each loop has a different random number.
            _randomNumber = uint256(keccak256(abi.encode(_randomNumber, i)));

            if(_legionMetadata.legionGeneration == LegionGeneration.RECRUIT) {
                _calculateAndDistributeRewardRecruit(_tokenId, _randomNumber);
            } else {
                _calculateAndDistributeReward(_tokenId, _difficulty, _randomNumber);
                 // Process QP gain/level up.
                _processQPGainAndLevelUp(_tokenId, _legionMetadata.questLevel);
            }
        }

        delete tokenIdToRequestId[_tokenId];
    }

    function _calculateAndDistributeRewardRecruit(
        uint256 _tokenId,
        uint256 _randomNumber)
    private {
        require(starlightId != 0
            && shardId != 0
            && universalLockId != 0, "Consumable ID not set");

        // Recruits are guaranteed starlight.
        uint8 _starlightAmount = recruitNumberOfStarlight;
        if(_starlightAmount > 0) {
            consumable.mint(msg.sender, starlightId, _starlightAmount);
        }

        uint8 _shardAmount = 0;

        if(recruitNumberOfCrystalShards > 0) {
            uint256 _shardResult = _randomNumber % 100000;

            _randomNumber = uint256(keccak256(abi.encode(_randomNumber, _randomNumber)));

            if(_shardResult < recruitCrystalShardsOdds) {
                _shardAmount = recruitNumberOfCrystalShards;
                consumable.mint(msg.sender, shardId, _shardAmount);
            }
        }

        uint256 _universalLockResult = _randomNumber % 100000;
        uint8 _universalLockAmount = 0;
        if(_universalLockResult < recruitUniversalLockOdds) {
            consumable.mint(msg.sender, universalLockId, 1);
            _universalLockAmount = 1;
        }

        emit QuestRevealed(
            msg.sender,
            _tokenId,
            QuestReward(
                _starlightAmount,
                _shardAmount,
                _universalLockAmount,
                0
            )
        );
    }

    function _calculateAndDistributeReward(
        uint256 _tokenId,
        QuestDifficulty _difficulty,
        uint256 _randomNumber)
    private {
        require(starlightId != 0
            && shardId != 0
            && universalLockId != 0, "Consumable ID not set");

        // Every user is guaranteed 2 rewards per quest.
        uint8 _starlightAmount = difficultyToStarlightAmount[_difficulty];
        uint8 _shardAmount = difficultyToShardAmount[_difficulty];

        if(_starlightAmount > 0) {
            consumable.mint(msg.sender, starlightId, _starlightAmount);
        }
        if(_shardAmount > 0) {
            consumable.mint(msg.sender, shardId, _shardAmount);
        }

        uint256 _rewardedTreasureId = 0;

        uint256 _treasureResult = _randomNumber % 100000;
        if(_treasureResult < treasureDropOdds) {
            _randomNumber = uint256(keccak256(abi.encode(_randomNumber, _randomNumber)));

            uint256 _treasureTierResult = _randomNumber % 100000;

            uint256[5] memory _tierOdds = difficultyToTierOdds[_difficulty];
            uint256 _topRange = 0;
            for(uint256 i = 0; i < _tierOdds.length; i++) {
                _topRange += _tierOdds[i];
                if(_treasureTierResult < _topRange) {
                    _randomNumber = uint256(keccak256(abi.encode(_randomNumber, _randomNumber)));

                    // Tiers are 1 index based.
                    _rewardedTreasureId = treasureMetadataStore.getRandomTreasureForTier(uint8(i + 1), _randomNumber);

                    treasure.mint(msg.sender, _rewardedTreasureId, 1);
                    break;
                }
            }
        }

        _randomNumber = uint256(keccak256(abi.encode(_randomNumber, _randomNumber)));

        uint256 _universalLockResult = _randomNumber % 100000;
        uint8 _universalLockAmount = 0;
        if(_universalLockResult < universalLockDropOdds) {
            consumable.mint(msg.sender, universalLockId, 1);
            _universalLockAmount = 1;
        }

        emit QuestRevealed(
            msg.sender,
            _tokenId,
            QuestReward(
                _starlightAmount,
                _shardAmount,
                _universalLockAmount,
                _rewardedTreasureId
            )
        );
    }

    function _processQPGainAndLevelUp(uint256 _tokenId, uint8 _currentQuestLevel) private {
        // No need to do anything if they're at the max level.
        if(_currentQuestLevel >= maxQuestLevel) {
            return;
        }

        // Add QP relative to their current level.
        tokenIdToQP[_tokenId] += levelToQPGainedPerQuest[_currentQuestLevel];

        // While the user is not max level
        // and they have enough to go to the next level.
        while(_currentQuestLevel < maxQuestLevel
            && tokenIdToQP[_tokenId] >= levelToQPNeeded[_currentQuestLevel])
        {
            tokenIdToQP[_tokenId] -= levelToQPNeeded[_currentQuestLevel];
            legionMetadataStore.increaseQuestLevel(_tokenId);
            _currentQuestLevel++;
        }
    }

    function finishTokenQuests(uint256[] calldata _tokenIds)
    external
    contractsAreSet
    whenNotPaused
    nonZeroLength(_tokenIds)
    onlyEOA
    {
        for(uint256 i = 0; i < _tokenIds.length; i++) {
            require(userToQuestsInProgress[msg.sender].contains(_tokenIds[i]), "Not owned by user");

            _finishQuest(_tokenIds[i], true);
        }
    }

    function restartTokenQuests(
        uint256[] calldata _tokenIds,
        QuestDifficulty[] calldata _difficulties,
        uint256[] calldata _questLoops)
    external
    contractsAreSet
    whenNotPaused
    nonZeroLength(_tokenIds)
    onlyEOA
    {
        require(_tokenIds.length == _difficulties.length
            && _questLoops.length == _difficulties.length, "Bad number of difficulties");

        require(treasury.isBridgeWorldPowered(), "Bridge World not powered.");

        for(uint256 i = 0; i < _tokenIds.length; i++) {
            require(userToQuestsInProgress[msg.sender].contains(_tokenIds[i]), "Not owned by user");

            _finishQuest(_tokenIds[i], false);

            LegionMetadata memory _legionMetadata = legionMetadataStore.metadataForLegion(_tokenIds[i]);

            if(_legionMetadata.legionGeneration == LegionGeneration.RECRUIT) {
                _startQuestRecruit(_tokenIds[i], _difficulties[i], _questLoops[i], false);
            } else {
                _startQuest(_tokenIds[i], _difficulties[i], _questLoops[i], _legionMetadata, false);
            }
        }
    }

    function _finishQuest(uint256 _tokenId, bool _sendLegionBackAndClearData) private {
        uint256 _requestId = tokenIdToRequestId[_tokenId];
        require(_requestId == 0, "Reward not revealed yet");

        require(_isQuestCooldownDone(_tokenId), "Quest cooldown has not completed");

        uint256 _lpStakedAmount = tokenIdToLPStaked[_tokenId];

        // Save on gas by not writing unnecessarily to the chain. These will be overwritten when questing is started again
        if(_sendLegionBackAndClearData) {
            delete tokenIdToQuestDifficulty[_tokenId];
            delete tokenIdToQuestStartTime[_tokenId];
            delete tokenIdToLPStaked[_tokenId];
            delete tokenIdToNumberLoops[_tokenId];

            userToQuestsInProgress[msg.sender].remove(_tokenId);
            legion.adminSafeTransferFrom(address(this), msg.sender, _tokenId);
        }

        if(_lpStakedAmount > 0) {
            bool _lpSucceed = lp.transfer(msg.sender, _lpStakedAmount);
            require(_lpSucceed, "LP transfer failed");
        }

        emit QuestFinished(msg.sender, _tokenId);
    }

    function isQuestReadyToReveal(uint256 _tokenId) external view returns(bool) {
        uint256 _requestId = tokenIdToRequestId[_tokenId];
        require(_requestId > 0, "Not active or already revealed");

        return randomizer.isRandomReady(_requestId);
    }

    function getStakedLegions(
        address _user)
    external
    view
    returns(uint256[] memory)
    {
        return userToQuestsInProgress[_user].values();
    }
}

File 2 of 34 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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 proxied contracts do not make use of 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 : QuestingTimeKeeper.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./QuestingSettings.sol";

abstract contract QuestingTimeKeeper is Initializable, QuestingSettings {

    function __QuestingTimeKeeper_init() internal initializer {
        QuestingSettings.__QuestingSettings_init();
    }

    function _startQuestTime(uint256 _tokenId) internal {
        tokenIdToQuestStartTime[_tokenId] = block.timestamp;
    }

    function _isQuestCooldownDone(uint256 _tokenId) internal view returns(bool) {
        uint256 _startTime = tokenIdToQuestStartTime[_tokenId];
        QuestDifficulty _questDifficulty = tokenIdToQuestDifficulty[_tokenId];
        uint256 _cooldown = difficultyToQuestLength[_questDifficulty];
        return block.timestamp >= _startTime + (_cooldown * tokenIdToNumberLoops[_tokenId]);
    }
}

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

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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 : QuestingSettings.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./QuestingContracts.sol";

abstract contract QuestingSettings is Initializable, QuestingContracts {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function __QuestingSettings_init() internal initializer {
        QuestingContracts.__QuestingContracts_init();
    }

    function setQuestLengths(
        uint256 _easyLength,
        uint256 _mediumLength,
        uint256 _hardLength)
    external
    onlyAdminOrOwner
    {
        difficultyToQuestLength[QuestDifficulty.EASY] = _easyLength;
        difficultyToQuestLength[QuestDifficulty.MEDIUM] = _mediumLength;
        difficultyToQuestLength[QuestDifficulty.HARD] = _hardLength;
    }

    function setLevelDifficultyUnlocks(
        uint8 _easyLevel,
        uint8 _mediumLevel,
        uint8 _hardLevel)
    external
    onlyAdminOrOwner
    {
        difficultyToLevelUnlocked[QuestDifficulty.EASY] = _easyLevel;
        difficultyToLevelUnlocked[QuestDifficulty.MEDIUM] = _mediumLevel;
        difficultyToLevelUnlocked[QuestDifficulty.HARD] = _hardLevel;
    }

    function setLevelSteps(
        uint8 _maxQuestLevel,
        uint256[] calldata _qpNeededForEachLevel,
        uint256[] calldata _qpGainedAtEachLevel
    )
    external
    onlyAdminOrOwner
    {
        require(_maxQuestLevel > 0, "Bad max level");
        require(_qpNeededForEachLevel.length == _maxQuestLevel - 1, "Not enough QP steps");
        require(_qpGainedAtEachLevel.length == _maxQuestLevel - 1, "Not enough QP gained steps");

        maxQuestLevel = _maxQuestLevel;

        delete levelToQPNeeded;
        delete levelToQPGainedPerQuest;

        levelToQPNeeded.push(0);
        levelToQPGainedPerQuest.push(0);

        for(uint256 i = 0; i < _maxQuestLevel - 1; i++) {
            levelToQPNeeded.push(_qpNeededForEachLevel[i]);
            levelToQPGainedPerQuest.push(_qpGainedAtEachLevel[i]);
        }
    }

    // Should be provided in order Easy, Medium, and Hard.
    function setGuaranteedDropAmounts(
        uint8[3] calldata _shardAmounts,
        uint8[3] calldata _starlightAmounts)
    external
    onlyAdminOrOwner
    {
        difficultyToStarlightAmount[QuestDifficulty.EASY] = _shardAmounts[0];
        difficultyToStarlightAmount[QuestDifficulty.MEDIUM] = _shardAmounts[1];
        difficultyToStarlightAmount[QuestDifficulty.HARD] = _shardAmounts[2];

        difficultyToShardAmount[QuestDifficulty.EASY] = _starlightAmounts[0];
        difficultyToShardAmount[QuestDifficulty.MEDIUM] = _starlightAmounts[1];
        difficultyToShardAmount[QuestDifficulty.HARD] = _starlightAmounts[2];
    }

    function setTreasureSettings(
        uint256 _treasureDropOdds,
        uint256 _universalLockDropOdds,
        uint256 _starlightId,
        uint256 _shardId,
        uint256 _universalLockId)
    external
    onlyAdminOrOwner {
        treasureDropOdds = _treasureDropOdds;
        starlightId = _starlightId;
        shardId = _shardId;
        universalLockDropOdds = _universalLockDropOdds;
        universalLockId = _universalLockId;
    }

    function setLPNeeded(uint256[3] calldata _lpNeeded) external onlyAdminOrOwner {
        difficultyToLPNeeded[QuestDifficulty.EASY] = _lpNeeded[0];
        difficultyToLPNeeded[QuestDifficulty.MEDIUM] = _lpNeeded[1];
        difficultyToLPNeeded[QuestDifficulty.HARD] = _lpNeeded[2];
    }

    function setTierOddsForDifficulty(
        uint256[5] calldata _easyTierOdds,
        uint256[5] calldata _mediumTierOdds,
        uint256[5] calldata _hardTierOdds)
    external
    onlyAdminOrOwner
    {
       difficultyToTierOdds[QuestDifficulty.EASY] = _easyTierOdds;
       difficultyToTierOdds[QuestDifficulty.MEDIUM] = _mediumTierOdds;
       difficultyToTierOdds[QuestDifficulty.HARD] = _hardTierOdds;
    }

    function setAutoQuestLoops(uint256[] calldata _availableLoops) external onlyAdminOrOwner {
        uint256[] memory _oldValues = availableAutoQuestLoops.values();
        for(uint256 i = 0; i < _oldValues.length; i++) {
            availableAutoQuestLoops.remove(_oldValues[i]);
        }

        for(uint256 i = 0; i < _availableLoops.length; i++) {
            availableAutoQuestLoops.add(_availableLoops[i]);
        }
    }

    function setRecruitSettings(
        uint8 _recruitNumberOfStarlight,
        uint8 _recruitNumberOfCrystalShards,
        uint256 _recruitCrystalShardsOdds,
        uint256 _recruitUniversalLockOdds)
    external
    onlyAdminOrOwner
    {
        recruitNumberOfStarlight = _recruitNumberOfStarlight;
        recruitNumberOfCrystalShards = _recruitNumberOfCrystalShards;
        recruitCrystalShardsOdds = _recruitCrystalShardsOdds;
        recruitUniversalLockOdds = _recruitUniversalLockOdds;
    }
}

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

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

import "./QuestingState.sol";

abstract contract QuestingContracts is Initializable, QuestingState {

    function __QuestingContracts_init() internal initializer {
        QuestingState.__QuestingState_init();
    }

    function setContracts(
        address _randomizerAddress,
        address _treasureAddress,
        address _legionAddress,
        address _treasureMetadataStoreAddress,
        address _legionMetadataStoreAddress,
        address _lpAddress,
        address _consumableAddress,
        address _treasuryAddress)
    external onlyAdminOrOwner
    {
        randomizer = IRandomizer(_randomizerAddress);
        treasure = ITreasure(_treasureAddress);
        legion = ILegion(_legionAddress);
        treasureMetadataStore = ITreasureMetadataStore(_treasureMetadataStoreAddress);
        legionMetadataStore = ILegionMetadataStore(_legionMetadataStoreAddress);
        lp = ILP(_lpAddress);
        consumable = IConsumable(_consumableAddress);
        treasury = ITreasury(_treasuryAddress);
    }

    modifier contractsAreSet() {
        require(areContractsSet(), "Questing: Contracts aren't set");

        _;
    }

    function areContractsSet() public view returns(bool) {
        return address(randomizer) != address(0)
            && address(treasure) != address(0)
            && address(legion) != address(0)
            && address(treasureMetadataStore) != address(0)
            && address(legionMetadataStore) != address(0)
            && address(consumable) != address(0)
            && address(treasury) != address(0)
            && address(lp) != address(0);
    }
}

File 7 of 34 : QuestingState.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 "./IQuesting.sol";
import "../../shared/AdminableUpgradeable.sol";
import "../external/ITreasure.sol";
import "../external/ILP.sol";
import "../legion/ILegion.sol";
import "../consumable/IConsumable.sol";
import "../treasuremetadatastore/ITreasureMetadataStore.sol";
import "../legionmetadatastore/ILegionMetadataStore.sol";
import "../treasury/ITreasury.sol";

abstract contract QuestingState is Initializable, IQuesting, ERC721HolderUpgradeable, ERC1155HolderUpgradeable, AdminableUpgradeable {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    event QuestStarted(address indexed _owner, uint256 indexed _tokenId, uint256 indexed _requestId, uint256 _finishTime, QuestDifficulty _difficulty);
    event QuestRevealed(address indexed _owner, uint256 indexed _tokenId, QuestReward _reward);
    event QuestFinished(address indexed _owner, uint256 indexed _tokenId);

    IRandomizer public randomizer;
    ITreasure public treasure;
    ILegion public legion;
    IConsumable public consumable;
    ITreasureMetadataStore public treasureMetadataStore;
    ILegionMetadataStore public legionMetadataStore;
    ILP public lp;

    mapping(QuestDifficulty => uint256) public difficultyToQuestLength;
    mapping(QuestDifficulty => uint8) public difficultyToLevelUnlocked;
    mapping(QuestDifficulty => uint8) public difficultyToStarlightAmount;
    mapping(QuestDifficulty => uint8) public difficultyToShardAmount;
    // Ordered from tier 1 (index 0) -> tier 5 (index 4)
    mapping(QuestDifficulty => uint256[5]) public difficultyToTierOdds;
    mapping(QuestDifficulty => uint256) public difficultyToLPNeeded;

    uint8 public maxQuestLevel;
    uint256[] public levelToQPNeeded;
    uint256[] public levelToQPGainedPerQuest;

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

    mapping(uint256 => uint256) public tokenIdToQP;
    mapping(uint256 => uint256) public tokenIdToQuestStartTime;
    mapping(uint256 => uint256) public tokenIdToRequestId;
    mapping(uint256 => QuestDifficulty) public tokenIdToQuestDifficulty;
    mapping(uint256 => uint256) public tokenIdToLPStaked;
    mapping(uint256 => uint256) public tokenIdToNumberLoops;

    uint256 public treasureDropOdds;
    uint256 public universalLockDropOdds;
    uint256 public starlightId;
    uint256 public shardId;
    uint256 public universalLockId;

    EnumerableSetUpgradeable.UintSet internal availableAutoQuestLoops;

    uint8 public recruitNumberOfStarlight;
    uint8 public recruitNumberOfCrystalShards;
    // Out of 100,000
    uint256 public recruitCrystalShardsOdds;
    uint256 public recruitUniversalLockOdds;

    ITreasury public treasury;

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

        difficultyToQuestLength[QuestDifficulty.EASY] = 8 hours;
        difficultyToQuestLength[QuestDifficulty.MEDIUM] = 12 hours;
        difficultyToQuestLength[QuestDifficulty.HARD] = 16 hours;

        difficultyToLevelUnlocked[QuestDifficulty.EASY] = 1;
        difficultyToLevelUnlocked[QuestDifficulty.MEDIUM] = 3;
        difficultyToLevelUnlocked[QuestDifficulty.HARD] = 5;

        maxQuestLevel = 6;

        // Level starts at 1
        levelToQPNeeded.push(0);
        levelToQPNeeded.push(100);
        levelToQPNeeded.push(200);
        levelToQPNeeded.push(500);
        levelToQPNeeded.push(1000);
        levelToQPNeeded.push(2000);

        // Level starts at 1
        levelToQPGainedPerQuest.push(0);
        levelToQPGainedPerQuest.push(10);
        levelToQPGainedPerQuest.push(10);
        levelToQPGainedPerQuest.push(20);
        levelToQPGainedPerQuest.push(20);
        levelToQPGainedPerQuest.push(40);

        treasureDropOdds = 20000;
        universalLockDropOdds = 10;

        difficultyToTierOdds[QuestDifficulty.EASY] = [0, 2500, 5000, 15000, 77500];
        difficultyToTierOdds[QuestDifficulty.MEDIUM] = [1500, 5000, 7000, 17000, 69500];
        difficultyToTierOdds[QuestDifficulty.HARD] = [2500, 9000, 8000, 22000, 58500];

        availableAutoQuestLoops.add(3);
        availableAutoQuestLoops.add(9);
        availableAutoQuestLoops.add(15);

        difficultyToLPNeeded[QuestDifficulty.EASY] = 5 ether;
        difficultyToLPNeeded[QuestDifficulty.MEDIUM] = 10 ether;
        difficultyToLPNeeded[QuestDifficulty.HARD] = 15 ether;

        difficultyToStarlightAmount[QuestDifficulty.EASY] = 3;
        difficultyToStarlightAmount[QuestDifficulty.MEDIUM] = 4;
        difficultyToStarlightAmount[QuestDifficulty.HARD] = 5;

        difficultyToShardAmount[QuestDifficulty.EASY] = 3;
        difficultyToShardAmount[QuestDifficulty.MEDIUM] = 4;
        difficultyToShardAmount[QuestDifficulty.HARD] = 5;

        recruitNumberOfStarlight = 1;
        recruitNumberOfCrystalShards = 1;
        recruitCrystalShardsOdds = 50000;
        recruitUniversalLockOdds = 1;

        starlightId = 8;
        shardId = 9;
        universalLockId = 10;
    }
}

enum QuestDifficulty {
    EASY,
    MEDIUM,
    HARD
}

// This is okay to modify, as it used in an event rather than in state.
struct QuestReward {
    uint8 starlightAmount;
    uint8 crystalShardAmount;
    uint8 universalLockAmount;
    // The ID of the treasure received. Will be 0 if no treasure received.
    uint256 treasureId;
}

File 8 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 9 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 {
    }

    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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 10 of 34 : ERC1155HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

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

/**
 * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 *
 * @dev _Available since v3.1._
 */
contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable {
    function __ERC1155Holder_init() internal onlyInitializing {
    }

    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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 11 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 12 of 34 : IQuesting.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IQuesting {

}

File 13 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 14 of 34 : ITreasure.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ITreasure {
    // Transfers the treasure at the given ID of the given amount.
    // Requires that the legions are pre-approved.
    //
    function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts, bytes memory data) external;

    // Transfers the treasure at the given ID of the given amount.
    //
    function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes memory data) external;

    // Admin only.
    //
    function mint(address _account, uint256 _tokenId, uint256 _amount) external;
}

File 15 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 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 : 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 18 of 34 : ITreasureMetadataStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./TreasureMetadataStoreState.sol";

interface ITreasureMetadataStore {
    // Sets the metadata for the given Ids.
    // Admin only.
    function setMetadataForIds(uint256[] calldata _ids, TreasureMetadata[] calldata _metadatas) external;

    // Returns if the given ID has metadata set.
    function hasMetadataForTreasureId(uint256 _treasureId) external view returns(bool);

    // Returns the metadata for the given ID. Reverts if no metadata for the ID is set.
    function getMetadataForTreasureId(uint256 _treasureId) external view returns(TreasureMetadata memory);

    // For the given tier, gets a random MINTABLE treasure id.
    function getRandomTreasureForTier(uint8 _tier, uint256 _randomNumber) external view returns(uint256);
}

// Do not change. Stored in state.
struct TreasureMetadata {
    TreasureCategory category;
    uint8 tier;
    // Out of 100,000
    uint32 craftingBreakOdds;
    bool isMintable;
    uint256 consumableIdDropWhenBreak;
}

enum TreasureCategory {
    ALCHEMY,
    ARCANA,
    BREWING,
    ENCHANTER,
    LEATHERWORKING,
    SMITHING
}

File 19 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 20 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 21 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 22 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 {
    }

    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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 23 of 34 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (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.
     *
     * NOTE: 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.
     *
     * NOTE: 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 24 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 {
    }

    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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 25 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 26 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 27 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 {
        __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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 28 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 {
        __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());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 29 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 {
    }

    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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 30 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 31 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 32 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;
}

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

import "../../shared/AdminableUpgradeable.sol";
import "./ITreasureMetadataStore.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

abstract contract TreasureMetadataStoreState is AdminableUpgradeable {

    mapping(uint8 => EnumerableSetUpgradeable.UintSet) internal tierToMintableTreasureIds;
    mapping(uint256 => TreasureMetadata) internal treasureIdToMetadata;

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

File 34 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();
    }
}

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

Contract ABI

[{"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":"_owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"QuestFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"components":[{"internalType":"uint8","name":"starlightAmount","type":"uint8"},{"internalType":"uint8","name":"crystalShardAmount","type":"uint8"},{"internalType":"uint8","name":"universalLockAmount","type":"uint8"},{"internalType":"uint256","name":"treasureId","type":"uint256"}],"indexed":false,"internalType":"struct QuestReward","name":"_reward","type":"tuple"}],"name":"QuestRevealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","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"},{"indexed":false,"internalType":"enum QuestDifficulty","name":"_difficulty","type":"uint8"}],"name":"QuestStarted","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":"areContractsSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"consumable","outputs":[{"internalType":"contract IConsumable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum QuestDifficulty","name":"","type":"uint8"}],"name":"difficultyToLPNeeded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum QuestDifficulty","name":"","type":"uint8"}],"name":"difficultyToLevelUnlocked","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum QuestDifficulty","name":"","type":"uint8"}],"name":"difficultyToQuestLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum QuestDifficulty","name":"","type":"uint8"}],"name":"difficultyToShardAmount","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum QuestDifficulty","name":"","type":"uint8"}],"name":"difficultyToStarlightAmount","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum QuestDifficulty","name":"","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"difficultyToTierOdds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"finishTokenQuests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getStakedLegions","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"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":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isQuestReadyToReveal","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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"levelToQPGainedPerQuest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"levelToQPNeeded","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lp","outputs":[{"internalType":"contract ILP","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxQuestLevel","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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":[],"name":"recruitCrystalShardsOdds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recruitNumberOfCrystalShards","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recruitNumberOfStarlight","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recruitUniversalLockOdds","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":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"enum QuestDifficulty[]","name":"_difficulties","type":"uint8[]"},{"internalType":"uint256[]","name":"_questLoops","type":"uint256[]"}],"name":"restartTokenQuests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"revealTokensQuests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_availableLoops","type":"uint256[]"}],"name":"setAutoQuestLoops","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_randomizerAddress","type":"address"},{"internalType":"address","name":"_treasureAddress","type":"address"},{"internalType":"address","name":"_legionAddress","type":"address"},{"internalType":"address","name":"_treasureMetadataStoreAddress","type":"address"},{"internalType":"address","name":"_legionMetadataStoreAddress","type":"address"},{"internalType":"address","name":"_lpAddress","type":"address"},{"internalType":"address","name":"_consumableAddress","type":"address"},{"internalType":"address","name":"_treasuryAddress","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8[3]","name":"_shardAmounts","type":"uint8[3]"},{"internalType":"uint8[3]","name":"_starlightAmounts","type":"uint8[3]"}],"name":"setGuaranteedDropAmounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[3]","name":"_lpNeeded","type":"uint256[3]"}],"name":"setLPNeeded","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_easyLevel","type":"uint8"},{"internalType":"uint8","name":"_mediumLevel","type":"uint8"},{"internalType":"uint8","name":"_hardLevel","type":"uint8"}],"name":"setLevelDifficultyUnlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_maxQuestLevel","type":"uint8"},{"internalType":"uint256[]","name":"_qpNeededForEachLevel","type":"uint256[]"},{"internalType":"uint256[]","name":"_qpGainedAtEachLevel","type":"uint256[]"}],"name":"setLevelSteps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_shouldPause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_easyLength","type":"uint256"},{"internalType":"uint256","name":"_mediumLength","type":"uint256"},{"internalType":"uint256","name":"_hardLength","type":"uint256"}],"name":"setQuestLengths","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_recruitNumberOfStarlight","type":"uint8"},{"internalType":"uint8","name":"_recruitNumberOfCrystalShards","type":"uint8"},{"internalType":"uint256","name":"_recruitCrystalShardsOdds","type":"uint256"},{"internalType":"uint256","name":"_recruitUniversalLockOdds","type":"uint256"}],"name":"setRecruitSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[5]","name":"_easyTierOdds","type":"uint256[5]"},{"internalType":"uint256[5]","name":"_mediumTierOdds","type":"uint256[5]"},{"internalType":"uint256[5]","name":"_hardTierOdds","type":"uint256[5]"}],"name":"setTierOddsForDifficulty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_treasureDropOdds","type":"uint256"},{"internalType":"uint256","name":"_universalLockDropOdds","type":"uint256"},{"internalType":"uint256","name":"_starlightId","type":"uint256"},{"internalType":"uint256","name":"_shardId","type":"uint256"},{"internalType":"uint256","name":"_universalLockId","type":"uint256"}],"name":"setTreasureSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shardId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"starlightId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"enum QuestDifficulty[]","name":"_difficulties","type":"uint8[]"},{"internalType":"uint256[]","name":"_questLoops","type":"uint256[]"}],"name":"startQuests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToLPStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToNumberLoops","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToQP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToQuestDifficulty","outputs":[{"internalType":"enum QuestDifficulty","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToQuestStartTime","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":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasure","outputs":[{"internalType":"contract ITreasure","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasureDropOdds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasureMetadataStore","outputs":[{"internalType":"contract ITreasureMetadataStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"contract ITreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"universalLockDropOdds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"universalLockId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506153ef806100206000396000f3fe608060405234801561001057600080fd5b50600436106103d05760003560e01c80638cdcc4b4116101ff578063cb3a4a741161011a578063f0c1ebe4116100ad578063f2fde38b1161007c578063f2fde38b14610943578063f68fa57814610956578063f93309d114610969578063fb00011e1461097c57600080fd5b8063f0c1ebe4146108be578063f10fb584146108ef578063f161217e14610903578063f23a6e611461092457600080fd5b8063dd26bd84116100e9578063dd26bd8414610860578063e50d19df14610884578063e520fc7e14610897578063e820cb6c146108ab57600080fd5b8063cb3a4a741461081c578063d214c14b1461082f578063d67896a914610839578063d7dfe4dd1461084c57600080fd5b8063ac99ccb611610192578063ba12528911610161578063ba125289146107cd578063bc197c81146107e0578063bd31ba33146107ff578063bedb86fb1461080957600080fd5b8063ac99ccb61461076f578063ad72e1a514610782578063aea88976146107a3578063b5821dc9146107ad57600080fd5b80639b9c9a66116101ce5780639b9c9a66146107145780639c54df6414610727578063a0122ec61461073a578063a46879e71461074e57600080fd5b80638cdcc4b4146106c45780638da5cb5b146106cc57806390a47013146106dd5780639ad8d6f71461070157600080fd5b8063377e11e0116102ef578063675857eb116102825780638129fc1c116102515780638129fc1c1461067657806383d022401461067e57806385b34d97146106a25780638a7bf804146106b057600080fd5b8063675857eb146106345780637048027514610648578063715018a61461065b57806371a54c851461066357600080fd5b806356b048ea116102be57806356b048ea146105f75780635c975abb1461060157806361d027b31461060d5780636696f79c1461062157600080fd5b8063377e11e0146105985780634106f1b9146105ab57806349af3467146105cc5780634ed8d2c0146105d657600080fd5b806324d7806c116103675780632d3a5323116103365780632d3a53231461053c5780632d5240231461054f5780632fc87b9214610562578063313c06a01461056c57600080fd5b806324d7806c146104c85780632521ff47146104f557806327f6eb8e146105085780632bf8b7641461052957600080fd5b8063150b7a02116103a3578063150b7a021461044f5780631785f53c146104865780631c686ee81461049957806324537d37146104a757600080fd5b806301ffc9a7146103d557806303070e45146103fd57806306b8ae04146104155780630cad8b161461043a575b600080fd5b6103e86103e33660046146a1565b61098f565b60405190151581526020015b60405180910390f35b6104076101a95481565b6040519081526020016103f4565b6101b05461042890610100900460ff1681565b60405160ff90911681526020016103f4565b61044d610448366004614717565b6109c6565b005b61046d61045d3660046148ad565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016103f4565b61044d610494366004614915565b610de8565b6101b0546104289060ff1681565b6104076104b5366004614930565b6101a86020526000908152604090205481565b6103e86104d6366004614915565b6001600160a01b0316600090815261015f602052604090205460ff1690565b61044d610503366004614949565b610e34565b610407610516366004614930565b6101a76020526000908152604090205481565b61044d610537366004614986565b610ee8565b61044d61054a3660046149ce565b610fd2565b61040761055d366004614a16565b61102c565b6104076101b25481565b61019854610580906001600160a01b031681565b6040516001600160a01b0390911681526020016103f4565b61044d6105a6366004614a42565b611052565b6104076105b9366004614930565b6101a46020526000908152604090205481565b6104076101b15481565b6104076105e4366004614a84565b61019e6020526000908152604090205481565b6104076101ad5481565b61012d5460ff166103e8565b6101b354610580906001600160a01b031681565b61044d61062f366004614a42565b6110f4565b61019454610580906001600160a01b031681565b61044d610656366004614915565b6111da565b61044d611229565b61044d610671366004614ab0565b61125f565b61044d6112cb565b61042861068c366004614a84565b61019b6020526000908152604090205460ff1681565b61019f546104289060ff1681565b61019754610580906001600160a01b031681565b6103e8611345565b60fb546001600160a01b0316610580565b6104286106eb366004614a84565b61019c6020526000908152604090205460ff1681565b61044d61070f366004614af6565b6113fd565b61044d610722366004614b9e565b6114d1565b61044d610735366004614a42565b61158d565b61019654610580906001600160a01b031681565b61040761075c366004614930565b6101a36020526000908152604090205481565b61044d61077d366004614a42565b61162a565b610407610790366004614930565b6101a56020526000908152604090205481565b6104076101ab5481565b6107c06107bb366004614915565b611755565b6040516103f49190614bba565b6104076107db366004614930565b61177a565b61046d6107ee366004614c7e565b63bc197c8160e01b95945050505050565b6104076101ac5481565b61044d610817366004614d36565b61179c565b61044d61082a366004614d53565b6117f0565b6104076101aa5481565b61044d610847366004614d88565b611a06565b61019554610580906001600160a01b031681565b61042861086e366004614a84565b61019a6020526000908152604090205460ff1681565b610407610892366004614930565b611c66565b61019354610580906001600160a01b031681565b61044d6108b9366004614e0b565b611c77565b6108e26108cc366004614930565b6101a66020526000908152604090205460ff1681565b6040516103f49190614e8e565b61019254610580906001600160a01b031681565b610407610911366004614a84565b6101996020526000908152604090205481565b61046d610932366004614e9c565b63f23a6e6160e01b95945050505050565b61044d610951366004614915565b611d4f565b61044d610964366004614717565b611de7565b61044d610977366004614a42565b612170565b6103e861098a366004614930565b61229d565b60006001600160e01b03198216630271189760e51b14806109c057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6109ce611345565b6109f35760405162461bcd60e51b81526004016109ea90614f01565b60405180910390fd5b61012d5460ff1615610a175760405162461bcd60e51b81526004016109ea90614f38565b85858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050825115159150610a6c90505760405162461bcd60e51b81526004016109ea90614f62565b333214610a8b5760405162461bcd60e51b81526004016109ea90614f87565b8584148015610a9957508184145b610ae55760405162461bcd60e51b815260206004820152601a60248201527f426164206e756d626572206f6620646966666963756c7469657300000000000060448201526064016109ea565b6101b360009054906101000a90046001600160a01b03166001600160a01b031663ca1709556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3457600080fd5b505afa158015610b48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6c9190614fad565b610bb45760405162461bcd60e51b8152602060048201526019602482015278213934b233b2902bb7b93632103737ba103837bbb2b932b21760391b60448201526064016109ea565b60005b86811015610dde57610c06888883818110610bd457610bd4614fca565b3360009081526101a2602090815260409091209391020135905060009081526001919091016020526040902054151590565b610c225760405162461bcd60e51b81526004016109ea90614fe0565b610c45888883818110610c3757610c37614fca565b90506020020135600061237e565b610197546000906001600160a01b031663f15fbdf28a8a85818110610c6c57610c6c614fca565b905060200201356040518263ffffffff1660e01b8152600401610c9191815260200190565b6101806040518083038186803b158015610caa57600080fd5b505afa158015610cbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce2919061509c565b9050600281516002811115610cf957610cf9614e56565b1415610d6757610d62898984818110610d1457610d14614fca565b90506020020135888885818110610d2d57610d2d614fca565b9050602002016020810190610d429190614a84565b878786818110610d5457610d54614fca565b905060200201356000612605565b610dcb565b610dcb898984818110610d7c57610d7c614fca565b90506020020135888885818110610d9557610d95614fca565b9050602002016020810190610daa9190614a84565b878786818110610dbc57610dbc614fca565b905060200201358460006128a5565b5080610dd681615149565b915050610bb7565b5050505050505050565b60fb546001600160a01b03163314610e125760405162461bcd60e51b81526004016109ea90615164565b6001600160a01b0316600090815261015f60205260409020805460ff19169055565b33600090815261015f602052604090205460ff1680610e565750610e56612cb8565b610e725760405162461bcd60e51b81526004016109ea90615199565b6101996020527f64ff465cfcabcf42f95776227c293cec69d4462f43d19ab892c0f096d0681446929092557f25b1716dafbf144c17ee7e01561ffe7a3113c6c5ff9fba1fb9b7a7d39e4c38f75560026000527f4074d44e33158386ca63db52321f67f5d8423dbdefd3bf591730a62f6576595c55565b33600090815261015f602052604090205460ff1680610f0a5750610f0a612cb8565b610f265760405162461bcd60e51b81526004016109ea90615199565b6000805261019d602052610f5c7f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d8460056145c7565b50600160005261019d602052610f947f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff8360056145c7565b50600260005261019d602052610fcc7f29ea485743245ef5c5c24b1a283e9aaa2745fd5e9f6154d72f7ef154d10421bc8260056145c7565b50505050565b33600090815261015f602052604090205460ff1680610ff45750610ff4612cb8565b6110105760405162461bcd60e51b81526004016109ea90615199565b6101a9949094556101ab919091556101ac556101aa556101ad55565b61019d602052816000526040600020816005811061104957600080fd5b01549150829050565b60fb546001600160a01b0316331461107c5760405162461bcd60e51b81526004016109ea90615164565b60005b818110156110ef57600061015f60008585858181106110a0576110a0614fca565b90506020020160208101906110b59190614915565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806110e781615149565b91505061107f565b505050565b33600090815261015f602052604090205460ff16806111165750611116612cb8565b6111325760405162461bcd60e51b81526004016109ea90615199565b600061113f6101ae612cdc565b905060005b815181101561118e5761117b82828151811061116257611162614fca565b60200260200101516101ae612ce990919063ffffffff16565b508061118681615149565b915050611144565b5060005b82811015610fcc576111c78484838181106111af576111af614fca565b905060200201356101ae612cf590919063ffffffff16565b50806111d281615149565b915050611192565b60fb546001600160a01b031633146112045760405162461bcd60e51b81526004016109ea90615164565b6001600160a01b0316600090815261015f60205260409020805460ff19166001179055565b60fb546001600160a01b031633146112535760405162461bcd60e51b81526004016109ea90615164565b61125d6000612d01565b565b33600090815261015f602052604090205460ff16806112815750611281612cb8565b61129d5760405162461bcd60e51b81526004016109ea90615199565b6101b0805460ff9485166101000261ffff199091169490951693909317939093179091556101b1556101b255565b600054610100900460ff166112e65760005460ff16156112ea565b303b155b6113065760405162461bcd60e51b81526004016109ea906151c5565b600054610100900460ff16158015611328576000805461ffff19166101011790555b611330612d53565b8015611342576000805461ff00191690555b50565b610192546000906001600160a01b03161580159061136e5750610193546001600160a01b031615155b80156113855750610194546001600160a01b031615155b801561139c5750610196546001600160a01b031615155b80156113b35750610197546001600160a01b031615155b80156113ca5750610195546001600160a01b031615155b80156113e157506101b3546001600160a01b031615155b80156113f85750610198546001600160a01b031615155b905090565b33600090815261015f602052604090205460ff168061141f575061141f612cb8565b61143b5760405162461bcd60e51b81526004016109ea90615199565b61019280546001600160a01b03199081166001600160a01b039a8b161790915561019380548216988a169890981790975561019480548816968916969096179095556101968054871694881694909417909355610197805486169287169290921790915561019880548516918616919091179055610195805484169185169190911790556101b380549092169216919091179055565b33600090815261015f602052604090205460ff16806114f357506114f3612cb8565b61150f5760405162461bcd60e51b81526004016109ea90615199565b61019e602090815281357f5b1e587894c781c322714baac11bfa7b0da2aeb4590a6dcb5f31ea08c486311b558101357f2d695d1bdc89be0990c9b1cefd0e589f7fbb3368bfb8d91126956a95dcf16073556002600052604001357f1482f8fde77c2e0a1223b839dd85e5e0d40575a23bb6b13896f241a0b36fe0d855565b60fb546001600160a01b031633146115b75760405162461bcd60e51b81526004016109ea90615164565b60005b818110156110ef57600161015f60008585858181106115db576115db614fca565b90506020020160208101906115f09190614915565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061162281615149565b9150506115ba565b611632611345565b61164e5760405162461bcd60e51b81526004016109ea90614f01565b61012d5460ff16156116725760405162461bcd60e51b81526004016109ea90614f38565b818180806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251151591506116c790505760405162461bcd60e51b81526004016109ea90614f62565b3332146116e65760405162461bcd60e51b81526004016109ea90614f87565b60005b82811015610fcc57611706848483818110610bd457610bd4614fca565b6117225760405162461bcd60e51b81526004016109ea90614fe0565b61174384848381811061173757611737614fca565b90506020020135612db8565b8061174d81615149565b9150506116e9565b6001600160a01b03811660009081526101a2602052604090206060906109c090612cdc565b6101a0818154811061178b57600080fd5b600091825260209091200154905081565b33600090815261015f602052604090205460ff16806117be57506117be612cb8565b6117da5760405162461bcd60e51b81526004016109ea90615199565b80156117e8576113426130a1565b611342613118565b33600090815261015f602052604090205460ff16806118125750611812612cb8565b61182e5760405162461bcd60e51b81526004016109ea90615199565b61183b6020830183615213565b6000805261019b60209081527f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a657805460ff191660ff939093169290921790915561188b9060408401908401615213565b600160005261019b6020527f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef805460ff191660ff929092169190911790556118d96060830160408401615213565b600260005261019b60209081527f2a1d4f6078f8c36c9403e0edc3d4b2935b0182bca5295cb74bc8b6bfebfa2a5d805460ff191660ff939093169290921790915561192690820182615213565b6000805261019c60209081527f4b419d2fef537193bcacf7d8e3aa1e02cb76a5e91c9927ac0b4328ae4cf88823805460ff191660ff93909316929092179091556119769060408301908301615213565b600160005261019c6020527fc72eaf8cd3b5c9a905003f86a3aad459ca788a7847e8657dc6013b9edcb24e94805460ff191660ff929092169190911790556119c46060820160408301615213565b600260005261019c6020527f6ac6d6b719103e0be90d8f1dc8f262c2aa4b9ba5e23a506ed6f056d83b5bbc70805460ff191660ff929092169190911790555050565b33600090815261015f602052604090205460ff1680611a285750611a28612cb8565b611a445760405162461bcd60e51b81526004016109ea90615199565b60008560ff1611611a875760405162461bcd60e51b815260206004820152600d60248201526c109859081b585e081b195d995b609a1b60448201526064016109ea565b611a92600186615230565b60ff168314611ad95760405162461bcd60e51b81526020600482015260136024820152724e6f7420656e6f75676820515020737465707360681b60448201526064016109ea565b611ae4600186615230565b60ff168114611b355760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f756768205150206761696e656420737465707300000000000060448201526064016109ea565b61019f805460ff191660ff8716179055611b526101a06000614605565b611b5f6101a16000614605565b6101a08054600181810190925560007f7980fe0f714a613298681d64b7b8ffa7b148338dd52429f307d72798d5c317c49091018190556101a18054928301815581527f138323e2a914e847043e23cddd114fae8437deb6d72c040f1025356455849bda9091018190555b611bd4600187615230565b60ff16811015611c5e576101a0858583818110611bf357611bf3614fca565b835460018101855560009485526020948590209190940292909201359190920155506101a1838383818110611c2a57611c2a614fca565b8354600181018555600094855260209485902091909402929092013591909201555080611c5681615149565b915050611bc9565b505050505050565b6101a1818154811061178b57600080fd5b33600090815261015f602052604090205460ff1680611c995750611c99612cb8565b611cb55760405162461bcd60e51b81526004016109ea90615199565b61019a6020527fdf87daca02df9cb008fcda558ae984ab92a5826e62dcff2b5180361f9f18ebf2805460ff1990811660ff958616179091557f082445bb554fade7877a24b2437efaaa3cb9ee97beb4fd4e4c6f863073eb85c4805482169385169390931790925560026000527fef497134997ac3f497d45996287bb42d7b7318af1499095a908382aa5a592ebd8054919093169116179055565b60fb546001600160a01b03163314611d795760405162461bcd60e51b81526004016109ea90615164565b6001600160a01b038116611dde5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109ea565b61134281612d01565b85858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050825115159150611e3c90505760405162461bcd60e51b81526004016109ea90614f62565b611e44611345565b611e605760405162461bcd60e51b81526004016109ea90614f01565b61012d5460ff1615611e845760405162461bcd60e51b81526004016109ea90614f38565b333214611ea35760405162461bcd60e51b81526004016109ea90614f87565b8584148015611eb157508184145b611efd5760405162461bcd60e51b815260206004820152601a60248201527f426164206e756d626572206f6620646966666963756c7469657300000000000060448201526064016109ea565b6101b360009054906101000a90046001600160a01b03166001600160a01b031663ca1709556040518163ffffffff1660e01b815260040160206040518083038186803b158015611f4c57600080fd5b505afa158015611f60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f849190614fad565b611fcc5760405162461bcd60e51b8152602060048201526019602482015278213934b233b2902bb7b93632103737ba103837bbb2b932b21760391b60448201526064016109ea565b60005b86811015610dde57610197546000906001600160a01b031663f15fbdf28a8a85818110611ffe57611ffe614fca565b905060200201356040518263ffffffff1660e01b815260040161202391815260200190565b6101806040518083038186803b15801561203c57600080fd5b505afa158015612050573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612074919061509c565b905060028151600281111561208b5761208b614e56565b14156120f9576120f48989848181106120a6576120a6614fca565b905060200201358888858181106120bf576120bf614fca565b90506020020160208101906120d49190614a84565b8787868181106120e6576120e6614fca565b905060200201356001612605565b61215d565b61215d89898481811061210e5761210e614fca565b9050602002013588888581811061212757612127614fca565b905060200201602081019061213c9190614a84565b87878681811061214e5761214e614fca565b905060200201358460016128a5565b508061216881615149565b915050611fcf565b612178611345565b6121945760405162461bcd60e51b81526004016109ea90614f01565b61012d5460ff16156121b85760405162461bcd60e51b81526004016109ea90614f38565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061220d90505760405162461bcd60e51b81526004016109ea90614f62565b33321461222c5760405162461bcd60e51b81526004016109ea90614f87565b60005b82811015610fcc5761224c848483818110610bd457610bd4614fca565b6122685760405162461bcd60e51b81526004016109ea90614fe0565b61228b84848381811061227d5761227d614fca565b90506020020135600161237e565b8061229581615149565b91505061222f565b60008181526101a56020526040812054806122fa5760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420616374697665206f7220616c72656164792072657665616c6564000060448201526064016109ea565b6101925460405163f030210760e01b8152600481018390526001600160a01b039091169063f03021079060240160206040518083038186803b15801561233f57600080fd5b505afa158015612353573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123779190614fad565b9392505050565b60008281526101a5602052604090205480156123dc5760405162461bcd60e51b815260206004820152601760248201527f526577617264206e6f742072657665616c65642079657400000000000000000060448201526064016109ea565b6123e583613194565b6124315760405162461bcd60e51b815260206004820181905260248201527f517565737420636f6f6c646f776e20686173206e6f7420636f6d706c6574656460448201526064016109ea565b60008381526101a7602052604090205482156125005760008481526101a660209081526040808320805460ff191690556101a482528083208390556101a782528083208390556101a882528083208390553383526101a290915290206124979085612ce9565b50610194546040516383291f8760e01b81526001600160a01b03909116906383291f87906124cd90309033908990600401615253565b600060405180830381600087803b1580156124e757600080fd5b505af11580156124fb573d6000803e3d6000fd5b505050505b80156125d2576101985460405163a9059cbb60e01b8152336004820152602481018390526000916001600160a01b03169063a9059cbb90604401602060405180830381600087803b15801561255457600080fd5b505af1158015612568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258c9190614fad565b9050806125d05760405162461bcd60e51b81526020600482015260126024820152711314081d1c985b9cd9995c8819985a5b195960721b60448201526064016109ea565b505b604051849033907f8ac429d7fc602a05164517560aadca9c5327863f7f5077d92f78a2e91922722e90600090a350505050565b816001146126555760405162461bcd60e51b815260206004820152601d60248201527f4d61782031206c6f6f7020666f722072656372756974206c6567696f6e00000060448201526064016109ea565b600083600281111561266957612669614e56565b146126ae5760405162461bcd60e51b815260206004820152601560248201527411585cde481bdb9b1e48199bdc881c9958dc9d5a5d605a1b60448201526064016109ea565b60008481526101a46020908152604080832042905561019254815163433c53d960e11b815291516001600160a01b0390911692638678a7b2926004808201939182900301818787803b15801561270357600080fd5b505af1158015612717573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273b9190615277565b60008681526101a5602090815260408083208490556101a690915290208054919250859160ff1916600183600281111561277757612777614e56565b021790555060008581526101a8602052604090208390558115612817573360009081526101a2602052604090206127ae9086612cf5565b50610194546040516383291f8760e01b81526001600160a01b03909116906383291f87906127e490339030908a90600401615253565b600060405180830381600087803b1580156127fe57600080fd5b505af1158015612812573d6000803e3d6000fd5b505050505b8085337ff9bf523eabbad837ea3c0c583eda3c19f5d05a9a1c3254e37480198a72e05f448661019960008a600281111561285357612853614e56565b600281111561286457612864614e56565b81526020019081526020016000205461287d9190615290565b61288790426152af565b886040516128969291906152c7565b60405180910390a45050505050565b600083600114612a235760008481526101af602052604090205461290b5760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206e756d626572206f66206c6f6f707300000000000000000060448201526064016109ea565b8361019e600087600281111561292357612923614e56565b600281111561293457612934614e56565b81526020019081526020016000205461294d9190615290565b90508015612a2357610198546040516323b872dd60e01b81526000916001600160a01b0316906323b872dd9061298b90339030908790600401615253565b602060405180830381600087803b1580156129a557600080fd5b505af11580156129b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129dd9190614fad565b905080612a215760405162461bcd60e51b81526020600482015260126024820152711314081d1c985b9cd9995c8819985a5b195960721b60448201526064016109ea565b505b600061019a6000876002811115612a3c57612a3c614e56565b6002811115612a4d57612a4d614e56565b8152602081019190915260400160002054606085015160ff918216925016811115612aba5760405162461bcd60e51b815260206004820152601860248201527f446966666963756c7479206e6f7420756e6c6f636b65642e000000000000000060448201526064016109ea565b60008781526101a46020908152604080832042905561019254815163433c53d960e11b815291516001600160a01b0390911692638678a7b2926004808201939182900301818787803b158015612b0f57600080fd5b505af1158015612b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b479190615277565b60008981526101a5602090815260408083208490556101a690915290208054919250889160ff19166001836002811115612b8357612b83614e56565b021790555060008881526101a7602090815260408083208690556101a890915290208690558315612c31573360009081526101a260205260409020612bc89089612cf5565b50610194546040516383291f8760e01b81526001600160a01b03909116906383291f8790612bfe90339030908d90600401615253565b600060405180830381600087803b158015612c1857600080fd5b505af1158015612c2c573d6000803e3d6000fd5b505050505b8088337ff9bf523eabbad837ea3c0c583eda3c19f5d05a9a1c3254e37480198a72e05f4461019960008c6002811115612c6c57612c6c614e56565b6002811115612c7d57612c7d614e56565b81526020019081526020016000205442612c9791906152af565b8b604051612ca69291906152c7565b60405180910390a45050505050505050565b600033612ccd60fb546001600160a01b031690565b6001600160a01b031614905090565b6060600061237783613222565b6000612377838361327e565b60006123778383613371565b60fb80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612d6e5760005460ff1615612d72565b303b155b612d8e5760405162461bcd60e51b81526004016109ea906151c5565b600054610100900460ff16158015612db0576000805461ffff19166101011790555b6113306133c0565b60008181526101a5602052604090205480612e155760405162461bcd60e51b815260206004820152601760248201527f416c72656164792072657665616c65642071756573747300000000000000000060448201526064016109ea565b6101925460405163f030210760e01b8152600481018390526001600160a01b039091169063f03021079060240160206040518083038186803b158015612e5a57600080fd5b505afa158015612e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e929190614fad565b612ed55760405162461bcd60e51b815260206004820152601460248201527352616e646f6d206973206e6f742072656164792160601b60448201526064016109ea565b60008281526101a6602052604080822054610192549151634ad30a7560e01b81526004810185905260ff90911692916001600160a01b031690634ad30a759060240160206040518083038186803b158015612f2f57600080fd5b505afa158015612f43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f679190615277565b610197546040516378afdef960e11b8152600481018790529192506000916001600160a01b039091169063f15fbdf2906024016101806040518083038186803b158015612fb357600080fd5b505afa158015612fc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612feb919061509c565b905060005b60008681526101a8602052604090205481101561308a57604080516020810185905290810182905260600160408051601f198184030181529190528051602090910120925060028251600281111561304a5761304a614e56565b141561305f5761305a8684613425565b613078565b61306a86858561370e565b613078868360600151613c71565b8061308281615149565b915050612ff0565b505050600092835250506101a56020526040812055565b61012d5460ff16156130c55760405162461bcd60e51b81526004016109ea90614f38565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586130fb3390565b6040516001600160a01b03909116815260200160405180910390a1565b61012d5460ff166131625760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109ea565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336130fb565b60008181526101a460209081526040808320546101a690925282205460ff1682610199818360028111156131ca576131ca614e56565b60028111156131db576131db614e56565b81526020019081526020016000205490506101a86000868152602001908152602001600020548161320c9190615290565b61321690846152af565b42101595945050505050565b60608160000180548060200260200160405190810160405280929190818152602001828054801561327257602002820191906000526020600020905b81548152602001906001019080831161325e575b50505050509050919050565b600081815260018301602052604081205480156133675760006132a26001836152db565b85549091506000906132b6906001906152db565b905081811461331b5760008660000182815481106132d6576132d6614fca565b90600052602060002001549050808760000184815481106132f9576132f9614fca565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061332c5761332c6152f2565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506109c0565b60009150506109c0565b60008181526001830160205260408120546133b8575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556109c0565b5060006109c0565b600054610100900460ff166133db5760005460ff16156133df565b303b155b6133fb5760405162461bcd60e51b81526004016109ea906151c5565b600054610100900460ff1615801561341d576000805461ffff19166101011790555b611330613de4565b6101ab541580159061343957506101ac5415155b801561344757506101ad5415155b61348b5760405162461bcd60e51b815260206004820152601560248201527410dbdb9cdd5b58589b19481251081b9bdd081cd95d605a1b60448201526064016109ea565b6101b05460ff16801561350357610195546101ab54604051630ab714fb60e11b81526001600160a01b039092169163156e29f6916134d0913391908690600401615308565b600060405180830381600087803b1580156134ea57600080fd5b505af11580156134fe573d6000803e3d6000fd5b505050505b6101b054600090610100900460ff16156135df576000613526620186a08561532c565b60408051602081018790529081018690529091506060016040516020818303038152906040528051906020012060001c93506101b1548110156135dd576101b054610195546101ac54604051630ab714fb60e11b815261010090930460ff1694506001600160a01b039091169163156e29f6916135aa913391908790600401615308565b600060405180830381600087803b1580156135c457600080fd5b505af11580156135d8573d6000803e3d6000fd5b505050505b505b60006135ee620186a08561532c565b905060006101b25482101561367357610195546101ad54604051630ab714fb60e11b81523360048201526024810191909152600160448201526001600160a01b039091169063156e29f690606401600060405180830381600087803b15801561365657600080fd5b505af115801561366a573d6000803e3d6000fd5b50505050600190505b6040805160808101825260ff80871682528581166020830152831681830152600060608201529051879133917fc255245a3e4dbbee8d3a2bf2e49e4fe763a2ceace1a69b09f80803770cc20ffc916136fe91600060808201905060ff835116825260ff602084015116602083015260ff60408401511660408301526060830151606083015292915050565b60405180910390a3505050505050565b6101ab541580159061372257506101ac5415155b801561373057506101ad5415155b6137745760405162461bcd60e51b815260206004820152601560248201527410dbdb9cdd5b58589b19481251081b9bdd081cd95d605a1b60448201526064016109ea565b600061019b600084600281111561378d5761378d614e56565b600281111561379e5761379e614e56565b8152602081019190915260400160009081205460ff16915061019c818560028111156137cc576137cc614e56565b60028111156137dd576137dd614e56565b815260208101919091526040016000205460ff908116915082161561386757610195546101ab54604051630ab714fb60e11b81526001600160a01b039092169163156e29f691613834913391908790600401615308565b600060405180830381600087803b15801561384e57600080fd5b505af1158015613862573d6000803e3d6000fd5b505050505b60ff8116156138db57610195546101ac54604051630ab714fb60e11b81526001600160a01b039092169163156e29f6916138a8913391908690600401615308565b600060405180830381600087803b1580156138c257600080fd5b505af11580156138d6573d6000803e3d6000fd5b505050505b6000806138eb620186a08661532c565b90506101a954811015613b2357604080516020810187905290810186905260600160408051601f19818403018152919052805160209091012094506000613935620186a08761532c565b9050600061019d600089600281111561395057613950614e56565b600281111561396157613961614e56565b815260208101919091526040908101600020815160a08101928390529160059082845b81548152602001906001019080831161398457505050505090506000805b6005811015613b1e578281600581106139bd576139bd614fca565b60200201516139cc90836152af565b915081841015613b0c5760408051602081018b90529081018a905260600160408051601f198184030181529190528051602090910120610196549099506001600160a01b0316637498e03f613a228360016152af565b6040516001600160e01b031960e084901b16815260ff9091166004820152602481018c905260440160206040518083038186803b158015613a6257600080fd5b505afa158015613a76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a9a9190615277565b61019354604051630ab714fb60e11b815233600482015260248101839052600160448201529197506001600160a01b03169063156e29f690606401600060405180830381600087803b158015613aef57600080fd5b505af1158015613b03573d6000803e3d6000fd5b50505050613b1e565b80613b1681615149565b9150506139a2565b505050505b604080516020810187905290810186905260600160408051601f19818403018152919052805160209091012094506000613b60620186a08761532c565b905060006101aa54821015613be557610195546101ad54604051630ab714fb60e11b81523360048201526024810191909152600160448201526001600160a01b039091169063156e29f690606401600060405180830381600087803b158015613bc857600080fd5b505af1158015613bdc573d6000803e3d6000fd5b50505050600190505b604080516080808201835260ff808a16808452898216602080860191825287841686880190815260609687018c815288519485529251851691840191909152519092169481019490945251918301919091528a9133917fc255245a3e4dbbee8d3a2bf2e49e4fe763a2ceace1a69b09f80803770cc20ffc910160405180910390a3505050505050505050565b61019f5460ff90811690821610613c86575050565b6101a18160ff1681548110613c9d57613c9d614fca565b90600052602060002001546101a360008481526020019081526020016000206000828254613ccb91906152af565b90915550505b61019f5460ff908116908216108015613d1f57506101a08160ff1681548110613cfc57613cfc614fca565b90600052602060002001546101a360008481526020019081526020016000205410155b15613de0576101a08160ff1681548110613d3b57613d3b614fca565b90600052602060002001546101a360008481526020019081526020016000206000828254613d6991906152db565b90915550506101975460405163ccd5efbf60e01b8152600481018490526001600160a01b039091169063ccd5efbf90602401600060405180830381600087803b158015613db557600080fd5b505af1158015613dc9573d6000803e3d6000fd5b505050508080613dd89061534e565b915050613cd1565b5050565b600054610100900460ff16613dff5760005460ff1615613e03565b303b155b613e1f5760405162461bcd60e51b81526004016109ea906151c5565b600054610100900460ff16158015613e41576000805461ffff19166101011790555b611330600054610100900460ff16613e5f5760005460ff1615613e63565b303b155b613e7f5760405162461bcd60e51b81526004016109ea906151c5565b600054610100900460ff16158015613ea1576000805461ffff19166101011790555b613ea9614404565b613eb1614469565b613eb9614469565b6170807f64ff465cfcabcf42f95776227c293cec69d4462f43d19ab892c0f096d06814465561a8c07f25b1716dafbf144c17ee7e01561ffe7a3113c6c5ff9fba1fb9b7a7d39e4c38f75561e1007f4074d44e33158386ca63db52321f67f5d8423dbdefd3bf591730a62f6576595c557fdf87daca02df9cb008fcda558ae984ab92a5826e62dcff2b5180361f9f18ebf28054600160ff1991821681179092557f082445bb554fade7877a24b2437efaaa3cb9ee97beb4fd4e4c6f863073eb85c48054821660031790557fef497134997ac3f497d45996287bb42d7b7318af1499095a908382aa5a592ebd80546005908316811790915561019f80549092166006179091556101a08054808401825560007f7980fe0f714a613298681d64b7b8ffa7b148338dd52429f307d72798d5c317c4918201819055825480860184556064908301558254808601845560c890830155825480860184556101f490830155825480860184556103e89083015582548086019093556107d092909101919091556101a1805480850182557f138323e2a914e847043e23cddd114fae8437deb6d72c040f1025356455849bda90810183905581548086018355600a9082018190558254808701845582018190558254808701845560149083018190558354808801855583015582549586019092556028940193909355614e206101a9556101aa929092556040805160a0810182528381526109c460208083019190915261138892820192909252613a98606082015262012ebc608082015292805261019d9052614123917f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d91614623565b506040805160a0810182526105dc8152611388602080830191909152611b5892820192909252614268606082015262010f7c6080820152600160005261019d909152614192907f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff906005614623565b506040805160a0810182526109c48152612328602080830191909152611f40928201929092526155f0606082015261e4846080820152600260005261019d909152614200907f29ea485743245ef5c5c24b1a283e9aaa2745fd5e9f6154d72f7ef154d10421bc906005614658565b5061420e6101ae6003612cf5565b5061421c6101ae6009612cf5565b5061422a6101ae600f612cf5565b50674563918244f400007f5b1e587894c781c322714baac11bfa7b0da2aeb4590a6dcb5f31ea08c486311b55678ac7230489e800007f2d695d1bdc89be0990c9b1cefd0e589f7fbb3368bfb8d91126956a95dcf160735567d02ab486cedc00007f1482f8fde77c2e0a1223b839dd85e5e0d40575a23bb6b13896f241a0b36fe0d8557f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a6578054600360ff1991821681179092557f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef8054821660049081179091557f2a1d4f6078f8c36c9403e0edc3d4b2935b0182bca5295cb74bc8b6bfebfa2a5d80546005908416811790915561019c6020527f4b419d2fef537193bcacf7d8e3aa1e02cb76a5e91c9927ac0b4328ae4cf88823805484169094179093557fc72eaf8cd3b5c9a905003f86a3aad459ca788a7847e8657dc6013b9edcb24e9480548316909117905560026000527f6ac6d6b719103e0be90d8f1dc8f262c2aa4b9ba5e23a506ed6f056d83b5bbc70805490911690911790556101b0805461ffff191661010117905561c3506101b15560016101b25560086101ab5560096101ac55600a6101ad558015611342576000805461ff001916905550565b600054610100900460ff1661441f5760005460ff1615614423565b303b155b61443f5760405162461bcd60e51b81526004016109ea906151c5565b600054610100900460ff16158015614461576000805461ffff19166101011790555b611330614490565b600054610100900460ff1661125d5760405162461bcd60e51b81526004016109ea9061536e565b600054610100900460ff166144ab5760005460ff16156144af565b303b155b6144cb5760405162461bcd60e51b81526004016109ea906151c5565b600054610100900460ff161580156144ed576000805461ffff19166101011790555b6144f5614505565b6144fd614534565b6113306130a1565b600054610100900460ff1661452c5760405162461bcd60e51b81526004016109ea9061536e565b61125d614563565b600054610100900460ff1661455b5760405162461bcd60e51b81526004016109ea9061536e565b61125d614593565b600054610100900460ff1661458a5760405162461bcd60e51b81526004016109ea9061536e565b61125d33612d01565b600054610100900460ff166145ba5760405162461bcd60e51b81526004016109ea9061536e565b61012d805460ff19169055565b82600581019282156145f5579160200282015b828111156145f55782358255916020019190600101906145da565b5061460192915061468c565b5090565b5080546000825590600052602060002090810190611342919061468c565b82600581019282156145f5579160200282015b828111156145f5578251829062ffffff16905591602001919060010190614636565b82600581019282156145f5579160200282015b828111156145f5578251829061ffff1690559160200191906001019061466b565b5b80821115614601576000815560010161468d565b6000602082840312156146b357600080fd5b81356001600160e01b03198116811461237757600080fd5b60008083601f8401126146dd57600080fd5b50813567ffffffffffffffff8111156146f557600080fd5b6020830191508360208260051b850101111561471057600080fd5b9250929050565b6000806000806000806060878903121561473057600080fd5b863567ffffffffffffffff8082111561474857600080fd5b6147548a838b016146cb565b9098509650602089013591508082111561476d57600080fd5b6147798a838b016146cb565b9096509450604089013591508082111561479257600080fd5b5061479f89828a016146cb565b979a9699509497509295939492505050565b80356001600160a01b03811681146147c857600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff81118282101715614806576148066147cd565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614835576148356147cd565b604052919050565b600082601f83011261484e57600080fd5b813567ffffffffffffffff811115614868576148686147cd565b61487b601f8201601f191660200161480c565b81815284602083860101111561489057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156148c357600080fd5b6148cc856147b1565b93506148da602086016147b1565b925060408501359150606085013567ffffffffffffffff8111156148fd57600080fd5b6149098782880161483d565b91505092959194509250565b60006020828403121561492757600080fd5b612377826147b1565b60006020828403121561494257600080fd5b5035919050565b60008060006060848603121561495e57600080fd5b505081359360208301359350604090920135919050565b8060a081018310156109c057600080fd5b60008060006101e0848603121561499c57600080fd5b6149a68585614975565b92506149b58560a08601614975565b91506149c5856101408601614975565b90509250925092565b600080600080600060a086880312156149e657600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6003811061134257600080fd5b60008060408385031215614a2957600080fd5b8235614a3481614a09565b946020939093013593505050565b60008060208385031215614a5557600080fd5b823567ffffffffffffffff811115614a6c57600080fd5b614a78858286016146cb565b90969095509350505050565b600060208284031215614a9657600080fd5b813561237781614a09565b60ff8116811461134257600080fd5b60008060008060808587031215614ac657600080fd5b8435614ad181614aa1565b93506020850135614ae181614aa1565b93969395505050506040820135916060013590565b600080600080600080600080610100898b031215614b1357600080fd5b614b1c896147b1565b9750614b2a60208a016147b1565b9650614b3860408a016147b1565b9550614b4660608a016147b1565b9450614b5460808a016147b1565b9350614b6260a08a016147b1565b9250614b7060c08a016147b1565b9150614b7e60e08a016147b1565b90509295985092959890939650565b80606081018310156109c057600080fd5b600060608284031215614bb057600080fd5b6123778383614b8d565b6020808252825182820181905260009190848201906040850190845b81811015614bf257835183529284019291840191600101614bd6565b50909695505050505050565b600082601f830112614c0f57600080fd5b8135602067ffffffffffffffff821115614c2b57614c2b6147cd565b8160051b614c3a82820161480c565b9283528481018201928281019087851115614c5457600080fd5b83870192505b84831015614c7357823582529183019190830190614c5a565b979650505050505050565b600080600080600060a08688031215614c9657600080fd5b614c9f866147b1565b9450614cad602087016147b1565b9350604086013567ffffffffffffffff80821115614cca57600080fd5b614cd689838a01614bfe565b94506060880135915080821115614cec57600080fd5b614cf889838a01614bfe565b93506080880135915080821115614d0e57600080fd5b50614d1b8882890161483d565b9150509295509295909350565b801515811461134257600080fd5b600060208284031215614d4857600080fd5b813561237781614d28565b60008060c08385031215614d6657600080fd5b614d708484614b8d565b9150614d7f8460608501614b8d565b90509250929050565b600080600080600060608688031215614da057600080fd5b8535614dab81614aa1565b9450602086013567ffffffffffffffff80821115614dc857600080fd5b614dd489838a016146cb565b90965094506040880135915080821115614ded57600080fd5b50614dfa888289016146cb565b969995985093965092949392505050565b600080600060608486031215614e2057600080fd5b8335614e2b81614aa1565b92506020840135614e3b81614aa1565b91506040840135614e4b81614aa1565b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b60038110614e8a57634e487b7160e01b600052602160045260246000fd5b9052565b602081016109c08284614e6c565b600080600080600060a08688031215614eb457600080fd5b614ebd866147b1565b9450614ecb602087016147b1565b93506040860135925060608601359150608086013567ffffffffffffffff811115614ef557600080fd5b614d1b8882890161483d565b6020808252601e908201527f5175657374696e673a20436f6e747261637473206172656e2774207365740000604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252600b908201526a456d70747920617272617960a81b604082015260600190565b6020808252600c908201526b4e6f20636f6e74726163747360a01b604082015260600190565b600060208284031215614fbf57600080fd5b815161237781614d28565b634e487b7160e01b600052603260045260246000fd5b6020808252601190820152702737ba1037bbb732b210313c903ab9b2b960791b604082015260600190565b8051600681106147c857600080fd5b80516147c881614aa1565b600082601f83011261503657600080fd5b60405160c0810181811067ffffffffffffffff82111715615059576150596147cd565b6040528060c084018581111561506e57600080fd5b845b8181101561509157805161508381614aa1565b835260209283019201615070565b509195945050505050565b600061018082840312156150af57600080fd5b6150b76147e3565b82516150c281614a09565b81526020830151600a81106150d657600080fd5b60208201526150e76040840161500b565b60408201526150f86060840161501a565b60608201526151096080840161501a565b608082015261511b8460a08501615025565b60a0820152610160929092015160c083015250919050565b634e487b7160e01b600052601160045260246000fd5b600060001982141561515d5761515d615133565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601290820152712737ba1030b236b4b71037b91037bbb732b960711b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60006020828403121561522557600080fd5b813561237781614aa1565b600060ff821660ff84168082101561524a5761524a615133565b90039392505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561528957600080fd5b5051919050565b60008160001904831182151516156152aa576152aa615133565b500290565b600082198211156152c2576152c2615133565b500190565b828152604081016123776020830184614e6c565b6000828210156152ed576152ed615133565b500390565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b03939093168352602083019190915260ff16604082015260600190565b60008261534957634e487b7160e01b600052601260045260246000fd5b500690565b600060ff821660ff81141561536557615365615133565b60010192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212209e9d18802f80bc4c15abc5b37b051ab64f2e0500e205bb6da0c1757c24e95aa964736f6c63430008090033

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.