Overview
APE Balance
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract contains unverified libraries: StatValidation, StatsCalculator
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
DungeonGame
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./interfaces/IDungeonGame.sol"; import "./interfaces/IDungeonEntry.sol"; import "./interfaces/INFTStats.sol"; import "./interfaces/IPrizePool.sol"; import "./libraries/EncounterLibrary.sol"; import "./libraries/StatsCalculator.sol"; /// @title DungeonGame /// @notice Core game logic for dungeon runs and encounters contract DungeonGame is IDungeonGame, Ownable(msg.sender), ReentrancyGuard { // ------------------------- Constants ------------------------- uint8 public constant ROOM_COUNT = 16; uint256 private constant BASE_XP = 100; uint256 private constant COMPLETION_BONUS = 500; // ------------------------- State variables ------------------------- CharacterState private emptyRoom = CharacterState({collection: address(0), tokenId: 0, currentHp: 0}); // Core contract references address public dungeonEntry; address public immutable nftStats; address public immutable prizePool; uint256 public currentIndex = 0; uint8 public startRoom = 0; CharacterState[ROOM_COUNT] public rooms; mapping(uint64 => CharacterState) private pendingEntries; mapping(address => mapping(uint256 => uint256)) private characterEntryIndex; // ------------------------- Events ------------------------- event FeesWithdrawn(address indexed owner, uint256 amount); event DungeonEntered( address indexed collection, uint256 indexed tokenId, uint256 indexed entryIndex ); event CharacterSurvived( address indexed collection, uint256 indexed tokenId, uint256 newHp, uint256 xpGained ); // ------------------------- Constructor ------------------------- constructor(address _dungeonEntry, address _nftStats, address _prizePool) { require(_dungeonEntry != address(0), "Invalid DungeonEntry address"); require(_nftStats != address(0), "Invalid NFTStats address"); require(_prizePool != address(0), "Invalid PrizePool address"); dungeonEntry = _dungeonEntry; nftStats = _nftStats; prizePool = _prizePool; } // ------------------------- External functions - Core game mechanics ------------------------- /// @notice Add a new character to the dungeon queue /// @dev Only DungeonEntry can add characters function enterDungeon(address collection, uint256 tokenId) external { require( msg.sender == address(dungeonEntry), "Only DungeonEntry can add characters" ); bytes32 randomNumber = keccak256( abi.encodePacked(block.timestamp, block.prevrandao) ); _processEntry(collection, tokenId, randomNumber); } // ------------------------- External functions - Admin ------------------------- /// @notice Withdraw accumulated fees from Pyth refunds /// @dev Only callable by contract owner function withdrawFees() external onlyOwner { uint256 balance = address(this).balance; require(balance > 0, "No fees to withdraw"); (bool success, ) = msg.sender.call{value: balance}(""); require(success, "Withdrawal failed"); emit FeesWithdrawn(msg.sender, balance); } function setDungeonEntry(address _dungeonEntry) external onlyOwner { require(_dungeonEntry != address(0), "Invalid dungeon entry address"); dungeonEntry = _dungeonEntry; } // ------------------------- External view functions ------------------------- /// @notice Get the state of a specific room function getRoomState( uint256 roomNumber ) external view returns (CharacterState memory) { require( roomNumber >= 0 && roomNumber <= ROOM_COUNT - 1, "Invalid room number" ); return rooms[roomNumber]; } function getAllRoomStates() external view returns (CharacterState[ROOM_COUNT] memory) { CharacterState[ROOM_COUNT] memory allRoomStates; for (uint8 i = 0; i < ROOM_COUNT; i++) { uint8 roomIndex = (ROOM_COUNT + startRoom - 1 - i) % ROOM_COUNT; allRoomStates[i] = rooms[roomIndex]; } return allRoomStates; } function getCharacterRoomNumber( address collection, uint256 tokenId ) public view returns (uint8) { uint256 entryIndex = characterEntryIndex[collection][tokenId]; require(entryIndex != 0, "Character not in dungeon"); uint8 roomNumber = uint8( (currentIndex - entryIndex + startRoom) % ROOM_COUNT ); return roomNumber; } function getCharacterState( address collection, uint256 tokenId ) external view returns (CharacterState memory) { uint8 roomNumber = getCharacterRoomNumber(collection, tokenId); return rooms[roomNumber]; } function getPendingEntry( uint64 sequenceNumber ) external view returns (CharacterState memory) { return pendingEntries[sequenceNumber]; } // ------------------------- Internal functions ------------------------- /// @notice Process encounter function _processEntry( address collection, uint256 tokenId, bytes32 randomNumber ) internal { // Push all characters forward one room, starting from the last room for (uint8 i = 0; i < ROOM_COUNT; i++) { uint8 roomIndex = (ROOM_COUNT + startRoom - 1 - i) % ROOM_COUNT; uint8 finalRoomIndex = (ROOM_COUNT + startRoom - 1) % ROOM_COUNT; CharacterState storage character = rooms[roomIndex]; // Skip empty rooms if (character.collection == address(0)) { continue; } EncounterLibrary.Encounter memory encounter = EncounterLibrary .generateEncounter( roomIndex + 1, // Add 1 since EncounterLibrary expects 1-based room numbers uint256(randomNumber) ); INFTStats.NFTStatsData memory characterStats = INFTStats(nftStats) .getStats(character.collection, character.tokenId); EncounterResult memory result = EncounterLibrary.processEncounter( encounter, characterStats ); int256 newHp = int256(character.currentHp) + result.hpChange; bool survived = newHp > 0; // Calculate XP (partial XP if failed) uint256 xpGained = survived ? encounter.baseXp : encounter.baseXp / 2; // Update character stats if (survived) { emit CharacterSurvived( character.collection, character.tokenId, uint256(newHp), xpGained ); character.currentHp = uint256(newHp); INFTStats(nftStats).awardXP( character.collection, character.tokenId, xpGained, 1 ); } // Only move if they survived the encounter if (survived) { if (roomIndex == finalRoomIndex) { // Character completed the dungeon _handleDungeonCompletion( character.collection, character.tokenId, roomIndex ); } } else { // End the run in DungeonEntry IDungeonEntry(dungeonEntry).endDungeonRun( character.collection, character.tokenId, false ); // Remove dead character rooms[roomIndex] = emptyRoom; } } INFTStats.NFTStatsData memory stats = INFTStats(nftStats).getStats( collection, tokenId ); // Store the entry index for this character characterEntryIndex[collection][tokenId] = currentIndex; // Place the new character in the start room rooms[startRoom] = CharacterState({ collection: collection, tokenId: tokenId, currentHp: StatsCalculator.calculateHp(stats.vitality) }); emit DungeonEntered(collection, tokenId, currentIndex); // Increment indices for next entry startRoom = (ROOM_COUNT + startRoom - 1) % ROOM_COUNT; currentIndex++; } function _handleDungeonCompletion( address collection, uint256 tokenId, uint8 roomIndex ) internal { // Award completion bonus XP INFTStats(nftStats).awardXP( collection, tokenId, COMPLETION_BONUS, ROOM_COUNT ); // Clear the last room rooms[roomIndex] = emptyRoom; characterEntryIndex[collection][tokenId] = 0; IPrizePool(prizePool).registerWinner(collection, tokenId); IDungeonEntry(dungeonEntry).endDungeonRun(collection, tokenId, true); emit DungeonCompleted(collection, tokenId); } // ------------------------- Receive function ------------------------- // Allow contract to receive native currency (for Pyth refunds) receive() external payable {} }
// 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); } }
// 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; } }
// 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); }
// 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); }
// 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); }
// 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; }
// 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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "../interfaces/IDungeonGame.sol"; import "../interfaces/INFTStats.sol"; /// @title EncounterLibrary /// @notice Library for generating and processing dungeon encounters library EncounterLibrary { // Encounter types enum EncounterType { Combat, // Standard combat encounter Trap, // Environmental hazard Blessing, // Positive encounter Elite, // Stronger combat encounter Boss // Room 16 boss encounter } // Encounter definition struct Encounter { EncounterType encounterType; uint256 difficulty; // 1-100 scale int256 baseHpChange; // Base HP modification int256 baseAttackMod; // Temporary attack modification int256 baseSpeedMod; // Temporary speed modification uint256 baseXp; // Base XP reward string description; // Encounter description } // Constants for encounter generation uint256 private constant BASE_DIFFICULTY_PER_ROOM = 6; // ~100 difficulty by room 16 uint256 private constant ELITE_CHANCE = 15; // 15% chance for elite encounter uint256 private constant BLESSING_CHANCE = 10; // 10% chance for blessing uint256 private constant TRAP_CHANCE = 20; // 20% chance for trap // Constants for encounter effects uint256 private constant BASE_DAMAGE = 20; uint256 private constant ELITE_DAMAGE_MULTIPLIER = 2; uint256 private constant BOSS_DAMAGE_MULTIPLIER = 3; int256 private constant MAX_STAT_MODIFICATION = 50; // Maximum temporary stat change /// @notice Generate an encounter for a specific room /// @param roomNumber Current room number (1-16) /// @param randomness Random number for encounter generation /// @return Encounter struct with encounter details function generateEncounter( uint256 roomNumber, uint256 randomness ) internal pure returns (Encounter memory) { require(roomNumber > 0 && roomNumber <= 16, "Invalid room number"); // Room 16 is always a boss encounter if (roomNumber == 16) { return _generateBossEncounter(); } // Use randomness to determine encounter type uint256 encounterRoll = randomness % 100; // Scale difficulty with room number uint256 difficulty = BASE_DIFFICULTY_PER_ROOM * roomNumber; // Select encounter type based on roll if (encounterRoll < BLESSING_CHANCE) { return _generateBlessing(roomNumber, difficulty); } else if (encounterRoll < BLESSING_CHANCE + TRAP_CHANCE) { return _generateTrap(roomNumber, difficulty); } else if ( encounterRoll < BLESSING_CHANCE + TRAP_CHANCE + ELITE_CHANCE ) { return _generateEliteEncounter(roomNumber, difficulty); } else { return _generateCombatEncounter(roomNumber, difficulty); } } /// @notice Process an encounter for a character /// @param encounter The encounter to process /// @param characterStats Current character stats /// @return IDungeonGame.EncounterResult Result of the encounter function processEncounter( Encounter memory encounter, INFTStats.NFTStatsData memory characterStats ) internal pure returns (IDungeonGame.EncounterResult memory) { // Calculate final HP change based on character stats int256 hpChange = _calculateHpChange(encounter, characterStats); return IDungeonGame.EncounterResult({ hpChange: hpChange, encounterDescription: encounter.description }); } // Internal encounter generation functions function _generateCombatEncounter( uint256 roomNumber, uint256 difficulty ) private pure returns (Encounter memory) { int256 damage = -int256(BASE_DAMAGE + (difficulty / 2)); return Encounter({ encounterType: EncounterType.Combat, difficulty: difficulty, baseHpChange: damage, baseAttackMod: 0, baseSpeedMod: 0, baseXp: 100 + (roomNumber * 10), description: "A hostile enemy appears!" }); } function _generateEliteEncounter( uint256 roomNumber, uint256 difficulty ) private pure returns (Encounter memory) { int256 damage = -int256( (BASE_DAMAGE + (difficulty / 2)) * ELITE_DAMAGE_MULTIPLIER ); return Encounter({ encounterType: EncounterType.Elite, difficulty: difficulty, baseHpChange: damage, baseAttackMod: int256(MAX_STAT_MODIFICATION / 2), baseSpeedMod: -int256(MAX_STAT_MODIFICATION / 4), baseXp: (150 + (roomNumber * 15)), description: "An elite enemy blocks your path!" }); } function _generateBossEncounter() private pure returns (Encounter memory) { return Encounter({ encounterType: EncounterType.Boss, difficulty: 100, baseHpChange: -int256(BASE_DAMAGE * BOSS_DAMAGE_MULTIPLIER), baseAttackMod: -int256(MAX_STAT_MODIFICATION), baseSpeedMod: -int256(MAX_STAT_MODIFICATION / 2), baseXp: 1000, description: "The dungeon boss emerges!" }); } function _generateBlessing( uint256 roomNumber, uint256 difficulty ) private pure returns (Encounter memory) { return Encounter({ encounterType: EncounterType.Blessing, difficulty: difficulty, baseHpChange: int256(BASE_DAMAGE), baseAttackMod: int256(MAX_STAT_MODIFICATION / 2), baseSpeedMod: int256(MAX_STAT_MODIFICATION / 2), baseXp: 50 + (roomNumber * 5), description: "You discover a magical blessing!" }); } function _generateTrap( uint256 roomNumber, uint256 difficulty ) private pure returns (Encounter memory) { return Encounter({ encounterType: EncounterType.Trap, difficulty: difficulty, baseHpChange: -int256(BASE_DAMAGE / 2), baseAttackMod: -int256(MAX_STAT_MODIFICATION / 4), baseSpeedMod: -int256(MAX_STAT_MODIFICATION / 4), baseXp: 75 + (roomNumber * 7), description: "You triggered a trap!" }); } // Internal helper functions function _calculateHpChange( Encounter memory encounter, INFTStats.NFTStatsData memory characterStats ) private pure returns (int256) { // Base damage int256 hpChange = encounter.baseHpChange; // Modify based on character stats if ( encounter.encounterType == EncounterType.Combat || encounter.encounterType == EncounterType.Elite || encounter.encounterType == EncounterType.Boss ) { // Higher attack reduces damage taken uint256 attackMitigation = characterStats.strength / 10; // Higher speed increases chance to dodge uint256 speedMitigation = characterStats.agility / 20; hpChange += int256(attackMitigation + speedMitigation); } return hpChange; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /// @title StatsCalculator /// @notice Library for calculating derived stats and combat values library StatsCalculator { // ------------------------- Constants ------------------------- uint8 private constant BASE_CRITICAL_RATE = 5; uint8 private constant MAX_CRITICAL_RATE = 15; uint8 private constant MAX_DODGE_CHANCE = 10; uint8 private constant MAX_BLOCK_RATE = 10; uint8 private constant CRITICAL_DAMAGE_PERCENT = 150; uint8 private constant BLOCK_REDUCTION_PERCENT = 50; uint256 private constant HP_PER_VITALITY = 5; // ------------------------- Core stat calculations ------------------------- /// @notice Calculate max HP from vitality /// @param vitality Character's vitality stat /// @return uint256 Maximum HP value function calculateHp(uint64 vitality) public pure returns (uint256) { return uint256(vitality) * HP_PER_VITALITY; } /// @notice Calculate damage considering strength and enemy defense /// @param strength Attacker's strength stat /// @param enemyDefense Defender's defense stat /// @return uint256 Base damage value function calculateDamage( uint64 strength, uint64 enemyDefense ) public pure returns (uint256) { return (uint256(strength) * 100) / (100 + uint256(enemyDefense)); } // ------------------------- Secondary stat calculations ------------------------- /// @notice Calculate all secondary 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 calculateSecondaryStats( uint64 vitality, uint64 strength, uint64 agility, uint64 defense ) public pure returns ( uint8 criticalRate, uint8 dodgeChance, uint8 blockRate, uint8 initiative ) { criticalRate = calculateCriticalRate(agility); dodgeChance = calculateDodgeChance(agility); blockRate = calculateBlockRate(defense); initiative = calculateInitiative(agility, strength); } /// @notice Calculate critical hit rate from agility /// @param agility Character's agility stat /// @return uint8 Critical hit chance (0-15) function calculateCriticalRate(uint64 agility) public pure returns (uint8) { uint8 critRate = BASE_CRITICAL_RATE + uint8(agility / 40); return critRate > MAX_CRITICAL_RATE ? MAX_CRITICAL_RATE : critRate; } /// @notice Calculate dodge chance from agility /// @param agility Character's agility stat /// @return uint8 Dodge chance (0-10) function calculateDodgeChance(uint64 agility) public pure returns (uint8) { uint8 dodgeChance = uint8(agility / 50); return dodgeChance > MAX_DODGE_CHANCE ? MAX_DODGE_CHANCE : dodgeChance; } /// @notice Calculate block rate from defense /// @param defense Character's defense stat /// @return uint8 Block chance (0-10) function calculateBlockRate(uint64 defense) public pure returns (uint8) { uint8 blockRate = uint8(defense / 50); return blockRate > MAX_BLOCK_RATE ? MAX_BLOCK_RATE : blockRate; } /// @notice Calculate initiative for combat order /// @param agility Character's agility stat /// @param strength Character's strength stat /// @return uint8 Initiative value (0-100) function calculateInitiative( uint64 agility, uint64 strength ) public pure returns (uint8) { return uint8(((uint256(agility) * 2) + uint256(strength)) / 3); } // ------------------------- Combat calculations ------------------------- /// @notice Calculate final damage including critical hits /// @param baseDamage Base damage amount /// @param criticalRate Critical hit chance /// @param entropy Random value for critical determination /// @return uint256 Final damage amount function calculateDamageWithCrit( uint256 baseDamage, uint8 criticalRate, bytes32 entropy ) public pure returns (uint256) { bool isCritical = uint8(uint256(entropy) & 0xFF) < criticalRate; return isCritical ? (baseDamage * CRITICAL_DAMAGE_PERCENT) / 100 : baseDamage; } /// @notice Calculate damage reduction from blocking /// @param incomingDamage Original damage amount /// @param blockRate Block chance /// @param entropy Random value for block determination /// @return uint256 Final damage after potential block function calculateDamageReduction( uint256 incomingDamage, uint8 blockRate, bytes32 entropy ) public pure returns (uint256) { bool isBlocked = uint8(uint256(entropy >> 8) & 0xFF) < blockRate; return isBlocked ? (incomingDamage * BLOCK_REDUCTION_PERCENT) / 100 : incomingDamage; } }
// 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; } }
// 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); }
{ "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
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_dungeonEntry","type":"address"},{"internalType":"address","name":"_nftStats","type":"address"},{"internalType":"address","name":"_prizePool","type":"address"}],"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":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newHp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xpGained","type":"uint256"}],"name":"CharacterSurvived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"DungeonCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"entryIndex","type":"uint256"}],"name":"DungeonEntered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"roomNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xpGained","type":"uint256"},{"indexed":false,"internalType":"bool","name":"survived","type":"bool"},{"indexed":false,"internalType":"string","name":"encounterDescription","type":"string"}],"name":"EncounterCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesWithdrawn","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"},{"inputs":[],"name":"ROOM_COUNT","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dungeonEntry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"enterDungeon","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllRoomStates","outputs":[{"components":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"currentHp","type":"uint256"}],"internalType":"struct IDungeonGame.CharacterState[16]","name":"","type":"tuple[16]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCharacterRoomNumber","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCharacterState","outputs":[{"components":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"currentHp","type":"uint256"}],"internalType":"struct IDungeonGame.CharacterState","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"sequenceNumber","type":"uint64"}],"name":"getPendingEntry","outputs":[{"components":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"currentHp","type":"uint256"}],"internalType":"struct IDungeonGame.CharacterState","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"roomNumber","type":"uint256"}],"name":"getRoomState","outputs":[{"components":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"currentHp","type":"uint256"}],"internalType":"struct IDungeonGame.CharacterState","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftStats","outputs":[{"internalType":"address","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":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rooms","outputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"currentHp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_dungeonEntry","type":"address"}],"name":"setDungeonEntry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startRoom","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6101206040525f60c081905260e0819052610100819052600280546001600160a01b0319169055600381905560048190556006556007805460ff1916905534801562000049575f80fd5b5060405162001f6438038062001f648339810160408190526200006c9162000242565b33806200009357604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6200009e81620001d7565b50600180556001600160a01b038316620000fb5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c69642044756e67656f6e456e74727920616464726573730000000060448201526064016200008a565b6001600160a01b038216620001535760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964204e465453746174732061646472657373000000000000000060448201526064016200008a565b6001600160a01b038116620001ab5760405162461bcd60e51b815260206004820152601960248201527f496e76616c6964205072697a65506f6f6c20616464726573730000000000000060448201526064016200008a565b600580546001600160a01b0319166001600160a01b039485161790559082166080521660a05262000289565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200023d575f80fd5b919050565b5f805f6060848603121562000255575f80fd5b620002608462000226565b9250620002706020850162000226565b9150620002806040850162000226565b90509250925092565b60805160a051611c96620002ce5f395f8181610284015261120e01525f818161034801528181610ac301528181610c1301528181610da801526111270152611c965ff3fe608060405260043610610108575f3560e01c8063715018a6116100925780639d157ea0116100625780639d157ea0146102f9578063b996e27d14610318578063e602ef3614610337578063f0477d791461036a578063f2fde38b14610389575f80fd5b8063715018a61461025f578063719ce73e146102735780637d304847146102be5780638da5cb5b146102dd575f80fd5b806326987b60116100d857806326987b60146101da5780633c42dd9c146101fd5780633dd5911114610211578063476343ee14610230578063607e9d7714610246575f80fd5b806305e72e421461011357806308f28b8f146101495780631911ce781461016a5780631bae0ac814610196575f80fd5b3661010f57005b5f80fd5b34801561011e575f80fd5b5061013261012d366004611801565b6103a8565b60405160ff90911681526020015b60405180910390f35b348015610154575f80fd5b5061015d61045a565b6040516101409190611829565b348015610175575f80fd5b50610189610184366004611897565b610531565b60405161014091906118b2565b3480156101a1575f80fd5b506101b56101b03660046118dc565b610584565b604080516001600160a01b039094168452602084019290925290820152606001610140565b3480156101e5575f80fd5b506101ef60065481565b604051908152602001610140565b348015610208575f80fd5b50610132601081565b34801561021c575f80fd5b5061018961022b3660046118dc565b6105b4565b34801561023b575f80fd5b5061024461065f565b005b348015610251575f80fd5b506007546101329060ff1681565b34801561026a575f80fd5b5061024461076d565b34801561027e575f80fd5b506102a67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610140565b3480156102c9575f80fd5b506102446102d83660046118f3565b610780565b3480156102e8575f80fd5b505f546001600160a01b03166102a6565b348015610304575f80fd5b50610244610313366004611801565b610800565b348015610323575f80fd5b506005546102a6906001600160a01b031681565b348015610342575f80fd5b506102a67f000000000000000000000000000000000000000000000000000000000000000081565b348015610375575f80fd5b50610189610384366004611801565b6108ab565b348015610394575f80fd5b506102446103a33660046118f3565b610914565b6001600160a01b0382165f90815260396020908152604080832084845290915281205480820361041f5760405162461bcd60e51b815260206004820152601860248201527f436861726163746572206e6f7420696e2064756e67656f6e000000000000000060448201526064015b60405180910390fd5b6007546006545f9160109160ff9091169061043b908590611920565b6104459190611933565b61044f919061195a565b925050505b92915050565b610462611759565b61046a611759565b5f5b601060ff8216101561052b576007545f9060109083906001906104929060ff168461196d565b61049c9190611986565b6104a69190611986565b6104b0919061199f565b905060088160ff16601081106104c8576104c86119c0565b604080516060810182526003929092029290920180546001600160a01b031682526001810154602083015260020154918101919091528360ff841660108110610513576105136119c0565b60200201525080610523816119d4565b91505061046c565b50919050565b610539611787565b5067ffffffffffffffff165f90815260386020908152604091829020825160608101845281546001600160a01b03168152600182015492810192909252600201549181019190915290565b60088160108110610593575f80fd5b60030201805460018201546002909201546001600160a01b03909116925083565b6105bc611787565b6105c860016010611986565b60ff168211156106105760405162461bcd60e51b815260206004820152601360248201527224b73b30b634b2103937b7b690373ab6b132b960691b6044820152606401610416565b60088260108110610623576106236119c0565b604080516060810182526003929092029290920180546001600160a01b0316825260018101546020830152600201549181019190915292915050565b610667610951565b47806106ab5760405162461bcd60e51b81526020600482015260136024820152724e6f206665657320746f20776974686472617760681b6044820152606401610416565b6040515f90339083908381818185875af1925050503d805f81146106ea576040519150601f19603f3d011682016040523d82523d5f602084013e6106ef565b606091505b50509050806107345760405162461bcd60e51b815260206004820152601160248201527015da5d1a191c985dd85b0819985a5b1959607a1b6044820152606401610416565b60405182815233907fc0819c13be868895eb93e40eaceb96de976442fa1d404e5c55f14bb65a8c489a9060200160405180910390a25050565b610775610951565b61077e5f61097d565b565b610788610951565b6001600160a01b0381166107de5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642064756e67656f6e20656e74727920616464726573730000006044820152606401610416565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031633146108665760405162461bcd60e51b8152602060048201526024808201527f4f6e6c792044756e67656f6e456e7472792063616e20616464206368617261636044820152637465727360e01b6064820152608401610416565b5f4244604051602001610883929190918252602082015260400190565b6040516020818303038152906040528051906020012090506108a68383836109cc565b505050565b6108b3611787565b5f6108be84846103a8565b905060088160ff16601081106108d6576108d66119c0565b604080516060810182526003929092029290920180546001600160a01b03168252600181015460208301526002015491810191909152949350505050565b61091c610951565b6001600160a01b03811661094557604051631e4fbdf760e01b81525f6004820152602401610416565b61094e8161097d565b50565b5f546001600160a01b0316331461077e5760405163118cdaa760e01b8152336004820152602401610416565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f5b601060ff82161015610d7f576007545f9060109083906001906109f49060ff168461196d565b6109fe9190611986565b610a089190611986565b610a12919061199f565b6007549091505f90601090600190610a2d9060ff168361196d565b610a379190611986565b610a41919061199f565b90505f60088360ff1660108110610a5a57610a5a6119c0565b6003020180549091506001600160a01b0316610a7857505050610d6d565b5f610a90610a8785600161196d565b60ff1687610fb2565b82546001840154604051630368516960e01b81526001600160a01b03928316600482015260248101919091529192505f917f00000000000000000000000000000000000000000000000000000000000000009091169063036851699060440161018060405180830381865afa158015610b0b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b2f9190611a7e565b90505f610b3c83836110b3565b90505f815f01518560020154610b529190611b68565b90505f8082139081610b745760028660a00151610b6f9190611b87565b610b7a565b8560a001515b90508115610c6d576001870154875460408051868152602081018590526001600160a01b03909216917f6dfed4d35f3671480d53c1b0f0cea670d9b92b20280e2cd62e65f9c0a0de5c4d910160405180910390a360028701839055865460018089015460405163012a988f60e31b81526001600160a01b03938416600482015260248101919091526044810184905260648101919091527f000000000000000000000000000000000000000000000000000000000000000090911690630954c478906084015f604051808303815f87803b158015610c56575f80fd5b505af1158015610c68573d5f803e3d5ffd5b505050505b8115610ca0578760ff168960ff1603610c9b5786546001880154610c9b916001600160a01b0316908b6110f2565b610d63565b6005548754600189015460405163ceef46bd60e01b81526001600160a01b03928316600482015260248101919091525f604482015291169063ceef46bd906064015f604051808303815f87803b158015610cf8575f80fd5b505af1158015610d0a573d5f803e3d5ffd5b50505050600260088a60ff1660108110610d2657610d266119c0565b82546003919091029190910180546001600160a01b0319166001600160a01b03909216919091178155600180830154908201556002918201549101555b5050505050505050505b80610d77816119d4565b9150506109ce565b50604051630368516960e01b81526001600160a01b038481166004830152602482018490525f917f00000000000000000000000000000000000000000000000000000000000000009091169063036851699060440161018060405180830381865afa158015610df0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e149190611a7e565b6006546001600160a01b0386165f81815260396020908152604080832089845282529182902093909355805160608101825291825291810186905282518251631cb19caf60e21b815267ffffffffffffffff909116600482015292935091908201907340bc4d559834f72951a83a8e098a6b969f1c79a8906372c672bc90602401602060405180830381865af4158015610eb0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ed49190611b9a565b905260075460089060ff1660108110610eef57610eef6119c0565b82516003919091029190910180546001600160a01b0319166001600160a01b0392831617815560208301516001820155604092830151600290910155600654915185918716907faef57a2e740e7aa2c0ef80e2d976766d8b4b1cc896fae50d9a4c15cc5f0b9c56905f90a4600754601090600190610f709060ff168361196d565b610f7a9190611986565b610f84919061199f565b6007805460ff191660ff9290921691909117905560068054905f610fa783611bb1565b919050555050505050565b610fba6117ae565b5f83118015610fca575060108311155b61100c5760405162461bcd60e51b815260206004820152601360248201527224b73b30b634b2103937b7b690373ab6b132b960691b6044820152606401610416565b826010036110235761101c611309565b9050610454565b5f61102f60648461195a565b90505f61103d856006611bc9565b9050600a82101561105b5761105285826113b2565b92505050610454565b6110676014600a611933565b821015611078576110528582611454565b600f6110866014600a611933565b6110909190611933565b8210156110a1576110528582611516565b61105285826115ee565b505092915050565b604080518082019091525f8152606060208201525f6110d284846116a2565b6040805180820190915290815260c0850151602082015291505092915050565b60405163012a988f60e31b81526001600160a01b038481166004830152602482018490526101f46044830152601060648301527f00000000000000000000000000000000000000000000000000000000000000001690630954c478906084015f604051808303815f87803b158015611168575f80fd5b505af115801561117a573d5f803e3d5ffd5b50505050600260088260ff1660108110611196576111966119c0565b82546003919091029190910180546001600160a01b0319166001600160a01b03928316178155600180840154908201556002928301549201919091558381165f818152603960209081526040808320878452909152808220919091555163f79edfcd60e01b81526004810191909152602481018490527f00000000000000000000000000000000000000000000000000000000000000009091169063f79edfcd906044015f604051808303815f87803b158015611251575f80fd5b505af1158015611263573d5f803e3d5ffd5b505060055460405163ceef46bd60e01b81526001600160a01b0387811660048301526024820187905260016044830152909116925063ceef46bd91506064015f604051808303815f87803b1580156112b9575f80fd5b505af11580156112cb573d5f803e3d5ffd5b50506040518492506001600160a01b03861691507f83c7c1485e35802f043337a3bbc33306ed0d06395209bcfa732d95eeab9776bb905f90a3505050565b6113116117ae565b6040805160e081018252600481526064602082015290810161133560036014611bc9565b61133e90611bf4565b815260200161134d6032611bf4565b815260200161135e60026032611c0e565b61136790611bf4565b81526020016103e881526020016040518060400160405280601981526020017f5468652064756e67656f6e20626f737320656d65726765732100000000000000815250815250905090565b6113ba6117ae565b6040805160e08101909152806002815260208101849052601460408201526060016113e760026032611c0e565b81526020016113f860026032611c0e565b8152602001611408856005611bc9565b611413906032611933565b81526040805180820190915260208082527f596f7520646973636f7665722061206d61676963616c20626c657373696e672182820152909101529392505050565b61145c6117ae565b6040805160e081018252600181526020810184905290810161148060026014611b87565b61148990611bf4565b815260200161149a60046032611c0e565b6114a390611bf4565b81526020016114b460046032611c0e565b6114bd90611bf4565b81526020016114cd856007611bc9565b6114d890604b611933565b815260200160405180604001604052806015815260200174596f7520747269676765726564206120747261702160581b815250815250905092915050565b61151e6117ae565b5f600261152b8185611b87565b611536906014611933565b6115409190611bc9565b61154990611bf4565b6040805160e08101825260038152602081018690529081018290529091506060810161157760026032611c0e565b815260200161158860046032611c0e565b61159190611bf4565b81526020016115a186600f611bc9565b6115ac906096611933565b81526040805180820190915260208082527f416e20656c69746520656e656d7920626c6f636b7320796f75722070617468218282015290910152949350505050565b6115f66117ae565b5f611602600284611b87565b61160d906014611933565b61161690611bf4565b6040805160e08101909152909150805f81526020018481526020018281526020015f81526020015f815260200185600a6116509190611bc9565b61165b906064611933565b81526020016040518060400160405280601881526020017f4120686f7374696c6520656e656d79206170706561727321000000000000000081525081525091505092915050565b60408201515f9081845160048111156116bd576116bd611be0565b14806116db57506003845160048111156116d9576116d9611be0565b145b806116f857506004845160048111156116f6576116f6611be0565b145b15611752575f600a846020015161170f9190611c3a565b67ffffffffffffffff1690505f6014856040015161172d9190611c3a565b67ffffffffffffffff1690506117438183611933565b61174d9084611b68565b925050505b9392505050565b6040518061020001604052806010905b611771611787565b8152602001906001900390816117695790505090565b60405180606001604052805f6001600160a01b031681526020015f81526020015f81525090565b6040805160e08101909152805f81526020015f81526020015f81526020015f81526020015f81526020015f8152602001606081525090565b80356001600160a01b03811681146117fc575f80fd5b919050565b5f8060408385031215611812575f80fd5b61181b836117e6565b946020939093013593505050565b610600810181835f5b60108110156118795761186383835180516001600160a01b0316825260208082015190830152604090810151910152565b6060929092019160209190910190600101611832565b50505092915050565b67ffffffffffffffff8116811461094e575f80fd5b5f602082840312156118a7575f80fd5b813561175281611882565b81516001600160a01b03168152602080830151908201526040808301519082015260608101610454565b5f602082840312156118ec575f80fd5b5035919050565b5f60208284031215611903575f80fd5b611752826117e6565b634e487b7160e01b5f52601160045260245ffd5b818103818111156104545761045461190c565b808201808211156104545761045461190c565b634e487b7160e01b5f52601260045260245ffd5b5f8261196857611968611946565b500690565b60ff81811683821601908111156104545761045461190c565b60ff82811682821603908111156104545761045461190c565b5f60ff8316806119b1576119b1611946565b8060ff84160691505092915050565b634e487b7160e01b5f52603260045260245ffd5b5f60ff821660ff81036119e9576119e961190c565b60010192915050565b604051610180810167ffffffffffffffff81118282101715611a2257634e487b7160e01b5f52604160045260245ffd5b60405290565b80516117fc81611882565b805163ffffffff811681146117fc575f80fd5b80516bffffffffffffffffffffffff811681146117fc575f80fd5b805180151581146117fc575f80fd5b8051600581106117fc575f80fd5b5f6101808284031215611a8f575f80fd5b611a976119f2565b611aa083611a28565b8152611aae60208401611a28565b6020820152611abf60408401611a28565b6040820152611ad060608401611a28565b6060820152611ae160808401611a33565b6080820152611af260a08401611a46565b60a0820152611b0360c08401611a46565b60c0820152611b1460e08401611a33565b60e0820152610100611b27818501611a33565b90820152610120611b39848201611a33565b90820152610140611b4b848201611a61565b90820152610160611b5d848201611a70565b908201529392505050565b8082018281125f8312801582168215821617156110ab576110ab61190c565b5f82611b9557611b95611946565b500490565b5f60208284031215611baa575f80fd5b5051919050565b5f60018201611bc257611bc261190c565b5060010190565b80820281158282048414176104545761045461190c565b634e487b7160e01b5f52602160045260245ffd5b5f600160ff1b8201611c0857611c0861190c565b505f0390565b5f82611c1c57611c1c611946565b600160ff1b82145f1984141615611c3557611c3561190c565b500590565b5f67ffffffffffffffff80841680611c5457611c54611946565b9216919091049291505056fea26469706673582212201d560f7cb5966279ba6d6024b4e7641868570005e2e20db43b22d833871f6d3064736f6c63430008140033000000000000000000000000cfb8214eeef1d9dcee7cd4d053004771eec938a7000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a0000000000000000000000009a53134e8d966ec2c3996f4b93bf8abbe1891b8e
Deployed Bytecode
0x608060405260043610610108575f3560e01c8063715018a6116100925780639d157ea0116100625780639d157ea0146102f9578063b996e27d14610318578063e602ef3614610337578063f0477d791461036a578063f2fde38b14610389575f80fd5b8063715018a61461025f578063719ce73e146102735780637d304847146102be5780638da5cb5b146102dd575f80fd5b806326987b60116100d857806326987b60146101da5780633c42dd9c146101fd5780633dd5911114610211578063476343ee14610230578063607e9d7714610246575f80fd5b806305e72e421461011357806308f28b8f146101495780631911ce781461016a5780631bae0ac814610196575f80fd5b3661010f57005b5f80fd5b34801561011e575f80fd5b5061013261012d366004611801565b6103a8565b60405160ff90911681526020015b60405180910390f35b348015610154575f80fd5b5061015d61045a565b6040516101409190611829565b348015610175575f80fd5b50610189610184366004611897565b610531565b60405161014091906118b2565b3480156101a1575f80fd5b506101b56101b03660046118dc565b610584565b604080516001600160a01b039094168452602084019290925290820152606001610140565b3480156101e5575f80fd5b506101ef60065481565b604051908152602001610140565b348015610208575f80fd5b50610132601081565b34801561021c575f80fd5b5061018961022b3660046118dc565b6105b4565b34801561023b575f80fd5b5061024461065f565b005b348015610251575f80fd5b506007546101329060ff1681565b34801561026a575f80fd5b5061024461076d565b34801561027e575f80fd5b506102a67f0000000000000000000000009a53134e8d966ec2c3996f4b93bf8abbe1891b8e81565b6040516001600160a01b039091168152602001610140565b3480156102c9575f80fd5b506102446102d83660046118f3565b610780565b3480156102e8575f80fd5b505f546001600160a01b03166102a6565b348015610304575f80fd5b50610244610313366004611801565b610800565b348015610323575f80fd5b506005546102a6906001600160a01b031681565b348015610342575f80fd5b506102a67f000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a81565b348015610375575f80fd5b50610189610384366004611801565b6108ab565b348015610394575f80fd5b506102446103a33660046118f3565b610914565b6001600160a01b0382165f90815260396020908152604080832084845290915281205480820361041f5760405162461bcd60e51b815260206004820152601860248201527f436861726163746572206e6f7420696e2064756e67656f6e000000000000000060448201526064015b60405180910390fd5b6007546006545f9160109160ff9091169061043b908590611920565b6104459190611933565b61044f919061195a565b925050505b92915050565b610462611759565b61046a611759565b5f5b601060ff8216101561052b576007545f9060109083906001906104929060ff168461196d565b61049c9190611986565b6104a69190611986565b6104b0919061199f565b905060088160ff16601081106104c8576104c86119c0565b604080516060810182526003929092029290920180546001600160a01b031682526001810154602083015260020154918101919091528360ff841660108110610513576105136119c0565b60200201525080610523816119d4565b91505061046c565b50919050565b610539611787565b5067ffffffffffffffff165f90815260386020908152604091829020825160608101845281546001600160a01b03168152600182015492810192909252600201549181019190915290565b60088160108110610593575f80fd5b60030201805460018201546002909201546001600160a01b03909116925083565b6105bc611787565b6105c860016010611986565b60ff168211156106105760405162461bcd60e51b815260206004820152601360248201527224b73b30b634b2103937b7b690373ab6b132b960691b6044820152606401610416565b60088260108110610623576106236119c0565b604080516060810182526003929092029290920180546001600160a01b0316825260018101546020830152600201549181019190915292915050565b610667610951565b47806106ab5760405162461bcd60e51b81526020600482015260136024820152724e6f206665657320746f20776974686472617760681b6044820152606401610416565b6040515f90339083908381818185875af1925050503d805f81146106ea576040519150601f19603f3d011682016040523d82523d5f602084013e6106ef565b606091505b50509050806107345760405162461bcd60e51b815260206004820152601160248201527015da5d1a191c985dd85b0819985a5b1959607a1b6044820152606401610416565b60405182815233907fc0819c13be868895eb93e40eaceb96de976442fa1d404e5c55f14bb65a8c489a9060200160405180910390a25050565b610775610951565b61077e5f61097d565b565b610788610951565b6001600160a01b0381166107de5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642064756e67656f6e20656e74727920616464726573730000006044820152606401610416565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031633146108665760405162461bcd60e51b8152602060048201526024808201527f4f6e6c792044756e67656f6e456e7472792063616e20616464206368617261636044820152637465727360e01b6064820152608401610416565b5f4244604051602001610883929190918252602082015260400190565b6040516020818303038152906040528051906020012090506108a68383836109cc565b505050565b6108b3611787565b5f6108be84846103a8565b905060088160ff16601081106108d6576108d66119c0565b604080516060810182526003929092029290920180546001600160a01b03168252600181015460208301526002015491810191909152949350505050565b61091c610951565b6001600160a01b03811661094557604051631e4fbdf760e01b81525f6004820152602401610416565b61094e8161097d565b50565b5f546001600160a01b0316331461077e5760405163118cdaa760e01b8152336004820152602401610416565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f5b601060ff82161015610d7f576007545f9060109083906001906109f49060ff168461196d565b6109fe9190611986565b610a089190611986565b610a12919061199f565b6007549091505f90601090600190610a2d9060ff168361196d565b610a379190611986565b610a41919061199f565b90505f60088360ff1660108110610a5a57610a5a6119c0565b6003020180549091506001600160a01b0316610a7857505050610d6d565b5f610a90610a8785600161196d565b60ff1687610fb2565b82546001840154604051630368516960e01b81526001600160a01b03928316600482015260248101919091529192505f917f000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a9091169063036851699060440161018060405180830381865afa158015610b0b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b2f9190611a7e565b90505f610b3c83836110b3565b90505f815f01518560020154610b529190611b68565b90505f8082139081610b745760028660a00151610b6f9190611b87565b610b7a565b8560a001515b90508115610c6d576001870154875460408051868152602081018590526001600160a01b03909216917f6dfed4d35f3671480d53c1b0f0cea670d9b92b20280e2cd62e65f9c0a0de5c4d910160405180910390a360028701839055865460018089015460405163012a988f60e31b81526001600160a01b03938416600482015260248101919091526044810184905260648101919091527f000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a90911690630954c478906084015f604051808303815f87803b158015610c56575f80fd5b505af1158015610c68573d5f803e3d5ffd5b505050505b8115610ca0578760ff168960ff1603610c9b5786546001880154610c9b916001600160a01b0316908b6110f2565b610d63565b6005548754600189015460405163ceef46bd60e01b81526001600160a01b03928316600482015260248101919091525f604482015291169063ceef46bd906064015f604051808303815f87803b158015610cf8575f80fd5b505af1158015610d0a573d5f803e3d5ffd5b50505050600260088a60ff1660108110610d2657610d266119c0565b82546003919091029190910180546001600160a01b0319166001600160a01b03909216919091178155600180830154908201556002918201549101555b5050505050505050505b80610d77816119d4565b9150506109ce565b50604051630368516960e01b81526001600160a01b038481166004830152602482018490525f917f000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a9091169063036851699060440161018060405180830381865afa158015610df0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e149190611a7e565b6006546001600160a01b0386165f81815260396020908152604080832089845282529182902093909355805160608101825291825291810186905282518251631cb19caf60e21b815267ffffffffffffffff909116600482015292935091908201907340bc4d559834f72951a83a8e098a6b969f1c79a8906372c672bc90602401602060405180830381865af4158015610eb0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ed49190611b9a565b905260075460089060ff1660108110610eef57610eef6119c0565b82516003919091029190910180546001600160a01b0319166001600160a01b0392831617815560208301516001820155604092830151600290910155600654915185918716907faef57a2e740e7aa2c0ef80e2d976766d8b4b1cc896fae50d9a4c15cc5f0b9c56905f90a4600754601090600190610f709060ff168361196d565b610f7a9190611986565b610f84919061199f565b6007805460ff191660ff9290921691909117905560068054905f610fa783611bb1565b919050555050505050565b610fba6117ae565b5f83118015610fca575060108311155b61100c5760405162461bcd60e51b815260206004820152601360248201527224b73b30b634b2103937b7b690373ab6b132b960691b6044820152606401610416565b826010036110235761101c611309565b9050610454565b5f61102f60648461195a565b90505f61103d856006611bc9565b9050600a82101561105b5761105285826113b2565b92505050610454565b6110676014600a611933565b821015611078576110528582611454565b600f6110866014600a611933565b6110909190611933565b8210156110a1576110528582611516565b61105285826115ee565b505092915050565b604080518082019091525f8152606060208201525f6110d284846116a2565b6040805180820190915290815260c0850151602082015291505092915050565b60405163012a988f60e31b81526001600160a01b038481166004830152602482018490526101f46044830152601060648301527f000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a1690630954c478906084015f604051808303815f87803b158015611168575f80fd5b505af115801561117a573d5f803e3d5ffd5b50505050600260088260ff1660108110611196576111966119c0565b82546003919091029190910180546001600160a01b0319166001600160a01b03928316178155600180840154908201556002928301549201919091558381165f818152603960209081526040808320878452909152808220919091555163f79edfcd60e01b81526004810191909152602481018490527f0000000000000000000000009a53134e8d966ec2c3996f4b93bf8abbe1891b8e9091169063f79edfcd906044015f604051808303815f87803b158015611251575f80fd5b505af1158015611263573d5f803e3d5ffd5b505060055460405163ceef46bd60e01b81526001600160a01b0387811660048301526024820187905260016044830152909116925063ceef46bd91506064015f604051808303815f87803b1580156112b9575f80fd5b505af11580156112cb573d5f803e3d5ffd5b50506040518492506001600160a01b03861691507f83c7c1485e35802f043337a3bbc33306ed0d06395209bcfa732d95eeab9776bb905f90a3505050565b6113116117ae565b6040805160e081018252600481526064602082015290810161133560036014611bc9565b61133e90611bf4565b815260200161134d6032611bf4565b815260200161135e60026032611c0e565b61136790611bf4565b81526020016103e881526020016040518060400160405280601981526020017f5468652064756e67656f6e20626f737320656d65726765732100000000000000815250815250905090565b6113ba6117ae565b6040805160e08101909152806002815260208101849052601460408201526060016113e760026032611c0e565b81526020016113f860026032611c0e565b8152602001611408856005611bc9565b611413906032611933565b81526040805180820190915260208082527f596f7520646973636f7665722061206d61676963616c20626c657373696e672182820152909101529392505050565b61145c6117ae565b6040805160e081018252600181526020810184905290810161148060026014611b87565b61148990611bf4565b815260200161149a60046032611c0e565b6114a390611bf4565b81526020016114b460046032611c0e565b6114bd90611bf4565b81526020016114cd856007611bc9565b6114d890604b611933565b815260200160405180604001604052806015815260200174596f7520747269676765726564206120747261702160581b815250815250905092915050565b61151e6117ae565b5f600261152b8185611b87565b611536906014611933565b6115409190611bc9565b61154990611bf4565b6040805160e08101825260038152602081018690529081018290529091506060810161157760026032611c0e565b815260200161158860046032611c0e565b61159190611bf4565b81526020016115a186600f611bc9565b6115ac906096611933565b81526040805180820190915260208082527f416e20656c69746520656e656d7920626c6f636b7320796f75722070617468218282015290910152949350505050565b6115f66117ae565b5f611602600284611b87565b61160d906014611933565b61161690611bf4565b6040805160e08101909152909150805f81526020018481526020018281526020015f81526020015f815260200185600a6116509190611bc9565b61165b906064611933565b81526020016040518060400160405280601881526020017f4120686f7374696c6520656e656d79206170706561727321000000000000000081525081525091505092915050565b60408201515f9081845160048111156116bd576116bd611be0565b14806116db57506003845160048111156116d9576116d9611be0565b145b806116f857506004845160048111156116f6576116f6611be0565b145b15611752575f600a846020015161170f9190611c3a565b67ffffffffffffffff1690505f6014856040015161172d9190611c3a565b67ffffffffffffffff1690506117438183611933565b61174d9084611b68565b925050505b9392505050565b6040518061020001604052806010905b611771611787565b8152602001906001900390816117695790505090565b60405180606001604052805f6001600160a01b031681526020015f81526020015f81525090565b6040805160e08101909152805f81526020015f81526020015f81526020015f81526020015f81526020015f8152602001606081525090565b80356001600160a01b03811681146117fc575f80fd5b919050565b5f8060408385031215611812575f80fd5b61181b836117e6565b946020939093013593505050565b610600810181835f5b60108110156118795761186383835180516001600160a01b0316825260208082015190830152604090810151910152565b6060929092019160209190910190600101611832565b50505092915050565b67ffffffffffffffff8116811461094e575f80fd5b5f602082840312156118a7575f80fd5b813561175281611882565b81516001600160a01b03168152602080830151908201526040808301519082015260608101610454565b5f602082840312156118ec575f80fd5b5035919050565b5f60208284031215611903575f80fd5b611752826117e6565b634e487b7160e01b5f52601160045260245ffd5b818103818111156104545761045461190c565b808201808211156104545761045461190c565b634e487b7160e01b5f52601260045260245ffd5b5f8261196857611968611946565b500690565b60ff81811683821601908111156104545761045461190c565b60ff82811682821603908111156104545761045461190c565b5f60ff8316806119b1576119b1611946565b8060ff84160691505092915050565b634e487b7160e01b5f52603260045260245ffd5b5f60ff821660ff81036119e9576119e961190c565b60010192915050565b604051610180810167ffffffffffffffff81118282101715611a2257634e487b7160e01b5f52604160045260245ffd5b60405290565b80516117fc81611882565b805163ffffffff811681146117fc575f80fd5b80516bffffffffffffffffffffffff811681146117fc575f80fd5b805180151581146117fc575f80fd5b8051600581106117fc575f80fd5b5f6101808284031215611a8f575f80fd5b611a976119f2565b611aa083611a28565b8152611aae60208401611a28565b6020820152611abf60408401611a28565b6040820152611ad060608401611a28565b6060820152611ae160808401611a33565b6080820152611af260a08401611a46565b60a0820152611b0360c08401611a46565b60c0820152611b1460e08401611a33565b60e0820152610100611b27818501611a33565b90820152610120611b39848201611a33565b90820152610140611b4b848201611a61565b90820152610160611b5d848201611a70565b908201529392505050565b8082018281125f8312801582168215821617156110ab576110ab61190c565b5f82611b9557611b95611946565b500490565b5f60208284031215611baa575f80fd5b5051919050565b5f60018201611bc257611bc261190c565b5060010190565b80820281158282048414176104545761045461190c565b634e487b7160e01b5f52602160045260245ffd5b5f600160ff1b8201611c0857611c0861190c565b505f0390565b5f82611c1c57611c1c611946565b600160ff1b82145f1984141615611c3557611c3561190c565b500590565b5f67ffffffffffffffff80841680611c5457611c54611946565b9216919091049291505056fea26469706673582212201d560f7cb5966279ba6d6024b4e7641868570005e2e20db43b22d833871f6d3064736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000cfb8214eeef1d9dcee7cd4d053004771eec938a7000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a0000000000000000000000009a53134e8d966ec2c3996f4b93bf8abbe1891b8e
-----Decoded View---------------
Arg [0] : _dungeonEntry (address): 0xcfb8214eEEf1d9dCEE7cd4D053004771EEC938A7
Arg [1] : _nftStats (address): 0xb23805e18B8b54d66cEfC22476973C87896DDd3A
Arg [2] : _prizePool (address): 0x9a53134E8d966eC2c3996f4B93Bf8aBBE1891B8e
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000cfb8214eeef1d9dcee7cd4d053004771eec938a7
Arg [1] : 000000000000000000000000b23805e18b8b54d66cefc22476973c87896ddd3a
Arg [2] : 0000000000000000000000009a53134e8d966ec2c3996f4b93bf8abbe1891b8e
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
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.