Contract 0xab01d1ef2040114cfc88a228f67e932b67f19772

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x7152b77dfbb49c01c0dc3abcd74c2303654022065e3377e49ad666b00d480ad20x6080604097588902022-04-13 20:30:46235 days 20 hrs ago0xb013abd83f0bd173e9f14ce7d6e420ad711483b4 IN  Create: Summoning0 ETH0.036740232226 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x3f161228d38e1effa03a0689225744dc09c6387d47fe73efc18d9debe4b12bad426337582022-12-01 6:50:394 days 10 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x9a954a76ba40c4b6a29dcf3d7a655b06961b659611b6bf029ddf04fbf3ed0968425569462022-11-30 22:34:074 days 18 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x5274db49db0eabb3f1bc98981252bf971ab9737ba569a3493c74e19a73cb777d411944982022-11-25 21:20:389 days 20 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x14073756486d790709c55a3097478d80f53fc9a886fec92b0b01f6f6ec31bd30406308322022-11-23 19:14:2411 days 22 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xcd49da39164651d677b70b3b19bf32c8ec0c82a786a0507b1eb0c53e71e413f5404527022022-11-23 5:35:2212 days 11 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x9a957bc82da9a1829f9dd0678b3b2d4e180bac156a25f393a28b099f5d7f8f3b403077142022-11-22 17:08:0813 days 17 mins ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x4064afac1015576ae63eabd9043663e23edf23b2f1dd515725a178b5cf531713400798322022-11-21 22:58:4613 days 18 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x4064afac1015576ae63eabd9043663e23edf23b2f1dd515725a178b5cf531713400798322022-11-21 22:58:4613 days 18 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x1840b2dba61bc4de9f09632ed115f48b4d43cb3ada10e50ffa0ebd3a6c035e0d400791272022-11-21 22:54:4313 days 18 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x89af53d6a9582e0e3d38e747451165488f35cf3cf7e2b8fd8e3c0cda18b207e6398766752022-11-21 7:55:5014 days 9 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x7a4b5a0d675e3da7b2a4afd30c83442f29a12da3f43f328883ff00726f5cf94e383911322022-11-15 21:06:1619 days 20 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xf5f763a51e8cf7f01b12dfcb0495454717fdf290eae0dfa3fab1434008e37199379437582022-11-14 6:11:4121 days 11 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xf5f763a51e8cf7f01b12dfcb0495454717fdf290eae0dfa3fab1434008e37199379437582022-11-14 6:11:4121 days 11 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x410eea985dd414274669165c47e926581847c32b7a03c1b614a73b13785d6edf376526072022-11-13 3:33:1022 days 13 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xfb6bc803a5177f44fa16f8713fb0f2fa61f320f8c8cad45dc52addbb4a88c7cb375808042022-11-12 19:21:1222 days 22 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xfc910276072d992f0dd4e1aa5c344447f49f39ea09e49679f734a3c87af4e7bb373067642022-11-11 19:56:1223 days 21 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xc9f3e6b003e139d6d948fde020364a14161f57761e4df6b9c5339e74008c1973373063362022-11-11 19:54:0923 days 21 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xf0759a1d9925491ef5d59f84e53082e1bc9b98a0cfe1aeb293a8434d9a6fc849362769382022-11-08 10:21:1827 days 7 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x080374a9f617487bff01f7e69d93287ec5fdc5596e06e75b49e2a1af243fb0fc360688432022-11-07 17:18:5128 days 6 mins ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x121ee6ffa9ec07d07559de5c8175ccd57c3cbfbda261ba60e88d55c5d567711f357201042022-11-06 12:30:0429 days 4 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xdd81a0d8f1166f6191b6d6c0286cf32e39777cf77dcc77b1e18abde3f355f73a355443832022-11-05 19:43:5129 days 21 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xfa7d07108148de11dcd3f958a1871e91ac6859fceb3dde1919504495305a7fb5353362352022-11-05 2:14:2030 days 15 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xfa7d07108148de11dcd3f958a1871e91ac6859fceb3dde1919504495305a7fb5353362352022-11-05 2:14:2030 days 15 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0xc63d8af4bafd575075c68bcf2edba0279318d6f3709d9685a128491bfe536423353361482022-11-05 2:13:4130 days 15 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
0x163110bf651c930b5b6b7ff54dfd794ae7e129ca97ff8a747842d01fd2a930e0352594342022-11-04 18:19:5030 days 23 hrs ago 0xc8dbdc58289474ab3e01568eb5f88f440bde6b46 0xab01d1ef2040114cfc88a228f67e932b67f197720 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Summoning

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

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

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

import "./SummoningLPStakable.sol";

contract Summoning is Initializable, SummoningLPStakable {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

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

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

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

        if(_magicNeeded > 0) {
            bool _magicSuccess = magic.transferFrom(msg.sender, address(this), _magicNeeded);
            require(_magicSuccess, "Summoning: Magic failed to transfer");
        }

        if(_bcTotal > 0) {
            require(balancerCrystalId > 0, "Summoning: Balancer crystal id missing");

            balancerCrystal.adminSafeTransferFrom(msg.sender, address(this), balancerCrystalId, _bcTotal);
        }
    }

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

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

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

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

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

        // Transfer before calculating the success rate so that this legion counts in the calculation.
        legion.adminSafeTransferFrom(msg.sender, address(this), _tokenId);

        uint256 _bcAmount = _bcNeeded(_metadata.legionGeneration, _summoningCountCur);

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

        tokenIdToSuccessRate[_tokenId] = calculateSuccessRate();

        tokenIdToMagicAmount[_tokenId] = generationToMagicCost[_metadata.legionGeneration];

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

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

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

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

    // Returns a value out of 100,000
    function calculateSuccessRate() public view returns(uint256) {
        uint256 _numberOfSummonings = legion.balanceOf(address(this));
        uint256 _numberOfCraftings = legion.balanceOf(address(crafting));

        // Just in case
        if(_numberOfCraftings == 0) {
            return 1;
        }

        return 10**25 / (10**20 + (((_numberOfSummonings * 10**5) / _numberOfCraftings) * ((successSensitivity * 10**5) / 100000))**2);
    }

    function finishSummonTokens(uint256[] calldata _tokenIds)
    external
    nonZeroLength(_tokenIds)
    whenNotPaused
    contractsAreSet
    onlyEOA
    {
        uint256 _numberFinished = 0;
        uint256 _bcToRefund = 0;

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

            require(userToSummoningsInProgress[msg.sender].contains(_tokenId), "Does not own token");

            (uint256 _newTokenId, uint256 _bcRefund) = _finishSummonSingle(_tokenId);

            _numberFinished++;
            _bcToRefund += _bcRefund;
            userToSummoningsInProgress[msg.sender].remove(_tokenId);

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

        if(_bcToRefund > 0) {
            balancerCrystal.adminSafeTransferFrom(address(this), msg.sender, balancerCrystalId, _bcToRefund);
        }
    }

    function _finishSummonSingle(
        uint256 _tokenId)
    private
    returns(uint256, uint256)
    {
        uint256 _requestId = tokenIdToRequestId[_tokenId];

        require(randomizer.isRandomReady(_requestId), "Summoning: Random is not ready");

        uint256 _randomNumber = randomizer.revealRandomNumber(_requestId);

        bool _didSucceed = _didSummoningSucceed(_tokenId, _randomNumber);

        require(isTokenDoneSummoning(_tokenId, _didSucceed), "Summoning: Legion is not done summoning");

        uint256 _newTokenId;

        uint256 _crystalId = tokenIdToCrystalIdUsed[_tokenId];

        if(_didSucceed) {
            LegionMetadata memory _metadata = legionMetadataStore.metadataForLegion(_tokenId);

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

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

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

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

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

            tokenIdToCreatedTime[_newTokenId] = block.timestamp;

            // Send magic straight to the treasury.
            uint256 _magicAmount = tokenIdToMagicAmount[_tokenId];
            bool _magicSuccess = magic.transfer(address(treasury), _magicAmount);
            require(_magicSuccess, "Summoning: Magic failed to transfer to the treasury");

            treasury.forwardCoinsToMine(_magicAmount);
        } else {
            // They didn't actually summon.
            tokenIdToSummonCount[_tokenId]--;

            // Refund magic and crystal
            bool _magicSuccess = magic.transfer(msg.sender, tokenIdToMagicAmount[_tokenId]);
            require(_magicSuccess, "Summoning: Magic failed to transfer back to user");

            if(_crystalId > 0) {
                consumable.adminSafeTransferFrom(address(treasury), msg.sender, _crystalId, 1);
            }
        }

        uint256 _bcStaked = tokenIdToLPStaked[_tokenId];

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

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

        return (_newTokenId, _bcStaked);
    }

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

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

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

        uint256 _result = _randomNumber % 100000;

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

    // Returns whether summoning succeded and the end time for the legion.
    function didSummoningSucceed(uint256 _tokenId) external view returns(bool, uint256) {
        uint256 _requestId = tokenIdToRequestId[_tokenId];
        require(_requestId > 0, "Summoning: Summoning not in progress for token");
        require(randomizer.isRandomReady(_requestId), "Summoning: Random is not ready");

        uint256 _randomNumber = randomizer.revealRandomNumber(_requestId);

        bool _succeeded = _didSummoningSucceed(_tokenId, _randomNumber);

        return (_succeeded, _getTokenEndTime(_tokenId, _succeeded));
    }

    function _didSummoningSucceed(uint256 _tokenId, uint256 _randomNumber) private view returns(bool) {
        // Some random number. Doesn't really matter. Ensure this seed is unrelated to the seed used for picking class.
        _randomNumber = uint256(keccak256(abi.encode(_randomNumber, 35976445988152254298657094197983652404179925051360399363530388281034017204761)));

        uint256 _successRate = tokenIdToSuccessRate[_tokenId];

        // For backwards compatibility. The calculated success rate will never be 0 itself,
        // so this should be safe to do.
        if(_successRate == 0) {
            return true;
        }

        uint256 _successResult = _randomNumber % 100000;

        return _successResult < _successRate;
    }

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

File 2 of 36 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

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

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

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

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

// Should be called BC for Balancer Crystals.
//
abstract contract SummoningLPStakable is Initializable, SummoningTimeKeeper {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

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

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

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

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

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

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

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

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

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

abstract contract SummoningTimeKeeper is Initializable, SummoningSettings {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

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

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

    function isTokenDoneSummoning(uint256 _tokenId, bool _succeeded) public view returns(bool) {
        return block.timestamp >= _getTokenEndTime(_tokenId, _succeeded);
    }

    function _getTokenEndTime(uint256 _tokenId, bool _succeded) internal view returns(uint256) {
        if(_succeded) {
            uint256 _crystalId = tokenIdToCrystalIdUsed[_tokenId];
            uint256 _reduction = crystalIdToTimeReduction[_crystalId];
            return tokenIdToSummonStartTime[_tokenId] + summoningDuration - _reduction;
        } else {
            return tokenIdToSummonStartTime[_tokenId] + summoningDurationIfFailed;
        }
    }
}

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

import "./LegionMetadataStoreState.sol";

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

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

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

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

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

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

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

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

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

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

enum LegionGeneration {
    GENESIS,
    AUXILIARY,
    RECRUIT
}

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

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

import "./SummoningContracts.sol";

abstract contract SummoningSettings is Initializable, SummoningContracts {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

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

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

    function setSuccessSensitivity(uint256 _successSensitivity) external onlyAdminOrOwner {
        successSensitivity = _successSensitivity;
    }

    function setSummoningDurationIfFailed(uint256 _summoningDurationIfFailed) external onlyAdminOrOwner {
        summoningDurationIfFailed = _summoningDurationIfFailed;
    }

    function setBalancerCrystalId(uint256 _balancerCrystalId) external onlyAdminOrOwner {
        balancerCrystalId = _balancerCrystalId;
    }

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

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

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

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

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

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

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

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

        delete crystalIds;

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

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

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

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

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

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

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

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

import "./SummoningState.sol";

abstract contract SummoningContracts is Initializable, SummoningState {

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

    function setContracts(
        address _legionAddress,
        address _legionMetadataStoreAddress,
        address _randomizerAddress,
        address _magicAddress,
        address _treasuryAddress,
        address _consumableAddress,
        address _craftingAddress,
        address _balancerCrystal)
    external onlyAdminOrOwner
    {
        randomizer = IRandomizer(_randomizerAddress);
        legion = ILegion(_legionAddress);
        legionMetadataStore = ILegionMetadataStore(_legionMetadataStoreAddress);
        magic = IMagic(_magicAddress);
        treasury = ITreasury(_treasuryAddress);
        consumable = IConsumable(_consumableAddress);
        crafting = ICrafting(_craftingAddress);
        balancerCrystal = IBalancerCrystal(_balancerCrystal);
    }

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

        _;
    }

    function areContractsSet() public view returns(bool) {
        return address(randomizer) != address(0)
            && address(legion) != address(0)
            && address(magic) != address(0)
            && address(treasury) != address(0)
            && address(consumable) != address(0)
            && address(legionMetadataStore) != address(0)
            && address(crafting) != address(0)
            && address(balancerCrystal) != address(0);
    }
}

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

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

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

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

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

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

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

    mapping(LegionGeneration => uint32) public generationToMaxSummons;

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

    // The name of the variable says LP, but in reality, this is Balancer Crystals.
    mapping(LegionGeneration => SummoningStep[]) public generationToLPRequiredSteps;

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

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

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

    // The name of the variable says LP, but in reality, this is Balancer Crystals.
    mapping(uint256 => uint256) public tokenIdToLPStaked;

    mapping(uint256 => uint256) public tokenIdToCrystalIdUsed;

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

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

    uint256 public summoningFatigueCooldown;

    uint256 public azuriteDustId;

    mapping(LegionGeneration => uint256) public generationToMagicCost;

    bool public isSummoningPaused;

    // Out of 100,000. Can be higher or lower than that value.
    uint256 public successSensitivity;

    uint256 public summoningDurationIfFailed;

    mapping(uint256 => uint256) public tokenIdToSuccessRate;
    mapping(uint256 => uint256) public tokenIdToMagicAmount;
    mapping(uint256 => uint256) public crystalIdToTimeReduction;

    ICrafting public crafting;
    IBalancerCrystal public balancerCrystal;
    uint256 public balancerCrystalId;

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

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

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

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

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

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

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

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

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

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

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

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

        summoningFatigueCooldown = 7 days;

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

        successSensitivity = 100000;
        summoningDurationIfFailed = 2 days;

        azuriteDustId = 11;

        crystalIdToTimeReduction[1] = 43200;
        crystalIdToTimeReduction[2] = 129600;
        crystalIdToTimeReduction[3] = 259200;

        crystalIdToChangedOdds[1] = [6000, 4000, 2000];
        crystalIdToChangedOdds[2] = [10000, 6000, 4000];
        crystalIdToChangedOdds[3] = [14000, 8000, 6000];
    }
}

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

interface IRandomizer {

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

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

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

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

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

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

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

interface ISummoning {

}

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

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

import "./UtilitiesUpgradeable.sol";

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

    mapping(address => bool) private admins;

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

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

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

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

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

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

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

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

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

    uint256[50] private __gap;
}

File 16 of 36 : 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 36 : IStarlightTemple.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IStarlightTemple {

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

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

interface ITreasury {

    function isBridgeWorldPowered() external view returns(bool);

    function forwardCoinsToMine(uint256 _totalMagicSent) external;
}

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

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

interface IConsumable is IERC1155Upgradeable {

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

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

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

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

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

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

interface IMagic {

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

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

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

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

interface ILP {

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

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

File 22 of 36 : IBalancerCrystal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

interface IBalancerCrystal is IERC1155Upgradeable {

    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 23 of 36 : ICrafting.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ICrafting {

}

File 24 of 36 : 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 25 of 36 : ERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

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

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

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

File 26 of 36 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

File 28 of 36 : 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 29 of 36 : 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 30 of 36 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

abstract contract LegionMetadataStoreState is Initializable, AdminableUpgradeable {

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"}],"name":"NoSummoningToFinish","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"uint256","name":"_returnedId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_newTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newTokenSummoningCooldown","type":"uint256"}],"name":"SummoningFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_finishTime","type":"uint256"}],"name":"SummoningStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"addAdmins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"areContractsSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"azuriteDustId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balancerCrystal","outputs":[{"internalType":"contract IBalancerCrystal","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balancerCrystalId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculateSuccessRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chanceAzuriteDustDrop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"consumable","outputs":[{"internalType":"contract IConsumable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"crafting","outputs":[{"internalType":"contract ICrafting","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"crystalIdToChangedOdds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"crystalIdToTimeReduction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"didSummoningSucceed","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"finishSummonTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum LegionGeneration","name":"","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"generationToLPRequiredSteps","outputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32","name":"minSummons","type":"uint32"},{"internalType":"uint32","name":"maxSummons","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum LegionGeneration","name":"","type":"uint8"}],"name":"generationToMagicCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum LegionGeneration","name":"","type":"uint8"}],"name":"generationToMaxSummons","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getStakedLegions","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSummoningPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_succeeded","type":"bool"}],"name":"isTokenDoneSummoning","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legion","outputs":[{"internalType":"contract ILegion","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legionMetadataStore","outputs":[{"internalType":"contract ILegionMetadataStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lp","outputs":[{"internalType":"contract ILP","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"magic","outputs":[{"internalType":"contract IMagic","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomizer","outputs":[{"internalType":"contract IRandomizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum LegionRarity","name":"","type":"uint8"},{"internalType":"enum LegionGeneration","name":"","type":"uint8"},{"internalType":"enum LegionRarity","name":"","type":"uint8"}],"name":"rarityToGenerationToOddsPerRarity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"removeAdmins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32","name":"minSummons","type":"uint32"},{"internalType":"uint32","name":"maxSummons","type":"uint32"}],"internalType":"struct SummoningStep[]","name":"_auxiliarySteps","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint32","name":"minSummons","type":"uint32"},{"internalType":"uint32","name":"maxSummons","type":"uint32"}],"internalType":"struct SummoningStep[]","name":"_genesisSteps","type":"tuple[]"}],"name":"setBCSteps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_balancerCrystalId","type":"uint256"}],"name":"setBalancerCrystalId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_legionAddress","type":"address"},{"internalType":"address","name":"_legionMetadataStoreAddress","type":"address"},{"internalType":"address","name":"_randomizerAddress","type":"address"},{"internalType":"address","name":"_magicAddress","type":"address"},{"internalType":"address","name":"_treasuryAddress","type":"address"},{"internalType":"address","name":"_consumableAddress","type":"address"},{"internalType":"address","name":"_craftingAddress","type":"address"},{"internalType":"address","name":"_balancerCrystal","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_crystalIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_crystalTimeReductions","type":"uint256[]"},{"internalType":"uint256[3][]","name":"_crystalIdToOdds","type":"uint256[3][]"}],"name":"setCrystalOdds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isSummoningPaused","type":"bool"}],"name":"setIsSummoningPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_shouldPause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_summoningDuration","type":"uint256"},{"internalType":"uint256","name":"_genesisMagicCost","type":"uint256"},{"internalType":"uint256","name":"_auxiliaryMagicCost","type":"uint256"},{"internalType":"uint32","name":"_auxiliaryMaxSummons","type":"uint32"},{"internalType":"uint32","name":"_genesisMaxSummons","type":"uint32"},{"internalType":"uint256","name":"_chanceAzuriteDustDrop","type":"uint256"},{"internalType":"uint256","name":"_azuriteDustId","type":"uint256"}],"name":"setSimpleSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_successSensitivity","type":"uint256"}],"name":"setSuccessSensitivity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_summoningDurationIfFailed","type":"uint256"}],"name":"setSummoningDurationIfFailed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_summoningFatigueCooldown","type":"uint256"}],"name":"setSummoningFatigue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum LegionRarity[]","name":"_inputRarities","type":"uint8[]"},{"internalType":"uint256[]","name":"_genesisOdds","type":"uint256[]"},{"internalType":"uint256[]","name":"_auxiliaryOdds","type":"uint256[]"}],"name":"setSummoningOdds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_crystalIds","type":"uint256[]"}],"name":"startSummon","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"successSensitivity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"summoningDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"summoningDurationIfFailed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"summoningFatigueCooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToCreatedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToCrystalIdUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToLPStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToMagicAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToSuccessRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToSummonCount","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToSummonStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"contract ITreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50615a4280620000216000396000f3fe608060405234801561001057600080fd5b50600436106103c55760003560e01c8063808f1057116101ff578063af39c1251161011a578063ccbb4225116100ad578063f23a6e611161007c578063f23a6e6114610962578063f2fde38b14610981578063fa39563214610994578063ffd0d14d146109a757600080fd5b8063ccbb42251461090f578063d7dfe4dd14610930578063dfa43d3214610944578063f10fb5841461094e57600080fd5b8063bc197c81116100e9578063bc197c81146108c2578063bedb86fb146108e1578063c28f1f9c146108f4578063c98c8c44146108fc57600080fd5b8063af39c12514610853578063b06dac3914610866578063b5821dc914610870578063b866b6921461089057600080fd5b806391f1cf0511610192578063a433a57d11610161578063a433a57d146107eb578063a56cb6dd1461080c578063ad402cc31461081f578063ad72e1a51461083257600080fd5b806391f1cf051461079e578063939a7fa1146107b25780639ad8d6f7146107c55780639c54df64146107d857600080fd5b80638da5cb5b116101ce5780638da5cb5b146107495780638e97a6481461075a5780638fc0f8b01461076d57806391c96bf51461077757600080fd5b8063808f10571461071b5780638129fc1c146107255780638a7bf8041461072d5780638cdcc4b41461074157600080fd5b806329570f41116102ef5780635d85f85411610282578063675857eb11610251578063675857eb146106d857806370480275146106ec578063715018a6146106ff5780637d72c35f1461070757600080fd5b80635d85f854146106615780635fce51a31461068257806361d027b3146106a357806362689129146106b757600080fd5b8063377e11e0116102be578063377e11e01461062557806351c2f470146106385780635772d5b21461064b5780635c975abb1461065557600080fd5b806329570f41146105b8578063313c06a0146105c2578063340c2ca7146105d65780633576cd341461061257600080fd5b80630ebe11961161036757806318d939e81161033657806318d939e814610536578063192be2331461055757806324d7806c1461056a57806327f6eb8e1461059757600080fd5b80630ebe1196146104b657806310e12640146104d7578063150b7a02146104ec5780631785f53c1461052357600080fd5b80630643ba4c116103a35780630643ba4c146104185780630b10338f146104425780630c6263a5146104555780630d8546461461048a57600080fd5b806301ffc9a7146103ca578063021946db146103f2578063037a528b14610400575b600080fd5b6103dd6103d8366004614bca565b6109ba565b60405190151581526020015b60405180910390f35b6101ab546103dd9060ff1681565b61040a61019a5481565b6040519081526020016103e9565b61042b610426366004614bf4565b6109f1565b6040805192151583526020830191909152016103e9565b61040a610450366004614c0d565b610bda565b610468610463366004614c3c565b610c00565b6040805193845263ffffffff92831660208501529116908201526060016103e9565b6101955461049e906001600160a01b031681565b6040516001600160a01b0390911681526020016103e9565b61040a6104c4366004614bf4565b6101a36020526000908152604090205481565b6104ea6104e5366004614cac565b610c4f565b005b61050a6104fa366004614e10565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016103e9565b6104ea610531366004614e77565b611138565b61040a610544366004614bf4565b6101a46020526000908152604090205481565b6104ea610565366004614ea0565b611184565b6103dd610578366004614e77565b6001600160a01b0316600090815261015f602052604090205460ff1690565b61040a6105a5366004614bf4565b6101a26020526000908152604090205481565b61040a6101a95481565b6101965461049e906001600160a01b031681565b6105fd6105e4366004614ebd565b61019b6020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016103e9565b6104ea610620366004614f1e565b6111d6565b6104ea610633366004614fb7565b6113a3565b6103dd610646366004614ff8565b611445565b61040a61019e5481565b61012d5460ff166103dd565b61040a61066f366004614bf4565b6101b06020526000908152604090205481565b61040a610690366004614bf4565b6101a06020526000908152604090205481565b6101975461049e906001600160a01b031681565b61040a6106c5366004614bf4565b6101af6020526000908152604090205481565b6101935461049e906001600160a01b031681565b6104ea6106fa366004614e77565b61145b565b6104ea6114aa565b6101b25461049e906001600160a01b031681565b61040a6101ad5481565b6104ea6114e0565b6101945461049e906001600160a01b031681565b6103dd61155a565b60fb546001600160a01b031661049e565b6104ea610768366004614bf4565b611612565b61040a6101ac5481565b6105fd610785366004614bf4565b6101996020526000908152604090205463ffffffff1681565b6101b15461049e906001600160a01b031681565b6104ea6107c0366004614bf4565b611656565b6104ea6107d3366004615028565b61169a565b6104ea6107e6366004614fb7565b61176b565b61040a6107f9366004614bf4565b6101ae6020526000908152604090205481565b6104ea61081a3660046150bf565b611808565b6104ea61082d366004614fb7565b611db0565b61040a610840366004614bf4565b6101a16020526000908152604090205481565b6104ea610861366004614bf4565b612088565b61040a6101b35481565b61088361087e366004614e77565b6120cc565b6040516103e99190615146565b61040a61089e366004615197565b61019c60209081526000938452604080852082529284528284209052825290205481565b61050a6108d0366004615261565b63bc197c8160e01b95945050505050565b6104ea6108ef366004614ea0565b6120f1565b61040a612145565b6104ea61090a366004614bf4565b6122da565b61040a61091d366004614ebd565b6101aa6020526000908152604090205481565b6101985461049e906001600160a01b031681565b61040a6101a85481565b6101925461049e906001600160a01b031681565b61050a61097036600461530a565b63f23a6e6160e01b95945050505050565b6104ea61098f366004614e77565b61231e565b6104ea6109a236600461536e565b6123b6565b6104ea6109b53660046153df565b6125fe565b60006001600160e01b03198216630271189760e51b14806109eb57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008181526101a16020526040812054819080610a6c5760405162461bcd60e51b815260206004820152602e60248201527f53756d6d6f6e696e673a2053756d6d6f6e696e67206e6f7420696e2070726f6760448201526d3932b9b9903337b9103a37b5b2b760911b60648201526084015b60405180910390fd5b6101925460405163f030210760e01b8152600481018390526001600160a01b039091169063f03021079060240160206040518083038186803b158015610ab157600080fd5b505afa158015610ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae99190615447565b610b355760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e673a2052616e646f6d206973206e6f7420726561647900006044820152606401610a63565b61019254604051634ad30a7560e01b8152600481018390526000916001600160a01b031690634ad30a759060240160206040518083038186803b158015610b7b57600080fd5b505afa158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb39190615464565b90506000610bc1868361274e565b905080610bce87836127df565b94509450505050915091565b6101a76020528160005260406000208160038110610bf757600080fd5b01549150829050565b61019d6020528160005260406000208181548110610c1d57600080fd5b60009182526020909120600290910201805460019091015490925063ffffffff80821692506401000000009091041683565b83838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050825115159150610cc290505760405162461bcd60e51b815260206004820152600b60248201526a456d70747920617272617960a81b6044820152606401610a63565b61012d5460ff1615610ce65760405162461bcd60e51b8152600401610a639061547d565b610cee61155a565b610d3a5760405162461bcd60e51b815260206004820152601f60248201527f53756d6d6f6e696e673a20436f6e747261637473206172656e277420736574006044820152606401610a63565b333214610d785760405162461bcd60e51b815260206004820152600c60248201526b4e6f20636f6e74726163747360a01b6044820152606401610a63565b6101ab5460ff1615610dcc5760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e673a2053756d6d6f6e696e672069732070617573656400006044820152606401610a63565b838214610e1b5760405162461bcd60e51b815260206004820181905260248201527f4372797374616c20616e6420546f6b656e73206d75737420626520657175616c6044820152606401610a63565b61019760009054906101000a90046001600160a01b03166001600160a01b031663ca1709556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6a57600080fd5b505afa158015610e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea29190615447565b610eee5760405162461bcd60e51b815260206004820152601860248201527f42726964676520576f726c64206e6f7420706f776572656400000000000000006044820152606401610a63565b60008060005b86811015610f6b57600080610f398a8a85818110610f1457610f146154a7565b90506020020135898986818110610f2d57610f2d6154a7565b9050602002013561285e565b9092509050610f4882866154d3565b9450610f5481856154d3565b935050508080610f63906154eb565b915050610ef4565b50801561105b57610195546040516323b872dd60e01b8152336004820152306024820152604481018390526000916001600160a01b0316906323b872dd90606401602060405180830381600087803b158015610fc657600080fd5b505af1158015610fda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffe9190615447565b9050806110595760405162461bcd60e51b815260206004820152602360248201527f53756d6d6f6e696e673a204d61676963206661696c656420746f207472616e736044820152623332b960e91b6064820152608401610a63565b505b811561112f5760006101b354116110c35760405162461bcd60e51b815260206004820152602660248201527f53756d6d6f6e696e673a2042616c616e636572206372797374616c206964206d604482015265697373696e6760d01b6064820152608401610a63565b6101b2546101b35460405163a878b95d60e01b81526001600160a01b039092169163a878b95d916110fc91339130918890600401615506565b600060405180830381600087803b15801561111657600080fd5b505af115801561112a573d6000803e3d6000fd5b505050505b50505050505050565b60fb546001600160a01b031633146111625760405162461bcd60e51b8152600401610a639061552f565b6001600160a01b0316600090815261015f60205260409020805460ff19169055565b33600090815261015f602052604090205460ff16806111a657506111a6612d9a565b6111c25760405162461bcd60e51b8152600401610a6390615564565b6101ab805460ff1916911515919091179055565b33600090815261015f602052604090205460ff16806111f857506111f8612d9a565b6112145760405162461bcd60e51b8152600401610a6390615564565b848114801561122257508483145b61126e5760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e673a20426164206372797374616c206c656e6774687300006044820152606401610a63565b6101a56000818161127f8282614b0a565b5050505060005b8581101561112f576112bb8787838181106112a3576112a36154a7565b905060200201356101a5612dbe90919063ffffffff16565b508484828181106112ce576112ce6154a7565b905060200201356101b060008989858181106112ec576112ec6154a7565b9050602002013581526020019081526020016000208190555060005b600381101561139057838383818110611323576113236154a7565b905060600201816003811061133a5761133a6154a7565b60200201356101a760008a8a86818110611356576113566154a7565b905060200201358152602001908152602001600020826003811061137c5761137c6154a7565b015580611388816154eb565b915050611308565b508061139b816154eb565b915050611286565b60fb546001600160a01b031633146113cd5760405162461bcd60e51b8152600401610a639061552f565b60005b8181101561144057600061015f60008585858181106113f1576113f16154a7565b90506020020160208101906114069190614e77565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580611438816154eb565b9150506113d0565b505050565b600061145183836127df565b4210159392505050565b60fb546001600160a01b031633146114855760405162461bcd60e51b8152600401610a639061552f565b6001600160a01b0316600090815261015f60205260409020805460ff19166001179055565b60fb546001600160a01b031633146114d45760405162461bcd60e51b8152600401610a639061552f565b6114de6000612dd1565b565b600054610100900460ff166114fb5760005460ff16156114ff565b303b155b61151b5760405162461bcd60e51b8152600401610a6390615590565b600054610100900460ff1615801561153d576000805461ffff19166101011790555b611545612e23565b8015611557576000805461ff00191690555b50565b610192546000906001600160a01b0316158015906115835750610193546001600160a01b031615155b801561159a5750610195546001600160a01b031615155b80156115b15750610197546001600160a01b031615155b80156115c85750610198546001600160a01b031615155b80156115df5750610194546001600160a01b031615155b80156115f657506101b1546001600160a01b031615155b801561160d57506101b2546001600160a01b031615155b905090565b33600090815261015f602052604090205460ff16806116345750611634612d9a565b6116505760405162461bcd60e51b8152600401610a6390615564565b6101ac55565b33600090815261015f602052604090205460ff16806116785750611678612d9a565b6116945760405162461bcd60e51b8152600401610a6390615564565b6101a855565b33600090815261015f602052604090205460ff16806116bc57506116bc612d9a565b6116d85760405162461bcd60e51b8152600401610a6390615564565b61019280546001600160a01b03199081166001600160a01b03988916179091556101938054821699881699909917909855610194805489169787169790971790965561019580548816948616949094179093556101978054871692851692909217909155610198805486169184169190911790556101b1805485169183169190911790556101b280549093169116179055565b60fb546001600160a01b031633146117955760405162461bcd60e51b8152600401610a639061552f565b60005b8181101561144057600161015f60008585858181106117b9576117b96154a7565b90506020020160208101906117ce9190614e77565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580611800816154eb565b915050611798565b33600090815261015f602052604090205460ff168061182a575061182a612d9a565b6118465760405162461bcd60e51b8152600401610a6390615564565b841580159061185e575061185b8560036155de565b83145b801561186957508083145b6118a65760405162461bcd60e51b815260206004820152600e60248201526d42616420696e707574206461746160901b6044820152606401610a63565b60005b8581101561112f5760008787838181106118c5576118c56154a7565b90506020020160208101906118da91906155fd565b905085856118e98460036155de565b8181106118f8576118f86154a7565b9050602002013561019c60008360058111156119165761191661561a565b60058111156119275761192761561a565b815260200190815260200160002060008060028111156119495761194961561a565b600281111561195a5761195a61561a565b815260200190815260200160002060006004600581111561197d5761197d61561a565b600581111561198e5761198e61561a565b815260208101919091526040016000205585856119ac8460036155de565b6119b79060016154d3565b8181106119c6576119c66154a7565b9050602002013561019c60008360058111156119e4576119e461561a565b60058111156119f5576119f561561a565b81526020019081526020016000206000806002811115611a1757611a1761561a565b6002811115611a2857611a2861561a565b8152602001908152602001600020600060036005811115611a4b57611a4b61561a565b6005811115611a5c57611a5c61561a565b81526020810191909152604001600020558585611a7a8460036155de565b611a859060026154d3565b818110611a9457611a946154a7565b9050602002013561019c6000836005811115611ab257611ab261561a565b6005811115611ac357611ac361561a565b81526020019081526020016000206000806002811115611ae557611ae561561a565b6002811115611af657611af661561a565b8152602001908152602001600020600060016005811115611b1957611b1961561a565b6005811115611b2a57611b2a61561a565b81526020810191909152604001600020558383611b488460036155de565b818110611b5757611b576154a7565b9050602002013561019c6000836005811115611b7557611b7561561a565b6005811115611b8657611b8661561a565b8152602001908152602001600020600060016002811115611ba957611ba961561a565b6002811115611bba57611bba61561a565b8152602001908152602001600020600060046005811115611bdd57611bdd61561a565b6005811115611bee57611bee61561a565b81526020810191909152604001600020558383611c0c8460036155de565b611c179060016154d3565b818110611c2657611c266154a7565b9050602002013561019c6000836005811115611c4457611c4461561a565b6005811115611c5557611c5561561a565b8152602001908152602001600020600060016002811115611c7857611c7861561a565b6002811115611c8957611c8961561a565b8152602001908152602001600020600060036005811115611cac57611cac61561a565b6005811115611cbd57611cbd61561a565b81526020810191909152604001600020558383611cdb8460036155de565b611ce69060026154d3565b818110611cf557611cf56154a7565b9050602002013561019c6000836005811115611d1357611d1361561a565b6005811115611d2457611d2461561a565b8152602001908152602001600020600060016002811115611d4757611d4761561a565b6002811115611d5857611d5861561a565b8152602001908152602001600020600060016005811115611d7b57611d7b61561a565b6005811115611d8c57611d8c61561a565b81526020810191909152604001600020555080611da8816154eb565b9150506118a9565b81818080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050825115159150611e2390505760405162461bcd60e51b815260206004820152600b60248201526a456d70747920617272617960a81b6044820152606401610a63565b61012d5460ff1615611e475760405162461bcd60e51b8152600401610a639061547d565b611e4f61155a565b611e9b5760405162461bcd60e51b815260206004820152601f60248201527f53756d6d6f6e696e673a20436f6e747261637473206172656e277420736574006044820152606401610a63565b333214611ed95760405162461bcd60e51b815260206004820152600c60248201526b4e6f20636f6e74726163747360a01b6044820152606401610a63565b60008060005b8481101561200e576000868683818110611efb57611efb6154a7565b33600090815261019f60209081526040909120910292909201359250611f2391905082612e88565b611f645760405162461bcd60e51b81526020600482015260126024820152712237b2b9903737ba1037bbb7103a37b5b2b760711b6044820152606401610a63565b600080611f7083612ea0565b915091508580611f7f906154eb565b9650611f8d905081866154d3565b33600090815261019f60205260409020909550611faa908461375f565b508183336001600160a01b03167f57fb6651407add325798886abde3bb5570b272ab228220645c3046def1a620646101a85442611fe791906154d3565b60405190815260200160405180910390a45050508080612006906154eb565b915050611edf565b508015612081576101b2546101b35460405163a878b95d60e01b81526001600160a01b039092169163a878b95d9161204e91309133918790600401615506565b600060405180830381600087803b15801561206857600080fd5b505af115801561207c573d6000803e3d6000fd5b505050505b5050505050565b33600090815261015f602052604090205460ff16806120aa57506120aa612d9a565b6120c65760405162461bcd60e51b8152600401610a6390615564565b6101ad55565b6001600160a01b038116600090815261019f602052604090206060906109eb9061376b565b33600090815261015f602052604090205460ff16806121135750612113612d9a565b61212f5760405162461bcd60e51b8152600401610a6390615564565b801561213d57611557613778565b6115576137ef565b610193546040516370a0823160e01b815230600482015260009182916001600160a01b03909116906370a082319060240160206040518083038186803b15801561218e57600080fd5b505afa1580156121a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c69190615464565b610193546101b1546040516370a0823160e01b81526001600160a01b0391821660048201529293506000929116906370a082319060240160206040518083038186803b15801561221557600080fd5b505afa158015612229573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224d9190615464565b90508061225d5760019250505090565b6002620186a06101ac54620186a061227591906155de565b61227f9190615646565b8261228d85620186a06155de565b6122979190615646565b6122a191906155de565b6122ab919061573e565b6122be9068056bc75e2d631000006154d3565b6122d3906a084595161401484a000000615646565b9250505090565b33600090815261015f602052604090205460ff16806122fc57506122fc612d9a565b6123185760405162461bcd60e51b8152600401610a6390615564565b6101b355565b60fb546001600160a01b031633146123485760405162461bcd60e51b8152600401610a639061552f565b6001600160a01b0381166123ad5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a63565b61155781612dd1565b33600090815261015f602052604090205460ff16806123d857506123d8612d9a565b6123f45760405162461bcd60e51b8152600401610a6390615564565b826124375760405162461bcd60e51b815260206004820152601360248201527242616420617578696c6961727920737465707360681b6044820152606401610a63565b806124785760405162461bcd60e51b81526020600482015260116024820152704261642067656e6573697320737465707360781b6044820152606401610a63565b6001600090815261019d6020526124b0907f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff90614b28565b600080805261019d6020526124e6907f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d90614b28565b60005b8381101561257257600160005261019d6020527f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff85858381811061252f5761252f6154a7565b83546001810185556000948552602090942060609091029290920192600202909101905061255d828261574d565b5050808061256a906154eb565b9150506124e9565b5060005b81811015612081576000805261019d6020527f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d8383838181106125bb576125bb6154a7565b8354600181018555600094855260209094206060909102929092019260020290910190506125e9828261574d565b505080806125f6906154eb565b915050612576565b33600090815261015f602052604090205460ff16806126205750612620612d9a565b61263c5760405162461bcd60e51b8152600401610a6390615564565b620186a08211156126825760405162461bcd60e51b815260206004820152601060248201526f42616420617a7572697465206f64647360801b6044820152606401610a63565b61019a9690965561019e556101a9949094557f04d43b951d4b9841d09fb89cef478e37e6998a75d7f9d1fc96bb4384cfcd3c3b919091557f72a6c68455ff49f07ee58e8d48ef255a5d3d0e7e858ddaa2a08c6674acc4146b9190915561019b6020527f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef805463ffffffff92831663ffffffff1991821617909155600080527f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a6578054929093169116179055565b6000817f4f89f263642b05c303a871d09552051eec7beb8efdb1aed78334fa0f3a85ea1960405160200161278c929190918252602082015260400190565b60408051601f19818403018152918152815160209283012060008681526101ae909352912054909250806127c45760019150506109eb565b60006127d3620186a0856157ae565b91909110949350505050565b600081156128395760008381526101a360209081526040808320548084526101b083528184205461019a548886526101a090945291909320549091829161282691906154d3565b61283091906157c2565b925050506109eb565b6101ad5460008481526101a0602052604090205461285791906154d3565b90506109eb565b6101a85460008381526101a460205260408120549091829161288091906154d3565b4210156128cf5760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e672066617469677565207374696c6c2061637469766500006044820152606401610a63565b610194546040516378afdef960e11b8152600481018690526000916001600160a01b03169063f15fbdf2906024016101806040518083038186803b15801561291657600080fd5b505afa15801561292a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294e9190615869565b90506002815160028111156129655761296561561a565b14156129b35760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f742073756d6d6f6e207769746820726563727569740000000000006044820152606401610a63565b600085815261019960205260408120805463ffffffff16918291906129d783615900565b91906101000a81548163ffffffff021916908363ffffffff1602179055505061019b600083600001516002811115612a1157612a1161561a565b6002811115612a2257612a2261561a565b815260208101919091526040016000205463ffffffff90811690821610612a815760405162461bcd60e51b815260206004820152601360248201527252656163686564206d61782073756d6d6f6e7360681b6044820152606401610a63565b610193546040516383291f8760e01b8152336004820152306024820152604481018890526001600160a01b03909116906383291f8790606401600060405180830381600087803b158015612ad457600080fd5b505af1158015612ae8573d6000803e3d6000fd5b505050506000612afc83600001518361386b565b33600090815261019f60205260409020909150612b199088612dbe565b5060008781526101a06020908152604080832042905561019254815163433c53d960e11b815291516001600160a01b0390911692638678a7b2926004808201939182900301818787803b158015612b6f57600080fd5b505af1158015612b83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba79190615464565b60008981526101a1602090815260408083208490556101a290915290208390559050612bd1612145565b60008981526101ae602052604081209190915584516101aa91906002811115612bfc57612bfc61561a565b6002811115612c0d57612c0d61561a565b815260208082019290925260409081016000908120548b82526101af90935220558615612d0157612c406101a588612e88565b612c7d5760405162461bcd60e51b815260206004820152600e60248201526d1098590818dc9e5cdd185b08125160921b6044820152606401610a63565b60008881526101a36020526040908190208890556101985461019754915163a878b95d60e01b81526001600160a01b039182169263a878b95d92612cce923392909116908c90600190600401615506565b600060405180830381600087803b158015612ce857600080fd5b505af1158015612cfc573d6000803e3d6000fd5b505050505b8088336001600160a01b03167fa65bbc6392db72d041caaed384252b6166f63d34c0012bf969b6312e8dddba7461019a5442612d3d91906154d3565b60405190815260200160405180910390a4816101aa600086600001516002811115612d6a57612d6a61561a565b6002811115612d7b57612d7b61561a565b81526020019081526020016000205495509550505050505b9250929050565b600033612daf60fb546001600160a01b031690565b6001600160a01b031614905090565b6000612dca83836139c5565b9392505050565b60fb80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612e3e5760005460ff1615612e42565b303b155b612e5e5760405162461bcd60e51b8152600401610a6390615590565b600054610100900460ff16158015612e80576000805461ffff19166101011790555b611545613a14565b60008181526001830160205260408120541515612dca565b60008181526101a160205260408082205461019254915163f030210760e01b81526004810182905283926001600160a01b03169063f03021079060240160206040518083038186803b158015612ef557600080fd5b505afa158015612f09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f2d9190615447565b612f795760405162461bcd60e51b815260206004820152601e60248201527f53756d6d6f6e696e673a2052616e646f6d206973206e6f7420726561647900006044820152606401610a63565b61019254604051634ad30a7560e01b8152600481018390526000916001600160a01b031690634ad30a759060240160206040518083038186803b158015612fbf57600080fd5b505afa158015612fd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ff79190615464565b90506000613005868361274e565b90506130118682611445565b61306d5760405162461bcd60e51b815260206004820152602760248201527f53756d6d6f6e696e673a204c6567696f6e206973206e6f7420646f6e652073756044820152666d6d6f6e696e6760c81b6064820152608401610a63565b60008681526101a3602052604081205482156134f457610194546040516378afdef960e11b8152600481018a90526000916001600160a01b03169063f15fbdf2906024016101806040518083038186803b1580156130ca57600080fd5b505afa1580156130de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131029190615869565b610193546040516340d097c360e01b81523360048201529192506001600160a01b0316906340d097c390602401602060405180830381600087803b15801561314957600080fd5b505af115801561315d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131819190615464565b925060006131906005876157ae565b61319b9060016154d3565b60098111156131ac576131ac61561a565b60408051602081018990529081018890529091506060016040516020818303038152906040528051906020012060001c955060006131eb878486613a79565b610194546040516307d1b76f60e41b81529192506001600160a01b031690637d1b76f090613229903390899060019088908890600090600401615924565b600060405180830381600087803b15801561324357600080fd5b505af1158015613257573d6000803e3d6000fd5b505050508687604051602001613277929190918252602082015260400190565b60408051601f198184030181529190528051602090910120965060006132a0620186a0896157ae565b905061019e548110156133725760006101a954116133005760405162461bcd60e51b815260206004820152601760248201527f417a75726974652044757374204944206e6f74207365740000000000000000006044820152606401610a63565b610198546101a954604051630ab714fb60e11b81523360048201526024810191909152600160448201526001600160a01b039091169063156e29f690606401600060405180830381600087803b15801561335957600080fd5b505af115801561336d573d6000803e3d6000fd5b505050505b60008681526101a4602090815260408083204290558e83526101af909152808220546101955461019754925163a9059cbb60e01b81526001600160a01b03938416600482015260248101839052919392169063a9059cbb90604401602060405180830381600087803b1580156133e757600080fd5b505af11580156133fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061341f9190615447565b90508061348a5760405162461bcd60e51b815260206004820152603360248201527f53756d6d6f6e696e673a204d61676963206661696c656420746f207472616e7360448201527266657220746f2074686520747265617375727960681b6064820152608401610a63565b610197546040516359193fc560e01b8152600481018490526001600160a01b03909116906359193fc590602401600060405180830381600087803b1580156134d157600080fd5b505af11580156134e5573d6000803e3d6000fd5b505050505050505050506136ab565b600088815261019960205260408120805463ffffffff16916135158361598b565b825463ffffffff9182166101009390930a9283029190920219909116179055506101955460008981526101af602052604080822054905163a9059cbb60e01b8152336004820152602481019190915290916001600160a01b03169063a9059cbb90604401602060405180830381600087803b15801561359357600080fd5b505af11580156135a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135cb9190615447565b9050806136335760405162461bcd60e51b815260206004820152603060248201527f53756d6d6f6e696e673a204d61676963206661696c656420746f207472616e7360448201526f3332b9103130b1b5903a37903ab9b2b960811b6064820152608401610a63565b81156136a957610198546101975460405163a878b95d60e01b81526001600160a01b039283169263a878b95d926136769291169033908790600190600401615506565b600060405180830381600087803b15801561369057600080fd5b505af11580156136a4573d6000803e3d6000fd5b505050505b505b60008881526101a26020908152604080832080546101a18452828520859055908490556101a083528184208490556101a3909252808320929092556101935491516383291f8760e01b8152306004820152336024820152604481018b905290916001600160a01b0316906383291f8790606401600060405180830381600087803b15801561373857600080fd5b505af115801561374c573d6000803e3d6000fd5b50949b929a509198505050505050505050565b6000612dca8383613daf565b60606000612dca83613ea2565b61012d5460ff161561379c5760405162461bcd60e51b8152600401610a639061547d565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586137d23390565b6040516001600160a01b03909116815260200160405180910390a1565b61012d5460ff166138395760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a63565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336137d2565b60008061019d60008560028111156138855761388561561a565b60028111156138965761389661561a565b8152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b8282101561391c57600084815260209081902060408051606081018252600286029092018054835260019081015463ffffffff80821685870152640100000000909104169183019190915290835290920191016138c4565b50505050905060005b8151811015613987576000828281518110613942576139426154a7565b60200260200101519050806040015163ffffffff168563ffffffff16111561396a5750613975565b5192506109eb915050565b8061397f816154eb565b915050613925565b5060405162461bcd60e51b815260206004820152601260248201527142616420424320737465702076616c75657360701b6044820152606401610a63565b6000818152600183016020526040812054613a0c575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556109eb565b5060006109eb565b600054610100900460ff16613a2f5760005460ff1615613a33565b303b155b613a4f5760405162461bcd60e51b8152600401610a6390615590565b600054610100900460ff16158015613a71576000805461ffff19166101011790555b611545613efe565b60008061019c600085604001516005811115613a9757613a9761561a565b6005811115613aa857613aa861561a565b8152602001908152602001600020600085600001516002811115613ace57613ace61561a565b6002811115613adf57613adf61561a565b8152602001908152602001600020600060046005811115613b0257613b0261561a565b6005811115613b1357613b1361561a565b8152602001908152602001600020549050600061019c600086604001516005811115613b4157613b4161561a565b6005811115613b5257613b5261561a565b8152602001908152602001600020600086600001516002811115613b7857613b7861561a565b6002811115613b8957613b8961561a565b8152602001908152602001600020600060036005811115613bac57613bac61561a565b6005811115613bbd57613bbd61561a565b8152602001908152602001600020549050600061019c600087604001516005811115613beb57613beb61561a565b6005811115613bfc57613bfc61561a565b8152602001908152602001600020600087600001516002811115613c2257613c2261561a565b6002811115613c3357613c3361561a565b8152602001908152602001600020600060016005811115613c5657613c5661561a565b6005811115613c6757613c6761561a565b815260200190815260200160002054905084600014613d055760008581526101a76020526040808220815160608101928390529160039082845b815481526020019060010190808311613ca1575050505050905080600060038110613cce57613cce6154a7565b6020020151613cdd90856157c2565b6020820151909450613cef90846154d3565b6040820151909350613d0190836154d3565b9150505b80613d1083856154d3565b613d1a91906154d3565b620186a014613d5d5760405162461bcd60e51b815260206004820152600f60248201526e42616420526172697479206f64647360881b6044820152606401610a63565b6000613d6c620186a0896157ae565b905083811015613d83576004945050505050612dca565b613d8d83856154d3565b811015613da1576003945050505050612dca565b506001979650505050505050565b60008181526001830160205260408120548015613e98576000613dd36001836157c2565b8554909150600090613de7906001906157c2565b9050818114613e4c576000866000018281548110613e0757613e076154a7565b9060005260206000200154905080876000018481548110613e2a57613e2a6154a7565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613e5d57613e5d6159ab565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506109eb565b60009150506109eb565b606081600001805480602002602001604051908101604052809291908181526020018280548015613ef257602002820191906000526020600020905b815481526020019060010190808311613ede575b50505050509050919050565b600054610100900460ff16613f195760005460ff1615613f1d565b303b155b613f395760405162461bcd60e51b8152600401610a6390615590565b600054610100900460ff16158015613f5b576000805461ffff19166101011790555b611545600054610100900460ff16613f795760005460ff1615613f7d565b303b155b613f995760405162461bcd60e51b8152600401610a6390615590565b600054610100900460ff16158015613fbb576000805461ffff19166101011790555b611545600054610100900460ff16613fd95760005460ff1615613fdd565b303b155b613ff95760405162461bcd60e51b8152600401610a6390615590565b600054610100900460ff1615801561401b576000805461ffff19166101011790555b614023614947565b61402b6149ac565b6140336149ac565b620d2f0061019a55600a61019e8190557f1871dda0514920f847a38e1c1a849cdd4f94e8f7f85b81658671fe5ca8ad11ef8054600163ffffffff1991821681179092557f50a97c7b30cb1a28824c00fb61d93f0784e76a1d9a50667766f7b8f4ed03a657805463ffffffff92168217905562015f907f92ba7d3c000c0cc8d9e1dc8151b7ea9755ff00799f40e14ecd2e42eba9a6430b8190556123287fef75423777c4cbaaf239475bf1ff71a6a2d7d55f317caef41756b7774401a6288190556103e87f4a20c6e668f7dd6e7bddd50201d3ddad37ecb406e48c0bc7dfc3c774994f419c819055620186a07fee1b74751cc3a5aa70c3a9cbfa9b333cba45fdf17fc8771c9bed0ad31fd75eed5560007f5a1028a0f5ebc44f2a69e91f803daf6c7a853efb5f85733056fdf56e9e7593f58190557f9a16730bdc065e96f347922201bf0c48cc23ec91abb70524f62876fb8950dc8d819055620138807fd2197b725c02febdfc9072cadc39e07e1f70455aa071945e42d3aa4a0a47966d55613a987f22ab0f0c774a6350e3ffba0f0a82e3555ee91b83fee894d097b8b71a216245a3556113887f7268e37e9edc0071c46e13c7b8be8a3967fddb81587a7564252584c2ae65990b819055620173187fd057db82a093dff5a5c50b75cc28d0f87c701532f9199f538ccd67bc6d222a91557f2e18495cac82c92c768595199951016a13c3b60fb74847d03810b6691f428837557f2a5ca2d337f8e93fe60c5a12760950ee2341ea1f0c24ad8a6f60d1c8cb5b045c819055620124f87f8ea44f5f19ea7e0f66221b63e81924a0b29decc4022d9740928c06d0ad905906556146507f0e8ea98c7ba24f4310775ee2319dcd693ce49d9273d2b6defa20fab59e7087dd55611b587f54ec9ade77e971501bcf42a7aba591bfc1e21c118f89acd626cf43d300c465dc557f2eb50f01e9a6c23456610d7cc932654cf10b634dba8b84c8870284347c517630939093557f9c3fbc22309d3e0f7efb830ea76227b083916d1dd2af28e1246a121aee604f61919091557f3902c62920591d05fe33dfc1ed17a2e03f420b10b60fde30c7a925750ba1b1535562014c087fb2925a3dfcd73d885038ec62e54d0f653f8cb6ad6c1aef28e3f8d589420f769155612ee07fd4da45525b5231666d38b46b85110c25a747d4b24f0b8f0af140e43c699dc9e655610bb87f914e492f024dfff9a4ecd81e60bbff3cbc7e4967d6d453117de1830e60843cc055620111707faadb0fe37dc41b589d2bedb792d49d4db22a8da5366d8fabd8e9eb1ef5cebbd855614e207f348f258ed9e11b45156fb210d009b15e1bcffebc7130942dba1aaa921b74d75d556127107f60de8067a9abaa04637803c21accb88d531c34eca0d32e2c40e26ab1df15667d5561019d602081815260408051606080820183528582528184018681528284018881527f228719b3ab53201bbb41968c40b0b5cdf287f8c98ba3ec9532f722219a6d86ff8054808c018255908952935160029485027ff699062a39a3e0612cb6229cde40e8ae953b97ed69b6602abb2d6c056efc9df581019190915591517ff699062a39a3e0612cb6229cde40e8ae953b97ed69b6602abb2d6c056efc9df690920180549151928a1667ffffffffffffffff1992831617640100000000938b1684021790558686528451808401865288815280870189815260058288019081527f13dcb3c6205eccc5df5a4a7821d488c75d9d361908855b59d022fe13c7bb4f1d8054808f018255818d5293519388027ff136f0b91155d0d1b0095c010d99f25b7365178c4cbbfdaf819bc80e91ee9cc18181019590955592517ff136f0b91155d0d1b0095c010d99f25b7365178c4cbbfdaf819bc80e91ee9cc293840180549351918f1693871693909317908e1687021790915589895287519586018852678ac7230489e80000865260069886019889529685019c8d5286549b8c01875595895292519990930291820198909855925192909101805497518616909602961693169290921793909317909155908081526020808201929092526040908101600090812082516060810184526801a055690d9db800008152600b818601908152600f948201948552825460018181018555938552958420915160029096029091019485555193018054925163ffffffff9081166401000000000267ffffffffffffffff199094169416939093179190911790915561019d9080600281111561468d5761468d61561a565b81526020808201929092526040908101600090812082516060810184526802b5e3af16b18800008152601081860190815263ffffffff9482018581528354600181810186559486529685209251600290970290920195865551949091018054915184166401000000000267ffffffffffffffff19909216949093169390931792909217905562093a806101a855681043561a8829300000906101aa9080600281111561473b5761473b61561a565b815260200190815260200160002081905550681b1ae4d6e2ef5000006101aa60006001600281111561476f5761476f61561a565b60028111156147805761478061561a565b81526020808201929092526040908101600090812093909355620186a06101ac556202a3006101ad55600b6101a95561a8c07f1f08490867d20787c614d6a8d248b650951f47c2a9d7a476390914fda0bc6c69556201fa407f7cefccf88eab0cea29d7d15cd13c245902b3dcc86814f260912816d71a6ce8a6556203f4807f1d4adc0ca48a209577244d008debe427625a557439a06f307ca713d3b3ab7de85580516060810182526117708152610fa0818401526107d09181019190915260019092526101a79052614875907f150d818431632b18bbf6b7bf1dd883657e8309b2a3b94bec12602471deee700d906003614b49565b50604080516060810182526127108152611770602080830191909152610fa09282019290925260026000526101a79091526148d3907f3a823a964662b427f8903fd05da57d348a5f7ffa561b539c0bc588095f1fe835906003614b49565b50604080516060810182526136b08152611f4060208083019190915261177092820192909252600360008190526101a7909252614932917f1a8015dcb5cbb16f8b454f25f6ddaea2da1e1f49d4fa89209d81cfecc22c00c49190614b49565b508015611557576000805461ff001916905550565b600054610100900460ff166149625760005460ff1615614966565b303b155b6149825760405162461bcd60e51b8152600401610a6390615590565b600054610100900460ff161580156149a4576000805461ffff19166101011790555b6115456149d3565b600054610100900460ff166114de5760405162461bcd60e51b8152600401610a63906159c1565b600054610100900460ff166149ee5760005460ff16156149f2565b303b155b614a0e5760405162461bcd60e51b8152600401610a6390615590565b600054610100900460ff16158015614a30576000805461ffff19166101011790555b614a38614a48565b614a40614a77565b611545613778565b600054610100900460ff16614a6f5760405162461bcd60e51b8152600401610a63906159c1565b6114de614aa6565b600054610100900460ff16614a9e5760405162461bcd60e51b8152600401610a63906159c1565b6114de614ad6565b600054610100900460ff16614acd5760405162461bcd60e51b8152600401610a63906159c1565b6114de33612dd1565b600054610100900460ff16614afd5760405162461bcd60e51b8152600401610a63906159c1565b61012d805460ff19169055565b50805460008255906000526020600020908101906115579190614b8d565b50805460008255600202906000526020600020908101906115579190614ba2565b8260038101928215614b7d579160200282015b82811115614b7d578251829061ffff16905591602001919060010190614b5c565b50614b89929150614b8d565b5090565b5b80821115614b895760008155600101614b8e565b5b80821115614b89576000815560018101805467ffffffffffffffff19169055600201614ba3565b600060208284031215614bdc57600080fd5b81356001600160e01b031981168114612dca57600080fd5b600060208284031215614c0657600080fd5b5035919050565b60008060408385031215614c2057600080fd5b50508035926020909101359150565b6003811061155757600080fd5b60008060408385031215614c4f57600080fd5b8235614c5a81614c2f565b946020939093013593505050565b60008083601f840112614c7a57600080fd5b5081356001600160401b03811115614c9157600080fd5b6020830191508360208260051b8501011115612d9357600080fd5b60008060008060408587031215614cc257600080fd5b84356001600160401b0380821115614cd957600080fd5b614ce588838901614c68565b90965094506020870135915080821115614cfe57600080fd5b50614d0b87828801614c68565b95989497509550505050565b80356001600160a01b0381168114614d2e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715614d6b57614d6b614d33565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614d9957614d99614d33565b604052919050565b600082601f830112614db257600080fd5b81356001600160401b03811115614dcb57614dcb614d33565b614dde601f8201601f1916602001614d71565b818152846020838601011115614df357600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215614e2657600080fd5b614e2f85614d17565b9350614e3d60208601614d17565b92506040850135915060608501356001600160401b03811115614e5f57600080fd5b614e6b87828801614da1565b91505092959194509250565b600060208284031215614e8957600080fd5b612dca82614d17565b801515811461155757600080fd5b600060208284031215614eb257600080fd5b8135612dca81614e92565b600060208284031215614ecf57600080fd5b8135612dca81614c2f565b60008083601f840112614eec57600080fd5b5081356001600160401b03811115614f0357600080fd5b602083019150836020606083028501011115612d9357600080fd5b60008060008060008060608789031215614f3757600080fd5b86356001600160401b0380821115614f4e57600080fd5b614f5a8a838b01614c68565b90985096506020890135915080821115614f7357600080fd5b614f7f8a838b01614c68565b90965094506040890135915080821115614f9857600080fd5b50614fa589828a01614eda565b979a9699509497509295939492505050565b60008060208385031215614fca57600080fd5b82356001600160401b03811115614fe057600080fd5b614fec85828601614c68565b90969095509350505050565b6000806040838503121561500b57600080fd5b82359150602083013561501d81614e92565b809150509250929050565b600080600080600080600080610100898b03121561504557600080fd5b61504e89614d17565b975061505c60208a01614d17565b965061506a60408a01614d17565b955061507860608a01614d17565b945061508660808a01614d17565b935061509460a08a01614d17565b92506150a260c08a01614d17565b91506150b060e08a01614d17565b90509295985092959890939650565b600080600080600080606087890312156150d857600080fd5b86356001600160401b03808211156150ef57600080fd5b6150fb8a838b01614c68565b9098509650602089013591508082111561511457600080fd5b6151208a838b01614c68565b9096509450604089013591508082111561513957600080fd5b50614fa589828a01614c68565b6020808252825182820181905260009190848201906040850190845b8181101561517e57835183529284019291840191600101615162565b50909695505050505050565b6006811061155757600080fd5b6000806000606084860312156151ac57600080fd5b83356151b78161518a565b925060208401356151c781614c2f565b915060408401356151d78161518a565b809150509250925092565b600082601f8301126151f357600080fd5b813560206001600160401b0382111561520e5761520e614d33565b8160051b61521d828201614d71565b928352848101820192828101908785111561523757600080fd5b83870192505b848310156152565782358252918301919083019061523d565b979650505050505050565b600080600080600060a0868803121561527957600080fd5b61528286614d17565b945061529060208701614d17565b935060408601356001600160401b03808211156152ac57600080fd5b6152b889838a016151e2565b945060608801359150808211156152ce57600080fd5b6152da89838a016151e2565b935060808801359150808211156152f057600080fd5b506152fd88828901614da1565b9150509295509295909350565b600080600080600060a0868803121561532257600080fd5b61532b86614d17565b945061533960208701614d17565b9350604086013592506060860135915060808601356001600160401b0381111561536257600080fd5b6152fd88828901614da1565b6000806000806040858703121561538457600080fd5b84356001600160401b038082111561539b57600080fd5b6153a788838901614eda565b909650945060208701359150808211156153c057600080fd5b50614d0b87828801614eda565b63ffffffff8116811461155757600080fd5b600080600080600080600060e0888a0312156153fa57600080fd5b873596506020880135955060408801359450606088013561541a816153cd565b9350608088013561542a816153cd565b9699959850939692959460a0840135945060c09093013592915050565b60006020828403121561545957600080fd5b8151612dca81614e92565b60006020828403121561547657600080fd5b5051919050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156154e6576154e66154bd565b500190565b60006000198214156154ff576154ff6154bd565b5060010190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601290820152712737ba1030b236b4b71037b91037bbb732b960711b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60008160001904831182151516156155f8576155f86154bd565b500290565b60006020828403121561560f57600080fd5b8135612dca8161518a565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b60008261565557615655615630565b500490565b600181815b8085111561569557816000190482111561567b5761567b6154bd565b8085161561568857918102915b93841c939080029061565f565b509250929050565b6000826156ac575060016109eb565b816156b9575060006109eb565b81600181146156cf57600281146156d9576156f5565b60019150506109eb565b60ff8411156156ea576156ea6154bd565b50506001821b6109eb565b5060208310610133831016604e8410600b8410161715615718575081810a6109eb565b615722838361565a565b8060001904821115615736576157366154bd565b029392505050565b6000612dca60ff84168361569d565b81358155600181016020830135615763816153cd565b63ffffffff8116905081548163ffffffff1982161783556040850135615788816153cd565b67ffffffff000000008160201b16836001600160401b0319841617178455505050505050565b6000826157bd576157bd615630565b500690565b6000828210156157d4576157d46154bd565b500390565b8051614d2e8161518a565b805160ff81168114614d2e57600080fd5b600082601f83011261580657600080fd5b60405160c081018181106001600160401b038211171561582857615828614d33565b6040528060c084018581111561583d57600080fd5b845b8181101561585e57615850816157e4565b83526020928301920161583f565b509195945050505050565b6000610180828403121561587c57600080fd5b615884614d49565b825161588f81614c2f565b81526020830151600a81106158a357600080fd5b60208201526158b4604084016157d9565b60408201526158c5606084016157e4565b60608201526158d6608084016157e4565b60808201526158e88460a085016157f5565b60a0820152610160929092015160c083015250919050565b600063ffffffff8083168181141561591a5761591a6154bd565b6001019392505050565b6001600160a01b03871681526020810186905260c081016003861061594b5761594b61561a565b856040830152600a85106159615761596161561a565b846060830152600684106159775761597761561a565b608082019390935260a00152949350505050565b600063ffffffff8216806159a1576159a16154bd565b6000190192915050565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220f46895309a3a96dacefab463ca2cd5c57eebe4c9e4920d65fcf779db4390a7a164736f6c63430008090033

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