ETH Price: $2,874.35 (-9.20%)
Gas: 12 Gwei

Token

Moonbase: The Game (MOONGAME)
 

Overview

Max Total Supply

5,520 MOONGAME

Holders

817

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
1 MOONGAME
0x5902385d185ab3a38f2a0ca9b244979124962793
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Moonbase is a new DeFi primitive built by GHOULS and designed to encourage alignment, growth, and collaboration between fair-launch projects.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
MoonbaseTheGameNFT

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-10-23
*/

pragma solidity >=0.6.0;

interface IPoolFactory {
    function createNewPool(
        address _rewardToken,
        address _rover,
        uint256 _duration,
        address _distributor
    ) external returns (address);
}


pragma solidity >=0.6.0;

interface IBasedGod {
    function getSellingSchedule() external view returns (uint256);
    function weth() external view returns (address);
    function susd() external view returns (address);
    function based() external view returns (address);
    function uniswapRouter() external view returns (address);
    function moonbase() external view returns (address);
    function deployer() external view returns (address);
    function getRovers() external view returns (address[] memory);
    function getTokenRovers(address token) external view returns (address[] memory);
}



pragma solidity ^0.6.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}



pragma solidity ^0.6.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}



pragma solidity ^0.6.2;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}



pragma solidity ^0.6.0;




/**
 * @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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}



pragma solidity ^0.6.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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}



pragma solidity ^0.6.0;

/**
 * @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.
 */
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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}


pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}


pragma solidity >=0.6.2;


interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}


pragma solidity >=0.6.0;

interface ISwapModule {
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function swapReward(uint256 amountIn, address receiver, address[] calldata path) external returns (uint256);
}


pragma solidity >=0.6.0;








contract Rover is Ownable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    uint256 public constant vestingTime = 365*24*60*60; // 1 year

    uint256 public roverStart;
    uint256 public latestBalance;
    uint256 public totalTokensReceived;
    uint256 public totalTokensWithdrawn;
    address[] public path;

    // prepare for v1.69 migration
    address public marsColony;
    bool public migrationCompleted;

    IBasedGod public basedGod;
    IERC20 public immutable based;
    IERC20 public immutable rewardToken;
    address public immutable swapModule;


    modifier updateBalance() {
        sync();
        _;
        latestBalance = rewardToken.balanceOf(address(this));
    }

    modifier onlyBasedDeployer() {
        require(msg.sender == basedGod.deployer(), "Not a deployer");
        _;
    }

    modifier onlyMarsColony() {
        require(msg.sender == marsColony, "Not a new moonbase");
        _;
    }

    /// @param _pair either "sUSD" or "WETH"
    constructor (
        address _rewardToken,
        string memory _pair,
        address _swapModule
    )
        public
    {
        basedGod = IBasedGod(msg.sender);
        // set immutables
        rewardToken = IERC20(_rewardToken);
        based = IERC20(basedGod.based());
        swapModule = _swapModule;

        address[] memory _path = new address[](3);
        _path[0] = _rewardToken;
        _path[2] = basedGod.based();

        if (keccak256(abi.encodePacked(_pair)) == keccak256(abi.encodePacked("WETH"))) {
            _path[1] = basedGod.weth();
        } else if (keccak256(abi.encodePacked(_pair)) == keccak256(abi.encodePacked("sUSD"))) {
            _path[1] = basedGod.susd();
        } else {
            revert("must use a CERTIFIED OFFICIAL $BASED™ pair");
        }

        // ensure that the path exists
        uint[] memory amountsOut = ISwapModule(_swapModule).getAmountsOut(10**10, _path);
        require(amountsOut[amountsOut.length - 1] >= 1, "Path does not exist");

        path = _path;
    }

    function balance() public view returns (uint256) {
        return rewardToken.balanceOf(address(this));
    }

    function calculateReward() public view returns (uint256) {
        uint256 timeElapsed = block.timestamp.sub(roverStart);
        if (timeElapsed > vestingTime) timeElapsed = vestingTime;
        uint256 maxClaimable = totalTokensReceived.mul(timeElapsed).div(vestingTime);
        return maxClaimable.sub(totalTokensWithdrawn);
    }

    function rugPull() public virtual updateBalance {
        require(roverStart != 0, "Rover is not initialized");

        // Calculate how much reward can be swapped
        uint256 availableReward = calculateReward();

        // Record that the tokens are being withdrawn
        totalTokensWithdrawn = totalTokensWithdrawn.add(availableReward);
        // Swap for BASED
        (bool success, bytes memory result) = swapModule.delegatecall(
            abi.encodeWithSignature(
                "swapReward(uint256,address,address[])",
                availableReward,
                address(this),
                path
            )
        );
        require(success, "SwapModule: Swap failed");
        uint256 basedReward = abi.decode(result, (uint256));

        // Split the reward between the caller and the moonbase contract
        uint256 callerReward = basedReward.div(100);
        uint256 moonbaseReward = basedReward.sub(callerReward);

        // Reward the caller
        based.transfer(msg.sender, callerReward);
        // Send to MoonBase
        based.transfer(basedGod.moonbase(), moonbaseReward);
    }

    function setMarsColony(address _marsColony) public onlyBasedDeployer {
        marsColony = _marsColony;
    }

    // WARNING: Alpha leak!
    function migrateRoverBalanceToMarsColonyV1_69() external onlyMarsColony updateBalance {
        require(migrationCompleted == false, "Migration completed");

        IERC20 moonbase = IERC20(basedGod.moonbase());
        uint256 marsColonyShare = moonbase.balanceOf(msg.sender);
        uint256 totalSupply = moonbase.totalSupply();
        // withdraw amount is proportional to total supply share of mbBASED of msg.sender
        uint256 amountToMigrate =
            rewardToken.balanceOf(address(this)).mul(marsColonyShare).div(totalSupply);

        rewardToken.transfer(msg.sender, amountToMigrate);
        migrationCompleted = true;

        // update rewards
        totalTokensReceived = totalTokensReceived.sub(amountToMigrate);
    }

    function init() internal updateBalance {
        require(roverStart == 0, "Already initialized");
        roverStart = block.timestamp;
        renounceOwnership();
    }

    function sync() internal {
        uint256 currentBalance = rewardToken.balanceOf(address(this));
        if (currentBalance > latestBalance) {
            uint diff = currentBalance.sub(latestBalance);
            totalTokensReceived = totalTokensReceived.add(diff);
        }
    }
}


pragma solidity >=0.6.0;


contract RoverVault is Rover {
    constructor(address _rewardToken, string memory _pair, address _swapModule)
        public
        Rover(_rewardToken, _pair, _swapModule)
    {}

    function startRover() public onlyOwner {
        init();
    }
}



pragma solidity ^0.6.0;





/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;
    using Address for address;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name, string memory symbol) public {
        _name = name;
        _symbol = symbol;
        _decimals = 18;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20};
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
     *
     * This is internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}



pragma solidity ^0.6.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}


pragma solidity >=0.6.0;

interface IPool {
    function getReward() external;
    function stake(uint256 amount) external;
    function earned(address account) external view returns (uint256);
}


pragma solidity >=0.6.0;





contract FarmingRover is Rover, ERC20, ReentrancyGuard {
    IPool public rewardPool;

    /// @param _pair either "sUSD" or "WETH"
    constructor (
        address _rewardToken,
        string memory _pair,
        address _swapModule
    )
        public
        Rover(_rewardToken, _pair, _swapModule)
        ERC20(
            string(abi.encodePacked("Rover ", ERC20(_rewardToken).name())),
            string(abi.encodePacked("r", ERC20(_rewardToken).symbol()))
        )
    {
        // Mint the single token
        _mint(address(this), 1);
    }

    function earned() public view returns (uint256){
        return rewardPool.earned(address(this));
    }

    function startRover(address _rewardPool)
        public
        onlyOwner
    {
        init();

        this.approve(_rewardPool, 1);
        rewardPool = IPool(_rewardPool);
        rewardPool.stake(1);
    }

    function rugPull() public override nonReentrant {
        claimReward();

        // this couses reentracy
        super.rugPull();
    }

    function claimReward() internal {
        // ignore errors
        (bool success,) = address(rewardPool).call(abi.encodeWithSignature("getReward()"));
    }

    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal override {
        require(balanceOf(address(this)) == 1, "NOT BASED: only one transfer allowed.");
        require(recipient == address(rewardPool),
            "NOT BASED: Recipient address must be equal to rewardPool address.");
        super._transfer(sender, recipient, amount);
    }
}


pragma solidity >=0.6.0;





contract BasedGod {
    address[] public rovers;
    // rewardToken => rover address array
    mapping(address => address[]) public tokenRover;
    address public immutable moonbase;
    address public immutable based;
    address public immutable susd;
    address public immutable weth;
    // mainnet 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
    address public immutable uniswapRouter;
    address public immutable poolFactory;
    address public immutable basedGodV1;
    address public immutable deployer;

    constructor (
        address _based,
        address _moonbase,
        address _susd,
        address _weth,
        address _uniswapRouter,
        address _poolFactory,
        address _basedGodV1
    ) public {
        susd = _susd;
        based = _based;
        moonbase = _moonbase;
        weth = _weth;
        uniswapRouter = _uniswapRouter;
        poolFactory = _poolFactory;
        basedGodV1 = _basedGodV1;
        deployer = msg.sender;
    }

    function getRovers() public view returns (address[] memory) {
        address[] memory legacyRovers = IBasedGod(basedGodV1).getRovers();
        return legacyRovers.length == 0 ? rovers : concatArrays(legacyRovers, rovers);
    }

    function getTokenRovers(address token) public view returns (address[] memory) {
        address[] memory legacyRovers = IBasedGod(basedGodV1).getTokenRovers(token);
        return legacyRovers.length == 0 ? tokenRover[token] : concatArrays(legacyRovers, tokenRover[token]);
    }

    /// @dev Use this Rover if you want to depoit tokens directly to Rover contract and you don't need to farm
    /// @param _rewardToken address of the reward token
    /// @param _pair through which pair do you want to sell reward tokens, either "sUSD" or "WETH"
    /// @param _swapModule contract address with swap implementation
    function createNewRoverVault(address _rewardToken, string calldata _pair, address _swapModule) external returns (RoverVault rover) {
        rover = new RoverVault(_rewardToken, _pair, _swapModule);
        rover.transferOwnership(msg.sender);
        _saveRover(_rewardToken, address(rover));
    }

    /// @dev Use this Rover if you have a reward pool and you want the Rover to farm it
    /// @param _rewardToken address of the reward token
    /// @param _pair either "sUSD" or "WETH"
    /// @param _swapModule contract address with swap implementation
    function createNewFarmingRover(address _rewardToken, string calldata _pair, address _swapModule) external returns (FarmingRover rover) {
        rover = new FarmingRover(_rewardToken, _pair, _swapModule);
        rover.transferOwnership(msg.sender);
        _saveRover(_rewardToken, address(rover));
    }

    /// @dev Use this if you want to deploy Farming Rover and Pool at once
    /// @param _distributor who can notify of rewards
    /// @param _swapModule contract address with swap implementation
    function createNewFarmingRoverAndPool(
        address _rewardToken,
        address _distributor,
        string calldata _pair,
        address _swapModule,
        uint256 _duration
    ) external returns (FarmingRover rover, address rewardsPool) {
        require(_distributor != address(0), "someone has to notify of rewards and it ain't us");

        rover = new FarmingRover(_rewardToken, _pair, _swapModule);
        _saveRover(_rewardToken, address(rover));

        rewardsPool = IPoolFactory(poolFactory).createNewPool(
            _rewardToken,
            address(rover),
            _duration,
            _distributor
        );

        rover.startRover(rewardsPool);
    }

    function _saveRover(address _rewardToken, address _rover) internal {
        rovers.push(address(_rover));
        tokenRover[_rewardToken].push(address(_rover));
    }

    function concatArrays(address[] memory arr1, address[] memory arr2) internal pure returns (address[] memory) {
        address[] memory resultArray = new address[](arr1.length + arr2.length);
        uint i=0;
        for (; i < arr1.length; i++) {
            resultArray[i] = arr1[i];
        }

        uint j=0;
        while (j < arr2.length) {
            resultArray[i++] = arr2[j++];
        }
        return resultArray;
    }
}



pragma solidity ^0.6.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}



pragma solidity >=0.6.6;




contract ERC20Migrator {
    using SafeMath for uint256;

    IERC20 public legacyToken;
    IERC20 public newToken;

    uint256 public totalMigrated;

    constructor (address _legacyToken, address _newToken) public {
        require(_legacyToken != address(0), "legacyToken address is required");
        require(_newToken != address(0), "_newToken address is required");

        legacyToken = IERC20(_legacyToken);
        newToken = IERC20(_newToken);
    }

    function migrate(address account, uint256 amount) internal {
        legacyToken.transferFrom(account, address(this), amount);
        newToken.transfer(account, amount);
        totalMigrated = totalMigrated.add(amount);
    }

    function migrateAll() public {
        address account = msg.sender;
        uint256 balance = legacyToken.balanceOf(account);
        uint256 allowance = legacyToken.allowance(account, address(this));
        uint256 amount = Math.min(balance, allowance);
        require(amount > 0, "ERC20Migrator::migrateAll: Approval and balance must be > 0");
        migrate(account, amount);
    }
}


/*
   ____            __   __        __   _
  / __/__ __ ___  / /_ / /  ___  / /_ (_)__ __
 _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
     /___/

* Synthetix: CurveRewards.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/


pragma solidity ^0.6.0;







abstract contract IRewardDistributionRecipient is Ownable {
    address rewardDistribution;

    constructor(address _rewardDistribution) public {
        rewardDistribution = _rewardDistribution;
    }

    function notifyRewardAmount(uint256 reward) virtual external;

    modifier onlyRewardDistribution() {
        require(_msgSender() == rewardDistribution, "Caller is not reward distribution");
        _;
    }

    function setRewardDistribution(address _rewardDistribution)
        external
        onlyOwner
    {
        rewardDistribution = _rewardDistribution;
    }
}

/*
*   Changes made to the SynthetixReward contract
*
*   uni to lpToken, and make it as a parameter of the constructor instead of hardcoded.
*
*
*/

contract LPTokenWrapper {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    IERC20 public immutable lpToken;

    uint256 private _totalSupply;
    mapping(address => uint256) private _balances;

    constructor(address _lpToken) public {
        lpToken = IERC20(_lpToken);
    }

    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    function stake(uint256 amount) public virtual {
        _totalSupply = _totalSupply.add(amount);
        _balances[msg.sender] = _balances[msg.sender].add(amount);
        lpToken.safeTransferFrom(msg.sender, address(this), amount);
    }

    function withdraw(uint256 amount) public virtual {
        _totalSupply = _totalSupply.sub(amount);
        _balances[msg.sender] = _balances[msg.sender].sub(amount);
        lpToken.safeTransfer(msg.sender, amount);
    }
}

/*
*   [Hardwork]
*   This pool doesn't mint.
*   the rewards should be first transferred to this pool, then get "notified"
*   by calling `notifyRewardAmount`
*/

contract NoMintRewardPool is LPTokenWrapper, IRewardDistributionRecipient {
    IERC20 public immutable rewardToken;
    uint256 public immutable duration; // making it not a constant is less gas efficient, but portable

    uint256 public periodFinish = 0;
    uint256 public rewardRate = 0;
    uint256 public lastUpdateTime;
    uint256 public rewardPerTokenStored;
    mapping(address => uint256) public userRewardPerTokenPaid;
    mapping(address => uint256) public rewards;

    event RewardAdded(uint256 reward);
    event Staked(address indexed user, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);

    modifier updateReward(address account) {
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = lastTimeRewardApplicable();
        if (account != address(0)) {
            rewards[account] = earned(account);
            userRewardPerTokenPaid[account] = rewardPerTokenStored;
        }
        _;
    }

    // [Hardwork] setting the reward, lpToken, duration, and rewardDistribution for each pool
    constructor(address _rewardToken,
        address _lpToken,
        uint256 _duration,
        address _rewardDistribution) public
    LPTokenWrapper(_lpToken)
    IRewardDistributionRecipient(_rewardDistribution)
    {
        rewardToken = IERC20(_rewardToken);
        duration = _duration;
    }

    function lastTimeRewardApplicable() public view returns (uint256) {
        return Math.min(block.timestamp, periodFinish);
    }

    function rewardPerToken() public view returns (uint256) {
        if (totalSupply() == 0) {
            return rewardPerTokenStored;
        }
        return
            rewardPerTokenStored.add(
                lastTimeRewardApplicable()
                    .sub(lastUpdateTime)
                    .mul(rewardRate)
                    .mul(1e18)
                    .div(totalSupply())
            );
    }

    function earned(address account) public view returns (uint256) {
        return
            balanceOf(account)
                .mul(rewardPerToken().sub(userRewardPerTokenPaid[account]))
                .div(1e18)
                .add(rewards[account]);
    }

    // stake visibility is public as overriding LPTokenWrapper's stake() function
    function stake(uint256 amount) public updateReward(msg.sender) override {
        require(amount > 0, "Cannot stake 0");
        super.stake(amount);
        emit Staked(msg.sender, amount);
    }

    function withdraw(uint256 amount) public updateReward(msg.sender) override {
        require(amount > 0, "Cannot withdraw 0");
        super.withdraw(amount);
        emit Withdrawn(msg.sender, amount);
    }

    function exit() external {
        withdraw(balanceOf(msg.sender));
        getReward();
    }

    function getReward() public updateReward(msg.sender) {
        uint256 reward = earned(msg.sender);
        if (reward > 0) {
            rewards[msg.sender] = 0;
            rewardToken.safeTransfer(msg.sender, reward);
            emit RewardPaid(msg.sender, reward);
        }
    }

    function notifyRewardAmount(uint256 reward)
        external
        override
        onlyRewardDistribution
        updateReward(address(0))
    {
        if (block.timestamp >= periodFinish) {
            rewardRate = reward.div(duration);
        } else {
            uint256 remaining = periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(rewardRate);
            rewardRate = reward.add(leftover).div(duration);
        }
        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(duration);
        emit RewardAdded(reward);
    }
}

pragma solidity ^0.6.0;



interface IMoonbaseTheGame {
    function mint(address receiver, uint id, string calldata hash) external;
}

contract MoonbaseNFTAirdrop is Ownable {
    using SafeMath for uint;

    uint immutable public nftTotalQuantity;
    uint constant public maxClaimable = 11;

    IMoonbaseTheGame public moonbaseNFTs;

    mapping(address => uint) public nftPerAddress;

    string[] public nftHashes = [
        "QmQcdWUE5W8nt2xFn8mDvkLXGuU5CXWiptDM9SpVSPYnHX",
        "QmQax93v7EE2im7zgMpHZo74NouV7mBLvuBUMNKBHWJBiQ",
        "QmVKBGC3CqtGPR71aUzHbXRqvjkakVKJnazncvqsMhYcuU",
        "QmekhiMwznE7KQyCbvLiqk2JDKpt9N4frXPSCYyZNoM8Kx",
        "QmP6VAYvrrRMr47rGroDAM2G2WeNYC6HLJVrTgsGQS8kVp",
        "QmVavHhCLnegWQBfFpeyd7ckLswxRDd2EXZD4TDMggPWm6",
        "Qmc7d8mewKNVeig1PrURebWtkY9r1sToXBwhfSZnVw1eWm",
        "QmYMgbnFEpxw7Vy8qMg2ZNNJaJCSQQwnapdTTzerXpR7Pi",
        "QmT66L5CKAqFKYQ1pfLkSX78PCsko2YUdRudFLwUafP7iU",
        "QmP5NEMpets81LFbsWxNfSpUS1AsHvU39KK62vqnsotTpE",
        "QmVvfPRWsJGHhTMGfiELm5Soom31hwprbjW8tHGy22oMDM",
        "QmQKXm5dApWd9zjXWKtjS9NC8H21dzi6BcivRuBf9UxHQp",
        "QmYwCdmvxTyk8KwHJ3idasxiJ5WBUNFFW9QnCwrA2johY4",
        "QmNr9rUpVWXz7gedn7qiAczZtjfDtEWC7nGxdzbwTvj6er",
        "Qmbp9sbxNtevBw5YfyrvwFcYDeMptHsPCF8kC9bG8DrvCD",
        "QmT3mxzduUMje77cY9R9PDmFKiVuXZUdsCcP9dAVRxw1xH",
        "QmVsaqbViMPTDTqo6f3nF8imgnGeohirKQpmxj8hJT7Kk3",
        "QmcqnGtd9Ympe6NCAnWu7KFKhSRJPZ2zdfefYsMgmWSHGn",
        "QmU3mKvzFq8oNTkxebGFSaf8BN2YyFJxAgUnBk4uuwTxaw",
        "QmTskfzmU31XDQfTXad34igq99NqNhntLogjbJQ2U4Po3i",
        "QmYfA3XE7cwqAySXt1thduruA1cC23GcBrVuA3w3cd1shC",
        "QmVm9XKy5v7KSj5Bce4dj15V51sbrXPcxxcxXGP8qEHhRn",
        "QmYf3oQSh93hpyFH9UfsUgASHeJd924pcAoMyC3UHBwfH4",
        "QmReLfWBGxu3xNBNd61nMxJsK7bbBsdxVB6VmLf6F13VQe",
        "QmNZPXjZcGdNEe8jckNCvSsycFsUReFDFg9rqetXAk5mAf",
        "QmcSsjVpSsgFs7wb6SSDiT3oHKkrKeagAFVAugHfq4DEQX",
        "QmX5RvgTFknVfahVSTVT937zwvQh9vQCZHhAKDa87EnaHG",
        "QmUFwYwLk3mk5e2aLK1THaj3AT4CjUCSWRxn8MBqUVqFU7",
        "QmNpZzYy5RiCE6m6tDSYXZAxCbHu6gFEaDRocLiyr3MpQu",
        "QmbRgXX9PKXKGw9WpnqTDzYze3JCb5GXU4YoXJLdy8wogn",
        "QmTTtser1BdJufeQMeT7Gu1yXjNDRMmXArjffyh7TKs5Gk",
        "QmRPcFUriMkTo1djS6TyyMwvZimX2dj1qrLgBc387bQ6eD",
        "QmVNd4tjwqPFGn69gjrHtyA8Pz1BuXnoDMoJA5Uov3c3Kv",
        "QmVUrqFTiQnrRmeAUHqTpXYp9cymT59vyC3zKFh7EQ3dT4",
        "QmbakLza9Y1WgT7HyxrQZkTE1cBcUAPRZvJY7CYXE1CfxY",
        "QmV9nyt4Nis3NkiRTnmmNRQLtg7uewq976uR3FdpsVeGk6",
        "QmeckwtMBbWgXUP4jT6Yqaap7KDG17ed1x6SWJ9bL7n2fH",
        "QmZjbZd9Jny2cHGfxTFZUkai4R7ngTaFdSqKcsZ3FiJUEs",
        "QmVgAwLCrsZtzdjc5H8CVqUEzJty29wZ3LZ6w1ZuMoShru",
        "QmQEiw5GVxYTRQcYiHB3vbCo7GeQgVRGc1Leq3M9XSphXy",
        "QmeTSAx6YTPpXv9ErEcGgCZqLhByQFzroBqTi5kQutwqwv",
        "QmS5H5FBReRhj1BkV9JpT47LhAPtTf5XqYJroFnrgSUaLC"
    ];

    uint[] public nftQuantities = [
        906, 905, 905, 905, 666, 666, 666, 666, 666, 666,
        666, 666, 666, 666, 666, 666, 666, 666, 666, 666,
        666, 420, 420, 420, 420, 420, 69, 69, 69, 69,
        69, 13, 13, 13, 13, 13, 13, 3, 3, 3,
        3, 1
    ];

    uint public nftIdCounter = 0;

    constructor () public {
        uint total = 0;
        for (uint i = 0; i < nftQuantities.length; i++) {
            total += nftQuantities[i];
        }
        nftTotalQuantity = total;
    }

    function init(address _moonbaseNFTs) public onlyOwner {
        require(address(moonbaseNFTs) == address(0), "Already initialized");
        moonbaseNFTs = IMoonbaseTheGame(_moonbaseNFTs);
    }

    function setAddresses(address[] memory _addresses) public onlyOwner {
        for (uint i = 0; i < _addresses.length; i++) {
            nftPerAddress[_addresses[i]] = maxClaimable;
        }
    }

    function claimMoonbaseNFT() public {
        require(nftPerAddress[msg.sender] > 0, "You got all your NFTs already");

        string memory ipfsHash = getRandomNFT(msg.sender);
        moonbaseNFTs.mint(msg.sender, nftIdCounter, ipfsHash);
        nftIdCounter += 1;
        nftPerAddress[msg.sender] = nftPerAddress[msg.sender].sub(1);
    }

    function getRandomNFT(address entropy) internal returns (string memory) {
        uint mod = 0;
        for (uint i = 0; i < nftQuantities.length; i++) {
            mod = mod.add(nftQuantities[i]);
        }
        int remainder = int((uint(entropy) + uint(blockhash(block.number))) % mod);

	    uint index = 0;
        remainder -= int(nftQuantities[index]);
        while(remainder > 0) {
            index += 1;
            remainder -= int(nftQuantities[index]);
        }

        while(nftQuantities[index] == 0) {
            index += 1;
            if (index >= nftTotalQuantity) {
                index = 0;
            }
        }

        nftQuantities[index] -= 1;
        return nftHashes[index];
    }
}



pragma solidity ^0.6.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);
}



pragma solidity ^0.6.2;


/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transfered from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}



pragma solidity ^0.6.2;


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



pragma solidity ^0.6.2;


/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}



pragma solidity ^0.6.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
    external returns (bytes4);
}



pragma solidity ^0.6.0;


/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}



pragma solidity ^0.6.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
 * (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint256(_at(set._inner, index)));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}



pragma solidity ^0.6.0;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }

    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;

        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function _remove(Map storage map, bytes32 key) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;

            // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            MapEntry storage lastEntry = map._entries[lastIndex];

            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved entry was stored
            map._entries.pop();

            // Delete the index for the deleted slot
            delete map._indexes[key];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function _contains(Map storage map, bytes32 key) private view returns (bool) {
        return map._indexes[key] != 0;
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }

   /**
    * @dev Returns the key-value pair stored at position `index` in the map. O(1).
    *
    * Note that there are no guarantees on the ordering of entries inside the
    * array, and it may change when more entries are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
        require(map._entries.length > index, "EnumerableMap: index out of bounds");

        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        return _get(map, key, "EnumerableMap: nonexistent key");
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(value)));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
        return _remove(map._inner, bytes32(key));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
        return _contains(map._inner, bytes32(key));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return _length(map._inner);
    }

   /**
    * @dev Returns the element stored at position `index` in the set. O(1).
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint256(value)));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint256(_get(map._inner, bytes32(key))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint256(_get(map._inner, bytes32(key), errorMessage)));
    }
}



pragma solidity ^0.6.0;

/**
 * @dev String operations.
 */
library Strings {
    /**
     * @dev Converts a `uint256` to its ASCII `string` 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);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = byte(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}



pragma solidity ^0.6.0;












/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;
    using Strings for uint256;

    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    // Mapping from holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSet.UintSet) private _holderTokens;

    // Enumerable mapping from token ids to their owners
    EnumerableMap.UintToAddressMap private _tokenOwners;

    // Mapping from token ID to approved address
    mapping (uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping (address => mapping (address => bool)) private _operatorApprovals;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

    // Base URI
    string private _baseURI;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor (string memory name, string memory symbol) public {
        _name = name;
        _symbol = symbol;

        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");

        return _holderTokens[owner].length();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];

        // If there is no base URI, return the token URI.
        if (bytes(_baseURI).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(_baseURI, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(_baseURI, tokenId.toString()));
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
        return _holderTokens[owner].at(index);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mecanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return _tokenOwners.contains(tokenId);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        // Clear metadata (if any)
        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }

        _holderTokens[owner].remove(tokenId);

        _tokenOwners.remove(tokenId);

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function _setBaseURI(string memory baseURI_) internal virtual {
        _baseURI = baseURI_;
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

    function _approve(address to, uint256 tokenId) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}


pragma solidity >=0.6.0;



contract MoonbaseTheGameNFT is ERC721, Ownable {
    constructor (address moonbaseAirdrop) public ERC721("Moonbase: The Game", "MOONGAME") {
        transferOwnership(moonbaseAirdrop);
        _setBaseURI("ipfs://ipfs/");
    }

    function mint(address to, uint256 tokenId, string memory _tokenURI) public onlyOwner {
        _mint(to, tokenId);
        _setTokenURI(tokenId, _tokenURI);
    }
}


pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}


pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}


pragma solidity >=0.4.0;

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
library FixedPoint {
    // range: [0, 2**112 - 1]
    // resolution: 1 / 2**112
    struct uq112x112 {
        uint224 _x;
    }

    // range: [0, 2**144 - 1]
    // resolution: 1 / 2**112
    struct uq144x112 {
        uint _x;
    }

    uint8 private constant RESOLUTION = 112;

    // encode a uint112 as a UQ112x112
    function encode(uint112 x) internal pure returns (uq112x112 memory) {
        return uq112x112(uint224(x) << RESOLUTION);
    }

    // encodes a uint144 as a UQ144x112
    function encode144(uint144 x) internal pure returns (uq144x112 memory) {
        return uq144x112(uint256(x) << RESOLUTION);
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) {
        require(x != 0, 'FixedPoint: DIV_BY_ZERO');
        return uq112x112(self._x / uint224(x));
    }

    // multiply a UQ112x112 by a uint, returning a UQ144x112
    // reverts on overflow
    function mul(uq112x112 memory self, uint y) internal pure returns (uq144x112 memory) {
        uint z;
        require(y == 0 || (z = uint(self._x) * y) / y == uint(self._x), "FixedPoint: MULTIPLICATION_OVERFLOW");
        return uq144x112(z);
    }

    // returns a UQ112x112 which represents the ratio of the numerator to the denominator
    // equivalent to encode(numerator).div(denominator)
    function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {
        require(denominator > 0, "FixedPoint: DIV_BY_ZERO");
        return uq112x112((uint224(numerator) << RESOLUTION) / denominator);
    }

    // decode a UQ112x112 into a uint112 by truncating after the radix point
    function decode(uq112x112 memory self) internal pure returns (uint112) {
        return uint112(self._x >> RESOLUTION);
    }

    // decode a UQ144x112 into a uint144 by truncating after the radix point
    function decode144(uq144x112 memory self) internal pure returns (uint144) {
        return uint144(self._x >> RESOLUTION);
    }
}


pragma solidity >=0.5.0;



// library with helper methods for oracles that are concerned with computing average prices
library UniswapV2OracleLibrary {
    using FixedPoint for *;

    // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]
    function currentBlockTimestamp() internal view returns (uint32) {
        return uint32(block.timestamp % 2 ** 32);
    }

    // produces the cumulative price using counterfactuals to save gas and avoid a call to sync.
    function currentCumulativePrices(
        address pair
    ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) {
        blockTimestamp = currentBlockTimestamp();
        price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();
        price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();

        // if time has elapsed since the last update on the pair, mock the accumulated price values
        (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves();
        if (blockTimestampLast != blockTimestamp) {
            // subtraction overflow is desired
            uint32 timeElapsed = blockTimestamp - blockTimestampLast;
            // addition overflow is desired
            // counterfactual
            price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;
            // counterfactual
            price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;
        }
    }
}



pragma solidity >=0.5.0;



library UniswapV2Library {
    using SafeMath for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        amountB = amountA.mul(reserveB) / reserveA;
    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn.mul(997);
        uint numerator = amountInWithFee.mul(reserveOut);
        uint denominator = reserveIn.mul(1000).add(amountInWithFee);
        amountOut = numerator / denominator;
    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
        require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint numerator = reserveIn.mul(amountOut).mul(1000);
        uint denominator = reserveOut.sub(amountOut).mul(997);
        amountIn = (numerator / denominator).add(1);
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
        }
    }

    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
        }
    }
}



pragma solidity >=0.6.6;

// Some code reproduced from
// https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2Pair.sol






interface IOracle {
    function getData() external returns (uint256, bool);
}

// fixed window oracle that recomputes the average price for the entire period once every period
// note that the price average is only guaranteed to be over at least 1 period, but may be over a longer period
contract ExampleOracleSimple {
    using FixedPoint for *;

    uint public PERIOD = 24 hours;

    IUniswapV2Pair immutable pair;
    address public immutable token0;
    address public immutable token1;

    uint    public price0CumulativeLast;
    uint    public price1CumulativeLast;
    uint32  public blockTimestampLast;
    FixedPoint.uq112x112 public price0Average;
    FixedPoint.uq112x112 public price1Average;

    constructor(address factory, address tokenA, address tokenB) public {
        IUniswapV2Pair _pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, tokenA, tokenB));
        pair = _pair;
        token0 = _pair.token0();
        token1 = _pair.token1();
        price0CumulativeLast = _pair.price0CumulativeLast(); // fetch the current accumulated price value (1 / 0)
        price1CumulativeLast = _pair.price1CumulativeLast(); // fetch the current accumulated price value (0 / 1)
        uint112 reserve0;
        uint112 reserve1;
        (reserve0, reserve1, blockTimestampLast) = _pair.getReserves();
        // ensure that there's liquidity in the pair
        require(reserve0 != 0 && reserve1 != 0, 'ExampleOracleSimple: NO_RESERVES');
    }

    function update() internal {
        (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) =
            UniswapV2OracleLibrary.currentCumulativePrices(address(pair));
        uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired

        // ensure that at least one full period has passed since the last update
        require(timeElapsed >= PERIOD, 'ExampleOracleSimple: PERIOD_NOT_ELAPSED');

        // overflow is desired, casting never truncates
        // cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed
        price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLast) / timeElapsed));
        price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1CumulativeLast) / timeElapsed));

        price0CumulativeLast = price0Cumulative;
        price1CumulativeLast = price1Cumulative;
        blockTimestampLast = blockTimestamp;
    }

    // note this will always return 0 before update has been called successfully for the first time.
    function consult(address token, uint amountIn) internal view returns (uint amountOut) {
        if (token == token0) {
            amountOut = price0Average.mul(amountIn).decode144();
        } else {
            require(token == token1, 'ExampleOracleSimple: INVALID_TOKEN');
            amountOut = price1Average.mul(amountIn).decode144();
        }
    }
}

interface UFragmentsI {
    function monetaryPolicy() external view returns (address);
}


contract BASEDOracle is Ownable, ExampleOracleSimple, IOracle {

    uint256 constant SCALE = 10 ** 18;
    address based;
    address constant uniFactory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;

    constructor(address based_, address susd_) public ExampleOracleSimple(uniFactory, based_, susd_) {
        PERIOD = 23 hours; // ensure that rebase can always call update
        based = based_;
    }

    // this must be called 24h before first rebase to get proper price
    function updateBeforeRebase() public onlyOwner {
        update();
    }

    function getData() override external returns (uint256, bool) {
        require(msg.sender == UFragmentsI(based).monetaryPolicy());
        update();
        uint256 price = consult(based, SCALE); // will return 1 BASED in sUSD

        if (price == 0) {
            return (0, false);
        }

        return (price, true);
    }
}


pragma solidity >=0.6.0;


contract PoolFactory {
    function createNewPool(
        address _rewardToken,
        address _rover,
        uint256 _duration,
        address _distributor
    ) external returns (address) {
        _distributor = (_distributor != address(0)) ? _distributor : msg.sender;

        NoMintRewardPool rewardsPool = new NoMintRewardPool(
            _rewardToken,
            _rover,
            _duration,
            _distributor  // who can notify of rewards
        );

        return address(rewardsPool);
    }
}


pragma solidity >=0.6.2;

interface ISakeSwapRouter {
    function factory() external pure returns (address);

    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        );

    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        );

    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        returns (
            uint256 amountA,
            uint256 amountB
        );

    function removeLiquidityETH(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        returns (
            uint256 amountToken,
            uint256 amountETH
        );

    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    )
        external
        returns (
            uint256 amountA,
            uint256 amountB
        );

    function removeLiquidityETHWithPermit(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    )
        external
        returns (
            uint256 amountToken,
            uint256 amountETH
        );

    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external returns (uint256[] memory amounts);

    function swapTokensForExactTokens(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external returns (uint256[] memory amounts);

    function swapExactETHForTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external payable returns (uint256[] memory amounts);

    function swapTokensForExactETH(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external returns (uint256[] memory amounts);

    function swapExactTokensForETH(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external returns (uint256[] memory amounts);

    function swapETHForExactTokens(
        uint256 amountOut,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external payable returns (uint256[] memory amounts);

    function quote(
        uint256 amountA,
        uint256 reserveA,
        uint256 reserveB
    ) external pure returns (uint256 amountB);

    function getAmountOut(
        uint256 amountIn,
        uint256 reserveIn,
        uint256 reserveOut
    ) external pure returns (uint256 amountOut);

    function getAmountIn(
        uint256 amountOut,
        uint256 reserveIn,
        uint256 reserveOut
    ) external pure returns (uint256 amountIn);

    function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);

    function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);

    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountETH);

    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external payable;

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline,
        bool ifmint
    ) external;
}


pragma solidity >=0.6.0;





contract SakeSwapModule {
    using SafeERC20 for IERC20;

    address public immutable sakeSwapRouter;
    address public immutable uniswapRouter;

    constructor (address _uniswapRouter, address _sakeSwapRouter) public {
        uniswapRouter = _uniswapRouter;
        sakeSwapRouter = _sakeSwapRouter;
    }

    function getPaths(address[] memory path) public pure returns (address[] memory, address[] memory) {
        address[] memory sakePath = new address[](2);
        address[] memory uniswapPath = new address[](2);
        sakePath[0] = path[0];
        sakePath[1] = path[1];
        uniswapPath[0] = path[1];
        uniswapPath[1] = path[2];
        return (sakePath, uniswapPath);
    }

    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint256[] memory) {
        (address[] memory sakePath, address[] memory uniswapPath) = getPaths(path);
        uint256[] memory amounts = new uint256[](2);
        uint256[] memory sakeAmounts = ISakeSwapRouter(sakeSwapRouter).getAmountsOut(amountIn, sakePath);
        amounts[0] = sakeAmounts[sakeAmounts.length - 1];
        uint256[] memory uniswapAmounts = IUniswapV2Router02(uniswapRouter).getAmountsOut(amounts[0], uniswapPath);
        amounts[1] = uniswapAmounts[uniswapAmounts.length - 1];
        return amounts;
    }

    function swapReward(uint256 amountIn, address receiver, address[] memory path) public returns (uint256){
        (address[] memory sakePath, address[] memory uniswapPath) = getPaths(path);

        IERC20(path[0]).safeApprove(sakeSwapRouter, 0);
        IERC20(path[0]).safeApprove(sakeSwapRouter, amountIn);
        uint256 amountOutMin = 1;
        uint256[] memory amounts =
            ISakeSwapRouter(sakeSwapRouter).swapExactTokensForTokens(
                amountIn,
                amountOutMin,
                sakePath,
                receiver,
                block.timestamp,
                false
            );
        amountIn = amounts[amounts.length - 1];

        IERC20(path[1]).safeApprove(uniswapRouter, 0);
        IERC20(path[1]).safeApprove(uniswapRouter, amountIn);
        amounts =
            IUniswapV2Router02(uniswapRouter).swapExactTokensForTokens(
                amountIn,
                amountOutMin,
                uniswapPath,
                receiver,
                block.timestamp
            );
        return amounts[amounts.length - 1];
    }
}


pragma solidity >=0.6.0;




contract UniswapModule {
    using SafeERC20 for IERC20;

    address public immutable uniswapRouter;

    constructor (address _uniswapRouter) public {
        uniswapRouter = _uniswapRouter;
    }
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory) {
        return IUniswapV2Router02(uniswapRouter).getAmountsOut(amountIn, path);
    }

    function swapReward(uint256 amountIn, address receiver, address[] memory path) public returns (uint256){
        // ensure we have no over-approval
        IERC20(path[0]).safeApprove(uniswapRouter, 0);
        IERC20(path[0]).safeApprove(uniswapRouter, amountIn);
        uint256 amountOutMin = 1;
        uint256[] memory amounts =
            IUniswapV2Router02(uniswapRouter).swapExactTokensForTokens(
                amountIn,
                amountOutMin,
                path,
                receiver,
                block.timestamp
            );
        return amounts[amounts.length - 1];
    }
}


pragma solidity >=0.6.0;

interface IMoonBase {
    function notifyRewardAmount(uint256 reward) external;
}


pragma solidity >=0.6.0;

interface IRover {
    function transferOwnership(address newOwner) external;
}


pragma solidity >=0.6.0;

interface IScheduleProvider {
    function getSchedule() external view returns (uint256);
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"moonbaseAirdrop","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200246c3803806200246c833981810160405260208110156200003757600080fd5b505160408051808201825260128152714d6f6f6e626173653a205468652047616d6560701b602082810191909152825180840190935260088352674d4f4f4e47414d4560c01b90830152906200009d6301ffc9a760e01b6001600160e01b03620001c116565b8151620000b29060069060208501906200036c565b508051620000c89060079060208401906200036c565b50620000e46380ac58cd60e01b6001600160e01b03620001c116565b620000ff635b5e139f60e01b6001600160e01b03620001c116565b6200011a63780e9d6360e01b6001600160e01b03620001c116565b5060009050620001326001600160e01b036200024616565b600a80546001600160a01b0319166001600160a01b038316908117909155604051919250906000906000805160206200244c833981519152908290a35062000183816001600160e01b036200024b16565b60408051808201909152600c81526b697066733a2f2f697066732f60a01b6020820152620001ba906001600160e01b036200035316565b506200040e565b6001600160e01b0319808216141562000221576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b335b90565b6200025e6001600160e01b036200024616565b600a546001600160a01b03908116911614620002c1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116620003085760405162461bcd60e51b8152600401808060200182810382526026815260200180620024266026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216906000805160206200244c83398151915290600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b8051620003689060099060208401906200036c565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003af57805160ff1916838001178555620003df565b82800160010185558215620003df579182015b82811115620003df578251825591602001919060010190620003c2565b50620003ed929150620003f1565b5090565b6200024891905b80821115620003ed5760008155600101620003f8565b612008806200041e6000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c80636c0360eb116100b8578063a22cb4651161007c578063a22cb4651461038d578063b88d4fde146103bb578063c87b56dd14610481578063d3fc98641461049e578063e985e9c514610559578063f2fde38b1461058757610137565b80636c0360eb1461034757806370a082311461034f578063715018a6146103755780638da5cb5b1461037d57806395d89b411461038557610137565b806323b872dd116100ff57806323b872dd146102755780632f745c59146102ab57806342842e0e146102d75780634f6ccce71461030d5780636352211e1461032a57610137565b806301ffc9a71461013c57806306fdde0314610177578063081812fc146101f4578063095ea7b31461022d57806318160ddd1461025b575b600080fd5b6101636004803603602081101561015257600080fd5b50356001600160e01b0319166105ad565b604080519115158252519081900360200190f35b61017f6105d0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101b95781810151838201526020016101a1565b50505050905090810190601f1680156101e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102116004803603602081101561020a57600080fd5b5035610667565b604080516001600160a01b039092168252519081900360200190f35b6102596004803603604081101561024357600080fd5b506001600160a01b0381351690602001356106c9565b005b6102636107a4565b60408051918252519081900360200190f35b6102596004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356107b5565b610263600480360360408110156102c157600080fd5b506001600160a01b03813516906020013561080c565b610259600480360360608110156102ed57600080fd5b506001600160a01b0381358116916020810135909116906040013561083d565b6102636004803603602081101561032357600080fd5b5035610858565b6102116004803603602081101561034057600080fd5b5035610874565b61017f6108a2565b6102636004803603602081101561036557600080fd5b50356001600160a01b0316610903565b61025961096b565b610211610a1f565b61017f610a2e565b610259600480360360408110156103a357600080fd5b506001600160a01b0381351690602001351515610a8f565b610259600480360360808110156103d157600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561040c57600080fd5b82018360208201111561041e57600080fd5b8035906020019184600183028401116401000000008311171561044057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610b94945050505050565b61017f6004803603602081101561049757600080fd5b5035610bf2565b610259600480360360608110156104b457600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156104e457600080fd5b8201836020820111156104f657600080fd5b8035906020019184600183028401116401000000008311171561051857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610e99945050505050565b6101636004803603604081101561056f57600080fd5b506001600160a01b0381358116916020013516610f17565b6102596004803603602081101561059d57600080fd5b50356001600160a01b0316610f45565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561065c5780601f106106315761010080835404028352916020019161065c565b820191906000526020600020905b81548152906001019060200180831161063f57829003601f168201915b505050505090505b90565b600061067282611050565b6106ad5760405162461bcd60e51b815260040180806020018281038252602c815260200180611ed1602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106d482610874565b9050806001600160a01b0316836001600160a01b031614156107275760405162461bcd60e51b8152600401808060200182810382526021815260200180611f816021913960400191505060405180910390fd5b806001600160a01b0316610739611063565b6001600160a01b0316148061075a575061075a81610755611063565b610f17565b6107955760405162461bcd60e51b8152600401808060200182810382526038815260200180611e246038913960400191505060405180910390fd5b61079f8383611067565b505050565b60006107b060026110d5565b905090565b6107c66107c0611063565b826110e0565b6108015760405162461bcd60e51b8152600401808060200182810382526031815260200180611fa26031913960400191505060405180910390fd5b61079f838383611184565b6001600160a01b0382166000908152600160205260408120610834908363ffffffff6112e216565b90505b92915050565b61079f83838360405180602001604052806000815250610b94565b60008061086c60028463ffffffff6112ee16565b509392505050565b600061083782604051806060016040528060298152602001611e86602991396002919063ffffffff61130a16565b60098054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561065c5780601f106106315761010080835404028352916020019161065c565b60006001600160a01b03821661094a5760405162461bcd60e51b815260040180806020018281038252602a815260200180611e5c602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610837906110d5565b610973611063565b600a546001600160a01b039081169116146109d5576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600a546001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561065c5780601f106106315761010080835404028352916020019161065c565b610a97611063565b6001600160a01b0316826001600160a01b03161415610afd576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000610b0a611063565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610b4e611063565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b610ba5610b9f611063565b836110e0565b610be05760405162461bcd60e51b8152600401808060200182810382526031815260200180611fa26031913960400191505060405180910390fd5b610bec84848484611321565b50505050565b6060610bfd82611050565b610c385760405162461bcd60e51b815260040180806020018281038252602f815260200180611f52602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ccd5780601f10610ca257610100808354040283529160200191610ccd565b820191906000526020600020905b815481529060010190602001808311610cb057829003601f168201915b505060095493945050505060026000196101006001841615020190911604610cf65790506105cb565b805115610dc7576009816040516020018083805460018160011615610100020316600290048015610d5e5780601f10610d3c576101008083540402835291820191610d5e565b820191906000526020600020905b815481529060010190602001808311610d4a575b5050825160208401908083835b60208310610d8a5780518252601f199092019160209182019101610d6b565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506105cb565b6009610dd284611373565b6040516020018083805460018160011615610100020316600290048015610e305780601f10610e0e576101008083540402835291820191610e30565b820191906000526020600020905b815481529060010190602001808311610e1c575b5050825160208401908083835b60208310610e5c5780518252601f199092019160209182019101610e3d565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b610ea1611063565b600a546001600160a01b03908116911614610f03576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610f0d838361144e565b61079f8282611588565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b610f4d611063565b600a546001600160a01b03908116911614610faf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610ff45760405162461bcd60e51b8152600401808060200182810382526026815260200180611dae6026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b600061083760028363ffffffff6115eb16565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061109c82610874565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610837826115f7565b60006110eb82611050565b6111265760405162461bcd60e51b815260040180806020018281038252602c815260200180611df8602c913960400191505060405180910390fd5b600061113183610874565b9050806001600160a01b0316846001600160a01b0316148061116c5750836001600160a01b031661116184610667565b6001600160a01b0316145b8061117c575061117c8185610f17565b949350505050565b826001600160a01b031661119782610874565b6001600160a01b0316146111dc5760405162461bcd60e51b8152600401808060200182810382526029815260200180611f296029913960400191505060405180910390fd5b6001600160a01b0382166112215760405162461bcd60e51b8152600401808060200182810382526024815260200180611dd46024913960400191505060405180910390fd5b61122c83838361079f565b611237600082611067565b6001600160a01b038316600090815260016020526040902061125f908263ffffffff6115fb16565b506001600160a01b0382166000908152600160205260409020611288908263ffffffff61160716565b5061129b6002828463ffffffff61161316565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006108348383611629565b60008080806112fd868661168d565b9097909650945050505050565b6000611317848484611708565b90505b9392505050565b61132c848484611184565b611338848484846117d2565b610bec5760405162461bcd60e51b8152600401808060200182810382526032815260200180611d7c6032913960400191505060405180910390fd5b60608161139857506040805180820190915260018152600360fc1b60208201526105cb565b8160005b81156113b057600101600a8204915061139c565b60608167ffffffffffffffff811180156113c957600080fd5b506040519080825280601f01601f1916602001820160405280156113f4576020820181803683370190505b50859350905060001982015b831561144557600a840660300160f81b8282806001900393508151811061142357fe5b60200101906001600160f81b031916908160001a905350600a84049350611400565b50949350505050565b6001600160a01b0382166114a9576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6114b281611050565b15611504576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6115106000838361079f565b6001600160a01b0382166000908152600160205260409020611538908263ffffffff61160716565b5061154b6002828463ffffffff61161316565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b61159182611050565b6115cc5760405162461bcd60e51b815260040180806020018281038252602c815260200180611efd602c913960400191505060405180910390fd5b6000828152600860209081526040909120825161079f92840190611cc1565b60006108348383611952565b5490565b6000610834838361196a565b60006108348383611a30565b600061131784846001600160a01b038516611a7a565b8154600090821061166b5760405162461bcd60e51b8152600401808060200182810382526022815260200180611d5a6022913960400191505060405180910390fd5b82600001828154811061167a57fe5b9060005260206000200154905092915050565b8154600090819083106116d15760405162461bcd60e51b8152600401808060200182810382526022815260200180611eaf6022913960400191505060405180910390fd5b60008460000184815481106116e257fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816117a35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611768578181015183820152602001611750565b50505050905090810190601f1680156117955780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b508460000160018203815481106117b657fe5b9060005260206000209060020201600101549150509392505050565b60006117e6846001600160a01b0316611b11565b6117f25750600161117c565b6060611918630a85bd0160e11b611807611063565b88878760405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611880578181015183820152602001611868565b50505050905090810190601f1680156118ad5780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001611d7c603291396001600160a01b038816919063ffffffff611b4a16565b9050600081806020019051602081101561193157600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015611a26578354600019808301919081019060009087908390811061199d57fe5b90600052602060002001549050808760000184815481106119ba57fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806119ea57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610837565b6000915050610837565b6000611a3c8383611952565b611a7257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610837565b506000610837565b600082815260018401602052604081205480611adf57505060408051808201825283815260208082018481528654600181810189556000898152848120955160029093029095019182559151908201558654868452818801909252929091205561131a565b82856000016001830381548110611af257fe5b906000526020600020906002020160010181905550600091505061131a565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061117c575050151592915050565b606061131784846000856060611b5f85611b11565b611bb0576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310611bef5780518252601f199092019160209182019101611bd0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611c51576040519150601f19603f3d011682016040523d82523d6000602084013e611c56565b606091505b50915091508115611c6a57915061117c9050565b805115611c7a5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315611768578181015183820152602001611750565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611d0257805160ff1916838001178555611d2f565b82800160010185558215611d2f579182015b82811115611d2f578251825591602001919060010190611d14565b50611d3b929150611d3f565b5090565b61066491905b80821115611d3b5760008155600101611d4556fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a26469706673582212204768bb17ca5f49ae7826a457268950e10ccc6679a0e1b07730a7f936a49b15b764736f6c634300060600334f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0000000000000000000000000514aade50d0a679afd172720a7b6fbaccccb64ee

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101375760003560e01c80636c0360eb116100b8578063a22cb4651161007c578063a22cb4651461038d578063b88d4fde146103bb578063c87b56dd14610481578063d3fc98641461049e578063e985e9c514610559578063f2fde38b1461058757610137565b80636c0360eb1461034757806370a082311461034f578063715018a6146103755780638da5cb5b1461037d57806395d89b411461038557610137565b806323b872dd116100ff57806323b872dd146102755780632f745c59146102ab57806342842e0e146102d75780634f6ccce71461030d5780636352211e1461032a57610137565b806301ffc9a71461013c57806306fdde0314610177578063081812fc146101f4578063095ea7b31461022d57806318160ddd1461025b575b600080fd5b6101636004803603602081101561015257600080fd5b50356001600160e01b0319166105ad565b604080519115158252519081900360200190f35b61017f6105d0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101b95781810151838201526020016101a1565b50505050905090810190601f1680156101e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102116004803603602081101561020a57600080fd5b5035610667565b604080516001600160a01b039092168252519081900360200190f35b6102596004803603604081101561024357600080fd5b506001600160a01b0381351690602001356106c9565b005b6102636107a4565b60408051918252519081900360200190f35b6102596004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356107b5565b610263600480360360408110156102c157600080fd5b506001600160a01b03813516906020013561080c565b610259600480360360608110156102ed57600080fd5b506001600160a01b0381358116916020810135909116906040013561083d565b6102636004803603602081101561032357600080fd5b5035610858565b6102116004803603602081101561034057600080fd5b5035610874565b61017f6108a2565b6102636004803603602081101561036557600080fd5b50356001600160a01b0316610903565b61025961096b565b610211610a1f565b61017f610a2e565b610259600480360360408110156103a357600080fd5b506001600160a01b0381351690602001351515610a8f565b610259600480360360808110156103d157600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561040c57600080fd5b82018360208201111561041e57600080fd5b8035906020019184600183028401116401000000008311171561044057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610b94945050505050565b61017f6004803603602081101561049757600080fd5b5035610bf2565b610259600480360360608110156104b457600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156104e457600080fd5b8201836020820111156104f657600080fd5b8035906020019184600183028401116401000000008311171561051857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610e99945050505050565b6101636004803603604081101561056f57600080fd5b506001600160a01b0381358116916020013516610f17565b6102596004803603602081101561059d57600080fd5b50356001600160a01b0316610f45565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561065c5780601f106106315761010080835404028352916020019161065c565b820191906000526020600020905b81548152906001019060200180831161063f57829003601f168201915b505050505090505b90565b600061067282611050565b6106ad5760405162461bcd60e51b815260040180806020018281038252602c815260200180611ed1602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106d482610874565b9050806001600160a01b0316836001600160a01b031614156107275760405162461bcd60e51b8152600401808060200182810382526021815260200180611f816021913960400191505060405180910390fd5b806001600160a01b0316610739611063565b6001600160a01b0316148061075a575061075a81610755611063565b610f17565b6107955760405162461bcd60e51b8152600401808060200182810382526038815260200180611e246038913960400191505060405180910390fd5b61079f8383611067565b505050565b60006107b060026110d5565b905090565b6107c66107c0611063565b826110e0565b6108015760405162461bcd60e51b8152600401808060200182810382526031815260200180611fa26031913960400191505060405180910390fd5b61079f838383611184565b6001600160a01b0382166000908152600160205260408120610834908363ffffffff6112e216565b90505b92915050565b61079f83838360405180602001604052806000815250610b94565b60008061086c60028463ffffffff6112ee16565b509392505050565b600061083782604051806060016040528060298152602001611e86602991396002919063ffffffff61130a16565b60098054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561065c5780601f106106315761010080835404028352916020019161065c565b60006001600160a01b03821661094a5760405162461bcd60e51b815260040180806020018281038252602a815260200180611e5c602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610837906110d5565b610973611063565b600a546001600160a01b039081169116146109d5576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600a546001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561065c5780601f106106315761010080835404028352916020019161065c565b610a97611063565b6001600160a01b0316826001600160a01b03161415610afd576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000610b0a611063565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610b4e611063565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b610ba5610b9f611063565b836110e0565b610be05760405162461bcd60e51b8152600401808060200182810382526031815260200180611fa26031913960400191505060405180910390fd5b610bec84848484611321565b50505050565b6060610bfd82611050565b610c385760405162461bcd60e51b815260040180806020018281038252602f815260200180611f52602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015610ccd5780601f10610ca257610100808354040283529160200191610ccd565b820191906000526020600020905b815481529060010190602001808311610cb057829003601f168201915b505060095493945050505060026000196101006001841615020190911604610cf65790506105cb565b805115610dc7576009816040516020018083805460018160011615610100020316600290048015610d5e5780601f10610d3c576101008083540402835291820191610d5e565b820191906000526020600020905b815481529060010190602001808311610d4a575b5050825160208401908083835b60208310610d8a5780518252601f199092019160209182019101610d6b565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506105cb565b6009610dd284611373565b6040516020018083805460018160011615610100020316600290048015610e305780601f10610e0e576101008083540402835291820191610e30565b820191906000526020600020905b815481529060010190602001808311610e1c575b5050825160208401908083835b60208310610e5c5780518252601f199092019160209182019101610e3d565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b610ea1611063565b600a546001600160a01b03908116911614610f03576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610f0d838361144e565b61079f8282611588565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b610f4d611063565b600a546001600160a01b03908116911614610faf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610ff45760405162461bcd60e51b8152600401808060200182810382526026815260200180611dae6026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b600061083760028363ffffffff6115eb16565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061109c82610874565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610837826115f7565b60006110eb82611050565b6111265760405162461bcd60e51b815260040180806020018281038252602c815260200180611df8602c913960400191505060405180910390fd5b600061113183610874565b9050806001600160a01b0316846001600160a01b0316148061116c5750836001600160a01b031661116184610667565b6001600160a01b0316145b8061117c575061117c8185610f17565b949350505050565b826001600160a01b031661119782610874565b6001600160a01b0316146111dc5760405162461bcd60e51b8152600401808060200182810382526029815260200180611f296029913960400191505060405180910390fd5b6001600160a01b0382166112215760405162461bcd60e51b8152600401808060200182810382526024815260200180611dd46024913960400191505060405180910390fd5b61122c83838361079f565b611237600082611067565b6001600160a01b038316600090815260016020526040902061125f908263ffffffff6115fb16565b506001600160a01b0382166000908152600160205260409020611288908263ffffffff61160716565b5061129b6002828463ffffffff61161316565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006108348383611629565b60008080806112fd868661168d565b9097909650945050505050565b6000611317848484611708565b90505b9392505050565b61132c848484611184565b611338848484846117d2565b610bec5760405162461bcd60e51b8152600401808060200182810382526032815260200180611d7c6032913960400191505060405180910390fd5b60608161139857506040805180820190915260018152600360fc1b60208201526105cb565b8160005b81156113b057600101600a8204915061139c565b60608167ffffffffffffffff811180156113c957600080fd5b506040519080825280601f01601f1916602001820160405280156113f4576020820181803683370190505b50859350905060001982015b831561144557600a840660300160f81b8282806001900393508151811061142357fe5b60200101906001600160f81b031916908160001a905350600a84049350611400565b50949350505050565b6001600160a01b0382166114a9576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6114b281611050565b15611504576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6115106000838361079f565b6001600160a01b0382166000908152600160205260409020611538908263ffffffff61160716565b5061154b6002828463ffffffff61161316565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b61159182611050565b6115cc5760405162461bcd60e51b815260040180806020018281038252602c815260200180611efd602c913960400191505060405180910390fd5b6000828152600860209081526040909120825161079f92840190611cc1565b60006108348383611952565b5490565b6000610834838361196a565b60006108348383611a30565b600061131784846001600160a01b038516611a7a565b8154600090821061166b5760405162461bcd60e51b8152600401808060200182810382526022815260200180611d5a6022913960400191505060405180910390fd5b82600001828154811061167a57fe5b9060005260206000200154905092915050565b8154600090819083106116d15760405162461bcd60e51b8152600401808060200182810382526022815260200180611eaf6022913960400191505060405180910390fd5b60008460000184815481106116e257fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816117a35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611768578181015183820152602001611750565b50505050905090810190601f1680156117955780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b508460000160018203815481106117b657fe5b9060005260206000209060020201600101549150509392505050565b60006117e6846001600160a01b0316611b11565b6117f25750600161117c565b6060611918630a85bd0160e11b611807611063565b88878760405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611880578181015183820152602001611868565b50505050905090810190601f1680156118ad5780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001611d7c603291396001600160a01b038816919063ffffffff611b4a16565b9050600081806020019051602081101561193157600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015611a26578354600019808301919081019060009087908390811061199d57fe5b90600052602060002001549050808760000184815481106119ba57fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806119ea57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610837565b6000915050610837565b6000611a3c8383611952565b611a7257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610837565b506000610837565b600082815260018401602052604081205480611adf57505060408051808201825283815260208082018481528654600181810189556000898152848120955160029093029095019182559151908201558654868452818801909252929091205561131a565b82856000016001830381548110611af257fe5b906000526020600020906002020160010181905550600091505061131a565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061117c575050151592915050565b606061131784846000856060611b5f85611b11565b611bb0576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310611bef5780518252601f199092019160209182019101611bd0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611c51576040519150601f19603f3d011682016040523d82523d6000602084013e611c56565b606091505b50915091508115611c6a57915061117c9050565b805115611c7a5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315611768578181015183820152602001611750565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611d0257805160ff1916838001178555611d2f565b82800160010185558215611d2f579182015b82811115611d2f578251825591602001919060010190611d14565b50611d3b929150611d3f565b5090565b61066491905b80821115611d3b5760008155600101611d4556fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a26469706673582212204768bb17ca5f49ae7826a457268950e10ccc6679a0e1b07730a7f936a49b15b764736f6c63430006060033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000514aade50d0a679afd172720a7b6fbaccccb64ee

-----Decoded View---------------
Arg [0] : moonbaseAirdrop (address): 0x514AADe50d0A679Afd172720a7B6FBACCccB64ee

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000514aade50d0a679afd172720a7b6fbaccccb64ee


Deployed Bytecode Sourcemap

110509:407:0:-:0;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;110509:407:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;9;2:12;75440:142:0;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;75440:142:0;-1:-1:-1;;;;;;75440:142:0;;:::i;:::-;;;;;;;;;;;;;;;;;;97867:92;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;97867:92:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100554:213;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;100554:213:0;;:::i;:::-;;;;-1:-1:-1;;;;;100554:213:0;;;;;;;;;;;;;;100098:390;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;;;;;;100098:390:0;;;;;;;;:::i;:::-;;99592:203;;;:::i;:::-;;;;;;;;;;;;;;;;101428:305;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;;;;;;101428:305:0;;;;;;;;;;;;;;;;;:::i;99362:154::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;;;;;;99362:154:0;;;;;;;;:::i;101804:151::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;;;;;;101804:151:0;;;;;;;;;;;;;;;;;:::i;99872:164::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;99872:164:0;;:::i;97631:169::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;97631:169:0;;:::i;99189:89::-;;;:::i;97354:215::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;97354:215:0;-1:-1:-1;;;;;97354:215:0;;:::i;21402:148::-;;;:::i;20760:79::-;;;:::i;98028:96::-;;;:::i;100839:295::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;;;;;;100839:295:0;;;;;;;;;;:::i;102026:285::-;;;;;;15:3:-1;10;7:12;4:2;;;32:1;29;22:12;4:2;-1:-1;;;;;102026:285:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:11:-1;11:28;;8:2;;;52:1;49;42:12;8:2;102026:285:0;;41:9:-1;34:4;18:14;14:25;11:40;8:2;;;64:1;61;54:12;8:2;102026:285:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;102026:285:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;102026:285:0;;-1:-1:-1;102026:285:0;;-1:-1:-1;;;;;102026:285:0:i;98195:755::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;98195:755:0;;:::i;110748:165::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;;;;;110748:165:0;;;;;;;;;;;;;;;;;;;27:11:-1;11:28;;8:2;;;52:1;49;42:12;8:2;110748:165:0;;41:9:-1;34:4;18:14;14:25;11:40;8:2;;;64:1;61;54:12;8:2;110748:165:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;110748:165:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;110748:165:0;;-1:-1:-1;110748:165:0;;-1:-1:-1;;;;;110748:165:0:i;101205:156::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;;;;;;101205:156:0;;;;;;;;;;:::i;21705:244::-;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;21705:244:0;-1:-1:-1;;;;;21705:244:0;;:::i;75440:142::-;-1:-1:-1;;;;;;75541:33:0;;75517:4;75541:33;;;;;;;;;;;;;75440:142;;;;:::o;97867:92::-;97946:5;97939:12;;;;;;;;-1:-1:-1;;97939:12:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;97913:13;;97939:12;;97946:5;;97939:12;;97946:5;97939:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;97867:92;;:::o;100554:213::-;100622:7;100650:16;100658:7;100650;:16::i;:::-;100642:73;;;;-1:-1:-1;;;100642:73:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;100735:24:0;;;;:15;:24;;;;;;-1:-1:-1;;;;;100735:24:0;;100554:213::o;100098:390::-;100179:13;100195:16;100203:7;100195;:16::i;:::-;100179:32;;100236:5;-1:-1:-1;;;;;100230:11:0;:2;-1:-1:-1;;;;;100230:11:0;;;100222:57;;;;-1:-1:-1;;;100222:57:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100316:5;-1:-1:-1;;;;;100300:21:0;:12;:10;:12::i;:::-;-1:-1:-1;;;;;100300:21:0;;:62;;;;100325:37;100342:5;100349:12;:10;:12::i;:::-;100325:16;:37::i;:::-;100292:154;;;;-1:-1:-1;;;100292:154:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;100459:21;100468:2;100472:7;100459:8;:21::i;:::-;100098:390;;;:::o;99592:203::-;99645:7;99766:21;:12;:19;:21::i;:::-;99759:28;;99592:203;:::o;101428:305::-;101589:41;101608:12;:10;:12::i;:::-;101622:7;101589:18;:41::i;:::-;101581:103;;;;-1:-1:-1;;;101581:103:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;101697:28;101707:4;101713:2;101717:7;101697:9;:28::i;99362:154::-;-1:-1:-1;;;;;99478:20:0;;99451:7;99478:20;;;:13;:20;;;;;:30;;99502:5;99478:30;:23;:30;:::i;:::-;99471:37;;99362:154;;;;;:::o;101804:151::-;101908:39;101925:4;101931:2;101935:7;101908:39;;;;;;;;;;;;:16;:39::i;99872:164::-;99939:7;;99981:22;:12;99997:5;99981:22;:15;:22;:::i;:::-;-1:-1:-1;99959:44:0;99872:164;-1:-1:-1;;;99872:164:0:o;97631:169::-;97695:7;97722:70;97739:7;97722:70;;;;;;;;;;;;;;;;;:12;;:70;;:16;:70;:::i;99189:89::-;99262:8;99255:15;;;;;;;;-1:-1:-1;;99255:15:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;99229:13;;99255:15;;99262:8;;99255:15;;99262:8;99255:15;;;;;;;;;;;;;;;;;;;;;;;;97354:215;97418:7;-1:-1:-1;;;;;97446:19:0;;97438:74;;;;-1:-1:-1;;;97438:74:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;97532:20:0;;;;;;:13;:20;;;;;:29;;:27;:29::i;21402:148::-;20982:12;:10;:12::i;:::-;20972:6;;-1:-1:-1;;;;;20972:6:0;;;:22;;;20964:67;;;;;-1:-1:-1;;;20964:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21493:6:::1;::::0;21472:40:::1;::::0;21509:1:::1;::::0;-1:-1:-1;;;;;21493:6:0::1;::::0;21472:40:::1;::::0;21509:1;;21472:40:::1;21523:6;:19:::0;;-1:-1:-1;;;;;;21523:19:0::1;::::0;;21402:148::o;20760:79::-;20825:6;;-1:-1:-1;;;;;20825:6:0;20760:79;:::o;98028:96::-;98109:7;98102:14;;;;;;;;-1:-1:-1;;98102:14:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;98076:13;;98102:14;;98109:7;;98102:14;;98109:7;98102:14;;;;;;;;;;;;;;;;;;;;;;;;100839:295;100954:12;:10;:12::i;:::-;-1:-1:-1;;;;;100942:24:0;:8;-1:-1:-1;;;;;100942:24:0;;;100934:62;;;;;-1:-1:-1;;;100934:62:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;101054:8;101009:18;:32;101028:12;:10;:12::i;:::-;-1:-1:-1;;;;;101009:32:0;;;;;;;;;;;;;;;;;-1:-1:-1;101009:32:0;;;:42;;;;;;;;;;;;:53;;-1:-1:-1;;101009:53:0;;;;;;;;;;;101093:12;:10;:12::i;:::-;101078:48;;;;;;;;;;-1:-1:-1;;;;;101078:48:0;;;;;;;;;;;;;;100839:295;;:::o;102026:285::-;102158:41;102177:12;:10;:12::i;:::-;102191:7;102158:18;:41::i;:::-;102150:103;;;;-1:-1:-1;;;102150:103:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;102264:39;102278:4;102284:2;102288:7;102297:5;102264:13;:39::i;:::-;102026:285;;;;:::o;98195:755::-;98260:13;98294:16;98302:7;98294;:16::i;:::-;98286:76;;;;-1:-1:-1;;;98286:76:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;98401:19;;;;:10;:19;;;;;;;;;98375:45;;;;;;-1:-1:-1;;98375:45:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:23;;:45;;;98401:19;98375:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;98502:8:0;98496:22;98375:45;;-1:-1:-1;;;;98496:22:0;-1:-1:-1;;98496:22:0;;;;;;;;;;;98492:76;;98547:9;-1:-1:-1;98540:16:0;;98492:76;98672:23;;:27;98668:112;;98747:8;98757:9;98730:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;98730:37:0;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;98730:37:0;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;98730:37:0;;;98716:52;;;;;98668:112;98912:8;98922:18;:7;:16;:18::i;:::-;98895:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;98895:46:0;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;98895:46:0;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;98895:46:0;;;98881:61;;;98195:755;;;:::o;110748:165::-;20982:12;:10;:12::i;:::-;20972:6;;-1:-1:-1;;;;;20972:6:0;;;:22;;;20964:67;;;;;-1:-1:-1;;;20964:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;110844:18:::1;110850:2;110854:7;110844:5;:18::i;:::-;110873:32;110886:7;110895:9;110873:12;:32::i;101205:156::-:0;-1:-1:-1;;;;;101318:25:0;;;101294:4;101318:25;;;:18;:25;;;;;;;;:35;;;;;;;;;;;;;;;101205:156::o;21705:244::-;20982:12;:10;:12::i;:::-;20972:6;;-1:-1:-1;;;;;20972:6:0;;;:22;;;20964:67;;;;;-1:-1:-1;;;20964:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;21794:22:0;::::1;21786:73;;;;-1:-1:-1::0;;;21786:73:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21896:6;::::0;21875:38:::1;::::0;-1:-1:-1;;;;;21875:38:0;;::::1;::::0;21896:6:::1;::::0;21875:38:::1;::::0;21896:6:::1;::::0;21875:38:::1;21924:6;:17:::0;;-1:-1:-1;;;;;;21924:17:0::1;-1:-1:-1::0;;;;;21924:17:0;;;::::1;::::0;;;::::1;::::0;;21705:244::o;103777:119::-;103834:4;103858:30;:12;103880:7;103858:30;:21;:30;:::i;19367:106::-;19455:10;19367:106;:::o;109604:158::-;109670:24;;;;:15;:24;;;;;:29;;-1:-1:-1;;;;;;109670:29:0;-1:-1:-1;;;;;109670:29:0;;;;;;;;:24;;109724:16;109670:24;109724:7;:16::i;:::-;-1:-1:-1;;;;;109715:39:0;;;;;;;;;;;109604:158;;:::o;91391:123::-;91460:7;91487:19;91495:3;91487:7;:19::i;104063:333::-;104148:4;104173:16;104181:7;104173;:16::i;:::-;104165:73;;;;-1:-1:-1;;;104165:73:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;104249:13;104265:16;104273:7;104265;:16::i;:::-;104249:32;;104311:5;-1:-1:-1;;;;;104300:16:0;:7;-1:-1:-1;;;;;104300:16:0;;:51;;;;104344:7;-1:-1:-1;;;;;104320:31:0;:20;104332:7;104320:11;:20::i;:::-;-1:-1:-1;;;;;104320:31:0;;104300:51;:87;;;;104355:32;104372:5;104379:7;104355:16;:32::i;:::-;104292:96;104063:333;-1:-1:-1;;;;104063:333:0:o;107152:574::-;107270:4;-1:-1:-1;;;;;107250:24:0;:16;107258:7;107250;:16::i;:::-;-1:-1:-1;;;;;107250:24:0;;107242:78;;;;-1:-1:-1;;;107242:78:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;107339:16:0;;107331:65;;;;-1:-1:-1;;;107331:65:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;107409:39;107430:4;107436:2;107440:7;107409:20;:39::i;:::-;107513:29;107530:1;107534:7;107513:8;:29::i;:::-;-1:-1:-1;;;;;107555:19:0;;;;;;:13;:19;;;;;:35;;107582:7;107555:35;:26;:35;:::i;:::-;-1:-1:-1;;;;;;107601:17:0;;;;;;:13;:17;;;;;:30;;107623:7;107601:30;:21;:30;:::i;:::-;-1:-1:-1;107644:29:0;:12;107661:7;107670:2;107644:29;:16;:29;:::i;:::-;;107710:7;107706:2;-1:-1:-1;;;;;107691:27:0;107700:4;-1:-1:-1;;;;;107691:27:0;;;;;;;;;;;107152:574;;;:::o;84054:137::-;84125:7;84160:22;84164:3;84176:5;84160:3;:22::i;91853:227::-;91933:7;;;;91993:22;91997:3;92009:5;91993:3;:22::i;:::-;91962:53;;;;-1:-1:-1;91853:227:0;-1:-1:-1;;;;;91853:227:0:o;92515:204::-;92622:7;92665:44;92670:3;92690;92696:12;92665:4;:44::i;:::-;92657:53;-1:-1:-1;92515:204:0;;;;;;:::o;103192:272::-;103306:28;103316:4;103322:2;103326:7;103306:9;:28::i;:::-;103353:48;103376:4;103382:2;103386:7;103395:5;103353:22;:48::i;:::-;103345:111;;;;-1:-1:-1;;;103345:111:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;92908:744;92964:13;93185:10;93181:53;;-1:-1:-1;93212:10:0;;;;;;;;;;;;-1:-1:-1;;;93212:10:0;;;;;;93181:53;93259:5;93244:12;93300:78;93307:9;;93300:78;;93333:8;;93364:2;93356:10;;;;93300:78;;;93388:19;93420:6;93410:17;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;93410:17:0;;;;;;;;;;;;;;;;;;;;;;;;;;21:6:-1;;108:14;93410:17:0;87:42:-1;143:17;;-1:-1;93410:17:0;-1:-1:-1;93482:5:0;;-1:-1:-1;93388:39:0;-1:-1:-1;;;93454:10:0;;93498:115;93505:9;;93498:115;;93572:2;93565:4;:9;93560:2;:14;93549:27;;93531:6;93538:7;;;;;;;93531:15;;;;;;;;;;;:45;-1:-1:-1;;;;;93531:45:0;;;;;;;;-1:-1:-1;93599:2:0;93591:10;;;;93498:115;;;-1:-1:-1;93637:6:0;92908:744;-1:-1:-1;;;;92908:744:0:o;105662:404::-;-1:-1:-1;;;;;105742:16:0;;105734:61;;;;;-1:-1:-1;;;105734:61:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;105815:16;105823:7;105815;:16::i;:::-;105814:17;105806:58;;;;;-1:-1:-1;;;105806:58:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;105877:45;105906:1;105910:2;105914:7;105877:20;:45::i;:::-;-1:-1:-1;;;;;105935:17:0;;;;;;:13;:17;;;;;:30;;105957:7;105935:30;:21;:30;:::i;:::-;-1:-1:-1;105978:29:0;:12;105995:7;106004:2;105978:29;:16;:29;:::i;:::-;-1:-1:-1;106025:33:0;;106050:7;;-1:-1:-1;;;;;106025:33:0;;;106042:1;;106025:33;;106042:1;;106025:33;105662:404;;:::o;107882:215::-;107982:16;107990:7;107982;:16::i;:::-;107974:73;;;;-1:-1:-1;;;107974:73:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;108058:19;;;;:10;:19;;;;;;;;:31;;;;;;;;:::i;91152:151::-;91236:4;91260:35;91270:3;91290;91260:9;:35::i;88774:110::-;88857:19;;88774:110::o;83141:137::-;83211:4;83235:35;83243:3;83263:5;83235:7;:35::i;82834:131::-;82901:4;82925:32;82930:3;82950:5;82925:4;:32::i;90584:176::-;90673:4;90697:55;90702:3;90722;-1:-1:-1;;;;;90736:14:0;;90697:4;:55::i;80718:204::-;80813:18;;80785:7;;80813:26;-1:-1:-1;80805:73:0;;;;-1:-1:-1;;;80805:73:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;80896:3;:11;;80908:5;80896:18;;;;;;;;;;;;;;;;80889:25;;80718:204;;;;:::o;89239:279::-;89343:19;;89306:7;;;;89343:27;-1:-1:-1;89335:74:0;;;;-1:-1:-1;;;89335:74:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;89422:22;89447:3;:12;;89460:5;89447:19;;;;;;;;;;;;;;;;;;89422:44;;89485:5;:10;;;89497:5;:12;;;89477:33;;;;;89239:279;;;;;:::o;89941:319::-;90035:7;90074:17;;;:12;;;:17;;;;;;90125:12;90110:13;90102:36;;;;-1:-1:-1;;;90102:36:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;90102:36:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;90192:3;:12;;90216:1;90205:8;:12;90192:26;;;;;;;;;;;;;;;;;;:33;;;90185:40;;;89941:319;;;;;:::o;108992:604::-;109113:4;109140:15;:2;-1:-1:-1;;;;;109140:13:0;;:15::i;:::-;109135:60;;-1:-1:-1;109179:4:0;109172:11;;109135:60;109205:23;109231:252;-1:-1:-1;;;109344:12:0;:10;:12::i;:::-;109371:4;109390:7;109412:5;109247:181;;;;;;-1:-1:-1;;;;;109247:181:0;-1:-1:-1;;;;;109247:181:0;;;;;;-1:-1:-1;;;;;109247:181:0;-1:-1:-1;;;;;109247:181:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;109247:181:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;109247:181:0;;;;-1:-1:-1;;;;;109247:181:0;;38:4:-1;29:7;25:18;67:10;61:17;-1:-1;;;;;199:8;192:4;186;182:15;179:29;167:10;160:49;0:215;;;109247:181:0;109231:252;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;109231:15:0;;;:252;;:15;:252;:::i;:::-;109205:278;;109494:13;109521:10;109510:32;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;-1:-1;109510:32:0;-1:-1:-1;;;;;;109561:26:0;-1:-1:-1;;;109561:26:0;;-1:-1:-1;;;108992:604:0;;;;;;:::o;88554:125::-;88625:4;88649:17;;;:12;;;;;:17;;;;;;:22;;;88554:125::o;78420:1544::-;78486:4;78625:19;;;:12;;;:19;;;;;;78661:15;;78657:1300;;79096:18;;-1:-1:-1;;79047:14:0;;;;79096:22;;;;79023:21;;79096:3;;:22;;79383;;;;;;;;;;;;;;79363:42;;79529:9;79500:3;:11;;79512:13;79500:26;;;;;;;;;;;;;;;;;;;:38;;;;79606:23;;;79648:1;79606:12;;;:23;;;;;;79632:17;;;79606:43;;79758:17;;79606:3;;79758:17;;;;;;;;;;;;;;;;;;;;;;79853:3;:12;;:19;79866:5;79853:19;;;;;;;;;;;79846:26;;;79896:4;79889:11;;;;;;;;78657:1300;79940:5;79933:12;;;;;77830:414;77893:4;77915:21;77925:3;77930:5;77915:9;:21::i;:::-;77910:327;;-1:-1:-1;27:10;;39:1;23:18;;;45:23;;77953:11:0;:23;;;;;;;;;;;;;78136:18;;78114:19;;;:12;;;:19;;;;;;:40;;;;78169:11;;77910:327;-1:-1:-1;78220:5:0;78213:12;;86054:692;86130:4;86265:17;;;:12;;;:17;;;;;;86299:13;86295:444;;-1:-1:-1;;86384:38:0;;;;;;;;;;;;;;;;;;27:10:-1;;39:1;23:18;;;45:23;;86366:12:0;:57;;;;;;;;;;;;;;;;;;;;;;;;86581:19;;86561:17;;;:12;;;:17;;;;;;;:39;86615:11;;86295:444;86695:5;86659:3;:12;;86683:1;86672:8;:12;86659:26;;;;;;;;;;;;;;;;;;:33;;:41;;;;86722:5;86715:12;;;;;9646:619;9706:4;10174:20;;10017:66;10214:23;;;;;;:42;;-1:-1:-1;;10241:15:0;;;10206:51;-1:-1:-1;;9646:619:0:o;12761:196::-;12864:12;12896:53;12919:6;12927:4;12933:1;12936:12;14268;14301:18;14312:6;14301:10;:18::i;:::-;14293:60;;;;;-1:-1:-1;;;14293:60:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;14427:12;14441:23;14468:6;-1:-1:-1;;;;;14468:11:0;14488:8;14499:4;14468:36;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;14468:36:0;;;;;;;;;;;;;;;;;;;;;;;;;12:1:-1;19;14:27;;;;67:4;61:11;56:16;;134:4;130:9;123:4;105:16;101:27;97:43;94:1;90:51;84:4;77:65;157:16;154:1;147:27;211:16;208:1;201:4;198:1;194:12;179:49;5:228;;14:27;32:4;27:9;;5:228;;14426:78:0;;;;14519:7;14515:595;;;14550:10;-1:-1:-1;14543:17:0;;-1:-1:-1;14543:17:0;14515:595;14664:17;;:21;14660:439;;14927:10;14921:17;14988:15;14975:10;14971:2;14967:19;14960:44;14875:148;15063:20;;-1:-1:-1;;;15063:20:0;;;;;;;;;;;;;;;;;15070:12;;15063:20;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;110509:407:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;110509:407:0;;;-1:-1:-1;110509:407:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;

Swarm Source

ipfs://4768bb17ca5f49ae7826a457268950e10ccc6679a0e1b07730a7f936a49b15b7
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.