Contract 0x45EfA2812E1D8d1297EDb97f26A3C36A8FEE53d3

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x5a4eb47877eab4c241f1568fc6eeca9b5f8368c9377349efea69a5aebc6090160x6080604049562862022-01-24 8:44:23115 days 19 hrs ago0xb013abd83f0bd173e9f14ce7d6e420ad711483b4 IN  Create: Questing0 ETH0.08659995721 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x421541d7a313b6d242270adfe2a737ec67a514eed28280bb3307cea929454f0155833302022-02-07 17:37:35101 days 10 hrs ago 0x31575e07c79011949a434b683e933ecae2e66484 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x8fef7275cf6b47a56579f42f56e92c414d56f304da6fa9b8bce61c8c7b8e3dcc55833292022-02-07 17:37:35101 days 10 hrs ago 0x6407886b1bae3e1b535c6d47d7dcd56195b3c11d 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x12d53726c901dd9b4a99eabadefe48cb903abeddf04dd232d7c2aac2ce3e4e9355833282022-02-07 17:37:35101 days 10 hrs ago 0xf69eaa349b7a92e0d0cffb1b926cdff2c44220bd 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x1ffb93c0cda01ae530f038e979f8bf2b2dba5bd7258a68234ce4a734b907069e55833192022-02-07 17:35:53101 days 10 hrs ago 0x4f2999191c762a0aafa4f01603989f0533fd8b0e 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x5396815b6da234579a49df22ea3534a22e06bed3232740f7c3258790c9904ac055833162022-02-07 17:35:53101 days 10 hrs ago 0xc41bdb989c8d0267f650d25708e442119c6d4d10 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x91760505f9a714576fe515e3215eb9aa2d818b2d53743d78cb1d5b729cf6f3a455833142022-02-07 17:35:53101 days 10 hrs ago 0x920471f0dfc19d49c33b9fcfb5307c6b25f53bf1 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x5dcd6269469b4b438eadf04d9b9886a4b758c3ae6eaab3a4f8d25aac8412646d55833112022-02-07 17:35:53101 days 10 hrs ago 0x2efa51e8e4c8c564cfa73e29171707c57244ce7a 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x4bb2f8cd872795edc45a1948e12c66ad6841500ad9dcb6ff34b3fa13ba97777155833102022-02-07 17:35:53101 days 10 hrs ago 0x11ab9463418e47fc5d9fe2a17f662adb19b295c1 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x3a6c396c2c9689f1b71feeccd9323a32a75810cbfe36cb1dbde240c3065eab0955833042022-02-07 17:35:53101 days 10 hrs ago 0x367600c7d2da61ad8b7bde808054abc6cc7f6abb 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x895c2abb006a14abd34d475348d4934c3b998a4b1a4392433ecdd297974fd0b655832962022-02-07 17:35:53101 days 10 hrs ago 0xf6ec5ac46a5d882883785840be9416ff5ff50c6a 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0xeb5a5f22be421fc4a28a60867e436d7faebb8ff43e3732a5a1b4d082c992810155832952022-02-07 17:35:53101 days 10 hrs ago 0x56311eecf9141d6135fc5a60f7de7145da6b61e3 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x035c0c46d0241e2578560d9d55c047c77a60f5ab39aad9b1ea4422c6209d99ff55832932022-02-07 17:35:53101 days 10 hrs ago 0x0090720fed7fed66ed658118b7b3bb0189d3a495 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x81c49158b80c09dcdecc3a87c25cccf90747f149ef14f95a354af38337d2118255832882022-02-07 17:35:53101 days 10 hrs ago 0xdf95760cee82a371ea0da6195f4bc8cf7529b735 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0xea2bcb8abb494e0973b5dfc9af968659368be40b2603f8cb7de57603a030cfad55832862022-02-07 17:35:53101 days 10 hrs ago 0x91f3186fa8a1974ee30aa7c5d628fab364ab6f48 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x93857b4039dd2a5aefbba359c0333e2fc44fd4b42dacf26715dc7036ee40b6da55832802022-02-07 17:35:53101 days 10 hrs ago 0xfd358ab53aafabb4504c68da5f6d3e1c98c437f4 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0xe4562f8edd772f71cc3ff5d6e08d39be5bea655cd71d2c8c37dc415e9b5409ee55832772022-02-07 17:35:53101 days 10 hrs ago 0x920471f0dfc19d49c33b9fcfb5307c6b25f53bf1 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x95e8de6ef0d78196ab031cecbca3430f5a47c9d7364873da63e912458417d5b555832742022-02-07 17:35:53101 days 10 hrs ago 0xecfdd15ad2e7bbb5560ec93e2509dfcd8949121f 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0xdeb800abd61fe7d4125a3e1595a0f967970e8784ef4e74cf904ded14ee1947ac55832722022-02-07 17:35:53101 days 10 hrs ago 0x9a3514439aed2aa3c608fa3defcc16fe900efd1a 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x65706684c7916e4ddd25b05c3b0d987cbddbaadde281d53984b81da99ec8d37055832692022-02-07 17:35:53101 days 10 hrs ago 0xdb94daa8bf1b6f45b122f442f922a2c4dd2f7ade 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x7c6fd668eeafafe458d43e1ef94e18c31fb9808f9dca45aecdc202aaf0a7d8b655832682022-02-07 17:35:53101 days 10 hrs ago 0x9f8e4a00a1d59889b970aab8fbdc1af3819c25fa 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x1dbde86d04e5e897888339128a2337a3947e94d524dbe0833257563fe600fcb255832662022-02-07 17:35:53101 days 10 hrs ago 0x2efa51e8e4c8c564cfa73e29171707c57244ce7a 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x39c488690edbc0c54352cde4928dfeebadd67677ec3290376142340bb7c6a20355832652022-02-07 17:35:53101 days 10 hrs ago 0x56311eecf9141d6135fc5a60f7de7145da6b61e3 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0xb0aa7184885cfd91d120e14b7be0bc9cff97667cd5729b2e3962e0e84ef90c0955832642022-02-07 17:35:53101 days 10 hrs ago 0x9f77d892524bd9167c0a72fd6e58d645e5c14550 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0x8898bfb50a2d54a85c2c57ce01c55e312970ea37552abc56d5666c3de959a6f655832612022-02-07 17:35:53101 days 10 hrs ago 0x15f386a69eb29c2d284a655957e3b96a62fb76d9 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 ETH
0xb2aadd5f2e8d2ce796fa81e61eb56e48722fd4af83e039b73a4a41343ad0dfe555832602022-02-07 17:35:53101 days 10 hrs ago 0xf6174f219d468b420af8787a979b7b81bc69d136 0x45efa2812e1d8d1297edb97f26a3c36a8fee53d30 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]);
            } else {
                _startQuest(_tokenIds[i], _difficulties[i], _questLoops[i], _legionMetadata);
            }
        }
    }

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

        userToQuestsInProgress[msg.sender].add(_tokenId);
        _startQuestTime(_tokenId);

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

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

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

    function _startQuest(
        uint256 _tokenId,
        QuestDifficulty _difficulty,
        uint256 _numberLoops,
        LegionMetadata memory _legionMetadata)
    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, "Difficult not unlocked.");

        userToQuestsInProgress[msg.sender].add(_tokenId);
        _startQuestTime(_tokenId);

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

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

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

    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 revealQuests()
    external
    contractsAreSet
    whenNotPaused
    onlyEOA
    {
        uint256[] memory _tokenIds = userToQuestsInProgress[msg.sender].values();

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

            _revealQuest(_tokenId);
        }
    }

    function _revealQuest(uint256 _tokenId) private {
        uint256 _requestId = tokenIdToRequestId[_tokenId];
        if(_requestId == 0) {
            // Already revealed, just in the waiting period.
            return;
        }

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

        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];
        delete tokenIdToNumberLoops[_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);
                }
            }
        }

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

    function finishQuests()
    external
    contractsAreSet
    whenNotPaused
    onlyEOA
    {
        uint256[] memory _tokenIds = userToQuestsInProgress[msg.sender].values();

        for(uint256 i = 0; i < _tokenIds.length; i++) {
            _finishQuest(_tokenIds[i]);
        }
    }

    function _finishQuest(uint256 _tokenId) private {
        uint256 _requestId = tokenIdToRequestId[_tokenId];
        if(_requestId != 0) {
            // Has not revealed rewards yet!!
            return;
        }

        // Check if quest is done
        if(!_isQuestCooldownDone(_tokenId)) {
            return;
        }

        uint256 _lpStakedAmount = tokenIdToLPStaked[_tokenId];

        userToQuestsInProgress[msg.sender].remove(_tokenId);
        delete tokenIdToQuestDifficulty[_tokenId];
        delete tokenIdToQuestStartTime[_tokenId];
        delete tokenIdToLPStaked[_tokenId];

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

        if(_lpStakedAmount > 0) {
            bool _lpSucceed = lp.transferFrom(address(this), 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);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

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

File 3 of 34 : 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;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 5 of 34 : 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 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(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), "Contracts aren't set");

        _;
    }
}

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

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 {
        __ERC721Holder_init_unchained();
    }

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

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

pragma solidity ^0.8.0;

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

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

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

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

File 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 {
        __ERC165_init_unchained();
        __ERC1155Receiver_init_unchained();
    }

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

File 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 {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

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

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

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

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

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

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

File 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 {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

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

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

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

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

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

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

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

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

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

File 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",
        "abi"
      ]
    }
  },
  "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"}],"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":"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":[],"name":"finishQuests","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"finishTokenQuests","outputs":[],"stateMutability":"nonpayable","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":[],"name":"revealQuests","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","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"}]

608060405234801561001057600080fd5b50615124806100206000396000f3fe608060405234801561001057600080fd5b50600436106103ba5760003560e01c80638a7bf804116101f4578063cb3a4a741161011a578063f0c1ebe4116100ad578063f2fde38b1161007c578063f2fde38b146108ef578063f68fa57814610902578063f93309d114610915578063fb00011e1461092857600080fd5b8063f0c1ebe41461086a578063f10fb5841461089b578063f161217e146108af578063f23a6e61146108d057600080fd5b8063dd26bd84116100e9578063dd26bd841461080c578063e50d19df14610830578063e520fc7e14610843578063e820cb6c1461085757600080fd5b8063cb3a4a74146107c8578063d214c14b146107db578063d67896a9146107e5578063d7dfe4dd146107f857600080fd5b8063a46879e711610192578063ba12528911610161578063ba12528914610779578063bc197c811461078c578063bd31ba33146107ab578063bedb86fb146107b557600080fd5b8063a46879e71461071a578063ac99ccb61461073b578063ad72e1a51461074e578063aea889761461076f57600080fd5b80639ad8d6f7116101ce5780639ad8d6f7146106cd5780639b9c9a66146106e05780639c54df64146106f3578063a0122ec61461070657600080fd5b80638a7bf804146106845780638da5cb5b1461069857806390a47013146106a957600080fd5b8063377e11e0116102e4578063675857eb11610277578063736ecd7f11610246578063736ecd7f146106425780638129fc1c1461064a57806383d022401461065257806385b34d971461067657600080fd5b8063675857eb146106005780637048027514610614578063715018a61461062757806371a54c851461062f57600080fd5b806356b048ea116102b357806356b048ea146105c35780635c975abb146105cd57806361d027b3146105d95780636696f79c146105ed57600080fd5b8063377e11e0146105645780634106f1b91461057757806349af3467146105985780634ed8d2c0146105a257600080fd5b806324d7806c1161035c5780632d3a53231161032b5780632d3a5323146105085780632d5240231461051b5780632fc87b921461052e578063313c06a01461053857600080fd5b806324d7806c1461049f5780632521ff47146104cc578063271900a9146104df57806327f6eb8e146104e757600080fd5b8063150b7a0211610398578063150b7a02146104245780631785f53c1461045b5780631c686ee81461047057806324537d371461047e57600080fd5b806301ffc9a7146103bf57806303070e45146103e757806306b8ae04146103ff575b600080fd5b6103d26103cd3660046144c3565b61093b565b60405190151581526020015b60405180910390f35b6103f16101a95481565b6040519081526020016103de565b6101b05461041290610100900460ff1681565b60405160ff90911681526020016103de565b6104426104323660046145e9565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016103de565b61046e610469366004614651565b610972565b005b6101b0546104129060ff1681565b6103f161048c36600461466c565b6101a86020526000908152604090205481565b6103d26104ad366004614651565b6001600160a01b0316600090815261015f602052604090205460ff1690565b61046e6104da366004614685565b6109c7565b61046e610a7b565b6103f16104f536600461466c565b6101a76020526000908152604090205481565b61046e6105163660046146b1565b610be9565b6103f16105293660046146f9565b610c43565b6103f16101b25481565b6101985461054c906001600160a01b031681565b6040516001600160a01b0390911681526020016103de565b61046e610572366004614771565b610c69565b6103f161058536600461466c565b6101a46020526000908152604090205481565b6103f16101b15481565b6103f16105b03660046147b3565b61019e6020526000908152604090205481565b6103f16101ad5481565b61012d5460ff166103d2565b6101b35461054c906001600160a01b031681565b61046e6105fb366004614771565b610d0b565b6101945461054c906001600160a01b031681565b61046e610622366004614651565b610df7565b61046e610e46565b61046e61063d3660046147df565b610e7c565b61046e610ee8565b61046e611058565b6104126106603660046147b3565b61019b6020526000908152604090205460ff1681565b61019f546104129060ff1681565b6101975461054c906001600160a01b031681565b60fb546001600160a01b031661054c565b6104126106b73660046147b3565b61019c6020526000908152604090205460ff1681565b61046e6106db366004614825565b6110d2565b61046e6106ee3660046148cd565b6111a6565b61046e610701366004614771565b611262565b6101965461054c906001600160a01b031681565b6103f161072836600461466c565b6101a36020526000908152604090205481565b61046e610749366004614771565b6112ff565b6103f161075c36600461466c565b6101a56020526000908152604090205481565b6103f16101ab5481565b6103f161078736600461466c565b611515565b61044261079a366004614969565b63bc197c8160e01b95945050505050565b6103f16101ac5481565b61046e6107c3366004614a21565b611537565b61046e6107d6366004614a3e565b61158b565b6103f16101aa5481565b61046e6107f3366004614a73565b6117a1565b6101955461054c906001600160a01b031681565b61041261081a3660046147b3565b61019a6020526000908152604090205460ff1681565b6103f161083e36600461466c565b611a01565b6101935461054c906001600160a01b031681565b61046e610865366004614af6565b611a12565b61088e61087836600461466c565b6101a66020526000908152604090205460ff1681565b6040516103de9190614b57565b6101925461054c906001600160a01b031681565b6103f16108bd3660046147b3565b6101996020526000908152604090205481565b6104426108de366004614b7f565b63f23a6e6160e01b95945050505050565b61046e6108fd366004614651565b611aea565b61046e610910366004614be4565b611b82565b61046e610923366004614771565b611fbd565b6103d261093636600461466c565b6121b4565b60006001600160e01b03198216630271189760e51b148061096c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60fb546001600160a01b031633146109a55760405162461bcd60e51b815260040161099c90614c7e565b60405180910390fd5b6001600160a01b0316600090815261015f60205260409020805460ff19169055565b33600090815261015f602052604090205460ff16806109e957506109e9612295565b610a055760405162461bcd60e51b815260040161099c90614cb3565b6101996020527f64ff465cfcabcf42f95776227c293cec69d4462f43d19ab892c0f096d0681446929092557f25b1716dafbf144c17ee7e01561ffe7a3113c6c5ff9fba1fb9b7a7d39e4c38f75560026000527f4074d44e33158386ca63db52321f67f5d8423dbdefd3bf591730a62f6576595c55565b610192546001600160a01b031615801590610aa15750610193546001600160a01b031615155b8015610ab85750610194546001600160a01b031615155b8015610acf5750610196546001600160a01b031615155b8015610ae65750610197546001600160a01b031615155b8015610afd5750610195546001600160a01b031615155b8015610b1457506101b3546001600160a01b031615155b8015610b2b5750610198546001600160a01b031615155b610b475760405162461bcd60e51b815260040161099c90614cdf565b61012d5460ff1615610b6b5760405162461bcd60e51b815260040161099c90614d0d565b333214610b8a5760405162461bcd60e51b815260040161099c90614d37565b3360009081526101a260205260408120610ba3906122b9565b905060005b8151811015610be557610bd3828281518110610bc657610bc6614d5d565b60200260200101516122c6565b80610bdd81614d89565b915050610ba8565b5050565b33600090815261015f602052604090205460ff1680610c0b5750610c0b612295565b610c275760405162461bcd60e51b815260040161099c90614cb3565b6101a9949094556101ab919091556101ac556101aa556101ad55565b61019d6020528160005260406000208160058110610c6057600080fd5b01549150829050565b60fb546001600160a01b03163314610c935760405162461bcd60e51b815260040161099c90614c7e565b60005b81811015610d0657600061015f6000858585818110610cb757610cb7614d5d565b9050602002016020810190610ccc9190614651565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610cfe81614d89565b915050610c96565b505050565b33600090815261015f602052604090205460ff1680610d2d5750610d2d612295565b610d495760405162461bcd60e51b815260040161099c90614cb3565b6000610d566101ae6122b9565b905060005b8151811015610da557610d92828281518110610d7957610d79614d5d565b60200260200101516101ae6124bc90919063ffffffff16565b5080610d9d81614d89565b915050610d5b565b5060005b82811015610df157610dde848483818110610dc657610dc6614d5d565b905060200201356101ae6124c890919063ffffffff16565b5080610de981614d89565b915050610da9565b50505050565b60fb546001600160a01b03163314610e215760405162461bcd60e51b815260040161099c90614c7e565b6001600160a01b0316600090815261015f60205260409020805460ff19166001179055565b60fb546001600160a01b03163314610e705760405162461bcd60e51b815260040161099c90614c7e565b610e7a60006124d4565b565b33600090815261015f602052604090205460ff1680610e9e5750610e9e612295565b610eba5760405162461bcd60e51b815260040161099c90614cb3565b6101b0805460ff9485166101000261ffff199091169490951693909317939093179091556101b1556101b255565b610192546001600160a01b031615801590610f0e5750610193546001600160a01b031615155b8015610f255750610194546001600160a01b031615155b8015610f3c5750610196546001600160a01b031615155b8015610f535750610197546001600160a01b031615155b8015610f6a5750610195546001600160a01b031615155b8015610f8157506101b3546001600160a01b031615155b8015610f985750610198546001600160a01b031615155b610fb45760405162461bcd60e51b815260040161099c90614cdf565b61012d5460ff1615610fd85760405162461bcd60e51b815260040161099c90614d0d565b333214610ff75760405162461bcd60e51b815260040161099c90614d37565b3360009081526101a260205260408120611010906122b9565b905060005b8151811015610be557600082828151811061103257611032614d5d565b6020026020010151905061104581612526565b508061105081614d89565b915050611015565b600054610100900460ff166110735760005460ff1615611077565b303b155b6110935760405162461bcd60e51b815260040161099c90614da4565b600054610100900460ff161580156110b5576000805461ffff19166101011790555b6110bd61279e565b80156110cf576000805461ff00191690555b50565b33600090815261015f602052604090205460ff16806110f457506110f4612295565b6111105760405162461bcd60e51b815260040161099c90614cb3565b61019280546001600160a01b03199081166001600160a01b039a8b161790915561019380548216988a169890981790975561019480548816968916969096179095556101968054871694881694909417909355610197805486169287169290921790915561019880548516918616919091179055610195805484169185169190911790556101b380549092169216919091179055565b33600090815261015f602052604090205460ff16806111c857506111c8612295565b6111e45760405162461bcd60e51b815260040161099c90614cb3565b61019e602090815281357f5b1e587894c781c322714baac11bfa7b0da2aeb4590a6dcb5f31ea08c486311b558101357f2d695d1bdc89be0990c9b1cefd0e589f7fbb3368bfb8d91126956a95dcf16073556002600052604001357f1482f8fde77c2e0a1223b839dd85e5e0d40575a23bb6b13896f241a0b36fe0d855565b60fb546001600160a01b0316331461128c5760405162461bcd60e51b815260040161099c90614c7e565b60005b81811015610d0657600161015f60008585858181106112b0576112b0614d5d565b90506020020160208101906112c59190614651565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806112f781614d89565b91505061128f565b610192546001600160a01b0316158015906113255750610193546001600160a01b031615155b801561133c5750610194546001600160a01b031615155b80156113535750610196546001600160a01b031615155b801561136a5750610197546001600160a01b031615155b80156113815750610195546001600160a01b031615155b801561139857506101b3546001600160a01b031615155b80156113af5750610198546001600160a01b031615155b6113cb5760405162461bcd60e51b815260040161099c90614cdf565b61012d5460ff16156113ef5760405162461bcd60e51b815260040161099c90614d0d565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061144490505760405162461bcd60e51b815260040161099c90614df2565b3332146114635760405162461bcd60e51b815260040161099c90614d37565b60005b82811015610df1576114a284848381811061148357611483614d5d565b3360009081526101a26020908152604090912093910201359050612803565b6114e25760405162461bcd60e51b81526020600482015260116024820152702737ba1037bbb732b210313c903ab9b2b960791b604482015260640161099c565b6115038484838181106114f7576114f7614d5d565b90506020020135612526565b8061150d81614d89565b915050611466565b6101a0818154811061152657600080fd5b600091825260209091200154905081565b33600090815261015f602052604090205460ff16806115595750611559612295565b6115755760405162461bcd60e51b815260040161099c90614cb3565b8015611583576110cf61281b565b6110cf612892565b33600090815261015f602052604090205460ff16806115ad57506115ad612295565b6115c95760405162461bcd60e51b815260040161099c90614cb3565b6115d66020830183614e17565b6000805261019b60209081527f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a657805460ff191660ff93909316929092179091556116269060408401908401614e17565b600160005261019b6020527f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef805460ff191660ff929092169190911790556116746060830160408401614e17565b600260005261019b60209081527f2a1d4f6078f8c36c9403e0edc3d4b2935b0182bca5295cb74bc8b6bfebfa2a5d805460ff191660ff93909316929092179091556116c190820182614e17565b6000805261019c60209081527f4b419d2fef537193bcacf7d8e3aa1e02cb76a5e91c9927ac0b4328ae4cf88823805460ff191660ff93909316929092179091556117119060408301908301614e17565b600160005261019c6020527fc72eaf8cd3b5c9a905003f86a3aad459ca788a7847e8657dc6013b9edcb24e94805460ff191660ff9290921691909117905561175f6060820160408301614e17565b600260005261019c6020527f6ac6d6b719103e0be90d8f1dc8f262c2aa4b9ba5e23a506ed6f056d83b5bbc70805460ff191660ff929092169190911790555050565b33600090815261015f602052604090205460ff16806117c357506117c3612295565b6117df5760405162461bcd60e51b815260040161099c90614cb3565b60008560ff16116118225760405162461bcd60e51b815260206004820152600d60248201526c109859081b585e081b195d995b609a1b604482015260640161099c565b61182d600186614e34565b60ff1683146118745760405162461bcd60e51b81526020600482015260136024820152724e6f7420656e6f75676820515020737465707360681b604482015260640161099c565b61187f600186614e34565b60ff1681146118d05760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f756768205150206761696e6564207374657073000000000000604482015260640161099c565b61019f805460ff191660ff87161790556118ed6101a06000614417565b6118fa6101a16000614417565b6101a08054600181810190925560007f7980fe0f714a613298681d64b7b8ffa7b148338dd52429f307d72798d5c317c49091018190556101a18054928301815581527f138323e2a914e847043e23cddd114fae8437deb6d72c040f1025356455849bda9091018190555b61196f600187614e34565b60ff168110156119f9576101a085858381811061198e5761198e614d5d565b835460018101855560009485526020948590209190940292909201359190920155506101a18383838181106119c5576119c5614d5d565b83546001810185556000948552602094859020919094029290920135919092015550806119f181614d89565b915050611964565b505050505050565b6101a1818154811061152657600080fd5b33600090815261015f602052604090205460ff1680611a345750611a34612295565b611a505760405162461bcd60e51b815260040161099c90614cb3565b61019a6020527fdf87daca02df9cb008fcda558ae984ab92a5826e62dcff2b5180361f9f18ebf2805460ff1990811660ff958616179091557f082445bb554fade7877a24b2437efaaa3cb9ee97beb4fd4e4c6f863073eb85c4805482169385169390931790925560026000527fef497134997ac3f497d45996287bb42d7b7318af1499095a908382aa5a592ebd8054919093169116179055565b60fb546001600160a01b03163314611b145760405162461bcd60e51b815260040161099c90614c7e565b6001600160a01b038116611b795760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161099c565b6110cf816124d4565b85858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050825115159150611bd790505760405162461bcd60e51b815260040161099c90614df2565b610192546001600160a01b031615801590611bfd5750610193546001600160a01b031615155b8015611c145750610194546001600160a01b031615155b8015611c2b5750610196546001600160a01b031615155b8015611c425750610197546001600160a01b031615155b8015611c595750610195546001600160a01b031615155b8015611c7057506101b3546001600160a01b031615155b8015611c875750610198546001600160a01b031615155b611ca35760405162461bcd60e51b815260040161099c90614cdf565b61012d5460ff1615611cc75760405162461bcd60e51b815260040161099c90614d0d565b333214611ce65760405162461bcd60e51b815260040161099c90614d37565b8584148015611cf457508184145b611d405760405162461bcd60e51b815260206004820152601a60248201527f426164206e756d626572206f6620646966666963756c74696573000000000000604482015260640161099c565b6101b360009054906101000a90046001600160a01b03166001600160a01b031663ca1709556040518163ffffffff1660e01b815260040160206040518083038186803b158015611d8f57600080fd5b505afa158015611da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc79190614e57565b611e135760405162461bcd60e51b815260206004820152601960248201527f42726964676520576f726c64206e6f7420706f77657265642e00000000000000604482015260640161099c565b60005b86811015611fb357610197546000906001600160a01b031663f15fbdf28a8a85818110611e4557611e45614d5d565b905060200201356040518263ffffffff1660e01b8152600401611e6a91815260200190565b6101806040518083038186803b158015611e8357600080fd5b505afa158015611e97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebb9190614f05565b9050600281516002811115611ed257611ed2614b41565b1415611f3e57611f39898984818110611eed57611eed614d5d565b90506020020135888885818110611f0657611f06614d5d565b9050602002016020810190611f1b91906147b3565b878786818110611f2d57611f2d614d5d565b9050602002013561290e565b611fa0565b611fa0898984818110611f5357611f53614d5d565b90506020020135888885818110611f6c57611f6c614d5d565b9050602002016020810190611f8191906147b3565b878786818110611f9357611f93614d5d565b9050602002013584612ba0565b5080611fab81614d89565b915050611e16565b5050505050505050565b610192546001600160a01b031615801590611fe35750610193546001600160a01b031615155b8015611ffa5750610194546001600160a01b031615155b80156120115750610196546001600160a01b031615155b80156120285750610197546001600160a01b031615155b801561203f5750610195546001600160a01b031615155b801561205657506101b3546001600160a01b031615155b801561206d5750610198546001600160a01b031615155b6120895760405162461bcd60e51b815260040161099c90614cdf565b61012d5460ff16156120ad5760405162461bcd60e51b815260040161099c90614d0d565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061210290505760405162461bcd60e51b815260040161099c90614df2565b3332146121215760405162461bcd60e51b815260040161099c90614d37565b60005b82811015610df15761214184848381811061148357611483614d5d565b6121815760405162461bcd60e51b81526020600482015260116024820152702737ba1037bbb732b210313c903ab9b2b960791b604482015260640161099c565b6121a284848381811061219657612196614d5d565b905060200201356122c6565b806121ac81614d89565b915050612124565b60008181526101a56020526040812054806122115760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420616374697665206f7220616c72656164792072657665616c65640000604482015260640161099c565b6101925460405163f030210760e01b8152600481018390526001600160a01b039091169063f03021079060240160206040518083038186803b15801561225657600080fd5b505afa15801561226a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228e9190614e57565b9392505050565b6000336122aa60fb546001600160a01b031690565b6001600160a01b031614905090565b6060600061228e83612fab565b60008181526101a5602052604090205480156122e0575050565b6122e982613007565b6122f1575050565b60008281526101a760209081526040808320543384526101a290925290912061231a90846124bc565b5060008381526101a660209081526040808320805460ff191690556101a482528083208390556101a7909152808220919091556101945490516383291f8760e01b81526001600160a01b03909116906383291f879061238190309033908890600401614f9c565b600060405180830381600087803b15801561239b57600080fd5b505af11580156123af573d6000803e3d6000fd5b50505050600081111561248a57610198546040516323b872dd60e01b81526000916001600160a01b0316906323b872dd906123f290309033908790600401614f9c565b602060405180830381600087803b15801561240c57600080fd5b505af1158015612420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124449190614e57565b9050806124885760405162461bcd60e51b81526020600482015260126024820152711314081d1c985b9cd9995c8819985a5b195960721b604482015260640161099c565b505b604051839033907f8ac429d7fc602a05164517560aadca9c5327863f7f5077d92f78a2e91922722e90600090a3505050565b600061228e8383613077565b600061228e838361316a565b60fb80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008181526101a560205260409020548061253f575050565b6101925460405163f030210760e01b8152600481018390526001600160a01b039091169063f03021079060240160206040518083038186803b15801561258457600080fd5b505afa158015612598573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125bc9190614e57565b6125c4575050565b60008281526101a6602052604080822054610192549151634ad30a7560e01b81526004810185905260ff90911692916001600160a01b031690634ad30a759060240160206040518083038186803b15801561261e57600080fd5b505afa158015612632573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126569190614fc0565b610197546040516378afdef960e11b8152600481018790529192506000916001600160a01b039091169063f15fbdf2906024016101806040518083038186803b1580156126a257600080fd5b505afa1580156126b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126da9190614f05565b905060005b60008681526101a8602052604090205481101561277957604080516020810185905290810182905260600160408051601f198184030181529190528051602090910120925060028251600281111561273957612739614b41565b141561274e5761274986846131b9565b612767565b6127598685856134a2565b612767868360600151613a01565b8061277181614d89565b9150506126df565b505050600092835250506101a5602090815260408083208390556101a8909152812055565b600054610100900460ff166127b95760005460ff16156127bd565b303b155b6127d95760405162461bcd60e51b815260040161099c90614da4565b600054610100900460ff161580156127fb576000805461ffff19166101011790555b6110bd613b70565b6000818152600183016020526040812054151561228e565b61012d5460ff161561283f5760405162461bcd60e51b815260040161099c90614d0d565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586128753390565b6040516001600160a01b03909116815260200160405180910390a1565b61012d5460ff166128dc5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161099c565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612875565b8060011461295e5760405162461bcd60e51b815260206004820152601d60248201527f4d61782031206c6f6f7020666f722072656372756974206c6567696f6e000000604482015260640161099c565b600082600281111561297257612972614b41565b146129b75760405162461bcd60e51b815260206004820152601560248201527411585cde481bdb9b1e48199bdc881c9958dc9d5a5d605a1b604482015260640161099c565b3360009081526101a2602052604090206129d190846124c8565b5060008381526101a46020908152604080832042905561019254815163433c53d960e11b815291516001600160a01b0390911692638678a7b2926004808201939182900301818787803b158015612a2757600080fd5b505af1158015612a3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5f9190614fc0565b60008581526101a5602090815260408083208490556101a690915290208054919250849160ff19166001836002811115612a9b57612a9b614b41565b021790555060008481526101a86020526040908190208390556101945490516383291f8760e01b81526001600160a01b03909116906383291f8790612ae890339030908990600401614f9c565b600060405180830381600087803b158015612b0257600080fd5b505af1158015612b16573d6000803e3d6000fd5b505050508084336001600160a01b03167fb01c6f111ccf2d738b45ffe57725d969f4a4e893a0777391d77fc2351b5f30546101996000886002811115612b5e57612b5e614b41565b6002811115612b6f57612b6f614b41565b81526020019081526020016000205442612b899190614fd9565b60405190815260200160405180910390a450505050565b600082600114612d1a57612bb66101ae84612803565b612c025760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206e756d626572206f66206c6f6f7073000000000000000000604482015260640161099c565b8261019e6000866002811115612c1a57612c1a614b41565b6002811115612c2b57612c2b614b41565b815260200190815260200160002054612c449190614ff1565b90508015612d1a57610198546040516323b872dd60e01b81526000916001600160a01b0316906323b872dd90612c8290339030908790600401614f9c565b602060405180830381600087803b158015612c9c57600080fd5b505af1158015612cb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd49190614e57565b905080612d185760405162461bcd60e51b81526020600482015260126024820152711314081d1c985b9cd9995c8819985a5b195960721b604482015260640161099c565b505b600061019a6000866002811115612d3357612d33614b41565b6002811115612d4457612d44614b41565b8152602081019190915260400160002054606084015160ff918216925016811115612db15760405162461bcd60e51b815260206004820152601760248201527f446966666963756c74206e6f7420756e6c6f636b65642e000000000000000000604482015260640161099c565b3360009081526101a260205260409020612dcb90876124c8565b5060008681526101a46020908152604080832042905561019254815163433c53d960e11b815291516001600160a01b0390911692638678a7b2926004808201939182900301818787803b158015612e2157600080fd5b505af1158015612e35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e599190614fc0565b60008881526101a5602090815260408083208490556101a690915290208054919250879160ff19166001836002811115612e9557612e95614b41565b021790555060008781526101a7602090815260408083208690556101a8909152908190208690556101945490516383291f8760e01b81526001600160a01b03909116906383291f8790612ef090339030908c90600401614f9c565b600060405180830381600087803b158015612f0a57600080fd5b505af1158015612f1e573d6000803e3d6000fd5b505050508087336001600160a01b03167fb01c6f111ccf2d738b45ffe57725d969f4a4e893a0777391d77fc2351b5f305461019960008b6002811115612f6657612f66614b41565b6002811115612f7757612f77614b41565b81526020019081526020016000205442612f919190614fd9565b60405190815260200160405180910390a450505050505050565b606081600001805480602002602001604051908101604052809291908181526020018280548015612ffb57602002820191906000526020600020905b815481526020019060010190808311612fe7575b50505050509050919050565b60008181526101a460209081526040808320546101a690925282205460ff16826101998183600281111561303d5761303d614b41565b600281111561304e5761304e614b41565b8152602001908152602001600020549050808361306b9190614fd9565b42101595945050505050565b6000818152600183016020526040812054801561316057600061309b600183615010565b85549091506000906130af90600190615010565b90508181146131145760008660000182815481106130cf576130cf614d5d565b90600052602060002001549050808760000184815481106130f2576130f2614d5d565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061312557613125615027565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061096c565b600091505061096c565b60008181526001830160205260408120546131b15750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561096c565b50600061096c565b6101ab54158015906131cd57506101ac5415155b80156131db57506101ad5415155b61321f5760405162461bcd60e51b815260206004820152601560248201527410dbdb9cdd5b58589b19481251081b9bdd081cd95d605a1b604482015260640161099c565b6101b05460ff16801561329757610195546101ab54604051630ab714fb60e11b81526001600160a01b039092169163156e29f69161326491339190869060040161503d565b600060405180830381600087803b15801561327e57600080fd5b505af1158015613292573d6000803e3d6000fd5b505050505b6101b054600090610100900460ff16156133735760006132ba620186a085615061565b60408051602081018790529081018690529091506060016040516020818303038152906040528051906020012060001c93506101b154811015613371576101b054610195546101ac54604051630ab714fb60e11b815261010090930460ff1694506001600160a01b039091169163156e29f69161333e91339190879060040161503d565b600060405180830381600087803b15801561335857600080fd5b505af115801561336c573d6000803e3d6000fd5b505050505b505b6000613382620186a085615061565b905060006101b25482101561340757610195546101ad54604051630ab714fb60e11b81523360048201526024810191909152600160448201526001600160a01b039091169063156e29f690606401600060405180830381600087803b1580156133ea57600080fd5b505af11580156133fe573d6000803e3d6000fd5b50505050600190505b6040805160808101825260ff80871682528581166020830152831681830152600060608201529051879133917fc255245a3e4dbbee8d3a2bf2e49e4fe763a2ceace1a69b09f80803770cc20ffc9161349291600060808201905060ff835116825260ff602084015116602083015260ff60408401511660408301526060830151606083015292915050565b60405180910390a3505050505050565b6101ab54158015906134b657506101ac5415155b80156134c457506101ad5415155b6135085760405162461bcd60e51b815260206004820152601560248201527410dbdb9cdd5b58589b19481251081b9bdd081cd95d605a1b604482015260640161099c565b600061019b600084600281111561352157613521614b41565b600281111561353257613532614b41565b8152602081019190915260400160009081205460ff16915061019c8185600281111561356057613560614b41565b600281111561357157613571614b41565b815260208101919091526040016000205460ff90811691508216156135fb57610195546101ab54604051630ab714fb60e11b81526001600160a01b039092169163156e29f6916135c891339190879060040161503d565b600060405180830381600087803b1580156135e257600080fd5b505af11580156135f6573d6000803e3d6000fd5b505050505b60ff81161561366f57610195546101ac54604051630ab714fb60e11b81526001600160a01b039092169163156e29f69161363c91339190869060040161503d565b600060405180830381600087803b15801561365657600080fd5b505af115801561366a573d6000803e3d6000fd5b505050505b60008061367f620186a086615061565b90506101a9548110156138b357604080516020810187905290810186905260600160408051601f198184030181529190528051602090910120945060006136c9620186a087615061565b9050600061019d60008960028111156136e4576136e4614b41565b60028111156136f5576136f5614b41565b815260208101919091526040908101600020815160a08101928390529160059082845b81548152602001906001019080831161371857505050505090506000805b60058110156138ae5782816005811061375157613751614d5d565b60200201516137609083614fd9565b91508184101561389c5760408051602081018b90529081018a905260600160408051601f198184030181529190528051602090910120610196549099506001600160a01b0316637498e03f6137b6836001614fd9565b6040516001600160e01b031960e084901b16815260ff9091166004820152602481018c905260440160206040518083038186803b1580156137f657600080fd5b505afa15801561380a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061382e9190614fc0565b61019354604051630ab714fb60e11b815233600482015260248101839052600160448201529197506001600160a01b03169063156e29f690606401600060405180830381600087803b15801561388357600080fd5b505af1158015613897573d6000803e3d6000fd5b505050505b806138a681614d89565b915050613736565b505050505b604080516020810187905290810186905260600160408051601f198184030181529190528051602090910120945060006138f0620186a087615061565b905060006101aa5482101561397557610195546101ad54604051630ab714fb60e11b81523360048201526024810191909152600160448201526001600160a01b039091169063156e29f690606401600060405180830381600087803b15801561395857600080fd5b505af115801561396c573d6000803e3d6000fd5b50505050600190505b604080516080808201835260ff808a16808452898216602080860191825287841686880190815260609687018c815288519485529251851691840191909152519092169481019490945251918301919091528a9133917fc255245a3e4dbbee8d3a2bf2e49e4fe763a2ceace1a69b09f80803770cc20ffc910160405180910390a3505050505050505050565b61019f5460ff90811690821610613a16575050565b6101a18160ff1681548110613a2d57613a2d614d5d565b90600052602060002001546101a360008481526020019081526020016000206000828254613a5b9190614fd9565b90915550505b61019f5460ff908116908216108015613aaf57506101a08160ff1681548110613a8c57613a8c614d5d565b90600052602060002001546101a360008481526020019081526020016000205410155b15610be5576101a08160ff1681548110613acb57613acb614d5d565b90600052602060002001546101a360008481526020019081526020016000206000828254613af99190615010565b90915550506101975460405163ccd5efbf60e01b8152600481018490526001600160a01b039091169063ccd5efbf90602401600060405180830381600087803b158015613b4557600080fd5b505af1158015613b59573d6000803e3d6000fd5b505050508080613b6890615083565b915050613a61565b600054610100900460ff16613b8b5760005460ff1615613b8f565b303b155b613bab5760405162461bcd60e51b815260040161099c90614da4565b600054610100900460ff16158015613bcd576000805461ffff19166101011790555b6110bd600054610100900460ff16613beb5760005460ff1615613bef565b303b155b613c0b5760405162461bcd60e51b815260040161099c90614da4565b600054610100900460ff16158015613c2d576000805461ffff19166101011790555b6110bd600054610100900460ff16613c4b5760005460ff1615613c4f565b303b155b613c6b5760405162461bcd60e51b815260040161099c90614da4565b600054610100900460ff16158015613c8d576000805461ffff19166101011790555b613c956141de565b613c9d614243565b613ca5614272565b6170807f64ff465cfcabcf42f95776227c293cec69d4462f43d19ab892c0f096d06814465561a8c07f25b1716dafbf144c17ee7e01561ffe7a3113c6c5ff9fba1fb9b7a7d39e4c38f75561e1007f4074d44e33158386ca63db52321f67f5d8423dbdefd3bf591730a62f6576595c557fdf87daca02df9cb008fcda558ae984ab92a5826e62dcff2b5180361f9f18ebf28054600160ff1991821681179092557f082445bb554fade7877a24b2437efaaa3cb9ee97beb4fd4e4c6f863073eb85c48054821660031790557fef497134997ac3f497d45996287bb42d7b7318af1499095a908382aa5a592ebd80546005908316811790915561019f80549092166006179091556101a08054808401825560007f7980fe0f714a613298681d64b7b8ffa7b148338dd52429f307d72798d5c317c4918201819055825480860184556064908301558254808601845560c890830155825480860184556101f490830155825480860184556103e89083015582548086019093556107d092909101919091556101a1805480850182557f138323e2a914e847043e23cddd114fae8437deb6d72c040f1025356455849bda90810183905581548086018355600a9082018190558254808701845582018190558254808701845560149083018190558354808801855583015582549586019092556028940193909355614e206101a9556101aa929092556040805160a0810182528381526109c460208083019190915261138892820192909252613a98606082015262012ebc608082015292805261019d9052613f0f917f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d91614435565b506040805160a0810182526105dc8152611388602080830191909152611b5892820192909252614268606082015262010f7c6080820152600160005261019d909152613f7e907f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff906005614435565b506040805160a0810182526109c48152612328602080830191909152611f40928201929092526155f0606082015261e4846080820152600260005261019d909152613fec907f29ea485743245ef5c5c24b1a283e9aaa2745fd5e9f6154d72f7ef154d10421bc90600561447a565b50613ffa6101ae60036124c8565b506140086101ae60096124c8565b506140166101ae600f6124c8565b50674563918244f400007f5b1e587894c781c322714baac11bfa7b0da2aeb4590a6dcb5f31ea08c486311b55678ac7230489e800007f2d695d1bdc89be0990c9b1cefd0e589f7fbb3368bfb8d91126956a95dcf160735567d02ab486cedc00007f1482f8fde77c2e0a1223b839dd85e5e0d40575a23bb6b13896f241a0b36fe0d8557f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a6578054600360ff1991821681179092557f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef8054821660049081179091557f2a1d4f6078f8c36c9403e0edc3d4b2935b0182bca5295cb74bc8b6bfebfa2a5d80546005908416811790915561019c6020527f4b419d2fef537193bcacf7d8e3aa1e02cb76a5e91c9927ac0b4328ae4cf88823805484169094179093557fc72eaf8cd3b5c9a905003f86a3aad459ca788a7847e8657dc6013b9edcb24e9480548316909117905560026000527f6ac6d6b719103e0be90d8f1dc8f262c2aa4b9ba5e23a506ed6f056d83b5bbc70805490911690911790556101b0805461ffff191661010117905561c3506101b15560016101b25580156110cf576000805461ff001916905550565b600054610100900460ff166141f95760005460ff16156141fd565b303b155b6142195760405162461bcd60e51b815260040161099c90614da4565b600054610100900460ff1615801561423b576000805461ffff19166101011790555b6110bd6142a9565b600054610100900460ff1661426a5760405162461bcd60e51b815260040161099c906150a3565b610e7a61431e565b600054610100900460ff166142995760405162461bcd60e51b815260040161099c906150a3565b6142a161431e565b61426a61431e565b600054610100900460ff166142c45760005460ff16156142c8565b303b155b6142e45760405162461bcd60e51b815260040161099c90614da4565b600054610100900460ff16158015614306576000805461ffff19166101011790555b61430e614345565b61431661437c565b6110bd61281b565b600054610100900460ff16610e7a5760405162461bcd60e51b815260040161099c906150a3565b600054610100900460ff1661436c5760405162461bcd60e51b815260040161099c906150a3565b61437461431e565b610e7a6143b3565b600054610100900460ff166143a35760405162461bcd60e51b815260040161099c906150a3565b6143ab61431e565b610e7a6143e3565b600054610100900460ff166143da5760405162461bcd60e51b815260040161099c906150a3565b610e7a336124d4565b600054610100900460ff1661440a5760405162461bcd60e51b815260040161099c906150a3565b61012d805460ff19169055565b50805460008255906000526020600020908101906110cf91906144ae565b826005810192821561446a579160200282015b8281111561446a578251829062ffffff16905591602001919060010190614448565b506144769291506144ae565b5090565b826005810192821561446a579160200282015b8281111561446a578251829061ffff1690559160200191906001019061448d565b5b8082111561447657600081556001016144af565b6000602082840312156144d557600080fd5b81356001600160e01b03198116811461228e57600080fd5b80356001600160a01b038116811461450457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561454257614542614509565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561457157614571614509565b604052919050565b600082601f83011261458a57600080fd5b813567ffffffffffffffff8111156145a4576145a4614509565b6145b7601f8201601f1916602001614548565b8181528460208386010111156145cc57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156145ff57600080fd5b614608856144ed565b9350614616602086016144ed565b925060408501359150606085013567ffffffffffffffff81111561463957600080fd5b61464587828801614579565b91505092959194509250565b60006020828403121561466357600080fd5b61228e826144ed565b60006020828403121561467e57600080fd5b5035919050565b60008060006060848603121561469a57600080fd5b505081359360208301359350604090920135919050565b600080600080600060a086880312156146c957600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b600381106110cf57600080fd5b6000806040838503121561470c57600080fd5b8235614717816146ec565b946020939093013593505050565b60008083601f84011261473757600080fd5b50813567ffffffffffffffff81111561474f57600080fd5b6020830191508360208260051b850101111561476a57600080fd5b9250929050565b6000806020838503121561478457600080fd5b823567ffffffffffffffff81111561479b57600080fd5b6147a785828601614725565b90969095509350505050565b6000602082840312156147c557600080fd5b813561228e816146ec565b60ff811681146110cf57600080fd5b600080600080608085870312156147f557600080fd5b8435614800816147d0565b93506020850135614810816147d0565b93969395505050506040820135916060013590565b600080600080600080600080610100898b03121561484257600080fd5b61484b896144ed565b975061485960208a016144ed565b965061486760408a016144ed565b955061487560608a016144ed565b945061488360808a016144ed565b935061489160a08a016144ed565b925061489f60c08a016144ed565b91506148ad60e08a016144ed565b90509295985092959890939650565b806060810183101561096c57600080fd5b6000606082840312156148df57600080fd5b61228e83836148bc565b600082601f8301126148fa57600080fd5b8135602067ffffffffffffffff82111561491657614916614509565b8160051b614925828201614548565b928352848101820192828101908785111561493f57600080fd5b83870192505b8483101561495e57823582529183019190830190614945565b979650505050505050565b600080600080600060a0868803121561498157600080fd5b61498a866144ed565b9450614998602087016144ed565b9350604086013567ffffffffffffffff808211156149b557600080fd5b6149c189838a016148e9565b945060608801359150808211156149d757600080fd5b6149e389838a016148e9565b935060808801359150808211156149f957600080fd5b50614a0688828901614579565b9150509295509295909350565b80151581146110cf57600080fd5b600060208284031215614a3357600080fd5b813561228e81614a13565b60008060c08385031215614a5157600080fd5b614a5b84846148bc565b9150614a6a84606085016148bc565b90509250929050565b600080600080600060608688031215614a8b57600080fd5b8535614a96816147d0565b9450602086013567ffffffffffffffff80821115614ab357600080fd5b614abf89838a01614725565b90965094506040880135915080821115614ad857600080fd5b50614ae588828901614725565b969995985093965092949392505050565b600080600060608486031215614b0b57600080fd5b8335614b16816147d0565b92506020840135614b26816147d0565b91506040840135614b36816147d0565b809150509250925092565b634e487b7160e01b600052602160045260246000fd5b6020810160038310614b7957634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060a08688031215614b9757600080fd5b614ba0866144ed565b9450614bae602087016144ed565b93506040860135925060608601359150608086013567ffffffffffffffff811115614bd857600080fd5b614a0688828901614579565b60008060008060008060608789031215614bfd57600080fd5b863567ffffffffffffffff80821115614c1557600080fd5b614c218a838b01614725565b90985096506020890135915080821115614c3a57600080fd5b614c468a838b01614725565b90965094506040890135915080821115614c5f57600080fd5b50614c6c89828a01614725565b979a9699509497509295939492505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601290820152712737ba1030b236b4b71037b91037bbb732b960711b604082015260600190565b60208082526014908201527310dbdb9d1c9858dd1cc8185c995b89dd081cd95d60621b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252600c908201526b4e6f20636f6e74726163747360a01b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415614d9d57614d9d614d73565b5060010190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600b908201526a456d70747920617272617960a81b604082015260600190565b600060208284031215614e2957600080fd5b813561228e816147d0565b600060ff821660ff841680821015614e4e57614e4e614d73565b90039392505050565b600060208284031215614e6957600080fd5b815161228e81614a13565b80516006811061450457600080fd5b8051614504816147d0565b600082601f830112614e9f57600080fd5b60405160c0810181811067ffffffffffffffff82111715614ec257614ec2614509565b6040528060c0840185811115614ed757600080fd5b845b81811015614efa578051614eec816147d0565b835260209283019201614ed9565b509195945050505050565b60006101808284031215614f1857600080fd5b614f2061451f565b8251614f2b816146ec565b81526020830151600a8110614f3f57600080fd5b6020820152614f5060408401614e74565b6040820152614f6160608401614e83565b6060820152614f7260808401614e83565b6080820152614f848460a08501614e8e565b60a0820152610160929092015160c083015250919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215614fd257600080fd5b5051919050565b60008219821115614fec57614fec614d73565b500190565b600081600019048311821515161561500b5761500b614d73565b500290565b60008282101561502257615022614d73565b500390565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b03939093168352602083019190915260ff16604082015260600190565b60008261507e57634e487b7160e01b600052601260045260246000fd5b500690565b600060ff821660ff81141561509a5761509a614d73565b60010192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea264697066735822122028eff7623c54387345427550ac28801f50b13e2b28cb8d1262be752cc9cfe5d764736f6c63430008090033

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