APE Price: $0.51 (+2.75%)

Contract

0xcfb8214eEEf1d9dCEE7cd4D053004771EEC938A7

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Start Dungeon Ru...114492892025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0192628525.42069
Start Dungeon Ru...114492882025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0193848725.42069
Start Dungeon Ru...114492882025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0197861925.42069
Start Dungeon Ru...114492882025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492882025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492882025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492882025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492882025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492872025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492872025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492872025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492872025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492872025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492872025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114492872025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.019856625.42069
Start Dungeon Ru...114492862025-03-12 6:12:0719 hrs ago1741759927IN
0xcfb8214e...1EEC938A7
0.001 APE0.0191746425.42069
Start Dungeon Ru...114487412025-03-12 6:01:1019 hrs ago1741759270IN
0xcfb8214e...1EEC938A7
0.001 APE0.0192628525.42069
Start Dungeon Ru...114487412025-03-12 6:01:1019 hrs ago1741759270IN
0xcfb8214e...1EEC938A7
0.001 APE0.0193848725.42069
Start Dungeon Ru...114487412025-03-12 6:01:1019 hrs ago1741759270IN
0xcfb8214e...1EEC938A7
0.001 APE0.0197861925.42069
Start Dungeon Ru...114487412025-03-12 6:01:1019 hrs ago1741759270IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114487412025-03-12 6:01:1019 hrs ago1741759270IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114487412025-03-12 6:01:1019 hrs ago1741759270IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114487402025-03-12 6:01:0919 hrs ago1741759269IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114487402025-03-12 6:01:0919 hrs ago1741759269IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
Start Dungeon Ru...114487402025-03-12 6:01:0919 hrs ago1741759269IN
0xcfb8214e...1EEC938A7
0.001 APE0.0202172225.42069
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
114492892025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492882025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492882025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492882025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492882025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492882025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492882025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492882025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492872025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492872025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492872025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492872025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492872025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492872025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492872025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114492862025-03-12 6:12:0719 hrs ago1741759927
0xcfb8214e...1EEC938A7
0.001 APE
114487412025-03-12 6:01:1019 hrs ago1741759270
0xcfb8214e...1EEC938A7
0.001 APE
114487412025-03-12 6:01:1019 hrs ago1741759270
0xcfb8214e...1EEC938A7
0.001 APE
114487412025-03-12 6:01:1019 hrs ago1741759270
0xcfb8214e...1EEC938A7
0.001 APE
114487412025-03-12 6:01:1019 hrs ago1741759270
0xcfb8214e...1EEC938A7
0.001 APE
114487412025-03-12 6:01:1019 hrs ago1741759270
0xcfb8214e...1EEC938A7
0.001 APE
114487412025-03-12 6:01:1019 hrs ago1741759270
0xcfb8214e...1EEC938A7
0.001 APE
114487402025-03-12 6:01:0919 hrs ago1741759269
0xcfb8214e...1EEC938A7
0.001 APE
114487402025-03-12 6:01:0919 hrs ago1741759269
0xcfb8214e...1EEC938A7
0.001 APE
114487402025-03-12 6:01:0919 hrs ago1741759269
0xcfb8214e...1EEC938A7
0.001 APE
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DungeonEntry

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
shanghai EvmVersion
File 1 of 11 : DungeonEntry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./interfaces/IDungeonEntry.sol";
import "./interfaces/IDungeonGame.sol";
import "./interfaces/INFTStats.sol";
import "./interfaces/IPrizePool.sol";
import "./interfaces/ICollectionRegistry.sol";

/// @title DungeonEntry
/// @notice Manages dungeon entry and active run state for NFTs
contract DungeonEntry is IDungeonEntry, Ownable, ReentrancyGuard {
    // ------------------------- Immutable state variables -------------------------
    ICollectionRegistry public immutable collectionRegistry;
    INFTStats public immutable nftStats;

    // ------------------------- Constants -------------------------
    uint256 private constant MAX_RUN_DURATION = 24 hours;

    // ------------------------- State variables -------------------------
    IPrizePool public prizePool;
    IDungeonGame public dungeonGame;
    bool private initialized;
    uint256 private entryFee;
    mapping(address => mapping(uint256 => bool)) private inDungeon;

    // ------------------------- Events -------------------------
    event EntryFeeUpdated(uint256 newFee);
    event RunExpired(address indexed collection, uint256 indexed tokenId);
    event DungeonEntryInitialized(
        address indexed prizePool,
        address indexed dungeonGame
    );

    // ------------------------- Constructor -------------------------
    constructor(
        address _collectionRegistry,
        address _nftStats,
        uint256 _initialEntryFee
    ) Ownable(msg.sender) {
        require(_collectionRegistry != address(0), "Invalid registry address");
        require(_nftStats != address(0), "Invalid stats address");

        collectionRegistry = ICollectionRegistry(_collectionRegistry);
        nftStats = INFTStats(_nftStats);
        entryFee = _initialEntryFee;
    }

    // ------------------------- External functions - Admin -------------------------
    /// @notice Initialize the DungeonEntry with required contract addresses
    /// @param _prizePool Address of the PrizePool contract
    /// @param _dungeonGame Address of the DungeonGame contract
    function initialize(
        address _prizePool,
        address _dungeonGame
    ) external onlyOwner {
        require(!initialized, "Already initialized");
        require(_prizePool != address(0), "Invalid prize pool address");
        require(_dungeonGame != address(0), "Invalid dungeon game address");

        prizePool = IPrizePool(_prizePool);
        dungeonGame = IDungeonGame(_dungeonGame);
        initialized = true;

        emit DungeonEntryInitialized(_prizePool, _dungeonGame);
    }

    /// @notice Update the entry fee
    /// @param newFee New entry fee in wei
    function updateEntryFee(uint256 newFee) external onlyOwner {
        entryFee = newFee;
        emit EntryFeeUpdated(newFee);
    }

    // ------------------------- External functions - Core game mechanics -------------------------
    /// @notice Start a new dungeon run for an NFT
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    function startDungeonRun(
        address collection,
        uint256 tokenId
    ) external payable nonReentrant {
        require(initialized, "Not initialized");
        // Check entry fee
        require(msg.value >= entryFee, "Insufficient entry fee");

        // Verify collection is whitelisted
        require(
            collectionRegistry.isWhitelisted(collection),
            "Collection not whitelisted"
        );

        // Verify NFT ownership
        require(
            IERC721(collection).ownerOf(tokenId) == msg.sender,
            "Not NFT owner"
        );

        // Check if NFT is already in dungeon
        require(!inDungeon[collection][tokenId], "Already in dungeon");

        require(
            nftStats.isInitialized(collection, tokenId),
            "NFT stats not initialized"
        );

        // Add character to dungeon queue
        dungeonGame.enterDungeon(collection, tokenId);

        // Mark NFT as in dungeon
        inDungeon[collection][tokenId] = true;

        // Forward entry fee to prize pool
        prizePool.depositEntryFee{value: entryFee}();

        // Refund excess payment if any
        uint256 excess = msg.value - entryFee;
        if (excess > 0) {
            (bool success, ) = msg.sender.call{value: excess}("");
            require(success, "Refund failed");
        }

        emit DungeonRunStarted(collection, tokenId, msg.sender, entryFee);
    }

    /// @notice End an active dungeon run
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @param success Whether the run was successful
    function endDungeonRun(
        address collection,
        uint256 tokenId,
        bool success
    ) external {
        require(initialized, "Not initialized");
        // Only DungeonGame contract can end runs
        require(msg.sender == address(dungeonGame), "Not authorized");
        require(inDungeon[collection][tokenId], "Not in dungeon");

        // Mark NFT as no longer in dungeon
        inDungeon[collection][tokenId] = false;

        emit DungeonRunEnded(collection, tokenId, success);
    }

    // ------------------------- External view functions -------------------------
    /// @notice Check if an NFT has an active dungeon run
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @return bool True if NFT has an active run
    function hasActiveRun(
        address collection,
        uint256 tokenId
    ) public view returns (bool) {
        if (!inDungeon[collection][tokenId]) return false;

        uint256 roomNumber = dungeonGame.getCharacterRoomNumber(
            collection,
            tokenId
        );
        if (roomNumber == 0) return false;

        return true;
    }

    /// @notice Get the current entry fee for dungeon runs
    /// @return uint256 Current entry fee in wei
    function getEntryFee() external view returns (uint256) {
        return entryFee;
    }

    /// @notice Get time remaining for an active run
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @return uint256 Time remaining in seconds, 0 if no active run
    function getTimeRemaining(
        address collection,
        uint256 tokenId
    ) external view returns (uint256) {
        if (!inDungeon[collection][tokenId]) return 0;

        uint256 roomNumber = dungeonGame.getCharacterRoomNumber(
            collection,
            tokenId
        );
        if (roomNumber == 0) return 0;

        return 0;
    }
}

File 2 of 11 : 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);
    }
}

File 3 of 11 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Required interface of an ERC-721 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 ERC-721 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 ERC-721
     * 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);
}

File 4 of 11 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

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

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

File 5 of 11 : IDungeonEntry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/// @title IDungeonEntry
/// @notice Interface for managing dungeon entry and run initialization
interface IDungeonEntry {
    // ------------------------- Type definitions -------------------------
    /// @notice Structure for active dungeon run state
    struct DungeonRun {
        uint256 currentHp;
        uint256 currentRoom;
        bool isActive;
    }

    // ------------------------- Events -------------------------
    /// @notice Event emitted when a dungeon run is started
    event DungeonRunStarted(
        address indexed collection,
        uint256 indexed tokenId,
        address indexed player,
        uint256 entryFee
    );

    /// @notice Event emitted when a dungeon run is ended
    event DungeonRunEnded(
        address indexed collection,
        uint256 indexed tokenId,
        bool success
    );

    // ------------------------- External functions -------------------------
    /// @notice Start a new dungeon run for an NFT
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    function startDungeonRun(
        address collection,
        uint256 tokenId
    ) external payable;

    /// @notice End an active dungeon run (called by DungeonGame)
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @param success Whether the run was successful
    function endDungeonRun(
        address collection,
        uint256 tokenId,
        bool success
    ) external;

    // ------------------------- View functions -------------------------
    /// @notice Check if an NFT has an active dungeon run
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @return bool True if NFT has an active run
    function hasActiveRun(
        address collection,
        uint256 tokenId
    ) external view returns (bool);

    /// @notice Get the current entry fee for dungeon runs
    /// @return uint256 Current entry fee in wei
    function getEntryFee() external view returns (uint256);
}

File 6 of 11 : IDungeonGame.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/// @title IDungeonGame
/// @notice Interface for core dungeon game mechanics and progression
interface IDungeonGame {
    // ------------------------- Type definitions -------------------------
    /// @notice Structure for dungeon room state
    struct RoomState {
        address collection;
        uint256 tokenId;
        uint256 entryIndex; // Used for ordering characters
        uint256 currentHp;
        uint256 currentAttack;
        uint256 currentSpeed;
        bool isOccupied;
    }

    /// @notice Structure for encounter results
    struct EncounterResult {
        int256 hpChange;
        string encounterDescription;
    }

    /// @notice Structure for character state
    struct CharacterState {
        address collection;
        uint256 tokenId;
        uint256 currentHp;
    }

    // ------------------------- Events -------------------------
    /// @notice Event emitted when an encounter is completed
    event EncounterCompleted(
        address indexed collection,
        uint256 indexed tokenId,
        uint256 roomNumber,
        uint256 xpGained,
        bool survived,
        string encounterDescription
    );

    /// @notice Event emitted when a dungeon run is completed
    event DungeonCompleted(address indexed collection, uint256 indexed tokenId);

    // ------------------------- External functions - Core game mechanics -------------------------
    /// @notice Add a new character to the dungeon queue
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    function enterDungeon(address collection, uint256 tokenId) external;

    // ------------------------- View functions -------------------------
    /// @notice Get the current room number for a character
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @return Current room number
    function getCharacterRoomNumber(
        address collection,
        uint256 tokenId
    ) external view returns (uint8);

    /// @notice Get the current room state for a character
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @return Current room state
    function getCharacterState(
        address collection,
        uint256 tokenId
    ) external view returns (CharacterState memory);

    /// @notice Get the state of a specific room
    /// @param roomNumber Room number to get state for
    /// @return CharacterState Memory of the room state
    function getRoomState(
        uint256 roomNumber
    ) external view returns (CharacterState memory);
}

File 7 of 11 : INFTStats.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/// @title INFTStats
/// @notice Interface for managing individual NFT stats and progression
interface INFTStats {
    // ------------------------- Type definitions -------------------------
    /// @notice Enum representing different rarity levels
    /// affects the stat variation of the NFT
    enum Rarity {
        Common,
        Uncommon,
        Rare,
        Epic,
        Legendary
    }

    /// @notice Structure for NFT permanent stats
    struct NFTStatsData {
        // Core Stats (256 bits)
        uint64 vitality; // Replaces HP
        uint64 strength; // Replaces attack
        uint64 agility; // Replaces speed
        uint64 defense; // New stat
        // Progression data (256 bits)
        uint32 level;
        uint96 currentXP;
        uint96 xpToNextLevel;
        uint32 dungeonRuns;
        uint32 successfulRuns;
        uint32 roomsCleared;
        bool initialized;
        Rarity rarity;
    }

    // ------------------------- Events - Stats -------------------------
    /// @notice Event emitted when an NFT's stats are initialized
    event StatsInitialized(
        address indexed collection,
        uint256 indexed tokenId,
        uint64 vitality,
        uint64 strength,
        uint64 agility,
        uint64 defense
    );

    /// @notice Event emitted when an NFT's stats are boosted
    event StatsBoosted(
        address indexed collection,
        uint256 indexed tokenId,
        uint64 newVitality,
        uint64 newStrength,
        uint64 newAgility,
        uint64 newDefense
    );

    // ------------------------- Events - Progression -------------------------
    /// @notice Event emitted when XP is gained
    event XPGained(
        address indexed collection,
        uint256 indexed tokenId,
        uint256 xpGained,
        uint256 newTotalXP
    );

    /// @notice Event emitted when a level up occurs
    event LevelUp(
        address indexed collection,
        uint256 indexed tokenId,
        uint256 newLevel
    );

    /// @notice Event emitted when a run is recorded
    event RunRecorded(
        address indexed collection,
        uint256 indexed tokenId,
        bool success,
        uint256 roomsCleared,
        uint256 xpGained
    );

    // ------------------------- View/Pure Functions -------------------------
    /// @notice Get current stats for an NFT
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @return NFTStatsData struct containing current stats
    function getStats(
        address collection,
        uint256 tokenId
    ) external view returns (NFTStatsData memory);

    /// @notice Check if an NFT has been initialized
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @return bool True if NFT has been initialized
    function isInitialized(
        address collection,
        uint256 tokenId
    ) external view returns (bool);

    /// @notice Calculate XP required for next level
    /// @param currentLevel Current level of the NFT
    /// @return uint256 XP required for next level
    function getXPForNextLevel(
        uint32 currentLevel
    ) external pure returns (uint96);

    /// @notice Get secondary stats derived from core stats
    /// @param vitality Character's vitality stat
    /// @param strength Character's strength stat
    /// @param agility Character's agility stat
    /// @param defense Character's defense stat
    /// @return criticalRate Chance to land critical hits (0-15)
    /// @return dodgeChance Chance to dodge attacks (0-10)
    /// @return blockRate Chance to block attacks (0-10)
    /// @return initiative Determines turn order in combat (0-100)
    function getSecondaryStats(
        uint64 vitality,
        uint64 strength,
        uint64 agility,
        uint64 defense
    )
        external
        pure
        returns (
            uint8 criticalRate,
            uint8 dodgeChance,
            uint8 blockRate,
            uint8 initiative
        );

    /// @notice Get the stat increases for a level up
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @return vitalityIncrease Amount vitality increases
    /// @return strengthIncrease Amount strength increases
    /// @return agilityIncrease Amount agility increases
    /// @return defenseIncrease Amount defense increases
    function getLevelUpStats(
        address collection,
        uint256 tokenId
    )
        external
        view
        returns (
            uint64 vitalityIncrease,
            uint64 strengthIncrease,
            uint64 agilityIncrease,
            uint64 defenseIncrease
        );

    // ------------------------- State-Changing Functions -------------------------
    /// @notice Initialize stats for an NFT based on its collection's base stats
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    function rollStats(address collection, uint256 tokenId) external;

    /// @notice Award XP for dungeon progress
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @param xpAmount Amount of XP to award
    /// @param roomsCleared Number of rooms cleared in this run
    function awardXP(
        address collection,
        uint256 tokenId,
        uint256 xpAmount,
        uint256 roomsCleared
    ) external;

    /// @notice Record a dungeon run attempt
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    /// @param success Whether the run was successful
    function recordRun(
        address collection,
        uint256 tokenId,
        bool success
    ) external;
}

File 8 of 11 : IPrizePool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/// @title IPrizePool
/// @notice Interface for managing dungeon rewards and prize distribution
interface IPrizePool {
    // ------------------------- Events -------------------------
    /// @notice Event emitted when entry fee is deposited
    event EntryFeeDeposited(
        address indexed collection,
        uint256 indexed tokenId,
        uint256 amount
    );

    /// @notice Event emitted when reward is claimed
    event RewardClaimed(
        address indexed collection,
        uint256 indexed tokenId,
        address indexed recipient,
        uint256 amount
    );

    /// @notice Event emitted when prize pool parameters are updated
    event PrizePoolParametersUpdated(uint256 entryFee, uint256 winnerShare);

    // ------------------------- External functions - Core mechanics -------------------------
    /// @notice Deposit entry fee for a dungeon run
    function depositEntryFee() external payable;

    /// @notice Register a winner and immediately transfer their prize
    /// @param collection Address of the NFT collection
    /// @param tokenId Token ID of the NFT
    function registerWinner(address collection, uint256 tokenId) external;

    // ------------------------- View functions -------------------------
    /// @notice Get current prize pool amount
    /// @return uint256 Current prize pool amount
    function getCurrentPrizePool() external view returns (uint256);

    /// @notice Gets the current entry fee
    /// @return uint256 Current entry fee
    function getEntryFee() external view returns (uint256);

    /// @notice Gets total entry fees collected
    /// @return uint256 Total entry fees
    function getTotalEntryFees() external view returns (uint256);

    /// @notice Gets total prizes paid out
    /// @return uint256 Total prizes paid
    function getTotalPrizesPaid() external view returns (uint256);

    /// @notice Gets current treasury balance
    /// @return uint256 Current treasury balance
    function getTreasuryBalance() external view returns (uint256);
}

File 9 of 11 : ICollectionRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/// @title ICollectionRegistry
/// @notice Interface for managing whitelisted NFT collections and their base stats
interface ICollectionRegistry {
    // ------------------------- Type definitions -------------------------
    /// @notice Enum for different class archetypes
    enum ClassArchetype {
        WARRIOR, // High strength/defense
        ROGUE, // High agility/critical
        PALADIN, // Balanced with healing
        BERSERKER // High damage/risk
    }

    /// @notice Stats structure for NFT collections
    struct CollectionStats {
        uint64 baseVitality;
        uint64 baseStrength;
        uint64 baseAgility;
        uint64 baseDefense;
        uint8 classType; // ClassArchetype
        uint8 complexity; // For gas limit determination
        bool isWhitelisted;
    }

    // ------------------------- Events -------------------------
    /// @notice Event emitted when a collection is whitelisted
    event CollectionWhitelisted(
        address indexed collection,
        uint64 baseVitality,
        uint64 baseStrength,
        uint64 baseAgility,
        uint64 baseDefense,
        ClassArchetype classType,
        uint8 complexity
    );

    /// @notice Event emitted when a collection's stats are updated
    event CollectionStatsUpdated(
        address indexed collection,
        uint64 baseVitality,
        uint64 baseStrength,
        uint64 baseAgility,
        uint64 baseDefense,
        ClassArchetype classType,
        uint8 complexity
    );

    /// @notice Event emitted when a collection is removed from whitelist
    event CollectionRemoved(address indexed collection);

    // ------------------------- Admin functions -------------------------
    /// @notice Whitelist a new NFT collection with base stats
    /// @param collection Address of the NFT collection
    /// @param baseVitality Initial vitality for NFTs from this collection
    /// @param baseStrength Initial strength for NFTs from this collection
    /// @param baseAgility Initial agility for NFTs from this collection
    /// @param baseDefense Initial defense for NFTs from this collection
    /// @param classType Class archetype for this collection
    /// @param complexity Gas complexity tier (1-3)
    function whitelistCollection(
        address collection,
        uint64 baseVitality,
        uint64 baseStrength,
        uint64 baseAgility,
        uint64 baseDefense,
        ClassArchetype classType,
        uint8 complexity
    ) external;

    /// @notice Update base stats for a whitelisted collection
    /// @param collection Address of the NFT collection
    /// @param baseVitality New base vitality
    /// @param baseStrength New base strength
    /// @param baseAgility New base agility
    /// @param baseDefense New base defense
    /// @param classType New class archetype
    /// @param complexity New complexity tier
    function updateCollectionStats(
        address collection,
        uint64 baseVitality,
        uint64 baseStrength,
        uint64 baseAgility,
        uint64 baseDefense,
        ClassArchetype classType,
        uint8 complexity
    ) external;

    /// @notice Remove a collection from the whitelist
    /// @param collection Address of the NFT collection to remove
    function removeCollection(address collection) external;

    // ------------------------- View functions -------------------------
    /// @notice Check if a collection is whitelisted
    /// @param collection Address of the NFT collection to check
    /// @return bool True if collection is whitelisted
    function isWhitelisted(address collection) external view returns (bool);

    /// @notice Get base stats for a collection
    /// @param collection Address of the NFT collection
    /// @return CollectionStats struct containing base stats
    function getCollectionStats(
        address collection
    ) external view returns (CollectionStats memory);
}

File 10 of 11 : 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;
    }
}

File 11 of 11 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC 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);
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@pythnetwork/entropy-sdk-solidity/=../node_modules/@pythnetwork/entropy-sdk-solidity/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "pyth-sdk-solidity/=lib/pyth-sdk-solidity/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "shanghai",
  "viaIR": false,
  "libraries": {
    "src/libraries/StatValidation.sol": {
      "StatValidation": "0x6E9a7a68Ae6B4B27D9D5494c034939C52a49b650"
    },
    "src/libraries/StatsCalculator.sol": {
      "StatsCalculator": "0x40bc4D559834F72951a83a8e098A6b969F1c79a8"
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_collectionRegistry","type":"address"},{"internalType":"address","name":"_nftStats","type":"address"},{"internalType":"uint256","name":"_initialEntryFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prizePool","type":"address"},{"indexed":true,"internalType":"address","name":"dungeonGame","type":"address"}],"name":"DungeonEntryInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"}],"name":"DungeonRunEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"entryFee","type":"uint256"}],"name":"DungeonRunStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"EntryFeeUpdated","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":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"RunExpired","type":"event"},{"inputs":[],"name":"collectionRegistry","outputs":[{"internalType":"contract ICollectionRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dungeonGame","outputs":[{"internalType":"contract IDungeonGame","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"success","type":"bool"}],"name":"endDungeonRun","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getEntryFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTimeRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"hasActiveRun","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_prizePool","type":"address"},{"internalType":"address","name":"_dungeonGame","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nftStats","outputs":[{"internalType":"contract INFTStats","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prizePool","outputs":[{"internalType":"contract IPrizePool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"startDungeonRun","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"updateEntryFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c060405234801562000010575f80fd5b5060405162001151380380620011518339810160408190526200003391620001a1565b33806200005a57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b620000658162000136565b50600180556001600160a01b038316620000c25760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420726567697374727920616464726573730000000000000000604482015260640162000051565b6001600160a01b0382166200011a5760405162461bcd60e51b815260206004820152601560248201527f496e76616c696420737461747320616464726573730000000000000000000000604482015260640162000051565b6001600160a01b03928316608052911660a052600455620001df565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200019c575f80fd5b919050565b5f805f60608486031215620001b4575f80fd5b620001bf8462000185565b9250620001cf6020850162000185565b9150604084015190509250925092565b60805160a051610f426200020f5f395f818161026b01526107b001525f81816101c001526105be0152610f425ff3fe6080604052600436106100d9575f3560e01c80638da5cb5b1161007c578063e586a4f011610057578063e586a4f01461023c578063e602ef361461025a578063f2fde38b1461028d578063f514b939146102ac575f80fd5b80638da5cb5b146101e2578063aa182626146101fe578063ceef46bd1461021d575f80fd5b8063620973fd116100b7578063620973fd14610169578063715018a61461017c578063719ce73e146101905780638c7cc5e3146101af575f80fd5b80632702abdf146100dd5780634592ad0914610111578063485cc95514610148575b5f80fd5b3480156100e8575f80fd5b506100fc6100f7366004610db1565b6102cb565b60405190151581526020015b60405180910390f35b34801561011c575f80fd5b50600354610130906001600160a01b031681565b6040516001600160a01b039091168152602001610108565b348015610153575f80fd5b50610167610162366004610ddb565b610390565b005b610167610177366004610db1565b610501565b348015610187575f80fd5b50610167610a45565b34801561019b575f80fd5b50600254610130906001600160a01b031681565b3480156101ba575f80fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b3480156101ed575f80fd5b505f546001600160a01b0316610130565b348015610209575f80fd5b50610167610218366004610e12565b610a58565b348015610228575f80fd5b50610167610237366004610e36565b610a9b565b348015610247575f80fd5b506004545b604051908152602001610108565b348015610265575f80fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b348015610298575f80fd5b506101676102a7366004610e75565b610bf9565b3480156102b7575f80fd5b5061024c6102c6366004610db1565b610c36565b6001600160a01b0382165f90815260056020908152604080832084845290915281205460ff166102fc57505f61038a565b6003546040516302f3972160e11b81526001600160a01b038581166004830152602482018590525f9216906305e72e4290604401602060405180830381865afa15801561034b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061036f9190610e97565b60ff169050805f03610384575f91505061038a565b60019150505b92915050565b610398610cf8565b600354600160a01b900460ff16156103ed5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064015b60405180910390fd5b6001600160a01b0382166104435760405162461bcd60e51b815260206004820152601a60248201527f496e76616c6964207072697a6520706f6f6c206164647265737300000000000060448201526064016103e4565b6001600160a01b0381166104995760405162461bcd60e51b815260206004820152601c60248201527f496e76616c69642064756e67656f6e2067616d6520616464726573730000000060448201526064016103e4565b600280546001600160a01b038085166001600160a01b03199092168217909255600380546001600160a81b031916928416928317600160a01b1790556040517fd3d631c04a19be365c7a93f9ac2327474a453b62a6f88ba5de9d90a0519ba9f9905f90a35050565b610509610d24565b600354600160a01b900460ff166105545760405162461bcd60e51b815260206004820152600f60248201526e139bdd081a5b9a5d1a585b1a5e9959608a1b60448201526064016103e4565b60045434101561059f5760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420656e7472792066656560501b60448201526064016103e4565b604051633af32abf60e01b81526001600160a01b0383811660048301527f00000000000000000000000000000000000000000000000000000000000000001690633af32abf90602401602060405180830381865afa158015610603573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106279190610eb7565b6106735760405162461bcd60e51b815260206004820152601a60248201527f436f6c6c656374696f6e206e6f742077686974656c697374656400000000000060448201526064016103e4565b6040516331a9108f60e11b81526004810182905233906001600160a01b03841690636352211e90602401602060405180830381865afa1580156106b8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106dc9190610ed2565b6001600160a01b0316146107225760405162461bcd60e51b815260206004820152600d60248201526c2737ba1027232a1037bbb732b960991b60448201526064016103e4565b6001600160a01b0382165f90815260056020908152604080832084845290915290205460ff161561078a5760405162461bcd60e51b815260206004820152601260248201527120b63932b0b23c9034b710323ab733b2b7b760711b60448201526064016103e4565b60405163994e4a1960e01b81526001600160a01b038381166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063994e4a1990604401602060405180830381865afa1580156107f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108199190610eb7565b6108655760405162461bcd60e51b815260206004820152601960248201527f4e4654207374617473206e6f7420696e697469616c697a65640000000000000060448201526064016103e4565b6003546040516304e8abf560e51b81526001600160a01b0384811660048301526024820184905290911690639d157ea0906044015f604051808303815f87803b1580156108b0575f80fd5b505af11580156108c2573d5f803e3d5ffd5b5050506001600160a01b038084165f908152600560209081526040808320868452909152808220805460ff19166001179055600254600480548351639e70b75f60e01b81529351929095169550639e70b75f9493838201939092919082900301818588803b158015610932575f80fd5b505af1158015610944573d5f803e3d5ffd5b50505050505f600454346109589190610eed565b905080156109e7576040515f90339083908381818185875af1925050503d805f811461099f576040519150601f19603f3d011682016040523d82523d5f602084013e6109a4565b606091505b50509050806109e55760405162461bcd60e51b815260206004820152600d60248201526c1499599d5b990819985a5b1959609a1b60448201526064016103e4565b505b336001600160a01b031682846001600160a01b03167f9136aa41ac12d9cb2394fa7b07f6ec0f9ba99460a55f53bf992fa2d48f2502ae600454604051610a2f91815260200190565b60405180910390a450610a4160018055565b5050565b610a4d610cf8565b610a565f610d4e565b565b610a60610cf8565b60048190556040518181527f24a0b2e591795f2c27be52ff14a57d0a39ac957304305bc05e8b04be49e8fe159060200160405180910390a150565b600354600160a01b900460ff16610ae65760405162461bcd60e51b815260206004820152600f60248201526e139bdd081a5b9a5d1a585b1a5e9959608a1b60448201526064016103e4565b6003546001600160a01b03163314610b315760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016103e4565b6001600160a01b0383165f90815260056020908152604080832085845290915290205460ff16610b945760405162461bcd60e51b815260206004820152600e60248201526d2737ba1034b710323ab733b2b7b760911b60448201526064016103e4565b6001600160a01b0383165f818152600560209081526040808320868452825291829020805460ff19169055905183151581528492917f9837bdef6316112d748f048a69f3dfe78e01cad7afc9ed2c69b63a94ec006a3d910160405180910390a3505050565b610c01610cf8565b6001600160a01b038116610c2a57604051631e4fbdf760e01b81525f60048201526024016103e4565b610c3381610d4e565b50565b6001600160a01b0382165f90815260056020908152604080832084845290915281205460ff16610c6757505f61038a565b6003546040516302f3972160e11b81526001600160a01b038581166004830152602482018590525f9216906305e72e4290604401602060405180830381865afa158015610cb6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cda9190610e97565b60ff169050805f03610cef575f91505061038a565b505f9392505050565b5f546001600160a01b03163314610a565760405163118cdaa760e01b81523360048201526024016103e4565b600260015403610d4757604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114610c33575f80fd5b5f8060408385031215610dc2575f80fd5b8235610dcd81610d9d565b946020939093013593505050565b5f8060408385031215610dec575f80fd5b8235610df781610d9d565b91506020830135610e0781610d9d565b809150509250929050565b5f60208284031215610e22575f80fd5b5035919050565b8015158114610c33575f80fd5b5f805f60608486031215610e48575f80fd5b8335610e5381610d9d565b9250602084013591506040840135610e6a81610e29565b809150509250925092565b5f60208284031215610e85575f80fd5b8135610e9081610d9d565b9392505050565b5f60208284031215610ea7575f80fd5b815160ff81168114610e90575f80fd5b5f60208284031215610ec7575f80fd5b8151610e9081610e29565b5f60208284031215610ee2575f80fd5b8151610e9081610d9d565b8181038181111561038a57634e487b7160e01b5f52601160045260245ffdfea2646970667358221220b281a37810dfc2a3b7ce0cc8821b86a3a4682c0cf381e190481745c1694e0a7464736f6c63430008140033000000000000000000000000d7fe5c4b54a62d96689138af1348e3af2d9ffb9e000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a00000000000000000000000000000000000000000000000000038d7ea4c68000

Deployed Bytecode

0x6080604052600436106100d9575f3560e01c80638da5cb5b1161007c578063e586a4f011610057578063e586a4f01461023c578063e602ef361461025a578063f2fde38b1461028d578063f514b939146102ac575f80fd5b80638da5cb5b146101e2578063aa182626146101fe578063ceef46bd1461021d575f80fd5b8063620973fd116100b7578063620973fd14610169578063715018a61461017c578063719ce73e146101905780638c7cc5e3146101af575f80fd5b80632702abdf146100dd5780634592ad0914610111578063485cc95514610148575b5f80fd5b3480156100e8575f80fd5b506100fc6100f7366004610db1565b6102cb565b60405190151581526020015b60405180910390f35b34801561011c575f80fd5b50600354610130906001600160a01b031681565b6040516001600160a01b039091168152602001610108565b348015610153575f80fd5b50610167610162366004610ddb565b610390565b005b610167610177366004610db1565b610501565b348015610187575f80fd5b50610167610a45565b34801561019b575f80fd5b50600254610130906001600160a01b031681565b3480156101ba575f80fd5b506101307f000000000000000000000000d7fe5c4b54a62d96689138af1348e3af2d9ffb9e81565b3480156101ed575f80fd5b505f546001600160a01b0316610130565b348015610209575f80fd5b50610167610218366004610e12565b610a58565b348015610228575f80fd5b50610167610237366004610e36565b610a9b565b348015610247575f80fd5b506004545b604051908152602001610108565b348015610265575f80fd5b506101307f000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a81565b348015610298575f80fd5b506101676102a7366004610e75565b610bf9565b3480156102b7575f80fd5b5061024c6102c6366004610db1565b610c36565b6001600160a01b0382165f90815260056020908152604080832084845290915281205460ff166102fc57505f61038a565b6003546040516302f3972160e11b81526001600160a01b038581166004830152602482018590525f9216906305e72e4290604401602060405180830381865afa15801561034b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061036f9190610e97565b60ff169050805f03610384575f91505061038a565b60019150505b92915050565b610398610cf8565b600354600160a01b900460ff16156103ed5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b60448201526064015b60405180910390fd5b6001600160a01b0382166104435760405162461bcd60e51b815260206004820152601a60248201527f496e76616c6964207072697a6520706f6f6c206164647265737300000000000060448201526064016103e4565b6001600160a01b0381166104995760405162461bcd60e51b815260206004820152601c60248201527f496e76616c69642064756e67656f6e2067616d6520616464726573730000000060448201526064016103e4565b600280546001600160a01b038085166001600160a01b03199092168217909255600380546001600160a81b031916928416928317600160a01b1790556040517fd3d631c04a19be365c7a93f9ac2327474a453b62a6f88ba5de9d90a0519ba9f9905f90a35050565b610509610d24565b600354600160a01b900460ff166105545760405162461bcd60e51b815260206004820152600f60248201526e139bdd081a5b9a5d1a585b1a5e9959608a1b60448201526064016103e4565b60045434101561059f5760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420656e7472792066656560501b60448201526064016103e4565b604051633af32abf60e01b81526001600160a01b0383811660048301527f000000000000000000000000d7fe5c4b54a62d96689138af1348e3af2d9ffb9e1690633af32abf90602401602060405180830381865afa158015610603573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106279190610eb7565b6106735760405162461bcd60e51b815260206004820152601a60248201527f436f6c6c656374696f6e206e6f742077686974656c697374656400000000000060448201526064016103e4565b6040516331a9108f60e11b81526004810182905233906001600160a01b03841690636352211e90602401602060405180830381865afa1580156106b8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106dc9190610ed2565b6001600160a01b0316146107225760405162461bcd60e51b815260206004820152600d60248201526c2737ba1027232a1037bbb732b960991b60448201526064016103e4565b6001600160a01b0382165f90815260056020908152604080832084845290915290205460ff161561078a5760405162461bcd60e51b815260206004820152601260248201527120b63932b0b23c9034b710323ab733b2b7b760711b60448201526064016103e4565b60405163994e4a1960e01b81526001600160a01b038381166004830152602482018390527f000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a169063994e4a1990604401602060405180830381865afa1580156107f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108199190610eb7565b6108655760405162461bcd60e51b815260206004820152601960248201527f4e4654207374617473206e6f7420696e697469616c697a65640000000000000060448201526064016103e4565b6003546040516304e8abf560e51b81526001600160a01b0384811660048301526024820184905290911690639d157ea0906044015f604051808303815f87803b1580156108b0575f80fd5b505af11580156108c2573d5f803e3d5ffd5b5050506001600160a01b038084165f908152600560209081526040808320868452909152808220805460ff19166001179055600254600480548351639e70b75f60e01b81529351929095169550639e70b75f9493838201939092919082900301818588803b158015610932575f80fd5b505af1158015610944573d5f803e3d5ffd5b50505050505f600454346109589190610eed565b905080156109e7576040515f90339083908381818185875af1925050503d805f811461099f576040519150601f19603f3d011682016040523d82523d5f602084013e6109a4565b606091505b50509050806109e55760405162461bcd60e51b815260206004820152600d60248201526c1499599d5b990819985a5b1959609a1b60448201526064016103e4565b505b336001600160a01b031682846001600160a01b03167f9136aa41ac12d9cb2394fa7b07f6ec0f9ba99460a55f53bf992fa2d48f2502ae600454604051610a2f91815260200190565b60405180910390a450610a4160018055565b5050565b610a4d610cf8565b610a565f610d4e565b565b610a60610cf8565b60048190556040518181527f24a0b2e591795f2c27be52ff14a57d0a39ac957304305bc05e8b04be49e8fe159060200160405180910390a150565b600354600160a01b900460ff16610ae65760405162461bcd60e51b815260206004820152600f60248201526e139bdd081a5b9a5d1a585b1a5e9959608a1b60448201526064016103e4565b6003546001600160a01b03163314610b315760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016103e4565b6001600160a01b0383165f90815260056020908152604080832085845290915290205460ff16610b945760405162461bcd60e51b815260206004820152600e60248201526d2737ba1034b710323ab733b2b7b760911b60448201526064016103e4565b6001600160a01b0383165f818152600560209081526040808320868452825291829020805460ff19169055905183151581528492917f9837bdef6316112d748f048a69f3dfe78e01cad7afc9ed2c69b63a94ec006a3d910160405180910390a3505050565b610c01610cf8565b6001600160a01b038116610c2a57604051631e4fbdf760e01b81525f60048201526024016103e4565b610c3381610d4e565b50565b6001600160a01b0382165f90815260056020908152604080832084845290915281205460ff16610c6757505f61038a565b6003546040516302f3972160e11b81526001600160a01b038581166004830152602482018590525f9216906305e72e4290604401602060405180830381865afa158015610cb6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cda9190610e97565b60ff169050805f03610cef575f91505061038a565b505f9392505050565b5f546001600160a01b03163314610a565760405163118cdaa760e01b81523360048201526024016103e4565b600260015403610d4757604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114610c33575f80fd5b5f8060408385031215610dc2575f80fd5b8235610dcd81610d9d565b946020939093013593505050565b5f8060408385031215610dec575f80fd5b8235610df781610d9d565b91506020830135610e0781610d9d565b809150509250929050565b5f60208284031215610e22575f80fd5b5035919050565b8015158114610c33575f80fd5b5f805f60608486031215610e48575f80fd5b8335610e5381610d9d565b9250602084013591506040840135610e6a81610e29565b809150509250925092565b5f60208284031215610e85575f80fd5b8135610e9081610d9d565b9392505050565b5f60208284031215610ea7575f80fd5b815160ff81168114610e90575f80fd5b5f60208284031215610ec7575f80fd5b8151610e9081610e29565b5f60208284031215610ee2575f80fd5b8151610e9081610d9d565b8181038181111561038a57634e487b7160e01b5f52601160045260245ffdfea2646970667358221220b281a37810dfc2a3b7ce0cc8821b86a3a4682c0cf381e190481745c1694e0a7464736f6c63430008140033

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

000000000000000000000000d7fe5c4b54a62d96689138af1348e3af2d9ffb9e000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a00000000000000000000000000000000000000000000000000038d7ea4c68000

-----Decoded View---------------
Arg [0] : _collectionRegistry (address): 0xD7FE5c4B54a62d96689138af1348e3aF2D9fFb9E
Arg [1] : _nftStats (address): 0xb23805e18B8b54d66cEfC22476973C87896DDd3A
Arg [2] : _initialEntryFee (uint256): 1000000000000000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000d7fe5c4b54a62d96689138af1348e3af2d9ffb9e
Arg [1] : 000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a
Arg [2] : 00000000000000000000000000000000000000000000000000038d7ea4c68000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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