Contract 0x695EFd2568a673A6cCDa47C24E2Af2c2e7392A3a

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x09e1ef02a1d93309943fcf0dccbf2dabc2d38f77534e21bd3d271018fa0ebdf20x6080604049561302022-01-24 8:37:14115 days 18 hrs ago0xb013abd83f0bd173e9f14ce7d6e420ad711483b4 IN  Create: Pilgrimage0 ETH0.052840569207 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x292ed0eaf360ad9a695210ba9358be835729e5fe33edcb863228eda78d5cf0ec102724042022-04-21 17:00:5028 days 10 hrs ago 0x1020f21c49f97588c4582b0e31399e0649c07844 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x2e3183d39d124b2fed858431298f86e291f86b6317253ebc49b64a7da9f86eb6102483872022-04-21 9:29:4028 days 17 hrs ago 0x9fecf056375a973308bb3d6fb6b1c230cfd21456 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0xd3f868be7ee07f5371343834bcd0778b56ba9b766b6640c2b06cf22981020ddc101396802022-04-20 3:15:5630 days 5 mins ago 0x10db880ffb76a7f5e3b9cd1e14b379b08d29c447 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x9342f87c59ff6304fd1aa687b292e80ade03e8dbfde7d0c29619d4714f91acdf97663482022-04-14 0:59:1536 days 2 hrs ago Treasure DAO: Legions (Common) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x9342f87c59ff6304fd1aa687b292e80ade03e8dbfde7d0c29619d4714f91acdf97663482022-04-14 0:59:1536 days 2 hrs ago 0x0a2fac010be2e44aff96b6b58e5a35507122786b 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0xc0b2d48e70483b05228f46d717965aed359f9a562b0de356b0ab862d647e538e97573112022-04-13 19:38:1136 days 7 hrs ago 0x713b8c9f2713a07a43eda78b454beab9d9e96015 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0xf122e7b1304032bdad68e3203c34b7401a3c47e5428d84303bd437ce89ab2d2a97045422022-04-12 19:11:1937 days 8 hrs ago Treasure DAO: Legions (Genesis) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0xf122e7b1304032bdad68e3203c34b7401a3c47e5428d84303bd437ce89ab2d2a97045422022-04-12 19:11:1937 days 8 hrs ago 0x713b8c9f2713a07a43eda78b454beab9d9e96015 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x86d81a528cae422191702766df742dcc6f0a0f7d462bb1674b635cf879989e7094351422022-04-07 6:09:4842 days 21 hrs ago 0x71a2dd44fd3ea050f7131cc00e64cd530ee3bd0a 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x4390e650aa98346b7bbf5d3b133d6019812d91ac2e3165d48386f1b6fc86386494193172022-04-06 22:38:3143 days 4 hrs ago 0x9566e577d78a7b21d8c71e3220d8275fb835c1f3 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x8f8dadd7577ddb6cd5d11d15764ceb1a44cf4a50c04614404efc0413fa99e2d493748102022-04-06 3:39:3543 days 23 hrs ago 0xf526ba3e671f7f44c953892c1ef594f6f12d5986 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x649d3dff29041fbbfe2344f6c257358a4fd7fd01e8a607926c798d6dd1c82bd693584102022-04-05 19:59:1444 days 7 hrs ago Treasure DAO: Legions (Common) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x649d3dff29041fbbfe2344f6c257358a4fd7fd01e8a607926c798d6dd1c82bd693584102022-04-05 19:59:1444 days 7 hrs ago 0x9566e577d78a7b21d8c71e3220d8275fb835c1f3 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x4f58525a14e990ee51357af58fdb900123357507f91df100e3ac56d6544e734d93537402022-04-05 17:25:5044 days 9 hrs ago Treasure DAO: Legions (Common) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x4f58525a14e990ee51357af58fdb900123357507f91df100e3ac56d6544e734d93537402022-04-05 17:25:5044 days 9 hrs ago 0xadc8f4bd423e12ce815762f3d76ec574a22fda0d 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x4c3109ec421be3065fd07e9da9e835c032f8b674b5570f9148e821b0888b760d93533652022-04-05 17:14:5344 days 10 hrs ago Treasure DAO: Legions (Common) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x4c3109ec421be3065fd07e9da9e835c032f8b674b5570f9148e821b0888b760d93533652022-04-05 17:14:5344 days 10 hrs ago 0xd54a547961b4f1ab6a61639713787402694c9212 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x07278f049ef0f24654739990195281fc4b4f728f55df6ed3e7022ebae8f42c8993503852022-04-05 16:12:2244 days 11 hrs ago Treasure DAO: Legions (Common) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x07278f049ef0f24654739990195281fc4b4f728f55df6ed3e7022ebae8f42c8993503852022-04-05 16:12:2244 days 11 hrs ago 0x1020f21c49f97588c4582b0e31399e0649c07844 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0xcb1d347154d04e3cbfa283a0e2cd8ee6192ffa05864d5ae62c54e29f86e3884592377852022-04-03 12:40:3146 days 14 hrs ago Treasure DAO: Legions (Genesis) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0xcb1d347154d04e3cbfa283a0e2cd8ee6192ffa05864d5ae62c54e29f86e3884592377852022-04-03 12:40:3146 days 14 hrs ago 0xf526ba3e671f7f44c953892c1ef594f6f12d5986 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0xbd01bba4a528bfa2f1a4631ed47b33a7e68819a11f9b2f227072fa167fb10c4c92310392022-04-03 9:44:4646 days 17 hrs ago Treasure DAO: Legions (Genesis) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0xbd01bba4a528bfa2f1a4631ed47b33a7e68819a11f9b2f227072fa167fb10c4c92310392022-04-03 9:44:4646 days 17 hrs ago 0xf526ba3e671f7f44c953892c1ef594f6f12d5986 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x8127a403a08203b5d79f0a0510cc3f8d15667fa525b8b002d7007cadb4e59c9c92310182022-04-03 9:44:1646 days 17 hrs ago Treasure DAO: Legions (Genesis) 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
0x8127a403a08203b5d79f0a0510cc3f8d15667fa525b8b002d7007cadb4e59c9c92310182022-04-03 9:44:1646 days 17 hrs ago 0xf526ba3e671f7f44c953892c1ef594f6f12d5986 0x695efd2568a673a6ccda47c24e2af2c2e7392a3a0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Pilgrimage

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 27 : Pilgrimage.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

import "./PilgrimageTimeKeeper.sol";

contract Pilgrimage is Initializable, PilgrimageTimeKeeper {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function initialize() external initializer {
        PilgrimageTimeKeeper.__PilgrimageTimeKeeper_init();
    }

    function embarkOnPilgrimages(
        uint256[] calldata _ids,
        uint256[] calldata _amounts,
        LegionGeneration _generation)
    external
    nonZeroLength(_ids)
    lengthsAreEqual(_ids, _amounts)
    contractsAreSet
    onlyEOA
    whenNotPaused
    {
        uint256 _totalPilgrimages = 0;
        for(uint256 i = 0; i < _amounts.length; i++) {
            _totalPilgrimages += _amounts[i];
        }

        uint256[] memory _pilgrimageIds = new uint256[](_totalPilgrimages);
        uint256 _pilgrimageIdIndex = 0;

        for(uint256 i = 0; i < _ids.length; i++) {
            require(legion1155Ids.contains(_ids[i]), "No rarity found for legion ID");
            require(_amounts[i] > 0, "Bad legion amount.");

            for(uint256 j = 0; j < _amounts[i]; j++) {
                // Sends a single legion on a pilgrimage
                uint256 _pilgrimageId = _embarkOnPilgrimage(_ids[i], _generation);
                _pilgrimageIds[_pilgrimageIdIndex] = _pilgrimageId;
                _pilgrimageIdIndex++;
            }
        }

        address _legionContractAddress;

        // If not approved, this will revert. When possible state changes should be done before calling an external contract.
        if(_generation == LegionGeneration.GENESIS) {
            _legionContractAddress = address(legionGenesis1155);
            legionGenesis1155.safeBatchTransferFrom(msg.sender, address(this), _ids, _amounts, "");
        } else {
            _legionContractAddress = address(legion1155);
            legion1155.safeBatchTransferFrom(msg.sender, address(this), _ids, _amounts, "");
        }

        emit PilgrimagesStarted(msg.sender, _legionContractAddress, block.timestamp + pilgrimageLength, _ids, _amounts, _pilgrimageIds);
    }

    function _embarkOnPilgrimage(uint256 _id, LegionGeneration _generation) private returns(uint256) {
        uint256 _pilgrimageID = pilgrimageID;
        pilgrimageID++;

        pilgrimageIdToRarity[_pilgrimageID] = legionIdToRarity[_id];
        pilgrimageIdToClass[_pilgrimageID] = legionIdToClass[_id];
        pilgrimageIdToGeneration[_pilgrimageID] = _generation;
        pilgrimageIdToChanceConstellationUnlocked[_pilgrimageID] = legionIdToChanceConstellationUnlocked[_id];
        pilgrimageIdToNumberConstellationUnlocked[_pilgrimageID] = legionIdToNumberConstellationUnlocked[_id];
        pilgrimageIdToOldId[_pilgrimageID] = _id;

        _setPilgrimageStartTime(_pilgrimageID);

        uint256 _randomRequestID = randomizer.requestRandomNumber();
        pilgrimageIdToRequestId[_pilgrimageID] = _randomRequestID;

        // Add this pilgrimage to the user.
        userToPilgrimagesInProgress[msg.sender].add(_pilgrimageID);

        return _pilgrimageID;
    }

    function returnTokensFromPilgrimages(
        uint256[] calldata _pilgrimageIds)
    external
    onlyEOA
    nonZeroLength(_pilgrimageIds)
    contractsAreSet
    whenNotPaused
    {
        for(uint256 i = 0; i < _pilgrimageIds.length; i++) {
            require(userToPilgrimagesInProgress[msg.sender].contains(_pilgrimageIds[i]), "Pilg does not belong to user");
        }

        _returnFromPilgrimages(_pilgrimageIds);
    }

    function returnFromPilgrimages()
    external
    onlyEOA
    contractsAreSet
    whenNotPaused {

        uint256[] memory _inProgressPilgrimages = userToPilgrimagesInProgress[msg.sender].values();

        _returnFromPilgrimages(_inProgressPilgrimages);
    }

    function _returnFromPilgrimages(uint256[] memory _inProgressPilgrimages) private {
        uint256[] memory _minted721s = new uint256[](_inProgressPilgrimages.length);
        uint256 _minted721sIndex = 0;

        uint256[] memory _finishedPilgrimages = new uint256[](_inProgressPilgrimages.length);
        uint256 _finishedPilgrimagesIndex = 0;

        for(uint256 i = 0; i < _inProgressPilgrimages.length; i++) {
            uint256 _pilgrimageId = _inProgressPilgrimages[i];

            uint256 _tokenId721 = _returnFromPilgrimage(_pilgrimageId);
            if(_tokenId721 != 0) {
                _minted721s[_minted721sIndex] = _tokenId721;
                _minted721sIndex++;
                _finishedPilgrimages[_finishedPilgrimagesIndex] = _pilgrimageId;
                _finishedPilgrimagesIndex++;
                userToPilgrimagesInProgress[msg.sender].remove(_pilgrimageId);
            }
        }

        if(_minted721sIndex > 0) {
            emit PilgrimagesFinished(msg.sender, _minted721s, _finishedPilgrimages);
        } else {
            emit NoPilgrimagesToFinish(msg.sender);
        }
    }

    // Returns the token id of the newly minted 721 if the pilgrimage is ready.
    function _returnFromPilgrimage(uint256 _pilgrimageID) private returns(uint256) {
        if(!isPilgrimageReady(_pilgrimageID)) {
            return 0;
        }

        LegionRarity _rarity = pilgrimageIdToRarity[_pilgrimageID];
        LegionClass _class = pilgrimageIdToClass[_pilgrimageID];
        uint256 _oldId = pilgrimageIdToOldId[_pilgrimageID];

        uint256 _requestId = pilgrimageIdToRequestId[_pilgrimageID];

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

        uint256 _randomNumber = randomizer.revealRandomNumber(_requestId);

        // Commmon legions need to be assigned a new class.
        if(_rarity == LegionRarity.COMMON) {
            // There are 6 enum values, but the first is None. We want the result to be between 1 and 5.
            _class = LegionClass((_randomNumber % 5) + 1);
        }

        uint256 _tokenId = legion.safeMint(msg.sender);

        legionMetadataStore.setInitialMetadataForLegion(msg.sender, _tokenId, pilgrimageIdToGeneration[_pilgrimageID], _class, _rarity, _oldId);

        uint256 _chance = pilgrimageIdToChanceConstellationUnlocked[_pilgrimageID];
        uint8 _numberToUnlock = 0;

        if(_chance == 100000) {
            _numberToUnlock = pilgrimageIdToNumberConstellationUnlocked[_pilgrimageID];
        } else {
            _randomNumber = uint256(keccak256(abi.encode(_randomNumber, _randomNumber)));

            if(_randomNumber % 100000 < _chance) {
                _numberToUnlock = pilgrimageIdToNumberConstellationUnlocked[_pilgrimageID];
            }
        }

        if(_numberToUnlock > 0) {
            starlightTemple.maxRankOfConstellations(_tokenId, _numberToUnlock);
        }

        return _tokenId;
    }
}

File 2 of 27 : CountersUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library CountersUpgradeable {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

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

File 4 of 27 : PilgrimageTimeKeeper.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 "./Pilgrimage1155Mapping.sol";

abstract contract PilgrimageTimeKeeper is Initializable, Pilgrimage1155Mapping {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function __PilgrimageTimeKeeper_init() internal initializer {
        Pilgrimage1155Mapping.__Pilgrimage1155Mapping_init();
    }

    function _setPilgrimageStartTime(uint256 _pilgrimageID) internal {
        pilgrimageIdToStartTime[_pilgrimageID] = block.timestamp;
    }

    function isPilgrimageReady(uint256 _pilgrimageID) public view returns(bool) {
        return block.timestamp >= pilgrimageIdToStartTime[_pilgrimageID] + pilgrimageLength;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 6 of 27 : 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 7 of 27 : Pilgrimage1155Mapping.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/ERC1155/utils/ERC1155ReceiverUpgradeable.sol";

import "./PilgrimageContracts.sol";

abstract contract Pilgrimage1155Mapping is Initializable, ERC1155ReceiverUpgradeable, PilgrimageContracts {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    function __Pilgrimage1155Mapping_init() internal initializer {
        PilgrimageContracts.__PilgrimageContracts_init();
        ERC1155ReceiverUpgradeable.__ERC1155Receiver_init();
    }

    function setPilgrimageLength(uint256 _pilgrimageLength) external onlyAdminOrOwner {
        pilgrimageLength = _pilgrimageLength;
    }

    function setMetadataForIds(
        uint256[] calldata _ids,
        LegionRarity[] calldata _rarities,
        LegionClass[] calldata _classes,
        uint256[] calldata _constellationOdds,
        uint8[] calldata _constellationNumber)
    external
    onlyAdminOrOwner
    nonZeroLength(_ids)
    {
        require(_ids.length == _rarities.length
            && _rarities.length == _classes.length
            && _classes.length == _constellationOdds.length
            && _constellationOdds.length == _constellationNumber.length, "Bad lengths");

        for(uint256 i = 0; i < _ids.length; i++) {
            if(!legion1155Ids.contains(_ids[i])) {
                legion1155Ids.add(_ids[i]);
            }

            legionIdToRarity[_ids[i]] = _rarities[i];
            legionIdToClass[_ids[i]] = _classes[i];
            legionIdToChanceConstellationUnlocked[_ids[i]] = _constellationOdds[i];
            legionIdToNumberConstellationUnlocked[_ids[i]] = _constellationNumber[i];
        }
    }

    function removeMetadataForIds(uint256[] calldata _ids) external override onlyAdminOrOwner {
        for(uint256 i = 0; i < _ids.length; i++) {
            if(legion1155Ids.contains(_ids[i])) {
                legion1155Ids.remove(_ids[i]);
            }

            delete legionIdToRarity[_ids[i]];
            delete legionIdToClass[_ids[i]];
            delete legionIdToChanceConstellationUnlocked[_ids[i]];
            delete legionIdToNumberConstellationUnlocked[_ids[i]];
        }
    }

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

import "./PilgrimageState.sol";

abstract contract PilgrimageContracts is Initializable, PilgrimageState {

    function __PilgrimageContracts_init() internal initializer {
        PilgrimageState.__PilgrimageState_init();
    }

    function setContracts(
        address _randomizerAddress,
        address _legionAddress,
        address _legionMetadataStoreAddress,
        address _legion1155Address,
        address _legionGensis1155Address,
        address _starlightTempleAddress)
    external onlyAdminOrOwner
    {
        randomizer = IRandomizer(_randomizerAddress);
        legion = ILegion(_legionAddress);
        legionMetadataStore = ILegionMetadataStore(_legionMetadataStoreAddress);
        legion1155 = ILegion1155(_legion1155Address);
        legionGenesis1155 = ILegion1155(_legionGensis1155Address);
        starlightTemple = IStarlightTemple(_starlightTempleAddress);
    }

    modifier contractsAreSet() {
        require(address(randomizer) != address(0)
            && address(legion) != address(0)
            && address(legion1155) != address(0)
            && address(legionGenesis1155) != address(0)
            && address(starlightTemple) != address(0)
            && address(legionMetadataStore) != address(0), "Contracts aren't set");

        _;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

File 12 of 27 : 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 13 of 27 : PilgrimageState.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 "../../shared/randomizer/IRandomizer.sol";
import "../../shared/AdminableUpgradeable.sol";
import "./IPilgrimage.sol";
import "../legion/ILegion.sol";
import "../legionmetadatastore/ILegionMetadataStore.sol";
import "../starlighttemple/IStarlightTemple.sol";
import "../external/ILegion1155.sol";

abstract contract PilgrimageState is Initializable, IPilgrimage, AdminableUpgradeable {

    event PilgrimagesStarted(
        address indexed _user,
        address indexed _legionContract,
        uint256 indexed _finishTime,
        uint256[] _ids1155,
        uint256[] _amounts1155,
        uint256[] _pilgrimageIds);
    event NoPilgrimagesToFinish(address indexed _user);
    event PilgrimagesFinished(address indexed _user, uint256[] _tokenIds, uint256[] _finishedPilgrimageIds);

    IRandomizer public randomizer;
    ILegion public legion;
    ILegionMetadataStore public legionMetadataStore;
    ILegion1155 public legion1155;
    ILegion1155 public legionGenesis1155;
    IStarlightTemple public starlightTemple;

    EnumerableSetUpgradeable.UintSet internal legion1155Ids;
    // The 1155 id of the legion to the rarity it will map to.
    mapping(uint256 => LegionRarity) public legionIdToRarity;
    mapping(uint256 => LegionClass) public legionIdToClass;
    mapping(uint256 => uint256) public legionIdToChanceConstellationUnlocked;
    mapping(uint256 => uint8) public legionIdToNumberConstellationUnlocked;

    // Represents a single pilgrimage by 1 legion1155 id with an amount of 1.
    uint256 public pilgrimageID;
    mapping(address => EnumerableSetUpgradeable.UintSet) internal userToPilgrimagesInProgress;

    mapping(uint256 => uint256) public pilgrimageIdToStartTime;
    mapping(uint256 => LegionRarity) public pilgrimageIdToRarity;
    mapping(uint256 => LegionClass) public pilgrimageIdToClass;
    mapping(uint256 => LegionGeneration) public pilgrimageIdToGeneration;
    mapping(uint256 => uint256) public pilgrimageIdToOldId;
    // Pilgrimage ID -> Random number request ID.
    mapping(uint256 => uint256) public pilgrimageIdToRequestId;
    mapping(uint256 => uint256) public pilgrimageIdToChanceConstellationUnlocked;
    mapping(uint256 => uint8) public pilgrimageIdToNumberConstellationUnlocked;

    uint256 public pilgrimageLength;

    function __PilgrimageState_init() internal initializer {
        AdminableUpgradeable.__Adminable_init();
        pilgrimageID = 1;
        pilgrimageLength = 1 days;
    }
}

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

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

interface IPilgrimage {

    // Removes the given ids as valid ids and removes the mapped rarity as well.
    // Admin only.
    function removeMetadataForIds(uint256[] calldata _ids) external;

    // Returns if the pilgrimage is ready to be completed for the given ID.
    function isPilgrimageReady(uint256 _pilgrimageID) external view returns(bool);

    // Sends the legion 1155s with the given Ids and amounts on the pilgrimage. The legions must be approved before calling this contract.
    function embarkOnPilgrimages(uint256[] calldata _ids, uint256[] calldata _amounts, LegionGeneration _generation) external;

    // Will collect any legions that have finished their pilgrimages and send the newly minted 721 token to the caller.
    // If there are none, or the pilgrimages aren't ready, this will send an event.
    function returnFromPilgrimages() external;
}

File 17 of 27 : 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 18 of 27 : 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 19 of 27 : 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 20 of 27 : ILegion1155.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

File 21 of 27 : 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 22 of 27 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

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

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

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

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

File 25 of 27 : 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 26 of 27 : 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 27 of 27 : 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;
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"}],"name":"NoPilgrimagesToFinish","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":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_finishedPilgrimageIds","type":"uint256[]"}],"name":"PilgrimagesFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_user","type":"address"},{"indexed":true,"internalType":"address","name":"_legionContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"_finishTime","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"_ids1155","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts1155","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_pilgrimageIds","type":"uint256[]"}],"name":"PilgrimagesStarted","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":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"enum LegionGeneration","name":"_generation","type":"uint8"}],"name":"embarkOnPilgrimages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pilgrimageID","type":"uint256"}],"name":"isPilgrimageReady","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":"legion1155","outputs":[{"internalType":"contract ILegion1155","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legionGenesis1155","outputs":[{"internalType":"contract ILegion1155","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"legionIdToChanceConstellationUnlocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"legionIdToClass","outputs":[{"internalType":"enum LegionClass","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"legionIdToNumberConstellationUnlocked","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"legionIdToRarity","outputs":[{"internalType":"enum LegionRarity","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"legionMetadataStore","outputs":[{"internalType":"contract ILegionMetadataStore","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":"pure","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":"pure","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":"pilgrimageID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pilgrimageIdToChanceConstellationUnlocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pilgrimageIdToClass","outputs":[{"internalType":"enum LegionClass","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pilgrimageIdToGeneration","outputs":[{"internalType":"enum LegionGeneration","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pilgrimageIdToNumberConstellationUnlocked","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pilgrimageIdToOldId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pilgrimageIdToRarity","outputs":[{"internalType":"enum LegionRarity","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pilgrimageIdToRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pilgrimageIdToStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pilgrimageLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomizer","outputs":[{"internalType":"contract IRandomizer","name":"","type":"address"}],"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":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"removeMetadataForIds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"returnFromPilgrimages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_pilgrimageIds","type":"uint256[]"}],"name":"returnTokensFromPilgrimages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_randomizerAddress","type":"address"},{"internalType":"address","name":"_legionAddress","type":"address"},{"internalType":"address","name":"_legionMetadataStoreAddress","type":"address"},{"internalType":"address","name":"_legion1155Address","type":"address"},{"internalType":"address","name":"_legionGensis1155Address","type":"address"},{"internalType":"address","name":"_starlightTempleAddress","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"enum LegionRarity[]","name":"_rarities","type":"uint8[]"},{"internalType":"enum LegionClass[]","name":"_classes","type":"uint8[]"},{"internalType":"uint256[]","name":"_constellationOdds","type":"uint256[]"},{"internalType":"uint8[]","name":"_constellationNumber","type":"uint8[]"}],"name":"setMetadataForIds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_shouldPause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pilgrimageLength","type":"uint256"}],"name":"setPilgrimageLength","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"starlightTemple","outputs":[{"internalType":"contract IStarlightTemple","name":"","type":"address"}],"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":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50613156806100206000396000f3fe608060405234801561001057600080fd5b506004361061025e5760003560e01c806381e9ab6b11610146578063b529139c116100c3578063cd9ca78611610087578063cd9ca78614610643578063d3ee9b2e14610657578063f043958c1461067b578063f10fb58414610683578063f23a6e6114610697578063f2fde38b146106b657600080fd5b8063b529139c146105a7578063baceec83146105b1578063bc197c81146105d5578063bedb86fb1461060f578063c5aba1771461062257600080fd5b8063a251394b1161010a578063a251394b1461050b578063a3b8c7791461052f578063b16ecb2e14610542578063b1c23b3014610555578063b387b77f1461057657600080fd5b806381e9ab6b146104815780638a7bf804146104b25780638da5cb5b146104c657806399daafd2146104d75780639c54df64146104f857600080fd5b80633a96d933116101df5780636f8c67f5116101a35780636f8c67f514610417578063704802751461042a578063715018a61461043d57806376ccb489146104455780637d7913e5146104665780638129fc1c1461047957600080fd5b80633a96d9331461038757806352b1fd1e146103bd5780635c975abb146103ee5780635d2c2bd5146103f9578063675857eb1461040357600080fd5b806321e1f1b61161022657806321e1f1b61461030e5780632463a55a1461032157806324d7806c14610334578063377e11e0146103605780633a42ea2d1461037357600080fd5b806301ffc9a7146102635780631785f53c1461028b57806318681ae3146102a057806320bf8a32146102cf578063214bd6eb146102fb575b600080fd5b610276610271366004612748565b6106c9565b60405190151581526020015b60405180910390f35b61029e61029936600461278e565b610700565b005b6102c16102ae3660046127a9565b6101406020526000908152604090205481565b604051908152602001610282565b610132546102e3906001600160a01b031681565b6040516001600160a01b039091168152602001610282565b6102766103093660046127a9565b610754565b61029e61031c3660046127a9565b61077c565b61029e61032f3660046127c2565b6107bf565b61027661034236600461278e565b6001600160a01b0316600090815260fb602052604090205460ff1690565b61029e61036e366004612882565b610871565b610131546102e3906001600160a01b031681565b6103ab6103953660046127a9565b6101396020526000908152604090205460ff1681565b60405160ff9091168152602001610282565b6103e16103cb3660046127a9565b61013f6020526000908152604090205460ff1681565b60405161028291906128ee565b60c95460ff16610276565b6102c16101445481565b61012f546102e3906001600160a01b031681565b61029e610425366004612882565b610912565b61029e61043836600461278e565b610b21565b61029e610b6f565b6102c16104533660046127a9565b6101426020526000908152604090205481565b61029e610474366004612882565b610ba5565b61029e610d40565b6104a561048f3660046127a9565b61013d6020526000908152604090205460ff1681565b604051610282919061290c565b610130546102e3906001600160a01b031681565b6097546001600160a01b03166102e3565b6102c16104e53660046127a9565b6101386020526000908152604090205481565b61029e610506366004612882565b610dba565b6103ab6105193660046127a9565b6101436020526000908152604090205460ff1681565b61029e61053d36600461291a565b610e56565b61029e6105503660046129a2565b6113e4565b6102c16105633660046127a9565b6101416020526000908152604090205481565b61059a6105843660046127a9565b61013e6020526000908152604090205460ff1681565b6040516102829190612aa3565b6102c161013a5481565b6104a56105bf3660046127a9565b6101366020526000908152604090205460ff1681565b6105f66105e3366004612b54565b63bc197c8160e01b979650505050505050565b6040516001600160e01b03199091168152602001610282565b61029e61061d366004612c17565b6116e8565b6102c16106303660046127a9565b61013c6020526000908152604090205481565b610133546102e3906001600160a01b031681565b61059a6106653660046127a9565b6101376020526000908152604090205460ff1681565b61029e61173b565b61012e546102e3906001600160a01b031681565b6105f66106a5366004612c34565b63f23a6e6160e01b95945050505050565b61029e6106c436600461278e565b61183f565b60006001600160e01b03198216630271189760e51b14806106fa57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6097546001600160a01b031633146107335760405162461bcd60e51b815260040161072a90612ca6565b60405180910390fd5b6001600160a01b0316600090815260fb60205260409020805460ff19169055565b61014454600082815261013c6020526040812054909161077391612cf1565b42101592915050565b33600090815260fb602052604090205460ff168061079d575061079d6118d7565b6107b95760405162461bcd60e51b815260040161072a90612d09565b61014455565b33600090815260fb602052604090205460ff16806107e057506107e06118d7565b6107fc5760405162461bcd60e51b815260040161072a90612d09565b61012e80546001600160a01b03199081166001600160a01b039889161790915561012f8054821696881696909617909555610130805486169487169490941790935561013180548516928616929092179091556101328054841691851691909117905561013380549092169216919091179055565b6097546001600160a01b0316331461089b5760405162461bcd60e51b815260040161072a90612ca6565b60005b8181101561090d57600060fb60008585858181106108be576108be612d35565b90506020020160208101906108d3919061278e565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061090581612d4b565b91505061089e565b505050565b3332146109315760405162461bcd60e51b815260040161072a90612d66565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061098690505760405162461bcd60e51b815260040161072a90612d8c565b61012e546001600160a01b0316158015906109ac575061012f546001600160a01b031615155b80156109c35750610131546001600160a01b031615155b80156109da5750610132546001600160a01b031615155b80156109f15750610133546001600160a01b031615155b8015610a085750610130546001600160a01b031615155b610a245760405162461bcd60e51b815260040161072a90612db1565b60c95460ff1615610a475760405162461bcd60e51b815260040161072a90612ddf565b60005b82811015610ae457610a86848483818110610a6757610a67612d35565b33600090815261013b60209081526040909120939102013590506118fb565b610ad25760405162461bcd60e51b815260206004820152601c60248201527f50696c6720646f6573206e6f742062656c6f6e6720746f207573657200000000604482015260640161072a565b80610adc81612d4b565b915050610a4a565b5061090d83838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061191692505050565b6097546001600160a01b03163314610b4b5760405162461bcd60e51b815260040161072a90612ca6565b6001600160a01b0316600090815260fb60205260409020805460ff19166001179055565b6097546001600160a01b03163314610b995760405162461bcd60e51b815260040161072a90612ca6565b610ba36000611aef565b565b33600090815260fb602052604090205460ff1680610bc65750610bc66118d7565b610be25760405162461bcd60e51b815260040161072a90612d09565b60005b8181101561090d57610c1a838383818110610c0257610c02612d35565b905060200201356101346118fb90919063ffffffff16565b15610c4e57610c4c838383818110610c3457610c34612d35565b90506020020135610134611b4190919063ffffffff16565b505b6101366000848484818110610c6557610c65612d35565b90506020020135815260200190815260200160002060006101000a81549060ff02191690556101376000848484818110610ca157610ca1612d35565b90506020020135815260200190815260200160002060006101000a81549060ff02191690556101386000848484818110610cdd57610cdd612d35565b905060200201358152602001908152602001600020600090556101396000848484818110610d0d57610d0d612d35565b60209081029290920135835250810191909152604001600020805460ff1916905580610d3881612d4b565b915050610be5565b600054610100900460ff16610d5b5760005460ff1615610d5f565b303b155b610d7b5760405162461bcd60e51b815260040161072a90612e09565b600054610100900460ff16158015610d9d576000805461ffff19166101011790555b610da5611b4d565b8015610db7576000805461ff00191690555b50565b6097546001600160a01b03163314610de45760405162461bcd60e51b815260040161072a90612ca6565b60005b8181101561090d57600160fb6000858585818110610e0757610e07612d35565b9050602002016020810190610e1c919061278e565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610e4e81612d4b565b915050610de7565b84848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050825115159150610eab90505760405162461bcd60e51b815260040161072a90612d8c565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040805160208089028281018201909352888252909350889250879182918501908490808284376000920191909152505082518451149150610f5490505760405162461bcd60e51b815260206004820152600f60248201526e556e657175616c206c656e6774687360881b604482015260640161072a565b61012e546001600160a01b031615801590610f7a575061012f546001600160a01b031615155b8015610f915750610131546001600160a01b031615155b8015610fa85750610132546001600160a01b031615155b8015610fbf5750610133546001600160a01b031615155b8015610fd65750610130546001600160a01b031615155b610ff25760405162461bcd60e51b815260040161072a90612db1565b3332146110115760405162461bcd60e51b815260040161072a90612d66565b60c95460ff16156110345760405162461bcd60e51b815260040161072a90612ddf565b6000805b868110156110785787878281811061105257611052612d35565b90506020020135826110649190612cf1565b91508061107081612d4b565b915050611038565b5060008167ffffffffffffffff81111561109457611094612ab1565b6040519080825280602002602001820160405280156110bd578160200160208202803683370190505b5090506000805b8a811015611225576110e18c8c83818110610c0257610c02612d35565b61112d5760405162461bcd60e51b815260206004820152601d60248201527f4e6f2072617269747920666f756e6420666f72206c6567696f6e204944000000604482015260640161072a565b60008a8a8381811061114157611141612d35565b905060200201351161118a5760405162461bcd60e51b81526020600482015260126024820152712130b2103632b3b4b7b71030b6b7bab73a1760711b604482015260640161072a565b60005b8a8a8381811061119f5761119f612d35565b905060200201358110156112125760006111d18e8e858181106111c4576111c4612d35565b905060200201358b611bb2565b9050808585815181106111e6576111e6612d35565b6020908102919091010152836111fb81612d4b565b94505050808061120a90612d4b565b91505061118d565b508061121d81612d4b565b9150506110c4565b5060008088600281111561123b5761123b6128c4565b14156112dd5761013260009054906101000a90046001600160a01b0316905061013260009054906101000a90046001600160a01b03166001600160a01b0316632eb2c2d633308f8f8f8f6040518763ffffffff1660e01b81526004016112a696959493929190612e8d565b600060405180830381600087803b1580156112c057600080fd5b505af11580156112d4573d6000803e3d6000fd5b50505050611375565b61013160009054906101000a90046001600160a01b0316905061013160009054906101000a90046001600160a01b03166001600160a01b0316632eb2c2d633308f8f8f8f6040518763ffffffff1660e01b815260040161134296959493929190612e8d565b600060405180830381600087803b15801561135c57600080fd5b505af1158015611370573d6000803e3d6000fd5b505050505b610144546113839042612cf1565b816001600160a01b0316336001600160a01b03167f2faddcf5955ab2f6035d1ca8607d3ecbfb66bd0978172c9f054efa84959136c78f8f8f8f8a6040516113ce959493929190612f27565b60405180910390a4505050505050505050505050565b33600090815260fb602052604090205460ff168061140557506114056118d7565b6114215760405162461bcd60e51b815260040161072a90612d09565b8989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061147690505760405162461bcd60e51b815260040161072a90612d8c565b898814801561148457508786145b801561148f57508584145b801561149a57508382145b6114d45760405162461bcd60e51b815260206004820152600b60248201526a426164206c656e6774687360a81b604482015260640161072a565b60005b8a8110156116da576114f48c8c83818110610c0257610c02612d35565b611527576115258c8c8381811061150d5761150d612d35565b90506020020135610134611d9090919063ffffffff16565b505b89898281811061153957611539612d35565b905060200201602081019061154e9190612f6e565b61013660008e8e8581811061156557611565612d35565b60209081029290920135835250810191909152604001600020805460ff19166001836005811115611598576115986128c4565b02179055508787828181106115af576115af612d35565b90506020020160208101906115c49190612f8f565b61013760008e8e858181106115db576115db612d35565b60209081029290920135835250810191909152604001600020805460ff1916600183600981111561160e5761160e6128c4565b021790555085858281811061162557611625612d35565b9050602002013561013860008e8e8581811061164357611643612d35565b9050602002013581526020019081526020016000208190555083838281811061166e5761166e612d35565b90506020020160208101906116839190612fb0565b61013960008e8e8581811061169a5761169a612d35565b90506020020135815260200190815260200160002060006101000a81548160ff021916908360ff16021790555080806116d290612d4b565b9150506114d7565b505050505050505050505050565b33600090815260fb602052604090205460ff168061170957506117096118d7565b6117255760405162461bcd60e51b815260040161072a90612d09565b801561173357610db7611d9c565b610db7611e11565b33321461175a5760405162461bcd60e51b815260040161072a90612d66565b61012e546001600160a01b031615801590611780575061012f546001600160a01b031615155b80156117975750610131546001600160a01b031615155b80156117ae5750610132546001600160a01b031615155b80156117c55750610133546001600160a01b031615155b80156117dc5750610130546001600160a01b031615155b6117f85760405162461bcd60e51b815260040161072a90612db1565b60c95460ff161561181b5760405162461bcd60e51b815260040161072a90612ddf565b33600090815261013b6020526040812061183490611e8b565b9050610db781611916565b6097546001600160a01b031633146118695760405162461bcd60e51b815260040161072a90612ca6565b6001600160a01b0381166118ce5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161072a565b610db781611aef565b6000336118ec6097546001600160a01b031690565b6001600160a01b031614905090565b600081815260018301602052604081205415155b9392505050565b6000815167ffffffffffffffff81111561193257611932612ab1565b60405190808252806020026020018201604052801561195b578160200160208202803683370190505b509050600080835167ffffffffffffffff81111561197b5761197b612ab1565b6040519080825280602002602001820160405280156119a4578160200160208202803683370190505b5090506000805b8551811015611a6d5760008682815181106119c8576119c8612d35565b6020026020010151905060006119dd82611e98565b90508015611a5857808787815181106119f8576119f8612d35565b602090810291909101015285611a0d81612d4b565b96505081858581518110611a2357611a23612d35565b602090810291909101015283611a3881612d4b565b33600090815261013b60205260409020909550611a56915083611b41565b505b50508080611a6590612d4b565b9150506119ab565b508215611abc57336001600160a01b03167fa7894a24bc9730f17af826c0250fd96e213893b3291ec9a7b9393117834713558584604051611aaf929190612fd3565b60405180910390a2611ae8565b60405133907f2dab1bc21ff4364419242bc9bdd4264ad166603c9c92b7dfe861b568119d7cf090600090a25b5050505050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061190f838361224d565b600054610100900460ff16611b685760005460ff1615611b6c565b303b155b611b885760405162461bcd60e51b815260040161072a90612e09565b600054610100900460ff16158015611baa576000805461ffff19166101011790555b610da5612340565b61013a8054600091819083611bc683612d4b565b90915550506000848152610136602090815260408083205484845261013d909252909120805460ff9092169160ff19166001836005811115611c0a57611c0a6128c4565b02179055506000848152610137602090815260408083205484845261013e909252909120805460ff9092169160ff19166001836009811115611c4e57611c4e6128c4565b0217905550600081815261013f60205260409020805484919060ff19166001836002811115611c7f57611c7f6128c4565b0217905550600084815261013860209081526040808320548484526101428352818420558683526101398252808320548484526101438352818420805460ff191660ff909216919091179055610140825280832087905561013c825280832042905561012e54815163433c53d960e11b815291516001600160a01b0390911692638678a7b2926004808201939182900301818787803b158015611d2157600080fd5b505af1158015611d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d599190613001565b60008381526101416020908152604080832084905533835261013b9091529020909150611d869083611d90565b5090949350505050565b600061190f83836123ad565b60c95460ff1615611dbf5760405162461bcd60e51b815260040161072a90612ddf565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611df43390565b6040516001600160a01b03909116815260200160405180910390a1565b60c95460ff16611e5a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161072a565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611df4565b6060600061190f836123fc565b6000611ea382610754565b611eaf57506000919050565b600082815261013d602090815260408083205461013e835281842054610140845282852054610141909452938290205461012e54925163f030210760e01b81526004810182905260ff9283169592909216939290916001600160a01b039091169063f03021079060240160206040518083038186803b158015611f3157600080fd5b505afa158015611f45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f69919061301a565b611f795750600095945050505050565b61012e54604051634ad30a7560e01b8152600481018390526000916001600160a01b031690634ad30a759060240160206040518083038186803b158015611fbf57600080fd5b505afa158015611fd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff79190613001565b9050600485600581111561200d5761200d6128c4565b141561203d5761201e600582613037565b612029906001612cf1565b600981111561203a5761203a6128c4565b93505b61012f546040516340d097c360e01b81523360048201526000916001600160a01b0316906340d097c390602401602060405180830381600087803b15801561208457600080fd5b505af1158015612098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bc9190613001565b6101305460008a815261013f6020526040908190205490516307d1b76f60e41b81529293506001600160a01b0390911691637d1b76f09161210f913391869160ff909116908b908d908c90600401613059565b600060405180830381600087803b15801561212957600080fd5b505af115801561213d573d6000803e3d6000fd5b505050600089815261014260205260408120549150620186a082141561217657506000898152610143602052604090205460ff166121cd565b604080516020810186905290810185905260600160408051601f1981840301815291905280516020909101209350816121b2620186a086613037565b10156121cd57506000898152610143602052604090205460ff165b60ff81161561223f5761013354604051630a011e1160e11b81526004810185905260ff831660248201526001600160a01b03909116906314023c2290604401600060405180830381600087803b15801561222657600080fd5b505af115801561223a573d6000803e3d6000fd5b505050505b509098975050505050505050565b600081815260018301602052604081205480156123365760006122716001836130a8565b8554909150600090612285906001906130a8565b90508181146122ea5760008660000182815481106122a5576122a5612d35565b90600052602060002001549050808760000184815481106122c8576122c8612d35565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806122fb576122fb6130bf565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106fa565b60009150506106fa565b600054610100900460ff1661235b5760005460ff161561235f565b303b155b61237b5760405162461bcd60e51b815260040161072a90612e09565b600054610100900460ff1615801561239d576000805461ffff19166101011790555b6123a5612458565b610da56124bd565b60008181526001830160205260408120546123f4575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106fa565b5060006106fa565b60608160000180548060200260200160405190810160405280929190818152602001828054801561244c57602002820191906000526020600020905b815481526020019060010190808311612438575b50505050509050919050565b600054610100900460ff166124735760005460ff1615612477565b303b155b6124935760405162461bcd60e51b815260040161072a90612e09565b600054610100900460ff161580156124b5576000805461ffff19166101011790555b610da56124f4565b600054610100900460ff166124e45760405162461bcd60e51b815260040161072a906130d5565b6124ec61257b565b610ba361257b565b600054610100900460ff1661250f5760005460ff1615612513565b303b155b61252f5760405162461bcd60e51b815260040161072a90612e09565b600054610100900460ff16158015612551576000805461ffff19166101011790555b6125596125a2565b600161013a5562015180610144558015610db7576000805461ff001916905550565b600054610100900460ff16610ba35760405162461bcd60e51b815260040161072a906130d5565b600054610100900460ff166125bd5760005460ff16156125c1565b303b155b6125dd5760405162461bcd60e51b815260040161072a90612e09565b600054610100900460ff161580156125ff576000805461ffff19166101011790555b610da5600054610100900460ff1661261d5760005460ff1615612621565b303b155b61263d5760405162461bcd60e51b815260040161072a90612e09565b600054610100900460ff1615801561265f576000805461ffff19166101011790555b612667612677565b61266f6126ae565b610da5611d9c565b600054610100900460ff1661269e5760405162461bcd60e51b815260040161072a906130d5565b6126a661257b565b610ba36126e5565b600054610100900460ff166126d55760405162461bcd60e51b815260040161072a906130d5565b6126dd61257b565b610ba3612715565b600054610100900460ff1661270c5760405162461bcd60e51b815260040161072a906130d5565b610ba333611aef565b600054610100900460ff1661273c5760405162461bcd60e51b815260040161072a906130d5565b60c9805460ff19169055565b60006020828403121561275a57600080fd5b81356001600160e01b03198116811461190f57600080fd5b80356001600160a01b038116811461278957600080fd5b919050565b6000602082840312156127a057600080fd5b61190f82612772565b6000602082840312156127bb57600080fd5b5035919050565b60008060008060008060c087890312156127db57600080fd5b6127e487612772565b95506127f260208801612772565b945061280060408801612772565b935061280e60608801612772565b925061281c60808801612772565b915061282a60a08801612772565b90509295509295509295565b60008083601f84011261284857600080fd5b50813567ffffffffffffffff81111561286057600080fd5b6020830191508360208260051b850101111561287b57600080fd5b9250929050565b6000806020838503121561289557600080fd5b823567ffffffffffffffff8111156128ac57600080fd5b6128b885828601612836565b90969095509350505050565b634e487b7160e01b600052602160045260246000fd5b600381106128ea576128ea6128c4565b9052565b602081016106fa82846128da565b600681106128ea576128ea6128c4565b602081016106fa82846128fc565b60008060008060006060868803121561293257600080fd5b853567ffffffffffffffff8082111561294a57600080fd5b61295689838a01612836565b9097509550602088013591508082111561296f57600080fd5b5061297c88828901612836565b90945092505060408601356003811061299457600080fd5b809150509295509295909350565b60008060008060008060008060008060a08b8d0312156129c157600080fd5b8a3567ffffffffffffffff808211156129d957600080fd5b6129e58e838f01612836565b909c509a5060208d01359150808211156129fe57600080fd5b612a0a8e838f01612836565b909a50985060408d0135915080821115612a2357600080fd5b612a2f8e838f01612836565b909850965060608d0135915080821115612a4857600080fd5b612a548e838f01612836565b909650945060808d0135915080821115612a6d57600080fd5b50612a7a8d828e01612836565b915080935050809150509295989b9194979a5092959850565b600a81106128ea576128ea6128c4565b602081016106fa8284612a93565b634e487b7160e01b600052604160045260246000fd5b600082601f830112612ad857600080fd5b813567ffffffffffffffff80821115612af357612af3612ab1565b604051601f8301601f19908116603f01168101908282118183101715612b1b57612b1b612ab1565b81604052838152866020858801011115612b3457600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600080600060a0888a031215612b6f57600080fd5b612b7888612772565b9650612b8660208901612772565b9550604088013567ffffffffffffffff80821115612ba357600080fd5b612baf8b838c01612836565b909750955060608a0135915080821115612bc857600080fd5b612bd48b838c01612836565b909550935060808a0135915080821115612bed57600080fd5b50612bfa8a828b01612ac7565b91505092959891949750929550565b8015158114610db757600080fd5b600060208284031215612c2957600080fd5b813561190f81612c09565b600080600080600060a08688031215612c4c57600080fd5b612c5586612772565b9450612c6360208701612772565b93506040860135925060608601359150608086013567ffffffffffffffff811115612c8d57600080fd5b612c9988828901612ac7565b9150509295509295909350565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115612d0457612d04612cdb565b500190565b6020808252601290820152712737ba1030b236b4b71037b91037bbb732b960711b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612d5f57612d5f612cdb565b5060010190565b6020808252600c908201526b4e6f20636f6e74726163747360a01b604082015260600190565b6020808252600b908201526a456d70747920617272617960a81b604082015260600190565b60208082526014908201527310dbdb9d1c9858dd1cc8185c995b89dd081cd95d60621b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b81835260006001600160fb1b03831115612e7057600080fd5b8260051b8083602087013760009401602001938452509192915050565b6001600160a01b0387811682528616602082015260a060408201819052600090612eba9083018688612e57565b8281036060840152612ecd818587612e57565b8381036080909401939093525050600081526020019695505050505050565b600081518084526020808501945080840160005b83811015612f1c57815187529582019590820190600101612f00565b509495945050505050565b606081526000612f3b606083018789612e57565b8281036020840152612f4e818688612e57565b90508281036040840152612f628185612eec565b98975050505050505050565b600060208284031215612f8057600080fd5b81356006811061190f57600080fd5b600060208284031215612fa157600080fd5b8135600a811061190f57600080fd5b600060208284031215612fc257600080fd5b813560ff8116811461190f57600080fd5b604081526000612fe66040830185612eec565b8281036020840152612ff88185612eec565b95945050505050565b60006020828403121561301357600080fd5b5051919050565b60006020828403121561302c57600080fd5b815161190f81612c09565b60008261305457634e487b7160e01b600052601260045260246000fd5b500690565b6001600160a01b03871681526020810186905260c0810161307d60408301876128da565b61308a6060830186612a93565b61309760808301856128fc565b8260a0830152979650505050505050565b6000828210156130ba576130ba612cdb565b500390565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212207936033cc06f92a226ecf97b03624e88652162245d0d2129777ed823358129be64736f6c63430008090033

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