GLMR Price: $0.020883 (-0.93%)

Contract

0xD1A9bA3e61Ac676f58B29EA0a09Cf5D7f4f35138

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo0 GLMR

GLMR Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Buy Voyages119449242025-07-30 4:04:42180 days ago1753848282IN
Damned Pirates Society: Cartographer V1
0 GLMR0.225547531.25
Buy Voyages79825732024-10-21 8:57:48461 days ago1729501068IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages79825692024-10-21 8:57:18461 days ago1729501038IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages77125732024-10-02 9:02:18480 days ago1727859738IN
Damned Pirates Society: Cartographer V1
0 GLMR0.31026844126
Buy Voyages77125682024-10-02 9:01:48480 days ago1727859708IN
Damned Pirates Society: Cartographer V1
0 GLMR0.31273089127
Buy Voyages77125622024-10-02 9:01:12480 days ago1727859672IN
Damned Pirates Society: Cartographer V1
0 GLMR0.31026844126
Buy Voyages77125562024-10-02 9:00:36480 days ago1727859636IN
Damned Pirates Society: Cartographer V1
0 GLMR0.31026844126
Buy Voyages77113992024-10-02 7:03:06481 days ago1727852586IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages76691752024-09-29 7:34:54484 days ago1727595294IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages76129772024-09-25 8:58:18487 days ago1727254698IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages75883362024-09-23 15:40:00489 days ago1727106000IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages75883072024-09-23 15:37:12489 days ago1727105832IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages75739322024-09-22 15:31:30490 days ago1727019090IN
Damned Pirates Society: Cartographer V1
0 GLMR0.392718125
Buy Voyages75739232024-09-22 15:30:36490 days ago1727019036IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages75547042024-09-21 7:12:06492 days ago1726902726IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages75217202024-09-18 23:51:12494 days ago1726703472IN
Damned Pirates Society: Cartographer V1
0 GLMR1.40019888194
Buy Voyages75217002024-09-18 23:49:12494 days ago1726703352IN
Damned Pirates Society: Cartographer V1
0 GLMR1.40019888194
Buy Voyages75112982024-09-18 5:57:00495 days ago1726639020IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages74904872024-09-16 17:52:36496 days ago1726509156IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages74658172024-09-15 0:16:18498 days ago1726359378IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages74657992024-09-15 0:14:30498 days ago1726359270IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages74657572024-09-15 0:10:12498 days ago1726359012IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages74382892024-09-13 1:49:18500 days ago1726192158IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
Buy Voyages74298132024-09-12 11:39:18500 days ago1726141158IN
Damned Pirates Society: Cartographer V1
0 GLMR0.992409137.5
Buy Voyages74153692024-09-11 11:22:12501 days ago1726053732IN
Damned Pirates Society: Cartographer V1
0 GLMR0.90219125
View all transactions

View more zero value Internal Transactions in Advanced View mode

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DPSCartographer

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;

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 {
    using SafeERC20 for IERC20MintableBurnable;

    IERC20MintableBurnable public tmap;
    DPSDoubloonMinterI public doubloonsMinter;
    DPSQRNGI public random;
    DPSGameSettingsI public gameSettings;

    /**
     * @notice we can have multiple voyages, we keep an array of voyages we want to use
     */
    mapping(DPSVoyageIV2 => bool) public voyages;

    uint256 private nonReentrant = 1;

    uint256 public randomRequestIndex;

    event Swap(address indexed _owner, bool indexed _tmapToDoubloon, uint256 _tmaps, uint256 _doubloons);
    event VoyageCreated(address indexed _owner, uint256 _id, uint256 _type);
    event SetContract(uint256 _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 {
        if (gameSettings.isPaused(0) == 1) revert Paused();
        if (tmap.balanceOf(msg.sender) < _quantity) revert NotEnoughTokens();

        uint256 amountOfDoubloons = _quantity * gameSettings.tmapPerDoubloon();
        uint256 amountOfTmaps = _quantity;

        tmap.burn(msg.sender, amountOfTmaps);
        doubloonsMinter.mintDoubloons(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 {
        if (gameSettings.isPaused(1) == 1) revert Paused();

        uint256 amountOfDoubloons = _quantity;
        uint256 amountOfTmaps = (_quantity) / gameSettings.tmapPerDoubloon();

        doubloonsMinter.burnDoubloons(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
     * @param _amount - how many voyages you want to buy
     */
    function buyVoyages(
        uint16 _voyageType,
        uint256 _amount,
        DPSVoyageIV2 _voyage
    ) external {
        if (nonReentrant == 2 || !voyages[_voyage]) revert Unauthorized();
        nonReentrant = 2;

        if (gameSettings.isPaused(2) == 1) revert Paused();
        uint256 amountOfTmap = gameSettings.tmapPerVoyage(_voyageType);
        // this will return 0 if not a valid voyage
        if (amountOfTmap == 0) revert WrongParams(1);

        if (tmap.balanceOf(msg.sender) < amountOfTmap * _amount) revert NotEnoughTokens();

        bytes memory uniqueId = abi.encode(msg.sender, "BUY_VOYAGE", randomRequestIndex, block.timestamp);
        randomRequestIndex++;

        for (uint256 i; i < _amount; ++i) {
            CartographerConfig memory currentVoyageConfigPerType = gameSettings.voyageConfigPerType(_voyageType);
            uint8[] memory sequence = new uint8[](currentVoyageConfigPerType.totalInteractions);
            VoyageConfigV2 memory voyageConfig = VoyageConfigV2(
                _voyageType,
                uint8(sequence.length),
                sequence,
                block.number,
                currentVoyageConfigPerType.gapBetweenInteractions,
                uniqueId
            );

            uint256 voyageId = _voyage.maxMintedId() + 1;

            tmap.burn(msg.sender, amountOfTmap);

            _voyage.mint(msg.sender, voyageId, voyageConfig);
            emit VoyageCreated(msg.sender, voyageId, _voyageType);
        }
        random.makeRequestUint256(uniqueId);
        nonReentrant = 1;
    }

    /**
     * @notice burns a voyage
     * @param _voyageId - voyage that needs to be burnt
     */
    function burnVoyage(uint256 _voyageId, DPSVoyageIV2 _voyage) external {
        if (!voyages[_voyage]) revert Unauthorized();
        if (gameSettings.isPaused(3) == 1) revert Paused();
        if (_voyage.ownerOf(_voyageId) != msg.sender) revert WrongParams(1);
        _voyage.burn(_voyageId);
    }

    /**
     * @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 _voyageId - voyage id
     * @param _voyage the voyage we want to get the config for, this is because we have multiple types of voyages
     * @return voyageConfig - a config of the voyage, see DPSStructs->VoyageConfig
     */
    function viewVoyageConfiguration(uint256 _voyageId, DPSVoyageIV2 _voyage)
        external
        view
        returns (VoyageConfigV2 memory voyageConfig)
    {
        if (!voyages[_voyage]) revert Unauthorized();

        voyageConfig = _voyage.getVoyageConfig(_voyageId);

        if (voyageConfig.noOfInteractions == 0) revert WrongParams(1);

        CartographerConfig memory configForThisInteraction = gameSettings.voyageConfigPerType(voyageConfig.typeOfVoyage);
        uint256 randomNumber = random.getRandomResult(voyageConfig.uniqueId);
        if (randomNumber == 0) revert NotFulfilled();

        // 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
        RandomInteractions memory randomInteractionsConfig = generateRandomNumbers(
            randomNumber,
            _voyageId,
            voyageConfig.boughtAt,
            configForThisInteraction
        );

        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; ) {
            /**
             * 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;
            }

            if (randomInteractionsConfig.positionsForGeneratingInteractions.length == 1) {
                randomInteractionsConfig.randomPosition = 0;
            } else {
                randomInteractionsConfig.randomPosition = random.getRandomNumber(
                    randomNumber,
                    voyageConfig.boughtAt,
                    string(abi.encode("INTERACTION_ORDER_", i, "_", _voyageId)),
                    0,
                    uint8(randomInteractionsConfig.positionsForGeneratingInteractions.length) - 1
                );
            }
            randomInteractionsConfig = interpretResult(randomInteractionsConfig, i, voyageConfig);
            unchecked {
                i++;
            }
        }
    }

    function interpretResult(
        RandomInteractions memory _randomInteractionsConfig,
        uint256 _index,
        VoyageConfigV2 memory _voyageConfig
    ) private pure returns (RandomInteractions memory) {
        uint256 selectedInteraction = _randomInteractionsConfig.positionsForGeneratingInteractions[
            _randomInteractionsConfig.randomPosition
        ];
        _voyageConfig.sequence[_index] = uint8(selectedInteraction);

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

    function generateRandomNumbers(
        uint256 _randomNumber,
        uint256 _voyageId,
        uint256 _boughtAt,
        CartographerConfig memory _configForThisInteraction
    ) private view returns (RandomInteractions memory) {
        RandomInteractions memory _randomInteractionsConfig;

        _randomInteractionsConfig.randomNoOfEnemies = random.getRandomNumber(
            _randomNumber,
            _boughtAt,
            string(abi.encode("NOOFENEMIES", _voyageId)),
            _configForThisInteraction.minNoOfEnemies,
            _configForThisInteraction.maxNoOfEnemies
        );
        _randomInteractionsConfig.randomNoOfStorms = random.getRandomNumber(
            _randomNumber,
            _boughtAt,
            string(abi.encode("NOOFSTORMS", _voyageId)),
            _configForThisInteraction.minNoOfStorms,
            _configForThisInteraction.maxNoOfStorms
        );

        // then the rest of the remaining interactions represents the number of chests
        _randomInteractionsConfig.randomNoOfChests =
            _configForThisInteraction.totalInteractions -
            _randomInteractionsConfig.randomNoOfEnemies -
            _randomInteractionsConfig.randomNoOfStorms;
        return _randomInteractionsConfig;
    }

    /**
     * @notice a utility function 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;
        unchecked {
            for (uint256 j; j < target.length; j++) {
                if (target[j] == value) continue;
                newTarget[k++] = target[j];
            }
        }
        return newTarget;
    }

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

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

    /**
     * SETTERS & GETTERS
     */
    function setContract(
        address _contract,
        uint256 _target,
        bool _enabled
    ) external onlyOwner {
        if (_target == 1) {
            voyages[DPSVoyageIV2(_contract)] = _enabled;
        } else if (_target == 2) random = DPSQRNGI(_contract);
        else if (_target == 3) doubloonsMinter = DPSDoubloonMinterI(_contract);
        else if (_target == 4) tmap = IERC20MintableBurnable(_contract);
        else if (_target == 5) gameSettings = DPSGameSettingsI(_contract);
        emit SetContract(_target, _contract);
    }
}

// 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 3 of 17 : DPSInterfaces.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

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

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

    function burn(uint256 _tokenId) external;

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

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

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

    function maxMintedId() external view returns (uint256);

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

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

    function burn(uint256 _tokenId) external;

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

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

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

    function maxMintedId() external view returns (uint256);

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

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

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

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

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

    function checkCausalityParams(
        CausalityParams calldata _causalityParams,
        VoyageConfigV2 calldata _voyageConfig,
        LockedVoyageV2 calldata _lockedVoyage
    ) external pure;
}

interface DPSGameSettingsI {
    function voyageConfigPerType(uint256 _type) external view returns (CartographerConfig memory);

    function maxSkillsCap() external view returns (uint16);

    function maxRollCap() external view returns (uint16);

    function flagshipBaseSkills() external view returns (uint16);

    function maxOpenLockBoxes() external view returns (uint256);

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

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

    function tmapPerVoyage(uint256 _type) external view returns (uint256);

    function gapBetweenVoyagesCreation() external view returns (uint256);

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

    function isPausedNonReentrant(uint8 _component) external view;

    function tmapPerDoubloon() external view returns (uint256);

    function repairFlagshipCost() external view returns (uint256);

    function doubloonPerFlagshipUpgradePerLevel(uint256 _level) external view returns (uint256);

    function voyageDebuffs(uint256 _type) external view returns (uint16);

    function maxArtifactsPerVoyage(uint16 _type) external view returns (uint256);

    function chestDoubloonRewards(uint256 _type) external view returns (uint256);

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

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

    function maxSupportShipsPerVoyageType(uint256 _type) external view returns (uint8);

    function maxRollPerChest(uint256 _type) external view returns (uint256);

    function maxRollCapLockBoxes() external view returns (uint16);

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

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

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

interface DPSGameEngineI {
    function sanityCheckLockVoyages(
        LockedVoyageV2 memory existingVoyage,
        LockedVoyageV2 memory finishedVoyage,
        LockedVoyageV2 memory lockedVoyage,
        VoyageConfigV2 memory voyageConfig,
        uint256 totalSupportShips,
        DPSFlagshipI _flagship
    ) external view;

    function computeVoyageState(
        LockedVoyageV2 memory _lockedVoyage,
        uint8[] memory _sequence,
        uint256 _randomNumber
    ) external view returns (VoyageResult memory);

    function rewardChest(
        uint256 _randomNumber,
        uint256 _amount,
        uint256 _voyageType,
        address _owner
    ) external;

    function rewardLockedBox(
        uint256 _randomNumber,
        uint256 _amount,
        address _owner
    ) external;

    function checkIfViableClaimer(
        address _claimer,
        LockedVoyageV2 memory _lockedVoyage,
        address _ownerOfVoyage
    ) external view returns (bool);
}

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

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

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

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

    function burn(uint256 _id) external;

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

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

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

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

interface DPSCartographerI {
    function viewVoyageConfiguration(uint256 _voyageId, DPSVoyageIV2 _voyage)
        external
        view
        returns (VoyageConfigV2 memory voyageConfig);

    function buyers(uint256 _voyageId) external view returns (address);
}

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

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

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

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

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

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

interface DPSDocksI {
    function getFinishedVoyagesForOwner(
        address _owner,
        uint256 _start,
        uint256 _stop
    ) external view returns (LockedVoyageV2[] memory finished);

    function getLockedVoyagesForOwner(
        address _owner,
        uint256 _start,
        uint256 _stop
    ) external view returns (LockedVoyageV2[] memory locked);
}

interface DPSQRNGI {
    function makeRequestUint256(bytes calldata _uniqueId) external;

    function makeRequestUint256Array(uint256 _size, bytes32 _uniqueId) external;

    function getRandomResult(bytes calldata _uniqueId) external view returns (uint256);

    function getRandomResultArray(bytes32 _uniqueId) external view returns (uint256[] memory);

    function getRandomNumber(
        uint256 _randomNumber,
        uint256 _blockNumber,
        string calldata _entropy,
        uint256 _min,
        uint256 _max
    ) external pure returns (uint256);
}

interface DPSCrewForCoinI {
    struct Asset {
        uint32 targetId;
        bool borrowed;
        address borrower;
        uint32 epochs;
        address lender;
        uint64 startTime;
        uint64 endTime;
        uint256 doubloonsPerEpoch;
    }

    function isDPSInMarket(uint256 _tokenId) external view returns (Asset memory);

    function isFlagshipInMarket(uint256 _tokenId) external view returns (Asset memory);
}

interface DPSDoubloonMinterI {
    function mintDoubloons(address _to, uint256 _amount) external;

    function burnDoubloons(address _from, uint256 _amount) external;
}

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

import "./DPSInterfaces.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";

enum VOYAGE_TYPE {
    EASY,
    MEDIUM,
    HARD,
    LEGENDARY,
    CUSTOM
}

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

enum ARTIFACT_TYPE {
    NONE,
    COMMON_STRENGTH,
    COMMON_LUCK,
    COMMON_NAVIGATION,
    RARE_STRENGTH,
    RARE_LUCK,
    RARE_NAVIGATION,
    EPIC_STRENGTH,
    EPIC_LUCK,
    EPIC_NAVIGATION,
    LEGENDARY_STRENGTH,
    LEGENDARY_LUCK,
    LEGENDARY_NAVIGATION
}

enum INTERACTION {
    NONE,
    CHEST,
    STORM,
    ENEMY
}

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

enum SKILL_TYPE {
    LUCK,
    STRENGTH,
    NAVIGATION
}

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

struct VoyageConfigV2 {
    uint16 typeOfVoyage;
    uint8 noOfInteractions;
    // 1 - Chest 2 - Storm 3 - Enemy
    uint8[] sequence;
    uint256 boughtAt;
    uint256 gapBetweenInteractions;
    bytes uniqueId;
}

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;
    uint256 randomPosition;
}

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

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

struct LockedVoyageV2 {
    uint8 totalSupportShips;
    uint16 voyageType;
    uint16[13] artifactIds;
    uint8[9] supportShips; //this should be an array for each type, expressing the quantities he took on a trip
    uint8[] sequence;
    uint16 navigation;
    uint16 luck;
    uint16 strength;
    uint256 voyageId;
    uint256 dpsId;
    uint256 flagshipId;
    uint256 lockedBlock;
    uint256 lockedTimestamp;
    uint256 claimedTime;
    bytes uniqueId;
    DPSVoyageIV2 voyage;
    IERC721Metadata pirate;
    DPSFlagshipI flagship;
}

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

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

error AddressZero();
error Paused();
error WrongParams(uint256 _location);
error WrongState(uint256 _state);
error Unauthorized();
error NotEnoughTokens();
error Unhealthy();
error ExternalCallFailed();
error NotFulfilled();
error NotViableClaimer();

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @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);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 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;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.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));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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");
        }
    }
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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);

    /**
     * @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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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`.
     *
     * 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;

    /**
     * @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 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface 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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"NotEnoughTokens","type":"error"},{"inputs":[],"name":"NotFulfilled","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[{"internalType":"uint256","name":"_location","type":"uint256"}],"name":"WrongParams","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_target","type":"uint256"},{"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":"uint256","name":"_type","type":"uint256"}],"name":"VoyageCreated","type":"event"},{"inputs":[{"internalType":"uint256","name":"_voyageId","type":"uint256"},{"internalType":"contract DPSVoyageIV2","name":"_voyage","type":"address"}],"name":"burnVoyage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_voyageType","type":"uint16"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"contract DPSVoyageIV2","name":"_voyage","type":"address"}],"name":"buyVoyages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"doubloonsMinter","outputs":[{"internalType":"contract DPSDoubloonMinterI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameSettings","outputs":[{"internalType":"contract DPSGameSettingsI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"random","outputs":[{"internalType":"contract DPSQRNGI","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomRequestIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_destination","type":"address"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"},{"internalType":"address","name":"_destination","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"recoverNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"uint256","name":"_target","type":"uint256"},{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setContract","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":[{"internalType":"uint256","name":"_voyageId","type":"uint256"},{"internalType":"contract DPSVoyageIV2","name":"_voyage","type":"address"}],"name":"viewVoyageConfiguration","outputs":[{"components":[{"internalType":"uint16","name":"typeOfVoyage","type":"uint16"},{"internalType":"uint8","name":"noOfInteractions","type":"uint8"},{"internalType":"uint8[]","name":"sequence","type":"uint8[]"},{"internalType":"uint256","name":"boughtAt","type":"uint256"},{"internalType":"uint256","name":"gapBetweenInteractions","type":"uint256"},{"internalType":"bytes","name":"uniqueId","type":"bytes"}],"internalType":"struct VoyageConfigV2","name":"voyageConfig","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract DPSVoyageIV2","name":"","type":"address"}],"name":"voyages","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

6080604052600160065534801561001557600080fd5b5061001f33610024565b610074565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6125b7806100836000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063886f039a116100a2578063c8ff2c9211610071578063c8ff2c9214610237578063db76d5b31461024a578063de0777f61461025d578063f0fd812814610270578063f2fde38b1461028357600080fd5b8063886f039a146101ed5780638da5cb5b14610200578063a678daa314610211578063b7297cf31461022457600080fd5b8063548cb801116100de578063548cb8011461019f5780635ec01e4d146101bf5780637020e71e146101d2578063715018a6146101e557600080fd5b80630d7f503514610110578063424de32714610125578063499c3fe8146101415780634e3975e514610174575b600080fd5b61012361011e366004611e27565b610296565b005b61012e60075481565b6040519081526020015b60405180910390f35b61016461014f366004611e68565b60056020526000908152604090205460ff1681565b6040519015158152602001610138565b600154610187906001600160a01b031681565b6040516001600160a01b039091168152602001610138565b6101b26101ad366004611e85565b610379565b6040516101389190611fa2565b600354610187906001600160a01b031681565b6101236101e0366004611fb5565b610874565b610123610b26565b6101236101fb366004611fce565b610b3a565b6000546001600160a01b0316610187565b61012361021f366004611fb5565b610c2d565b600454610187906001600160a01b031681565b600254610187906001600160a01b031681565b61012361025836600461200c565b610e3b565b61012361026b36600461205c565b6113bd565b61012361027e366004611e85565b6114d8565b610123610291366004611e68565b611696565b61029e61170f565b6001600160a01b0382166102c557604051639fabe1c160e01b815260040160405180910390fd5b604051632142170760e11b81523060048201526001600160a01b038381166024830152604482018390528416906342842e0e90606401600060405180830381600087803b15801561031557600080fd5b505af1158015610329573d6000803e3d6000fd5b5050604080516001600160a01b03868116825260208201869052871693507f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f90969250015b60405180910390a2505050565b6103b96040518060c00160405280600061ffff168152602001600060ff168152602001606081526020016000815260200160008152602001606081525090565b6001600160a01b03821660009081526005602052604090205460ff166103f1576040516282b42960e81b815260040160405180910390fd5b6040516352a701e360e01b8152600481018490526001600160a01b038316906352a701e390602401600060405180830381865afa158015610436573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261045e9190810190612204565b9050806020015160ff1660000361049057604051632473a0d360e11b8152600160048201526024015b60405180910390fd5b600480548251604051630e83307960e21b815261ffff909116928101929092526000916001600160a01b0390911690633a0cc1e49060240161010060405180830381865afa1580156104e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050a91906122cb565b60035460a084015160405163078c4d3560e51b81529293506000926001600160a01b039092169163f189a6a0916105439160040161238c565b602060405180830381865afa158015610560573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610584919061239f565b9050806000036105a7576040516303de361f60e11b815260040160405180910390fd5b60006105b98287866060015186611769565b90508260c0015160ff1667ffffffffffffffff8111156105db576105db612093565b604051908082528060200260200182016040528015610604578160200160208202803683370190505b506040858101919091528051600380825260808201909252906020820160608036833750505060c08201819052805160019190600090610646576106466123b8565b60200260200101818152505060028160c0015160018151811061066b5761066b6123b8565b60200260200101818152505060038160c00151600281518110610690576106906123b8565b60200260200101818152505060005b8360c0015160ff1681101561086a578151606083015160ff16036106d9576106cc8260c001516001611934565b60c0830152600060608301525b8160200151826080015160ff1603610707576106fa8260c001516002611934565b60c0830152600060808301525b81604001518260a0015160ff1603610735576107288260c001516003611934565b60c0830152600060a08301525b8160c001515160010361074e57600060e0830152610855565b60035460608601516040516001600160a01b03909216916355f542309186916107cb9086908d90602001608080825260129082015271494e544552414354494f4e5f4f524445525f60701b60a0820152602081019290925260c060408301819052600190830152605f60f81b60e083015260608201526101000190565b604051602081830303815290604052600060018860c00151516107ee91906123e4565b6040518663ffffffff1660e01b815260040161080e9594939291906123fd565b602060405180830381865afa15801561082b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084f919061239f565b60e08301525b610860828287611a0b565b915060010161069f565b5050505092915050565b6004805460405163bc61e73360e01b81526000928101929092526001600160a01b03169063bc61e733906024016020604051808303816000875af11580156108c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e49190612437565b60ff16600103610907576040516313d0ff5960e31b815260040160405180910390fd5b6001546040516370a0823160e01b815233600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa15801561094f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610973919061239f565b1015610992576040516308aeed0f60e21b815260040160405180910390fd5b6000600460009054906101000a90046001600160a01b03166001600160a01b031663c2fea1fe6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109e7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0b919061239f565b610a159083612452565b600154604051632770a7eb60e21b81523360048201526024810185905291925083916001600160a01b0390911690639dc29fac90604401600060405180830381600087803b158015610a6657600080fd5b505af1158015610a7a573d6000803e3d6000fd5b505060025460405163160493e760e01b8152336004820152602481018690526001600160a01b03909116925063160493e79150604401600060405180830381600087803b158015610aca57600080fd5b505af1158015610ade573d6000803e3d6000fd5b50506040805184815260208101869052600193503392507fbfd50a04f1e6e4aee344f5d0e7f15d74d0dbb58cd1f711daa6463094ca9508cd91015b60405180910390a3505050565b610b2e61170f565b610b386000611aca565b565b610b4261170f565b6001600160a01b038116610b6957604051639fabe1c160e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd4919061239f565b9050610bea6001600160a01b0384168383611b1a565b604080516001600160a01b038481168252602082018490528516917f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f9096910161036c565b6004805460405163bc61e73360e01b81526001928101929092526001600160a01b03169063bc61e733906024016020604051808303816000875af1158015610c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9d9190612437565b60ff16600103610cc0576040516313d0ff5960e31b815260040160405180910390fd5b600480546040805163617f50ff60e11b8152905184936000936001600160a01b03169263c2fea1fe92818301926020928290030181865afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d919061239f565b610d379084612469565b60025460405163396aec3b60e21b8152336004820152602481018590529192506001600160a01b03169063e5abb0ec90604401600060405180830381600087803b158015610d8457600080fd5b505af1158015610d98573d6000803e3d6000fd5b50506001546040516340c10f1960e01b8152336004820152602481018590526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b50506040805184815260208101869052600093503392507fbfd50a04f1e6e4aee344f5d0e7f15d74d0dbb58cd1f711daa6463094ca9508cd9101610b19565b60065460021480610e6557506001600160a01b03811660009081526005602052604090205460ff16155b15610e82576040516282b42960e81b815260040160405180910390fd5b600260068190556004805460405163bc61e73360e01b8152918201929092526001600160a01b039091169063bc61e733906024016020604051808303816000875af1158015610ed5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef99190612437565b60ff16600103610f1c576040516313d0ff5960e31b815260040160405180910390fd5b6004805460405163b16788b560e01b815261ffff8616928101929092526000916001600160a01b039091169063b16788b590602401602060405180830381865afa158015610f6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f92919061239f565b905080600003610fb857604051632473a0d360e11b815260016004820152602401610487565b610fc28382612452565b6001546040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561100a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102e919061239f565b101561104d576040516308aeed0f60e21b815260040160405180910390fd5b600754604080513360208201526080918101829052600a60a0820152694255595f564f5941474560b01b60c08201526060810192909252429082015260009060e00160408051601f198184030181529190526007805491925060006110b18361248b565b919050555060005b8481101561134e5760048054604051630e83307960e21b815261ffff8916928101929092526000916001600160a01b0390911690633a0cc1e49060240161010060405180830381865afa158015611114573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113891906122cb565b905060008160c0015160ff1667ffffffffffffffff81111561115c5761115c612093565b604051908082528060200260200182016040528015611185578160200160208202803683370190505b50905060006040518060c001604052808a61ffff168152602001835160ff1681526020018381526020014381526020018460e0015181526020018681525090506000876001600160a01b03166307c560016040518163ffffffff1660e01b8152600401602060405180830381865afa158015611205573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611229919061239f565b6112349060016124a4565b600154604051632770a7eb60e21b8152336004820152602481018a90529192506001600160a01b031690639dc29fac90604401600060405180830381600087803b15801561128157600080fd5b505af1158015611295573d6000803e3d6000fd5b5050604051633337366b60e21b81526001600160a01b038b16925063ccdcd9ac91506112c9903390859087906004016124b7565b600060405180830381600087803b1580156112e357600080fd5b505af11580156112f7573d6000803e3d6000fd5b50506040805184815261ffff8e1660208201523393507ff5d554220c117b825cf48f1b6792116a4c98735c37519e67c06480e4ab79b96792500160405180910390a250505050806113479061248b565b90506110b9565b5060035460405163123a60e960e01b81526001600160a01b039091169063123a60e99061137f90849060040161238c565b600060405180830381600087803b15801561139957600080fd5b505af11580156113ad573d6000803e3d6000fd5b5050600160065550505050505050565b6113c561170f565b816001036113f6576001600160a01b0383166000908152600560205260409020805460ff1916821515179055611492565b8160020361141e57600380546001600160a01b0319166001600160a01b038516179055611492565b8160030361144657600280546001600160a01b0319166001600160a01b038516179055611492565b8160040361146e57600180546001600160a01b0319166001600160a01b038516179055611492565b8160050361149257600480546001600160a01b0319166001600160a01b0385161790555b604080518381526001600160a01b03851660208201527fd58da2325ce084e36b92ea4c1a90706ffa665d07ec064f887de9dbb8f15f4995910160405180910390a1505050565b6001600160a01b03811660009081526005602052604090205460ff16611510576040516282b42960e81b815260040160405180910390fd5b6004805460405163bc61e73360e01b81526003928101929092526001600160a01b03169063bc61e733906024016020604051808303816000875af115801561155c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115809190612437565b60ff166001036115a3576040516313d0ff5960e31b815260040160405180910390fd5b6040516331a9108f60e11b81526004810183905233906001600160a01b03831690636352211e90602401602060405180830381865afa1580156115ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160e91906124e7565b6001600160a01b03161461163857604051632473a0d360e11b815260016004820152602401610487565b604051630852cd8d60e31b8152600481018390526001600160a01b038216906342966c6890602401600060405180830381600087803b15801561167a57600080fd5b505af115801561168e573d6000803e3d6000fd5b505050505050565b61169e61170f565b6001600160a01b0381166117035760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610487565b61170c81611aca565b50565b6000546001600160a01b03163314610b385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610487565b611771611dc4565b611779611dc4565b6003546040805160208101829052600b60608201526a4e4f4f46454e454d49455360a81b60808201529081018790526001600160a01b03909116906355f54230908890879060a00160408051601f1981840301815290829052608089015160a08a01516001600160e01b031960e088901b1684526117fb959493600401612504565b602060405180830381865afa158015611818573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183c919061239f565b604082810191909152600354815160208101839052600a6060820152694e4f4f4653544f524d5360b01b60808201529182018790526001600160a01b0316906355f54230908890879060a00160408051601f198184030181528282529089015160608a01516001600160e01b031960e088901b1684526118c0959493600401612504565b602060405180830381865afa1580156118dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611901919061239f565b60208201819052604082015160c085015161191f919060ff1661253f565b611929919061253f565b815295945050505050565b6060600060018451611946919061253f565b67ffffffffffffffff81111561195e5761195e612093565b604051908082528060200260200182016040528015611987578160200160208202803683370190505b5090506000805b85518110156119ff57848682815181106119aa576119aa6123b8565b602002602001015103156119f7578581815181106119ca576119ca6123b8565b60200260200101518383806001019450815181106119ea576119ea6123b8565b6020026020010181815250505b60010161198e565b50909150505b92915050565b611a13611dc4565b60008460c001518560e0015181518110611a2f57611a2f6123b8565b602002602001015190508083604001518581518110611a5057611a506123b8565b602002602001019060ff16908160ff168152505080600103611a875760608501805190611a7c82612552565b60ff16905250611abe565b80600203611a9f5760808501805190611a7c82612552565b80600303611abe5760a08501805190611ab782612552565b60ff169052505b849150505b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611b6c908490611b71565b505050565b6000611bc6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c439092919063ffffffff16565b805190915015611b6c5780806020019051810190611be49190612571565b611b6c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610487565b6060611c528484600085611c5a565b949350505050565b606082471015611cbb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610487565b6001600160a01b0385163b611d125760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610487565b600080866001600160a01b03168587604051611d2e919061258e565b60006040518083038185875af1925050503d8060008114611d6b576040519150601f19603f3d011682016040523d82523d6000602084013e611d70565b606091505b5091509150611d80828286611d8b565b979650505050505050565b60608315611d9a575081611ac3565b825115611daa5782518084602001fd5b8160405162461bcd60e51b8152600401610487919061238c565b604051806101000160405280600081526020016000815260200160008152602001600060ff168152602001600060ff168152602001600060ff16815260200160608152602001600081525090565b6001600160a01b038116811461170c57600080fd5b600080600060608486031215611e3c57600080fd5b8335611e4781611e12565b92506020840135611e5781611e12565b929592945050506040919091013590565b600060208284031215611e7a57600080fd5b8135611ac381611e12565b60008060408385031215611e9857600080fd5b823591506020830135611eaa81611e12565b809150509250929050565b60005b83811015611ed0578181015183820152602001611eb8565b50506000910152565b60008151808452611ef1816020860160208601611eb5565b601f01601f19169290920160200192915050565b600060c0830161ffff835116845260208084015160ff808216838801526040860151915060c0604088015283825180865260e0890191508484019550600093505b80841015611f6857855183168252948401946001939093019290840190611f46565b50606087015160608901526080870151608089015260a0870151945087810360a0890152611f968186611ed9565b98975050505050505050565b602081526000611ac36020830184611f05565b600060208284031215611fc757600080fd5b5035919050565b60008060408385031215611fe157600080fd5b8235611fec81611e12565b91506020830135611eaa81611e12565b61ffff8116811461170c57600080fd5b60008060006060848603121561202157600080fd5b833561202c81611ffc565b925060208401359150604084013561204381611e12565b809150509250925092565b801515811461170c57600080fd5b60008060006060848603121561207157600080fd5b833561207c81611e12565b92506020840135915060408401356120438161204e565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156120cc576120cc612093565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156120fb576120fb612093565b604052919050565b805161210e81611ffc565b919050565b805160ff8116811461210e57600080fd5b600082601f83011261213557600080fd5b8151602067ffffffffffffffff82111561215157612151612093565b8160051b6121608282016120d2565b928352848101820192828101908785111561217a57600080fd5b83870192505b84831015611d805761219183612113565b82529183019190830190612180565b600082601f8301126121b157600080fd5b815167ffffffffffffffff8111156121cb576121cb612093565b6121de601f8201601f19166020016120d2565b8181528460208386010111156121f357600080fd5b611c52826020830160208701611eb5565b60006020828403121561221657600080fd5b815167ffffffffffffffff8082111561222e57600080fd5b9083019060c0828603121561224257600080fd5b61224a6120a9565b61225383612103565b815261226160208401612113565b602082015260408301518281111561227857600080fd5b61228487828601612124565b604083015250606083015160608201526080830151608082015260a0830151828111156122b057600080fd5b6122bc878286016121a0565b60a08301525095945050505050565b60006101008083850312156122df57600080fd5b6040519081019067ffffffffffffffff8211818310171561230257612302612093565b8160405261230f84612113565b815261231d60208501612113565b602082015261232e60408501612113565b604082015261233f60608501612113565b606082015261235060808501612113565b608082015261236160a08501612113565b60a082015261237260c08501612113565b60c082015260e084015160e0820152809250505092915050565b602081526000611ac36020830184611ed9565b6000602082840312156123b157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60ff8281168282160390811115611a0557611a056123ce565b85815284602082015260a06040820152600061241c60a0830186611ed9565b905083606083015260ff831660808301529695505050505050565b60006020828403121561244957600080fd5b611ac382612113565b8082028115828204841417611a0557611a056123ce565b60008261248657634e487b7160e01b600052601260045260246000fd5b500490565b60006001820161249d5761249d6123ce565b5060010190565b80820180821115611a0557611a056123ce565b60018060a01b03841681528260208201526060604082015260006124de6060830184611f05565b95945050505050565b6000602082840312156124f957600080fd5b8151611ac381611e12565b85815284602082015260a06040820152600061252360a0830186611ed9565b60ff948516606084015292909316608090910152949350505050565b81810381811115611a0557611a056123ce565b600060ff821660ff8103612568576125686123ce565b60010192915050565b60006020828403121561258357600080fd5b8151611ac38161204e565b600082516125a0818460208701611eb5565b919091019291505056fea164736f6c6343000811000a

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063886f039a116100a2578063c8ff2c9211610071578063c8ff2c9214610237578063db76d5b31461024a578063de0777f61461025d578063f0fd812814610270578063f2fde38b1461028357600080fd5b8063886f039a146101ed5780638da5cb5b14610200578063a678daa314610211578063b7297cf31461022457600080fd5b8063548cb801116100de578063548cb8011461019f5780635ec01e4d146101bf5780637020e71e146101d2578063715018a6146101e557600080fd5b80630d7f503514610110578063424de32714610125578063499c3fe8146101415780634e3975e514610174575b600080fd5b61012361011e366004611e27565b610296565b005b61012e60075481565b6040519081526020015b60405180910390f35b61016461014f366004611e68565b60056020526000908152604090205460ff1681565b6040519015158152602001610138565b600154610187906001600160a01b031681565b6040516001600160a01b039091168152602001610138565b6101b26101ad366004611e85565b610379565b6040516101389190611fa2565b600354610187906001600160a01b031681565b6101236101e0366004611fb5565b610874565b610123610b26565b6101236101fb366004611fce565b610b3a565b6000546001600160a01b0316610187565b61012361021f366004611fb5565b610c2d565b600454610187906001600160a01b031681565b600254610187906001600160a01b031681565b61012361025836600461200c565b610e3b565b61012361026b36600461205c565b6113bd565b61012361027e366004611e85565b6114d8565b610123610291366004611e68565b611696565b61029e61170f565b6001600160a01b0382166102c557604051639fabe1c160e01b815260040160405180910390fd5b604051632142170760e11b81523060048201526001600160a01b038381166024830152604482018390528416906342842e0e90606401600060405180830381600087803b15801561031557600080fd5b505af1158015610329573d6000803e3d6000fd5b5050604080516001600160a01b03868116825260208201869052871693507f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f90969250015b60405180910390a2505050565b6103b96040518060c00160405280600061ffff168152602001600060ff168152602001606081526020016000815260200160008152602001606081525090565b6001600160a01b03821660009081526005602052604090205460ff166103f1576040516282b42960e81b815260040160405180910390fd5b6040516352a701e360e01b8152600481018490526001600160a01b038316906352a701e390602401600060405180830381865afa158015610436573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261045e9190810190612204565b9050806020015160ff1660000361049057604051632473a0d360e11b8152600160048201526024015b60405180910390fd5b600480548251604051630e83307960e21b815261ffff909116928101929092526000916001600160a01b0390911690633a0cc1e49060240161010060405180830381865afa1580156104e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050a91906122cb565b60035460a084015160405163078c4d3560e51b81529293506000926001600160a01b039092169163f189a6a0916105439160040161238c565b602060405180830381865afa158015610560573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610584919061239f565b9050806000036105a7576040516303de361f60e11b815260040160405180910390fd5b60006105b98287866060015186611769565b90508260c0015160ff1667ffffffffffffffff8111156105db576105db612093565b604051908082528060200260200182016040528015610604578160200160208202803683370190505b506040858101919091528051600380825260808201909252906020820160608036833750505060c08201819052805160019190600090610646576106466123b8565b60200260200101818152505060028160c0015160018151811061066b5761066b6123b8565b60200260200101818152505060038160c00151600281518110610690576106906123b8565b60200260200101818152505060005b8360c0015160ff1681101561086a578151606083015160ff16036106d9576106cc8260c001516001611934565b60c0830152600060608301525b8160200151826080015160ff1603610707576106fa8260c001516002611934565b60c0830152600060808301525b81604001518260a0015160ff1603610735576107288260c001516003611934565b60c0830152600060a08301525b8160c001515160010361074e57600060e0830152610855565b60035460608601516040516001600160a01b03909216916355f542309186916107cb9086908d90602001608080825260129082015271494e544552414354494f4e5f4f524445525f60701b60a0820152602081019290925260c060408301819052600190830152605f60f81b60e083015260608201526101000190565b604051602081830303815290604052600060018860c00151516107ee91906123e4565b6040518663ffffffff1660e01b815260040161080e9594939291906123fd565b602060405180830381865afa15801561082b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084f919061239f565b60e08301525b610860828287611a0b565b915060010161069f565b5050505092915050565b6004805460405163bc61e73360e01b81526000928101929092526001600160a01b03169063bc61e733906024016020604051808303816000875af11580156108c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e49190612437565b60ff16600103610907576040516313d0ff5960e31b815260040160405180910390fd5b6001546040516370a0823160e01b815233600482015282916001600160a01b0316906370a0823190602401602060405180830381865afa15801561094f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610973919061239f565b1015610992576040516308aeed0f60e21b815260040160405180910390fd5b6000600460009054906101000a90046001600160a01b03166001600160a01b031663c2fea1fe6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109e7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0b919061239f565b610a159083612452565b600154604051632770a7eb60e21b81523360048201526024810185905291925083916001600160a01b0390911690639dc29fac90604401600060405180830381600087803b158015610a6657600080fd5b505af1158015610a7a573d6000803e3d6000fd5b505060025460405163160493e760e01b8152336004820152602481018690526001600160a01b03909116925063160493e79150604401600060405180830381600087803b158015610aca57600080fd5b505af1158015610ade573d6000803e3d6000fd5b50506040805184815260208101869052600193503392507fbfd50a04f1e6e4aee344f5d0e7f15d74d0dbb58cd1f711daa6463094ca9508cd91015b60405180910390a3505050565b610b2e61170f565b610b386000611aca565b565b610b4261170f565b6001600160a01b038116610b6957604051639fabe1c160e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd4919061239f565b9050610bea6001600160a01b0384168383611b1a565b604080516001600160a01b038481168252602082018490528516917f879f92dded0f26b83c3e00b12e0395dc72cfc3077343d1854ed6988edd1f9096910161036c565b6004805460405163bc61e73360e01b81526001928101929092526001600160a01b03169063bc61e733906024016020604051808303816000875af1158015610c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9d9190612437565b60ff16600103610cc0576040516313d0ff5960e31b815260040160405180910390fd5b600480546040805163617f50ff60e11b8152905184936000936001600160a01b03169263c2fea1fe92818301926020928290030181865afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d919061239f565b610d379084612469565b60025460405163396aec3b60e21b8152336004820152602481018590529192506001600160a01b03169063e5abb0ec90604401600060405180830381600087803b158015610d8457600080fd5b505af1158015610d98573d6000803e3d6000fd5b50506001546040516340c10f1960e01b8152336004820152602481018590526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b50506040805184815260208101869052600093503392507fbfd50a04f1e6e4aee344f5d0e7f15d74d0dbb58cd1f711daa6463094ca9508cd9101610b19565b60065460021480610e6557506001600160a01b03811660009081526005602052604090205460ff16155b15610e82576040516282b42960e81b815260040160405180910390fd5b600260068190556004805460405163bc61e73360e01b8152918201929092526001600160a01b039091169063bc61e733906024016020604051808303816000875af1158015610ed5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef99190612437565b60ff16600103610f1c576040516313d0ff5960e31b815260040160405180910390fd5b6004805460405163b16788b560e01b815261ffff8616928101929092526000916001600160a01b039091169063b16788b590602401602060405180830381865afa158015610f6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f92919061239f565b905080600003610fb857604051632473a0d360e11b815260016004820152602401610487565b610fc28382612452565b6001546040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561100a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102e919061239f565b101561104d576040516308aeed0f60e21b815260040160405180910390fd5b600754604080513360208201526080918101829052600a60a0820152694255595f564f5941474560b01b60c08201526060810192909252429082015260009060e00160408051601f198184030181529190526007805491925060006110b18361248b565b919050555060005b8481101561134e5760048054604051630e83307960e21b815261ffff8916928101929092526000916001600160a01b0390911690633a0cc1e49060240161010060405180830381865afa158015611114573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113891906122cb565b905060008160c0015160ff1667ffffffffffffffff81111561115c5761115c612093565b604051908082528060200260200182016040528015611185578160200160208202803683370190505b50905060006040518060c001604052808a61ffff168152602001835160ff1681526020018381526020014381526020018460e0015181526020018681525090506000876001600160a01b03166307c560016040518163ffffffff1660e01b8152600401602060405180830381865afa158015611205573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611229919061239f565b6112349060016124a4565b600154604051632770a7eb60e21b8152336004820152602481018a90529192506001600160a01b031690639dc29fac90604401600060405180830381600087803b15801561128157600080fd5b505af1158015611295573d6000803e3d6000fd5b5050604051633337366b60e21b81526001600160a01b038b16925063ccdcd9ac91506112c9903390859087906004016124b7565b600060405180830381600087803b1580156112e357600080fd5b505af11580156112f7573d6000803e3d6000fd5b50506040805184815261ffff8e1660208201523393507ff5d554220c117b825cf48f1b6792116a4c98735c37519e67c06480e4ab79b96792500160405180910390a250505050806113479061248b565b90506110b9565b5060035460405163123a60e960e01b81526001600160a01b039091169063123a60e99061137f90849060040161238c565b600060405180830381600087803b15801561139957600080fd5b505af11580156113ad573d6000803e3d6000fd5b5050600160065550505050505050565b6113c561170f565b816001036113f6576001600160a01b0383166000908152600560205260409020805460ff1916821515179055611492565b8160020361141e57600380546001600160a01b0319166001600160a01b038516179055611492565b8160030361144657600280546001600160a01b0319166001600160a01b038516179055611492565b8160040361146e57600180546001600160a01b0319166001600160a01b038516179055611492565b8160050361149257600480546001600160a01b0319166001600160a01b0385161790555b604080518381526001600160a01b03851660208201527fd58da2325ce084e36b92ea4c1a90706ffa665d07ec064f887de9dbb8f15f4995910160405180910390a1505050565b6001600160a01b03811660009081526005602052604090205460ff16611510576040516282b42960e81b815260040160405180910390fd5b6004805460405163bc61e73360e01b81526003928101929092526001600160a01b03169063bc61e733906024016020604051808303816000875af115801561155c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115809190612437565b60ff166001036115a3576040516313d0ff5960e31b815260040160405180910390fd5b6040516331a9108f60e11b81526004810183905233906001600160a01b03831690636352211e90602401602060405180830381865afa1580156115ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160e91906124e7565b6001600160a01b03161461163857604051632473a0d360e11b815260016004820152602401610487565b604051630852cd8d60e31b8152600481018390526001600160a01b038216906342966c6890602401600060405180830381600087803b15801561167a57600080fd5b505af115801561168e573d6000803e3d6000fd5b505050505050565b61169e61170f565b6001600160a01b0381166117035760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610487565b61170c81611aca565b50565b6000546001600160a01b03163314610b385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610487565b611771611dc4565b611779611dc4565b6003546040805160208101829052600b60608201526a4e4f4f46454e454d49455360a81b60808201529081018790526001600160a01b03909116906355f54230908890879060a00160408051601f1981840301815290829052608089015160a08a01516001600160e01b031960e088901b1684526117fb959493600401612504565b602060405180830381865afa158015611818573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183c919061239f565b604082810191909152600354815160208101839052600a6060820152694e4f4f4653544f524d5360b01b60808201529182018790526001600160a01b0316906355f54230908890879060a00160408051601f198184030181528282529089015160608a01516001600160e01b031960e088901b1684526118c0959493600401612504565b602060405180830381865afa1580156118dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611901919061239f565b60208201819052604082015160c085015161191f919060ff1661253f565b611929919061253f565b815295945050505050565b6060600060018451611946919061253f565b67ffffffffffffffff81111561195e5761195e612093565b604051908082528060200260200182016040528015611987578160200160208202803683370190505b5090506000805b85518110156119ff57848682815181106119aa576119aa6123b8565b602002602001015103156119f7578581815181106119ca576119ca6123b8565b60200260200101518383806001019450815181106119ea576119ea6123b8565b6020026020010181815250505b60010161198e565b50909150505b92915050565b611a13611dc4565b60008460c001518560e0015181518110611a2f57611a2f6123b8565b602002602001015190508083604001518581518110611a5057611a506123b8565b602002602001019060ff16908160ff168152505080600103611a875760608501805190611a7c82612552565b60ff16905250611abe565b80600203611a9f5760808501805190611a7c82612552565b80600303611abe5760a08501805190611ab782612552565b60ff169052505b849150505b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611b6c908490611b71565b505050565b6000611bc6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c439092919063ffffffff16565b805190915015611b6c5780806020019051810190611be49190612571565b611b6c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610487565b6060611c528484600085611c5a565b949350505050565b606082471015611cbb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610487565b6001600160a01b0385163b611d125760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610487565b600080866001600160a01b03168587604051611d2e919061258e565b60006040518083038185875af1925050503d8060008114611d6b576040519150601f19603f3d011682016040523d82523d6000602084013e611d70565b606091505b5091509150611d80828286611d8b565b979650505050505050565b60608315611d9a575081611ac3565b825115611daa5782518084602001fd5b8160405162461bcd60e51b8152600401610487919061238c565b604051806101000160405280600081526020016000815260200160008152602001600060ff168152602001600060ff168152602001600060ff16815260200160608152602001600081525090565b6001600160a01b038116811461170c57600080fd5b600080600060608486031215611e3c57600080fd5b8335611e4781611e12565b92506020840135611e5781611e12565b929592945050506040919091013590565b600060208284031215611e7a57600080fd5b8135611ac381611e12565b60008060408385031215611e9857600080fd5b823591506020830135611eaa81611e12565b809150509250929050565b60005b83811015611ed0578181015183820152602001611eb8565b50506000910152565b60008151808452611ef1816020860160208601611eb5565b601f01601f19169290920160200192915050565b600060c0830161ffff835116845260208084015160ff808216838801526040860151915060c0604088015283825180865260e0890191508484019550600093505b80841015611f6857855183168252948401946001939093019290840190611f46565b50606087015160608901526080870151608089015260a0870151945087810360a0890152611f968186611ed9565b98975050505050505050565b602081526000611ac36020830184611f05565b600060208284031215611fc757600080fd5b5035919050565b60008060408385031215611fe157600080fd5b8235611fec81611e12565b91506020830135611eaa81611e12565b61ffff8116811461170c57600080fd5b60008060006060848603121561202157600080fd5b833561202c81611ffc565b925060208401359150604084013561204381611e12565b809150509250925092565b801515811461170c57600080fd5b60008060006060848603121561207157600080fd5b833561207c81611e12565b92506020840135915060408401356120438161204e565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff811182821017156120cc576120cc612093565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156120fb576120fb612093565b604052919050565b805161210e81611ffc565b919050565b805160ff8116811461210e57600080fd5b600082601f83011261213557600080fd5b8151602067ffffffffffffffff82111561215157612151612093565b8160051b6121608282016120d2565b928352848101820192828101908785111561217a57600080fd5b83870192505b84831015611d805761219183612113565b82529183019190830190612180565b600082601f8301126121b157600080fd5b815167ffffffffffffffff8111156121cb576121cb612093565b6121de601f8201601f19166020016120d2565b8181528460208386010111156121f357600080fd5b611c52826020830160208701611eb5565b60006020828403121561221657600080fd5b815167ffffffffffffffff8082111561222e57600080fd5b9083019060c0828603121561224257600080fd5b61224a6120a9565b61225383612103565b815261226160208401612113565b602082015260408301518281111561227857600080fd5b61228487828601612124565b604083015250606083015160608201526080830151608082015260a0830151828111156122b057600080fd5b6122bc878286016121a0565b60a08301525095945050505050565b60006101008083850312156122df57600080fd5b6040519081019067ffffffffffffffff8211818310171561230257612302612093565b8160405261230f84612113565b815261231d60208501612113565b602082015261232e60408501612113565b604082015261233f60608501612113565b606082015261235060808501612113565b608082015261236160a08501612113565b60a082015261237260c08501612113565b60c082015260e084015160e0820152809250505092915050565b602081526000611ac36020830184611ed9565b6000602082840312156123b157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60ff8281168282160390811115611a0557611a056123ce565b85815284602082015260a06040820152600061241c60a0830186611ed9565b905083606083015260ff831660808301529695505050505050565b60006020828403121561244957600080fd5b611ac382612113565b8082028115828204841417611a0557611a056123ce565b60008261248657634e487b7160e01b600052601260045260246000fd5b500490565b60006001820161249d5761249d6123ce565b5060010190565b80820180821115611a0557611a056123ce565b60018060a01b03841681528260208201526060604082015260006124de6060830184611f05565b95945050505050565b6000602082840312156124f957600080fd5b8151611ac381611e12565b85815284602082015260a06040820152600061252360a0830186611ed9565b60ff948516606084015292909316608090910152949350505050565b81810381811115611a0557611a056123ce565b600060ff821660ff8103612568576125686123ce565b60010192915050565b60006020828403121561258357600080fd5b8151611ac38161204e565b600082516125a0818460208701611eb5565b919091019291505056fea164736f6c6343000811000a

Block Transaction Gas Used Reward
view all blocks collator

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

OVERVIEW

Hector the Treasure Map Vendor.

Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.