Overview
POL Balance
0 POL
POL Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
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:
GameItems
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import {AccessControlUpgradeable} from '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; import {Initializable} from '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import {UUPSUpgradeable} from '@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol'; import {ERC1155Upgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol'; import {ERC1155BurnableUpgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol'; import {ERC1155SupplyUpgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol'; import {ERC1155URIStorageUpgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol'; import {PausableUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol'; import {ContextMixin} from './utils/ContextMixin.sol'; interface IRandom { function getRandomNumber() external returns (uint); } /** * GameItems are tokens that are directly mintable via mint() and mintWithGold(). */ struct GameItem { uint256 ID; uint256 rarity; // lower is more rare bool isDiscontinued; uint256 mintLimit; } /** * ProcessableItems are tokens that can be processed from other tokens. * These have inputs (tokens that are burned) and outputs (tokens that are minted). * The outputs are ALWAYS chosen randomly, and the user will randomly receive ONE OF the outputs. */ struct ProcessableItem { uint256[] inputs; uint256[] outputs; uint256[] outputRarities; bool isDiscontinued; } contract GameItems is Initializable, ERC1155Upgradeable, AccessControlUpgradeable, PausableUpgradeable, ERC1155BurnableUpgradeable, ERC1155SupplyUpgradeable, ERC1155URIStorageUpgradeable, UUPSUpgradeable, ContextMixin { bytes32 public constant COST_TO_MINT_SETTER_ROLE = keccak256('COST_TO_MINT_SETTER_ROLE'); bytes32 public constant GAME_ITEM_MANAGER_ROLE = keccak256('GAME_ITEM_MANAGER_ROLE'); bytes32 public constant PAUSER_ROLE = keccak256('PAUSER_ROLE'); bytes32 public constant UPGRADER_ROLE = keccak256('UPGRADER_ROLE'); bytes32 public constant URI_SETTER_ROLE = keccak256('URI_SETTER_ROLE'); bytes32 public constant WITHDRAWER_ROLE = keccak256('WITHDRAWER_ROLE'); address rng; string public name; string public contractURI; // contract-level metadata (https://docs.opensea.io/docs/contract-level-metadata) uint public costToMint; mapping(uint => GameItem) gameItems; // gameItemID => GameItem uint[] gameItemIDs; // list of all game item IDs uint public goldReceivedPerAlchedToken; uint public goldCostToMint; mapping(uint => ProcessableItem) processableItems; // processableID => ProcessableItem error ErrCostToMintNotSet(); error ErrGoldCostToMintNotSet(); error ErrIncorrectAmountPaid(uint sent, uint required); error ErrNoTokenToMint(); event GameItemUpdated(uint indexed id, uint rarity, uint mintLimit, bool isDiscontinued); event Mint(uint indexed gameItemID, address indexed to, string requestID); modifier needsRNG() { require(rng != address(0), 'rng not set'); _; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize() public initializer { __ERC1155_init(''); __AccessControl_init(); __Pausable_init(); __ERC1155Burnable_init(); __ERC1155Supply_init(); __UUPSUpgradeable_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); name = 'Anthology'; } function pause() public onlyRole(PAUSER_ROLE) { _pause(); } function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } function _authorizeUpgrade( address newImplementation ) internal override onlyRole(UPGRADER_ROLE) {} // The following functions are overrides required by Solidity. function supportsInterface( bytes4 interfaceId ) public view override(ERC1155Upgradeable, AccessControlUpgradeable) returns (bool) { return super.supportsInterface(interfaceId); } function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) { ERC1155SupplyUpgradeable._update(from, to, ids, values); } function setContractURI(string memory _newContractURI) public onlyRole(URI_SETTER_ROLE) { contractURI = _newContractURI; } function setCostToMint(uint newCost) public onlyRole(COST_TO_MINT_SETTER_ROLE) { require(newCost > 0, 'Cost to mint must be greater than 0'); costToMint = newCost; } function setGoldCostToMint(uint newCost) public onlyRole(COST_TO_MINT_SETTER_ROLE) { require(newCost > 0, 'Cost to mint must be greater than 0'); goldCostToMint = newCost; } function setName(string memory _name) public onlyRole(DEFAULT_ADMIN_ROLE) { name = _name; } function setRNG(address _rng) public onlyRole(DEFAULT_ADMIN_ROLE) { rng = _rng; } function setTokenURI(uint256 tokenId, string memory tokenURI) public onlyRole(URI_SETTER_ROLE) { _setURI(tokenId, tokenURI); } function setGoldReceivedPerAlchedToken( uint _goldReceivedPerAlchedToken ) public onlyRole(COST_TO_MINT_SETTER_ROLE) { goldReceivedPerAlchedToken = _goldReceivedPerAlchedToken; } function uri( uint256 tokenId ) public view virtual override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable) returns (string memory) { return ERC1155URIStorageUpgradeable.uri(tokenId); } function getGameItem( uint _id ) public view onlyRole(GAME_ITEM_MANAGER_ROLE) returns (GameItem memory gameItem) { return gameItems[_id]; } function upsertGameItem( uint _id, uint _rarity, uint _mintLimit, bool _isDiscontinued ) public onlyRole(GAME_ITEM_MANAGER_ROLE) { require(_id > 0, '_id must be greater than 0'); require(_rarity > 0, '_rarity must be greater than 0'); // save the game item to storage GameItem memory gameItem = GameItem(_id, _rarity, _isDiscontinued, _mintLimit); gameItems[_id] = gameItem; // add the game item to the list if it doesn't exist if (!_gameItemInListOfIDs(_id)) { gameItemIDs.push(_id); } emit GameItemUpdated( gameItem.ID, gameItem.rarity, gameItem.mintLimit, gameItem.isDiscontinued ); } function getProcessableItem( uint _id ) public view onlyRole(GAME_ITEM_MANAGER_ROLE) returns (ProcessableItem memory processableItem) { return processableItems[_id]; } function upsertProcessableItem( uint _id, uint[] memory _inputs, uint[] memory _outputs, uint[] memory _outputRarities, bool _isDiscontinued ) public onlyRole(GAME_ITEM_MANAGER_ROLE) { require(_id > 0, '_id must be greater than 0'); require(_inputs.length > 0, '_inputs must have at least one item'); require(_outputs.length > 0, '_outputs must have at least one item'); require( _outputs.length == _outputRarities.length, '_outputs and _outputRarities must be the same length' ); ProcessableItem memory processableItem = ProcessableItem( _inputs, _outputs, _outputRarities, _isDiscontinued ); processableItems[_id] = processableItem; } /** * Mint a random game item (requires payment) */ function mint( uint256 numToMint, string memory requestID ) public payable whenNotPaused needsRNG { if (costToMint == 0) { revert ErrCostToMintNotSet(); } require(numToMint > 0, 'Must mint at least one token'); uint requiredCost = costToMint * numToMint; if (requiredCost != msg.value) { revert ErrIncorrectAmountPaid({sent: msg.value, required: requiredCost}); } mintRandom(msg.sender, numToMint, requestID); } /** * Mint a random game item using Gold Pieces (game item id 0) as payment */ function mintWithGold( uint256 numToMint, string memory requestID ) public whenNotPaused needsRNG { if (goldCostToMint == 0) { revert ErrGoldCostToMintNotSet(); } uint expectedCost = goldCostToMint * numToMint; require(super.balanceOf(msg.sender, 0) >= expectedCost, 'Not enough gold to mint'); // burn the gold _burn(msg.sender, 0, expectedCost); // mint the random game item mintRandom(msg.sender, numToMint, requestID); } /** * Mint a random token to the given account. */ function mintRandom( address account, uint256 numToMint, string memory requestID ) internal whenNotPaused needsRNG { uint numberMinted = 0; while (numberMinted < numToMint) { GameItem memory gameItem = _getRandomGameItem(); _mint(account, gameItem.ID, 1, '0x'); emit Mint(gameItem.ID, account, requestID); numberMinted++; } } /** * convert a token into Gold Pieces (game item id 0) */ function alch(uint tokenId, uint numToAlch, string memory requestID) public whenNotPaused { require(tokenId > 0, 'tokenId must be greater than 0'); require(numToAlch > 0, 'Must alch at least one token'); // burn the tokens _burn(_msgSender(), tokenId, numToAlch); // mint the gold pieces _mint(_msgSender(), 0, numToAlch * goldReceivedPerAlchedToken, '0x'); emit Mint(0, _msgSender(), requestID); } function _getRandomGameItem() internal needsRNG returns (GameItem memory gameItem) { uint totalRarity = 0; uint[] memory eligibleGameItemIDs = new uint[](gameItemIDs.length); for (uint i = 0; i < gameItemIDs.length; i++) { // skip discontinued items if (gameItems[gameItemIDs[i]].isDiscontinued) { continue; } // skip items that have reached their mint limit if ( gameItems[gameItemIDs[i]].mintLimit > 0 && super.totalSupply(gameItemIDs[i]) >= gameItems[gameItemIDs[i]].mintLimit ) { continue; } // all remaining items are eligible for minting eligibleGameItemIDs[i] = gameItemIDs[i]; totalRarity += gameItems[eligibleGameItemIDs[i]].rarity; } if (eligibleGameItemIDs.length == 0 || totalRarity == 0) { revert ErrNoTokenToMint(); } uint randomNumber = IRandom(rng).getRandomNumber() % totalRarity; uint cumulativeRarity = 0; for (uint i = 0; i < eligibleGameItemIDs.length; i++) { cumulativeRarity += gameItems[eligibleGameItemIDs[i]].rarity; if (randomNumber <= cumulativeRarity) { return gameItems[eligibleGameItemIDs[i]]; } } } /** * Converts one or more tokens into another token. * * For example: * * - 1x basic chest -> one of (1x basic sword, 1x basic shield, 1x basic helmet) * - 1x clay + 1x water -> 1x mud * * The inputs and outputs are token IDs. * The outputs are ALWAYS chosen randomly, and the user will randomly * receive ONE OF the outputs. */ function process( uint processableID, uint numToProcess, string memory requestID ) public whenNotPaused { require(numToProcess > 0, 'Must process at least one token'); // get the processable item ProcessableItem memory processableItem = processableItems[processableID]; require(!processableItem.isDiscontinued, 'Processable item is discontinued'); require(processableItem.inputs.length > 0, 'Processable item has no inputs'); require(processableItem.outputs.length > 0, 'Processable item has no outputs'); uint numberMinted = 0; while (numberMinted < numToProcess) { // burn all of the inputs for (uint i = 0; i < processableItem.inputs.length; i++) { _burn(_msgSender(), processableItem.inputs[i], 1); } if (processableItem.outputs.length == 1) { // if there is only one potential output, mint it _mint(_msgSender(), processableItem.outputs[0], numToProcess, '0x'); emit Mint(processableItem.outputs[0], _msgSender(), requestID); numberMinted++; } else { // if there are multiple outputs, randomly choose one of the // outputs based on the rarity of the target items uint totalRarity = 0; uint[] memory eligibleOutputIDs = new uint[](processableItem.outputs.length); for (uint i = 0; i < processableItem.outputs.length; i++) { // skip discontinued items if (gameItems[processableItem.outputs[i]].isDiscontinued) { continue; } // all remaining items are eligible for minting eligibleOutputIDs[i] = processableItem.outputs[i]; totalRarity += processableItem.outputRarities[i]; } if (eligibleOutputIDs.length == 0 || totalRarity == 0) { revert ErrNoTokenToMint(); } uint randomNumber = IRandom(rng).getRandomNumber() % totalRarity; uint cumulativeRarity = 0; for (uint i = 0; i < eligibleOutputIDs.length; i++) { cumulativeRarity += processableItem.outputRarities[i]; if (randomNumber <= cumulativeRarity) { _mint(_msgSender(), eligibleOutputIDs[i], 1, '0x'); emit Mint(eligibleOutputIDs[i], _msgSender(), requestID); break; } } } numberMinted++; } } function withdraw() public onlyRole(WITHDRAWER_ROLE) { payable(msg.sender).transfer(address(this).balance); } /** * Override isApprovedForAll to auto-approve OS's proxy contract. * https://docs.opensea.io/docs/polygon-basic-integration */ function isApprovedForAll( address _owner, address _operator ) public view override returns (bool isOperator) { // if OpenSea's ERC1155 Proxy Address is detected, auto-return true if (_operator == address(0x207Fa8Df3a17D96Ca7EA4f2893fcdCb78a304101)) { return true; } // otherwise, use the default ERC1155.isApprovedForAll() return ERC1155Upgradeable.isApprovedForAll(_owner, _operator); } /** * This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea. */ function _msgSender() internal view override returns (address sender) { return ContextMixin.msgSender(); } function _gameItemInListOfIDs(uint _id) internal view returns (bool) { for (uint i = 0; i < gameItemIDs.length; i++) { if (gameItemIDs[i] == _id) { return true; } } return false; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import {IERC1155MetadataURI} from "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol"; import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol"; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {ERC165Upgradeable} from "../../utils/introspection/ERC165Upgradeable.sol"; import {Arrays} from "@openzeppelin/contracts/utils/Arrays.sol"; import {IERC1155Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 */ abstract contract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155, IERC1155MetadataURI, IERC1155Errors { using Arrays for uint256[]; using Arrays for address[]; /// @custom:storage-location erc7201:openzeppelin.storage.ERC1155 struct ERC1155Storage { mapping(uint256 id => mapping(address account => uint256)) _balances; mapping(address account => mapping(address operator => bool)) _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string _uri; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC1155")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC1155StorageLocation = 0x88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c4500; function _getERC1155Storage() private pure returns (ERC1155Storage storage $) { assembly { $.slot := ERC1155StorageLocation } } /** * @dev See {_setURI}. */ function __ERC1155_init(string memory uri_) internal onlyInitializing { __ERC1155_init_unchained(uri_); } function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256 /* id */) public view virtual returns (string memory) { ERC1155Storage storage $ = _getERC1155Storage(); return $._uri; } /** * @dev See {IERC1155-balanceOf}. */ function balanceOf(address account, uint256 id) public view virtual returns (uint256) { ERC1155Storage storage $ = _getERC1155Storage(); return $._balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual returns (uint256[] memory) { if (accounts.length != ids.length) { revert ERC1155InvalidArrayLength(ids.length, accounts.length); } uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i)); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual returns (bool) { ERC1155Storage storage $ = _getERC1155Storage(); return $._operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeTransferFrom(from, to, id, value, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeBatchTransferFrom(from, to, ids, values, data); } /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from` * (or `to`) is the zero address. * * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise. * * Requirements: * * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} * or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. * - `ids` and `values` must have the same length. * * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead. */ function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual { ERC1155Storage storage $ = _getERC1155Storage(); if (ids.length != values.length) { revert ERC1155InvalidArrayLength(ids.length, values.length); } address operator = _msgSender(); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids.unsafeMemoryAccess(i); uint256 value = values.unsafeMemoryAccess(i); if (from != address(0)) { uint256 fromBalance = $._balances[id][from]; if (fromBalance < value) { revert ERC1155InsufficientBalance(from, fromBalance, value, id); } unchecked { // Overflow not possible: value <= fromBalance $._balances[id][from] = fromBalance - value; } } if (to != address(0)) { $._balances[id][to] += value; } } if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); emit TransferSingle(operator, from, to, id, value); } else { emit TransferBatch(operator, from, to, ids, values); } } /** * @dev Version of {_update} that performs the token acceptance check by calling * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it * contains code (eg. is a smart contract at the moment of execution). * * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any * update to the contract state after this function would break the check-effect-interaction pattern. Consider * overriding {_update} instead. */ function _updateWithAcceptanceCheck( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal virtual { _update(from, to, ids, values); if (to != address(0)) { address operator = _msgSender(); if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); _doSafeTransferAcceptanceCheck(operator, from, to, id, value, data); } else { _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data); } } } /** * @dev Transfers a `value` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. * - `ids` and `values` must have the same length. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the values in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { ERC1155Storage storage $ = _getERC1155Storage(); $._uri = newuri; } /** * @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `values` must have the same length. * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev Destroys a `value` amount of tokens of type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. */ function _burn(address from, uint256 id, uint256 value) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. * - `ids` and `values` must have the same length. */ function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the zero address. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { ERC1155Storage storage $ = _getERC1155Storage(); if (operator == address(0)) { revert ERC1155InvalidOperator(address(0)); } $._operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address * if it contains code at the moment of execution. */ function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 value, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address * if it contains code at the moment of execution. */ function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Creates an array in memory with only one value for each of the elements provided. */ function _asSingletonArrays( uint256 element1, uint256 element2 ) private pure returns (uint256[] memory array1, uint256[] memory array2) { /// @solidity memory-safe-assembly assembly { // Load the free memory pointer array1 := mload(0x40) // Set array length to 1 mstore(array1, 1) // Store the single element at the next word after the length (where content starts) mstore(add(array1, 0x20), element1) // Repeat for next array locating it right after the first array array2 := add(array1, 0x40) mstore(array2, 1) mstore(add(array2, 0x20), element2) // Update the free memory pointer by pointing after the second array mstore(0x40, add(array2, 0x40)) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Burnable.sol) pragma solidity ^0.8.20; import {ERC1155Upgradeable} from "../ERC1155Upgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. */ abstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable { function __ERC1155Burnable_init() internal onlyInitializing { } function __ERC1155Burnable_init_unchained() internal onlyInitializing { } function burn(address account, uint256 id, uint256 value) public virtual { if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) { revert ERC1155MissingApprovalForAll(_msgSender(), account); } _burn(account, id, value); } function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual { if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) { revert ERC1155MissingApprovalForAll(_msgSender(), account); } _burnBatch(account, ids, values); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Supply.sol) pragma solidity ^0.8.20; import {ERC1155Upgradeable} from "../ERC1155Upgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of ERC1155 that adds tracking of total supply per id. * * Useful for scenarios where Fungible and Non-fungible tokens have to be * clearly identified. Note: While a totalSupply of 1 might mean the * corresponding is an NFT, there is no guarantees that no other token with the * same id are not going to be minted. * * NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens * that can be minted. * * CAUTION: This extension should not be added in an upgrade to an already deployed contract. */ abstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.ERC1155Supply struct ERC1155SupplyStorage { mapping(uint256 id => uint256) _totalSupply; uint256 _totalSupplyAll; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC1155Supply")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC1155SupplyStorageLocation = 0x4a593662ee04d27b6a00ebb31be7fe0c102c2ade82a7c5d764f2df05dc4e2800; function _getERC1155SupplyStorage() private pure returns (ERC1155SupplyStorage storage $) { assembly { $.slot := ERC1155SupplyStorageLocation } } function __ERC1155Supply_init() internal onlyInitializing { } function __ERC1155Supply_init_unchained() internal onlyInitializing { } /** * @dev Total value of tokens in with a given id. */ function totalSupply(uint256 id) public view virtual returns (uint256) { ERC1155SupplyStorage storage $ = _getERC1155SupplyStorage(); return $._totalSupply[id]; } /** * @dev Total value of tokens. */ function totalSupply() public view virtual returns (uint256) { ERC1155SupplyStorage storage $ = _getERC1155SupplyStorage(); return $._totalSupplyAll; } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; } /** * @dev See {ERC1155-_update}. */ function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal virtual override { ERC1155SupplyStorage storage $ = _getERC1155SupplyStorage(); super._update(from, to, ids, values); if (from == address(0)) { uint256 totalMintValue = 0; for (uint256 i = 0; i < ids.length; ++i) { uint256 value = values[i]; // Overflow check required: The rest of the code assumes that totalSupply never overflows $._totalSupply[ids[i]] += value; totalMintValue += value; } // Overflow check required: The rest of the code assumes that totalSupplyAll never overflows $._totalSupplyAll += totalMintValue; } if (to == address(0)) { uint256 totalBurnValue = 0; for (uint256 i = 0; i < ids.length; ++i) { uint256 value = values[i]; unchecked { // Overflow not possible: values[i] <= balanceOf(from, ids[i]) <= totalSupply(ids[i]) $._totalSupply[ids[i]] -= value; // Overflow not possible: sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll totalBurnValue += value; } } unchecked { // Overflow not possible: totalBurnValue = sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll $._totalSupplyAll -= totalBurnValue; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155URIStorage.sol) pragma solidity ^0.8.20; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {ERC1155Upgradeable} from "../ERC1155Upgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @dev ERC1155 token with storage based token URI management. * Inspired by the ERC721URIStorage extension */ abstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable { using Strings for uint256; /// @custom:storage-location erc7201:openzeppelin.storage.ERC1155URIStorage struct ERC1155URIStorageStorage { // Optional base URI string _baseURI; // Optional mapping for token URIs mapping(uint256 tokenId => string) _tokenURIs; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC1155URIStorage")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC1155URIStorageStorageLocation = 0x89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c558600; function _getERC1155URIStorageStorage() private pure returns (ERC1155URIStorageStorage storage $) { assembly { $.slot := ERC1155URIStorageStorageLocation } } function __ERC1155URIStorage_init() internal onlyInitializing { __ERC1155URIStorage_init_unchained(); } function __ERC1155URIStorage_init_unchained() internal onlyInitializing { ERC1155URIStorageStorage storage $ = _getERC1155URIStorageStorage(); $._baseURI = ""; } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the concatenation of the `_baseURI` * and the token-specific uri if the latter is set * * This enables the following behaviors: * * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI` * is empty per default); * * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()` * which in most cases will contain `ERC1155._uri`; * * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a * uri value set, then the result is empty. */ function uri(uint256 tokenId) public view virtual override returns (string memory) { ERC1155URIStorageStorage storage $ = _getERC1155URIStorageStorage(); string memory tokenURI = $._tokenURIs[tokenId]; // If token URI is set, concatenate base URI and tokenURI (via string.concat). return bytes(tokenURI).length > 0 ? string.concat($._baseURI, tokenURI) : super.uri(tokenId); } /** * @dev Sets `tokenURI` as the tokenURI of `tokenId`. */ function _setURI(uint256 tokenId, string memory tokenURI) internal virtual { ERC1155URIStorageStorage storage $ = _getERC1155URIStorageStorage(); $._tokenURIs[tokenId] = tokenURI; emit URI(uri(tokenId), tokenId); } /** * @dev Sets `baseURI` as the `_baseURI` for all tokens */ function _setBaseURI(string memory baseURI) internal virtual { ERC1155URIStorageStorage storage $ = _getERC1155URIStorageStorage(); $._baseURI = baseURI; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } 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 (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Pausable struct PausableStorage { bool _paused; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300; function _getPausableStorage() private pure returns (PausableStorage storage $) { assembly { $.slot := PausableStorageLocation } } /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { PausableStorage storage $ = _getPausableStorage(); $._paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { PausableStorage storage $ = _getPausableStorage(); return $._paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { PausableStorage storage $ = _getPausableStorage(); $._paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.20; import {IERC1155} from "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; import {Math} from "./math/Math.sol"; /** * @dev Collection of functions related to array types. */ library Arrays { using StorageSlot for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { uint256 low = 0; uint256 high = array.length; if (high == 0) { return 0; } while (low < high) { uint256 mid = Math.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds towards zero (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; /** * https://github.com/maticnetwork/pos-portal/blob/master/contracts/common/ContextMixin.sol */ abstract contract ContextMixin { function msgSender() internal view returns (address payable sender) { if (msg.sender == address(this)) { bytes memory array = msg.data; uint256 index = msg.data.length; assembly { // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. sender := and(mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff) } } else { sender = payable(msg.sender); } return sender; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ErrCostToMintNotSet","type":"error"},{"inputs":[],"name":"ErrGoldCostToMintNotSet","type":"error"},{"inputs":[{"internalType":"uint256","name":"sent","type":"uint256"},{"internalType":"uint256","name":"required","type":"uint256"}],"name":"ErrIncorrectAmountPaid","type":"error"},{"inputs":[],"name":"ErrNoTokenToMint","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rarity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintLimit","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDiscontinued","type":"bool"}],"name":"GameItemUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"gameItemID","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"string","name":"requestID","type":"string"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"COST_TO_MINT_SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GAME_ITEM_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"URI_SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAWER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numToAlch","type":"uint256"},{"internalType":"string","name":"requestID","type":"string"}],"name":"alch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"costToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getGameItem","outputs":[{"components":[{"internalType":"uint256","name":"ID","type":"uint256"},{"internalType":"uint256","name":"rarity","type":"uint256"},{"internalType":"bool","name":"isDiscontinued","type":"bool"},{"internalType":"uint256","name":"mintLimit","type":"uint256"}],"internalType":"struct GameItem","name":"gameItem","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getProcessableItem","outputs":[{"components":[{"internalType":"uint256[]","name":"inputs","type":"uint256[]"},{"internalType":"uint256[]","name":"outputs","type":"uint256[]"},{"internalType":"uint256[]","name":"outputRarities","type":"uint256[]"},{"internalType":"bool","name":"isDiscontinued","type":"bool"}],"internalType":"struct ProcessableItem","name":"processableItem","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"goldCostToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"goldReceivedPerAlchedToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"isOperator","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numToMint","type":"uint256"},{"internalType":"string","name":"requestID","type":"string"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numToMint","type":"uint256"},{"internalType":"string","name":"requestID","type":"string"}],"name":"mintWithGold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"processableID","type":"uint256"},{"internalType":"uint256","name":"numToProcess","type":"uint256"},{"internalType":"string","name":"requestID","type":"string"}],"name":"process","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newContractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCost","type":"uint256"}],"name":"setCostToMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCost","type":"uint256"}],"name":"setGoldCostToMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_goldReceivedPerAlchedToken","type":"uint256"}],"name":"setGoldReceivedPerAlchedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rng","type":"address"}],"name":"setRNG","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_rarity","type":"uint256"},{"internalType":"uint256","name":"_mintLimit","type":"uint256"},{"internalType":"bool","name":"_isDiscontinued","type":"bool"}],"name":"upsertGameItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256[]","name":"_inputs","type":"uint256[]"},{"internalType":"uint256[]","name":"_outputs","type":"uint256[]"},{"internalType":"uint256[]","name":"_outputRarities","type":"uint256[]"},{"internalType":"bool","name":"_isDiscontinued","type":"bool"}],"name":"upsertProcessableItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b506200002062000026565b620000da565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000775760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d75780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b60805161478d62000104600039600081816127a3015281816127cc015261292f015261478d6000f3fe6080604052600436106103195760003560e01c80636b20c454116101ab578063ad3cb1cc116100f7578063e8a3d48511610095578063f242432a1161006f578063f242432a146109cf578063f41743a7146109ef578063f5298aca14610a0f578063f72c0d8b14610a2f57600080fd5b8063e8a3d48514610984578063e985e9c514610999578063ecbeefec146109b957600080fd5b8063c47f0027116100d1578063c47f0027146108ee578063d1e836b51461090e578063d547741f14610930578063e63ab1e91461095057600080fd5b8063ad3cb1cc14610863578063bbaf55fb14610894578063bd85b039146108b457600080fd5b806391d1485411610164578063a05570411161013e578063a0557041146107ee578063a1b240df1461080e578063a217fddf1461082e578063a22cb4651461084357600080fd5b806391d1485414610759578063938e3d7b1461077957806394f13f4a1461079957600080fd5b80636b20c4541461069457806377097fc8146106b45780637f345710146106c75780638129fc1c146106fb5780638456cb591461071057806385f438c11461072557600080fd5b80633b84edbd1161026a5780634f1ef2861161022357806357cf54ff116101fd57806357cf54ff1461060f5780635a674c8b1461062f5780635c975abb1461064f5780636000fbcc1461067457600080fd5b80634f1ef286146105ab5780634f558e79146105be57806352d1902d146105fa57600080fd5b80633b84edbd146105085780633ccfd60b146105285780633f4ba83a1461053d5780634438512514610552578063446bc42c146105685780634e1273f41461057e57600080fd5b806318df29c4116102d75780632eb2c2d6116102b15780632eb2c2d6146104865780632f2ff15d146104a65780632fcaeac9146104c657806336568abe146104e857600080fd5b806318df29c414610419578063248a9ca3146104395780632d463c971461045957600080fd5b8062fdd58e1461031e57806301ffc9a71461035157806306fdde03146103815780630e89341c146103a3578063162094c4146103c357806318160ddd146103e5575b600080fd5b34801561032a57600080fd5b5061033e610339366004613abf565b610a63565b6040519081526020015b60405180910390f35b34801561035d57600080fd5b5061037161036c366004613aff565b610a9a565b6040519015158152602001610348565b34801561038d57600080fd5b50610396610aa5565b6040516103489190613b6c565b3480156103af57600080fd5b506103966103be366004613b7f565b610b33565b3480156103cf57600080fd5b506103e36103de366004613c4d565b610b3e565b005b3480156103f157600080fd5b507f4a593662ee04d27b6a00ebb31be7fe0c102c2ade82a7c5d764f2df05dc4e28015461033e565b34801561042557600080fd5b506103e3610434366004613c4d565b610b77565b34801561044557600080fd5b5061033e610454366004613b7f565b610c56565b34801561046557600080fd5b50610479610474366004613b7f565b610c78565b6040516103489190613cce565b34801561049257600080fd5b506103e36104a1366004613dcd565b610df0565b3480156104b257600080fd5b506103e36104c1366004613e76565b610e6b565b3480156104d257600080fd5b5061033e60008051602061465883398151915281565b3480156104f457600080fd5b506103e3610503366004613e76565b610e8d565b34801561051457600080fd5b506103e3610523366004613ea2565b610ed0565b34801561053457600080fd5b506103e3610efe565b34801561054957600080fd5b506103e3610f58565b34801561055e57600080fd5b5061033e60075481565b34801561057457600080fd5b5061033e60065481565b34801561058a57600080fd5b5061059e610599366004613ebd565b610f8d565b6040516103489190613f72565b6103e36105b9366004613f85565b611061565b3480156105ca57600080fd5b506103716105d9366004613b7f565b60009081526000805160206147188339815191526020526040902054151590565b34801561060657600080fd5b5061033e61107c565b34801561061b57600080fd5b506103e361062a366004613fcc565b61109a565b34801561063b57600080fd5b506103e361064a36600461400b565b61125a565b34801561065b57600080fd5b506000805160206146f88339815191525460ff16610371565b34801561068057600080fd5b506103e361068f366004613b7f565b611489565b3480156106a057600080fd5b506103e36106af3660046140ad565b6114c7565b6103e36106c2366004613c4d565b61153e565b3480156106d357600080fd5b5061033e7f7804d923f43a17d325d77e781528e0793b2edd9890ab45fc64efd7b4b427744c81565b34801561070757600080fd5b506103e361161c565b34801561071c57600080fd5b506103e361179a565b34801561073157600080fd5b5061033e7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e481565b34801561076557600080fd5b50610371610774366004613e76565b6117cc565b34801561078557600080fd5b506103e3610794366004614120565b611804565b3480156107a557600080fd5b506107b96107b4366004613b7f565b61183a565b604051610348919081518152602080830151908201526040808301511515908201526060918201519181019190915260800190565b3480156107fa57600080fd5b506103e3610809366004613b7f565b6118ca565b34801561081a57600080fd5b506103e3610829366004613b7f565b611908565b34801561083a57600080fd5b5061033e600081565b34801561084f57600080fd5b506103e361085e366004614154565b611926565b34801561086f57600080fd5b50610396604051806040016040528060058152602001640352e302e360dc1b81525081565b3480156108a057600080fd5b506103e36108af36600461417e565b611938565b3480156108c057600080fd5b5061033e6108cf366004613b7f565b6000908152600080516020614718833981519152602052604090205490565b3480156108fa57600080fd5b506103e3610909366004614120565b611a6a565b34801561091a57600080fd5b5061033e60008051602061473883398151915281565b34801561093c57600080fd5b506103e361094b366004613e76565b611a81565b34801561095c57600080fd5b5061033e7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b34801561099057600080fd5b50610396611a9d565b3480156109a557600080fd5b506103716109b43660046141c3565b611aaa565b3480156109c557600080fd5b5061033e60035481565b3480156109db57600080fd5b506103e36109ea3660046141ed565b611b29565b3480156109fb57600080fd5b506103e3610a0a36600461417e565b611b9c565b348015610a1b57600080fd5b506103e3610a2a366004614251565b6121ef565b348015610a3b57600080fd5b5061033e7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b60008181526000805160206146b8833981519152602090815260408083206001600160a01b03861684529091529020545b92915050565b6000610a9482612239565b60018054610ab290614284565b80601f0160208091040260200160405190810160405280929190818152602001828054610ade90614284565b8015610b2b5780601f10610b0057610100808354040283529160200191610b2b565b820191906000526020600020905b815481529060010190602001808311610b0e57829003601f168201915b505050505081565b6060610a948261225e565b7f7804d923f43a17d325d77e781528e0793b2edd9890ab45fc64efd7b4b427744c610b688161237f565b610b728383612390565b505050565b610b7f61242f565b6000546001600160a01b0316610bb05760405162461bcd60e51b8152600401610ba7906142b8565b60405180910390fd5b600754600003610bd35760405163132913ad60e31b815260040160405180910390fd5b600082600754610be391906142f3565b905080610bf1336000610a63565b1015610c3f5760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656e6f75676820676f6c6420746f206d696e740000000000000000006044820152606401610ba7565b610c4b33600083612462565b610b723384846124ca565b60009081526000805160206146d8833981519152602052604090206001015490565b610ca560405180608001604052806060815260200160608152602001606081526020016000151581525090565b600080516020614658833981519152610cbd8161237f565b6000838152600860209081526040918290208251815460a093810282018401909452608081018481529093919284928491840182828015610d1d57602002820191906000526020600020905b815481526020019060010190808311610d09575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015610d7557602002820191906000526020600020905b815481526020019060010190808311610d61575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015610dcd57602002820191906000526020600020905b815481526020019060010190808311610db9575b50505091835250506003919091015460ff16151560209091015291505b50919050565b6000610dfa612583565b9050806001600160a01b0316866001600160a01b031614158015610e255750610e238682611aaa565b155b15610e565760405163711bec9160e11b81526001600160a01b03808316600483015287166024820152604401610ba7565b610e638686868686612592565b505050505050565b610e7482610c56565b610e7d8161237f565b610e8783836125f2565b50505050565b610e95612583565b6001600160a01b0316816001600160a01b031614610ec65760405163334bd91960e11b815260040160405180910390fd5b610b728282612698565b6000610edb8161237f565b50600080546001600160a01b0319166001600160a01b0392909216919091179055565b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e4610f288161237f565b60405133904780156108fc02916000818181858888f19350505050158015610f54573d6000803e3d6000fd5b5050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610f828161237f565b610f8a612732565b50565b60608151835114610fbe5781518351604051635b05999160e01b815260048101929092526024820152604401610ba7565b600083516001600160401b03811115610fd957610fd9613b98565b604051908082528060200260200182016040528015611002578160200160208202803683370190505b50905060005b84518110156110595760208082028601015161102c90602080840287010151610a63565b82828151811061103e5761103e61430a565b602090810291909101015261105281614320565b9050611008565b509392505050565b611069612798565b6110728261283d565b610f548282612867565b6000611086612924565b506000805160206146788339815191525b90565b6000805160206146588339815191526110b28161237f565b600085116111025760405162461bcd60e51b815260206004820152601a60248201527f5f6964206d7573742062652067726561746572207468616e20300000000000006044820152606401610ba7565b600084116111525760405162461bcd60e51b815260206004820152601e60248201527f5f726172697479206d7573742062652067726561746572207468616e203000006044820152606401610ba7565b6040805160808101825286815260208082018781528515158385019081526060840188815260008b81526004909452949092208351815590516001820155905160028201805460ff191691151591909117905591516003909201919091556111b98661296d565b6111f357600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018690555b80600001517fd97b275e081f80d4337e39389411d894b137a0cce4eacd0bd2d99ce01be53af582602001518360600151846040015160405161124a9392919092835260208301919091521515604082015260600190565b60405180910390a2505050505050565b6000805160206146588339815191526112728161237f565b600086116112c25760405162461bcd60e51b815260206004820152601a60248201527f5f6964206d7573742062652067726561746572207468616e20300000000000006044820152606401610ba7565b600085511161131f5760405162461bcd60e51b815260206004820152602360248201527f5f696e70757473206d7573742068617665206174206c65617374206f6e65206960448201526274656d60e81b6064820152608401610ba7565b600084511161137c5760405162461bcd60e51b8152602060048201526024808201527f5f6f757470757473206d7573742068617665206174206c65617374206f6e65206044820152636974656d60e01b6064820152608401610ba7565b82518451146113ea5760405162461bcd60e51b815260206004820152603460248201527f5f6f75747075747320616e64205f6f75747075745261726974696573206d75736044820152730e840c4ca40e8d0ca40e6c2daca40d8cadccee8d60631b6064820152608401610ba7565b604080516080810182528681526020808201879052818301869052841515606083015260008981526008825292909220815180519293849361142f9284920190613a43565b5060208281015180516114489260018501920190613a43565b5060408201518051611464916002840191602090910190613a43565b50606091909101516003909101805460ff191691151591909117905550505050505050565b6000805160206147388339815191526114a18161237f565b600082116114c15760405162461bcd60e51b8152600401610ba790614339565b50600355565b6114cf612583565b6001600160a01b0316836001600160a01b0316141580156114f957506114f7836109b4612583565b155b1561153357611506612583565b60405163711bec9160e11b81526001600160a01b0391821660048201529084166024820152604401610ba7565b610b728383836129c3565b61154661242f565b6000546001600160a01b031661156e5760405162461bcd60e51b8152600401610ba7906142b8565b6003546000036115915760405163eafb6e3960e01b815260040160405180910390fd5b600082116115e15760405162461bcd60e51b815260206004820152601c60248201527f4d757374206d696e74206174206c65617374206f6e6520746f6b656e000000006044820152606401610ba7565b6000826003546115f191906142f3565b9050348114610c4b57604051634b23788560e11b815234600482015260248101829052604401610ba7565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156116615750825b90506000826001600160401b0316600114801561167d5750303b155b90508115801561168b575080155b156116a95760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156116d357845460ff60401b1916600160401b1785555b6116eb60405180602001604052806000815250612a09565b6116f3612a1a565b6116fb612a22565b611703612a1a565b61170b612a1a565b611713612a1a565b61171e6000336125f2565b50604080518082019091526009815268416e74686f6c6f677960b81b602082015260019061174c90826143c2565b50831561179357845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6117c48161237f565b610f8a612a32565b60009182526000805160206146d8833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7f7804d923f43a17d325d77e781528e0793b2edd9890ab45fc64efd7b4b427744c61182e8161237f565b6002610b7283826143c2565b61186760405180608001604052806000815260200160008152602001600015158152602001600081525090565b60008051602061465883398151915261187f8161237f565b5050600090815260046020908152604091829020825160808101845281548152600182015492810192909252600281015460ff16151592820192909252600390910154606082015290565b6000805160206147388339815191526118e28161237f565b600082116119025760405162461bcd60e51b8152600401610ba790614339565b50600755565b6000805160206147388339815191526119208161237f565b50600655565b610f54611931612583565b8383612a7d565b61194061242f565b600083116119905760405162461bcd60e51b815260206004820152601e60248201527f746f6b656e4964206d7573742062652067726561746572207468616e203000006044820152606401610ba7565b600082116119e05760405162461bcd60e51b815260206004820152601c60248201527f4d75737420616c6368206174206c65617374206f6e6520746f6b656e000000006044820152606401610ba7565b6119f26119eb612583565b8484612462565b611a2d6119fd612583565b600060065485611a0d91906142f3565b60405180604001604052806002815260200161060f60f31b815250612b25565b611a35612583565b6001600160a01b0316600060008051602061469883398151915283604051611a5d9190613b6c565b60405180910390a3505050565b6000611a758161237f565b6001610b7283826143c2565b611a8a82610c56565b611a938161237f565b610e878383612698565b60028054610ab290614284565b600073207fa8df3a17d96ca7ea4f2893fcdcb78a304100196001600160a01b03831601611ad957506001610a94565b6001600160a01b0380841660009081527f88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c4501602090815260408083209386168352929052205460ff165b9392505050565b6000611b33612583565b9050806001600160a01b0316866001600160a01b031614158015611b5e5750611b5c8682611aaa565b155b15611b8f5760405163711bec9160e11b81526001600160a01b03808316600483015287166024820152604401610ba7565b610e638686868686612b82565b611ba461242f565b60008211611bf45760405162461bcd60e51b815260206004820152601f60248201527f4d7573742070726f63657373206174206c65617374206f6e6520746f6b656e006044820152606401610ba7565b60008381526008602090815260408083208151815460a09481028201850190935260808101838152909391928492849190840182828015611c5457602002820191906000526020600020905b815481526020019060010190808311611c40575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015611cac57602002820191906000526020600020905b815481526020019060010190808311611c98575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015611d0457602002820191906000526020600020905b815481526020019060010190808311611cf0575b50505091835250506003919091015460ff161515602090910152606081015190915015611d735760405162461bcd60e51b815260206004820181905260248201527f50726f6365737361626c65206974656d20697320646973636f6e74696e7565646044820152606401610ba7565b805151611dc25760405162461bcd60e51b815260206004820152601e60248201527f50726f6365737361626c65206974656d20686173206e6f20696e7075747300006044820152606401610ba7565b600081602001515111611e175760405162461bcd60e51b815260206004820152601f60248201527f50726f6365737361626c65206974656d20686173206e6f206f757470757473006044820152606401610ba7565b60005b838110156117935760005b825151811015611e6f57611e5d611e3a612583565b8451805184908110611e4e57611e4e61430a565b60200260200101516001612462565b80611e6781614320565b915050611e25565b50816020015151600103611f2f57611ec8611e88612583565b8360200151600081518110611e9f57611e9f61430a565b60200260200101518660405180604001604052806002815260200161060f60f31b815250612b25565b611ed0612583565b6001600160a01b03168260200151600081518110611ef057611ef061430a565b602002602001015160008051602061469883398151915285604051611f159190613b6c565b60405180910390a380611f2781614320565b9150506121dd565b6000808360200151516001600160401b03811115611f4f57611f4f613b98565b604051908082528060200260200182016040528015611f78578160200160208202803683370190505b50905060005b846020015151811015612044576004600086602001518381518110611fa557611fa561430a565b60209081029190910181015182528101919091526040016000206002015460ff166120325784602001518181518110611fe057611fe061430a565b6020026020010151828281518110611ffa57611ffa61430a565b6020026020010181815250508460400151818151811061201c5761201c61430a565b60200260200101518361202f9190614481565b92505b8061203c81614320565b915050611f7e565b5080511580612051575081155b1561206f576040516337e7792360e11b815260040160405180910390fd5b600080546040805163dbdff2c160e01b8152905185926001600160a01b03169163dbdff2c1916004808301926020929190829003018188875af11580156120ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120de9190614494565b6120e891906144ad565b90506000805b83518110156121d7578660400151818151811061210d5761210d61430a565b6020026020010151826121209190614481565b91508183116121c557612170612134612583565b8583815181106121465761214661430a565b6020026020010151600160405180604001604052806002815260200161060f60f31b815250612b25565b612178612583565b6001600160a01b03168482815181106121935761219361430a565b60200260200101516000805160206146988339815191528a6040516121b89190613b6c565b60405180910390a36121d7565b806121cf81614320565b9150506120ee565b50505050505b806121e781614320565b915050611e1a565b6121f7612583565b6001600160a01b0316836001600160a01b031614158015612221575061221f836109b4612583565b155b1561222e57611506612583565b610b72838383612462565b60006001600160e01b03198216637965db0b60e01b1480610a945750610a9482612c10565b60008181527f89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c5586016020526040812080546060927f89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c5586009290916122bd90614284565b80601f01602080910402602001604051908101604052809291908181526020018280546122e990614284565b80156123365780601f1061230b57610100808354040283529160200191612336565b820191906000526020600020905b81548152906001019060200180831161231957829003601f168201915b5050505050905060008151116123545761234f84612c60565b612377565b60405161236790839083906020016144cf565b6040516020818303038152906040525b949350505050565b610f8a8161238b612583565b612d25565b60008281527f89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c558601602052604090207f89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c558600906123e983826143c2565b50827f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61241585610b33565b6040516124229190613b6c565b60405180910390a2505050565b6000805160206146f88339815191525460ff16156124605760405163d93c066560e01b815260040160405180910390fd5b565b6001600160a01b03831661248b57604051626a0d4560e21b815260006004820152602401610ba7565b604080516001808252602082018590528183019081526060820184905260a0820190925260006080820181815291929161179391879185908590612d5e565b6124d261242f565b6000546001600160a01b03166124fa5760405162461bcd60e51b8152600401610ba7906142b8565b60005b82811015610e8757600061250f612dbb565b905061253c858260000151600160405180604001604052806002815260200161060f60f31b815250612b25565b846001600160a01b03168160000151600080516020614698833981519152856040516125689190613b6c565b60405180910390a38161257a81614320565b925050506124fd565b600061258d61316a565b905090565b6001600160a01b0384166125bc57604051632bfa23e760e11b815260006004820152602401610ba7565b6001600160a01b0385166125e557604051626a0d4560e21b815260006004820152602401610ba7565b6117938585858585612d5e565b60006000805160206146d883398151915261260d84846117cc565b61268e576000848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055612644612583565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610a94565b6000915050610a94565b60006000805160206146d88339815191526126b384846117cc565b1561268e576000848152602082815260408083206001600160a01b03871684529091529020805460ff191690556126e8612583565b6001600160a01b0316836001600160a01b0316857ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a46001915050610a94565b61273a6131c5565b6000805160206146f8833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61277a612583565b6040516001600160a01b03909116815260200160405180910390a150565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061281f57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612813600080516020614678833981519152546001600160a01b031690565b6001600160a01b031614155b156124605760405163703e46dd60e11b815260040160405180910390fd5b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3610f548161237f565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128c1575060408051601f3d908101601f191682019092526128be91810190614494565b60015b6128e957604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610ba7565b600080516020614678833981519152811461291a57604051632a87526960e21b815260048101829052602401610ba7565b610b7283836131f5565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146124605760405163703e46dd60e11b815260040160405180910390fd5b6000805b6005548110156129ba57826005828154811061298f5761298f61430a565b9060005260206000200154036129a85750600192915050565b806129b281614320565b915050612971565b50600092915050565b6001600160a01b0383166129ec57604051626a0d4560e21b815260006004820152602401610ba7565b610b72836000848460405180602001604052806000815250612d5e565b612a1161324b565b610f8a81613294565b61246061324b565b612a2a61324b565b6124606132a5565b612a3a61242f565b6000805160206146f8833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861277a612583565b6000805160206146b88339815191526001600160a01b038316612ab55760405162ced3e160e81b815260006004820152602401610ba7565b6001600160a01b038481166000818152600184016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b038416612b4f57604051632bfa23e760e11b815260006004820152602401610ba7565b60408051600180825260208201869052818301908152606082018590526080820190925290610e63600087848487612d5e565b6001600160a01b038416612bac57604051632bfa23e760e11b815260006004820152602401610ba7565b6001600160a01b038516612bd557604051626a0d4560e21b815260006004820152602401610ba7565b60408051600180825260208201869052818301908152606082018590526080820190925290612c078787848487612d5e565b50505050505050565b60006001600160e01b03198216636cdb3d1360e11b1480612c4157506001600160e01b031982166303a24d0760e21b145b80610a9457506301ffc9a760e01b6001600160e01b0319831614610a94565b7f88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c450280546060916000805160206146b883398151915291612c9f90614284565b80601f0160208091040260200160405190810160405280929190818152602001828054612ccb90614284565b8015612d185780601f10612ced57610100808354040283529160200191612d18565b820191906000526020600020905b815481529060010190602001808311612cfb57829003601f168201915b5050505050915050919050565b612d2f82826117cc565b610f545760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610ba7565b612d6a858585856132c6565b6001600160a01b03841615611793576000612d83612583565b90508351600103612dad5760208481015190840151612da68389898585896132d2565b5050610e63565b610e638187878787876133f6565b612de860405180608001604052806000815260200160008152602001600015158152602001600081525090565b6000546001600160a01b0316612e105760405162461bcd60e51b8152600401610ba7906142b8565b60055460009081906001600160401b03811115612e2f57612e2f613b98565b604051908082528060200260200182016040528015612e58578160200160208202803683370190505b50905060005b600554811015612fea576004600060058381548110612e7f57612e7f61430a565b6000918252602080832090910154835282019290925260400190206002015460ff16612fd85760006004600060058481548110612ebe57612ebe61430a565b9060005260206000200154815260200190815260200160002060030154118015612f5a57506004600060058381548110612efa57612efa61430a565b9060005260206000200154815260200190815260200160002060030154612f5760058381548110612f2d57612f2d61430a565b90600052602060002001546000908152600080516020614718833981519152602052604090205490565b10155b612fd85760058181548110612f7157612f7161430a565b9060005260206000200154828281518110612f8e57612f8e61430a565b60200260200101818152505060046000838381518110612fb057612fb061430a565b602002602001015181526020019081526020016000206001015483612fd59190614481565b92505b80612fe281614320565b915050612e5e565b5080511580612ff7575081155b15613015576040516337e7792360e11b815260040160405180910390fd5b600080546040805163dbdff2c160e01b8152905185926001600160a01b03169163dbdff2c1916004808301926020929190829003018188875af1158015613060573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130849190614494565b61308e91906144ad565b90506000805b835181101561316257600460008583815181106130b3576130b361430a565b6020026020010151815260200190815260200160002060010154826130d89190614481565b915081831161315057600460008583815181106130f7576130f761430a565b6020908102919091018101518252818101929092526040908101600020815160808101835281548152600182015493810193909352600281015460ff161515918301919091526003015460608201529695505050505050565b8061315a81614320565b915050613094565b505050505090565b60003033036131c057600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b031691506110979050565b503390565b6000805160206146f88339815191525460ff1661246057604051638dfc202b60e01b815260040160405180910390fd5b6131fe826134df565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a280511561324357610b728282613544565b610f546135ba565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661246057604051631afcd79f60e31b815260040160405180910390fd5b61329c61324b565b610f8a816135d9565b6132ad61324b565b6000805160206146f8833981519152805460ff19169055565b610e8784848484613613565b6001600160a01b0384163b15610e635760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906133169089908990889088908890600401614556565b6020604051808303816000875af1925050508015613351575060408051601f3d908101601f1916820190925261334e9181019061459b565b60015b6133ba573d80801561337f576040519150601f19603f3d011682016040523d82523d6000602084013e613384565b606091505b5080516000036133b257604051632bfa23e760e11b81526001600160a01b0386166004820152602401610ba7565b805181602001fd5b6001600160e01b0319811663f23a6e6160e01b14612c0757604051632bfa23e760e11b81526001600160a01b0386166004820152602401610ba7565b6001600160a01b0384163b15610e635760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061343a90899089908890889088906004016145b8565b6020604051808303816000875af1925050508015613475575060408051601f3d908101601f191682019092526134729181019061459b565b60015b6134a3573d80801561337f576040519150601f19603f3d011682016040523d82523d6000602084013e613384565b6001600160e01b0319811663bc197c8160e01b14612c0757604051632bfa23e760e11b81526001600160a01b0386166004820152602401610ba7565b806001600160a01b03163b60000361351557604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610ba7565b60008051602061467883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516135619190614616565b600060405180830381855af49150503d806000811461359c576040519150601f19603f3d011682016040523d82523d6000602084013e6135a1565b606091505b50915091506135b1858383613785565b95945050505050565b34156124605760405163b398979f60e01b815260040160405180910390fd5b6000805160206146b88339815191527f88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c4502610b7283826143c2565b60008051602061471883398151915261362e858585856137e1565b6001600160a01b0385166136e5576000805b84518110156136c957600084828151811061365d5761365d61430a565b60200260200101519050808460000160008885815181106136805761368061430a565b6020026020010151815260200190815260200160002060008282546136a59190614481565b909155506136b590508184614481565b925050806136c290614320565b9050613640565b50808260010160008282546136de9190614481565b9091555050505b6001600160a01b038416611793576000805b84518110156137715760008482815181106137145761371461430a565b60200260200101519050808460000160008885815181106137375761373761430a565b60200260200101518152602001908152602001600020600082825403925050819055508083019250508061376a90614320565b90506136f7565b506001820180549190910390555050505050565b60608261379a5761379582613a1a565b611b22565b81511580156137b157506001600160a01b0384163b155b156137da57604051639996b31560e01b81526001600160a01b0385166004820152602401610ba7565b5092915050565b805182516000805160206146b883398151915291146138205782518251604051635b05999160e01b815260048101929092526024820152604401610ba7565b600061382a612583565b905060005b845181101561393a576020818102868101820151908601909101516001600160a01b038916156138e2576000828152602086815260408083206001600160a01b038d168452909152902054818110156138bb576040516303dee4c560e01b81526001600160a01b038b166004820152602481018290526044810183905260648101849052608401610ba7565b6000838152602087815260408083206001600160a01b038e16845290915290209082900390555b6001600160a01b03881615613927576000828152602086815260408083206001600160a01b038c16845290915281208054839290613921908490614481565b90915550505b50508061393390614320565b905061382f565b5083516001036139bb5760208401516000906020850151909150866001600160a01b0316886001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6285856040516139ac929190918252602082015260400190565b60405180910390a45050610e63565b846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613a0a929190614632565b60405180910390a4505050505050565b805115613a2a5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b828054828255906000526020600020908101928215613a7e579160200282015b82811115613a7e578251825591602001919060010190613a63565b50613a8a929150613a8e565b5090565b5b80821115613a8a5760008155600101613a8f565b80356001600160a01b0381168114613aba57600080fd5b919050565b60008060408385031215613ad257600080fd5b613adb83613aa3565b946020939093013593505050565b6001600160e01b031981168114610f8a57600080fd5b600060208284031215613b1157600080fd5b8135611b2281613ae9565b60005b83811015613b37578181015183820152602001613b1f565b50506000910152565b60008151808452613b58816020860160208601613b1c565b601f01601f19169290920160200192915050565b602081526000611b226020830184613b40565b600060208284031215613b9157600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613bd657613bd6613b98565b604052919050565b600082601f830112613bef57600080fd5b81356001600160401b03811115613c0857613c08613b98565b613c1b601f8201601f1916602001613bae565b818152846020838601011115613c3057600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215613c6057600080fd5b8235915060208301356001600160401b03811115613c7d57600080fd5b613c8985828601613bde565b9150509250929050565b600081518084526020808501945080840160005b83811015613cc357815187529582019590820190600101613ca7565b509495945050505050565b602081526000825160806020840152613cea60a0840182613c93565b90506020840151601f1980858403016040860152613d088383613c93565b9250604086015191508085840301606086015250613d268282613c93565b9150506060840151151560808401528091505092915050565b60006001600160401b03821115613d5857613d58613b98565b5060051b60200190565b600082601f830112613d7357600080fd5b81356020613d88613d8383613d3f565b613bae565b82815260059290921b84018101918181019086841115613da757600080fd5b8286015b84811015613dc25780358352918301918301613dab565b509695505050505050565b600080600080600060a08688031215613de557600080fd5b613dee86613aa3565b9450613dfc60208701613aa3565b935060408601356001600160401b0380821115613e1857600080fd5b613e2489838a01613d62565b94506060880135915080821115613e3a57600080fd5b613e4689838a01613d62565b93506080880135915080821115613e5c57600080fd5b50613e6988828901613bde565b9150509295509295909350565b60008060408385031215613e8957600080fd5b82359150613e9960208401613aa3565b90509250929050565b600060208284031215613eb457600080fd5b611b2282613aa3565b60008060408385031215613ed057600080fd5b82356001600160401b0380821115613ee757600080fd5b818501915085601f830112613efb57600080fd5b81356020613f0b613d8383613d3f565b82815260059290921b84018101918181019089841115613f2a57600080fd5b948201945b83861015613f4f57613f4086613aa3565b82529482019490820190613f2f565b96505086013592505080821115613f6557600080fd5b50613c8985828601613d62565b602081526000611b226020830184613c93565b60008060408385031215613f9857600080fd5b613fa183613aa3565b915060208301356001600160401b03811115613c7d57600080fd5b80358015158114613aba57600080fd5b60008060008060808587031215613fe257600080fd5b84359350602085013592506040850135915061400060608601613fbc565b905092959194509250565b600080600080600060a0868803121561402357600080fd5b8535945060208601356001600160401b038082111561404157600080fd5b61404d89838a01613d62565b9550604088013591508082111561406357600080fd5b61406f89838a01613d62565b9450606088013591508082111561408557600080fd5b5061409288828901613d62565b9250506140a160808701613fbc565b90509295509295909350565b6000806000606084860312156140c257600080fd5b6140cb84613aa3565b925060208401356001600160401b03808211156140e757600080fd5b6140f387838801613d62565b9350604086013591508082111561410957600080fd5b5061411686828701613d62565b9150509250925092565b60006020828403121561413257600080fd5b81356001600160401b0381111561414857600080fd5b61237784828501613bde565b6000806040838503121561416757600080fd5b61417083613aa3565b9150613e9960208401613fbc565b60008060006060848603121561419357600080fd5b833592506020840135915060408401356001600160401b038111156141b757600080fd5b61411686828701613bde565b600080604083850312156141d657600080fd5b6141df83613aa3565b9150613e9960208401613aa3565b600080600080600060a0868803121561420557600080fd5b61420e86613aa3565b945061421c60208701613aa3565b9350604086013592506060860135915060808601356001600160401b0381111561424557600080fd5b613e6988828901613bde565b60008060006060848603121561426657600080fd5b61426f84613aa3565b95602085013595506040909401359392505050565b600181811c9082168061429857607f821691505b602082108103610dea57634e487b7160e01b600052602260045260246000fd5b6020808252600b908201526a1c9b99c81b9bdd081cd95d60aa1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610a9457610a946142dd565b634e487b7160e01b600052603260045260246000fd5b600060018201614332576143326142dd565b5060010190565b60208082526023908201527f436f737420746f206d696e74206d75737420626520677265617465722074686160408201526206e20360ec1b606082015260800190565b601f821115610b7257600081815260208120601f850160051c810160208610156143a35750805b601f850160051c820191505b81811015610e63578281556001016143af565b81516001600160401b038111156143db576143db613b98565b6143ef816143e98454614284565b8461437c565b602080601f831160018114614424576000841561440c5750858301515b600019600386901b1c1916600185901b178555610e63565b600085815260208120601f198616915b8281101561445357888601518255948401946001909101908401614434565b50858210156144715787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115610a9457610a946142dd565b6000602082840312156144a657600080fd5b5051919050565b6000826144ca57634e487b7160e01b600052601260045260246000fd5b500690565b60008084546144dd81614284565b600182811680156144f5576001811461450a57614539565b60ff1984168752821515830287019450614539565b8860005260208060002060005b858110156145305781548a820152908401908201614517565b50505082870194505b50505050835161454d818360208801613b1c565b01949350505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061459090830184613b40565b979650505050505050565b6000602082840312156145ad57600080fd5b8151611b2281613ae9565b6001600160a01b0386811682528516602082015260a0604082018190526000906145e490830186613c93565b82810360608401526145f68186613c93565b9050828103608084015261460a8185613b40565b98975050505050505050565b60008251614628818460208701613b1c565b9190910192915050565b6040815260006146456040830185613c93565b82810360208401526135b18185613c9356feb5761ac9b056272d3bdca1168ee3dba5d2c7a79511f840134463effde592d271360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5e6e91ac34c27031e88e32d087c8a31df9ba84699c5bdce35d6bc6597c4fa5e788be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c450002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033004a593662ee04d27b6a00ebb31be7fe0c102c2ade82a7c5d764f2df05dc4e28006dcca0447a6fbf6b9082f78d259e15c7305289163862cab022fef4a3368523efa26469706673582212200826b37d7555f2ffa669973a860a74c1bd6f46016d442a7c98b5c62dd9bcb82c64736f6c63430008140033
Deployed Bytecode
0x6080604052600436106103195760003560e01c80636b20c454116101ab578063ad3cb1cc116100f7578063e8a3d48511610095578063f242432a1161006f578063f242432a146109cf578063f41743a7146109ef578063f5298aca14610a0f578063f72c0d8b14610a2f57600080fd5b8063e8a3d48514610984578063e985e9c514610999578063ecbeefec146109b957600080fd5b8063c47f0027116100d1578063c47f0027146108ee578063d1e836b51461090e578063d547741f14610930578063e63ab1e91461095057600080fd5b8063ad3cb1cc14610863578063bbaf55fb14610894578063bd85b039146108b457600080fd5b806391d1485411610164578063a05570411161013e578063a0557041146107ee578063a1b240df1461080e578063a217fddf1461082e578063a22cb4651461084357600080fd5b806391d1485414610759578063938e3d7b1461077957806394f13f4a1461079957600080fd5b80636b20c4541461069457806377097fc8146106b45780637f345710146106c75780638129fc1c146106fb5780638456cb591461071057806385f438c11461072557600080fd5b80633b84edbd1161026a5780634f1ef2861161022357806357cf54ff116101fd57806357cf54ff1461060f5780635a674c8b1461062f5780635c975abb1461064f5780636000fbcc1461067457600080fd5b80634f1ef286146105ab5780634f558e79146105be57806352d1902d146105fa57600080fd5b80633b84edbd146105085780633ccfd60b146105285780633f4ba83a1461053d5780634438512514610552578063446bc42c146105685780634e1273f41461057e57600080fd5b806318df29c4116102d75780632eb2c2d6116102b15780632eb2c2d6146104865780632f2ff15d146104a65780632fcaeac9146104c657806336568abe146104e857600080fd5b806318df29c414610419578063248a9ca3146104395780632d463c971461045957600080fd5b8062fdd58e1461031e57806301ffc9a71461035157806306fdde03146103815780630e89341c146103a3578063162094c4146103c357806318160ddd146103e5575b600080fd5b34801561032a57600080fd5b5061033e610339366004613abf565b610a63565b6040519081526020015b60405180910390f35b34801561035d57600080fd5b5061037161036c366004613aff565b610a9a565b6040519015158152602001610348565b34801561038d57600080fd5b50610396610aa5565b6040516103489190613b6c565b3480156103af57600080fd5b506103966103be366004613b7f565b610b33565b3480156103cf57600080fd5b506103e36103de366004613c4d565b610b3e565b005b3480156103f157600080fd5b507f4a593662ee04d27b6a00ebb31be7fe0c102c2ade82a7c5d764f2df05dc4e28015461033e565b34801561042557600080fd5b506103e3610434366004613c4d565b610b77565b34801561044557600080fd5b5061033e610454366004613b7f565b610c56565b34801561046557600080fd5b50610479610474366004613b7f565b610c78565b6040516103489190613cce565b34801561049257600080fd5b506103e36104a1366004613dcd565b610df0565b3480156104b257600080fd5b506103e36104c1366004613e76565b610e6b565b3480156104d257600080fd5b5061033e60008051602061465883398151915281565b3480156104f457600080fd5b506103e3610503366004613e76565b610e8d565b34801561051457600080fd5b506103e3610523366004613ea2565b610ed0565b34801561053457600080fd5b506103e3610efe565b34801561054957600080fd5b506103e3610f58565b34801561055e57600080fd5b5061033e60075481565b34801561057457600080fd5b5061033e60065481565b34801561058a57600080fd5b5061059e610599366004613ebd565b610f8d565b6040516103489190613f72565b6103e36105b9366004613f85565b611061565b3480156105ca57600080fd5b506103716105d9366004613b7f565b60009081526000805160206147188339815191526020526040902054151590565b34801561060657600080fd5b5061033e61107c565b34801561061b57600080fd5b506103e361062a366004613fcc565b61109a565b34801561063b57600080fd5b506103e361064a36600461400b565b61125a565b34801561065b57600080fd5b506000805160206146f88339815191525460ff16610371565b34801561068057600080fd5b506103e361068f366004613b7f565b611489565b3480156106a057600080fd5b506103e36106af3660046140ad565b6114c7565b6103e36106c2366004613c4d565b61153e565b3480156106d357600080fd5b5061033e7f7804d923f43a17d325d77e781528e0793b2edd9890ab45fc64efd7b4b427744c81565b34801561070757600080fd5b506103e361161c565b34801561071c57600080fd5b506103e361179a565b34801561073157600080fd5b5061033e7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e481565b34801561076557600080fd5b50610371610774366004613e76565b6117cc565b34801561078557600080fd5b506103e3610794366004614120565b611804565b3480156107a557600080fd5b506107b96107b4366004613b7f565b61183a565b604051610348919081518152602080830151908201526040808301511515908201526060918201519181019190915260800190565b3480156107fa57600080fd5b506103e3610809366004613b7f565b6118ca565b34801561081a57600080fd5b506103e3610829366004613b7f565b611908565b34801561083a57600080fd5b5061033e600081565b34801561084f57600080fd5b506103e361085e366004614154565b611926565b34801561086f57600080fd5b50610396604051806040016040528060058152602001640352e302e360dc1b81525081565b3480156108a057600080fd5b506103e36108af36600461417e565b611938565b3480156108c057600080fd5b5061033e6108cf366004613b7f565b6000908152600080516020614718833981519152602052604090205490565b3480156108fa57600080fd5b506103e3610909366004614120565b611a6a565b34801561091a57600080fd5b5061033e60008051602061473883398151915281565b34801561093c57600080fd5b506103e361094b366004613e76565b611a81565b34801561095c57600080fd5b5061033e7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b34801561099057600080fd5b50610396611a9d565b3480156109a557600080fd5b506103716109b43660046141c3565b611aaa565b3480156109c557600080fd5b5061033e60035481565b3480156109db57600080fd5b506103e36109ea3660046141ed565b611b29565b3480156109fb57600080fd5b506103e3610a0a36600461417e565b611b9c565b348015610a1b57600080fd5b506103e3610a2a366004614251565b6121ef565b348015610a3b57600080fd5b5061033e7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b60008181526000805160206146b8833981519152602090815260408083206001600160a01b03861684529091529020545b92915050565b6000610a9482612239565b60018054610ab290614284565b80601f0160208091040260200160405190810160405280929190818152602001828054610ade90614284565b8015610b2b5780601f10610b0057610100808354040283529160200191610b2b565b820191906000526020600020905b815481529060010190602001808311610b0e57829003601f168201915b505050505081565b6060610a948261225e565b7f7804d923f43a17d325d77e781528e0793b2edd9890ab45fc64efd7b4b427744c610b688161237f565b610b728383612390565b505050565b610b7f61242f565b6000546001600160a01b0316610bb05760405162461bcd60e51b8152600401610ba7906142b8565b60405180910390fd5b600754600003610bd35760405163132913ad60e31b815260040160405180910390fd5b600082600754610be391906142f3565b905080610bf1336000610a63565b1015610c3f5760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656e6f75676820676f6c6420746f206d696e740000000000000000006044820152606401610ba7565b610c4b33600083612462565b610b723384846124ca565b60009081526000805160206146d8833981519152602052604090206001015490565b610ca560405180608001604052806060815260200160608152602001606081526020016000151581525090565b600080516020614658833981519152610cbd8161237f565b6000838152600860209081526040918290208251815460a093810282018401909452608081018481529093919284928491840182828015610d1d57602002820191906000526020600020905b815481526020019060010190808311610d09575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015610d7557602002820191906000526020600020905b815481526020019060010190808311610d61575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015610dcd57602002820191906000526020600020905b815481526020019060010190808311610db9575b50505091835250506003919091015460ff16151560209091015291505b50919050565b6000610dfa612583565b9050806001600160a01b0316866001600160a01b031614158015610e255750610e238682611aaa565b155b15610e565760405163711bec9160e11b81526001600160a01b03808316600483015287166024820152604401610ba7565b610e638686868686612592565b505050505050565b610e7482610c56565b610e7d8161237f565b610e8783836125f2565b50505050565b610e95612583565b6001600160a01b0316816001600160a01b031614610ec65760405163334bd91960e11b815260040160405180910390fd5b610b728282612698565b6000610edb8161237f565b50600080546001600160a01b0319166001600160a01b0392909216919091179055565b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e4610f288161237f565b60405133904780156108fc02916000818181858888f19350505050158015610f54573d6000803e3d6000fd5b5050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610f828161237f565b610f8a612732565b50565b60608151835114610fbe5781518351604051635b05999160e01b815260048101929092526024820152604401610ba7565b600083516001600160401b03811115610fd957610fd9613b98565b604051908082528060200260200182016040528015611002578160200160208202803683370190505b50905060005b84518110156110595760208082028601015161102c90602080840287010151610a63565b82828151811061103e5761103e61430a565b602090810291909101015261105281614320565b9050611008565b509392505050565b611069612798565b6110728261283d565b610f548282612867565b6000611086612924565b506000805160206146788339815191525b90565b6000805160206146588339815191526110b28161237f565b600085116111025760405162461bcd60e51b815260206004820152601a60248201527f5f6964206d7573742062652067726561746572207468616e20300000000000006044820152606401610ba7565b600084116111525760405162461bcd60e51b815260206004820152601e60248201527f5f726172697479206d7573742062652067726561746572207468616e203000006044820152606401610ba7565b6040805160808101825286815260208082018781528515158385019081526060840188815260008b81526004909452949092208351815590516001820155905160028201805460ff191691151591909117905591516003909201919091556111b98661296d565b6111f357600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018690555b80600001517fd97b275e081f80d4337e39389411d894b137a0cce4eacd0bd2d99ce01be53af582602001518360600151846040015160405161124a9392919092835260208301919091521515604082015260600190565b60405180910390a2505050505050565b6000805160206146588339815191526112728161237f565b600086116112c25760405162461bcd60e51b815260206004820152601a60248201527f5f6964206d7573742062652067726561746572207468616e20300000000000006044820152606401610ba7565b600085511161131f5760405162461bcd60e51b815260206004820152602360248201527f5f696e70757473206d7573742068617665206174206c65617374206f6e65206960448201526274656d60e81b6064820152608401610ba7565b600084511161137c5760405162461bcd60e51b8152602060048201526024808201527f5f6f757470757473206d7573742068617665206174206c65617374206f6e65206044820152636974656d60e01b6064820152608401610ba7565b82518451146113ea5760405162461bcd60e51b815260206004820152603460248201527f5f6f75747075747320616e64205f6f75747075745261726974696573206d75736044820152730e840c4ca40e8d0ca40e6c2daca40d8cadccee8d60631b6064820152608401610ba7565b604080516080810182528681526020808201879052818301869052841515606083015260008981526008825292909220815180519293849361142f9284920190613a43565b5060208281015180516114489260018501920190613a43565b5060408201518051611464916002840191602090910190613a43565b50606091909101516003909101805460ff191691151591909117905550505050505050565b6000805160206147388339815191526114a18161237f565b600082116114c15760405162461bcd60e51b8152600401610ba790614339565b50600355565b6114cf612583565b6001600160a01b0316836001600160a01b0316141580156114f957506114f7836109b4612583565b155b1561153357611506612583565b60405163711bec9160e11b81526001600160a01b0391821660048201529084166024820152604401610ba7565b610b728383836129c3565b61154661242f565b6000546001600160a01b031661156e5760405162461bcd60e51b8152600401610ba7906142b8565b6003546000036115915760405163eafb6e3960e01b815260040160405180910390fd5b600082116115e15760405162461bcd60e51b815260206004820152601c60248201527f4d757374206d696e74206174206c65617374206f6e6520746f6b656e000000006044820152606401610ba7565b6000826003546115f191906142f3565b9050348114610c4b57604051634b23788560e11b815234600482015260248101829052604401610ba7565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156116615750825b90506000826001600160401b0316600114801561167d5750303b155b90508115801561168b575080155b156116a95760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156116d357845460ff60401b1916600160401b1785555b6116eb60405180602001604052806000815250612a09565b6116f3612a1a565b6116fb612a22565b611703612a1a565b61170b612a1a565b611713612a1a565b61171e6000336125f2565b50604080518082019091526009815268416e74686f6c6f677960b81b602082015260019061174c90826143c2565b50831561179357845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6117c48161237f565b610f8a612a32565b60009182526000805160206146d8833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7f7804d923f43a17d325d77e781528e0793b2edd9890ab45fc64efd7b4b427744c61182e8161237f565b6002610b7283826143c2565b61186760405180608001604052806000815260200160008152602001600015158152602001600081525090565b60008051602061465883398151915261187f8161237f565b5050600090815260046020908152604091829020825160808101845281548152600182015492810192909252600281015460ff16151592820192909252600390910154606082015290565b6000805160206147388339815191526118e28161237f565b600082116119025760405162461bcd60e51b8152600401610ba790614339565b50600755565b6000805160206147388339815191526119208161237f565b50600655565b610f54611931612583565b8383612a7d565b61194061242f565b600083116119905760405162461bcd60e51b815260206004820152601e60248201527f746f6b656e4964206d7573742062652067726561746572207468616e203000006044820152606401610ba7565b600082116119e05760405162461bcd60e51b815260206004820152601c60248201527f4d75737420616c6368206174206c65617374206f6e6520746f6b656e000000006044820152606401610ba7565b6119f26119eb612583565b8484612462565b611a2d6119fd612583565b600060065485611a0d91906142f3565b60405180604001604052806002815260200161060f60f31b815250612b25565b611a35612583565b6001600160a01b0316600060008051602061469883398151915283604051611a5d9190613b6c565b60405180910390a3505050565b6000611a758161237f565b6001610b7283826143c2565b611a8a82610c56565b611a938161237f565b610e878383612698565b60028054610ab290614284565b600073207fa8df3a17d96ca7ea4f2893fcdcb78a304100196001600160a01b03831601611ad957506001610a94565b6001600160a01b0380841660009081527f88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c4501602090815260408083209386168352929052205460ff165b9392505050565b6000611b33612583565b9050806001600160a01b0316866001600160a01b031614158015611b5e5750611b5c8682611aaa565b155b15611b8f5760405163711bec9160e11b81526001600160a01b03808316600483015287166024820152604401610ba7565b610e638686868686612b82565b611ba461242f565b60008211611bf45760405162461bcd60e51b815260206004820152601f60248201527f4d7573742070726f63657373206174206c65617374206f6e6520746f6b656e006044820152606401610ba7565b60008381526008602090815260408083208151815460a09481028201850190935260808101838152909391928492849190840182828015611c5457602002820191906000526020600020905b815481526020019060010190808311611c40575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015611cac57602002820191906000526020600020905b815481526020019060010190808311611c98575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015611d0457602002820191906000526020600020905b815481526020019060010190808311611cf0575b50505091835250506003919091015460ff161515602090910152606081015190915015611d735760405162461bcd60e51b815260206004820181905260248201527f50726f6365737361626c65206974656d20697320646973636f6e74696e7565646044820152606401610ba7565b805151611dc25760405162461bcd60e51b815260206004820152601e60248201527f50726f6365737361626c65206974656d20686173206e6f20696e7075747300006044820152606401610ba7565b600081602001515111611e175760405162461bcd60e51b815260206004820152601f60248201527f50726f6365737361626c65206974656d20686173206e6f206f757470757473006044820152606401610ba7565b60005b838110156117935760005b825151811015611e6f57611e5d611e3a612583565b8451805184908110611e4e57611e4e61430a565b60200260200101516001612462565b80611e6781614320565b915050611e25565b50816020015151600103611f2f57611ec8611e88612583565b8360200151600081518110611e9f57611e9f61430a565b60200260200101518660405180604001604052806002815260200161060f60f31b815250612b25565b611ed0612583565b6001600160a01b03168260200151600081518110611ef057611ef061430a565b602002602001015160008051602061469883398151915285604051611f159190613b6c565b60405180910390a380611f2781614320565b9150506121dd565b6000808360200151516001600160401b03811115611f4f57611f4f613b98565b604051908082528060200260200182016040528015611f78578160200160208202803683370190505b50905060005b846020015151811015612044576004600086602001518381518110611fa557611fa561430a565b60209081029190910181015182528101919091526040016000206002015460ff166120325784602001518181518110611fe057611fe061430a565b6020026020010151828281518110611ffa57611ffa61430a565b6020026020010181815250508460400151818151811061201c5761201c61430a565b60200260200101518361202f9190614481565b92505b8061203c81614320565b915050611f7e565b5080511580612051575081155b1561206f576040516337e7792360e11b815260040160405180910390fd5b600080546040805163dbdff2c160e01b8152905185926001600160a01b03169163dbdff2c1916004808301926020929190829003018188875af11580156120ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120de9190614494565b6120e891906144ad565b90506000805b83518110156121d7578660400151818151811061210d5761210d61430a565b6020026020010151826121209190614481565b91508183116121c557612170612134612583565b8583815181106121465761214661430a565b6020026020010151600160405180604001604052806002815260200161060f60f31b815250612b25565b612178612583565b6001600160a01b03168482815181106121935761219361430a565b60200260200101516000805160206146988339815191528a6040516121b89190613b6c565b60405180910390a36121d7565b806121cf81614320565b9150506120ee565b50505050505b806121e781614320565b915050611e1a565b6121f7612583565b6001600160a01b0316836001600160a01b031614158015612221575061221f836109b4612583565b155b1561222e57611506612583565b610b72838383612462565b60006001600160e01b03198216637965db0b60e01b1480610a945750610a9482612c10565b60008181527f89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c5586016020526040812080546060927f89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c5586009290916122bd90614284565b80601f01602080910402602001604051908101604052809291908181526020018280546122e990614284565b80156123365780601f1061230b57610100808354040283529160200191612336565b820191906000526020600020905b81548152906001019060200180831161231957829003601f168201915b5050505050905060008151116123545761234f84612c60565b612377565b60405161236790839083906020016144cf565b6040516020818303038152906040525b949350505050565b610f8a8161238b612583565b612d25565b60008281527f89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c558601602052604090207f89fc852226e759c7c636cf34d732f0198fc56a54876b2374a52beb7b0c558600906123e983826143c2565b50827f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61241585610b33565b6040516124229190613b6c565b60405180910390a2505050565b6000805160206146f88339815191525460ff16156124605760405163d93c066560e01b815260040160405180910390fd5b565b6001600160a01b03831661248b57604051626a0d4560e21b815260006004820152602401610ba7565b604080516001808252602082018590528183019081526060820184905260a0820190925260006080820181815291929161179391879185908590612d5e565b6124d261242f565b6000546001600160a01b03166124fa5760405162461bcd60e51b8152600401610ba7906142b8565b60005b82811015610e8757600061250f612dbb565b905061253c858260000151600160405180604001604052806002815260200161060f60f31b815250612b25565b846001600160a01b03168160000151600080516020614698833981519152856040516125689190613b6c565b60405180910390a38161257a81614320565b925050506124fd565b600061258d61316a565b905090565b6001600160a01b0384166125bc57604051632bfa23e760e11b815260006004820152602401610ba7565b6001600160a01b0385166125e557604051626a0d4560e21b815260006004820152602401610ba7565b6117938585858585612d5e565b60006000805160206146d883398151915261260d84846117cc565b61268e576000848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055612644612583565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610a94565b6000915050610a94565b60006000805160206146d88339815191526126b384846117cc565b1561268e576000848152602082815260408083206001600160a01b03871684529091529020805460ff191690556126e8612583565b6001600160a01b0316836001600160a01b0316857ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a46001915050610a94565b61273a6131c5565b6000805160206146f8833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61277a612583565b6040516001600160a01b03909116815260200160405180910390a150565b306001600160a01b037f00000000000000000000000063d98163e5ce8f7a39481a1f12565f8faba5eec216148061281f57507f00000000000000000000000063d98163e5ce8f7a39481a1f12565f8faba5eec26001600160a01b0316612813600080516020614678833981519152546001600160a01b031690565b6001600160a01b031614155b156124605760405163703e46dd60e11b815260040160405180910390fd5b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3610f548161237f565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156128c1575060408051601f3d908101601f191682019092526128be91810190614494565b60015b6128e957604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610ba7565b600080516020614678833981519152811461291a57604051632a87526960e21b815260048101829052602401610ba7565b610b7283836131f5565b306001600160a01b037f00000000000000000000000063d98163e5ce8f7a39481a1f12565f8faba5eec216146124605760405163703e46dd60e11b815260040160405180910390fd5b6000805b6005548110156129ba57826005828154811061298f5761298f61430a565b9060005260206000200154036129a85750600192915050565b806129b281614320565b915050612971565b50600092915050565b6001600160a01b0383166129ec57604051626a0d4560e21b815260006004820152602401610ba7565b610b72836000848460405180602001604052806000815250612d5e565b612a1161324b565b610f8a81613294565b61246061324b565b612a2a61324b565b6124606132a5565b612a3a61242f565b6000805160206146f8833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861277a612583565b6000805160206146b88339815191526001600160a01b038316612ab55760405162ced3e160e81b815260006004820152602401610ba7565b6001600160a01b038481166000818152600184016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b038416612b4f57604051632bfa23e760e11b815260006004820152602401610ba7565b60408051600180825260208201869052818301908152606082018590526080820190925290610e63600087848487612d5e565b6001600160a01b038416612bac57604051632bfa23e760e11b815260006004820152602401610ba7565b6001600160a01b038516612bd557604051626a0d4560e21b815260006004820152602401610ba7565b60408051600180825260208201869052818301908152606082018590526080820190925290612c078787848487612d5e565b50505050505050565b60006001600160e01b03198216636cdb3d1360e11b1480612c4157506001600160e01b031982166303a24d0760e21b145b80610a9457506301ffc9a760e01b6001600160e01b0319831614610a94565b7f88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c450280546060916000805160206146b883398151915291612c9f90614284565b80601f0160208091040260200160405190810160405280929190818152602001828054612ccb90614284565b8015612d185780601f10612ced57610100808354040283529160200191612d18565b820191906000526020600020905b815481529060010190602001808311612cfb57829003601f168201915b5050505050915050919050565b612d2f82826117cc565b610f545760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610ba7565b612d6a858585856132c6565b6001600160a01b03841615611793576000612d83612583565b90508351600103612dad5760208481015190840151612da68389898585896132d2565b5050610e63565b610e638187878787876133f6565b612de860405180608001604052806000815260200160008152602001600015158152602001600081525090565b6000546001600160a01b0316612e105760405162461bcd60e51b8152600401610ba7906142b8565b60055460009081906001600160401b03811115612e2f57612e2f613b98565b604051908082528060200260200182016040528015612e58578160200160208202803683370190505b50905060005b600554811015612fea576004600060058381548110612e7f57612e7f61430a565b6000918252602080832090910154835282019290925260400190206002015460ff16612fd85760006004600060058481548110612ebe57612ebe61430a565b9060005260206000200154815260200190815260200160002060030154118015612f5a57506004600060058381548110612efa57612efa61430a565b9060005260206000200154815260200190815260200160002060030154612f5760058381548110612f2d57612f2d61430a565b90600052602060002001546000908152600080516020614718833981519152602052604090205490565b10155b612fd85760058181548110612f7157612f7161430a565b9060005260206000200154828281518110612f8e57612f8e61430a565b60200260200101818152505060046000838381518110612fb057612fb061430a565b602002602001015181526020019081526020016000206001015483612fd59190614481565b92505b80612fe281614320565b915050612e5e565b5080511580612ff7575081155b15613015576040516337e7792360e11b815260040160405180910390fd5b600080546040805163dbdff2c160e01b8152905185926001600160a01b03169163dbdff2c1916004808301926020929190829003018188875af1158015613060573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130849190614494565b61308e91906144ad565b90506000805b835181101561316257600460008583815181106130b3576130b361430a565b6020026020010151815260200190815260200160002060010154826130d89190614481565b915081831161315057600460008583815181106130f7576130f761430a565b6020908102919091018101518252818101929092526040908101600020815160808101835281548152600182015493810193909352600281015460ff161515918301919091526003015460608201529695505050505050565b8061315a81614320565b915050613094565b505050505090565b60003033036131c057600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b031691506110979050565b503390565b6000805160206146f88339815191525460ff1661246057604051638dfc202b60e01b815260040160405180910390fd5b6131fe826134df565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a280511561324357610b728282613544565b610f546135ba565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661246057604051631afcd79f60e31b815260040160405180910390fd5b61329c61324b565b610f8a816135d9565b6132ad61324b565b6000805160206146f8833981519152805460ff19169055565b610e8784848484613613565b6001600160a01b0384163b15610e635760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906133169089908990889088908890600401614556565b6020604051808303816000875af1925050508015613351575060408051601f3d908101601f1916820190925261334e9181019061459b565b60015b6133ba573d80801561337f576040519150601f19603f3d011682016040523d82523d6000602084013e613384565b606091505b5080516000036133b257604051632bfa23e760e11b81526001600160a01b0386166004820152602401610ba7565b805181602001fd5b6001600160e01b0319811663f23a6e6160e01b14612c0757604051632bfa23e760e11b81526001600160a01b0386166004820152602401610ba7565b6001600160a01b0384163b15610e635760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061343a90899089908890889088906004016145b8565b6020604051808303816000875af1925050508015613475575060408051601f3d908101601f191682019092526134729181019061459b565b60015b6134a3573d80801561337f576040519150601f19603f3d011682016040523d82523d6000602084013e613384565b6001600160e01b0319811663bc197c8160e01b14612c0757604051632bfa23e760e11b81526001600160a01b0386166004820152602401610ba7565b806001600160a01b03163b60000361351557604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610ba7565b60008051602061467883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516135619190614616565b600060405180830381855af49150503d806000811461359c576040519150601f19603f3d011682016040523d82523d6000602084013e6135a1565b606091505b50915091506135b1858383613785565b95945050505050565b34156124605760405163b398979f60e01b815260040160405180910390fd5b6000805160206146b88339815191527f88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c4502610b7283826143c2565b60008051602061471883398151915261362e858585856137e1565b6001600160a01b0385166136e5576000805b84518110156136c957600084828151811061365d5761365d61430a565b60200260200101519050808460000160008885815181106136805761368061430a565b6020026020010151815260200190815260200160002060008282546136a59190614481565b909155506136b590508184614481565b925050806136c290614320565b9050613640565b50808260010160008282546136de9190614481565b9091555050505b6001600160a01b038416611793576000805b84518110156137715760008482815181106137145761371461430a565b60200260200101519050808460000160008885815181106137375761373761430a565b60200260200101518152602001908152602001600020600082825403925050819055508083019250508061376a90614320565b90506136f7565b506001820180549190910390555050505050565b60608261379a5761379582613a1a565b611b22565b81511580156137b157506001600160a01b0384163b155b156137da57604051639996b31560e01b81526001600160a01b0385166004820152602401610ba7565b5092915050565b805182516000805160206146b883398151915291146138205782518251604051635b05999160e01b815260048101929092526024820152604401610ba7565b600061382a612583565b905060005b845181101561393a576020818102868101820151908601909101516001600160a01b038916156138e2576000828152602086815260408083206001600160a01b038d168452909152902054818110156138bb576040516303dee4c560e01b81526001600160a01b038b166004820152602481018290526044810183905260648101849052608401610ba7565b6000838152602087815260408083206001600160a01b038e16845290915290209082900390555b6001600160a01b03881615613927576000828152602086815260408083206001600160a01b038c16845290915281208054839290613921908490614481565b90915550505b50508061393390614320565b905061382f565b5083516001036139bb5760208401516000906020850151909150866001600160a01b0316886001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6285856040516139ac929190918252602082015260400190565b60405180910390a45050610e63565b846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613a0a929190614632565b60405180910390a4505050505050565b805115613a2a5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b828054828255906000526020600020908101928215613a7e579160200282015b82811115613a7e578251825591602001919060010190613a63565b50613a8a929150613a8e565b5090565b5b80821115613a8a5760008155600101613a8f565b80356001600160a01b0381168114613aba57600080fd5b919050565b60008060408385031215613ad257600080fd5b613adb83613aa3565b946020939093013593505050565b6001600160e01b031981168114610f8a57600080fd5b600060208284031215613b1157600080fd5b8135611b2281613ae9565b60005b83811015613b37578181015183820152602001613b1f565b50506000910152565b60008151808452613b58816020860160208601613b1c565b601f01601f19169290920160200192915050565b602081526000611b226020830184613b40565b600060208284031215613b9157600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613bd657613bd6613b98565b604052919050565b600082601f830112613bef57600080fd5b81356001600160401b03811115613c0857613c08613b98565b613c1b601f8201601f1916602001613bae565b818152846020838601011115613c3057600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215613c6057600080fd5b8235915060208301356001600160401b03811115613c7d57600080fd5b613c8985828601613bde565b9150509250929050565b600081518084526020808501945080840160005b83811015613cc357815187529582019590820190600101613ca7565b509495945050505050565b602081526000825160806020840152613cea60a0840182613c93565b90506020840151601f1980858403016040860152613d088383613c93565b9250604086015191508085840301606086015250613d268282613c93565b9150506060840151151560808401528091505092915050565b60006001600160401b03821115613d5857613d58613b98565b5060051b60200190565b600082601f830112613d7357600080fd5b81356020613d88613d8383613d3f565b613bae565b82815260059290921b84018101918181019086841115613da757600080fd5b8286015b84811015613dc25780358352918301918301613dab565b509695505050505050565b600080600080600060a08688031215613de557600080fd5b613dee86613aa3565b9450613dfc60208701613aa3565b935060408601356001600160401b0380821115613e1857600080fd5b613e2489838a01613d62565b94506060880135915080821115613e3a57600080fd5b613e4689838a01613d62565b93506080880135915080821115613e5c57600080fd5b50613e6988828901613bde565b9150509295509295909350565b60008060408385031215613e8957600080fd5b82359150613e9960208401613aa3565b90509250929050565b600060208284031215613eb457600080fd5b611b2282613aa3565b60008060408385031215613ed057600080fd5b82356001600160401b0380821115613ee757600080fd5b818501915085601f830112613efb57600080fd5b81356020613f0b613d8383613d3f565b82815260059290921b84018101918181019089841115613f2a57600080fd5b948201945b83861015613f4f57613f4086613aa3565b82529482019490820190613f2f565b96505086013592505080821115613f6557600080fd5b50613c8985828601613d62565b602081526000611b226020830184613c93565b60008060408385031215613f9857600080fd5b613fa183613aa3565b915060208301356001600160401b03811115613c7d57600080fd5b80358015158114613aba57600080fd5b60008060008060808587031215613fe257600080fd5b84359350602085013592506040850135915061400060608601613fbc565b905092959194509250565b600080600080600060a0868803121561402357600080fd5b8535945060208601356001600160401b038082111561404157600080fd5b61404d89838a01613d62565b9550604088013591508082111561406357600080fd5b61406f89838a01613d62565b9450606088013591508082111561408557600080fd5b5061409288828901613d62565b9250506140a160808701613fbc565b90509295509295909350565b6000806000606084860312156140c257600080fd5b6140cb84613aa3565b925060208401356001600160401b03808211156140e757600080fd5b6140f387838801613d62565b9350604086013591508082111561410957600080fd5b5061411686828701613d62565b9150509250925092565b60006020828403121561413257600080fd5b81356001600160401b0381111561414857600080fd5b61237784828501613bde565b6000806040838503121561416757600080fd5b61417083613aa3565b9150613e9960208401613fbc565b60008060006060848603121561419357600080fd5b833592506020840135915060408401356001600160401b038111156141b757600080fd5b61411686828701613bde565b600080604083850312156141d657600080fd5b6141df83613aa3565b9150613e9960208401613aa3565b600080600080600060a0868803121561420557600080fd5b61420e86613aa3565b945061421c60208701613aa3565b9350604086013592506060860135915060808601356001600160401b0381111561424557600080fd5b613e6988828901613bde565b60008060006060848603121561426657600080fd5b61426f84613aa3565b95602085013595506040909401359392505050565b600181811c9082168061429857607f821691505b602082108103610dea57634e487b7160e01b600052602260045260246000fd5b6020808252600b908201526a1c9b99c81b9bdd081cd95d60aa1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610a9457610a946142dd565b634e487b7160e01b600052603260045260246000fd5b600060018201614332576143326142dd565b5060010190565b60208082526023908201527f436f737420746f206d696e74206d75737420626520677265617465722074686160408201526206e20360ec1b606082015260800190565b601f821115610b7257600081815260208120601f850160051c810160208610156143a35750805b601f850160051c820191505b81811015610e63578281556001016143af565b81516001600160401b038111156143db576143db613b98565b6143ef816143e98454614284565b8461437c565b602080601f831160018114614424576000841561440c5750858301515b600019600386901b1c1916600185901b178555610e63565b600085815260208120601f198616915b8281101561445357888601518255948401946001909101908401614434565b50858210156144715787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80820180821115610a9457610a946142dd565b6000602082840312156144a657600080fd5b5051919050565b6000826144ca57634e487b7160e01b600052601260045260246000fd5b500690565b60008084546144dd81614284565b600182811680156144f5576001811461450a57614539565b60ff1984168752821515830287019450614539565b8860005260208060002060005b858110156145305781548a820152908401908201614517565b50505082870194505b50505050835161454d818360208801613b1c565b01949350505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061459090830184613b40565b979650505050505050565b6000602082840312156145ad57600080fd5b8151611b2281613ae9565b6001600160a01b0386811682528516602082015260a0604082018190526000906145e490830186613c93565b82810360608401526145f68186613c93565b9050828103608084015261460a8185613b40565b98975050505050505050565b60008251614628818460208701613b1c565b9190910192915050565b6040815260006146456040830185613c93565b82810360208401526135b18185613c9356feb5761ac9b056272d3bdca1168ee3dba5d2c7a79511f840134463effde592d271360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5e6e91ac34c27031e88e32d087c8a31df9ba84699c5bdce35d6bc6597c4fa5e788be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c450002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033004a593662ee04d27b6a00ebb31be7fe0c102c2ade82a7c5d764f2df05dc4e28006dcca0447a6fbf6b9082f78d259e15c7305289163862cab022fef4a3368523efa26469706673582212200826b37d7555f2ffa669973a860a74c1bd6f46016d442a7c98b5c62dd9bcb82c64736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 29 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.