false
false
0
The new Blockscout UI is now open source! Learn how to deploy it here
- We're indexing this chain right now. Some of the counts may be inaccurate.

Contract Address Details

0xd3700691C78d1938496F261e3F97A8d42D140C5E

Contract Name
JustMinter
Creator
0x9c017f–019d9a at 0x863bc2–65ddde
Balance
0.1 ETH
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
1998627
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
JustMinter




Optimization enabled
true
Compiler version
v0.8.20+commit.a1b79de6




Optimization runs
1000
EVM Version
paris




Verified at
2024-05-16T12:14:31.067382Z

contracts/JustMinter.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

import {IERC721Mintable} from "./IERC721Mintable.sol";

contract JustMinter is Ownable {
    using Address for address payable;

    struct SetupParam {
        IERC721Mintable nft; // target NFT contract
        uint256 cap; // max mints
        uint256 price; // mint price
        uint256 freeMints; // number of free mints
        uint256 nWinners; // number of winners
        uint256 prizeActivationWindow; // condition is cap being reached within this activation window, to avoid dead end situation.
        uint256 prizeDrawingInterval; // interval bwt prize activation and claiming. seed updaters can still perform update during this time.
        address team; // team address
    }

    SetupParam public param;

    uint256 public seed;
    uint256 public prizePool;
    uint256 public splitPrize; // amount for each winner

    uint256 public time0;
    uint256 public prizeActivationTime;
    uint256 public prizeClaimStartTime = type(uint256).max;

    uint256 seedUpdateCount;
    mapping(uint256 tokenId => uint256) public seedUpdates;
    mapping(uint256 tokenId => uint256) public claims;

    uint256 public constant SeedUpdatesPerID = 1;
    uint256 public constant DefaultPrizeActivationWindow = 8 weeks;
    uint256 public constant DefaultPrizeDrawingInterval = 1 weeks;

    error LESS_PAID_ERROR();
    error EXCEED_CAP_ERROR(uint256 cap);
    error AHEAD_CLAIM_TIME_ERROR();
    error UPDATESEED_TIME_OVER_ERROR();
    error OWNERSHIP_ERROR();
    error ALREADY_UPDATE_ERROR(uint256);
    error NO_PRIZE_TO_CLAIM_ERROR();
    error RECLAIM_ERRROR();

    modifier afterClaimTime() {
        if (block.timestamp < prizeClaimStartTime) revert AHEAD_CLAIM_TIME_ERROR();
        _;
    }

    modifier beforeClaimTime() {
        if (block.timestamp >= prizeClaimStartTime) revert UPDATESEED_TIME_OVER_ERROR();
        _;
    }

    modifier senderOwns(uint256 id_) {
        if (msg.sender != param.nft.ownerOf(id_)) revert OWNERSHIP_ERROR();
        _;
    }

    modifier onlyTeam() {
        require(msg.sender == param.team);
        _;
    }

    constructor() Ownable(msg.sender) {}

    //@dev  the ownership MUST be renounced after setup, to ensure commitment of consistent parameters.
    function setup(SetupParam calldata param_) external onlyOwner {
        require(address(param_.nft) != address(0));
        require(param_.cap > 0 && param_.cap >= param_.freeMints);
        require(param_.nWinners > 0);
        require(param_.team != address(0));

        param = param_;

        if (param.prizeActivationWindow <= 0) {
            param.prizeActivationWindow = DefaultPrizeActivationWindow;
        }

        if (param.prizeDrawingInterval <= 0) {
            param.prizeDrawingInterval = DefaultPrizeDrawingInterval;
        }

        time0 = block.timestamp;
    }

    function mint() external payable returns (uint256 tokenId) {
        uint256 total = param.nft.totalSupply();

        if (total >= param.cap) revert EXCEED_CAP_ERROR(param.cap);

        if (total >= param.freeMints) {
            if (msg.value < param.price) revert LESS_PAID_ERROR();
        }

        tokenId = param.nft.mint(msg.sender);

        if (tokenId == param.cap) {
            // since this is the last minted token
            if (block.timestamp <= time0 + param.prizeActivationWindow) {
                // within prize activation time
                _activatePrize();
            }
        }
    }

    function updateSeed(uint256 id_) external beforeClaimTime senderOwns(id_) {
        if (seedUpdates[id_] > 0) revert ALREADY_UPDATE_ERROR(seedUpdates[id_]);

        seedUpdateCount++;
        seed += seedUpdateCount * id_;

        seedUpdates[id_] = seedUpdateCount;
    }

    function checkPrize(uint256 id_) public view afterClaimTime returns (uint256 prize) {
        prize = _checkPrize(id_);
    }

    function claimPrize(uint256 id_) external afterClaimTime senderOwns(id_) {
        uint256 prize = _checkPrize(id_);
        if (prize == 0) revert NO_PRIZE_TO_CLAIM_ERROR();

        if (claims[id_] != 0) revert RECLAIM_ERRROR();

        claims[id_] = prize;
        prizePool -= prize;

        payable(msg.sender).sendValue(prize);
    }

    function previewWinners() external view returns (uint256[] memory winners_, bool isFinal_) {
        uint256 g = _calculateG();
        winners_ = new uint256[](param.nWinners);
        uint256 step = param.cap / param.nWinners;
        for (uint256 i = 0; i < param.nWinners; i++) {
            winners_[i] = g + 1;
            g = (g + step) % param.cap;
        }
        isFinal_ = block.timestamp >= prizeClaimStartTime;
    }

    function withdraw() external onlyTeam {
        uint256 withdrawable = 0;

        if (prizePool > 0) {
            // prize activated, make sure prize is safe
            withdrawable = address(this).balance - prizePool;
        } else if (block.timestamp > time0 + param.prizeActivationWindow) {
            // prize not activated, and the activation time has passed,
            // there is no prize to keep.
            withdrawable = address(this).balance;
        }

        if (withdrawable > 0) {
            payable(msg.sender).sendValue(withdrawable);
        }
    }

    ////////////////////////////////////////////////
    ////    PRIVATE functions
    ////////////////////////////////////////////////

    function _activatePrize() private {
        prizeActivationTime = block.timestamp;
        prizeClaimStartTime = prizeActivationTime + param.prizeDrawingInterval;
        prizePool = address(this).balance / 2;
        splitPrize = prizePool / param.nWinners;
    }

    // calcualte generator element based on the seed
    function _calculateG() private view returns (uint256 g) {
        g = uint256(keccak256(abi.encode(address(param.nft), seed))) % param.cap;
    }

    function _checkPrize(uint256 id_) private view returns (uint256 prize) {
        prize = 0;

        uint256 g = _calculateG();

        uint256 step = param.cap / param.nWinners;
        for (uint256 i = 0; i < param.nWinners; i++) {
            if (id_ == g + 1) {
                prize = splitPrize;
                break;
            }

            g = (g + step) % param.cap;
        }
    }
}
        

@openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
          

@openzeppelin/contracts/token/ERC721/IERC721.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

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

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

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

@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

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

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

@openzeppelin/contracts/utils/Address.sol

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

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}
          

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
          

@openzeppelin/contracts/utils/introspection/IERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

contracts/IERC721Mintable.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

interface IERC721Mintable is IERC721, IERC721Enumerable {
    function mint(address to) external returns (uint256 tokenId);
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":1000,"enabled":true},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"AHEAD_CLAIM_TIME_ERROR","inputs":[]},{"type":"error","name":"ALREADY_UPDATE_ERROR","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"error","name":"AddressInsufficientBalance","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"error","name":"EXCEED_CAP_ERROR","inputs":[{"type":"uint256","name":"cap","internalType":"uint256"}]},{"type":"error","name":"FailedInnerCall","inputs":[]},{"type":"error","name":"LESS_PAID_ERROR","inputs":[]},{"type":"error","name":"NO_PRIZE_TO_CLAIM_ERROR","inputs":[]},{"type":"error","name":"OWNERSHIP_ERROR","inputs":[]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"error","name":"RECLAIM_ERRROR","inputs":[]},{"type":"error","name":"UPDATESEED_TIME_OVER_ERROR","inputs":[]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"DefaultPrizeActivationWindow","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"DefaultPrizeDrawingInterval","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"SeedUpdatesPerID","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"prize","internalType":"uint256"}],"name":"checkPrize","inputs":[{"type":"uint256","name":"id_","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimPrize","inputs":[{"type":"uint256","name":"id_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claims","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}],"name":"mint","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"nft","internalType":"contract IERC721Mintable"},{"type":"uint256","name":"cap","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"freeMints","internalType":"uint256"},{"type":"uint256","name":"nWinners","internalType":"uint256"},{"type":"uint256","name":"prizeActivationWindow","internalType":"uint256"},{"type":"uint256","name":"prizeDrawingInterval","internalType":"uint256"},{"type":"address","name":"team","internalType":"address"}],"name":"param","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"winners_","internalType":"uint256[]"},{"type":"bool","name":"isFinal_","internalType":"bool"}],"name":"previewWinners","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"prizeActivationTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"prizeClaimStartTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"prizePool","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"seed","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"seedUpdates","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setup","inputs":[{"type":"tuple","name":"param_","internalType":"struct JustMinter.SetupParam","components":[{"type":"address","name":"nft","internalType":"contract IERC721Mintable"},{"type":"uint256","name":"cap","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"freeMints","internalType":"uint256"},{"type":"uint256","name":"nWinners","internalType":"uint256"},{"type":"uint256","name":"prizeActivationWindow","internalType":"uint256"},{"type":"uint256","name":"prizeDrawingInterval","internalType":"uint256"},{"type":"address","name":"team","internalType":"address"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"splitPrize","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"time0","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateSeed","inputs":[{"type":"uint256","name":"id_","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[]}]
              

Contract Creation Code

0x6080604052600019600e5534801561001657600080fd5b50338061003d57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6100468161004c565b5061009c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6110c9806100ab6000396000f3fe6080604052600436106101755760003560e01c80637fa568ac116100cb578063aa0ad7691161007f578063d709815411610059578063d709815414610400578063f2fde38b14610420578063f5a8d3cf1461044057600080fd5b8063aa0ad769146103b4578063b3f8c65c146103ca578063b776eaef146103ea57600080fd5b80638da5cb5b116100b05780638da5cb5b146103325780638deaa6c71461035a578063a888c2cd1461038757600080fd5b80637fa568ac14610289578063883d87b1146102a957600080fd5b80632e5a4db11161012d578063719ce73e11610107578063719ce73e1461024657806376e702711461025c5780637d94792a1461027357600080fd5b80632e5a4db1146102075780633ccfd60b1461021c578063715018a61461023157600080fd5b806311ce10361161015e57806311ce1036146101c55780631249c58b146101e85780632183811e146101f057600080fd5b8063070573821461017a5780630c99d59c146101a3575b600080fd5b34801561018657600080fd5b50610190600b5481565b6040519081526020015b60405180910390f35b3480156101af57600080fd5b506101c36101be366004610e26565b610456565b005b3480156101d157600080fd5b506101da610510565b60405161019a929190610e3f565b6101906105ec565b3480156101fc57600080fd5b5061019062093a8081565b34801561021357600080fd5b50610190600181565b34801561022857600080fd5b506101c36107ad565b34801561023d57600080fd5b506101c3610810565b34801561025257600080fd5b50610190600a5481565b34801561026857600080fd5b506101906249d40081565b34801561027f57600080fd5b5061019060095481565b34801561029557600080fd5b506101906102a4366004610e8a565b610824565b3480156102b557600080fd5b506001546002546003546004546005546006546007546008546102e8976001600160a01b03908116979695949392911688565b604080516001600160a01b03998a16815260208101989098528701959095526060860193909352608085019190915260a084015260c083015290911660e08201526101000161019a565b34801561033e57600080fd5b506000546040516001600160a01b03909116815260200161019a565b34801561036657600080fd5b50610190610375366004610e8a565b60106020526000908152604090205481565b34801561039357600080fd5b506101906103a2366004610e8a565b60116020526000908152604090205481565b3480156103c057600080fd5b50610190600d5481565b3480156103d657600080fd5b506101c36103e5366004610e8a565b610858565b3480156103f657600080fd5b50610190600c5481565b34801561040c57600080fd5b506101c361041b366004610e8a565b6109dd565b34801561042c57600080fd5b506101c361043b366004610eb8565b610b63565b34801561044c57600080fd5b50610190600e5481565b61045e610bb7565b600061046d6020830183610eb8565b6001600160a01b03160361048057600080fd5b6000816020013511801561049c57508060600135816020013510155b6104a557600080fd5b60008160800135116104b657600080fd5b60006104c9610100830160e08401610eb8565b6001600160a01b0316036104dc57600080fd5b8060016104e98282610edc565b50506006546104fa576249d4006006555b6007546105095762093a806007555b5042600c55565b606060008061051d610bfd565b60055490915067ffffffffffffffff81111561053b5761053b610f87565b604051908082528060200260200182016040528015610564578160200160208202803683370190505b5060055460025491945060009161057b9190610fc9565b905060005b6005548110156105dd57610595836001610fdd565b8582815181106105a7576105a7610ff0565b60209081029190910101526002546105bf8385610fdd565b6105c99190611006565b9250806105d58161101a565b915050610580565b50600e54421015925050509091565b600080600160000160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610645573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106699190611033565b60025490915081106106b3576002546040517f7cc5357b00000000000000000000000000000000000000000000000000000000815260048101919091526024015b60405180910390fd5b60045481106106f8576003543410156106f8576040517ff628858a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001546040517f6a6278420000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0390911690636a627842906024016020604051808303816000875af115801561075b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077f9190611033565b60025490925082036107a957600654600c5461079b9190610fdd565b42116107a9576107a9610c4c565b5090565b6008546001600160a01b031633146107c457600080fd5b600a54600090156107e357600a546107dc904761104c565b90506107fd565b600654600c546107f39190610fdd565b4211156107fd5750475b801561080d5761080d3382610c82565b50565b610818610bb7565b6108226000610d4b565b565b6000600e5442101561084957604051635444165560e01b815260040160405180910390fd5b61085282610da8565b92915050565b600e544210610893576040517f2edf9a5700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001546040516331a9108f60e11b81526004810183905282916001600160a01b031690636352211e90602401602060405180830381865afa1580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610900919061105f565b6001600160a01b0316336001600160a01b0316146109315760405163c16447a560e01b815260040160405180910390fd5b6000828152601060205260409020541561098b57600082815260106020526040908190205490517f682c0e1800000000000000000000000000000000000000000000000000000000815260048101919091526024016106aa565b600f805490600061099b8361101a565b919050555081600f546109ae919061107c565b600960008282546109bf9190610fdd565b9091555050600f546000928352601060205260409092209190915550565b600e54421015610a0057604051635444165560e01b815260040160405180910390fd5b6001546040516331a9108f60e11b81526004810183905282916001600160a01b031690636352211e90602401602060405180830381865afa158015610a49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6d919061105f565b6001600160a01b0316336001600160a01b031614610a9e5760405163c16447a560e01b815260040160405180910390fd5b6000610aa983610da8565b905080600003610ae5576040517fefff729300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008381526011602052604090205415610b2b576040517f92c1c10500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152601160205260408120829055600a8054839290610b4e90849061104c565b90915550610b5e90503382610c82565b505050565b610b6b610bb7565b6001600160a01b038116610bae576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016106aa565b61080d81610d4b565b6000546001600160a01b03163314610822576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016106aa565b600254600154600954604080516001600160a01b039093166020840152820152600091906060016040516020818303038152906040528051906020012060001c610c479190611006565b905090565b42600d819055600754610c5e91610fdd565b600e55610c6c600247610fc9565b600a819055600554610c7d91610fc9565b600b55565b80471015610cbe576040517fcd7860590000000000000000000000000000000000000000000000000000000081523060048201526024016106aa565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610d0b576040519150601f19603f3d011682016040523d82523d6000602084013e610d10565b606091505b5050905080610b5e576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080610db3610bfd565b600554600254919250600091610dc99190610fc9565b905060005b600554811015610e1e57610de3836001610fdd565b8503610df357600b549350610e1e565b600254610e008385610fdd565b610e0a9190611006565b925080610e168161101a565b915050610dce565b505050919050565b60006101008284031215610e3957600080fd5b50919050565b604080825283519082018190526000906020906060840190828701845b82811015610e7857815184529284019290840190600101610e5c565b50505093151592019190915250919050565b600060208284031215610e9c57600080fd5b5035919050565b6001600160a01b038116811461080d57600080fd5b600060208284031215610eca57600080fd5b8135610ed581610ea3565b9392505050565b8135610ee781610ea3565b815473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038216178255506020820135600182015560408201356002820155606082013560038201556080820135600482015560a0820135600582015560c0820135600682015560e0820135610f5881610ea3565b60078201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082610fd857610fd8610f9d565b500490565b8082018082111561085257610852610fb3565b634e487b7160e01b600052603260045260246000fd5b60008261101557611015610f9d565b500690565b60006001820161102c5761102c610fb3565b5060010190565b60006020828403121561104557600080fd5b5051919050565b8181038181111561085257610852610fb3565b60006020828403121561107157600080fd5b8151610ed581610ea3565b808202811582820484141761085257610852610fb356fea26469706673582212207b797df2517b5d59f39af5d3487b07daf3d67efbfab8170d2a8be8944762ddc364736f6c63430008140033

Deployed ByteCode

0x6080604052600436106101755760003560e01c80637fa568ac116100cb578063aa0ad7691161007f578063d709815411610059578063d709815414610400578063f2fde38b14610420578063f5a8d3cf1461044057600080fd5b8063aa0ad769146103b4578063b3f8c65c146103ca578063b776eaef146103ea57600080fd5b80638da5cb5b116100b05780638da5cb5b146103325780638deaa6c71461035a578063a888c2cd1461038757600080fd5b80637fa568ac14610289578063883d87b1146102a957600080fd5b80632e5a4db11161012d578063719ce73e11610107578063719ce73e1461024657806376e702711461025c5780637d94792a1461027357600080fd5b80632e5a4db1146102075780633ccfd60b1461021c578063715018a61461023157600080fd5b806311ce10361161015e57806311ce1036146101c55780631249c58b146101e85780632183811e146101f057600080fd5b8063070573821461017a5780630c99d59c146101a3575b600080fd5b34801561018657600080fd5b50610190600b5481565b6040519081526020015b60405180910390f35b3480156101af57600080fd5b506101c36101be366004610e26565b610456565b005b3480156101d157600080fd5b506101da610510565b60405161019a929190610e3f565b6101906105ec565b3480156101fc57600080fd5b5061019062093a8081565b34801561021357600080fd5b50610190600181565b34801561022857600080fd5b506101c36107ad565b34801561023d57600080fd5b506101c3610810565b34801561025257600080fd5b50610190600a5481565b34801561026857600080fd5b506101906249d40081565b34801561027f57600080fd5b5061019060095481565b34801561029557600080fd5b506101906102a4366004610e8a565b610824565b3480156102b557600080fd5b506001546002546003546004546005546006546007546008546102e8976001600160a01b03908116979695949392911688565b604080516001600160a01b03998a16815260208101989098528701959095526060860193909352608085019190915260a084015260c083015290911660e08201526101000161019a565b34801561033e57600080fd5b506000546040516001600160a01b03909116815260200161019a565b34801561036657600080fd5b50610190610375366004610e8a565b60106020526000908152604090205481565b34801561039357600080fd5b506101906103a2366004610e8a565b60116020526000908152604090205481565b3480156103c057600080fd5b50610190600d5481565b3480156103d657600080fd5b506101c36103e5366004610e8a565b610858565b3480156103f657600080fd5b50610190600c5481565b34801561040c57600080fd5b506101c361041b366004610e8a565b6109dd565b34801561042c57600080fd5b506101c361043b366004610eb8565b610b63565b34801561044c57600080fd5b50610190600e5481565b61045e610bb7565b600061046d6020830183610eb8565b6001600160a01b03160361048057600080fd5b6000816020013511801561049c57508060600135816020013510155b6104a557600080fd5b60008160800135116104b657600080fd5b60006104c9610100830160e08401610eb8565b6001600160a01b0316036104dc57600080fd5b8060016104e98282610edc565b50506006546104fa576249d4006006555b6007546105095762093a806007555b5042600c55565b606060008061051d610bfd565b60055490915067ffffffffffffffff81111561053b5761053b610f87565b604051908082528060200260200182016040528015610564578160200160208202803683370190505b5060055460025491945060009161057b9190610fc9565b905060005b6005548110156105dd57610595836001610fdd565b8582815181106105a7576105a7610ff0565b60209081029190910101526002546105bf8385610fdd565b6105c99190611006565b9250806105d58161101a565b915050610580565b50600e54421015925050509091565b600080600160000160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610645573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106699190611033565b60025490915081106106b3576002546040517f7cc5357b00000000000000000000000000000000000000000000000000000000815260048101919091526024015b60405180910390fd5b60045481106106f8576003543410156106f8576040517ff628858a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001546040517f6a6278420000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0390911690636a627842906024016020604051808303816000875af115801561075b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077f9190611033565b60025490925082036107a957600654600c5461079b9190610fdd565b42116107a9576107a9610c4c565b5090565b6008546001600160a01b031633146107c457600080fd5b600a54600090156107e357600a546107dc904761104c565b90506107fd565b600654600c546107f39190610fdd565b4211156107fd5750475b801561080d5761080d3382610c82565b50565b610818610bb7565b6108226000610d4b565b565b6000600e5442101561084957604051635444165560e01b815260040160405180910390fd5b61085282610da8565b92915050565b600e544210610893576040517f2edf9a5700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001546040516331a9108f60e11b81526004810183905282916001600160a01b031690636352211e90602401602060405180830381865afa1580156108dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610900919061105f565b6001600160a01b0316336001600160a01b0316146109315760405163c16447a560e01b815260040160405180910390fd5b6000828152601060205260409020541561098b57600082815260106020526040908190205490517f682c0e1800000000000000000000000000000000000000000000000000000000815260048101919091526024016106aa565b600f805490600061099b8361101a565b919050555081600f546109ae919061107c565b600960008282546109bf9190610fdd565b9091555050600f546000928352601060205260409092209190915550565b600e54421015610a0057604051635444165560e01b815260040160405180910390fd5b6001546040516331a9108f60e11b81526004810183905282916001600160a01b031690636352211e90602401602060405180830381865afa158015610a49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6d919061105f565b6001600160a01b0316336001600160a01b031614610a9e5760405163c16447a560e01b815260040160405180910390fd5b6000610aa983610da8565b905080600003610ae5576040517fefff729300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008381526011602052604090205415610b2b576040517f92c1c10500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152601160205260408120829055600a8054839290610b4e90849061104c565b90915550610b5e90503382610c82565b505050565b610b6b610bb7565b6001600160a01b038116610bae576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016106aa565b61080d81610d4b565b6000546001600160a01b03163314610822576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016106aa565b600254600154600954604080516001600160a01b039093166020840152820152600091906060016040516020818303038152906040528051906020012060001c610c479190611006565b905090565b42600d819055600754610c5e91610fdd565b600e55610c6c600247610fc9565b600a819055600554610c7d91610fc9565b600b55565b80471015610cbe576040517fcd7860590000000000000000000000000000000000000000000000000000000081523060048201526024016106aa565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610d0b576040519150601f19603f3d011682016040523d82523d6000602084013e610d10565b606091505b5050905080610b5e576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080610db3610bfd565b600554600254919250600091610dc99190610fc9565b905060005b600554811015610e1e57610de3836001610fdd565b8503610df357600b549350610e1e565b600254610e008385610fdd565b610e0a9190611006565b925080610e168161101a565b915050610dce565b505050919050565b60006101008284031215610e3957600080fd5b50919050565b604080825283519082018190526000906020906060840190828701845b82811015610e7857815184529284019290840190600101610e5c565b50505093151592019190915250919050565b600060208284031215610e9c57600080fd5b5035919050565b6001600160a01b038116811461080d57600080fd5b600060208284031215610eca57600080fd5b8135610ed581610ea3565b9392505050565b8135610ee781610ea3565b815473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038216178255506020820135600182015560408201356002820155606082013560038201556080820135600482015560a0820135600582015560c0820135600682015560e0820135610f5881610ea3565b60078201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082610fd857610fd8610f9d565b500490565b8082018082111561085257610852610fb3565b634e487b7160e01b600052603260045260246000fd5b60008261101557611015610f9d565b500690565b60006001820161102c5761102c610fb3565b5060010190565b60006020828403121561104557600080fd5b5051919050565b8181038181111561085257610852610fb3565b60006020828403121561107157600080fd5b8151610ed581610ea3565b808202811582820484141761085257610852610fb356fea26469706673582212207b797df2517b5d59f39af5d3487b07daf3d67efbfab8170d2a8be8944762ddc364736f6c63430008140033