Contract 0x353419Ac4dD684AEd9E741903cd45fb55ca0640D

Contract Overview

Balance:
0 MATIC

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x1def3e7ab35b9c41fccf64c808efe29171ecdf797472cb97ee51cf13dce2ff5b0x952624d2236031472022-01-06 14:42:37176 days 16 hrs ago0xc32004eced24167e8aaef9690da3a70387a97a9b IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.000877252 2
0x5c5e69ca768d42e9385528da537eea6687882514dbecd9feead83b3efcfdf859Set Voyage Contr...229539062021-12-21 20:06:32192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.00047669 10.000000005
0x4b522831c71a05a25c3b7c5f35ea2af4c6ff346978c1b68d91c0131c81715997Set Game Setting...229539002021-12-21 20:06:20192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.00047646 10.000000005
0x6f9dd92505e201587665fa5a6ffce7b2218955d4399f0425d5ea0f5f07fa3b0cSet Flagship Con...229538942021-12-21 20:06:08192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.00047692 10.000000005
0x00cf8dfd0ad8b20f3750bf5f0c97933ab2df80507af7ff50384a58af9ed6bfb6Set Dps Pirate F...229538892021-12-21 20:05:58192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.00047714 10.000000004
0x629cd3cc8b3bc4f856b1b68574184fe6520349a5db45fcf739c4f0613476203eSet Dps Contract229538832021-12-21 20:05:46192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.00047714 10.000000003
0xc30ae16f62157d569059ee9e7a2ea8f6650ce1c2b577856f882e3a0a6ee34e3fSet Chest Contra...229538782021-12-21 20:05:36192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.00047682 10.000000004
0xbb99c864ac3604159c65e8bac6ecb36c3f94fb37806c629782ef251f69b1cae6Set Causality Co...229538742021-12-21 20:05:28192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.00047713 10.000000004
0xf2f13945dff22bac5e0738ad20bf42204c213bf9810715d3e0ac36c4d4cd7ce3Set Cartographer...229538612021-12-21 20:05:02192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  0x353419ac4dd684aed9e741903cd45fb55ca0640d0 MATIC0.0004767 10.000000003
0xc7c402216b87e2bac3cdde9fdf3451e6cd7fa2f305fd7e443040aa08db4141ef0x60806040229536502021-12-21 19:57:44192 days 11 hrs ago0x4bb7e1d5c463ec80d0b316e83a090b00f7d87d1d IN  Create: DPSDocks0 MATIC0.2369875860
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DPSDocks

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 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";
// import "hardhat/console.sol";

contract DPSDocks is ERC721Holder, ReentrancyGuard, Ownable {
  VoyageI public voyage;
  DPSRandomI public causality;
  IERC721 public dps;
  DPSPirateFeaturesI public dpsFeatures;
  FlagshipI public flagship;
  SupportShipI public supportShip;
  IERC721 public artifact;
  CartographerI public cartographer;
  DPSGameSettingsI public gameSettings;
  DPSChestsI public chest;

  //keeping a list of voyages started by a user
  mapping(address => mapping(uint256 => LockedVoyage)) private lockedVoyages;
  mapping(address => mapping(uint256 => LockedVoyage)) private finishedVoyages;
  mapping(address => uint256[]) private finishedVoyagesIds;
  mapping(address => uint256[]) private lockedVoyagesIds;
  mapping(uint256 => VoyageResult) private voyageResults;
  mapping(uint256 => address) private ownerOfLockedVoyages;

  VoyageStatusCache private claimingRewardsCache;

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

  struct VoyageResult {
    uint16 awardedChests;
    uint16 destroyedSupportShips;
    uint16 healthDamage;
    uint16 skippedInteractions;
  }

  struct VoyageStatusCache {
    uint256 strength;
    uint256 luck;
    uint256 navigation;
    INTERACTION interaction;
    uint256 maxPointsCap;
    uint256 randomCheckIndex;
    address ownerOfVoyage;
  }

  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);
  event SetContract(string indexed _target, address _contract);
  event VoyageState(
    uint256 _voyageId,
    uint16 _awardedChests,
    uint16 _destroyedSupportships,
    uint16 _healthDamage,
    uint16 _skippedInteractions
  );

  constructor() {}

  function lockVoyageItems(LockedVoyage memory _lockedVoyage) external nonReentrant {
    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(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");
      }
    }
    if (_lockedVoyage.artifactId > 0) {
      require(artifact.ownerOf(_lockedVoyage.artifactId) == msg.sender, "You don't owe this artifact");
      artifact.safeTransferFrom(msg.sender, address(this), _lockedVoyage.artifactId);
    }
    _lockedVoyage.finished = false;
    _lockedVoyage.lockedBlock = block.number;
    _lockedVoyage.lockedTimestamp = block.timestamp;
    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
    );
  }

  function claimRewards(
    uint256 _voyageId,
    uint256[] memory _blockNumber,
    bytes32[] memory _hash1,
    bytes32[] memory _hash2,
    uint256[] memory _blockTimestamp,
    bytes[] memory _signature
  ) external nonReentrant {
    claimingRewardsCache.ownerOfVoyage = getLockedVoyageOwner(_voyageId);
    require(claimingRewardsCache.ownerOfVoyage != address(0), "Voyage does not exists");
    LockedVoyage storage lockedVoyage = lockedVoyages[claimingRewardsCache.ownerOfVoyage][_voyageId];
    require(voyage.ownerOf(_voyageId) == address(this) && lockedVoyage.voyageId != 0, "Voyage not started");
    claimingRewardsCache.randomCheckIndex = 0;

    CausalityParams memory causalityParams = CausalityParams(
      claimingRewardsCache.ownerOfVoyage,
      _blockNumber,
      _hash1,
      _hash2,
      _blockTimestamp,
      _signature
    );

    VoyageConfig memory voyageConfig = cartographer.viewVoyageConfiguration(causalityParams, _voyageId);
    claimingRewardsCache.randomCheckIndex = voyageConfig.noOfInteractions + 2;

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

    computeVoyageState(_voyageId, lockedVoyage, voyageConfig, _blockNumber, _hash1, _hash2, _blockTimestamp, _signature);
    VoyageResult memory voyageResult = voyageResults[_voyageId];

    lockedVoyage.finished = true;
    finishedVoyages[claimingRewardsCache.ownerOfVoyage][lockedVoyage.voyageId] = lockedVoyage;
    finishedVoyagesIds[claimingRewardsCache.ownerOfVoyage].push(lockedVoyage.voyageId);
    cleanLockedVoyage(lockedVoyage.voyageId);
    //TODO delete voyage
    emit ClaimVoyageRewards(_voyageId, voyageResult.awardedChests, voyageResult.destroyedSupportShips, voyageResult.healthDamage);
  }

  function checkVoyageState(
    uint256 _voyageId,
    uint256[] memory _blockNumber,
    bytes32[] memory _hash1,
    bytes32[] memory _hash2,
    uint256[] memory _blockTimestamp,
    bytes[] memory _signature
  ) external returns (VoyageResult memory voyageResult) {
    claimingRewardsCache.ownerOfVoyage = getLockedVoyageOwner(_voyageId);
    LockedVoyage storage lockedVoyage = lockedVoyages[claimingRewardsCache.ownerOfVoyage][_voyageId];

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

    CausalityParams memory causalityParams = CausalityParams(
      claimingRewardsCache.ownerOfVoyage,
      _blockNumber,
      _hash1,
      _hash2,
      _blockTimestamp,
      _signature
    );
    VoyageConfig memory voyageConfig = cartographer.viewVoyageConfiguration(causalityParams, _voyageId);
    claimingRewardsCache.randomCheckIndex = voyageConfig.noOfInteractions + 2;

    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;
    for (uint8 i; i < interactions; i++) {
      voyageConfig.sequence[voyageConfig.sequence.length - i - 1] = 0;
    }

    computeVoyageState(_voyageId, lockedVoyage, voyageConfig, _blockNumber, _hash1, _hash2, _blockTimestamp, _signature);
    voyageResult = voyageResults[_voyageId];

    emit VoyageState(
      _voyageId,
      voyageResult.awardedChests,
      voyageResult.destroyedSupportShips,
      voyageResult.healthDamage,
      voyageResult.skippedInteractions
    );
  }

  function computeVoyageState(
    uint256 _voyageId,
    LockedVoyage storage lockedVoyage,
    VoyageConfig memory voyageConfig,
    uint256[] memory _blockNumber,
    bytes32[] memory _hash1,
    bytes32[] memory _hash2,
    uint256[] memory _blockTimestamp,
    bytes[] memory _signature
  ) internal {
    claimingRewardsCache.strength = 0;
    claimingRewardsCache.luck = 0;
    claimingRewardsCache.navigation = 0;
    claimingRewardsCache.interaction = INTERACTION.NONE;
    claimingRewardsCache.maxPointsCap = 0;
    claimingRewardsCache.randomCheckIndex = 0;
    claimingRewardsCache.ownerOfVoyage = address(0);

    claimingRewardsCache.ownerOfVoyage = getLockedVoyageOwner(_voyageId);
    (, uint16[3] memory features) = dpsFeatures.getTraitsAndSkills(uint16(lockedVoyage.dpsId));
    computeSupportShipSkills(lockedVoyage.supportShipIds);
    claimingRewardsCache.luck += features[0];
    claimingRewardsCache.navigation += features[1];
    claimingRewardsCache.strength += features[2];
    computeFlagShipSkills(lockedVoyage.flagshipId);
    VoyageResult memory voyageResult = VoyageResult(0, 0, 0, 0);
    claimingRewardsCache.maxPointsCap = gameSettings.getMaxPointsCap();
    for (uint8 i; i < voyageConfig.sequence.length; i++) {
      claimingRewardsCache.interaction = INTERACTION(voyageConfig.sequence[i]);
      if (claimingRewardsCache.interaction == INTERACTION.NONE) {
        voyageResult.skippedInteractions++;
        continue;
      }
      claimingRewardsCache.randomCheckIndex++;
      if (voyageResult.healthDamage == 100) {
        voyageResult.skippedInteractions++;
        continue;
      }
      uint256 result = causality.getRandom(
        claimingRewardsCache.ownerOfVoyage,
        _blockNumber[claimingRewardsCache.randomCheckIndex],
        _hash1[claimingRewardsCache.randomCheckIndex],
        _hash2[claimingRewardsCache.randomCheckIndex],
        _blockTimestamp[claimingRewardsCache.randomCheckIndex],
        _signature[claimingRewardsCache.randomCheckIndex],
        string(abi.encodePacked("INTERACTION_RESULT", claimingRewardsCache.randomCheckIndex)),
        0,
        claimingRewardsCache.maxPointsCap - 1
      );
      interpretResults(result, voyageResult, lockedVoyage);
    }
    voyageResults[_voyageId] = voyageResult;
  }

  function interpretResults(
    uint256 result,
    VoyageResult memory voyageResult,
    LockedVoyage storage lockedVoyage
  ) internal {
    if (claimingRewardsCache.interaction == INTERACTION.CHEST && result <= claimingRewardsCache.luck) {
      voyageResult.awardedChests++;
    } else if (claimingRewardsCache.interaction == INTERACTION.STORM && result > claimingRewardsCache.navigation) {
      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 if (voyageResult.healthDamage == 0) {
        voyageResult.healthDamage = 100;
      }
    }
  }

  function awardRewards(
    VoyageResult memory voyageResult,
    VoyageConfig storage voyageConfig,
    LockedVoyage storage lockedVoyage
  ) internal {
    chest.mint(claimingRewardsCache.ownerOfVoyage, voyageConfig.typeOfVoyage, voyageResult.awardedChests);
    dps.safeTransferFrom(address(this), claimingRewardsCache.ownerOfVoyage, lockedVoyage.dpsId);
    flagship.safeTransferFrom(address(this), claimingRewardsCache.ownerOfVoyage, lockedVoyage.flagshipId);
    for (uint256 i; i < lockedVoyage.supportShipIds.length; i++) {
      if (i < voyageResult.destroyedSupportShips) supportShip.burn(lockedVoyage.supportShipIds[i]);
      else supportShip.safeTransferFrom(claimingRewardsCache.ownerOfVoyage, address(this), lockedVoyage.supportShipIds[i]);
    }
    artifact.safeTransferFrom(address(this), claimingRewardsCache.ownerOfVoyage, lockedVoyage.artifactId);
    voyage.burn(lockedVoyage.voyageId);
  }

  function computeSupportShipSkills(uint256[] storage supportShips) internal {
    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;
    }
  }

  function computeFlagShipSkills(uint256 _flagshipId) internal {
    uint8[7] memory levels = flagship.getPartsLevel(_flagshipId);
    uint16[7] memory skillsPerPart = gameSettings.getSkillsPerFlagshipParts();
    uint8[7] memory skillTypes = gameSettings.getSkillTypeOfEachFlagshipPart();
    for (uint8 i = 0; 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];
    }
  }

  function cleanLockedVoyage(uint256 _voyageId) internal {
    uint256[] storage voyagesForOwner = lockedVoyagesIds[claimingRewardsCache.ownerOfVoyage];
    for (uint256 i; i < voyagesForOwner.length; i++) {
      if (voyagesForOwner[i] == _voyageId) {
        voyagesForOwner[i] = voyagesForOwner[voyagesForOwner.length - 1];
        voyagesForOwner.pop();
      }
    }
    delete ownerOfLockedVoyages[_voyageId];
    delete lockedVoyages[claimingRewardsCache.ownerOfVoyage][_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;
  }

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

  /**
   * SETTERS & GETTERS
   */
  function setVoyageContract(address _contract) external onlyOwner {
    require(_contract != address(0), "Can not be address 0");
    voyage = VoyageI(_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 = FlagshipI(_contract);
    emit SetContract("Flagship", _contract);
  }

  function setSupportShipContract(address _contract) external onlyOwner {
    require(_contract != address(0), "Can not be address 0");
    supportShip = SupportShipI(_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 = CartographerI(_contract);
    emit SetContract("Cartographer", _contract);
  }

  function setChestContract(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 lockedVoyagesOfOwner) {
    for (uint256 i; i < lockedVoyagesIds[_owner].length; i++) {
      lockedVoyagesOfOwner[i] = lockedVoyages[_owner][lockedVoyagesIds[_owner][i]];
    }
  }

  function getLockedVoyageByOwnerAndId(address _owner, uint256 _voyageId)
    external
    view
    returns (LockedVoyage memory lockedVoyage)
  {
    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 finishedVoyagesOfOwner) {
    for (uint256 i; i < finishedVoyagesIds[_owner].length; i++) {
      finishedVoyagesOfOwner[i] = finishedVoyages[_owner][finishedVoyagesIds[_owner][i]];
    }
  }

  function getFinishedVoyageByOwnerAndId(address _owner, uint256 _voyageId)
    external
    view
    returns (LockedVoyage memory lockedVoyage)
  {
    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 _address;
  uint256[] _blockNumber;
  bytes32[] _hash1;
  bytes32[] _hash2;
  uint256[] _timestamp;
  bytes[] _signature;
}

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

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

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

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

  function burn(uint256 _id) external;
}

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

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 CartographerI {
  function viewVoyageConfiguration(CausalityParams memory causalityParams, uint256 _voyageId)
    external
    view
    returns (VoyageConfig memory voyageConfig);
}

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"}],"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":false,"internalType":"uint256","name":"_voyageId","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"_awardedChests","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_destroyedSupportships","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_healthDamage","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_skippedInteractions","type":"uint16"}],"name":"VoyageState","type":"event"},{"inputs":[],"name":"artifact","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cartographer","outputs":[{"internalType":"contract CartographerI","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"},{"internalType":"uint256[]","name":"_blockNumber","type":"uint256[]"},{"internalType":"bytes32[]","name":"_hash1","type":"bytes32[]"},{"internalType":"bytes32[]","name":"_hash2","type":"bytes32[]"},{"internalType":"uint256[]","name":"_blockTimestamp","type":"uint256[]"},{"internalType":"bytes[]","name":"_signature","type":"bytes[]"}],"name":"checkVoyageState","outputs":[{"components":[{"internalType":"uint16","name":"awardedChests","type":"uint16"},{"internalType":"uint16","name":"destroyedSupportShips","type":"uint16"},{"internalType":"uint16","name":"healthDamage","type":"uint16"},{"internalType":"uint16","name":"skippedInteractions","type":"uint16"}],"internalType":"struct DPSDocks.VoyageResult","name":"voyageResult","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"chest","outputs":[{"internalType":"contract DPSChestsI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_voyageId","type":"uint256"},{"internalType":"uint256[]","name":"_blockNumber","type":"uint256[]"},{"internalType":"bytes32[]","name":"_hash1","type":"bytes32[]"},{"internalType":"bytes32[]","name":"_hash2","type":"bytes32[]"},{"internalType":"uint256[]","name":"_blockTimestamp","type":"uint256[]"},{"internalType":"bytes[]","name":"_signature","type":"bytes[]"}],"name":"claimRewards","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 FlagshipI","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":"bool","name":"finished","type":"bool"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"},{"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":"struct DPSDocks.LockedVoyage","name":"lockedVoyage","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"getFinishedVoyagesForOwner","outputs":[{"components":[{"internalType":"bool","name":"finished","type":"bool"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"},{"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":"struct DPSDocks.LockedVoyage[]","name":"finishedVoyagesOfOwner","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":"uint16","name":"healthDamage","type":"uint16"},{"internalType":"uint16","name":"skippedInteractions","type":"uint16"}],"internalType":"struct DPSDocks.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":"bool","name":"finished","type":"bool"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"},{"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":"struct DPSDocks.LockedVoyage","name":"lockedVoyage","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":"bool","name":"finished","type":"bool"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"},{"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":"struct DPSDocks.LockedVoyage[]","name":"lockedVoyagesOfOwner","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"finished","type":"bool"},{"internalType":"uint16","name":"navigation","type":"uint16"},{"internalType":"uint16","name":"luck","type":"uint16"},{"internalType":"uint16","name":"strength","type":"uint16"},{"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":"struct DPSDocks.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"}],"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":"setChestContract","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 SupportShipI","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 VoyageI","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506001600055620000223362000028565b6200007a565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6145a4806200008a6000396000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c8063952624d21161011a578063d970d60f116100ad578063ea68ba8e1161007c578063ea68ba8e14610540578063f2fde38b14610553578063f9ae4cb614610566578063fcb601b814610579578063ffd7593c1461058c57600080fd5b8063d970d60f1461047f578063ddbf6c5b14610492578063e012d8d3146104a5578063e4eb95931461052d57600080fd5b8063b7297cf3116100e9578063b7297cf3146103e8578063b9f37e3f146103fb578063c29a87a51461040e578063c98ec5c91461045f57600080fd5b8063952624d21461039c578063a09620fb146103af578063a1e40df8146103c2578063a31ad6ed146103d557600080fd5b806351b695941161019d57806364026ac01161016c57806364026ac01461034a578063647aba301461035d578063715018a61461037057806380f669fd146103785780638da5cb5b1461038b57600080fd5b806351b69594146102f157806360d2f9c614610304578063613a3cea1461031757806362c2fd6b1461033757600080fd5b80633c2f22bc116101d95780633c2f22bc1461028f57806341dd7a41146102a2578063431211d8146102b557806343f4089e146102de57600080fd5b80630d7f50351461020b578063150b7a02146102205780631b2e6a4c146102515780633086f74d14610264575b600080fd5b61021e6102193660046136a3565b61059f565b005b61023361022e3660046136e4565b61068f565b6040516001600160e01b031990911681526020015b60405180910390f35b61021e61025f366004613782565b6106fb565b600654610277906001600160a01b031681565b6040516001600160a01b039091168152602001610248565b600754610277906001600160a01b031681565b61021e6102b0366004613782565b6107be565b6102776102c33660046137a6565b6000908152601160205260409020546001600160a01b031690565b61021e6102ec366004613782565b610845565b61021e6102ff366004613a08565b6108c4565b61021e610312366004613782565b610dcd565b61032a610325366004613ae1565b610e55565b6040516102489190613bf7565b600854610277906001600160a01b031681565b600b54610277906001600160a01b031681565b600954610277906001600160a01b031681565b61021e610fd7565b61021e610386366004613782565b61100d565b6001546001600160a01b0316610277565b61021e6103aa366004613c3a565b611092565b600454610277906001600160a01b031681565b61021e6103d0366004613782565b611a7b565b61021e6103e3366004613782565b611aff565b600a54610277906001600160a01b031681565b600254610277906001600160a01b031681565b61042161041c366004613a08565b611b86565b6040516102489190815161ffff9081168252602080840151821690830152604080840151821690830152606092830151169181019190915260800190565b61047261046d366004613782565b611fe2565b6040516102489190613d2c565b600554610277906001600160a01b031681565b61021e6104a0366004613782565b612163565b6104216104b33660046137a6565b604080516080810182526000808252602082018190529181018290526060810191909152506000908152601060209081526040918290208251608081018452905461ffff80821683526201000082048116938301939093526401000000008104831693820193909352600160301b90920416606082015290565b61047261053b366004613782565b6121e5565b61021e61054e366004613782565b612360565b61021e610561366004613782565b6123e8565b61021e610574366004613782565b612483565b61032a610587366004613ae1565b612505565b600354610277906001600160a01b031681565b6001546001600160a01b031633146105d25760405162461bcd60e51b81526004016105c990613d8e565b60405180910390fd5b6001600160a01b0382166106285760405162461bcd60e51b815260206004820181905260248201527f44657374696e6174696f6e2063616e206e6f742062652061646472657373203060448201526064016105c9565b604051632142170760e11b81526001600160a01b038416906342842e0e9061065890309086908690600401613dc3565b600060405180830381600087803b15801561067257600080fd5b505af1158015610686573d6000803e3d6000fd5b50505050505050565b60006001600160a01b03861630146106e95760405162461bcd60e51b815260206004820152601960248201527f416363657074696e67206f6e6c792066726f6d20446f636b730000000000000060448201526064016105c9565b50630a85bd0160e11b95945050505050565b6001546001600160a01b031633146107255760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b03811661074b5760405162461bcd60e51b81526004016105c990613de7565b600b80546001600160a01b0319166001600160a01b0383161790556040516410da195cdd60da1b81526005015b6040519081900381206001600160a01b0383168252907fbf2cc7083b32d1f5c82633af784e1285df86eb43c88d0752feea4bebb4a0b6d29060200160405180910390a250565b6001546001600160a01b031633146107e85760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b03811661080e5760405162461bcd60e51b81526004016105c990613de7565b600780546001600160a01b0319166001600160a01b0383161790556040516a0537570706f7274536869760ac1b8152600b01610778565b6001546001600160a01b0316331461086f5760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b0381166108955760405162461bcd60e51b81526004016105c990613de7565b600480546001600160a01b0319166001600160a01b0383161790556040516244505360e81b8152600301610778565b600260005414156109175760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105c9565b6002600090815586815260116020526040902054601880546001600160a01b0319166001600160a01b03909216918217905561098e5760405162461bcd60e51b8152602060048201526016602482015275566f7961676520646f6573206e6f742065786973747360501b60448201526064016105c9565b6018546001600160a01b039081166000908152600c602090815260408083208a84529091529081902060025491516331a9108f60e11b8152600481018a9052909230921690636352211e9060240160206040518083038186803b1580156109f457600080fd5b505afa158015610a08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2c9190613e15565b6001600160a01b0316148015610a455750600181015415155b610a865760405162461bcd60e51b8152602060048201526012602482015271159bde5859d9481b9bdd081cdd185c9d195960721b60448201526064016105c9565b600060178190556040805160c0810182526018546001600160a01b039081168252602082018a9052818301899052606082018890526080820187905260a08201869052600954925163712796e560e01b8152919392169063712796e590610af39085908d90600401613e8e565b60006040518083038186803b158015610b0b57600080fd5b505afa158015610b1f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b479190810190614006565b905080602001516002610b5a91906140d8565b60ff90811660175560a082015160208301514292610b799291166140fd565b8460070154610b88919061411c565b1115610bcc5760405162461bcd60e51b8152602060048201526013602482015272159bde5859d9481b9bdd08199a5b9a5cda1959606a1b60448201526064016105c9565b610bdc8984838b8b8b8b8b61267d565b60008981526010602090815260408083208151608081018352905461ffff80821683526201000082048116838601526401000000008204811683850152600160301b90910481166060830152875460ff1990811660019081178a556018546001600160a01b03168752600d86528487208a82018054895296529390952080549586168417815588546101009081900483160262ffffff19909616959095178317808655885463010000009081900483160264ffff000000198216811787558954600160281b9081900490931690920266ffff00000000001990921666ffffffff0000001990911617178455915490830155600285810154908301556003808601549083015560048581018054929387939092610cfb929084019161356c565b5060058281015490820155600680830154908201556007918201549101556018546001600160a01b03166000908152600e6020908152604082206001878101805483549283018455928552929093209092019190915554610d5b90612b93565b897f133f53e5d0124136c4edb7ca22ce9a359e7464aeb228625f07639eb954e09838826000015183602001518460400151604051610db49392919061ffff93841681529183166020830152909116604082015260600190565b60405180910390a2505060016000555050505050505050565b6001546001600160a01b03163314610df75760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b038116610e1d5760405162461bcd60e51b81526004016105c990613de7565b600980546001600160a01b0319166001600160a01b0383161790556040516b21b0b93a37b3b930b83432b960a11b8152600c01610778565b610e5d6135bc565b60005b6001600160a01b0384166000908152600f6020526040902054811015610fcf576001600160a01b0384166000908152600f60205260408120805483908110610eaa57610eaa614134565b9060005260206000200154905083811415610fbc576001600160a01b0385166000908152600c60209081526040808320848452825291829020825161016081018452815460ff81161515825261ffff610100820481168386015263010000008204811683870152600160281b90910416606082015260018201546080820152600282015460a0820152600382015460c08201526004820180548551818602810186019096528086529194929360e08601939290830182828015610f8c57602002820191906000526020600020905b815481526020019060010190808311610f78575b50505050508152602001600582015481526020016006820154815260200160078201548152505092505050610fd1565b5080610fc78161414a565b915050610e60565b505b92915050565b6001546001600160a01b031633146110015760405162461bcd60e51b81526004016105c990613d8e565b61100b6000612ce9565b565b6001546001600160a01b031633146110375760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b03811661105d5760405162461bcd60e51b81526004016105c990613de7565b600380546001600160a01b0319166001600160a01b0383161790556040516843617573616c69747960b81b8152600901610778565b600260005414156110e55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105c9565b6002600055608081015161112c5760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420566f7961676560901b60448201526064016105c9565b60025460808201516040516331a9108f60e11b8152600481019190915233916001600160a01b031690636352211e9060240160206040518083038186803b15801561117657600080fd5b505afa15801561118a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ae9190613e15565b6001600160a01b0316146112045760405162461bcd60e51b815260206004820152601960248201527f596f7520646f6e2774206f7765207468697320766f796167650000000000000060448201526064016105c9565b6004805460a08301516040516331a9108f60e11b81529283015233916001600160a01b0390911690636352211e9060240160206040518083038186803b15801561124d57600080fd5b505afa158015611261573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112859190613e15565b6001600160a01b0316146112d45760405162461bcd60e51b8152602060048201526016602482015275596f7520646f6e2774206f776520746869732064707360501b60448201526064016105c9565b60065460c08201516040516331a9108f60e11b8152600481019190915233916001600160a01b031690636352211e9060240160206040518083038186803b15801561131e57600080fd5b505afa158015611332573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113569190613e15565b6001600160a01b0316146113ac5760405162461bcd60e51b815260206004820152601b60248201527f596f7520646f6e2774206f7765207468697320666c616773686970000000000060448201526064016105c9565b336000908152600c60209081526040808320608085015184529091529020600101541561141b5760405162461bcd60e51b815260206004820152601e60248201527f5468697320566f7961676520697320616c72656164792073746172746564000060448201526064016105c9565b336000908152600d60209081526040808320608085015184529091529020600101541561148a5760405162461bcd60e51b815260206004820152601760248201527f5468697320566f796167652069732066696e697368656400000000000000000060448201526064016105c9565b60e081015151156115b15760005b8160e00151518110156115af5760075460e0830151805133926001600160a01b031691636352211e91859081106114d1576114d1614134565b60200260200101516040518263ffffffff1660e01b81526004016114f791815260200190565b60206040518083038186803b15801561150f57600080fd5b505afa158015611523573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115479190613e15565b6001600160a01b03161461159d5760405162461bcd60e51b815260206004820152601d60248201527f537570706f72742073686970206e6f74206f776e656420627920796f7500000060448201526064016105c9565b806115a78161414a565b915050611498565b505b61010081015115611700576008546101008201516040516331a9108f60e11b8152600481019190915233916001600160a01b031690636352211e9060240160206040518083038186803b15801561160757600080fd5b505afa15801561161b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163f9190613e15565b6001600160a01b0316146116955760405162461bcd60e51b815260206004820152601b60248201527f596f7520646f6e2774206f77652074686973206172746966616374000000000060448201526064016105c9565b600854610100820151604051632142170760e11b81526001600160a01b03909216916342842e0e916116cd9133913091600401613dc3565b600060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050505b60008082524361012083015242610140830152338152600c60209081526040808320608085018051855290835292819020845181548487015193870151606088015162ffffff1990921692151562ffff0019169290921761010061ffff958616021766ffffffff000000191663010000009285169290920266ffff0000000000191691909117600160281b93909116929092029190911781559151600183015560a0830151600283015560c0830151600383015560e083015180518493926117cf926004850192910190613624565b506101008201516005820155610120820151600682015561014090910151600790910155336000818152600f6020908152604080832060808601805182546001810184559286528486209092019190915551835260119091529081902080546001600160a01b031916831790556004805460a08501519251632142170760e11b81526001600160a01b03909116936342842e0e93611871939192309201613dc3565b600060405180830381600087803b15801561188b57600080fd5b505af115801561189f573d6000803e3d6000fd5b505060065460c0840151604051632142170760e11b81526001600160a01b0390921693506342842e0e92506118da9133913091600401613dc3565b600060405180830381600087803b1580156118f457600080fd5b505af1158015611908573d6000803e3d6000fd5b5050505060005b8160e00151518110156119b85760075460e083015180516001600160a01b03909216916342842e0e9133913091908690811061194d5761194d614134565b60200260200101516040518463ffffffff1660e01b815260040161197393929190613dc3565b600060405180830381600087803b15801561198d57600080fd5b505af11580156119a1573d6000803e3d6000fd5b5050505080806119b09061414a565b91505061190f565b506002546080820151604051632142170760e11b81526001600160a01b03909216916342842e0e916119f09133913091600401613dc3565b600060405180830381600087803b158015611a0a57600080fd5b505af1158015611a1e573d6000803e3d6000fd5b505050508060c001518160a0015182608001517f6fa242eeaf9df98bd980632a1306b3992ebd368677b7f320cad215f74497f9998460e00151856101000151604051611a6b929190614165565b60405180910390a4506001600055565b6001546001600160a01b03163314611aa55760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b038116611acb5760405162461bcd60e51b81526004016105c990613de7565b600680546001600160a01b0319166001600160a01b038316179055604051670466c6167736869760c41b8152600801610778565b6001546001600160a01b03163314611b295760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b038116611b4f5760405162461bcd60e51b81526004016105c990613de7565b600580546001600160a01b0319166001600160a01b0383161790556040516a445053466561747572657360a81b8152600b01610778565b6040805160808101825260008082526020820181905291810182905260608101919091526000878152601160205260409020546001600160a01b0316601880546001600160a01b0319166001600160a01b039283169081179091556000908152600c602090815260408083208b84529091529081902060025491516331a9108f60e11b8152600481018b9052909230921690636352211e9060240160206040518083038186803b158015611c3957600080fd5b505afa158015611c4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c719190613e15565b6001600160a01b0316148015611c9157506018546001600160a01b031633145b8015611ca05750600181015415155b611ce15760405162461bcd60e51b8152602060048201526012602482015271159bde5859d9481b9bdd081cdd185c9d195960721b60448201526064016105c9565b6040805160c0810182526018546001600160a01b039081168252602082018a9052818301899052606082018890526080820187905260a08201869052600954925163712796e560e01b8152919260009291169063712796e590611d4a9085908e90600401613e8e565b60006040518083038186803b158015611d6257600080fd5b505afa158015611d76573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d9e9190810190614006565b905080602001516002611db191906140d8565b60ff1660175560a08101516007840154611dcb90426141ad565b11611e0f5760405162461bcd60e51b8152602060048201526014602482015273159bde5859d948191a59081b9bdd081cdd185c9d60621b60448201526064016105c9565b60008160a00151846007015442611e2691906141ad565b611e3091906141c4565b9050816060015151811115611e4757506060810151515b60005b818160ff161015611eb0576000836060015160018360ff16866060015151611e7291906141ad565b611e7c91906141ad565b81518110611e8c57611e8c614134565b60ff9092166020928302919091019091015280611ea8816141e6565b915050611e4a565b50611ec18b85848d8d8d8d8d61267d565b601060008c81526020019081526020016000206040518060800160405290816000820160009054906101000a900461ffff1661ffff1661ffff1681526020016000820160029054906101000a900461ffff1661ffff1661ffff1681526020016000820160049054906101000a900461ffff1661ffff1661ffff1681526020016000820160069054906101000a900461ffff1661ffff1661ffff168152505094507fe5f82cd83201b0f2582a0d9b4c69ad8e8f1084c41ccb87d2d6df56d04916313b8b8660000151876020015188604001518960600151604051611fcc95949392919094855261ffff938416602086015291831660408501528216606084015216608082015260a00190565b60405180910390a1505050509695505050505050565b606060005b6001600160a01b0383166000908152600e602052604090205481101561215d576001600160a01b0383166000908152600d60209081526040808320600e909252822080549192918490811061203e5761203e614134565b600091825260208083209091015483528281019390935260409182019020815161016081018352815460ff81161515825261ffff610100820481168387015263010000008204811683860152600160281b90910416606082015260018201546080820152600282015460a0820152600382015460c08201526004820180548451818702810187019095528085529194929360e086019390929083018282801561210657602002820191906000526020600020905b8154815260200190600101908083116120f2575b50505050508152602001600582015481526020016006820154815260200160078201548152505082828151811061213f5761213f614134565b602002602001018190525080806121559061414a565b915050611fe7565b50919050565b6001546001600160a01b0316331461218d5760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b0381166121b35760405162461bcd60e51b81526004016105c990613de7565b600280546001600160a01b0319166001600160a01b03831617905560405165566f7961676560d01b8152600601610778565b606060005b6001600160a01b0383166000908152600f602052604090205481101561215d576001600160a01b0383166000908152600c60209081526040808320600f909252822080549192918490811061224157612241614134565b600091825260208083209091015483528281019390935260409182019020815161016081018352815460ff81161515825261ffff610100820481168387015263010000008204811683860152600160281b90910416606082015260018201546080820152600282015460a0820152600382015460c08201526004820180548451818702810187019095528085529194929360e086019390929083018282801561230957602002820191906000526020600020905b8154815260200190600101908083116122f5575b50505050508152602001600582015481526020016006820154815260200160078201548152505082828151811061234257612342614134565b602002602001018190525080806123589061414a565b9150506121ea565b6001546001600160a01b0316331461238a5760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b0381166123b05760405162461bcd60e51b81526004016105c990613de7565b600a80546001600160a01b0319166001600160a01b0383161790556040516b47616d6553657474696e677360a01b8152600c01610778565b6001546001600160a01b031633146124125760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b0381166124775760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105c9565b61248081612ce9565b50565b6001546001600160a01b031633146124ad5760405162461bcd60e51b81526004016105c990613d8e565b6001600160a01b0381166124d35760405162461bcd60e51b81526004016105c990613de7565b600880546001600160a01b0319166001600160a01b03831617815560405167105c9d1a599858dd60c21b815201610778565b61250d6135bc565b60005b6001600160a01b0384166000908152600e6020526040902054811015610fcf576001600160a01b0384166000908152600e6020526040812080548390811061255a5761255a614134565b906000526020600020015490508381141561266a576001600160a01b0385166000908152600d60209081526040808320848452825291829020825161016081018452815460ff81161515825261ffff610100820481168386015263010000008204811683870152600160281b90910416606082015260018201546080820152600282015460a0820152600382015460c08201526004820180548551818602810186019096528086529194929360e08601939290830182828015610f8c5760200282019190600052602060002090815481526020019060010190808311610f785750505050508152602001600582015481526020016006820154815260200160078201548152505092505050610fd1565b50806126758161414a565b915050612510565b60006012819055601381905560148190556015805460ff1916905560168190556017819055601880546001600160a01b0319169055888152601160205260409020546001600160a01b0316601880546001600160a01b0319166001600160a01b0392831617905560055460028901546040516306814e3960e31b815261ffff9091166004820152600092919091169063340a71c89060240160006040518083038186803b15801561272d57600080fd5b505afa158015612741573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526127699190810190614292565b91505061277888600401612d3b565b80516013805461ffff9092169160009061279390849061411c565b909155505060208101516014805461ffff909216916000906127b690849061411c565b909155505060408101516012805461ffff909216916000906127d990849061411c565b909155505060038801546127ec90612f52565b60408051608081018252600080825260208083018290528284018290526060830191909152600a5483516344eddabb60e11b8152935192936001600160a01b03909116926389dbb57692600480840193919291829003018186803b15801561285357600080fd5b505afa158015612867573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061288b919061437b565b61ffff1660165560005b8860600151518160ff161015612b135788606001518160ff16815181106128be576128be614134565b602002602001015160ff1660038111156128da576128da614206565b6015805460ff191660018360038111156128f6576128f6614206565b0217905550600060155460ff16600381111561291457612914614206565b1415612936576060820180519061292a82614398565b61ffff16905250612b01565b601780549060006129468361414a565b9190505550816040015161ffff166064141561296c576060820180519061292a82614398565b6003546018546017548a516000936001600160a01b03908116936369171233939116918d919081106129a0576129a0614134565b60200260200101518b601260050154815181106129bf576129bf614134565b60200260200101518b601260050154815181106129de576129de614134565b60200260200101518b601260050154815181106129fd576129fd614134565b60200260200101518b60126005015481518110612a1c57612a1c614134565b6020026020010151601260050154604051602001612a5b91907112539511549050d51253d397d49154d5531560721b8152601281019190915260320190565b60405160208183030381529060405260006001601260040154612a7e91906141ad565b6040518a63ffffffff1660e01b8152600401612aa2999897969594939291906143ba565b60206040518083038186803b158015612aba57600080fd5b505afa158015612ace573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af29190614422565b9050612aff81848d613299565b505b80612b0b816141e6565b915050612895565b506000998a526010602090815260409a8b902082518154928401519c84015160609094015161ffff908116600160301b0267ffff00000000000019958216640100000000029590951667ffffffff00000000199e8216620100000263ffffffff199095169190921617929092179b909b1617179098555050505050505050565b6018546001600160a01b03166000908152600f60205260408120905b8154811015612c605782828281548110612bcb57612bcb614134565b90600052602060002001541415612c4e5781548290612bec906001906141ad565b81548110612bfc57612bfc614134565b9060005260206000200154828281548110612c1957612c19614134565b906000526020600020018190555081805480612c3757612c3761443b565b600190038181906000526020600020016000905590555b80612c588161414a565b915050612baf565b50600082815260116020908152604080832080546001600160a01b03191690556018546001600160a01b03168352600c82528083208584529091528120805466ffffffffffffff1916815560018101829055600281018290556003810182905590612cce600483018261365f565b50600060058201819055600682018190556007909101555050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005b8154811015612f4e57600754825460009182916001600160a01b039091169063d3f161ac90869086908110612d7557612d75614134565b90600052602060002001546040518263ffffffff1660e01b8152600401612d9e91815260200190565b604080518083038186803b158015612db557600080fd5b505afa158015612dc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ded9190614451565b90925090506000816008811115612e0657612e06614206565b1480612e2357506003816008811115612e2157612e21614206565b145b80612e3f57506006816008811115612e3d57612e3d614206565b145b15612e5f578160126000016000828254612e59919061411c565b90915550505b6001816008811115612e7357612e73614206565b1480612e9057506004816008811115612e8e57612e8e614206565b145b80612eac57506007816008811115612eaa57612eaa614206565b145b15612ecc578160126001016000828254612ec6919061411c565b90915550505b6002816008811115612ee057612ee0614206565b1480612efd57506005816008811115612efb57612efb614206565b145b80612f1957506008816008811115612f1757612f17614206565b145b15612f39578160126002016000828254612f33919061411c565b90915550505b50508080612f469061414a565b915050612d3e565b5050565b60065460405163a3df934f60e01b8152600481018390526000916001600160a01b03169063a3df934f9060240160e06040518083038186803b158015612f9757600080fd5b505afa158015612fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fcf9190614485565b90506000600a60009054906101000a90046001600160a01b03166001600160a01b031663bdd1e0806040518163ffffffff1660e01b815260040160e06040518083038186803b15801561302157600080fd5b505afa158015613035573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061305991906144ec565b90506000600a60009054906101000a90046001600160a01b03166001600160a01b031663904b33d36040518163ffffffff1660e01b815260040160e06040518083038186803b1580156130ab57600080fd5b505afa1580156130bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130e39190614485565b905060005b60078160ff1610156132925760008260ff83166007811061310b5761310b614134565b602002015160ff16141561317857838160ff166007811061312e5761312e614134565b602002015160ff16838260ff166007811061314b5761314b614134565b602002015161315a919061454a565b61ffff1660126001016000828254613172919061411c565b90915550505b60028260ff83166007811061318f5761318f614134565b602002015160ff1614156131fc57838160ff16600781106131b2576131b2614134565b602002015160ff16838260ff16600781106131cf576131cf614134565b60200201516131de919061454a565b61ffff16601260020160008282546131f6919061411c565b90915550505b60018260ff83166007811061321357613213614134565b602002015160ff16141561328057838160ff166007811061323657613236614134565b602002015160ff16838260ff166007811061325357613253614134565b6020020151613262919061454a565b61ffff166012600001600082825461327a919061411c565b90915550505b8061328a816141e6565b9150506130e8565b5050505050565b600160155460ff1660038111156132b2576132b2614206565b1480156132c157506013548311155b156132de578151826132d282614398565b61ffff16905250505050565b600260155460ff1660038111156132f7576132f7614206565b148015613305575060145483115b15613567576000826020015161ffff16826004018054905061332791906141ad565b1115613552576020820180519061333d82614398565b61ffff16905250600754602083015160009182916001600160a01b039091169063d3f161ac90600486019061337490600190614574565b61ffff168154811061338857613388614134565b90600052602060002001546040518263ffffffff1660e01b81526004016133b191815260200190565b604080518083038186803b1580156133c857600080fd5b505afa1580156133dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134009190614451565b9092509050600081600881111561341957613419614206565b14806134365750600381600881111561343457613434614206565b145b806134525750600681600881111561345057613450614206565b145b1561347257816012600001600082825461346c91906141ad565b90915550505b600181600881111561348657613486614206565b14806134a3575060048160088111156134a1576134a1614206565b145b806134bf575060078160088111156134bd576134bd614206565b145b156134df5781601260010160008282546134d991906141ad565b90915550505b60028160088111156134f3576134f3614206565b14806135105750600581600881111561350e5761350e614206565b145b8061352c5750600881600881111561352a5761352a614206565b145b1561329257816012600201600082825461354691906141ad565b90915550505050505050565b604082015161ffff1661356757606460408301525b505050565b8280548282559060005260206000209081019282156135ac5760005260206000209182015b828111156135ac578254825591600101919060010190613591565b506135b8929150613679565b5090565b604051806101600160405280600015158152602001600061ffff168152602001600061ffff168152602001600061ffff168152602001600081526020016000815260200160008152602001606081526020016000815260200160008152602001600081525090565b8280548282559060005260206000209081019282156135ac579160200282015b828111156135ac578251825591602001919060010190613644565b508054600082559060005260206000209081019061248091905b5b808211156135b8576000815560010161367a565b6001600160a01b038116811461248057600080fd5b6000806000606084860312156136b857600080fd5b83356136c38161368e565b925060208401356136d38161368e565b929592945050506040919091013590565b6000806000806000608086880312156136fc57600080fd5b85356137078161368e565b945060208601356137178161368e565b93506040860135925060608601356001600160401b038082111561373a57600080fd5b818801915088601f83011261374e57600080fd5b81358181111561375d57600080fd5b89602082850101111561376f57600080fd5b9699959850939650602001949392505050565b60006020828403121561379457600080fd5b813561379f8161368e565b9392505050565b6000602082840312156137b857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b03811182821017156137f8576137f86137bf565b60405290565b60405160c081016001600160401b03811182821017156137f8576137f86137bf565b60405161010081016001600160401b03811182821017156137f8576137f86137bf565b60405160e081016001600160401b03811182821017156137f8576137f86137bf565b604051601f8201601f191681016001600160401b038111828210171561388d5761388d6137bf565b604052919050565b60006001600160401b038211156138ae576138ae6137bf565b5060051b60200190565b600082601f8301126138c957600080fd5b813560206138de6138d983613895565b613865565b82815260059290921b840181019181810190868411156138fd57600080fd5b8286015b848110156139185780358352918301918301613901565b509695505050505050565b60006001600160401b0382111561393c5761393c6137bf565b50601f01601f191660200190565b600082601f83011261395b57600080fd5b8135602061396b6138d983613895565b82815260059290921b8401810191818101908684111561398a57600080fd5b8286015b848110156139185780356001600160401b038111156139ad5760008081fd5b8701603f810189136139bf5760008081fd5b8481013560406139d16138d983613923565b8281528b828486010111156139e65760008081fd5b828285018983013760009281018801929092525084525091830191830161398e565b60008060008060008060c08789031215613a2157600080fd5b8635955060208701356001600160401b0380821115613a3f57600080fd5b613a4b8a838b016138b8565b96506040890135915080821115613a6157600080fd5b613a6d8a838b016138b8565b95506060890135915080821115613a8357600080fd5b613a8f8a838b016138b8565b94506080890135915080821115613aa557600080fd5b613ab18a838b016138b8565b935060a0890135915080821115613ac757600080fd5b50613ad489828a0161394a565b9150509295509295509295565b60008060408385031215613af457600080fd5b8235613aff8161368e565b946020939093013593505050565b600081518084526020808501945080840160005b83811015613b3d57815187529582019590820190600101613b21565b509495945050505050565b80511515825260006101606020830151613b68602086018261ffff169052565b506040830151613b7e604086018261ffff169052565b506060830151613b94606086018261ffff169052565b506080830151608085015260a083015160a085015260c083015160c085015260e08301518160e0860152613bca82860182613b0d565b61010085810151908701526101208086015190870152610140948501519490950193909352509192915050565b60208152600061379f6020830184613b48565b80358015158114613c1a57600080fd5b919050565b61ffff8116811461248057600080fd5b8035613c1a81613c1f565b600060208284031215613c4c57600080fd5b81356001600160401b0380821115613c6357600080fd5b908301906101608286031215613c7857600080fd5b613c806137d5565b613c8983613c0a565b8152613c9760208401613c2f565b6020820152613ca860408401613c2f565b6040820152613cb960608401613c2f565b60608201526080830135608082015260a083013560a082015260c083013560c082015260e083013582811115613cee57600080fd5b613cfa878286016138b8565b60e083015250610100838101359082015261012080840135908201526101409283013592810192909252509392505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613d8157603f19888603018452613d6f858351613b48565b94509285019290850190600101613d53565b5092979650505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b602080825260149082015273043616e206e6f74206265206164647265737320360641b604082015260600190565b600060208284031215613e2757600080fd5b815161379f8161368e565b60005b83811015613e4d578181015183820152602001613e35565b83811115613e5c576000848401525b50505050565b60008151808452613e7a816020860160208601613e32565b601f01601f19169290920160200192915050565b604080825283516001600160a01b03169082015260208084015160c0606084015260009190613ec1610100850182613b0d565b90506040860151603f1980868403016080870152613edf8383613b0d565b925060608801519150808684030160a0870152613efc8383613b0d565b925060808801519150808684030160c0870152613f198383613b0d565b60a089015187820390920160e08801528151808252909350908401915083830190600581901b8401850160005b82811015613f7457601f19868303018452613f62828651613e62565b94870194938701939150600101613f46565b509690940196909652509295945050505050565b805160ff81168114613c1a57600080fd5b8051613c1a81613c1f565b600082601f830112613fb557600080fd5b81516020613fc56138d983613895565b82815260059290921b84018101918181019086841115613fe457600080fd5b8286015b8481101561391857613ff981613f88565b8352918301918301613fe8565b60006020828403121561401857600080fd5b81516001600160401b038082111561402f57600080fd5b9083019060c0828603121561404357600080fd5b61404b6137fe565b82516004811061405a57600080fd5b815261406860208401613f88565b602082015261407960408401613f99565b604082015260608301518281111561409057600080fd5b61409c87828601613fa4565b6060830152506080830151608082015260a083015160a082015280935050505092915050565b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff84168060ff038211156140f5576140f56140c2565b019392505050565b6000816000190483118215151615614117576141176140c2565b500290565b6000821982111561412f5761412f6140c2565b500190565b634e487b7160e01b600052603260045260246000fd5b600060001982141561415e5761415e6140c2565b5060010190565b604080825283519082018190526000906020906060840190828701845b8281101561419e57815184529284019290840190600101614182565b50505092019290925292915050565b6000828210156141bf576141bf6140c2565b500390565b6000826141e157634e487b7160e01b600052601260045260246000fd5b500490565b600060ff821660ff8114156141fd576141fd6140c2565b60010192915050565b634e487b7160e01b600052602160045260246000fd5b600082601f83011261422d57600080fd5b604051606081018181106001600160401b038211171561424f5761424f6137bf565b60405280606084018581111561426457600080fd5b845b8181101561428757805161427981613c1f565b835260209283019201614266565b509195945050505050565b600080608083850312156142a557600080fd5b82516001600160401b03808211156142bc57600080fd5b8185019150601f86818401126142d157600080fd5b6142d9613820565b806101008501898111156142ec57600080fd5b855b8181101561435b578051868111156143065760008081fd5b87018581018c136143175760008081fd5b805160206143276138d983613923565b8281528e8284860101111561433c5760008081fd5b61434b83838301848701613e32565b87529095019450506020016142ee565b50508096505050505050614372846020850161421c565b90509250929050565b60006020828403121561438d57600080fd5b815161379f81613c1f565b600061ffff808316818114156143b0576143b06140c2565b6001019392505050565b600061012060018060a01b038c1683528a60208401528960408401528860608401528760808401528060a08401526143f481840188613e62565b905082810360c08401526144088187613e62565b60e084019590955250506101000152979650505050505050565b60006020828403121561443457600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000806040838503121561446457600080fd5b8251915060208301516009811061447a57600080fd5b809150509250929050565b600060e0828403121561449757600080fd5b82601f8301126144a657600080fd5b6144ae613843565b8060e08401858111156144c057600080fd5b845b818110156144e1576144d381613f88565b8452602093840193016144c2565b509095945050505050565b600060e082840312156144fe57600080fd5b82601f83011261450d57600080fd5b614515613843565b8060e084018581111561452757600080fd5b845b818110156144e157805161453c81613c1f565b845260209384019301614529565b600061ffff8083168185168183048111821515161561456b5761456b6140c2565b02949350505050565b600061ffff8381169083168181101561458f5761458f6140c2565b03939250505056fea164736f6c6343000809000a

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading