MOVR Price: $21.46 (-0.75%)
Gas: 3 GWei

Contract

0x28cbBC39A13e40B5B958BF9314158f87e8337252

Overview

MOVR Balance

Moonriver Chain LogoMoonriver Chain LogoMoonriver Chain Logo0 MOVR

MOVR Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Buy Voyage16721482022-04-04 7:30:24725 days ago1649057424IN
0x28cbBC39...7e8337252
0 MOVR0.000067912
Buy Voyage16721452022-04-04 7:28:36725 days ago1649057316IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721442022-04-04 7:28:06725 days ago1649057286IN
0x28cbBC39...7e8337252
0 MOVR0.00077752.41
Buy Voyage16721442022-04-04 7:28:06725 days ago1649057286IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721432022-04-04 7:27:54725 days ago1649057274IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721412022-04-04 7:27:24725 days ago1649057244IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721392022-04-04 7:26:42725 days ago1649057202IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721332022-04-04 7:25:00725 days ago1649057100IN
0x28cbBC39...7e8337252
0 MOVR0.000354871.1
Buy Voyage16721332022-04-04 7:25:00725 days ago1649057100IN
0x28cbBC39...7e8337252
0 MOVR0.000126562.5
Buy Voyage16721332022-04-04 7:25:00725 days ago1649057100IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721322022-04-04 7:23:42725 days ago1649057022IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721322022-04-04 7:23:42725 days ago1649057022IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721302022-04-04 7:22:48725 days ago1649056968IN
0x28cbBC39...7e8337252
0 MOVR0.000322611
Buy Voyage16721282022-04-04 7:22:12725 days ago1649056932IN
0x28cbBC39...7e8337252
0 MOVR0.000354871.1
Buy Voyage16721282022-04-04 7:22:12725 days ago1649056932IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721282022-04-04 7:22:12725 days ago1649056932IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721262022-04-04 7:21:24725 days ago1649056884IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721242022-04-04 7:20:24725 days ago1649056824IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721222022-04-04 7:19:36725 days ago1649056776IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721222022-04-04 7:19:36725 days ago1649056776IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721202022-04-04 7:18:12725 days ago1649056692IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721182022-04-04 7:17:36725 days ago1649056656IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721182022-04-04 7:17:36725 days ago1649056656IN
0x28cbBC39...7e8337252
0 MOVR0.000806542.5
Buy Voyage16721142022-04-04 7:16:12725 days ago1649056572IN
0x28cbBC39...7e8337252
0 MOVR0.000322611
Buy Voyage16721142022-04-04 7:16:12725 days ago1649056572IN
0x28cbBC39...7e8337252
0 MOVR0.000322611
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xd898d202...EF7CE686d
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
DPSCartographer

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 16 : DPSCartographer.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 "@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 DPSCartographer is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20MintableBurnable;

    IERC20MintableBurnable public tmap;
    IERC20MintableBurnable public doubloon;
    DPSVoyageI public voyage;
    DPSRandomI public causality;
    DPSGameSettingsI public gameSettings;

    uint256[] public voyages;

    mapping(address => uint256) public lastCreatedVoyage;

    event Swap(address indexed _owner, bool indexed _tmapToDoubloon, uint256 _tmaps, uint256 _doubloons);
    event VoyageCreated(address indexed _owner, uint256 _id, VOYAGE_TYPE _type);
    event SetContract(string indexed _target, address _contract);
    event TokenRecovered(address indexed _token, address _destination, uint256 _amount);

    constructor() {}

    /**
     * @notice swap tmaps for doubloons
     * @param _quantity of tmaps you want to swap
     */
    function swapTmapsForDoubloons(uint256 _quantity) external nonReentrant {
        require(tmap.balanceOf(msg.sender) >= _quantity, "Not enough TMAP");

        uint256 amountOfDoubloons = _quantity * gameSettings.getTmapPerDoubloon() * 1e18;
        uint256 amountOfTmaps = _quantity * 1e18;

        tmap.burn(msg.sender, amountOfTmaps);
        doubloon.mint(msg.sender, amountOfDoubloons);

        emit Swap(msg.sender, true, amountOfTmaps, amountOfDoubloons);
    }

    /**
     * @notice swap doubloons for tmaps
     * @param _quantity of doubloons you want to swap
     */
    function swapDoubloonsForTmaps(uint256 _quantity) external nonReentrant {
        require(doubloon.balanceOf(msg.sender) >= _quantity, "Not enough Doubloons");

        uint256 amountOfDoubloons = _quantity * 1e18;
        uint256 amountOfTmaps = (_quantity * 1e18) / gameSettings.getTmapPerDoubloon();

        doubloon.burn(msg.sender, amountOfDoubloons);
        tmap.mint(msg.sender, amountOfTmaps);

        emit Swap(msg.sender, false, amountOfTmaps, amountOfDoubloons);
    }

    /**
     * @notice buy a voyage using tmaps
     * @param _voyageType - type of the voyage 0 - EASY, 1 - MEDIUM, 2 - HARD, 3 - LEGENDARY
     */
    function buyVoyage(VOYAGE_TYPE _voyageType) external nonReentrant {
        require(gameSettings.isPaused(0) == 0, "Paused");
        uint256 amountOfTmap = gameSettings.getTMAPPerVoyageType(_voyageType);
        require(amountOfTmap > 0, "Invalid Voyage");
        require(tmap.balanceOf(msg.sender) >= amountOfTmap, "Not enought TMAP");

        require(
            block.timestamp - lastCreatedVoyage[msg.sender] >= gameSettings.getGapBetweenVoyagesCreation() &&
                lastCreatedVoyage[msg.sender] < block.timestamp,
            "You need to cooloff"
        );
        CartographerConfig memory currentVoyageConfigPerType = gameSettings.getVoyageConfig(_voyageType);
        uint8[] memory sequence = new uint8[](currentVoyageConfigPerType.totalInteractions);
        VoyageConfig memory voyageConfig = VoyageConfig(
            _voyageType,
            uint8(sequence.length),
            gameSettings.getBlockJumps(),
            sequence,
            block.number,
            currentVoyageConfigPerType.gapBetweenInteractions
        );

        uint256 voyageId = voyages.length + 1;
        voyages.push(voyageId);
        lastCreatedVoyage[msg.sender] = block.timestamp;

        tmap.burn(msg.sender, amountOfTmap);
        voyage.mint(msg.sender, voyageId, voyageConfig);
        emit VoyageCreated(msg.sender, voyageId, _voyageType);
    }

    /**
     * @notice view voyage configurations.
     * @dev because voyage configurations are based on causality generated from future blocks, we need to send
     *      causality parameters retrieved from the DAPP. The causality params will determine the outcome of the voyage
     *      no of interactions, the order of interactions
     * @param _causalityParams - params used for causality
     * @param _voyageId - voyage id
     * @return voyageConfig - a config of the voyage, see DPSStructs->VoyageConfig
     */
    function viewVoyageConfiguration(CausalityParams memory _causalityParams, uint256 _voyageId)
        external
        view
        returns (VoyageConfig memory voyageConfig)
    {
        voyageConfig = voyage.getVoyageConfig(_voyageId);
        CartographerConfig memory configForThisInteraction = gameSettings.getVoyageConfig(voyageConfig.typeOfVoyage);
        RandomInteractions memory randomInteractionsConfig;
        // generating first the number of enemies, then the number of storms
        // if signature on then we need to generated based on signature, meaning is a verified generation
        if (_causalityParams.signature.length > 0) {
            randomInteractionsConfig.randomNoOfEnemies = causality.getRandom(
                _causalityParams.userAddress,
                _causalityParams.blockNumber[0],
                _causalityParams.hash1[0],
                _causalityParams.hash2[0],
                _causalityParams.timestamp[0],
                _causalityParams.signature[0],
                "NOOFENEMIES",
                configForThisInteraction.minNoOfEnemies,
                configForThisInteraction.maxNoOfEnemies
            );
            randomInteractionsConfig.randomNoOfStorms = causality.getRandom(
                _causalityParams.userAddress,
                _causalityParams.blockNumber[1],
                _causalityParams.hash1[1],
                _causalityParams.hash2[1],
                _causalityParams.timestamp[1],
                _causalityParams.signature[1],
                "NOOFSTORMS",
                configForThisInteraction.minNoOfStorms,
                configForThisInteraction.maxNoOfStorms
            );
        } else {
            randomInteractionsConfig.randomNoOfEnemies = causality.getRandomUnverified(
                _causalityParams.userAddress,
                _causalityParams.blockNumber[0],
                _causalityParams.hash1[0],
                _causalityParams.hash2[0],
                _causalityParams.timestamp[0],
                "NOOFENEMIES",
                configForThisInteraction.minNoOfEnemies,
                configForThisInteraction.maxNoOfEnemies
            );
            randomInteractionsConfig.randomNoOfStorms = causality.getRandomUnverified(
                _causalityParams.userAddress,
                _causalityParams.blockNumber[1],
                _causalityParams.hash1[1],
                _causalityParams.hash2[1],
                _causalityParams.timestamp[1],
                "NOOFSTORMS",
                configForThisInteraction.minNoOfStorms,
                configForThisInteraction.maxNoOfStorms
            );
        }
        
        // then the rest of the remaining interactions represents the number of chests
        randomInteractionsConfig.randomNoOfChests =
            configForThisInteraction.totalInteractions -
            randomInteractionsConfig.randomNoOfEnemies -
            randomInteractionsConfig.randomNoOfStorms;

        voyageConfig.sequence = new uint8[](configForThisInteraction.totalInteractions);
        randomInteractionsConfig.positionsForGeneratingInteractions = new uint256[](3);
        randomInteractionsConfig.positionsForGeneratingInteractions[0] = 1;
        randomInteractionsConfig.positionsForGeneratingInteractions[1] = 2;
        randomInteractionsConfig.positionsForGeneratingInteractions[2] = 3;

        // because each interaction has a maximum number of happenings we need to make sure that it's met
        for (uint256 i; i < configForThisInteraction.totalInteractions; i++) {
            /**
             * if we met the max number of generated interaction generatedChests == randomNoOfChests (defined above)
             * we remove this interaction from the positionsForGeneratingInteractions
             * which is an array containing the possible interactions that can gen generated as next values in the sequencer.
             * At first the positionsForGeneratingInteractions will have all 3 interactions (1 - Chest, 2 - Storm, 3 - Enemy)
             * but then we remove them as the generatedChests == randomNoOfChests
             */
            if (randomInteractionsConfig.generatedChests == randomInteractionsConfig.randomNoOfChests) {
                randomInteractionsConfig.positionsForGeneratingInteractions = removeByValue(
                    randomInteractionsConfig.positionsForGeneratingInteractions,
                    1
                );
                randomInteractionsConfig.generatedChests = 0;
            }
            if (randomInteractionsConfig.generatedStorms == randomInteractionsConfig.randomNoOfStorms) {
                randomInteractionsConfig.positionsForGeneratingInteractions = removeByValue(
                    randomInteractionsConfig.positionsForGeneratingInteractions,
                    2
                );
                randomInteractionsConfig.generatedStorms = 0;
            }
            if (randomInteractionsConfig.generatedEnemies == randomInteractionsConfig.randomNoOfEnemies) {
                randomInteractionsConfig.positionsForGeneratingInteractions = removeByValue(
                    randomInteractionsConfig.positionsForGeneratingInteractions,
                    3
                );
                randomInteractionsConfig.generatedEnemies = 0;
            }

            uint256 randomPosition;
            if (randomInteractionsConfig.positionsForGeneratingInteractions.length == 1) {
                randomPosition = 0;
            } else if (_causalityParams.signature.length > 0) {
                randomPosition = causality.getRandom(
                    _causalityParams.userAddress,
                    _causalityParams.blockNumber[i + 2],
                    _causalityParams.hash1[i + 2],
                    _causalityParams.hash2[i + 2],
                    _causalityParams.timestamp[i + 2],
                    _causalityParams.signature[i + 2],
                    string(abi.encodePacked("INTERACTION", i)),
                    0,
                    uint8(randomInteractionsConfig.positionsForGeneratingInteractions.length) - 1
                );
            } else {
                randomPosition = causality.getRandomUnverified(
                    _causalityParams.userAddress,
                    _causalityParams.blockNumber[i + 2],
                    _causalityParams.hash1[i + 2],
                    _causalityParams.hash2[i + 2],
                    _causalityParams.timestamp[i + 2],
                    string(abi.encodePacked("INTERACTION", i)),
                    0,
                    uint8(randomInteractionsConfig.positionsForGeneratingInteractions.length) - 1
                );
            }
            uint256 selectedInteraction = randomInteractionsConfig.positionsForGeneratingInteractions[randomPosition];
            voyageConfig.sequence[i] = uint8(selectedInteraction);

            if (selectedInteraction == 1) randomInteractionsConfig.generatedChests++;
            else if (selectedInteraction == 2) randomInteractionsConfig.generatedStorms++;
            else if (selectedInteraction == 3) randomInteractionsConfig.generatedEnemies++;
        }
    }

    /**
     * @notice a utilitary that removes by value from an array
     * @param target - targeted array
     * @param value - value that needs to be removed
     * @return new array without the value
     */
    function removeByValue(uint256[] memory target, uint256 value) internal pure returns (uint256[] memory) {
        uint256[] memory newTarget = new uint256[](target.length - 1);
        uint256 k = 0;
        for (uint256 j = 0; j < target.length; j++) {
            if (target[j] == value) continue;
            newTarget[k++] = target[j];
        }
        return newTarget;
    }

    /**
     * @notice Reinitialization of voyages in case Cartographer gets redeployed
     * @param _start the start id, usually this needs to be 0
     * @param _end the end id, last voyage id that was minted
     */
    function reinitializeVoyages(uint256 _start, uint256 _end) external onlyOwner {
        uint256[] memory newVoyages;
        for (uint256 i = _start; i < _end; i++) {
            newVoyages[i] = i;
        }
        voyages = newVoyages;
    }

    /**
     * burns a voyage
     * @param _voyageId - voyage that needs to be burnt
     */
    function burnVoyage(uint256 _voyageId) external {
        require(voyage.ownerOf(_voyageId) == msg.sender, "Not owner");
        voyage.burn(_voyageId);
        voyages = removeByValue(voyages, _voyageId);
    }

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

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

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

    /**
     * SETTERS & GETTERS
     */
    function setTmapContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        tmap = IERC20MintableBurnable(_contract);
        emit SetContract("TMAP", _contract);
    }

    function setDoubloonsContract(address _contract) external onlyOwner {
        require(_contract != address(0), "Can not be address 0");
        doubloon = IERC20MintableBurnable(_contract);
        emit SetContract("Doubloons", _contract);
    }

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

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

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

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.9;

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

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

    function burn(uint256 _tokenId) external;

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

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

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

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

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

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

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

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

    function getMaxSkillsCap() external view returns (uint16);

    function getMaxRollCap() external view returns (uint16);

    function getFlagshipBaseSkills() external view returns (uint16);

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

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

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

    function getBlockJumps() external view returns (uint16);

    function getGapBetweenVoyagesCreation() external view returns (uint256);

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

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

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

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

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

    function burn(uint256 _id) external;

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

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

    function burn(uint256 _id) external;

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

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

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

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

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

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

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

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

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

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

enum VOYAGE_TYPE {
    EASY,
    MEDIUM,
    HARD,
    LEGENDARY
}

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

enum INTERACTION {
    NONE,
    CHEST,
    STORM,
    ENEMY
}

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

enum SKILL_TYPE {
    LUCK,
    STRENGTH,
    NAVIGATION
}

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

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

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

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

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

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

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

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",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":"_owner","type":"address"},{"indexed":true,"internalType":"bool","name":"_tmapToDoubloon","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_tmaps","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_doubloons","type":"uint256"}],"name":"Swap","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":false,"internalType":"enum VOYAGE_TYPE","name":"_type","type":"uint8"}],"name":"VoyageCreated","type":"event"},{"inputs":[{"internalType":"uint256","name":"_voyageId","type":"uint256"}],"name":"burnVoyage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum VOYAGE_TYPE","name":"_voyageType","type":"uint8"}],"name":"buyVoyage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"causality","outputs":[{"internalType":"contract DPSRandomI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"doubloon","outputs":[{"internalType":"contract IERC20MintableBurnable","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":"","type":"address"}],"name":"lastCreatedVoyage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"address","name":"_destination","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recover1155NFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_destination","type":"address"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"address","name":"_destination","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"recoverNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"reinitializeVoyages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","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":"setDoubloonsContract","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":"setTmapContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setVoyageContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"swapDoubloonsForTmaps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"swapTmapsForDoubloons","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tmap","outputs":[{"internalType":"contract IERC20MintableBurnable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256[]","name":"blockNumber","type":"uint256[]"},{"internalType":"bytes32[]","name":"hash1","type":"bytes32[]"},{"internalType":"bytes32[]","name":"hash2","type":"bytes32[]"},{"internalType":"uint256[]","name":"timestamp","type":"uint256[]"},{"internalType":"bytes[]","name":"signature","type":"bytes[]"}],"internalType":"struct CausalityParams","name":"_causalityParams","type":"tuple"},{"internalType":"uint256","name":"_voyageId","type":"uint256"}],"name":"viewVoyageConfiguration","outputs":[{"components":[{"internalType":"enum VOYAGE_TYPE","name":"typeOfVoyage","type":"uint8"},{"internalType":"uint8","name":"noOfInteractions","type":"uint8"},{"internalType":"uint16","name":"noOfBlockJumps","type":"uint16"},{"internalType":"uint8[]","name":"sequence","type":"uint8[]"},{"internalType":"uint256","name":"boughtAt","type":"uint256"},{"internalType":"uint256","name":"gapBetweenInteractions","type":"uint256"}],"internalType":"struct VoyageConfig","name":"voyageConfig","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voyage","outputs":[{"internalType":"contract DPSVoyageI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"voyages","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101585760003560e01c80638da5cb5b116100c3578063ddbf6c5b1161007c578063ddbf6c5b146102e0578063ea68ba8e146102f3578063f127306214610306578063f2fde38b14610326578063f4a59b5814610339578063ffd7593c1461034c57600080fd5b80638da5cb5b14610262578063a678daa314610273578063b7297cf314610286578063b9f37e3f14610299578063bdb02e50146102ac578063d6bc8518146102bf57600080fd5b80637020e71e116101155780637020e71e146101ee578063712796e514610201578063715018a6146102215780637cc1e8951461022957806380f669fd1461023c578063886f039a1461024f57600080fd5b8063061a966f1461015d5780630d7f5035146101725780631526d0db1461018557806343a019e2146101985780634e3975e5146101c85780636f6b866d146101db575b600080fd5b61017061016b366004612854565b61035f565b005b61017061018036600461289b565b6103e8565b6101706101933660046128dc565b6104ec565b6003546101ab906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6002546101ab906001600160a01b031681565b6101706101e93660046128f9565b6105b3565b6101706101fc36600461293f565b6106cc565b61021461020f366004612b3b565b61096f565b6040516101bf9190612d20565b61017061155c565b6101706102373660046128dc565b611592565b61017061024a3660046128dc565b611612565b61017061025d366004612d33565b611697565b6000546001600160a01b03166101ab565b61017061028136600461293f565b6117bb565b6006546101ab906001600160a01b031681565b6004546101ab906001600160a01b031681565b6101706102ba366004612d79565b611a61565b6102d26102cd36600461293f565b6120d4565b6040519081526020016101bf565b6101706102ee3660046128dc565b6120f5565b6101706103013660046128dc565b612177565b6102d26103143660046128dc565b60086020526000908152604090205481565b6101706103343660046128dc565b6121ff565b61017061034736600461293f565b61229a565b6005546101ab906001600160a01b031681565b6000546001600160a01b031633146103925760405162461bcd60e51b815260040161038990612d96565b60405180910390fd5b6060825b828110156103ce57808282815181106103b1576103b1612dcb565b6020908102919091010152806103c681612df7565b915050610396565b5080516103e29060079060208401906127f4565b50505050565b6000546001600160a01b031633146104125760405162461bcd60e51b815260040161038990612d96565b6001600160a01b0382166104385760405162461bcd60e51b815260040161038990612e12565b604051632142170760e11b81523060048201526001600160a01b038381166024830152604482018390528416906342842e0e90606401600060405180830381600087803b15801561048857600080fd5b505af115801561049c573d6000803e3d6000fd5b5050604080516001600160a01b03868116825260208201869052871693507f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f90969250015b60405180910390a2505050565b6000546001600160a01b031633146105165760405162461bcd60e51b815260040161038990612d96565b6001600160a01b03811661053c5760405162461bcd60e51b815260040161038990612e47565b600380546001600160a01b0319166001600160a01b03831617905560405168446f75626c6f6f6e7360b81b81526009015b6040519081900381206001600160a01b0383168252907fbf2cc7083b32d1f5c82633af784e1285df86eb43c88d0752feea4bebb4a0b6d29060200160405180910390a250565b6000546001600160a01b031633146105dd5760405162461bcd60e51b815260040161038990612d96565b6001600160a01b0383166106035760405162461bcd60e51b815260040161038990612e12565b604051637921219560e11b81523060048201526001600160a01b038481166024830152604482018490526064820183905260a06084830152600060a483015285169063f242432a9060c401600060405180830381600087803b15801561066857600080fd5b505af115801561067c573d6000803e3d6000fd5b5050604080516001600160a01b03878116825260208201879052881693507f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f909692500160405180910390a250505050565b600260015414156106ef5760405162461bcd60e51b815260040161038990612e75565b60026001819055546040516370a0823160e01b815233600482015282916001600160a01b0316906370a082319060240160206040518083038186803b15801561073757600080fd5b505afa15801561074b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076f9190612eac565b10156107af5760405162461bcd60e51b815260206004820152600f60248201526e04e6f7420656e6f75676820544d415608c1b6044820152606401610389565b60065460408051632e97acbb60e01b815290516000926001600160a01b031691632e97acbb916004808301926020929190829003018186803b1580156107f457600080fd5b505afa158015610808573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082c9190612eac565b6108369083612ec5565b61084890670de0b6b3a7640000612ec5565b9050600061085e83670de0b6b3a7640000612ec5565b600254604051632770a7eb60e21b8152336004820152602481018390529192506001600160a01b031690639dc29fac90604401600060405180830381600087803b1580156108ab57600080fd5b505af11580156108bf573d6000803e3d6000fd5b50506003546040516340c10f1960e01b8152336004820152602481018690526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b15801561090f57600080fd5b505af1158015610923573d6000803e3d6000fd5b50506040805184815260208101869052600193503392507fbfd50a04f1e6e4aee344f5d0e7f15d74d0dbb58cd1f711daa6463094ca9508cd91015b60405180910390a350506001805550565b6040805160c0810182526000808252602082018190529181018290526060808201526080810182905260a0810191909152600480546040516352a701e360e01b81529182018490526001600160a01b0316906352a701e39060240160006040518083038186803b1580156109e257600080fd5b505afa1580156109f6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a1e9190810190612f07565b6006548151604051630cd6be8760e01b81529293506000926001600160a01b0390921691630cd6be8791610a5491600401613019565b6101006040518083038186803b158015610a6d57600080fd5b505afa158015610a81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa59190613027565b9050610af06040518060e00160405280600081526020016000815260200160008152602001600060ff168152602001600060ff168152602001600060ff168152602001606081525090565b60a08501515115610d6c576005548551602087015180516001600160a01b03909316926369171233929190600090610b2a57610b2a612dcb565b60200260200101518860400151600081518110610b4957610b49612dcb565b60200260200101518960600151600081518110610b6857610b68612dcb565b60200260200101518a60800151600081518110610b8757610b87612dcb565b60200260200101518b60a00151600081518110610ba657610ba6612dcb565b602002602001015189608001518a60a001516040518963ffffffff1660e01b8152600401610bdb989796959493929190613140565b60206040518083038186803b158015610bf357600080fd5b505afa158015610c07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2b9190612eac565b60408201526005548551602087015180516001600160a01b039093169263691712339291906001908110610c6157610c61612dcb565b60200260200101518860400151600181518110610c8057610c80612dcb565b60200260200101518960600151600181518110610c9f57610c9f612dcb565b60200260200101518a60800151600181518110610cbe57610cbe612dcb565b60200260200101518b60a00151600181518110610cdd57610cdd612dcb565b602002602001015189604001518a606001516040518963ffffffff1660e01b8152600401610d129897969594939291906131c4565b60206040518083038186803b158015610d2a57600080fd5b505afa158015610d3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d629190612eac565b6020820152610f99565b6005548551602087015180516001600160a01b0390931692638d91cb33929190600090610d9b57610d9b612dcb565b60200260200101518860400151600081518110610dba57610dba612dcb565b60200260200101518960600151600081518110610dd957610dd9612dcb565b60200260200101518a60800151600081518110610df857610df8612dcb565b602002602001015188608001518960a001516040518863ffffffff1660e01b8152600401610e2c9796959493929190613228565b60206040518083038186803b158015610e4457600080fd5b505afa158015610e58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7c9190612eac565b60408201526005548551602087015180516001600160a01b0390931692638d91cb339291906001908110610eb257610eb2612dcb565b60200260200101518860400151600181518110610ed157610ed1612dcb565b60200260200101518960600151600181518110610ef057610ef0612dcb565b60200260200101518a60800151600181518110610f0f57610f0f612dcb565b6020026020010151886040015189606001516040518863ffffffff1660e01b8152600401610f43979695949392919061329b565b60206040518083038186803b158015610f5b57600080fd5b505afa158015610f6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f939190612eac565b60208201525b806020015181604001518360c0015160ff16610fb591906132ec565b610fbf91906132ec565b815260c082015160ff1667ffffffffffffffff811115610fe157610fe1612958565b60405190808252806020026020018201604052801561100a578160200160208202803683370190505b506060840152604080516003808252608082019092529081602001602082028036833750505060c0820181905280516001919060009061104c5761104c612dcb565b60200260200101818152505060028160c0015160018151811061107157611071612dcb565b60200260200101818152505060038160c0015160028151811061109657611096612dcb565b60200260200101818152505060005b8260c0015160ff16811015611553578151606083015160ff1614156110e0576110d38260c001516001612424565b60c0830152600060608301525b8160200151826080015160ff16141561110f576111028260c001516002612424565b60c0830152600060808301525b81604001518260a0015160ff16141561113e576111318260c001516003612424565b60c0830152600060a08301525b60008260c00151516001141561115657506000611494565b60a0870151511561131257600554875160208901516001600160a01b039092169163691712339190611189866002613303565b8151811061119957611199612dcb565b60200260200101518a604001518660026111b39190613303565b815181106111c3576111c3612dcb565b60200260200101518b606001518760026111dd9190613303565b815181106111ed576111ed612dcb565b60200260200101518c608001518860026112079190613303565b8151811061121757611217612dcb565b60200260200101518d60a001518960026112319190613303565b8151811061124157611241612dcb565b60200260200101518960405160200161127491906a24a72a22a920a1aa24a7a760a91b8152600b810191909152602b0190565b604051602081830303815290604052600060018d60c0015151611297919061331b565b6040518a63ffffffff1660e01b81526004016112bb9998979695949392919061333e565b60206040518083038186803b1580156112d357600080fd5b505afa1580156112e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130b9190612eac565b9050611494565b600554875160208901516001600160a01b0390921691638d91cb33919061133a866002613303565b8151811061134a5761134a612dcb565b60200260200101518a604001518660026113649190613303565b8151811061137457611374612dcb565b60200260200101518b6060015187600261138e9190613303565b8151811061139e5761139e612dcb565b60200260200101518c608001518860026113b89190613303565b815181106113c8576113c8612dcb565b6020026020010151886040516020016113fb91906a24a72a22a920a1aa24a7a760a91b8152600b810191909152602b0190565b604051602081830303815290604052600060018c60c001515161141e919061331b565b6040518963ffffffff1660e01b81526004016114419897969594939291906133ad565b60206040518083038186803b15801561145957600080fd5b505afa15801561146d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114919190612eac565b90505b60008360c0015182815181106114ac576114ac612dcb565b6020026020010151905080866060015184815181106114cd576114cd612dcb565b602002602001019060ff16908160ff1681525050806001141561150557606084018051906114fa82613406565b60ff1690525061153e565b806002141561151e57608084018051906114fa82613406565b806003141561153e5760a0840180519061153782613406565b60ff169052505b5050808061154b90612df7565b9150506110a5565b50505092915050565b6000546001600160a01b031633146115865760405162461bcd60e51b815260040161038990612d96565b6115906000612510565b565b6000546001600160a01b031633146115bc5760405162461bcd60e51b815260040161038990612d96565b6001600160a01b0381166115e25760405162461bcd60e51b815260040161038990612e47565b600280546001600160a01b0319166001600160a01b038316179055604051630544d41560e41b815260040161056d565b6000546001600160a01b0316331461163c5760405162461bcd60e51b815260040161038990612d96565b6001600160a01b0381166116625760405162461bcd60e51b815260040161038990612e47565b600580546001600160a01b0319166001600160a01b0383161790556040516843617573616c69747960b81b815260090161056d565b6000546001600160a01b031633146116c15760405162461bcd60e51b815260040161038990612d96565b6001600160a01b0381166116e75760405162461bcd60e51b815260040161038990612e12565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b15801561172957600080fd5b505afa15801561173d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117619190612eac565b90506117786001600160a01b038416308484612560565b604080516001600160a01b038481168252602082018490528516917f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f909691016104df565b600260015414156117de5760405162461bcd60e51b815260040161038990612e75565b60026001556003546040516370a0823160e01b815233600482015282916001600160a01b0316906370a082319060240160206040518083038186803b15801561182657600080fd5b505afa15801561183a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185e9190612eac565b10156118a35760405162461bcd60e51b81526020600482015260146024820152734e6f7420656e6f75676820446f75626c6f6f6e7360601b6044820152606401610389565b60006118b782670de0b6b3a7640000612ec5565b90506000600660009054906101000a90046001600160a01b03166001600160a01b0316632e97acbb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561190957600080fd5b505afa15801561191d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119419190612eac565b61195384670de0b6b3a7640000612ec5565b61195d9190613426565b600354604051632770a7eb60e21b8152336004820152602481018590529192506001600160a01b031690639dc29fac90604401600060405180830381600087803b1580156119aa57600080fd5b505af11580156119be573d6000803e3d6000fd5b50506002546040516340c10f1960e01b8152336004820152602481018590526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b158015611a0e57600080fd5b505af1158015611a22573d6000803e3d6000fd5b50506040805184815260208101869052600093503392507fbfd50a04f1e6e4aee344f5d0e7f15d74d0dbb58cd1f711daa6463094ca9508cd910161095e565b60026001541415611a845760405162461bcd60e51b815260040161038990612e75565b600260015560065460405163bc61e73360e01b8152600060048201526001600160a01b039091169063bc61e7339060240160206040518083038186803b158015611acd57600080fd5b505afa158015611ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b059190613448565b60ff1615611b3e5760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610389565b6006546040516367fa631960e01b81526000916001600160a01b0316906367fa631990611b6f908590600401613019565b60206040518083038186803b158015611b8757600080fd5b505afa158015611b9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbf9190612eac565b905060008111611c025760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420566f7961676560901b6044820152606401610389565b6002546040516370a0823160e01b815233600482015282916001600160a01b0316906370a082319060240160206040518083038186803b158015611c4557600080fd5b505afa158015611c59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7d9190612eac565b1015611cbe5760405162461bcd60e51b815260206004820152601060248201526f04e6f7420656e6f7567687420544d41560841b6044820152606401610389565b600660009054906101000a90046001600160a01b03166001600160a01b0316631b5303606040518163ffffffff1660e01b815260040160206040518083038186803b158015611d0c57600080fd5b505afa158015611d20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d449190612eac565b33600090815260086020526040902054611d5e90426132ec565b10158015611d7a57503360009081526008602052604090205442115b611dbc5760405162461bcd60e51b81526020600482015260136024820152722cb7ba903732b2b2103a379031b7b7b637b33360691b6044820152606401610389565b600654604051630cd6be8760e01b81526000916001600160a01b031690630cd6be8790611ded908690600401613019565b6101006040518083038186803b158015611e0657600080fd5b505afa158015611e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3e9190613027565b905060008160c0015160ff1667ffffffffffffffff811115611e6257611e62612958565b604051908082528060200260200182016040528015611e8b578160200160208202803683370190505b50905060006040518060c00160405280866003811115611ead57611ead612c51565b8152602001835160ff168152602001600660009054906101000a90046001600160a01b03166001600160a01b0316630bcac4876040518163ffffffff1660e01b815260040160206040518083038186803b158015611f0a57600080fd5b505afa158015611f1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f429190613463565b61ffff1681526020810184905243604082015260e0850151606090910152600754909150600090611f74906001613303565b60078054600181019091557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880181905533600081815260086020526040908190204290556002549051632770a7eb60e21b81526004810192909252602482018890529192506001600160a01b0390911690639dc29fac90604401600060405180830381600087803b15801561200857600080fd5b505af115801561201c573d6000803e3d6000fd5b505060048054604051631afb74b160e31b81526001600160a01b03909116935063d7dba5889250612053913391869188910161347e565b600060405180830381600087803b15801561206d57600080fd5b505af1158015612081573d6000803e3d6000fd5b50505050336001600160a01b03167f8761c2e02e44f22776b48baa2d2e5aeb3ab724081fa92bba494f048c1256c5cb82886040516120c09291906134ae565b60405180910390a250506001805550505050565b600781815481106120e457600080fd5b600091825260209091200154905081565b6000546001600160a01b0316331461211f5760405162461bcd60e51b815260040161038990612d96565b6001600160a01b0381166121455760405162461bcd60e51b815260040161038990612e47565b600480546001600160a01b0319166001600160a01b03831617905560405165566f7961676560d01b815260060161056d565b6000546001600160a01b031633146121a15760405162461bcd60e51b815260040161038990612d96565b6001600160a01b0381166121c75760405162461bcd60e51b815260040161038990612e47565b600680546001600160a01b0319166001600160a01b0383161790556040516b47616d6553657474696e677360a01b8152600c0161056d565b6000546001600160a01b031633146122295760405162461bcd60e51b815260040161038990612d96565b6001600160a01b03811661228e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610389565b61229781612510565b50565b600480546040516331a9108f60e11b815291820183905233916001600160a01b0390911690636352211e9060240160206040518083038186803b1580156122e057600080fd5b505afa1580156122f4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061231891906134c2565b6001600160a01b03161461235a5760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610389565b60048054604051630852cd8d60e31b81529182018390526001600160a01b0316906342966c6890602401600060405180830381600087803b15801561239e57600080fd5b505af11580156123b2573d6000803e3d6000fd5b5050600780546040805160208084028201810190925282815261240c9550935083018282801561240157602002820191906000526020600020905b8154815260200190600101908083116123ed575b505050505082612424565b8051612420916007916020909101906127f4565b5050565b606060006001845161243691906132ec565b67ffffffffffffffff81111561244e5761244e612958565b604051908082528060200260200182016040528015612477578160200160208202803683370190505b5090506000805b8551811015612504578486828151811061249a5761249a612dcb565b602002602001015114156124ad576124f2565b8581815181106124bf576124bf612dcb565b60200260200101518383806124d390612df7565b9450815181106124e5576124e5612dcb565b6020026020010181815250505b806124fc81612df7565b91505061247e565b50909150505b92915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b038581166024830152848116604483015260648083018590528351808403909101815260849092018352602080830180516001600160e01b03166323b872dd60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526103e2928792916000916125f891851690849061267a565b805190915015612675578080602001905181019061261691906134df565b6126755760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610389565b505050565b60606126898484600085612693565b90505b9392505050565b6060824710156126f45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610389565b843b6127425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610389565b600080866001600160a01b0316858760405161275e9190613501565b60006040518083038185875af1925050503d806000811461279b576040519150601f19603f3d011682016040523d82523d6000602084013e6127a0565b606091505b50915091506127b08282866127bb565b979650505050505050565b606083156127ca57508161268c565b8251156127da5782518084602001fd5b8160405162461bcd60e51b8152600401610389919061351d565b82805482825590600052602060002090810192821561282f579160200282015b8281111561282f578251825591602001919060010190612814565b5061283b92915061283f565b5090565b5b8082111561283b5760008155600101612840565b6000806040838503121561286757600080fd5b50508035926020909101359150565b6001600160a01b038116811461229757600080fd5b803561289681612876565b919050565b6000806000606084860312156128b057600080fd5b83356128bb81612876565b925060208401356128cb81612876565b929592945050506040919091013590565b6000602082840312156128ee57600080fd5b813561268c81612876565b6000806000806080858703121561290f57600080fd5b843561291a81612876565b9350602085013561292a81612876565b93969395505050506040820135916060013590565b60006020828403121561295157600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff8111828210171561299157612991612958565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156129c0576129c0612958565b604052919050565b600067ffffffffffffffff8211156129e2576129e2612958565b5060051b60200190565b600082601f8301126129fd57600080fd5b81356020612a12612a0d836129c8565b612997565b82815260059290921b84018101918181019086841115612a3157600080fd5b8286015b84811015612a4c5780358352918301918301612a35565b509695505050505050565b6000601f8381840112612a6957600080fd5b82356020612a79612a0d836129c8565b82815260059290921b85018101918181019087841115612a9857600080fd5b8287015b84811015612b2f57803567ffffffffffffffff80821115612abd5760008081fd5b818a0191508a603f830112612ad25760008081fd5b85820135604082821115612ae857612ae8612958565b612af9828b01601f19168901612997565b92508183528c81838601011115612b105760008081fd5b8181850189850137506000908201870152845250918301918301612a9c565b50979650505050505050565b60008060408385031215612b4e57600080fd5b823567ffffffffffffffff80821115612b6657600080fd5b9084019060c08287031215612b7a57600080fd5b612b8261296e565b612b8b8361288b565b8152602083013582811115612b9f57600080fd5b612bab888286016129ec565b602083015250604083013582811115612bc357600080fd5b612bcf888286016129ec565b604083015250606083013582811115612be757600080fd5b612bf3888286016129ec565b606083015250608083013582811115612c0b57600080fd5b612c17888286016129ec565b60808301525060a083013582811115612c2f57600080fd5b612c3b88828601612a57565b60a0830152509660209590950135955050505050565b634e487b7160e01b600052602160045260246000fd5b60048110612c8557634e487b7160e01b600052602160045260246000fd5b9052565b600060c08301612c9a848451612c67565b60208084015160ff8082168388015261ffff60408701511660408801526060860151915060c0606088015283825180865260e0890191508484019550600093505b80841015612cfd57855183168252948401946001939093019290840190612cdb565b506080870151608089015260a087015160a0890152809550505050505092915050565b60208152600061268c6020830184612c89565b60008060408385031215612d4657600080fd5b8235612d5181612876565b91506020830135612d6181612876565b809150509250929050565b6004811061229757600080fd5b600060208284031215612d8b57600080fd5b813561268c81612d6c565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612e0b57612e0b612de1565b5060010190565b6020808252818101527f44657374696e6174696f6e2063616e206e6f7420626520616464726573732030604082015260600190565b602080825260149082015273043616e206e6f74206265206164647265737320360641b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600060208284031215612ebe57600080fd5b5051919050565b6000816000190483118215151615612edf57612edf612de1565b500290565b805160ff8116811461289657600080fd5b805161ffff8116811461289657600080fd5b60006020808385031215612f1a57600080fd5b825167ffffffffffffffff80821115612f3257600080fd5b9084019060c08287031215612f4657600080fd5b612f4e61296e565b8251612f5981612d6c565b8152612f66838501612ee4565b84820152612f7660408401612ef5565b6040820152606083015182811115612f8d57600080fd5b83019150601f82018713612fa057600080fd5b8151612fae612a0d826129c8565b81815260059190911b83018501908581019089831115612fcd57600080fd5b938601935b82851015612ff257612fe385612ee4565b82529386019390860190612fd2565b606084015250506080838101519082015260a0928301519281019290925250949350505050565b6020810161250a8284612c67565b600061010080838503121561303b57600080fd5b6040519081019067ffffffffffffffff8211818310171561305e5761305e612958565b8160405261306b84612ee4565b815261307960208501612ee4565b602082015261308a60408501612ee4565b604082015261309b60608501612ee4565b60608201526130ac60808501612ee4565b60808201526130bd60a08501612ee4565b60a08201526130ce60c08501612ee4565b60c082015260e084015160e0820152809250505092915050565b60005b838110156131035781810151838201526020016130eb565b838111156103e25750506000910152565b6000815180845261312c8160208601602086016130e8565b601f01601f19169290920160200192915050565b600061012060018060a01b038b1683528960208401528860408401528760608401528660808401528060a084015261317a81840187613114565b83810360c0850152600b81526a4e4f4f46454e454d49455360a81b60208201529050604081015b91505060ff841660e083015260ff83166101008301529998505050505050505050565b600061012060018060a01b038b1683528960208401528860408401528760608401528660808401528060a08401526131fe81840187613114565b83810360c0850152600a8152694e4f4f4653544f524d5360b01b60208201529050604081016131a1565b600061010060018060a01b038a1683528860208401528760408401528660608401528560808401528060a084015261327a818401600b81526a4e4f4f46454e454d49455360a81b602082015260400190565b91505060ff841660c083015260ff831660e083015298975050505050505050565b600061010060018060a01b038a1683528860208401528760408401528660608401528560808401528060a084015261327a818401600a8152694e4f4f4653544f524d5360b01b602082015260400190565b6000828210156132fe576132fe612de1565b500390565b6000821982111561331657613316612de1565b500190565b600060ff821660ff84168082101561333557613335612de1565b90039392505050565b600061012060018060a01b038c1683528a60208401528960408401528860608401528760808401528060a084015261337881840188613114565b905082810360c084015261338c8187613114565b9150508360e083015260ff83166101008301529a9950505050505050505050565b600061010060018060a01b038b1683528960208401528860408401528760608401528660808401528060a08401526133e781840187613114565b9150508360c083015260ff831660e08301529998505050505050505050565b600060ff821660ff81141561341d5761341d612de1565b60010192915050565b60008261344357634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561345a57600080fd5b61268c82612ee4565b60006020828403121561347557600080fd5b61268c82612ef5565b60018060a01b03841681528260208201526060604082015260006134a56060830184612c89565b95945050505050565b8281526040810161268c6020830184612c67565b6000602082840312156134d457600080fd5b815161268c81612876565b6000602082840312156134f157600080fd5b8151801515811461268c57600080fd5b600082516135138184602087016130e8565b9190910192915050565b60208152600061268c602083018461311456fea164736f6c6343000809000a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.