Contract 0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x24b8845dc4712dc027811001172db0c82ee66992614f375384567794f06e39d7Recover NFT28147462022-10-20 15:20:36111 days 20 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0x0f6ff9295ac46c324c53089204b1aa5ba8fe4b97b5ae8ba527820472e52fd30aRecover NFT28147452022-10-20 15:20:24111 days 20 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0xf8066cf0dfb9dceff4747eb3ebac397834eaf246858e18f5d4f0bff834f14decRecover NFT27797152022-10-15 14:13:12116 days 21 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0x5bd50d3ff8c8b10628929241851da6d0546120b88f56fdedd11f96d8193aeb89Recover NFT27797142022-10-15 14:13:00116 days 21 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0x4a110bdc002ca84804bcdd1f7895bd8b47c8d1dedb8865b68d0beca31d6d48f4Recover NFT27797142022-10-15 14:13:00116 days 21 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0xdcbe108035ee2c8615cb4c7182873a30ff76bda3ab189560b3d5c7dc67fc33eaRecover NFT27797132022-10-15 14:12:48116 days 21 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0xeb18d99d2fdc69b6a7c1c63b9e2a45233058790005e5a8d675089183c949d0a7Recover NFT27797132022-10-15 14:12:48116 days 21 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0x5ca3c67a095e7e86d92216fa1af475de9482c3a070ac4e3d0ef9e0843f1c5708Recover NFT27797122022-10-15 14:12:36116 days 21 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0x2f4d1175ff148e30642d70efe3d4d5b0beb7ff39aec17bb0182c3a2e5b9868e1Recover NFT27797112022-10-15 14:12:24116 days 21 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0x8f29b643babc3085ebeaf6c73f43767c63e12383b5dca9bf83f57bad67e12c41Recover NFT27797112022-10-15 14:12:24116 days 21 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0x4d084e66dbe15dff904d1aa7094c5414efac4701e41ff90c27ac7987680bba35Recover NFT27711612022-10-14 8:43:42118 days 3 hrs ago0xede67e9dcd28b467cc6ab54c539f4a429cdbdb0f IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00004938
0x873a0db623a405f69fc17c624a5045029ea05747c953e773fa4663c671afbe8dRecover NFT27578342022-10-12 10:46:18120 days 1 hr agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0x3b4cfb86deeb7c216d47d94f146aa44fa494b67eb477fedb1ca79e81064a6f20Recover NFT27578322022-10-12 10:45:54120 days 1 hr agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0xf64f1a5b5e913f2f5dfc8bfe19ae5330d5929a9e3eb22c843ab381fcd156eee3Recover NFT25978872022-09-19 9:01:30143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0x900e60fa640637590890d78724459d61c6941a467a8b21c6b21c54e3e9365d9bRecover NFT25978872022-09-19 9:01:30143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0x290906d17bd23f7d6b4a2fe6535b74b7baecaf14a111f16498581eaadc184d83Recover NFT25978852022-09-19 9:01:06143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0xaaf348bd367aa012fce93b5cf545e8fb3628298ba861eb57a69e872ef9930d60Recover NFT25978842022-09-19 9:00:54143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0x12d78f5977ec9fa06e98a1542aa71ed4a075786721f081d3ee3047c4ad28a42bRecover NFT25978842022-09-19 9:00:54143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0x1a217e40a1f916a1d2ef8352157ad9062764784320d26725320d70891dc9bc24Recover NFT25978832022-09-19 9:00:42143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0x00642096c190436d80878a0111f09315f77db702371f1942b3798d8256c95cfcRecover NFT25978742022-09-19 8:58:48143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0x30b5919bf218c4f4c152b56e9a41766c2f9a6fe9d004e82d1cdd41612c4983dfRecover NFT25978742022-09-19 8:58:48143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0xd0d6b34d11d6432a7989c4eb43fc942affd14a55d442aefcbeb13b15ec78393aRecover NFT25978732022-09-19 8:58:36143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0x4c2647e4dfdda7209b729a0c95a9b91ba68a763ec58169b2bd0e3bdfd236973dRecover NFT25978732022-09-19 8:58:36143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.000162012
0x8b4075df33b02bd54645a3521cfe76cb3cf9eb39380888555da46e7f2f1273afRecover NFT25978722022-09-19 8:58:24143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
0xe3da383e31a79f773b436e41cad83a1d2aac40c20b6b8cd50a0f910fe0e31cf7Recover NFT25978712022-09-19 8:58:12143 days 3 hrs agoDamned Pirates Society: Deployer IN  0xf48ea3bc302f6c0585eceddba70a1bc12d67e76f0 MOVR0.00015976
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xdf7338356a4c28c7ff4d762a1d03d184ac97b32a

Contract Name:
DPSDocks

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : DPSDocks.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./../interfaces/IERC20MintableBurnable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "./interfaces/DPSStructs.sol";
import "./interfaces/DPSInterfaces.sol";

contract DPSDocks is ERC721Holder, ReentrancyGuard, Ownable {
    using SafeERC20 for IERC20;

    DPSVoyageI public voyage;
    DPSRandomI public causality;
    IERC721 public dps;
    DPSPirateFeaturesI public dpsFeatures;
    DPSFlagshipI public flagship;
    DPSSupportShipI public supportShip;
    IERC721 public artifact;
    DPSCartographerI public cartographer;
    DPSGameSettingsI public gameSettings;
    DPSChestsI public chest;

    /**
     * @notice list of voyages started by wallet
     */
    mapping(address => mapping(uint256 => LockedVoyage)) private lockedVoyages;

    /**
     * @notice list of voyages finished by wallet
     */
    mapping(address => mapping(uint256 => LockedVoyage)) private finishedVoyages;

    /**
     * @notice list of voyages ids started by wallet
     */
    mapping(address => uint256[]) private lockedVoyagesIds;

    /**
     * @notice list of voyages ids finished by wallet
     */
    mapping(address => uint256[]) private finishedVoyagesIds;

    /**
     * @notice finished voyages results voyageId=>results
     */
    mapping(uint256 => VoyageResult) private voyageResults;

    /**
     * @notice list of locked voyages and their owners id => wallet
     */
    mapping(uint256 => address) private ownerOfLockedVoyages;

    event LockVoyage(
        uint256 indexed _voyageId,
        uint256 indexed _dpsId,
        uint256 indexed _flagshipId,
        uint256[] _supportShipIds,
        uint256 _artifactId
    );

    event ClaimVoyageRewards(
        uint256 indexed _voyageId,
        uint16 _noOfChests,
        uint16 _destroyedSupportships,
        uint16 _healthDamage,
        uint16[] _interactionRNGs,
        uint8[] _interactionResults
    );
    event SetContract(string indexed _target, address _contract);
    event TokenRecovered(address indexed _token, address _destination, uint256 _amount);

    constructor() {}

    /**
     * @notice Locking a voyage
     * @param _lockedVoyage object that contains:
     * - voyageId
     * - dpsId (Pirate)
     * - flagshipId
     * - supportShipIds - list of support ships ids
     * - artifactId
     * the rest of the params are ignored
     */
    function lockVoyageItems(LockedVoyage memory _lockedVoyage) external nonReentrant {
        require(gameSettings.isPaused(1) == 0, "Paused");
        require(_lockedVoyage.voyageId > 0, "Invalid Voyage");
        require(voyage.ownerOf(_lockedVoyage.voyageId) == msg.sender, "You don't owe this voyage");
        require(dps.ownerOf(_lockedVoyage.dpsId) == msg.sender, "You don't owe this dps");

        require(flagship.ownerOf(_lockedVoyage.flagshipId) == msg.sender, "You don't owe this flagship");
        require(flagship.getPartsLevel(_lockedVoyage.flagshipId)[uint256(FLAGSHIP_PART.HEALTH)] == 100, "Flagship damaged");

        require(lockedVoyages[msg.sender][_lockedVoyage.voyageId].voyageId == 0, "This Voyage is already started");
        require(finishedVoyages[msg.sender][_lockedVoyage.voyageId].voyageId == 0, "This Voyage is finished");
        if (_lockedVoyage.supportShipIds.length > 0) {
            for (uint256 i; i < _lockedVoyage.supportShipIds.length; i++) {
                require(supportShip.ownerOf(_lockedVoyage.supportShipIds[i]) == msg.sender, "Support ship not owned by you");
            }
        }
        VoyageConfig memory voyageConfig = voyage.getVoyageConfig(_lockedVoyage.voyageId);
        require(
            block.number > voyageConfig.boughtAt + voyageConfig.noOfBlockJumps * voyageConfig.noOfInteractions + 2,
            "Voyage generation not done"
        );

        _lockedVoyage.lockedBlock = block.number;
        _lockedVoyage.lockedTimestamp = block.timestamp;
        _lockedVoyage.claimedTime = 0;
        _lockedVoyage.claimedTime = 0;
        _lockedVoyage.navigation = 0;
        _lockedVoyage.luck = 0;
        _lockedVoyage.strength = 0;
        lockedVoyages[msg.sender][_lockedVoyage.voyageId] = _lockedVoyage;
        lockedVoyagesIds[msg.sender].push(_lockedVoyage.voyageId);
        ownerOfLockedVoyages[_lockedVoyage.voyageId] = msg.sender;

        dps.safeTransferFrom(msg.sender, address(this), _lockedVoyage.dpsId);
        flagship.safeTransferFrom(msg.sender, address(this), _lockedVoyage.flagshipId);

        for (uint256 i; i < _lockedVoyage.supportShipIds.length; i++) {
            supportShip.safeTransferFrom(msg.sender, address(this), _lockedVoyage.supportShipIds[i]);
        }

        voyage.safeTransferFrom(msg.sender, address(this), _lockedVoyage.voyageId);
        emit LockVoyage(
            _lockedVoyage.voyageId,
            _lockedVoyage.dpsId,
            _lockedVoyage.flagshipId,
            _lockedVoyage.supportShipIds,
            _lockedVoyage.artifactId
        );
    }

    /**
     * @notice Claiming rewards with params retrieved from the random future blocks
     * @param _voyageId - id of the voyage
     * @param _causalityParams - list of parameters used to generated random outcomes
     */
    function claimRewards(uint256 _voyageId, CausalityParams memory _causalityParams) external nonReentrant {
        _causalityParams.userAddress = getLockedVoyageOwner(_voyageId);
        require(_causalityParams.userAddress != address(0), "Voyage does not exists");

        LockedVoyage storage lockedVoyage = lockedVoyages[_causalityParams.userAddress][_voyageId];
        require(voyage.ownerOf(_voyageId) == address(this) && lockedVoyage.voyageId != 0, "Voyage not started");

        VoyageConfig memory voyageConfig = cartographer.viewVoyageConfiguration(_causalityParams, _voyageId);

        require(
            lockedVoyage.lockedTimestamp + voyageConfig.noOfInteractions * voyageConfig.gapBetweenInteractions <=
                block.timestamp,
            "Voyage not finished"
        );

        require(
            block.number > lockedVoyage.lockedBlock + voyageConfig.noOfInteractions * voyageConfig.noOfBlockJumps,
            "Voyage can't be finished, needs more blocks"
        );

        require(
            _causalityParams.blockNumber.length > 0 &&
                _causalityParams.blockNumber.length == _causalityParams.signature.length,
            "Causality params are incorrect"
        );
        checkCausalityParams(_causalityParams, voyageConfig, lockedVoyage);

        VoyageResult memory voyageResult = computeVoyageState(lockedVoyage, voyageConfig, _causalityParams);
        lockedVoyage.claimedTime = block.timestamp;
        finishedVoyages[_causalityParams.userAddress][lockedVoyage.voyageId] = lockedVoyage;
        finishedVoyagesIds[_causalityParams.userAddress].push(lockedVoyage.voyageId);
        voyageResults[_voyageId] = voyageResult;
        awardRewards(voyageResult, voyageConfig.typeOfVoyage, lockedVoyage, _causalityParams.userAddress);
        cleanLockedVoyage(lockedVoyage.voyageId, _causalityParams.userAddress);

        emit ClaimVoyageRewards(
            _voyageId,
            voyageResult.awardedChests,
            voyageResult.destroyedSupportShips,
            voyageResult.healthDamage,
            voyageResult.interactionRNGs,
            voyageResult.interactionResults
        );
    }

    /**
     * @notice checking voyage state between start start and finish sail, it uses causality parameters to determine the outcome of interactions
     * @param _voyageId - id of the voyage
     * @param _causalityParams - list of parameters used to generated random outcomes, it can be an incomplete list, meaning that you can check mid-sail to determine outcomes
     */
    function checkVoyageState(uint256 _voyageId, CausalityParams memory _causalityParams)
        external
        view
        returns (VoyageResult memory voyageResult)
    {
        _causalityParams.userAddress = getLockedVoyageOwner(_voyageId);
        LockedVoyage storage lockedVoyage = lockedVoyages[_causalityParams.userAddress][_voyageId];

        require(voyage.ownerOf(_voyageId) == address(this) && lockedVoyage.voyageId != 0, "Voyage not started");

        VoyageConfig memory voyageConfig = cartographer.viewVoyageConfiguration(_causalityParams, _voyageId);
        require(
            (block.timestamp - lockedVoyage.lockedTimestamp) > voyageConfig.gapBetweenInteractions,
            "Voyage did not start"
        );

        uint256 interactions = (block.timestamp - lockedVoyage.lockedTimestamp) / voyageConfig.gapBetweenInteractions;
        if (interactions > voyageConfig.sequence.length) interactions = voyageConfig.sequence.length;
        uint256 length = voyageConfig.sequence.length;
        for (uint256 i; i < length - interactions; i++) {
            voyageConfig.sequence[length - i - 1] = 0;
        }
        return computeVoyageState(lockedVoyage, voyageConfig, _causalityParams);
    }

    /**
     * @notice computing voyage state based on the locked voyage skills and config and causality params
     * @param _lockedVoyage - locked voyage items
     * @param _voyageConfig - voyage config object
     * @param _causalityParams - list of parameters used to generated random outcomes, it can be an incomplete list, meaning that you can check mid-sail to determine outcomes
     * @return VoyageResult - containing the results of a voyage based on interactions
     */
    function computeVoyageState(
        LockedVoyage storage _lockedVoyage,
        VoyageConfig memory _voyageConfig,
        CausalityParams memory _causalityParams
    ) internal view returns (VoyageResult memory) {
        VoyageStatusCache memory claimingRewardsCache;
        claimingRewardsCache.randomCheckIndex = _voyageConfig.noOfInteractions + 2 - 1;
        (, uint16[3] memory features) = dpsFeatures.getTraitsAndSkills(uint16(_lockedVoyage.dpsId));

        require(features[0] > 0 && features[1] > 0 && features[2] > 0, "Traits not found");

        claimingRewardsCache.luck += features[0];
        claimingRewardsCache.navigation += features[1];
        claimingRewardsCache.strength += features[2];
        claimingRewardsCache = computeFlagShipSkills(_lockedVoyage.flagshipId, claimingRewardsCache);
        claimingRewardsCache = computeSupportShipSkills(_lockedVoyage.supportShipIds, claimingRewardsCache);
        VoyageResult memory voyageResult;
        uint256 maxRollCap = gameSettings.getMaxRollCap();
        voyageResult.interactionResults = new uint8[](_voyageConfig.sequence.length);
        voyageResult.interactionRNGs = new uint16[](_voyageConfig.sequence.length);
        for (uint256 i; i < _voyageConfig.sequence.length; i++) {
            INTERACTION interaction = INTERACTION(_voyageConfig.sequence[i]);
            if (interaction == INTERACTION.NONE || voyageResult.healthDamage == 100) {
                voyageResult.skippedInteractions++;
                continue;
            }

            claimingRewardsCache.randomCheckIndex++;

            uint256 result;
            if (_causalityParams.signature.length > 0) {
                result = causality.getRandom(
                    _causalityParams.userAddress,
                    _causalityParams.blockNumber[claimingRewardsCache.randomCheckIndex],
                    _causalityParams.hash1[claimingRewardsCache.randomCheckIndex],
                    _causalityParams.hash2[claimingRewardsCache.randomCheckIndex],
                    _causalityParams.timestamp[claimingRewardsCache.randomCheckIndex],
                    _causalityParams.signature[claimingRewardsCache.randomCheckIndex],
                    string(abi.encodePacked("INTERACTION_RESULT", claimingRewardsCache.randomCheckIndex)),
                    0,
                    maxRollCap
                );
            } else {
                result = causality.getRandomUnverified(
                    _causalityParams.userAddress,
                    _causalityParams.blockNumber[claimingRewardsCache.randomCheckIndex],
                    _causalityParams.hash1[claimingRewardsCache.randomCheckIndex],
                    _causalityParams.hash2[claimingRewardsCache.randomCheckIndex],
                    _causalityParams.timestamp[claimingRewardsCache.randomCheckIndex],
                    string(abi.encodePacked("INTERACTION_RESULT", claimingRewardsCache.randomCheckIndex)),
                    0,
                    maxRollCap
                );
            }
            (voyageResult, claimingRewardsCache) = interpretResults(
                result,
                voyageResult,
                _lockedVoyage,
                claimingRewardsCache,
                interaction,
                i
            );
            voyageResult.interactionRNGs[i] = uint16(result);
        }
        return voyageResult;
    }

    /**
     * @notice interprets a randomness result, meaning that based on the skill points accumulated from base pirate skills,
     *         flagship + support ships, we do a comparition between the result of the randomness and the skill points.
     *         if random > skill points than this interaction fails. Things to notice: if STORM or ENEMY fails then we
     *         destroy a support ship (if exists) or do health damage of 100% which will result in skipping all the upcoming
     *         interactions
     * @param _result - random number generated
     * @param _voyageResult - the result object that is cached and sent along for later on saving into storage
     * @param _lockedVoyage - locked voyage that contains the support ship objects that will get modified (sent as storage) if interaction failed
     * @param _claimingRewardsCache - cache object sent along for points updates
     * @param _interaction - interaction that we compute the outcome for
     * @param _index - current index of interaction, used to update the outcome
     * @return updated voyage results and claimingRewardsCache (this updates in case of a support ship getting destroyed)
     */
    function interpretResults(
        uint256 _result,
        VoyageResult memory _voyageResult,
        LockedVoyage storage _lockedVoyage,
        VoyageStatusCache memory _claimingRewardsCache,
        INTERACTION _interaction,
        uint256 _index
    ) internal view returns (VoyageResult memory, VoyageStatusCache memory) {
        if (_interaction == INTERACTION.CHEST && _result <= _claimingRewardsCache.luck) {
            _voyageResult.awardedChests++;
            _voyageResult.interactionResults[_index] = 1;
        } else if (
            (_interaction == INTERACTION.STORM && _result > _claimingRewardsCache.navigation) ||
            (_interaction == INTERACTION.ENEMY && _result > _claimingRewardsCache.strength)
        ) {
            if (_lockedVoyage.supportShipIds.length - _voyageResult.destroyedSupportShips > 0) {
                _voyageResult.destroyedSupportShips++;
                (uint256 points, SUPPORT_SHIP_TYPE supportShipType) = supportShip.getSkillBoostPerTokenId(
                    _lockedVoyage.supportShipIds[_voyageResult.destroyedSupportShips - 1]
                );
                if (
                    supportShipType == SUPPORT_SHIP_TYPE.SLOOP_STRENGTH ||
                    supportShipType == SUPPORT_SHIP_TYPE.CARAVEL_STRENGTH ||
                    supportShipType == SUPPORT_SHIP_TYPE.GALLEON_STRENGTH
                ) _claimingRewardsCache.strength -= points;
                if (
                    supportShipType == SUPPORT_SHIP_TYPE.SLOOP_LUCK ||
                    supportShipType == SUPPORT_SHIP_TYPE.CARAVEL_LUCK ||
                    supportShipType == SUPPORT_SHIP_TYPE.GALLEON_LUCK
                ) _claimingRewardsCache.luck -= points;
                if (
                    supportShipType == SUPPORT_SHIP_TYPE.SLOOP_NAVIGATION ||
                    supportShipType == SUPPORT_SHIP_TYPE.CARAVEL_NAVIGATION ||
                    supportShipType == SUPPORT_SHIP_TYPE.GALLEON_NAVIGATION
                ) _claimingRewardsCache.navigation -= points;
            } else {
                _voyageResult.healthDamage = 100;
            }
        } else if (_interaction != INTERACTION.CHEST) {
            _voyageResult.interactionResults[_index] = 1;
        }
        return (_voyageResult, _claimingRewardsCache);
    }

    /**
     * @notice awards the voyage (if any) and transfers back the assets that were locked into the voyage
     *         to the owners, also if support ship destroyed, it burns them, if healh damage taken then apply effect on flagship
     * @param _voyageResult - the result of the voyage that is used to award and apply effects
     * @param _typeOfVoyage - used to mint the chests types accordingly with the voyage type
     * @param _lockedVoyage - locked voyage object used to get the locked items that needs to be transferred back
     * @param _owner - the owner of the voyage that will receive rewards + items back
     *
     */
    function awardRewards(
        VoyageResult memory _voyageResult,
        VOYAGE_TYPE _typeOfVoyage,
        LockedVoyage memory _lockedVoyage,
        address _owner
    ) internal {
        chest.mint(_owner, _typeOfVoyage, _voyageResult.awardedChests);
        dps.safeTransferFrom(address(this), _owner, _lockedVoyage.dpsId);

        if (_voyageResult.healthDamage > 0)
            flagship.upgradePart(FLAGSHIP_PART.HEALTH, _lockedVoyage.flagshipId, 100 - _voyageResult.healthDamage);
        flagship.safeTransferFrom(address(this), _owner, _lockedVoyage.flagshipId);

        for (uint256 i; i < _lockedVoyage.supportShipIds.length; i++) {
            if (i < _voyageResult.destroyedSupportShips) supportShip.burn(_lockedVoyage.supportShipIds[i]);
            else supportShip.safeTransferFrom(address(this), _owner, _lockedVoyage.supportShipIds[i]);
        }
        voyage.burn(_lockedVoyage.voyageId);
    }

    /**
     * @notice computes skills for the support ships as there are multiple types that apply skills to different skill type: navigation, luck, strength
     * @param _supportShips the array of support ships
     * @param _claimingRewardsCache the cache object that contains the skill points per skill type
     * @return cached object with the skill points updated
     */
    function computeSupportShipSkills(uint256[] memory _supportShips, VoyageStatusCache memory _claimingRewardsCache)
        internal
        view
        returns (VoyageStatusCache memory)
    {
        for (uint256 i; i < _supportShips.length; i++) {
            (uint256 skill, SUPPORT_SHIP_TYPE supportShipType) = supportShip.getSkillBoostPerTokenId(_supportShips[i]);
            if (
                supportShipType == SUPPORT_SHIP_TYPE.SLOOP_STRENGTH ||
                supportShipType == SUPPORT_SHIP_TYPE.CARAVEL_STRENGTH ||
                supportShipType == SUPPORT_SHIP_TYPE.GALLEON_STRENGTH
            ) _claimingRewardsCache.strength += skill;

            if (
                supportShipType == SUPPORT_SHIP_TYPE.SLOOP_LUCK ||
                supportShipType == SUPPORT_SHIP_TYPE.CARAVEL_LUCK ||
                supportShipType == SUPPORT_SHIP_TYPE.GALLEON_LUCK
            ) _claimingRewardsCache.luck += skill;

            if (
                supportShipType == SUPPORT_SHIP_TYPE.SLOOP_NAVIGATION ||
                supportShipType == SUPPORT_SHIP_TYPE.CARAVEL_NAVIGATION ||
                supportShipType == SUPPORT_SHIP_TYPE.GALLEON_NAVIGATION
            ) _claimingRewardsCache.navigation += skill;
        }
        return _claimingRewardsCache;
    }

    /**
     * @notice computes skills for the flagship based on the level of the part of the flagship + base skills of the flagship
     * @param _flagshipId flagship id
     * @param _claimingRewardsCache the cache object that contains the skill points per skill type
     * @return cached object with the skill points updated
     */
    function computeFlagShipSkills(uint256 _flagshipId, VoyageStatusCache memory _claimingRewardsCache)
        internal
        view
        returns (VoyageStatusCache memory)
    {
        uint8[7] memory levels = flagship.getPartsLevel(_flagshipId);
        uint16[7] memory skillsPerPart = gameSettings.getSkillsPerFlagshipParts();
        uint8[7] memory skillTypes = gameSettings.getSkillTypeOfEachFlagshipPart();
        uint256 flagShipBaseSkills = gameSettings.getFlagshipBaseSkills();
        _claimingRewardsCache.luck += flagShipBaseSkills;
        _claimingRewardsCache.navigation += flagShipBaseSkills;
        _claimingRewardsCache.strength += flagShipBaseSkills;
        for (uint256 i; i < 7; i++) {
            if (skillTypes[i] == uint8(SKILL_TYPE.LUCK)) _claimingRewardsCache.luck += skillsPerPart[i] * levels[i];
            if (skillTypes[i] == uint8(SKILL_TYPE.NAVIGATION))
                _claimingRewardsCache.navigation += skillsPerPart[i] * levels[i];
            if (skillTypes[i] == uint8(SKILL_TYPE.STRENGTH)) _claimingRewardsCache.strength += skillsPerPart[i] * levels[i];
        }
        return _claimingRewardsCache;
    }

    /**
     * @notice Checks if causality params are correct in terms of blocks generated based on
     * block of buying and locked
     * @param _causalityParams params that needs to be checked
     * @param _voyageConfig config of the voyage
     * @param _lockedVoyage locked voyage params
     */
    function checkCausalityParams(
        CausalityParams memory _causalityParams,
        VoyageConfig memory _voyageConfig,
        LockedVoyage memory _lockedVoyage
    ) internal pure {
        for (uint256 i = 0; i < _voyageConfig.noOfInteractions + 2; i++) {
            if (!((i + 1) * _voyageConfig.noOfBlockJumps + _voyageConfig.boughtAt == _causalityParams.blockNumber[i])) {}
            require(
                (i + 1) * _voyageConfig.noOfBlockJumps + _voyageConfig.boughtAt == _causalityParams.blockNumber[i],
                "Causality params of bought blocks are wrong"
            );
        }
        uint256 j = 1;
        for (uint256 i = _voyageConfig.noOfInteractions + 2; i < _voyageConfig.noOfInteractions * 2 + 2; i++) {
            require(
                (j) * _voyageConfig.noOfBlockJumps + _lockedVoyage.lockedBlock == _causalityParams.blockNumber[i],
                "Causality params of locked blocks are wrong"
            );
            j++;
        }
    }

    /**
     * @notice cleans a locked voyage, usually once it's finished
     * @param _voyageId - voyage id
     * @param _owner  - owner of the voyage
     */
    function cleanLockedVoyage(uint256 _voyageId, address _owner) internal {
        uint256[] storage voyagesForOwner = lockedVoyagesIds[_owner];
        for (uint256 i; i < voyagesForOwner.length; i++) {
            if (voyagesForOwner[i] == _voyageId) {
                voyagesForOwner[i] = voyagesForOwner[voyagesForOwner.length - 1];
                voyagesForOwner.pop();
            }
        }
        delete ownerOfLockedVoyages[_voyageId];
        delete lockedVoyages[_owner][_voyageId];
    }

    function onERC721Received(
        address _operator,
        address,
        uint256,
        bytes calldata
    ) public view override returns (bytes4) {
        require(_operator == address(this), "Accepting only from Docks");
        return this.onERC721Received.selector;
    }

    /**
     * @notice Recover NFT sent by mistake to the contract
     * @param _nft the NFT address
     * @param _destination where to send the NFT
     * @param _tokenId the token to want to recover
     */
    function recoverNFT(
        address _nft,
        address _destination,
        uint256 _tokenId
    ) external onlyOwner {
        require(_destination != address(0), "Destination can not be address 0");
        IERC721(_nft).safeTransferFrom(address(this), _destination, _tokenId);
        emit TokenRecovered(_nft, _destination, _tokenId);
    }

    /**
     * @notice Recover NFT sent by mistake to the contract
     * @param _nft the 1155 NFT address
     * @param _destination where to send the NFT
     * @param _tokenId the token to want to recover
     * @param _amount amount of this token to want to recover
     */
    function recover1155NFT(
        address _nft,
        address _destination,
        uint256 _tokenId,
        uint256 _amount
    ) external onlyOwner {
        require(_destination != address(0), "Destination can not be address 0");
        IERC1155(_nft).safeTransferFrom(address(this), _destination, _tokenId, _amount, "");
        emit TokenRecovered(_nft, _destination, _tokenId);
    }

    /**
     * @notice Recover TOKENS sent by mistake to the contract
     * @param _token the TOKEN address
     * @param _destination where to send the NFT
     */
    function recoverERC20(address _token, address _destination) external onlyOwner {
        require(_destination != address(0), "Destination can not be address 0");
        uint256 amount = IERC20(_token).balanceOf(address(this));
        IERC20(_token).safeTransferFrom(address(this), _destination, amount);
        emit TokenRecovered(_token, _destination, amount);
    }

    function cleanVoyageResults(uint256 _voyageId) external onlyOwner {
        delete voyageResults[_voyageId];
    }

    /**
     * SETTERS & GETTERS
     */
    function setVoyageContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        voyage = DPSVoyageI(_contract);
        emit SetContract("Voyage", _contract);
    }

    function setCausalityContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        causality = DPSRandomI(_contract);
        emit SetContract("Causality", _contract);
    }

    function setDpsContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        dps = IERC721(_contract);
        emit SetContract("DPS", _contract);
    }

    function setFlagshipContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        flagship = DPSFlagshipI(_contract);
        emit SetContract("Flagship", _contract);
    }

    function setSupportShipContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        supportShip = DPSSupportShipI(_contract);
        emit SetContract("SupportShip", _contract);
    }

    function setArtifactContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        artifact = IERC721(_contract);
        emit SetContract("Artifact", _contract);
    }

    function setGameSettingsContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        gameSettings = DPSGameSettingsI(_contract);
        emit SetContract("GameSettings", _contract);
    }

    function setDpsPirateFeaturesContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        dpsFeatures = DPSPirateFeaturesI(_contract);
        emit SetContract("DPSFeatures", _contract);
    }

    function setCartographerContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        cartographer = DPSCartographerI(_contract);
        emit SetContract("Cartographer", _contract);
    }

    function setChestsContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        chest = DPSChestsI(_contract);
        emit SetContract("Chest", _contract);
    }

    function getLockedVoyagesForOwner(address _owner) external view returns (LockedVoyage[] memory locked) {
        locked = new LockedVoyage[](lockedVoyagesIds[_owner].length);
        for (uint256 i; i < lockedVoyagesIds[_owner].length; i++) {
            locked[i] = lockedVoyages[_owner][lockedVoyagesIds[_owner][i]];
        }
    }

    function getLockedVoyageByOwnerAndId(address _owner, uint256 _voyageId)
        external
        view
        returns (LockedVoyage memory locked)
    {
        for (uint256 i; i < lockedVoyagesIds[_owner].length; i++) {
            uint256 tempId = lockedVoyagesIds[_owner][i];
            if (tempId == _voyageId) return lockedVoyages[_owner][tempId];
        }
    }

    function getFinishedVoyagesForOwner(address _owner) external view returns (LockedVoyage[] memory finished) {
        finished = new LockedVoyage[](finishedVoyagesIds[_owner].length);
        for (uint256 i; i < finishedVoyagesIds[_owner].length; i++) {
            finished[i] = finishedVoyages[_owner][finishedVoyagesIds[_owner][i]];
        }
    }

    function getFinishedVoyageByOwnerAndId(address _owner, uint256 _voyageId)
        external
        view
        returns (LockedVoyage memory finished)
    {
        for (uint256 i; i < finishedVoyagesIds[_owner].length; i++) {
            uint256 tempId = finishedVoyagesIds[_owner][i];
            if (tempId == _voyageId) return finishedVoyages[_owner][tempId];
        }
    }

    function getLockedVoyageOwner(uint256 _voyageId) public view returns (address) {
        return ownerOfLockedVoyages[_voyageId];
    }

    function getLastComputedState(uint256 _voyageId) external view returns (VoyageResult memory) {
        return voyageResults[_voyageId];
    }
}

File 2 of 18 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 3 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 4 of 18 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _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);
    }
}

File 5 of 18 : IERC20MintableBurnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20Mintable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * @dev Interface of the ERC20 expanded to include mint and burn functionality
 * @dev
 */
interface IERC20MintableBurnable is IERC20Mintable, IERC20 {
    /**
     * @dev burns `amount` from `receiver`
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits an {BURN} event.
     */
    function burn(address _from, uint256 _amount) external;
}

File 6 of 18 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 7 of 18 : ERC721Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 8 of 18 : DPSStructs.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

enum VOYAGE_TYPE {
    EASY,
    MEDIUM,
    HARD,
    LEGENDARY
}

enum SUPPORT_SHIP_TYPE {
    SLOOP_STRENGTH,
    SLOOP_LUCK,
    SLOOP_NAVIGATION,
    CARAVEL_STRENGTH,
    CARAVEL_LUCK,
    CARAVEL_NAVIGATION,
    GALLEON_STRENGTH,
    GALLEON_LUCK,
    GALLEON_NAVIGATION
}

enum INTERACTION {
    NONE,
    CHEST,
    STORM,
    ENEMY
}

enum FLAGSHIP_PART {
    HEALTH,
    CANNON,
    HULL,
    SAILS,
    HELM,
    FLAG,
    FIGUREHEAD
}

enum SKILL_TYPE {
    LUCK,
    STRENGTH,
    NAVIGATION
}

struct VoyageConfig {
    VOYAGE_TYPE typeOfVoyage;
    uint8 noOfInteractions;
    uint16 noOfBlockJumps;
    // 1 - Chest 2 - Storm 3 - Enemy
    uint8[] sequence;
    uint256 boughtAt;
    uint256 gapBetweenInteractions;
}

struct CartographerConfig {
    uint8 minNoOfChests;
    uint8 maxNoOfChests;
    uint8 minNoOfStorms;
    uint8 maxNoOfStorms;
    uint8 minNoOfEnemies;
    uint8 maxNoOfEnemies;
    uint8 totalInteractions;
    uint256 gapBetweenInteractions;
}

struct RandomInteractions {
    uint256 randomNoOfChests;
    uint256 randomNoOfStorms;
    uint256 randomNoOfEnemies;
    uint8 generatedChests;
    uint8 generatedStorms;
    uint8 generatedEnemies;
    uint256[] positionsForGeneratingInteractions;
}

struct CausalityParams {
    address userAddress;
    uint256[] blockNumber;
    bytes32[] hash1;
    bytes32[] hash2;
    uint256[] timestamp;
    bytes[] signature;
}

struct LockedVoyage {
    uint256 voyageId;
    uint256 dpsId;
    uint256 flagshipId;
    uint256[] supportShipIds;
    uint256 artifactId;
    uint256 lockedBlock;
    uint256 lockedTimestamp;
    uint256 claimedTime;
    uint16 navigation;
    uint16 luck;
    uint16 strength;
}

struct VoyageResult {
    uint16 awardedChests;
    uint16 destroyedSupportShips;
    uint8 healthDamage;
    uint16 skippedInteractions;
    uint16[] interactionRNGs;
    uint8[] interactionResults;
}

struct VoyageStatusCache {
    uint256 strength;
    uint256 luck;
    uint256 navigation;
    uint256 randomCheckIndex;
}

File 9 of 18 : DPSInterfaces.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "./DPSStructs.sol";

interface DPSVoyageI is IERC721Enumerable {
    function mint(
        address _owner,
        uint256 _tokenId,
        VoyageConfig calldata config
    ) external;

    function burn(uint256 _tokenId) external;

    function getVoyageConfig(uint256 _voyageId) external view returns (VoyageConfig memory config);

    function tokensOfOwner(address _owner) external view returns (uint256[] memory);

    function exists(uint256 _tokenId) external view returns (bool);
}

interface DPSRandomI {
    function getRandomBatch(
        address _address,
        uint256[] memory _blockNumber,
        bytes32[] memory _hash1,
        bytes32[] memory _hash2,
        uint256[] memory _timestamp,
        bytes[] memory _signature,
        string[] memory _entropy,
        uint256 _min,
        uint256 _max
    ) external view returns (uint256[] memory randoms);

    function getRandomUnverifiedBatch(
        address _address,
        uint256[] memory _blockNumber,
        bytes32[] memory _hash1,
        bytes32[] memory _hash2,
        uint256[] memory _timestamp,
        string[] memory _entropy,
        uint256 _min,
        uint256 _max
    ) external pure returns (uint256[] memory randoms);

    function getRandom(
        address _address,
        uint256 _blockNumber,
        bytes32 _hash1,
        bytes32 _hash2,
        uint256 _timestamp,
        bytes memory _signature,
        string memory _entropy,
        uint256 _min,
        uint256 _max
    ) external view returns (uint256 randoms);

    function getRandomUnverified(
        address _address,
        uint256 _blockNumber,
        bytes32 _hash1,
        bytes32 _hash2,
        uint256 _timestamp,
        string memory _entropy,
        uint256 _min,
        uint256 _max
    ) external pure returns (uint256 randoms);
}

interface DPSGameSettingsI {
    function getVoyageConfig(VOYAGE_TYPE _type) external view returns (CartographerConfig memory);

    function getMaxSkillsCap() external view returns (uint16);

    function getMaxRollCap() external view returns (uint16);

    function getFlagshipBaseSkills() external view returns (uint16);

    function getSkillsPerFlagshipParts() external view returns (uint16[7] memory skills);

    function getSkillTypeOfEachFlagshipPart() external view returns (uint8[7] memory skillTypes);

    function getTMAPPerVoyageType(VOYAGE_TYPE _type) external view returns (uint256);

    function getBlockJumps() external view returns (uint16);

    function getGapBetweenVoyagesCreation() external view returns (uint256);

    function getDoubloonsRewardsPerChest(VOYAGE_TYPE _type) external view returns (uint256[] memory);

    function isPaused(uint8 _component) external view returns (uint8);

    function getTmapPerDoubloon() external view returns (uint256);
}

interface DPSPirateFeaturesI {
    function getTraitsAndSkills(uint16 _dpsId) external view returns (string[8] memory, uint16[3] memory);
}

interface DPSSupportShipI is IERC721 {
    function getSkillBoostPerTokenId(uint256 _tokenId) external view returns (uint256, SUPPORT_SHIP_TYPE);

    function burn(uint256 _id) external;

    function exists(uint256 _tokenId) external view returns (bool);
}

interface DPSFlagshipI is IERC721 {
    function mint(address _owner, uint256 _id) external;

    function burn(uint256 _id) external;

    function upgradePart(
        FLAGSHIP_PART _trait,
        uint256 _tokenId,
        uint8 _level
    ) external;

    function getPartsLevel(uint256 _flagshipId) external view returns (uint8[7] memory);

    function tokensOfOwner(address _owner) external view returns (uint256[] memory);

    function exists(uint256 _tokenId) external view returns (bool);
}

interface DPSChestsI is IERC1155 {
    function mint(
        address _to,
        VOYAGE_TYPE _voyageType,
        uint256 _amount
    ) external;

    function burn(
        address _from,
        VOYAGE_TYPE _voyageType,
        uint256 _amount
    ) external;
}

interface DPSCartographerI {
    function viewVoyageConfiguration(CausalityParams memory causalityParams, uint256 _voyageId)
        external
        view
        returns (VoyageConfig memory voyageConfig);
}

interface MintableBurnableIERC1155 is IERC1155 {
    function mint(
        address _to,
        VOYAGE_TYPE _voyageType,
        uint256 _amount
    ) external;

    function burn(
        address _from,
        VOYAGE_TYPE _voyageType,
        uint256 _amount
    ) external;
}

File 10 of 18 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

File 11 of 18 : IERC20Mintable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 expanded to include mint functionality
 * @dev
 */
interface IERC20Mintable {
    /**
     * @dev mints `amount` to `receiver`
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits an {Minted} event.
     */
    function mint(address receiver, uint256 amount) external;
}

File 12 of 18 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 13 of 18 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

        (bool success, bytes memory returndata) = target.delegatecall(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 14 of 18 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 15 of 18 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 16 of 18 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

File 17 of 18 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 18 of 18 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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 IERC165 {
    /**
     * @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);
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_voyageId","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"_noOfChests","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_destroyedSupportships","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_healthDamage","type":"uint16"},{"indexed":false,"internalType":"uint16[]","name":"_interactionRNGs","type":"uint16[]"},{"indexed":false,"internalType":"uint8[]","name":"_interactionResults","type":"uint8[]"}],"name":"ClaimVoyageRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_voyageId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_dpsId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_flagshipId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"_supportShipIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"_artifactId","type":"uint256"}],"name":"LockVoyage","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":true,"internalType":"string","name":"_target","type":"string"},{"indexed":false,"internalType":"address","name":"_contract","type":"address"}],"name":"SetContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"address","name":"_destination","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"TokenRecovered","type":"event"},{"inputs":[],"name":"artifact","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cartographer","outputs":[{"internalType":"contract DPSCartographerI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"causality","outputs":[{"internalType":"contract DPSRandomI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voyageId","type":"uint256"},{"components":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256[]","name":"blockNumber","type":"uint256[]"},{"internalType":"bytes32[]","name":"hash1","type":"bytes32[]"},{"internalType":"bytes32[]","name":"hash2","type":"bytes32[]"},{"internalType":"uint256[]","name":"timestamp","type":"uint256[]"},{"internalType":"bytes[]","name":"signature","type":"bytes[]"}],"internalType":"struct CausalityParams","name":"_causalityParams","type":"tuple"}],"name":"checkVoyageState","outputs":[{"components":[{"internalType":"uint16","name":"awardedChests","type":"uint16"},{"internalType":"uint16","name":"destroyedSupportShips","type":"uint16"},{"internalType":"uint8","name":"healthDamage","type":"uint8"},{"internalType":"uint16","name":"skippedInteractions","type":"uint16"},{"internalType":"uint16[]","name":"interactionRNGs","type":"uint16[]"},{"internalType":"uint8[]","name":"interactionResults","type":"uint8[]"}],"internalType":"struct VoyageResult","name":"voyageResult","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chest","outputs":[{"internalType":"contract DPSChestsI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voyageId","type":"uint256"},{"components":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256[]","name":"blockNumber","type":"uint256[]"},{"internalType":"bytes32[]","name":"hash1","type":"bytes32[]"},{"internalType":"bytes32[]","name":"hash2","type":"bytes32[]"},{"internalType":"uint256[]","name":"timestamp","type":"uint256[]"},{"internalType":"bytes[]","name":"signature","type":"bytes[]"}],"internalType":"struct CausalityParams","name":"_causalityParams","type":"tuple"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voyageId","type":"uint256"}],"name":"cleanVoyageResults","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dps","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dpsFeatures","outputs":[{"internalType":"contract DPSPirateFeaturesI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flagship","outputs":[{"internalType":"contract DPSFlagshipI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameSettings","outputs":[{"internalType":"contract DPSGameSettingsI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_voyageId","type":"uint256"}],"name":"getFinishedVoyageByOwnerAndId","outputs":[{"components":[{"internalType":"uint256","name":"voyageId","type":"uint256"},{"internalType":"uint256","name":"dpsId","type":"uint256"},{"internalType":"uint256","name":"flagshipId","type":"uint256"},{"internalType":"uint256[]","name":"supportShipIds","type":"uint256[]"},{"internalType":"uint256","name":"artifactId","type":"uint256"},{"internalType":"uint256","name":"lockedBlock","type":"uint256"},{"internalType":"uint256","name":"lockedTimestamp","type":"uint256"},{"internalType":"uint256","name":"claimedTime","type":"uint256"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"}],"internalType":"struct LockedVoyage","name":"finished","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"getFinishedVoyagesForOwner","outputs":[{"components":[{"internalType":"uint256","name":"voyageId","type":"uint256"},{"internalType":"uint256","name":"dpsId","type":"uint256"},{"internalType":"uint256","name":"flagshipId","type":"uint256"},{"internalType":"uint256[]","name":"supportShipIds","type":"uint256[]"},{"internalType":"uint256","name":"artifactId","type":"uint256"},{"internalType":"uint256","name":"lockedBlock","type":"uint256"},{"internalType":"uint256","name":"lockedTimestamp","type":"uint256"},{"internalType":"uint256","name":"claimedTime","type":"uint256"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"}],"internalType":"struct LockedVoyage[]","name":"finished","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voyageId","type":"uint256"}],"name":"getLastComputedState","outputs":[{"components":[{"internalType":"uint16","name":"awardedChests","type":"uint16"},{"internalType":"uint16","name":"destroyedSupportShips","type":"uint16"},{"internalType":"uint8","name":"healthDamage","type":"uint8"},{"internalType":"uint16","name":"skippedInteractions","type":"uint16"},{"internalType":"uint16[]","name":"interactionRNGs","type":"uint16[]"},{"internalType":"uint8[]","name":"interactionResults","type":"uint8[]"}],"internalType":"struct VoyageResult","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_voyageId","type":"uint256"}],"name":"getLockedVoyageByOwnerAndId","outputs":[{"components":[{"internalType":"uint256","name":"voyageId","type":"uint256"},{"internalType":"uint256","name":"dpsId","type":"uint256"},{"internalType":"uint256","name":"flagshipId","type":"uint256"},{"internalType":"uint256[]","name":"supportShipIds","type":"uint256[]"},{"internalType":"uint256","name":"artifactId","type":"uint256"},{"internalType":"uint256","name":"lockedBlock","type":"uint256"},{"internalType":"uint256","name":"lockedTimestamp","type":"uint256"},{"internalType":"uint256","name":"claimedTime","type":"uint256"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"}],"internalType":"struct LockedVoyage","name":"locked","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voyageId","type":"uint256"}],"name":"getLockedVoyageOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"getLockedVoyagesForOwner","outputs":[{"components":[{"internalType":"uint256","name":"voyageId","type":"uint256"},{"internalType":"uint256","name":"dpsId","type":"uint256"},{"internalType":"uint256","name":"flagshipId","type":"uint256"},{"internalType":"uint256[]","name":"supportShipIds","type":"uint256[]"},{"internalType":"uint256","name":"artifactId","type":"uint256"},{"internalType":"uint256","name":"lockedBlock","type":"uint256"},{"internalType":"uint256","name":"lockedTimestamp","type":"uint256"},{"internalType":"uint256","name":"claimedTime","type":"uint256"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"}],"internalType":"struct LockedVoyage[]","name":"locked","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"voyageId","type":"uint256"},{"internalType":"uint256","name":"dpsId","type":"uint256"},{"internalType":"uint256","name":"flagshipId","type":"uint256"},{"internalType":"uint256[]","name":"supportShipIds","type":"uint256[]"},{"internalType":"uint256","name":"artifactId","type":"uint256"},{"internalType":"uint256","name":"lockedBlock","type":"uint256"},{"internalType":"uint256","name":"lockedTimestamp","type":"uint256"},{"internalType":"uint256","name":"claimedTime","type":"uint256"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"}],"internalType":"struct LockedVoyage","name":"_lockedVoyage","type":"tuple"}],"name":"lockVoyageItems","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"address","name":"_destination","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recover1155NFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_destination","type":"address"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"address","name":"_destination","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"recoverNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setArtifactContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setCartographerContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setCausalityContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setChestsContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setDpsContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setDpsPirateFeaturesContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setFlagshipContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setGameSettingsContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setSupportShipContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setVoyageContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supportShip","outputs":[{"internalType":"contract DPSSupportShipI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voyage","outputs":[{"internalType":"contract DPSVoyageI","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506001600055620000223362000028565b6200007a565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b615d5c806200008a6000396000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c8063886f039a11610130578063ddbf6c5b116100b8578063f8ff888e1161007c578063f8ff888e146104f3578063f9a40af314610506578063f9ae4cb614610519578063fcb601b81461052c578063ffd7593c1461053f57600080fd5b8063ddbf6c5b14610494578063e012d8d3146104a7578063e4eb9593146104ba578063ea68ba8e146104cd578063f2fde38b146104e057600080fd5b8063a31ad6ed116100ff578063a31ad6ed14610428578063b7297cf31461043b578063b9f37e3f1461044e578063c98ec5c914610461578063d970d60f1461048157600080fd5b8063886f039a146103de5780638da5cb5b146103f1578063a09620fb14610402578063a1e40df81461041557600080fd5b806343f4089e116101b357806364026ac01161018257806364026ac01461038a578063647aba301461039d5780636f6b866d146103b0578063715018a6146103c357806380f669fd146103cb57600080fd5b806343f4089e1461033157806360d2f9c614610344578063613a3cea1461035757806362c2fd6b1461037757600080fd5b80633070c19b116101fa5780633070c19b146102975780633086f74d146102b75780633c2f22bc146102e257806341dd7a41146102f5578063431211d81461030857600080fd5b80625775561461022b5780630d7f503514610240578063150b7a02146102535780631791133814610284575b600080fd5b61023e610239366004614d6d565b610552565b005b61023e61024e366004614e86565b610cd7565b610266610261366004614ec7565b610dd5565b6040516001600160e01b031990911681526020015b60405180910390f35b61023e610292366004614f65565b610e41565b6102aa6102a5366004614d6d565b610ea8565b60405161027b9190614fbc565b6006546102ca906001600160a01b031681565b6040516001600160a01b03909116815260200161027b565b6007546102ca906001600160a01b031681565b61023e610303366004615065565b61115c565b6102ca610316366004614f65565b6000908152601160205260409020546001600160a01b031690565b61023e61033f366004615065565b611225565b61023e610352366004615065565b6112a4565b61036a610365366004615082565b61132c565b60405161027b919061517d565b6008546102ca906001600160a01b031681565b600b546102ca906001600160a01b031681565b6009546102ca906001600160a01b031681565b61023e6103be366004615190565b6114a9565b61023e6115c2565b61023e6103d9366004615065565b6115f8565b61023e6103ec3660046151d6565b61167d565b6001546001600160a01b03166102ca565b6004546102ca906001600160a01b031681565b61023e610423366004615065565b6117a1565b61023e610436366004615065565b611825565b600a546102ca906001600160a01b031681565b6002546102ca906001600160a01b031681565b61047461046f366004615065565b6118ac565b60405161027b919061520f565b6005546102ca906001600160a01b031681565b61023e6104a2366004615065565b611a9c565b6102aa6104b5366004614f65565b611b1e565b6104746104c8366004615065565b611c71565b61023e6104db366004615065565b611e5b565b61023e6104ee366004615065565b611ee3565b61023e610501366004615065565b611f7e565b61023e61051436600461528c565b611fff565b61023e610527366004615065565b612b07565b61036a61053a366004615082565b612b89565b6003546102ca906001600160a01b031681565b600260005414156105aa5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026000908155828152601160205260409020546001600160a01b031680825261060f5760405162461bcd60e51b8152602060048201526016602482015275566f7961676520646f6573206e6f742065786973747360501b60448201526064016105a1565b80516001600160a01b039081166000908152600c602090815260408083208684529091529081902060025491516331a9108f60e11b815260048101869052909230921690636352211e9060240160206040518083038186803b15801561067457600080fd5b505afa158015610688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ac919061537d565b6001600160a01b03161480156106c25750805415155b6107035760405162461bcd60e51b8152602060048201526012602482015271159bde5859d9481b9bdd081cdd185c9d195960721b60448201526064016105a1565b60095460405163712796e560e01b81526000916001600160a01b03169063712796e59061073690869088906004016153f2565b60006040518083038186803b15801561074e57600080fd5b505afa158015610762573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261078a919081019061556a565b9050428160a00151826020015160ff166107a4919061563c565b83600601546107b3919061565b565b11156107f75760405162461bcd60e51b8152602060048201526013602482015272159bde5859d9481b9bdd08199a5b9a5cda1959606a1b60448201526064016105a1565b8060400151816020015160ff1661080e9190615673565b61ffff168260050154610821919061565b565b43116108835760405162461bcd60e51b815260206004820152602b60248201527f566f796167652063616e27742062652066696e69736865642c206e656564732060448201526a6d6f726520626c6f636b7360a81b60648201526084016105a1565b60008360200151511180156108a157508260a0015151836020015151145b6108ed5760405162461bcd60e51b815260206004820152601e60248201527f43617573616c69747920706172616d732061726520696e636f7272656374000060448201526064016105a1565b6109ce838284604051806101600160405290816000820154815260200160018201548152602001600282015481526020016003820180548060200260200160405190810160405280929190818152602001828054801561096c57602002820191906000526020600020905b815481526020019060010190808311610958575b50505091835250506004820154602082015260058201546040820152600682015460608201526007820154608082015260089091015461ffff80821660a0840152620100008204811660c0840152600160201b9091041660e090910152612cfd565b60006109db838386612f34565b42600785015584516001600160a01b03166000908152600d60209081526040808320875480855292529091209081556001808601549082015560028086015490820155600380860180549394508693610a379284019190614818565b50600482810154908201556005808301549082015560068083015490820155600780830154908201556008918201805492909101805461ffff93841661ffff19821681178355835463ffffffff1992831690911762010000918290048616820217808455935465ffff0000000019909416600160201b94859004861685021790925587516001600160a01b03166000908152600f602090815260408083208a5481546001818101845592865284862001558c84526010835292819020885181548a850151938b015160608c0151928b1691909716179289169096029190911766ffffff00000000191660ff90941690950266ffff0000000000191692909217650100000000009390951692909202939093178255608084015180518594610b62938501920190614868565b5060a08201518051610b7e91600284019160209091019061490c565b50905050610c69818360000151856040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201805480602002602001604051908101604052809291908181526020018280548015610c0557602002820191906000526020600020905b815481526020019060010190808311610bf1575b50505091835250506004820154602082015260058201546040820152600682015460608201526007820154608082015260089091015461ffff80821660a0840152620100008204811660c0840152600160201b9091041660e0909101528751613675565b82548451610c7791906139eb565b847f12fc7d70e13f4b15f379d74f3aa5744bf1cbd08c49934dc59d935c9df757b95482600001518360200151846040015185608001518660a00151604051610cc395949392919061569d565b60405180910390a250506001600055505050565b6001546001600160a01b03163314610d015760405162461bcd60e51b81526004016105a190615719565b6001600160a01b038216610d275760405162461bcd60e51b81526004016105a19061574e565b604051632142170760e11b81526001600160a01b038416906342842e0e90610d5790309086908690600401615783565b600060405180830381600087803b158015610d7157600080fd5b505af1158015610d85573d6000803e3d6000fd5b5050604080516001600160a01b03868116825260208201869052871693507f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f90969250015b60405180910390a2505050565b60006001600160a01b0386163014610e2f5760405162461bcd60e51b815260206004820152601960248201527f416363657074696e67206f6e6c792066726f6d20446f636b730000000000000060448201526064016105a1565b50630a85bd0160e11b95945050505050565b6001546001600160a01b03163314610e6b5760405162461bcd60e51b81526004016105a190615719565b6000818152601060205260408120805466ffffffffffffff1916815590610e9560018301826149a0565b610ea36002830160006149c5565b505050565b610eb06149ea565b6000838152601160205260409020546001600160a01b03166001600160a01b039081168084526000908152600c602090815260408083208784529091529081902060025491516331a9108f60e11b815260048101879052909230921690636352211e9060240160206040518083038186803b158015610f2e57600080fd5b505afa158015610f42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f66919061537d565b6001600160a01b0316148015610f7c5750805415155b610fbd5760405162461bcd60e51b8152602060048201526012602482015271159bde5859d9481b9bdd081cdd185c9d195960721b60448201526064016105a1565b60095460405163712796e560e01b81526000916001600160a01b03169063712796e590610ff090879089906004016153f2565b60006040518083038186803b15801561100857600080fd5b505afa15801561101c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611044919081019061556a565b90508060a0015182600601544261105b91906157a7565b1161109f5760405162461bcd60e51b8152602060048201526014602482015273159bde5859d948191a59081b9bdd081cdd185c9d60621b60448201526064016105a1565b60008160a001518360060154426110b691906157a7565b6110c091906157be565b90508160600151518111156110d757506060810151515b60608201515160005b6110ea83836157a7565b811015611143576060840151600090600161110584866157a7565b61110f91906157a7565b8151811061111f5761111f6157e0565b60ff909216602092830291909101909101528061113b816157f6565b9150506110e0565b5061114f848488612f34565b9450505050505b92915050565b6001546001600160a01b031633146111865760405162461bcd60e51b81526004016105a190615719565b6001600160a01b0381166111ac5760405162461bcd60e51b81526004016105a190615811565b600780546001600160a01b0319166001600160a01b0383161790556040516a0537570706f7274536869760ac1b8152600b015b6040519081900381206001600160a01b0383168252907fbf2cc7083b32d1f5c82633af784e1285df86eb43c88d0752feea4bebb4a0b6d29060200160405180910390a250565b6001546001600160a01b0316331461124f5760405162461bcd60e51b81526004016105a190615719565b6001600160a01b0381166112755760405162461bcd60e51b81526004016105a190615811565b600480546001600160a01b0319166001600160a01b0383161790556040516244505360e81b81526003016111df565b6001546001600160a01b031633146112ce5760405162461bcd60e51b81526004016105a190615719565b6001600160a01b0381166112f45760405162461bcd60e51b81526004016105a190615811565b600980546001600160a01b0319166001600160a01b0383161790556040516b21b0b93a37b3b930b83432b960a11b8152600c016111df565b611334614a2f565b60005b6001600160a01b0384166000908152600e60205260409020548110156114a2576001600160a01b0384166000908152600e60205260408120805483908110611381576113816157e0565b906000526020600020015490508381141561148f576001600160a01b0385166000908152600c6020908152604080832084845282529182902082516101608101845281548152600182015481840152600282015481850152600382018054855181860281018601909652808652919492936060860193929083018282801561142857602002820191906000526020600020905b815481526020019060010190808311611414575b50505091835250506004820154602082015260058201546040820152600682015460608201526007820154608082015260089091015461ffff80821660a0840152620100008204811660c0840152600160201b9091041660e0909101529250611156915050565b508061149a816157f6565b915050611337565b5092915050565b6001546001600160a01b031633146114d35760405162461bcd60e51b81526004016105a190615719565b6001600160a01b0383166114f95760405162461bcd60e51b81526004016105a19061574e565b604051637921219560e11b81523060048201526001600160a01b038481166024830152604482018490526064820183905260a06084830152600060a483015285169063f242432a9060c401600060405180830381600087803b15801561155e57600080fd5b505af1158015611572573d6000803e3d6000fd5b5050604080516001600160a01b03878116825260208201879052881693507f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f909692500160405180910390a250505050565b6001546001600160a01b031633146115ec5760405162461bcd60e51b81526004016105a190615719565b6115f66000613b42565b565b6001546001600160a01b031633146116225760405162461bcd60e51b81526004016105a190615719565b6001600160a01b0381166116485760405162461bcd60e51b81526004016105a190615811565b600380546001600160a01b0319166001600160a01b0383161790556040516843617573616c69747960b81b81526009016111df565b6001546001600160a01b031633146116a75760405162461bcd60e51b81526004016105a190615719565b6001600160a01b0381166116cd5760405162461bcd60e51b81526004016105a19061574e565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611747919061583f565b905061175e6001600160a01b038416308484613b94565b604080516001600160a01b038481168252602082018490528516917f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f90969101610dc8565b6001546001600160a01b031633146117cb5760405162461bcd60e51b81526004016105a190615719565b6001600160a01b0381166117f15760405162461bcd60e51b81526004016105a190615811565b600680546001600160a01b0319166001600160a01b038316179055604051670466c6167736869760c41b81526008016111df565b6001546001600160a01b0316331461184f5760405162461bcd60e51b81526004016105a190615719565b6001600160a01b0381166118755760405162461bcd60e51b81526004016105a190615811565b600580546001600160a01b0319166001600160a01b0383161790556040516a445053466561747572657360a81b8152600b016111df565b6001600160a01b0381166000908152600f60205260409020546060906001600160401b038111156118df576118df614aff565b60405190808252806020026020018201604052801561191857816020015b611905614a2f565b8152602001906001900390816118fd5790505b50905060005b6001600160a01b0383166000908152600f6020526040902054811015611a96576001600160a01b0383166000908152600d60209081526040808320600f9092528220805491929184908110611975576119756157e0565b906000526020600020015481526020019081526020016000206040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201805480602002602001604051908101604052809291908181526020018280548015611a0757602002820191906000526020600020905b8154815260200190600101908083116119f3575b50505091835250506004820154602082015260058201546040820152600682015460608201526007820154608082015260089091015461ffff80821660a0840152620100008204811660c0840152600160201b9091041660e0909101528251839083908110611a7857611a786157e0565b60200260200101819052508080611a8e906157f6565b91505061191e565b50919050565b6001546001600160a01b03163314611ac65760405162461bcd60e51b81526004016105a190615719565b6001600160a01b038116611aec5760405162461bcd60e51b81526004016105a190615811565b600280546001600160a01b0319166001600160a01b03831617905560405165566f7961676560d01b81526006016111df565b611b266149ea565b600082815260106020908152604091829020825160c081018452815461ffff808216835262010000820481168386015260ff600160201b83041683870152650100000000009091041660608201526001820180548551818602810186019096528086529194929360808601939290830182828015611beb57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411611bb25790505b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015611c6157602002820191906000526020600020906000905b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411611c325790505b5050505050815250509050919050565b6001600160a01b0381166000908152600e60205260409020546060906001600160401b03811115611ca457611ca4614aff565b604051908082528060200260200182016040528015611cdd57816020015b611cca614a2f565b815260200190600190039081611cc25790505b50905060005b6001600160a01b0383166000908152600e6020526040902054811015611a96576001600160a01b0383166000908152600c60209081526040808320600e9092528220805491929184908110611d3a57611d3a6157e0565b906000526020600020015481526020019081526020016000206040518061016001604052908160008201548152602001600182015481526020016002820154815260200160038201805480602002602001604051908101604052809291908181526020018280548015611dcc57602002820191906000526020600020905b815481526020019060010190808311611db8575b50505091835250506004820154602082015260058201546040820152600682015460608201526007820154608082015260089091015461ffff80821660a0840152620100008204811660c0840152600160201b9091041660e0909101528251839083908110611e3d57611e3d6157e0565b60200260200101819052508080611e53906157f6565b915050611ce3565b6001546001600160a01b03163314611e855760405162461bcd60e51b81526004016105a190615719565b6001600160a01b038116611eab5760405162461bcd60e51b81526004016105a190615811565b600a80546001600160a01b0319166001600160a01b0383161790556040516b47616d6553657474696e677360a01b8152600c016111df565b6001546001600160a01b03163314611f0d5760405162461bcd60e51b81526004016105a190615719565b6001600160a01b038116611f725760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105a1565b611f7b81613b42565b50565b6001546001600160a01b03163314611fa85760405162461bcd60e51b81526004016105a190615719565b6001600160a01b038116611fce5760405162461bcd60e51b81526004016105a190615811565b600b80546001600160a01b0319166001600160a01b0383161790556040516410da195cdd60da1b81526005016111df565b600260005414156120525760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a1565b6002600055600a5460405163bc61e73360e01b8152600160048201526001600160a01b039091169063bc61e7339060240160206040518083038186803b15801561209b57600080fd5b505afa1580156120af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d39190615858565b60ff161561210c5760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b60448201526064016105a1565b805161214b5760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420566f7961676560901b60448201526064016105a1565b60025481516040516331a9108f60e11b8152600481019190915233916001600160a01b031690636352211e9060240160206040518083038186803b15801561219257600080fd5b505afa1580156121a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ca919061537d565b6001600160a01b0316146122205760405162461bcd60e51b815260206004820152601960248201527f596f7520646f6e2774206f7765207468697320766f796167650000000000000060448201526064016105a1565b6004805460208301516040516331a9108f60e11b81529283015233916001600160a01b0390911690636352211e9060240160206040518083038186803b15801561226957600080fd5b505afa15801561227d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a1919061537d565b6001600160a01b0316146122f05760405162461bcd60e51b8152602060048201526016602482015275596f7520646f6e2774206f776520746869732064707360501b60448201526064016105a1565b60065460408281015190516331a9108f60e11b8152600481019190915233916001600160a01b031690636352211e9060240160206040518083038186803b15801561233a57600080fd5b505afa15801561234e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612372919061537d565b6001600160a01b0316146123c85760405162461bcd60e51b815260206004820152601b60248201527f596f7520646f6e2774206f7765207468697320666c616773686970000000000060448201526064016105a1565b600654604080830151905163a3df934f60e01b81526001600160a01b039092169163a3df934f916123ff9160040190815260200190565b60e06040518083038186803b15801561241757600080fd5b505afa15801561242b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244f9190615873565b5160ff166064146124955760405162461bcd60e51b815260206004820152601060248201526f119b1859dcda1a5c0819185b5859d95960821b60448201526064016105a1565b336000908152600c6020908152604080832084518452909152902054156124fe5760405162461bcd60e51b815260206004820152601e60248201527f5468697320566f7961676520697320616c72656164792073746172746564000060448201526064016105a1565b336000908152600d6020908152604080832084518452909152902054156125675760405162461bcd60e51b815260206004820152601760248201527f5468697320566f796167652069732066696e697368656400000000000000000060448201526064016105a1565b6060810151511561268e5760005b81606001515181101561268c576007546060830151805133926001600160a01b031691636352211e91859081106125ae576125ae6157e0565b60200260200101516040518263ffffffff1660e01b81526004016125d491815260200190565b60206040518083038186803b1580156125ec57600080fd5b505afa158015612600573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612624919061537d565b6001600160a01b03161461267a5760405162461bcd60e51b815260206004820152601d60248201527f537570706f72742073686970206e6f74206f776e656420627920796f7500000060448201526064016105a1565b80612684816157f6565b915050612575565b505b60025481516040516352a701e360e01b815260048101919091526000916001600160a01b0316906352a701e39060240160006040518083038186803b1580156126d657600080fd5b505afa1580156126ea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612712919081019061556a565b9050806020015160ff16816040015161272b9190615673565b61ffff16816080015161273e919061565b565b61274990600261565b565b43116127975760405162461bcd60e51b815260206004820152601a60248201527f566f796167652067656e65726174696f6e206e6f7420646f6e6500000000000060448201526064016105a1565b4360a08301524260c0830152600060e08301819052610100830181905261012083018190526101408301819052338152600c6020908152604080832085518452825291829020845181558185015160018201559184015160028301556060840151805185939261280e926003850192910190614a95565b50608082015160048083019190915560a0830151600583015560c0830151600683015560e08301516007830155610100830151600890920180546101208501516101409095015161ffff908116600160201b0265ffff0000000019968216620100000263ffffffff199093169190951617179390931691909117909155336000818152600e60209081526040808320875181546001810183559185528385209091015586518352601182529182902080546001600160a01b031916841790558354908601519151632142170760e11b81526001600160a01b0391909116936342842e0e93612900939092309201615783565b600060405180830381600087803b15801561291a57600080fd5b505af115801561292e573d6000803e3d6000fd5b50506006546040808601519051632142170760e11b81526001600160a01b0390921693506342842e0e92506129699133913091600401615783565b600060405180830381600087803b15801561298357600080fd5b505af1158015612997573d6000803e3d6000fd5b5050505060005b826060015151811015612a4757600754606084015180516001600160a01b03909216916342842e0e913391309190869081106129dc576129dc6157e0565b60200260200101516040518463ffffffff1660e01b8152600401612a0293929190615783565b600060405180830381600087803b158015612a1c57600080fd5b505af1158015612a30573d6000803e3d6000fd5b505050508080612a3f906157f6565b91505061299e565b506002548251604051632142170760e11b81526001600160a01b03909216916342842e0e91612a7c9133913091600401615783565b600060405180830381600087803b158015612a9657600080fd5b505af1158015612aaa573d6000803e3d6000fd5b505050508160400151826020015183600001517f6fa242eeaf9df98bd980632a1306b3992ebd368677b7f320cad215f74497f99985606001518660800151604051612af69291906158f0565b60405180910390a450506001600055565b6001546001600160a01b03163314612b315760405162461bcd60e51b81526004016105a190615719565b6001600160a01b038116612b575760405162461bcd60e51b81526004016105a190615811565b600880546001600160a01b0319166001600160a01b03831617815560405167105c9d1a599858dd60c21b8152016111df565b612b91614a2f565b60005b6001600160a01b0384166000908152600f60205260409020548110156114a2576001600160a01b0384166000908152600f60205260408120805483908110612bde57612bde6157e0565b9060005260206000200154905083811415612cea576001600160a01b0385166000908152600d6020908152604080832084845282529182902082516101608101845281548152600182015481840152600282015481850152600382018054855181860281018601909652808652919492936060860193929083018282801561142857602002820191906000526020600020908154815260200190600101908083116114145750505091835250506004820154602082015260058201546040820152600682015460608201526007820154608082015260089091015461ffff80821660a0840152620100008204811660c0840152600160201b9091041660e0909101529250611156915050565b5080612cf5816157f6565b915050612b94565b60005b6020830151612d10906002615912565b60ff16811015612e295783602001518181518110612d3057612d306157e0565b60200260200101518360800151846040015161ffff16836001612d53919061565b565b612d5d919061563c565b612d67919061565b565b505083602001518181518110612d7f57612d7f6157e0565b60200260200101518360800151846040015161ffff16836001612da2919061565b565b612dac919061563c565b612db6919061565b565b14612e175760405162461bcd60e51b815260206004820152602b60248201527f43617573616c69747920706172616d73206f6620626f7567687420626c6f636b60448201526a73206172652077726f6e6760a81b60648201526084016105a1565b80612e21816157f6565b915050612d00565b506020820151600190600090612e40906002615912565b60ff1690505b6020840151612e56906002615937565b612e61906002615912565b60ff16811015612f2d5784602001518181518110612e8157612e816157e0565b60200260200101518360a00151856040015161ffff1684612ea2919061563c565b612eac919061565b565b14612f0d5760405162461bcd60e51b815260206004820152602b60248201527f43617573616c69747920706172616d73206f66206c6f636b656420626c6f636b60448201526a73206172652077726f6e6760a81b60648201526084016105a1565b81612f17816157f6565b9250508080612f25906157f6565b915050612e46565b5050505050565b612f3c6149ea565b612f676040518060800160405280600081526020016000815260200160008152602001600081525090565b600184602001516002612f7a9190615912565b612f849190615960565b60ff16606082015260055460018601546040516306814e3960e31b815261ffff90911660048201526000916001600160a01b03169063340a71c89060240160006040518083038186803b158015612fda57600080fd5b505afa158015612fee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261301691908101906159f9565b805190925061ffff1615801591506130355750602081015161ffff1615155b80156130485750604081015161ffff1615155b6130875760405162461bcd60e51b815260206004820152601060248201526f151c985a5d1cc81b9bdd08199bdd5b9960821b60448201526064016105a1565b805160208301805161ffff909216916130a190839061565b565b905250806001602002015161ffff16826040018181516130c1919061565b565b905250806002602002015161ffff16826000018181516130e1919061565b565b90525060028601546130f39083613bf2565b91506131518660030180548060200260200160405190810160405280929190818152602001828054801561314657602002820191906000526020600020905b815481526020019060010190808311613132575b50505050508361400a565b915061315b6149ea565b600a54604080516333598eb760e21b815290516000926001600160a01b03169163cd663adc916004808301926020929190829003018186803b1580156131a057600080fd5b505afa1580156131b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131d89190615ae2565b61ffff1690508660600151516001600160401b038111156131fb576131fb614aff565b604051908082528060200260200182016040528015613224578160200160208202803683370190505b5060a08301526060870151516001600160401b0381111561324757613247614aff565b604051908082528060200260200182016040528015613270578160200160208202803683370190505b50608083015260005b8760600151518110156136665760008860600151828151811061329e5761329e6157e0565b602002602001015160ff1660038111156132ba576132ba6158da565b905060008160038111156132d0576132d06158da565b14806132e35750836040015160ff166064145b1561330657606084018051906132f882615aff565b61ffff169052506136549050565b60608601805190613316826157f6565b90525060a088015151600090156134ae57600354895160208b015160608a015181516001600160a01b0390941693636917123393929190811061335b5761335b6157e0565b60200260200101518c604001518b606001518151811061337d5761337d6157e0565b60200260200101518d606001518c606001518151811061339f5761339f6157e0565b60200260200101518e608001518d60600151815181106133c1576133c16157e0565b60200260200101518f60a001518e60600151815181106133e3576133e36157e0565b60200260200101518e6060015160405160200161342191907112539511549050d51253d397d49154d5531560721b8152601281019190915260320190565b60405160208183030381529060405260008d6040518a63ffffffff1660e01b815260040161345799989796959493929190615b21565b60206040518083038186803b15801561346f57600080fd5b505afa158015613483573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134a7919061583f565b905061360e565b600354895160208b015160608a015181516001600160a01b0390941693638d91cb339392919081106134e2576134e26157e0565b60200260200101518c604001518b6060015181518110613504576135046157e0565b60200260200101518d606001518c6060015181518110613526576135266157e0565b60200260200101518e608001518d6060015181518110613548576135486157e0565b60200260200101518d6060015160405160200161358691907112539511549050d51253d397d49154d5531560721b8152601281019190915260320190565b60405160208183030381529060405260008c6040518963ffffffff1660e01b81526004016135bb989796959493929190615b89565b60206040518083038186803b1580156135d357600080fd5b505afa1580156135e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061360b919061583f565b90505b61361c81868d8a868861423e565b8098508196505050808560800151848151811061363b5761363b6157e0565b602002602001019061ffff16908161ffff168152505050505b8061365e816157f6565b915050613279565b509093505050505b9392505050565b600b548451604051632769c3d960e11b81526001600160a01b0390921691634ed387b2916136a99185918891600401615bdb565b600060405180830381600087803b1580156136c357600080fd5b505af11580156136d7573d6000803e3d6000fd5b5050600480546020860151604051632142170760e11b81526001600160a01b0390921694506342842e0e935061371292309287929101615783565b600060405180830381600087803b15801561372c57600080fd5b505af1158015613740573d6000803e3d6000fd5b50505050604084015160ff16156137cf57600654604080840151908601516001600160a01b0390921691639a5558399160009161377e906064615960565b6040518463ffffffff1660e01b815260040161379c93929190615c13565b600060405180830381600087803b1580156137b657600080fd5b505af11580156137ca573d6000803e3d6000fd5b505050505b6006546040808401519051632142170760e11b81526001600160a01b03909216916342842e0e916138069130918691600401615783565b600060405180830381600087803b15801561382057600080fd5b505af1158015613834573d6000803e3d6000fd5b5050505060005b82606001515181101561397e57846020015161ffff168110156138e257600754606084015180516001600160a01b03909216916342966c68919084908110613885576138856157e0565b60200260200101516040518263ffffffff1660e01b81526004016138ab91815260200190565b600060405180830381600087803b1580156138c557600080fd5b505af11580156138d9573d6000803e3d6000fd5b5050505061396c565b600754606084015180516001600160a01b03909216916342842e0e91309186919086908110613913576139136157e0565b60200260200101516040518463ffffffff1660e01b815260040161393993929190615783565b600060405180830381600087803b15801561395357600080fd5b505af1158015613967573d6000803e3d6000fd5b505050505b80613976816157f6565b91505061383b565b506002548251604051630852cd8d60e31b81526001600160a01b03909216916342966c68916139b39160040190815260200190565b600060405180830381600087803b1580156139cd57600080fd5b505af11580156139e1573d6000803e3d6000fd5b5050505050505050565b6001600160a01b0381166000908152600e60205260408120905b8154811015613ab65783828281548110613a2157613a216157e0565b90600052602060002001541415613aa45781548290613a42906001906157a7565b81548110613a5257613a526157e0565b9060005260206000200154828281548110613a6f57613a6f6157e0565b906000526020600020018190555081805480613a8d57613a8d615c3e565b600190038181906000526020600020016000905590555b80613aae816157f6565b915050613a05565b50600083815260116020908152604080832080546001600160a01b03191690556001600160a01b0385168352600c82528083208684529091528120818155600181018290556002810182905590613b106003830182614ad0565b5060006004820181905560058201819055600682018190556007820155600801805465ffffffffffff19169055505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b613bec846323b872dd60e01b858585604051602401613bb593929190615783565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526145ce565b50505050565b613c1d6040518060800160405280600081526020016000815260200160008152602001600081525090565b60065460405163a3df934f60e01b8152600481018590526000916001600160a01b03169063a3df934f9060240160e06040518083038186803b158015613c6257600080fd5b505afa158015613c76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c9a9190615873565b90506000600a60009054906101000a90046001600160a01b03166001600160a01b031663bdd1e0806040518163ffffffff1660e01b815260040160e06040518083038186803b158015613cec57600080fd5b505afa158015613d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d249190615c54565b90506000600a60009054906101000a90046001600160a01b03166001600160a01b031663904b33d36040518163ffffffff1660e01b815260040160e06040518083038186803b158015613d7657600080fd5b505afa158015613d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dae9190615873565b90506000600a60009054906101000a90046001600160a01b03166001600160a01b031663975be4576040518163ffffffff1660e01b815260040160206040518083038186803b158015613e0057600080fd5b505afa158015613e14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e389190615ae2565b61ffff1690508086602001818151613e50919061565b565b905250604086018051829190613e6790839061565b565b905250855181908790613e7b90839061565b565b90525060005b6007811015613ffe576000838260078110613e9e57613e9e6157e0565b602002015160ff161415613f0057848160078110613ebe57613ebe6157e0565b602002015160ff16848260078110613ed857613ed86157e0565b6020020151613ee79190615673565b61ffff1687602001818151613efc919061565b565b9052505b6002838260078110613f1457613f146157e0565b602002015160ff161415613f7657848160078110613f3457613f346157e0565b602002015160ff16848260078110613f4e57613f4e6157e0565b6020020151613f5d9190615673565b61ffff1687604001818151613f72919061565b565b9052505b6001838260078110613f8a57613f8a6157e0565b602002015160ff161415613fec57848160078110613faa57613faa6157e0565b602002015160ff16848260078110613fc457613fc46157e0565b6020020151613fd39190615673565b61ffff1687600001818151613fe8919061565b565b9052505b80613ff6816157f6565b915050613e81565b50949695505050505050565b6140356040518060800160405280600081526020016000815260200160008152602001600081525090565b60005b835181101561423657600754845160009182916001600160a01b039091169063d3f161ac9088908690811061406f5761406f6157e0565b60200260200101516040518263ffffffff1660e01b815260040161409591815260200190565b604080518083038186803b1580156140ac57600080fd5b505afa1580156140c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140e49190615cb2565b909250905060008160088111156140fd576140fd6158da565b148061411a57506003816008811115614118576141186158da565b145b8061413657506006816008811115614134576141346158da565b145b1561415157818560000181815161414d919061565b565b9052505b6001816008811115614165576141656158da565b148061418257506004816008811115614180576141806158da565b145b8061419e5750600781600881111561419c5761419c6158da565b145b156141b95781856020018181516141b5919061565b565b9052505b60028160088111156141cd576141cd6158da565b14806141ea575060058160088111156141e8576141e86158da565b145b8061420657506008816008811115614204576142046158da565b145b1561422157818560400181815161421d919061565b565b9052505b5050808061422e906157f6565b915050614038565b509092915050565b6142466149ea565b6142716040518060800160405280600081526020016000815260200160008152602001600081525090565b6001846003811115614285576142856158da565b148015614296575084602001518811155b156142e4578651876142a782615aff565b61ffff1661ffff168152505060018760a0015184815181106142cb576142cb6157e0565b602002602001019060ff16908160ff16815250506145c0565b60028460038111156142f8576142f86158da565b1480156143085750846040015188115b8061432f57506003846003811115614322576143226158da565b14801561432f5750845188115b1561457a576000876020015161ffff16876003018054905061435191906157a7565b111561456e576020870180519061436782615aff565b61ffff16905250600754602088015160009182916001600160a01b039091169063d3f161ac9060038b019061439e90600190615cdb565b61ffff16815481106143b2576143b26157e0565b90600052602060002001546040518263ffffffff1660e01b81526004016143db91815260200190565b604080518083038186803b1580156143f257600080fd5b505afa158015614406573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061442a9190615cb2565b90925090506000816008811115614443576144436158da565b14806144605750600381600881111561445e5761445e6158da565b145b8061447c5750600681600881111561447a5761447a6158da565b145b1561449757818760000181815161449391906157a7565b9052505b60018160088111156144ab576144ab6158da565b14806144c8575060048160088111156144c6576144c66158da565b145b806144e4575060078160088111156144e2576144e26158da565b145b156144ff5781876020018181516144fb91906157a7565b9052505b6002816008811115614513576145136158da565b14806145305750600581600881111561452e5761452e6158da565b145b8061454c5750600881600881111561454a5761454a6158da565b145b1561456757818760400181815161456391906157a7565b9052505b50506145c0565b606460408801526145c0565b600184600381111561458e5761458e6158da565b146145c05760018760a0015184815181106145ab576145ab6157e0565b602002602001019060ff16908160ff16815250505b509496929550919350505050565b6000614623826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166146a09092919063ffffffff16565b805190915015610ea357808060200190518101906146419190615cfe565b610ea35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105a1565b60606146af84846000856146b7565b949350505050565b6060824710156147185760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105a1565b843b6147665760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105a1565b600080866001600160a01b031685876040516147829190615d20565b60006040518083038185875af1925050503d80600081146147bf576040519150601f19603f3d011682016040523d82523d6000602084013e6147c4565b606091505b50915091506147d48282866147df565b979650505050505050565b606083156147ee57508161366e565b8251156147fe5782518084602001fd5b8160405162461bcd60e51b81526004016105a19190615d3c565b8280548282559060005260206000209081019282156148585760005260206000209182015b8281111561485857825482559160010191906001019061483d565b50614864929150614aea565b5090565b82805482825590600052602060002090600f016010900481019282156148585791602002820160005b838211156148d157835183826101000a81548161ffff021916908361ffff1602179055509260200192600201602081600101049283019260010302614891565b80156148ff5782816101000a81549061ffff02191690556002016020816001010492830192600103026148d1565b5050614864929150614aea565b82805482825590600052602060002090601f016020900481019282156148585791602002820160005b8382111561497357835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302614935565b80156148ff5782816101000a81549060ff0219169055600101602081600001049283019260010302614973565b50805460008255600f016010900490600052602060002090810190611f7b9190614aea565b50805460008255601f016020900490600052602060002090810190611f7b9190614aea565b6040518060c00160405280600061ffff168152602001600061ffff168152602001600060ff168152602001600061ffff16815260200160608152602001606081525090565b6040518061016001604052806000815260200160008152602001600081526020016060815260200160008152602001600081526020016000815260200160008152602001600061ffff168152602001600061ffff168152602001600061ffff1681525090565b828054828255906000526020600020908101928215614858579160200282015b82811115614858578251825591602001919060010190614ab5565b5080546000825590600052602060002090810190611f7b91905b5b808211156148645760008155600101614aeb565b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b0381118282101715614b3757614b37614aff565b60405290565b60405161016081016001600160401b0381118282101715614b3757614b37614aff565b60405160e081016001600160401b0381118282101715614b3757614b37614aff565b60405161010081016001600160401b0381118282101715614b3757614b37614aff565b604051601f8201601f191681016001600160401b0381118282101715614bcd57614bcd614aff565b604052919050565b6001600160a01b0381168114611f7b57600080fd5b8035614bf581614bd5565b919050565b60006001600160401b03821115614c1357614c13614aff565b5060051b60200190565b600082601f830112614c2e57600080fd5b81356020614c43614c3e83614bfa565b614ba5565b82815260059290921b84018101918181019086841115614c6257600080fd5b8286015b84811015614c7d5780358352918301918301614c66565b509695505050505050565b60006001600160401b03821115614ca157614ca1614aff565b50601f01601f191660200190565b600082601f830112614cc057600080fd5b81356020614cd0614c3e83614bfa565b82815260059290921b84018101918181019086841115614cef57600080fd5b8286015b84811015614c7d5780356001600160401b03811115614d125760008081fd5b8701603f81018913614d245760008081fd5b848101356040614d36614c3e83614c88565b8281528b82848601011115614d4b5760008081fd5b8282850189830137600092810188019290925250845250918301918301614cf3565b60008060408385031215614d8057600080fd5b8235915060208301356001600160401b0380821115614d9e57600080fd5b9084019060c08287031215614db257600080fd5b614dba614b15565b614dc383614bea565b8152602083013582811115614dd757600080fd5b614de388828601614c1d565b602083015250604083013582811115614dfb57600080fd5b614e0788828601614c1d565b604083015250606083013582811115614e1f57600080fd5b614e2b88828601614c1d565b606083015250608083013582811115614e4357600080fd5b614e4f88828601614c1d565b60808301525060a083013582811115614e6757600080fd5b614e7388828601614caf565b60a0830152508093505050509250929050565b600080600060608486031215614e9b57600080fd5b8335614ea681614bd5565b92506020840135614eb681614bd5565b929592945050506040919091013590565b600080600080600060808688031215614edf57600080fd5b8535614eea81614bd5565b94506020860135614efa81614bd5565b93506040860135925060608601356001600160401b0380821115614f1d57600080fd5b818801915088601f830112614f3157600080fd5b813581811115614f4057600080fd5b896020828501011115614f5257600080fd5b9699959850939650602001949392505050565b600060208284031215614f7757600080fd5b5035919050565b600081518084526020808501945080840160005b83811015614fb157815160ff1687529582019590820190600101614f92565b509495945050505050565b6000602080835260e0830161ffff8086511683860152808387015116604086015260ff6040870151166060860152806060870151166080860152608086015160c060a0870152828151808552610100880191508583019450600092505b8083101561503b57845184168252938501936001929092019190850190615019565b5060a0880151878203601f190160c089015294506150598186614f7e565b98975050505050505050565b60006020828403121561507757600080fd5b813561366e81614bd5565b6000806040838503121561509557600080fd5b82356150a081614bd5565b946020939093013593505050565b600081518084526020808501945080840160005b83811015614fb1578151875295820195908201906001016150c2565b60006101608251845260208301516020850152604083015160408501526060830151816060860152615112828601826150ae565b9150506080830151608085015260a083015160a085015260c083015160c085015260e083015160e0850152610100808401516151538287018261ffff169052565b50506101208381015161ffff90811691860191909152610140938401511692909301919091525090565b60208152600061366e60208301846150de565b600080600080608085870312156151a657600080fd5b84356151b181614bd5565b935060208501356151c181614bd5565b93969395505050506040820135916060013590565b600080604083850312156151e957600080fd5b82356151f481614bd5565b9150602083013561520481614bd5565b809150509250929050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561526457603f198886030184526152528583516150de565b94509285019290850190600101615236565b5092979650505050505050565b61ffff81168114611f7b57600080fd5b8035614bf581615271565b60006020828403121561529e57600080fd5b81356001600160401b03808211156152b557600080fd5b9083019061016082860312156152ca57600080fd5b6152d2614b3d565b8235815260208301356020820152604083013560408201526060830135828111156152fc57600080fd5b61530887828601614c1d565b6060830152506080830135608082015260a083013560a082015260c083013560c082015260e083013560e08201526101009150615346828401615281565b82820152610120915061535a828401615281565b82820152610140915061536e828401615281565b91810191909152949350505050565b60006020828403121561538f57600080fd5b815161366e81614bd5565b60005b838110156153b557818101518382015260200161539d565b83811115613bec5750506000910152565b600081518084526153de81602086016020860161539a565b601f01601f19169290920160200192915050565b604080825283516001600160a01b03169082015260208084015160c06060840152600091906154256101008501826150ae565b90506040860151603f198086840301608087015261544383836150ae565b925060608801519150808684030160a087015261546083836150ae565b925060808801519150808684030160c087015261547d83836150ae565b60a089015187820390920160e08801528151808252909350908401915083830190600581901b8401850160005b828110156154d857601f198683030184526154c68286516153c6565b948701949387019391506001016154aa565b509690940196909652509295945050505050565b805160ff81168114614bf557600080fd5b8051614bf581615271565b600082601f83011261551957600080fd5b81516020615529614c3e83614bfa565b82815260059290921b8401810191818101908684111561554857600080fd5b8286015b84811015614c7d5761555d816154ec565b835291830191830161554c565b60006020828403121561557c57600080fd5b81516001600160401b038082111561559357600080fd5b9083019060c082860312156155a757600080fd5b6155af614b15565b8251600481106155be57600080fd5b81526155cc602084016154ec565b60208201526155dd604084016154fd565b60408201526060830151828111156155f457600080fd5b61560087828601615508565b6060830152506080830151608082015260a083015160a082015280935050505092915050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561565657615656615626565b500290565b6000821982111561566e5761566e615626565b500190565b600061ffff8083168185168183048111821515161561569457615694615626565b02949350505050565b600060a0820161ffff808916845260208189168186015260ff8816604086015260a0606086015282875180855260c087019150828901945060005b818110156156f65785518516835294830194918301916001016156d8565b5050858103608087015261570a8188614f7e565b9b9a5050505050505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252818101527f44657374696e6174696f6e2063616e206e6f7420626520616464726573732030604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6000828210156157b9576157b9615626565b500390565b6000826157db57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060001982141561580a5761580a615626565b5060010190565b602080825260149082015273043616e206e6f74206265206164647265737320360641b604082015260600190565b60006020828403121561585157600080fd5b5051919050565b60006020828403121561586a57600080fd5b61366e826154ec565b600060e0828403121561588557600080fd5b82601f83011261589457600080fd5b61589c614b60565b8060e08401858111156158ae57600080fd5b845b818110156158cf576158c1816154ec565b8452602093840193016158b0565b509095945050505050565b634e487b7160e01b600052602160045260246000fd5b60408152600061590360408301856150ae565b90508260208301529392505050565b600060ff821660ff84168060ff0382111561592f5761592f615626565b019392505050565b600060ff821660ff84168160ff048111821515161561595857615958615626565b029392505050565b600060ff821660ff84168082101561597a5761597a615626565b90039392505050565b600082601f83011261599457600080fd5b604051606081018181106001600160401b03821117156159b6576159b6614aff565b6040528060608401858111156159cb57600080fd5b845b818110156159ee5780516159e081615271565b8352602092830192016159cd565b509195945050505050565b60008060808385031215615a0c57600080fd5b82516001600160401b0380821115615a2357600080fd5b8185019150601f8681840112615a3857600080fd5b615a40614b82565b80610100850189811115615a5357600080fd5b855b81811015615ac257805186811115615a6d5760008081fd5b87018581018c13615a7e5760008081fd5b80516020615a8e614c3e83614c88565b8281528e82848601011115615aa35760008081fd5b615ab28383830184870161539a565b8752909501945050602001615a55565b50508096505050505050615ad98460208501615983565b90509250929050565b600060208284031215615af457600080fd5b815161366e81615271565b600061ffff80831681811415615b1757615b17615626565b6001019392505050565b600061012060018060a01b038c1683528a60208401528960408401528860608401528760808401528060a0840152615b5b818401886153c6565b905082810360c0840152615b6f81876153c6565b60e084019590955250506101000152979650505050505050565b600061010060018060a01b038b1683528960208401528860408401528760608401528660808401528060a0840152615bc3818401876153c6565b60c0840195909552505060e001529695505050505050565b6001600160a01b03841681526060810160048410615bfb57615bfb6158da565b83602083015261ffff83166040830152949350505050565b6060810160078510615c2757615c276158da565b938152602081019290925260ff1660409091015290565b634e487b7160e01b600052603160045260246000fd5b600060e08284031215615c6657600080fd5b82601f830112615c7557600080fd5b615c7d614b60565b8060e0840185811115615c8f57600080fd5b845b818110156158cf578051615ca481615271565b845260209384019301615c91565b60008060408385031215615cc557600080fd5b8251915060208301516009811061520457600080fd5b600061ffff83811690831681811015615cf657615cf6615626565b039392505050565b600060208284031215615d1057600080fd5b8151801515811461366e57600080fd5b60008251615d3281846020870161539a565b9190910192915050565b60208152600061366e60208301846153c656fea164736f6c6343000809000a

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.