Overview
APE Balance
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xf4025f86...4e5263c90 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
NFTStats
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./interfaces/INFTStats.sol"; import "./interfaces/ICollectionRegistry.sol"; /// @title NFTStats /// @notice Manages individual NFT stats, experience, and leveling contract NFTStats is INFTStats, Ownable { // Reference to the collection registry ICollectionRegistry public immutable collectionRegistry; // Mapping from collection address and token ID to its stats mapping(address => mapping(uint256 => NFTStatsData)) private nftStats; // Constants for XP and leveling uint256 private constant BASE_XP_PER_LEVEL = 1000; uint256 private constant XP_MULTIPLIER = 150; // 150% increase per level uint256 private constant BASE_STAT_INCREASE_PERCENT = 5; // 5% increase per level uint256 private constant STARTING_LEVEL = 1; // Authorized contracts that can modify stats mapping(address => bool) private authorizedContracts; modifier onlyAuthorized() { require(msg.sender == owner() || authorizedContracts[msg.sender], "Not authorized"); _; } constructor(address _collectionRegistry) Ownable() { require(_collectionRegistry != address(0), "Invalid registry address"); collectionRegistry = ICollectionRegistry(_collectionRegistry); } /// @notice Set authorization for a contract to modify stats /// @param contract_ Address of the contract /// @param authorized Whether the contract should be authorized function setContractAuthorization(address contract_, bool authorized) external onlyOwner { require(contract_ != address(0), "Invalid contract address"); authorizedContracts[contract_] = authorized; } /// @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 initializeStats(address collection, uint256 tokenId) external onlyAuthorized { require(!nftStats[collection][tokenId].initialized, "Stats already initialized"); require(collectionRegistry.isWhitelisted(collection), "Collection not whitelisted"); // Verify NFT ownership try IERC721(collection).ownerOf(tokenId) returns (address) { // NFT exists, proceed with initialization } catch { revert("NFT does not exist"); } // Get base stats from collection registry ICollectionRegistry.CollectionStats memory baseStats = collectionRegistry.getCollectionStats(collection); // Initialize NFT stats nftStats[collection][tokenId] = NFTStatsData({ hp: baseStats.baseHp, attack: baseStats.baseAttack, speed: baseStats.baseSpeed, level: STARTING_LEVEL, currentXP: 0, xpToNextLevel: getXPForNextLevel(STARTING_LEVEL), dungeonRuns: 0, successfulRuns: 0, roomsCleared: 0, initialized: true }); emit StatsInitialized(collection, tokenId, baseStats.baseHp, baseStats.baseAttack, baseStats.baseSpeed); } /// @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 onlyAuthorized { require(nftStats[collection][tokenId].initialized, "Stats not initialized"); NFTStatsData storage stats = nftStats[collection][tokenId]; uint256 oldLevel = stats.level; // Update XP and rooms cleared stats.currentXP += xpAmount; stats.roomsCleared += roomsCleared; emit XPGained(collection, tokenId, xpAmount, stats.currentXP); // Check for level ups while (stats.currentXP >= stats.xpToNextLevel) { // Level up stats.level += 1; // Calculate stat increases (uint256 hpIncrease, uint256 attackIncrease, uint256 speedIncrease) = _calculateStatIncreases(stats); // Apply stat increases stats.hp += hpIncrease; stats.attack += attackIncrease; stats.speed += speedIncrease; // Set new XP threshold stats.currentXP -= stats.xpToNextLevel; stats.xpToNextLevel = getXPForNextLevel(stats.level); emit LevelUp(collection, tokenId, stats.level, stats.hp, stats.attack, stats.speed); } } /// @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 onlyAuthorized { require(nftStats[collection][tokenId].initialized, "Stats not initialized"); NFTStatsData storage stats = nftStats[collection][tokenId]; stats.dungeonRuns += 1; if (success) { stats.successfulRuns += 1; } emit RunRecorded(collection, tokenId, success, stats.roomsCleared, stats.currentXP); } /// @notice Calculate XP required for next level /// @param currentLevel Current level of the NFT /// @return uint256 XP required for next level function getXPForNextLevel(uint256 currentLevel) public pure returns (uint256) { return BASE_XP_PER_LEVEL * (currentLevel * XP_MULTIPLIER / 100); } /// @notice Get the stat increases for a level up /// @param collection Address of the NFT collection /// @param tokenId Token ID of the NFT /// @return hpIncrease Amount HP increases /// @return attackIncrease Amount Attack increases /// @return speedIncrease Amount Speed increases function getLevelUpStats( address collection, uint256 tokenId ) external view returns ( uint256 hpIncrease, uint256 attackIncrease, uint256 speedIncrease ) { require(nftStats[collection][tokenId].initialized, "Stats not initialized"); return _calculateStatIncreases(nftStats[collection][tokenId]); } /// @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) { return nftStats[collection][tokenId]; } /// @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) { return nftStats[collection][tokenId].initialized; } /// @notice Calculate stat increases for a level up /// @param stats Current stats of the NFT /// @return hpIncrease Amount HP increases /// @return attackIncrease Amount Attack increases /// @return speedIncrease Amount Speed increases function _calculateStatIncreases( NFTStatsData memory stats ) internal pure returns ( uint256 hpIncrease, uint256 attackIncrease, uint256 speedIncrease ) { hpIncrease = (stats.hp * BASE_STAT_INCREASE_PERCENT) / 100; attackIncrease = (stats.attack * BASE_STAT_INCREASE_PERCENT) / 100; speedIncrease = (stats.speed * BASE_STAT_INCREASE_PERCENT) / 100; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../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. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @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 { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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 v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * 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.19; /// @title INFTStats /// @notice Interface for managing individual NFT stats and progression interface INFTStats { /// @notice Structure for NFT permanent stats struct NFTStatsData { uint256 hp; uint256 attack; uint256 speed; uint256 level; uint256 currentXP; uint256 xpToNextLevel; uint256 dungeonRuns; uint256 successfulRuns; uint256 roomsCleared; bool initialized; } /// @notice Event emitted when an NFT's stats are initialized event StatsInitialized(address indexed collection, uint256 indexed tokenId, uint256 hp, uint256 attack, uint256 speed); /// @notice Event emitted when an NFT's stats are boosted event StatsBoosted(address indexed collection, uint256 indexed tokenId, uint256 newHp, uint256 newAttack, uint256 newSpeed); /// @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, uint256 newHp, uint256 newAttack, uint256 newSpeed); /// @notice Event emitted when a run is recorded event RunRecorded(address indexed collection, uint256 indexed tokenId, bool success, uint256 roomsCleared, uint256 xpGained); /// @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 initializeStats(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 Calculate XP required for next level /// @param currentLevel Current level of the NFT /// @return uint256 XP required for next level function getXPForNextLevel(uint256 currentLevel) external pure returns (uint256); /// @notice Get the stat increases for a level up /// @param collection Address of the NFT collection /// @param tokenId Token ID of the NFT /// @return hpIncrease Amount HP increases /// @return attackIncrease Amount Attack increases /// @return speedIncrease Amount Speed increases function getLevelUpStats( address collection, uint256 tokenId ) external view returns ( uint256 hpIncrease, uint256 attackIncrease, uint256 speedIncrease ); /// @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; /// @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; /// @title ICollectionRegistry /// @notice Interface for managing whitelisted NFT collections and their base stats interface ICollectionRegistry { /// @notice Stats structure for NFT collections struct CollectionStats { uint256 baseHp; uint256 baseAttack; uint256 baseSpeed; bool isWhitelisted; } /// @notice Event emitted when a collection is whitelisted event CollectionWhitelisted(address indexed collection, uint256 baseHp, uint256 baseAttack, uint256 baseSpeed); /// @notice Event emitted when a collection's stats are updated event CollectionStatsUpdated(address indexed collection, uint256 baseHp, uint256 baseAttack, uint256 baseSpeed); /// @notice Event emitted when a collection is removed from whitelist event CollectionRemoved(address indexed collection); /// @notice Whitelist a new NFT collection with base stats /// @param collection Address of the NFT collection /// @param baseHp Initial HP for NFTs from this collection /// @param baseAttack Initial Attack for NFTs from this collection /// @param baseSpeed Initial Speed for NFTs from this collection function whitelistCollection( address collection, uint256 baseHp, uint256 baseAttack, uint256 baseSpeed ) external; /// @notice Update base stats for a whitelisted collection /// @param collection Address of the NFT collection /// @param baseHp New base HP /// @param baseAttack New base Attack /// @param baseSpeed New base Speed function updateCollectionStats( address collection, uint256 baseHp, uint256 baseAttack, uint256 baseSpeed ) external; /// @notice Remove a collection from the whitelist /// @param collection Address of the NFT collection to remove function removeCollection(address collection) external; /// @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "forge-std/=lib/forge-std/src/", "@pythnetwork/=lib/@pythnetwork/", "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": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_collectionRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLevel","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newHp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAttack","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"LevelUp","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"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint256","name":"roomsCleared","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"xpGained","type":"uint256"}],"name":"RunRecorded","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":"newHp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAttack","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"StatsBoosted","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":"hp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"attack","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"speed","type":"uint256"}],"name":"StatsInitialized","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":"xpGained","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalXP","type":"uint256"}],"name":"XPGained","type":"event"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"xpAmount","type":"uint256"},{"internalType":"uint256","name":"roomsCleared","type":"uint256"}],"name":"awardXP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectionRegistry","outputs":[{"internalType":"contract ICollectionRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLevelUpStats","outputs":[{"internalType":"uint256","name":"hpIncrease","type":"uint256"},{"internalType":"uint256","name":"attackIncrease","type":"uint256"},{"internalType":"uint256","name":"speedIncrease","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getStats","outputs":[{"components":[{"internalType":"uint256","name":"hp","type":"uint256"},{"internalType":"uint256","name":"attack","type":"uint256"},{"internalType":"uint256","name":"speed","type":"uint256"},{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"uint256","name":"currentXP","type":"uint256"},{"internalType":"uint256","name":"xpToNextLevel","type":"uint256"},{"internalType":"uint256","name":"dungeonRuns","type":"uint256"},{"internalType":"uint256","name":"successfulRuns","type":"uint256"},{"internalType":"uint256","name":"roomsCleared","type":"uint256"},{"internalType":"bool","name":"initialized","type":"bool"}],"internalType":"struct INFTStats.NFTStatsData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"currentLevel","type":"uint256"}],"name":"getXPForNextLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"initializeStats","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","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":"recordRun","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contract_","type":"address"},{"internalType":"bool","name":"authorized","type":"bool"}],"name":"setContractAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806391f6c6581161007157806391f6c65814610170578063994e4a1914610183578063b3393115146101cf578063ea682d80146101fd578063f2fde38b14610210578063f60ccc861461022357600080fd5b806303685169146100b95780630954c478146100e25780634220be23146100f7578063715018a6146101185780638c7cc5e3146101205780638da5cb5b1461015f575b600080fd5b6100cc6100c7366004610eb1565b610236565b6040516100d99190610edd565b60405180910390f35b6100f56100f0366004610f58565b61032c565b005b61010a610105366004610f93565b610610565b6040519081526020016100d9565b6100f5610635565b6101477f0000000000000000000000004d574b520af1532aefa6f9819d252a992f6c570181565b6040516001600160a01b0390911681526020016100d9565b6000546001600160a01b0316610147565b6100f561017e366004610fba565b610649565b6101bf610191366004610eb1565b6001600160a01b03919091166000908152600160209081526040808320938352929052206009015460ff1690565b60405190151581526020016100d9565b6101e26101dd366004610eb1565b61078f565b604080519384526020840192909252908201526060016100d9565b6100f561020b366004610eb1565b610885565b6100f561021e366004610ffc565b610c88565b6100f5610231366004611020565b610d01565b61028e6040518061014001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b506001600160a01b03821660009081526001602081815260408084208585528252928390208351610140810185528154815292810154918301919091526002810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c0820152600782015460e0820152600882015461010082015260099091015460ff1615156101208201525b92915050565b6000546001600160a01b031633148061035457503360009081526002602052604090205460ff165b6103795760405162461bcd60e51b815260040161037090611059565b60405180910390fd5b6001600160a01b038416600090815260016020908152604080832086845290915290206009015460ff166103bf5760405162461bcd60e51b815260040161037090611081565b6001600160a01b038416600090815260016020908152604080832086845290915281206003810154600482018054929391928692906103ff9084906110c6565b925050819055508282600801600082825461041a91906110c6565b9091555050600482015460408051868152602081019290925286916001600160a01b038916917f1cfcc60a52168386067c020abab02289b7dee02c9a7e9690aeff3c3aa53e24a8910160405180910390a35b816005015482600401541061060857600182600301600082825461049091906110c6565b9091555050604080516101408101825283548152600184015460208201526002840154918101919091526003830154606082015260048301546080820152600583015460a0820152600683015460c0820152600783015460e08201526008830154610100820152600983015460ff1615156101208201526000908190819061051790610d8a565b9250925092508285600001600082825461053191906110c6565b925050819055508185600101600082825461054c91906110c6565b925050819055508085600201600082825461056791906110c6565b909155505060058501546004860180546000906105859084906110d9565b9091555050600385015461059890610610565b6005860155600385015485546001870154600288015460408051948552602085019390935291830152606082015288906001600160a01b038b16907f27f00c6eee3ecfb97cfd2cb07c92835fdeb914a06a100767f6708ce2fbb5a5f89060800160405180910390a350505061046c565b505050505050565b6000606461061f6096846110ec565b6106299190611103565b610326906103e86110ec565b61063d610df2565b6106476000610e4c565b565b6000546001600160a01b031633148061067157503360009081526002602052604090205460ff165b61068d5760405162461bcd60e51b815260040161037090611059565b6001600160a01b038316600090815260016020908152604080832085845290915290206009015460ff166106d35760405162461bcd60e51b815260040161037090611081565b6001600160a01b038316600090815260016020818152604080842086855290915282206006810180549193909161070b9084906110c6565b9091555050811561073157600181600701600082825461072b91906110c6565b90915550505b60088101546004820154604080518515158152602081019390935282015283906001600160a01b038616907fe6ce2da96a964985bd161cb1f6b383b07d1f2fed13aef14028de4503dfeb81d29060600160405180910390a350505050565b6001600160a01b03821660009081526001602090815260408083208484529091528120600901548190819060ff166107d95760405162461bcd60e51b815260040161037090611081565b6001600160a01b03851660009081526001602081815260408084208885528252928390208351610140810185528154815292810154918301919091526002810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c0820152600782015460e0820152600882015461010082015260099091015460ff16151561012082015261087890610d8a565b9250925092509250925092565b6000546001600160a01b03163314806108ad57503360009081526002602052604090205460ff165b6108c95760405162461bcd60e51b815260040161037090611059565b6001600160a01b038216600090815260016020908152604080832084845290915290206009015460ff16156109405760405162461bcd60e51b815260206004820152601960248201527f537461747320616c726561647920696e697469616c697a6564000000000000006044820152606401610370565b604051633af32abf60e01b81526001600160a01b0383811660048301527f0000000000000000000000004d574b520af1532aefa6f9819d252a992f6c57011690633af32abf90602401602060405180830381865afa1580156109a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ca9190611125565b610a165760405162461bcd60e51b815260206004820152601a60248201527f436f6c6c656374696f6e206e6f742077686974656c69737465640000000000006044820152606401610370565b6040516331a9108f60e11b8152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa925050508015610a77575060408051601f3d908101601f19168201909252610a7491810190611142565b60015b610ab85760405162461bcd60e51b815260206004820152601260248201527113919508191bd95cc81b9bdd08195e1a5cdd60721b6044820152606401610370565b50604051631cc6f28360e31b81526001600160a01b0383811660048301526000917f0000000000000000000000004d574b520af1532aefa6f9819d252a992f6c57019091169063e637941890602401608060405180830381865afa158015610b24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b48919061115f565b90506040518061014001604052808260000151815260200182602001518152602001826040015181526020016001815260200160008152602001610b8c6001610610565b81526000602080830182905260408084018390526060808501849052600160809586018190526001600160a01b038a168086528185528386208a875285529483902087518155878501519181019190915586830151600282015586820151600382015594860151600486015560a0860151600586015560c0860151600686015560e086015160078601556101008601516008860155610120909501516009909401805460ff1916941515949094179093558451858201518685015185519283529282015292830152849290917f32c0a0e7ad6c4e9521aaa8ec2a134505ae98bfb6b39a618b287ae78b7aa22dd1910160405180910390a3505050565b610c90610df2565b6001600160a01b038116610cf55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610370565b610cfe81610e4c565b50565b610d09610df2565b6001600160a01b038216610d5f5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420636f6e7472616374206164647265737300000000000000006044820152606401610370565b6001600160a01b03919091166000908152600260205260409020805460ff1916911515919091179055565b6000806000606460058560000151610da291906110ec565b610dac9190611103565b9250606460058560200151610dc191906110ec565b610dcb9190611103565b9150606460058560400151610de091906110ec565b610dea9190611103565b929491935050565b6000546001600160a01b031633146106475760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610370565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114610cfe57600080fd5b60008060408385031215610ec457600080fd5b8235610ecf81610e9c565b946020939093013593505050565b600061014082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525061012080840151610f508285018215159052565b505092915050565b60008060008060808587031215610f6e57600080fd5b8435610f7981610e9c565b966020860135965060408601359560600135945092505050565b600060208284031215610fa557600080fd5b5035919050565b8015158114610cfe57600080fd5b600080600060608486031215610fcf57600080fd5b8335610fda81610e9c565b9250602084013591506040840135610ff181610fac565b809150509250925092565b60006020828403121561100e57600080fd5b813561101981610e9c565b9392505050565b6000806040838503121561103357600080fd5b823561103e81610e9c565b9150602083013561104e81610fac565b809150509250929050565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b60208082526015908201527414dd185d1cc81b9bdd081a5b9a5d1a585b1a5e9959605a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610326576103266110b0565b81810381811115610326576103266110b0565b8082028115828204841417610326576103266110b0565b60008261112057634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561113757600080fd5b815161101981610fac565b60006020828403121561115457600080fd5b815161101981610e9c565b60006080828403121561117157600080fd5b6040516080810181811067ffffffffffffffff821117156111a257634e487b7160e01b600052604160045260246000fd5b806040525082518152602083015160208201526040830151604082015260608301516111cd81610fac565b6060820152939250505056fea26469706673582212204bf04df1181e14474a6a967244a9d054b88c2f8d83b359a0883bc183ccc89e0564736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.