Contract 0xa76dbab4d86fc95ab6bbc248138128a94451408b

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x13fba63511b5dc3eefe32dee6427e9ad24dc5906b188ac846a90591ed1f3e9b5Buy Support Ship...26929002022-10-03 2:57:001 min ago0x1405926895600265260fe89fee8d1cbd2c1a43f2 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067092
0x5983901f1ea814340d8f085cd577b45de2ee37473405f82e53d3041ab31e8892Buy Support Ship...26928972022-10-03 2:56:122 mins ago0x1405926895600265260fe89fee8d1cbd2c1a43f2 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067092
0x91161d7e16d13acbe16753bdcb9e1a598c8ba509aee7b4b4735cac00dfec0605Buy Support Ship...26928942022-10-03 2:55:303 mins ago0x9d3bcf6095791216cb9e39acb3c59b53fdc3b717 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067092
0x0ce05032d23e66e2a43abd332bcc9a082c342c63faf719c43d6dd4a783b101afBuy Support Ship...26928932022-10-03 2:55:183 mins ago0x9d3bcf6095791216cb9e39acb3c59b53fdc3b717 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067092
0x881c50e1c10bf8dba61d2a6fc7864c7a468ed8d9e5fa72747e13a158c05b836dRepair Flagship26928802022-10-03 2:52:366 mins ago0x9d3bcf6095791216cb9e39acb3c59b53fdc3b717 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.0001697075
0x8b27780f300a0a03238c449d473ecf748d4647da9cb5561e5f18ec61c3493995Upgrade Flagship26927722022-10-03 2:30:3028 mins ago0xed9490eb47478b11e0c6352446fa70542a093ef5 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.00020417
0xd46b70f11c94ad57cbbb293a48faa7cf1fc8c0e2489ed0b641957586d9a403ccRepair Flagships26927392022-10-03 2:23:4235 mins ago0xfe27522c648c8533f25e53cd91078b4c70c63645 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000070987
0x211dde27934a59478f1d8b2c64cf4f45f3f9830b27c7e6f3cb792d0da7ba5fd9Repair Flagship26924432022-10-03 1:21:361 hr 37 mins ago0x9676d8b9ef1cb4c9f856e86e7c7eabbd8e226ea6 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067883
0x00f4904260074b740b1fd5deaa1b746e9b2b93feffea6add6e224204a9e95e17Repair Flagship26924412022-10-03 1:21:121 hr 37 mins ago0x2535eefc8f3f61e6c59b42b91a09ae8ba35516f0 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.0001697075
0x99ca0f5aeba245655aa0e5c33952e57fce78f60bf5ce948a14a23e050d54a27fBuy Support Ship...26923252022-10-03 0:57:122 hrs 1 min ago0x813fba0fcc4efae3524a0b31a43ad4a45ea3c503 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067092
0x400a37cba5936e41b7ce14e10e7cbd15c91946a1639c94e68eb6bc7405089fe3Buy Support Ship...26923182022-10-03 0:55:362 hrs 3 mins ago0x551fb557b6e02c7a4348715c16f1fc89b8ec32f7 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.00006708
0x2a6c8c40943643d616efe9077950b96f2f8a94f06f9e9444a0bca7c721b6e853Repair Flagship26922682022-10-03 0:45:182 hrs 13 mins ago0x78fa562db71c28af6e0643324cd2b5d3cf2bc6ef IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.0001697075
0x91fb6aa7903a420ea0aabd26500391ac8337b5a3994fe80ad2067d7903b34b6cRepair Flagships26922612022-10-03 0:43:542 hrs 14 mins ago0x551fb557b6e02c7a4348715c16f1fc89b8ec32f7 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000070987
0xcde03927c25af9802a8643f50acb1af004bc29d13fdb3f1a0f58c4fabb24137cBuy Support Ship...26922162022-10-03 0:34:542 hrs 23 mins ago0x45af66ef9eb1e505077551df87b2e95d7481018c IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067092
0xa8efa7a3ce58dbd29c44f90f8e75bc3202818550a40ab23f93371924e90e9ec0Buy Support Ship...26922152022-10-03 0:34:422 hrs 24 mins ago0x45af66ef9eb1e505077551df87b2e95d7481018c IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000071505
0x1651ce65e62345e34df016a64dcd134f2fa5a4afccf815ccdb030dd4cd5285c5Repair Flagship26921772022-10-03 0:26:542 hrs 31 mins ago0x5655055e05757f013f21bcda60cfeee69dc09c32 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.00016359803
0x99c4160c6b7758476f6239369914622a81145ae276e587150e7cb333c6f97d59Buy Support Ship...26920172022-10-02 23:54:183 hrs 4 mins ago0x5655055e05757f013f21bcda60cfeee69dc09c32 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.00017396
0x3a320031e0c66b189c99246dcaa3c463a45fb9b04135215162ff883691ced643Repair Flagships26918542022-10-02 23:20:483 hrs 38 mins ago0x7ae9d9fb675b84a5df94215e32e55fa09ec5f94e IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000070987
0xbd8e21be1335e08522e0619c2dab2f42259eeb49d12770b383e0cb57b080d7c1Upgrade Flagship26917512022-10-02 23:00:123 hrs 58 mins ago0x72e4ab52c24daef73845b4d7a640be9b5cb16520 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.0002042
0x7d3c020850a80fff6bac0f20525b350a779bb80e29b34f55e6f70387c4b6bb18Repair Flagship26916632022-10-02 22:42:184 hrs 16 mins ago0x34e1583b4518ba76b4cde35abe8fe5e1ac2fb744 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067883
0x56681799a75b2ae3be9073897f44ca289c5ef8591a08c0d4f7ee6e26d4912688Repair Flagships26914622022-10-02 22:00:304 hrs 58 mins ago0x9210cbb688eb68d0c0dec88da9d7ee8a6b8b4dec IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.0001774675
0x406e1db5ad422e31397b282d56226992ca9632be4261c5e10cd0019f3728d500Repair Flagships26913922022-10-02 21:46:005 hrs 12 mins ago0xa490ba57d4a38ec8d6acfbe3c202689d4d2b985e IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.00022053
0xb5d13010bc5b0a80474db8f661b48cb9a8ae299264e643fe28f360d7536acefaBuy Support Ship...26912902022-10-02 21:24:485 hrs 34 mins ago0x9d3bcf6095791216cb9e39acb3c59b53fdc3b717 IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.000067092
0xd8cf518df1ebcb6ef19954e2569532024e731f561f77dd4da93054d8b21c20dbRepair Flagships26912812022-10-02 21:22:485 hrs 36 mins ago0x9b03dfd19705850beefb16d6a7ec77646d1bc26d IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.0001774675
0x49d827548ca69311ace51ef0dd5fb47feff50778d44e5d50b83d3aa34141ae6cRepair Flagships26912752022-10-02 21:21:245 hrs 37 mins ago0x0e304ad208cf62b90956ce200a5bfbd82e63e4cf IN  0xa76dbab4d86fc95ab6bbc248138128a94451408b0 MOVR0.0000882
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DPSShipyard

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 16 : DPSShipyard.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

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

contract DPSShipyard is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    IERC721 public dps;
    DPSFlagshipI public flagship;
    DPSSupportShipI public supportShip;
    IERC20MintableBurnable public doubloon;
    DPSGameSettingsI public gameSettings;

    event FlagshipMinted(address indexed _owner, uint16 _tokenId);
    event BoughSupportShip(address indexed _owner, SUPPORT_SHIP_TYPE _type, uint256 _quantity);
    event SetContract(string indexed _target, address _contract);
    event FlagshipRepaired(uint256 indexed _flagshipId);
    event FlagshipUpgraded(uint256 indexed _flagshipId, FLAGSHIP_PART[] _parts, uint8[] _levels, uint256 doubloonsSpent);
    event TokenRecovered(address indexed _token, address _destination, uint256 _amount);

    constructor() {}

    /**
     * @notice claiming a flagship by owning a Pirate. the flagship token id = dps id
     * @param _dpsId - pirate id
     */
    function claimFlagship(uint16 _dpsId) external nonReentrant {
        if (gameSettings.isPaused(10) == 1) revert Paused();
        if (dps.ownerOf(_dpsId) != msg.sender) revert WrongParams(1);

        flagship.mint(msg.sender, _dpsId);
        emit FlagshipMinted(msg.sender, _dpsId);
    }

    /**
     * @notice repairing a damaged ship, costs doubloons see `repairFlagshipCost` on GameSettings
     * @param _flagshipId - id of the flagship
     */
    function repairFlagship(uint256 _flagshipId) public {
        if (gameSettings.isPaused(11) == 1) revert Paused();

        // needs to be the owner of the flagship
        if (flagship.ownerOf(_flagshipId) != msg.sender) revert WrongParams(2);

        doubloon.burn(msg.sender, gameSettings.repairFlagshipCost());
        flagship.upgradePart(FLAGSHIP_PART.HEALTH, _flagshipId, 100);
        emit FlagshipRepaired(_flagshipId);
    }

    /**
     * @notice repairing a multiple flagships
     * @param _flagshipIds - ids of the flagships
     */
    function repairFlagships(uint256[] calldata _flagshipIds) external nonReentrant {
        for (uint256 i; i < _flagshipIds.length; i++) {
            repairFlagship(_flagshipIds[i]);
        }
    }

    /**
     * @notice upgrade parts of flagship for doubloons
     * @param _flagshipId the flagship we want to upgrade
     * @param _parts [] parts we want to upgrade
     * @param _levels [] levels we want the part to upgrade to, warning the index of the level
     *                needs to corespond with the index of the part from _parts[]
     */
    function upgradeFlagship(
        uint256 _flagshipId,
        FLAGSHIP_PART[] calldata _parts,
        uint8[] calldata _levels
    ) external nonReentrant {
        if (gameSettings.isPaused(12) == 1) revert Paused();

        // needs to be the owner of the flagship
        if (flagship.ownerOf(_flagshipId) != msg.sender) revert WrongParams(3);

        if (_parts.length != _levels.length) revert WrongParams(3);

        uint256 doubloonPerUpgrade = gameSettings.doubloonPerUpgradePart();
        uint8[7] memory currentLevels = flagship.getPartsLevel(_flagshipId);

        uint256 amountOfDoubloons = 0;
        for (uint256 i; i < _parts.length; i++) {
            FLAGSHIP_PART part = _parts[i];
            uint8 currentLevel = currentLevels[uint256(part)];

            if (part == FLAGSHIP_PART.HEALTH || currentLevel >= 10) continue;
            uint8 excess = 0;
            currentLevel += _levels[i];

            if (currentLevel > 10) {
                excess = currentLevel - 10;
                currentLevel = 10;
            }
            amountOfDoubloons += (_levels[i] - excess) * doubloonPerUpgrade;
            currentLevels[uint256(part)] = currentLevel;
            flagship.upgradePart(part, _flagshipId, currentLevel);
        }

        if (amountOfDoubloons == 0 || doubloon.balanceOf(msg.sender) < amountOfDoubloons) revert NotEnoughTokens();

        doubloon.burn(msg.sender, amountOfDoubloons);
        emit FlagshipUpgraded(_flagshipId, _parts, _levels, amountOfDoubloons);
    }

    /**
     * @notice buy support ships, just 1 type per tx, requires doubloons
     * @param _type tyep of support ship you want to buy
     * @param _quantity the quantity you want to buy
     */
    function buySupportShips(SUPPORT_SHIP_TYPE _type, uint256 _quantity) external nonReentrant {
        if (gameSettings.isPaused(13) == 1) revert Paused();

        uint256 doubloonsPerShip = gameSettings.getDoubloonsPerSupportShipType(_type);
        doubloon.burn(msg.sender, doubloonsPerShip * _quantity);
        supportShip.mint(msg.sender, uint256(_type), _quantity);
        emit BoughSupportShip(msg.sender, _type, _quantity);
    }

    /**
     * SETTERS & GETTERS
     */
    function setDpsContract(address _contract) external onlyOwner {
        if (_contract == address(0)) revert AddressZero();
        dps = IERC721(_contract);
        emit SetContract("DPS", _contract);
    }

    function setFlagshipContract(address _contract) external onlyOwner {
        if (_contract == address(0)) revert AddressZero();
        flagship = DPSFlagshipI(_contract);
        emit SetContract("Flagship", _contract);
    }

    function setGameSettingsContract(address _contract) external onlyOwner {
        if (_contract == address(0)) revert AddressZero();
        gameSettings = DPSGameSettingsI(_contract);
        emit SetContract("GameSettings", _contract);
    }

    function setDoubloonsContract(address _contract) external onlyOwner {
        if (_contract == address(0)) revert AddressZero();
        doubloon = IERC20MintableBurnable(_contract);
        emit SetContract("Doubloons", _contract);
    }

    function setSupportShip(address _contract) external onlyOwner {
        if (_contract == address(0)) revert AddressZero();
        supportShip = DPSSupportShipI(_contract);
        emit SetContract("SupportShip", _contract);
    }

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

    /**
     * @notice Recover TOKENS sent by mistake to the contract
     * @param _token the TOKEN address
     * @param _destination where to send the NFT
     */
    function recoverERC20(address _token, address _destination) external onlyOwner {
        if (_destination == address(0)) revert AddressZero();
        uint256 amount = IERC20(_token).balanceOf(address(this));
        IERC20(_token).safeTransfer(_destination, amount);
        emit TokenRecovered(_token, _destination, amount);
    }
}

File 2 of 16 : 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 16 : 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 16 : 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 16 : 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 6 of 16 : 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 7 of 16 : 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 8 of 16 : DPSInterfaces.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

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

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

    function burn(uint256 _tokenId) external;

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

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

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

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

interface DPSRandomI {
    function getRandomBatch(
        address _address,
        uint256[] memory _blockNumber,
        bytes32[] memory _hash1,
        bytes32[] memory _hash2,
        uint256[] memory _timestamp,
        bytes[] calldata _signature,
        string[] calldata _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[] calldata _entropy,
        uint256 _min,
        uint256 _max
    ) external pure returns (uint256[] memory randoms);

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

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

    function checkCausalityParams(
        CausalityParams calldata _causalityParams,
        VoyageConfig calldata _voyageConfig,
        LockedVoyage calldata _lockedVoyage
    ) external pure;
}

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

    function maxSkillsCap() external view returns (uint16);

    function maxRollCap() external view returns (uint16);

    function flagshipBaseSkills() external view returns (uint16);

    function maxOpenLockBoxes() external view returns (uint256);

    function blockJumps() 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 gapBetweenVoyagesCreation() external view returns (uint256);

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

    function tmapPerDoubloon() external view returns (uint256);

    function repairFlagshipCost() external view returns (uint256);

    function doubloonPerUpgradePart() external view returns (uint256);

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

    function computeFlagShipSkills(uint8[7] calldata levels, VoyageStatusCache memory _claimingRewardsCache)
        external
        view
        returns (VoyageStatusCache memory);

    function computeSupportSkills(
        uint8[9] calldata _supportShips,
        ARTIFACT_TYPE _type,
        VoyageStatusCache memory _claimingRewardsCache
    ) external view returns (VoyageStatusCache memory);

    function getDoubloonsPerSupportShipType(SUPPORT_SHIP_TYPE _type) external view returns (uint256);

    function getSupportShipsSkillBoosts(SUPPORT_SHIP_TYPE _type) external view returns (uint16);

    function getMaxSupportShipsPerVoyageType(VOYAGE_TYPE _type) external view returns (uint8);

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

    function maxRollCapLockBoxes() external view returns (uint16);

    function getLockBoxesDistribution(ARTIFACT_TYPE _type) external view returns (uint16[2] memory);

    function getVoyageDebuffs(VOYAGE_TYPE _type) external view returns (uint16);

    function debuffVoyage(VOYAGE_TYPE _voyageType, VoyageStatusCache memory _claimingRewardsCache)
        external
        view
        returns (VoyageStatusCache memory);

    function interpretResults(
        uint256 _result,
        VoyageResult memory _voyageResult,
        LockedVoyage calldata _lockedVoyage,
        VoyageStatusCache memory _claimingRewardsCache,
        INTERACTION _interaction,
        CausalityParams calldata _causalityParams,
        uint256 _index
    ) external view returns (VoyageResult memory, VoyageStatusCache memory);

    function getArtifactSkillBoosts(ARTIFACT_TYPE _type) external view returns (uint16);
}

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

interface DPSSupportShipI is IERC1155 {
    function burn(
        address _from,
        uint256 _type,
        uint256 _amount
    ) external;

    function mint(
        address _owner,
        uint256 _type,
        uint256 _amount
    ) external;
}

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

    function burn(uint256 _id) external;

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

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

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

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

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

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

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

File 9 of 16 : DPSStructs.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

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 ARTIFACT_TYPE {
    NONE,
    COMMON_STRENGTH,
    COMMON_LUCK,
    COMMON_NAVIGATION,
    RARE_STRENGTH,
    RARE_LUCK,
    RARE_NAVIGATION,
    EPIC_STRENGTH,
    EPIC_LUCK,
    EPIC_NAVIGATION,
    LEGENDARY_STRENGTH,
    LEGENDARY_LUCK,
    LEGENDARY_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;
    address buyer;
}

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 {
    uint256[] blockNumber;
    bytes32[] hash1;
    bytes32[] hash2;
    uint256[] timestamp;
    bytes[] signature;
}

struct LockedVoyage {
    uint8 totalSupportShips;
    VOYAGE_TYPE voyageType;
    ARTIFACT_TYPE artifactId;
    uint8[9] supportShips; //this should be an array for each type, expressing the quantities he took on a trip
    uint8[] sequence;
    uint16 navigation;
    uint16 luck;
    uint16 strength;
    uint256 voyageId;
    uint256 dpsId;
    uint256 flagshipId;
    uint256 lockedBlock;
    uint256 lockedTimestamp;
    uint256 claimedTime;
}

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

struct VoyageStatusCache {
    uint256 strength;
    uint256 luck;
    uint256 navigation;
    string entropy;
}

error AddressZero();
error Paused();
error WrongParams(uint256 _location);
error WrongState(uint256 _state);
error Unauthorized();
error NotEnoughTokens();

File 10 of 16 : 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 16 : 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 12 of 16 : 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 13 of 16 : 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);
}

File 14 of 16 : 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 15 of 16 : 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 16 : 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;
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"NotEnoughTokens","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[{"internalType":"uint256","name":"_location","type":"uint256"}],"name":"WrongParams","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":false,"internalType":"enum SUPPORT_SHIP_TYPE","name":"_type","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"BoughSupportShip","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":false,"internalType":"uint16","name":"_tokenId","type":"uint16"}],"name":"FlagshipMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_flagshipId","type":"uint256"}],"name":"FlagshipRepaired","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_flagshipId","type":"uint256"},{"indexed":false,"internalType":"enum FLAGSHIP_PART[]","name":"_parts","type":"uint8[]"},{"indexed":false,"internalType":"uint8[]","name":"_levels","type":"uint8[]"},{"indexed":false,"internalType":"uint256","name":"doubloonsSpent","type":"uint256"}],"name":"FlagshipUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"_target","type":"string"},{"indexed":false,"internalType":"address","name":"_contract","type":"address"}],"name":"SetContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_token","type":"address"},{"indexed":false,"internalType":"address","name":"_destination","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"TokenRecovered","type":"event"},{"inputs":[{"internalType":"enum SUPPORT_SHIP_TYPE","name":"_type","type":"uint8"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"buySupportShips","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dpsId","type":"uint16"}],"name":"claimFlagship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"doubloon","outputs":[{"internalType":"contract IERC20MintableBurnable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dps","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flagship","outputs":[{"internalType":"contract DPSFlagshipI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameSettings","outputs":[{"internalType":"contract DPSGameSettingsI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_destination","type":"address"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"address","name":"_destination","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"recoverNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_flagshipId","type":"uint256"}],"name":"repairFlagship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_flagshipIds","type":"uint256[]"}],"name":"repairFlagships","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setDoubloonsContract","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":"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":"setSupportShip","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supportShip","outputs":[{"internalType":"contract DPSSupportShipI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_flagshipId","type":"uint256"},{"internalType":"enum FLAGSHIP_PART[]","name":"_parts","type":"uint8[]"},{"internalType":"uint8[]","name":"_levels","type":"uint8[]"}],"name":"upgradeFlagship","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061001a33610023565b60018055610073565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611efd806100826000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063bceaa6b811610071578063bceaa6b81461025f578063e8de7c3f14610272578063ea68ba8e14610285578063ed5647a414610298578063f2fde38b146102ab57600080fd5b80638da5cb5b14610202578063a09620fb14610213578063a1e40df814610226578063ab51ce7314610239578063b7297cf31461024c57600080fd5b806343a019e2116100f457806343a019e2146101ae57806343f4089e146101c157806348ef5ea3146101d4578063715018a6146101e7578063886f039a146101ef57600080fd5b80630d7f5035146101315780631526d0db146101465780633086f74d146101595780633c2f22bc1461018857806341898d091461019b575b600080fd5b61014461013f3660046118a1565b6102be565b005b6101446101543660046118e2565b6103cc565b60035461016c906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60045461016c906001600160a01b031681565b6101446101a93660046118ff565b610494565b60055461016c906001600160a01b031681565b6101446101cf3660046118e2565b61068c565b6101446101e23660046118e2565b61070c565b610144610794565b6101446101fd366004611923565b6107ca565b6000546001600160a01b031661016c565b60025461016c906001600160a01b031681565b6101446102343660046118e2565b6108df565b6101446102473660046119a8565b610964565b60065461016c906001600160a01b031681565b61014461026d366004611a22565b610ef3565b610144610280366004611a52565b611170565b6101446102933660046118e2565b611407565b6101446102a6366004611a6b565b611490565b6101446102b93660046118e2565b6114fe565b6000546001600160a01b031633146102f15760405162461bcd60e51b81526004016102e890611aad565b60405180910390fd5b6001600160a01b03821661031857604051639fabe1c160e01b815260040160405180910390fd5b604051632142170760e11b81523060048201526001600160a01b038381166024830152604482018390528416906342842e0e90606401600060405180830381600087803b15801561036857600080fd5b505af115801561037c573d6000803e3d6000fd5b5050604080516001600160a01b03868116825260208201869052871693507f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f90969250015b60405180910390a2505050565b6000546001600160a01b031633146103f65760405162461bcd60e51b81526004016102e890611aad565b6001600160a01b03811661041d57604051639fabe1c160e01b815260040160405180910390fd5b600580546001600160a01b0319166001600160a01b03831617905560405168446f75626c6f6f6e7360b81b81526009015b6040519081900381206001600160a01b0383168252907fbf2cc7083b32d1f5c82633af784e1285df86eb43c88d0752feea4bebb4a0b6d29060200160405180910390a250565b6002600154036104b65760405162461bcd60e51b81526004016102e890611ae2565b600260015560065460405163bc61e73360e01b8152600a60048201526001600160a01b039091169063bc61e73390602401602060405180830381865afa158015610504573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105289190611b38565b60ff1660010361054b576040516313d0ff5960e31b815260040160405180910390fd5b6002546040516331a9108f60e11b815261ffff8316600482015233916001600160a01b031690636352211e90602401602060405180830381865afa158015610597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bb9190611b55565b6001600160a01b0316146105e557604051632473a0d360e11b8152600160048201526024016102e8565b6003546040516340c10f1960e01b815233600482015261ffff831660248201526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561063457600080fd5b505af1158015610648573d6000803e3d6000fd5b505060405161ffff841681523392507f2890feb5d8d1c81cccd8ff6e918319a45f00588d253e36cce602112b9d2b0e0c915060200160405180910390a25060018055565b6000546001600160a01b031633146106b65760405162461bcd60e51b81526004016102e890611aad565b6001600160a01b0381166106dd57604051639fabe1c160e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383161790556040516244505360e81b815260030161044e565b6000546001600160a01b031633146107365760405162461bcd60e51b81526004016102e890611aad565b6001600160a01b03811661075d57604051639fabe1c160e01b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b0383161790556040516a0537570706f7274536869760ac1b8152600b0161044e565b6000546001600160a01b031633146107be5760405162461bcd60e51b81526004016102e890611aad565b6107c86000611599565b565b6000546001600160a01b031633146107f45760405162461bcd60e51b81526004016102e890611aad565b6001600160a01b03811661081b57604051639fabe1c160e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610862573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108869190611b72565b905061089c6001600160a01b03841683836115e9565b604080516001600160a01b038481168252602082018490528516917f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f909691016103bf565b6000546001600160a01b031633146109095760405162461bcd60e51b81526004016102e890611aad565b6001600160a01b03811661093057604051639fabe1c160e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b038316179055604051670466c6167736869760c41b815260080161044e565b6002600154036109865760405162461bcd60e51b81526004016102e890611ae2565b600260015560065460405163bc61e73360e01b8152600c60048201526001600160a01b039091169063bc61e73390602401602060405180830381865afa1580156109d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f89190611b38565b60ff16600103610a1b576040516313d0ff5960e31b815260040160405180910390fd5b6003546040516331a9108f60e11b81526004810187905233916001600160a01b031690636352211e90602401602060405180830381865afa158015610a64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a889190611b55565b6001600160a01b031614610ab257604051632473a0d360e11b8152600360048201526024016102e8565b828114610ad557604051632473a0d360e11b8152600360048201526024016102e8565b600654604080516364bbd76f60e11b815290516000926001600160a01b03169163c977aede9160048083019260209291908290030181865afa158015610b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b439190611b72565b60035460405163a3df934f60e01b8152600481018990529192506000916001600160a01b039091169063a3df934f9060240160e060405180830381865afa158015610b92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb69190611b8b565b90506000805b86811015610dac576000888883818110610bd857610bd8611c1e565b9050602002016020810190610bed9190611c43565b9050600084826006811115610c0457610c04611c5e565b60078110610c1457610c14611c1e565b602002015190506000826006811115610c2f57610c2f611c5e565b1480610c3f5750600a8160ff1610155b15610c4b575050610d9a565b6000888885818110610c5f57610c5f611c1e565b9050602002016020810190610c749190611c74565b610c7e9083611ca7565b9150600a8260ff161115610c9e57610c97600a83611ccc565b9050600a91505b86818a8a87818110610cb257610cb2611c1e565b9050602002016020810190610cc79190611c74565b610cd19190611ccc565b60ff16610cde9190611cef565b610ce89086611d0e565b94508186846006811115610cfe57610cfe611c5e565b60078110610d0e57610d0e611c1e565b602002019060ff16908160ff1681525050600360009054906101000a90046001600160a01b03166001600160a01b0316639a555839848e856040518463ffffffff1660e01b8152600401610d6493929190611d3a565b600060405180830381600087803b158015610d7e57600080fd5b505af1158015610d92573d6000803e3d6000fd5b505050505050505b80610da481611d5f565b915050610bbc565b50801580610e2357506005546040516370a0823160e01b815233600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190611b72565b105b15610e41576040516308aeed0f60e21b815260040160405180910390fd5b600554604051632770a7eb60e21b8152336004820152602481018390526001600160a01b0390911690639dc29fac90604401600060405180830381600087803b158015610e8d57600080fd5b505af1158015610ea1573d6000803e3d6000fd5b50505050877f9765c61d28fd9c06a3bf69dccb7bedc529f05ad53b0e3473a0720366dc9822c48888888886604051610edd959493929190611d78565b60405180910390a2505060018055505050505050565b600260015403610f155760405162461bcd60e51b81526004016102e890611ae2565b600260015560065460405163bc61e73360e01b8152600d60048201526001600160a01b039091169063bc61e73390602401602060405180830381865afa158015610f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f879190611b38565b60ff16600103610faa576040516313d0ff5960e31b815260040160405180910390fd5b600654604051632822d87d60e01b81526000916001600160a01b031690632822d87d90610fdb908690600401611e20565b602060405180830381865afa158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c9190611b72565b6005549091506001600160a01b0316639dc29fac3361103b8585611cef565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561108157600080fd5b505af1158015611095573d6000803e3d6000fd5b50506004546001600160a01b0316915063156e29f69050338560088111156110bf576110bf611c5e565b6040516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482015260448101859052606401600060405180830381600087803b15801561110c57600080fd5b505af1158015611120573d6000803e3d6000fd5b50505050336001600160a01b03167f7109a80ca98a22133950ff2653fc863e1ad9bc35eeeeebef17f8757c7f49363b848460405161115f929190611e34565b60405180910390a250506001805550565b60065460405163bc61e73360e01b8152600b60048201526001600160a01b039091169063bc61e73390602401602060405180830381865afa1580156111b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dd9190611b38565b60ff16600103611200576040516313d0ff5960e31b815260040160405180910390fd5b6003546040516331a9108f60e11b81526004810183905233916001600160a01b031690636352211e90602401602060405180830381865afa158015611249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126d9190611b55565b6001600160a01b03161461129757604051632473a0d360e11b8152600260048201526024016102e8565b600554600654604080516306a0d55160e31b815290516001600160a01b0393841693639dc29fac933393911691633506aa88916004808201926020929091908290030181865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113139190611b72565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561135957600080fd5b505af115801561136d573d6000803e3d6000fd5b5050600354604051639a55583960e01b81526001600160a01b039091169250639a55583991506113a7906000908590606490600401611d3a565b600060405180830381600087803b1580156113c157600080fd5b505af11580156113d5573d6000803e3d6000fd5b50506040518392507f20d8223977d6b9d0eb961e3357248854b561d0857289a462f9f397847654075d9150600090a250565b6000546001600160a01b031633146114315760405162461bcd60e51b81526004016102e890611aad565b6001600160a01b03811661145857604051639fabe1c160e01b815260040160405180910390fd5b600680546001600160a01b0319166001600160a01b0383161790556040516b47616d6553657474696e677360a01b8152600c0161044e565b6002600154036114b25760405162461bcd60e51b81526004016102e890611ae2565b600260015560005b818110156114f5576114e38383838181106114d7576114d7611c1e565b90506020020135611170565b806114ed81611d5f565b9150506114ba565b50506001805550565b6000546001600160a01b031633146115285760405162461bcd60e51b81526004016102e890611aad565b6001600160a01b03811661158d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102e8565b61159681611599565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261163b908490611640565b505050565b6000611695826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117129092919063ffffffff16565b80519091501561163b57808060200190518101906116b39190611e4f565b61163b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102e8565b6060611721848460008561172b565b90505b9392505050565b60608247101561178c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102e8565b843b6117da5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102e8565b600080866001600160a01b031685876040516117f69190611ea1565b60006040518083038185875af1925050503d8060008114611833576040519150601f19603f3d011682016040523d82523d6000602084013e611838565b606091505b5091509150611848828286611853565b979650505050505050565b60608315611862575081611724565b8251156118725782518084602001fd5b8160405162461bcd60e51b81526004016102e89190611ebd565b6001600160a01b038116811461159657600080fd5b6000806000606084860312156118b657600080fd5b83356118c18161188c565b925060208401356118d18161188c565b929592945050506040919091013590565b6000602082840312156118f457600080fd5b81356117248161188c565b60006020828403121561191157600080fd5b813561ffff8116811461172457600080fd5b6000806040838503121561193657600080fd5b82356119418161188c565b915060208301356119518161188c565b809150509250929050565b60008083601f84011261196e57600080fd5b50813567ffffffffffffffff81111561198657600080fd5b6020830191508360208260051b85010111156119a157600080fd5b9250929050565b6000806000806000606086880312156119c057600080fd5b85359450602086013567ffffffffffffffff808211156119df57600080fd5b6119eb89838a0161195c565b90965094506040880135915080821115611a0457600080fd5b50611a118882890161195c565b969995985093965092949392505050565b60008060408385031215611a3557600080fd5b823560098110611a4457600080fd5b946020939093013593505050565b600060208284031215611a6457600080fd5b5035919050565b60008060208385031215611a7e57600080fd5b823567ffffffffffffffff811115611a9557600080fd5b611aa18582860161195c565b90969095509350505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60ff8116811461159657600080fd5b8051611b3381611b19565b919050565b600060208284031215611b4a57600080fd5b815161172481611b19565b600060208284031215611b6757600080fd5b81516117248161188c565b600060208284031215611b8457600080fd5b5051919050565b600060e08284031215611b9d57600080fd5b82601f830112611bac57600080fd5b60405160e0810181811067ffffffffffffffff82111715611bdd57634e487b7160e01b600052604160045260246000fd5b6040528060e0840185811115611bf257600080fd5b845b81811015611c1357611c0581611b28565b835260209283019201611bf4565b509195945050505050565b634e487b7160e01b600052603260045260246000fd5b803560078110611b3357600080fd5b600060208284031215611c5557600080fd5b61172482611c34565b634e487b7160e01b600052602160045260246000fd5b600060208284031215611c8657600080fd5b813561172481611b19565b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff84168060ff03821115611cc457611cc4611c91565b019392505050565b600060ff821660ff841680821015611ce657611ce6611c91565b90039392505050565b6000816000190483118215151615611d0957611d09611c91565b500290565b60008219821115611d2157611d21611c91565b500190565b60078110611d3657611d36611c5e565b9052565b60608101611d488286611d26565b83602083015260ff83166040830152949350505050565b600060018201611d7157611d71611c91565b5060010190565b6060808252810185905260008660808301825b88811015611db857611da582611da085611c34565b611d26565b6020928301929190910190600101611d8b565b5083810360208581019190915286825291508690820160005b87811015611df9578235611de481611b19565b60ff1682529183019190830190600101611dd1565b508093505050508260408301529695505050505050565b60098110611d3657611d36611c5e565b60208101611e2e8284611e10565b92915050565b60408101611e428285611e10565b8260208301529392505050565b600060208284031215611e6157600080fd5b8151801515811461172457600080fd5b60005b83811015611e8c578181015183820152602001611e74565b83811115611e9b576000848401525b50505050565b60008251611eb3818460208701611e71565b9190910192915050565b6020815260008251806020840152611edc816040850160208701611e71565b601f01601f1916919091016040019291505056fea164736f6c634300080d000a

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