Accounts
0xed...7309
0xed...7309

0xed...7309

$500
This contract's source code is verified!
Contract Metadata
Compiler
0.8.11+commit.d7f03943
Language
Solidity
Contract Source Code
File 1 of 6: Context.sol
// SPDX-License-Identifier: MIT

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;
    }
}
Contract Source Code
File 2 of 6: IMasterStaker.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;

interface IMasterStaker {

 function masterStake(
        uint16[] calldata colonistTokenIds,
        uint16[] calldata pirateTokenIds
    ) external;

 function masterUnstake(
        uint16[] calldata colonistTokenIds,
        uint16[] calldata pirateTokenIds
    ) external;

 function masterClaim(
        uint16[] calldata colonistTokenIds,
        uint16[] calldata pirateTokenIds
    ) external;
}
Contract Source Code
File 3 of 6: IOrbitalBlockade.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

interface IOrbitalBlockade {
    function addPiratesToCrew(address account, uint16[] calldata tokenIds)
        external;
    
    function claimPiratesFromCrew(address account, uint16[] calldata tokenIds, bool unstake)
        external;

    function payPirateTax(uint256 amount) external;

    function randomPirateOwner(uint256 seed) external view returns (address);
}
Contract Source Code
File 4 of 6: IPytheas.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

interface IPytheas {
    function addColonistToPytheas(address account, uint16[] calldata tokenIds)
        external;

    function claimColonistFromPytheas(address account, uint16[] calldata tokenIds, bool unstake)
        external;

    function getColonistMined(address account, uint16 tokenId)
        external
        returns (uint256);

    function handleJoinPirates(address addr, uint16 tokenId) external;

    function payUp(
        uint16 tokenId,
        uint256 amtMined,
        address addr
    ) external;
}
Contract Source Code
File 5 of 6: MasterStaker.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/security/Pausable.sol";
import "./interfaces/IPytheas.sol";
import "./interfaces/IOrbitalBlockade.sol";
import "./interfaces/IMasterStaker.sol";

contract MasterStaker is IMasterStaker, Pausable {
    address public auth;

    mapping(address => bool) private admins;

    // reference to Pytheas for stake of colonist
    IPytheas public pytheas;

    //reference to the oribitalBlockade for stake of pirates
    IOrbitalBlockade public orbital;

    constructor() {
        auth = msg.sender;
    }

    modifier noCheaters() {
        uint256 size = 0;
        address acc = msg.sender;
        assembly {
            size := extcodesize(acc)
        }

        require(
            msg.sender == tx.origin && size == 0,
            "you're trying to cheat!"
        );
        _;
    }
    modifier onlyOwner() {
        require(msg.sender == auth);
        _;
    }

    /** CRITICAL TO SETUP */
    modifier requireContractsSet() {
        require(
            address(pytheas) != address(0) && address(orbital) != address(0),
            "Contracts not set"
        );
        _;
    }

    function setContracts(address _pytheas, address _orbital)
        external
        onlyOwner
    {
        pytheas = IPytheas(_pytheas);
        orbital = IOrbitalBlockade(_orbital);
    }

    function masterStake(
        uint16[] calldata colonistTokenIds,
        uint16[] calldata pirateTokenIds
    ) external whenNotPaused noCheaters {
        uint16[] memory colonistIds = uint16[](colonistTokenIds);
        uint16[] memory pirateIds = uint16[](pirateTokenIds);
        pytheas.addColonistToPytheas(msg.sender, colonistIds);
        orbital.addPiratesToCrew(msg.sender, pirateIds);
    }

    function masterUnstake(
        uint16[] calldata colonistTokenIds,
        uint16[] calldata pirateTokenIds
    ) external whenNotPaused noCheaters {
        uint16[] memory colonistIds = uint16[](colonistTokenIds);
        uint16[] memory pirateIds = uint16[](pirateTokenIds);
        pytheas.claimColonistFromPytheas(msg.sender, colonistIds, true);
        orbital.claimPiratesFromCrew(msg.sender, pirateIds, true);
    }

    function masterClaim(
        uint16[] calldata colonistTokenIds,
        uint16[] calldata pirateTokenIds
    ) external whenNotPaused noCheaters {
        uint16[] memory colonistIds = uint16[](colonistTokenIds);
        uint16[] memory pirateIds = uint16[](pirateTokenIds);
        pytheas.claimColonistFromPytheas(msg.sender, colonistIds, false);
        orbital.claimPiratesFromCrew(msg.sender, pirateIds, false);
    }

    /**
     * enables owner to pause / unpause contract
     */
    function setPaused(bool _paused) external requireContractsSet onlyOwner {
        if (_paused) _pause();
        else _unpause();
    }

    function transferOwnership(address newOwner) external onlyOwner {
        auth = newOwner;
    }
}
Contract Source Code
File 6 of 6: Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
Settings
{
  "compilationTarget": {
    "contracts/MasterStaker.sol": "MasterStaker"
  },
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "details": {
      "constantOptimizer": true,
      "cse": true,
      "deduplicate": true,
      "inliner": true,
      "jumpdestRemover": true,
      "orderLiterals": true,
      "peephole": true,
      "yul": true,
      "yulDetails": {
        "optimizerSteps": "dhfoDgvulfnTUtnIf",
        "stackAllocation": true
      }
    },
    "runs": 2000
  },
  "remappings": []
}
ABI
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"auth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"colonistTokenIds","type":"uint16[]"},{"internalType":"uint16[]","name":"pirateTokenIds","type":"uint16[]"}],"name":"masterClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"colonistTokenIds","type":"uint16[]"},{"internalType":"uint16[]","name":"pirateTokenIds","type":"uint16[]"}],"name":"masterStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"colonistTokenIds","type":"uint16[]"},{"internalType":"uint16[]","name":"pirateTokenIds","type":"uint16[]"}],"name":"masterUnstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"orbital","outputs":[{"internalType":"contract IOrbitalBlockade","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pytheas","outputs":[{"internalType":"contract IPytheas","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pytheas","type":"address"},{"internalType":"address","name":"_orbital","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]