Feature Tip: Add private address tag to any address under My Name Tag !
ERC-1155
Overview
Max Total Supply
0 SANWEAR
Holders
174
Total Transfers
-
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
SANWEAR
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 3333 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.22; /** ███████╗ █████╗ ███╗ ██╗ * ██╔════╝██╔══██╗████╗ ██║ * ███████╗███████║██╔██╗ ██║ * ╚════██║██╔══██║██║╚██╗██║ * ███████║██║ ██║██║ ╚████║ * ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ * * █████████████╗ * ╚════════════╝ * ███████████╗ * ╚══════════╝ * █████████████████╗ * ╚════════════════╝ * * ██╗ ██╗███████╗ █████╗ ██████╗ * ██║ ██║██╔════╝██╔══██╗██╔══██╗ * ██║ █╗ ██║█████╗ ███████║██████╔╝ * ██║███╗██║██╔══╝ ██╔══██║██╔══██╗ * ╚███╔███╔╝███████╗██║ ██║██║ ██║ * ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ */ import {Ownable} from "lib/openzeppelin-contracts/contracts/access/Ownable.sol"; import {AccessControl} from "lib/openzeppelin-contracts/contracts/access/AccessControl.sol"; import {ERC1155URIStorage, ERC1155} from "lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol"; import {ArrayUtils} from "./utils/ArrayUtils.sol"; import {ISANWEAR} from "./ISANWEAR.sol"; import {ISANWORN} from "./ISANWORN.sol"; import {ERC2981Plus, ERC2981} from "./ERC2981Plus.sol"; /** * @title SANWEAR™ by SAN SOUND * @author Aaron Hanson <[email protected]> @CoffeeConverter * @notice https://sansound.io/ */ contract SANWEAR is Ownable, AccessControl, ERC1155URIStorage, ERC2981Plus, ISANWEAR { error ArrayLengthMismatch(); error ClaimAmountZero(); error ClaimInactive(); error InvalidTokenId(); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); ISANWORN public SANWORN; string public constant name = "SANWEAR by SAN SOUND"; string public constant symbol = "SANWEAR"; string public contractURI; constructor( string memory _uri, string memory _contractUri, address _royaltyReceiver, uint96 _royaltyBps ) ERC1155(_uri) Ownable(_msgSender()) { contractURI = _contractUri; _setDefaultRoyalty(_royaltyReceiver, _royaltyBps); _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); } function claim( uint256 _id, uint256 _amount ) external { if (address(SANWORN) == address(0)) revert ClaimInactive(); if (_amount == 0) revert ClaimAmountZero(); _burn(_msgSender(), _id, _amount); if (_amount == 1) SANWORN.mint(_msgSender(), _id); else { (uint256[] memory ids, uint256[] memory amounts) = ArrayUtils._toSingletonArrays(_id, _amount); SANWORN.mintBatch(_msgSender(), ids, amounts); } } function claimBatch( uint256[] memory _ids, uint256[] memory _amounts ) external { if (address(SANWORN) == address(0)) revert ClaimInactive(); _burnBatch(_msgSender(), _ids, _amounts); SANWORN.mintBatch(_msgSender(), _ids, _amounts); } function mint( address _to, uint256 _id, uint256 _amount ) external onlyRole(MINTER_ROLE) { if (_id == 0) revert InvalidTokenId(); _mint(_to, _id, _amount, ""); } function mintBatch( address _to, uint256[] calldata _ids, uint256[] calldata _amounts ) public onlyRole(MINTER_ROLE) { for (uint i; i < _ids.length; ++i) { if (_ids[i] == 0) revert InvalidTokenId(); } _mintBatch(_to, _ids, _amounts, ""); } function mintBatches( address[] calldata _tos, uint256[][] calldata _ids, uint256[][] calldata _amounts ) external onlyRole(MINTER_ROLE) { uint256 numTos = _tos.length; for (uint i; i < numTos; ++i) { mintBatch(_tos[i], _ids[i], _amounts[i]); } } function setSanworn( address _sanworn ) external onlyOwner { SANWORN = ISANWORN(_sanworn); } function setContractURI(string calldata _newContractURI) external onlyOwner { contractURI = _newContractURI; } function setTokenURI( uint256 _tokenId, string calldata _tokenURI ) external onlyOwner { _setURI(_tokenId, _tokenURI); } function setTokenURIBatch( uint256[] calldata _tokenIds, string[] calldata _tokenURIs ) external onlyOwner { if (_tokenIds.length != _tokenURIs.length) revert ArrayLengthMismatch(); for (uint i; i < _tokenIds.length; ++i) { _setURI(_tokenIds[i], _tokenURIs[i]); } } function setTokenBaseURI( string calldata _tokenBaseURI ) external onlyOwner { _setBaseURI(_tokenBaseURI); } function setURI( string calldata _newURI ) external onlyOwner { _setURI(_newURI); } function supportsInterface(bytes4 interfaceId) public view virtual override (ERC1155, ERC2981, AccessControl) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.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 AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @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); _; } /** * @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) { 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) { 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 { 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) { 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) { 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) (token/ERC1155/extensions/ERC1155URIStorage.sol) pragma solidity ^0.8.20; import {Strings} from "../../../utils/Strings.sol"; import {ERC1155} from "../ERC1155.sol"; /** * @dev ERC1155 token with storage based token URI management. * Inspired by the ERC721URIStorage extension */ abstract contract ERC1155URIStorage is ERC1155 { using Strings for uint256; // Optional base URI string private _baseURI = ""; // Optional mapping for token URIs mapping(uint256 tokenId => string) private _tokenURIs; /** * @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) { 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 { _tokenURIs[tokenId] = tokenURI; emit URI(uri(tokenId), tokenId); } /** * @dev Sets `baseURI` as the `_baseURI` for all tokens */ function _setBaseURI(string memory baseURI) internal virtual { _baseURI = baseURI; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.22; library ArrayUtils { function _toSingletonArrays( uint256 element1, uint256 element2 ) internal 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 pragma solidity 0.8.22; interface ISANWEAR { function mint(address _to, uint256 _id, uint256 _amount) external; function mintBatch(address _to, uint256[] calldata _ids, uint256[] calldata _amounts) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.22; interface ISANWORN { function mint(address _to, uint256 _colorwayId) external; function mintBatch(address _to, uint256[] calldata _colorwayIds, uint256[] calldata _amounts) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.22; import {Ownable} from "lib/openzeppelin-contracts/contracts/access/Ownable.sol"; import {ERC2981} from "lib/openzeppelin-contracts/contracts/token/common/ERC2981.sol"; abstract contract ERC2981Plus is Ownable, ERC2981 { event DefaultRoyaltySet(address recipient, uint16 bps); function setDefaultRoyalty( address _receiver, uint96 _feeNumerator ) external onlyOwner { _setDefaultRoyalty(_receiver, _feeNumerator); } function _setDefaultRoyalty( address _receiver, uint96 _feeNumerator ) internal override { super._setDefaultRoyalty(_receiver, _feeNumerator); emit DefaultRoyaltySet(_receiver, uint16(_feeNumerator)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// 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) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.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 ERC165 is IERC165 { /** * @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/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: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "./IERC1155.sol"; import {IERC1155Receiver} from "./IERC1155Receiver.sol"; import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol"; import {Context} from "../../utils/Context.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {Arrays} from "../../utils/Arrays.sol"; import {IERC1155Errors} from "../../interfaces/draft-IERC6093.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 ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors { using Arrays for uint256[]; using Arrays for address[]; mapping(uint256 id => mapping(address account => uint256)) private _balances; mapping(address account => mapping(address operator => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, 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) { return _uri; } /** * @dev See {IERC1155-balanceOf}. */ function balanceOf(address account, uint256 id) public view virtual returns (uint256) { 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) { 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 { 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 { _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 { 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/common/ERC2981.sol) pragma solidity ^0.8.20; import {IERC2981} from "../../interfaces/IERC2981.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1). */ error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator); /** * @dev The default royalty receiver is invalid. */ error ERC2981InvalidDefaultRoyaltyReceiver(address receiver); /** * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1). */ error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator); /** * @dev The royalty receiver for `tokenId` is invalid. */ error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver); /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { uint256 denominator = _feeDenominator(); if (feeNumerator > denominator) { // Royalty fee will exceed the sale price revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator); } if (receiver == address(0)) { revert ERC2981InvalidDefaultRoyaltyReceiver(address(0)); } _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { uint256 denominator = _feeDenominator(); if (feeNumerator > denominator) { // Royalty fee will exceed the sale price revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator); } if (receiver == address(0)) { revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0)); } _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// 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) (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) (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) (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) (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) (interfaces/IERC2981.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount); }
// 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 } } }
{ "remappings": [ "@openzeppelin/=lib/erc6551/lib/openzeppelin-contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "erc6551/=lib/erc6551/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 3333 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_uri","type":"string"},{"internalType":"string","name":"_contractUri","type":"string"},{"internalType":"address","name":"_royaltyReceiver","type":"address"},{"internalType":"uint96","name":"_royaltyBps","type":"uint96"}],"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":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"ClaimAmountZero","type":"error"},{"inputs":[],"name":"ClaimInactive","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":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"InvalidTokenId","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","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":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint16","name":"bps","type":"uint16"}],"name":"DefaultRoyaltySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SANWORN","outputs":[{"internalType":"contract ISANWORN","name":"","type":"address"}],"stateMutability":"view","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":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"claimBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tos","type":"address[]"},{"internalType":"uint256[][]","name":"_ids","type":"uint256[][]"},{"internalType":"uint256[][]","name":"_amounts","type":"uint256[][]"}],"name":"mintBatches","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"address","name":"_receiver","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sanworn","type":"address"}],"name":"setSanworn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_tokenBaseURI","type":"string"}],"name":"setTokenBaseURI","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":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"string[]","name":"_tokenURIs","type":"string[]"}],"name":"setTokenURIBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newURI","type":"string"}],"name":"setURI","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":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a0604052600060809081526005906200001a90826200035b565b503480156200002857600080fd5b50604051620033a1380380620033a18339810160408190526200004b91620004d9565b8333806200007457604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200007f81620000bf565b506200008b816200010f565b50600a6200009a84826200035b565b50620000a7828262000121565b620000b460003362000176565b505050505062000585565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60046200011d82826200035b565b5050565b6200012d82826200020d565b604080516001600160a01b038416815261ffff831660208201527f2c5ea6e4103e78cb101e796fb2dace540362fc542cbff5145eaa24af7dd8fe41910160405180910390a15050565b60008281526001602090815260408083206001600160a01b038516845290915281205460ff16620002035760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a450600162000207565b5060005b92915050565b6127106001600160601b0382168110156200024e57604051636f483d0960e01b81526001600160601b0383166004820152602481018290526044016200006b565b6001600160a01b0383166200027a57604051635b6cc80560e11b8152600060048201526024016200006b565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600755565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002df57607f821691505b6020821081036200030057634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000356576000816000526020600020601f850160051c81016020861015620003315750805b601f850160051c820191505b8181101562000352578281556001016200033d565b5050505b505050565b81516001600160401b03811115620003775762000377620002b4565b6200038f81620003888454620002ca565b8462000306565b602080601f831160018114620003c75760008415620003ae5750858301515b600019600386901b1c1916600185901b17855562000352565b600085815260208120601f198616915b82811015620003f857888601518255948401946001909101908401620003d7565b5085821015620004175787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082601f8301126200043957600080fd5b81516001600160401b0380821115620004565762000456620002b4565b604051601f8301601f19908116603f01168101908282118183101715620004815762000481620002b4565b81604052838152602092508660208588010111156200049f57600080fd5b600091505b83821015620004c35785820183015181830184015290820190620004a4565b6000602085830101528094505050505092915050565b60008060008060808587031215620004f057600080fd5b84516001600160401b03808211156200050857600080fd5b620005168883890162000427565b955060208701519150808211156200052d57600080fd5b506200053c8782880162000427565b604087015190945090506001600160a01b03811681146200055c57600080fd5b60608601519092506001600160601b03811681146200057a57600080fd5b939692955090935050565b612e0c80620005956000396000f3fe608060405234801561001057600080fd5b50600436106102405760003560e01c8063715018a611610145578063d5391393116100bd578063e985e9c51161008c578063f2fde38b11610071578063f2fde38b146105be578063f5e2a141146105d1578063ff45ee31146105e457600080fd5b8063e985e9c51461056f578063f242432a146105ab57600080fd5b8063d53913931461051a578063d547741f14610541578063d81d0a1514610554578063e8a3d4851461056757600080fd5b8063938e3d7b11610114578063a217fddf116100f9578063a217fddf146104ec578063a22cb465146104f4578063c34902631461050757600080fd5b8063938e3d7b1461049d57806395d89b41146104b057600080fd5b8063715018a6146104385780638da5cb5b146104405780638ef79e911461045157806391d148541461046457600080fd5b8063162094c4116101d85780632f2ff15d116101a7578063478b47fa1161018c578063478b47fa146103f25780634bb99351146104055780634e1273f41461041857600080fd5b80632f2ff15d146103cc57806336568abe146103df57600080fd5b8063162094c414610350578063248a9ca3146103635780632a55205a146103875780632eb2c2d6146103b957600080fd5b806306fdde031161021457806306fdde03146102b65780630e89341c146102ff578063156e29f61461031257806315b2f58a1461032557600080fd5b8062fdd58e1461024557806301ffc9a71461026b57806302fe53051461028e57806304634d8d146102a3575b600080fd5b610258610253366004612099565b6105f7565b6040519081526020015b60405180910390f35b61027e6102793660046120f1565b610621565b6040519015158152602001610262565b6102a161029c366004612150565b61062c565b005b6102a16102b1366004612192565b610677565b6102f26040518060400160405280601481526020017f53414e574541522062792053414e20534f554e4400000000000000000000000081525081565b604051610262919061222a565b6102f261030d36600461223d565b610689565b6102a1610320366004612256565b610769565b600954610338906001600160a01b031681565b6040516001600160a01b039091168152602001610262565b6102a161035e366004612289565b6107ee565b61025861037136600461223d565b6000908152600160208190526040909120015490565b61039a6103953660046122d5565b61083b565b604080516001600160a01b039093168352602083019190915201610262565b6102a16103c7366004612441565b61091a565b6102a16103da3660046124eb565b6109be565b6102a16103ed3660046124eb565b6109e4565b6102a161040036600461255c565b610a30565b6102a16104133660046125f6565b610aeb565b61042b610426366004612662565b610bc0565b604051610262919061275e565b6102a1610ca6565b6000546001600160a01b0316610338565b6102a161045f366004612150565b610cba565b61027e6104723660046124eb565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6102a16104ab366004612150565b610d01565b6102f26040518060400160405280600781526020017f53414e574541520000000000000000000000000000000000000000000000000081525081565b610258600081565b6102a1610502366004612771565b610d16565b6102a16105153660046122d5565b610d21565b6102587f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102a161054f3660046124eb565b610ecd565b6102a16105623660046127a2565b610ef3565b6102f2610fff565b61027e61057d366004612823565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b6102a16105b936600461284d565b61108d565b6102a16105cc3660046128b2565b611124565b6102a16105df3660046128b2565b61117b565b6102a16105f23660046128cd565b6111bd565b60008181526002602090815260408083206001600160a01b03861684529091529020545b92915050565b600061061b8261123c565b610634611292565b61067382828080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506112d892505050565b5050565b61067f611292565b61067382826112e4565b6000818152600660205260408120805460609291906106a79061291a565b80601f01602080910402602001604051908101604052809291908181526020018280546106d39061291a565b80156107205780601f106106f557610100808354040283529160200191610720565b820191906000526020600020905b81548152906001019060200180831161070357829003601f168201915b50505050509050600081511161073e5761073983611337565b610762565b600581604051602001610752929190612954565b6040516020818303038152906040525b9392505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610793816113cb565b826000036107cd576040517f3f6cc76800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107e8848484604051806020016040528060008152506113d5565b50505050565b6107f6611292565b6108368383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061143292505050565b505050565b60008281526008602090815260408083208151808301909252546001600160a01b038116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff169282019290925282916108dc5750604080518082019091526007546001600160a01b03811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b602081015160009061271090610900906bffffffffffffffffffffffff16876129f1565b61090a9190612a08565b91519350909150505b9250929050565b336001600160a01b038616811480159061095a57506001600160a01b0380871660009081526003602090815260408083209385168352929052205460ff16155b156109a9576040517fe237d9220000000000000000000000000000000000000000000000000000000081526001600160a01b038083166004830152871660248201526044015b60405180910390fd5b6109b6868686868661148f565b505050505050565b600082815260016020819052604090912001546109da816113cb565b6107e883836114ef565b6001600160a01b0381163314610a26576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108368282611582565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610a5a816113cb565b8560005b81811015610ae057610ad8898983818110610a7b57610a7b612a2a565b9050602002016020810190610a9091906128b2565b888884818110610aa257610aa2612a2a565b9050602002810190610ab49190612a40565b888886818110610ac657610ac6612a2a565b90506020028101906105629190612a40565b600101610a5e565b505050505050505050565b610af3611292565b828114610b2c576040517fa24a13a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b83811015610bb957610bb1858583818110610b4c57610b4c612a2a565b90506020020135848484818110610b6557610b65612a2a565b9050602002810190610b779190612a8a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061143292505050565b600101610b2f565b5050505050565b60608151835114610c0a57815183516040517f5b059991000000000000000000000000000000000000000000000000000000008152600481019290925260248201526044016109a0565b6000835167ffffffffffffffff811115610c2657610c266122f7565b604051908082528060200260200182016040528015610c4f578160200160208202803683370190505b50905060005b8451811015610c9e57602080820286010151610c79906020808402870101516105f7565b828281518110610c8b57610c8b612a2a565b6020908102919091010152600101610c55565b509392505050565b610cae611292565b610cb86000611609565b565b610cc2611292565b61067382828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061167192505050565b610d09611292565b600a610836828483612b19565b61067333838361167d565b6009546001600160a01b0316610d63576040517fc84651bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003610d9d576040517f499548bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610da833838361172d565b80600103610e2a576009546040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481018490526001600160a01b03909116906340c10f19906044015b600060405180830381600087803b158015610e1657600080fd5b505af11580156109b6573d6000803e3d6000fd5b604080516001808252602082018590528183019081526060820184905260808201928390526009547fd81d0a150000000000000000000000000000000000000000000000000000000090935290916001600160a01b031663d81d0a15610e9533858560848201612bd9565b600060405180830381600087803b158015610eaf57600080fd5b505af1158015610ec3573d6000803e3d6000fd5b5050505050505050565b60008281526001602081905260409091200154610ee9816113cb565b6107e88383611582565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610f1d816113cb565b60005b84811015610f8257858582818110610f3a57610f3a612a2a565b90506020020135600003610f7a576040517f3f6cc76800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600101610f20565b506109b68686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808a02828101820190935289825290935089925088918291850190849080828437600092018290525060408051602081019091529081529250611795915050565b600a805461100c9061291a565b80601f01602080910402602001604051908101604052809291908181526020018280546110389061291a565b80156110855780601f1061105a57610100808354040283529160200191611085565b820191906000526020600020905b81548152906001019060200180831161106857829003601f168201915b505050505081565b336001600160a01b03861681148015906110cd57506001600160a01b0380871660009081526003602090815260408083209385168352929052205460ff16155b15611117576040517fe237d9220000000000000000000000000000000000000000000000000000000081526001600160a01b038083166004830152871660248201526044016109a0565b6109b686868686866117cd565b61112c611292565b6001600160a01b03811661116f576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016109a0565b61117881611609565b50565b611183611292565b600980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6009546001600160a01b03166111ff576040517fc84651bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61120a33838361185b565b6009546001600160a01b031663d81d0a153384846040518463ffffffff1660e01b8152600401610dfc93929190612bd9565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a00000000000000000000000000000000000000000000000000000000148061061b575061061b826118a1565b6000546001600160a01b03163314610cb8576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016109a0565b60046106738282612c17565b6112ee8282611943565b604080516001600160a01b038416815261ffff831660208201527f2c5ea6e4103e78cb101e796fb2dace540362fc542cbff5145eaa24af7dd8fe41910160405180910390a15050565b6060600480546113469061291a565b80601f01602080910402602001604051908101604052809291908181526020018280546113729061291a565b80156113bf5780601f10611394576101008083540402835291602001916113bf565b820191906000526020600020905b8154815290600101906020018083116113a257829003601f168201915b50505050509050919050565b6111788133611a38565b6001600160a01b0384166113ff57604051632bfa23e760e11b8152600060048201526024016109a0565b604080516001808252602082018690528183019081526060820185905260808201909252906109b6600087848487611aa6565b600082815260066020526040902061144a8282612c17565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61147684610689565b604051611483919061222a565b60405180910390a25050565b6001600160a01b0384166114b957604051632bfa23e760e11b8152600060048201526024016109a0565b6001600160a01b0385166114e257604051626a0d4560e21b8152600060048201526024016109a0565b610bb98585858585611aa6565b60008281526001602090815260408083206001600160a01b038516845290915281205460ff1661157a5760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a450600161061b565b50600061061b565b60008281526001602090815260408083206001600160a01b038516845290915281205460ff161561157a5760008381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161061b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60056106738282612c17565b6001600160a01b0382166116c0576040517fced3e100000000000000000000000000000000000000000000000000000000008152600060048201526024016109a0565b6001600160a01b03838116600081815260036020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03831661175657604051626a0d4560e21b8152600060048201526024016109a0565b604080516001808252602082018590528183019081526060820184905260a08201909252600060808201818152919291610bb991879185908590611aa6565b6001600160a01b0384166117bf57604051632bfa23e760e11b8152600060048201526024016109a0565b6107e8600085858585611aa6565b6001600160a01b0384166117f757604051632bfa23e760e11b8152600060048201526024016109a0565b6001600160a01b03851661182057604051626a0d4560e21b8152600060048201526024016109a0565b604080516001808252602082018690528183019081526060820185905260808201909252906118528787848487611aa6565b50505050505050565b6001600160a01b03831661188457604051626a0d4560e21b8152600060048201526024016109a0565b610836836000848460405180602001604052806000815250611aa6565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fd9b67a2600000000000000000000000000000000000000000000000000000000148061193457507fffffffff0000000000000000000000000000000000000000000000000000000082167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061061b575061061b82611af9565b6127106bffffffffffffffffffffffff82168110156119a5576040517f6f483d090000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff83166004820152602481018290526044016109a0565b6001600160a01b0383166119e8576040517fb6d9900a000000000000000000000000000000000000000000000000000000008152600060048201526024016109a0565b50604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff90911660209092018290527401000000000000000000000000000000000000000090910217600755565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16610673576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016109a0565b611ab285858585611b90565b6001600160a01b03841615610bb95782513390600103611aeb5760208481015190840151611ae4838989858589611ddc565b50506109b6565b6109b6818787878787611f4a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061061b57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461061b565b8051825114611bd857815181516040517f5b059991000000000000000000000000000000000000000000000000000000008152600481019290925260248201526044016109a0565b3360005b8351811015611cfd576020818102858101820151908501909101516001600160a01b03881615611cac5760008281526002602090815260408083206001600160a01b038c16845290915290205481811015611c83576040517f03dee4c50000000000000000000000000000000000000000000000000000000081526001600160a01b038a1660048201526024810182905260448101839052606481018490526084016109a0565b60008381526002602090815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b03871615611cf35760008281526002602090815260408083206001600160a01b038b16845290915281208054839290611ced908490612cd7565b90915550505b5050600101611bdc565b508251600103611d7e5760208301516000906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628585604051611d6f929190918252602082015260400190565b60405180910390a45050610bb9565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611dcd929190612cea565b60405180910390a45050505050565b6001600160a01b0384163b156109b6576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190611e399089908990889088908890600401612d18565b6020604051808303816000875af1925050508015611e74575060408051601f3d908101601f19168201909252611e7191810190612d5b565b60015b611edd573d808015611ea2576040519150601f19603f3d011682016040523d82523d6000602084013e611ea7565b606091505b508051600003611ed557604051632bfa23e760e11b81526001600160a01b03861660048201526024016109a0565b805181602001fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e61000000000000000000000000000000000000000000000000000000001461185257604051632bfa23e760e11b81526001600160a01b03861660048201526024016109a0565b6001600160a01b0384163b156109b6576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c8190611fa79089908990889088908890600401612d78565b6020604051808303816000875af1925050508015611fe2575060408051601f3d908101601f19168201909252611fdf91810190612d5b565b60015b612010573d808015611ea2576040519150601f19603f3d011682016040523d82523d6000602084013e611ea7565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c81000000000000000000000000000000000000000000000000000000001461185257604051632bfa23e760e11b81526001600160a01b03861660048201526024016109a0565b80356001600160a01b038116811461209457600080fd5b919050565b600080604083850312156120ac57600080fd5b6120b58361207d565b946020939093013593505050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461117857600080fd5b60006020828403121561210357600080fd5b8135610762816120c3565b60008083601f84011261212057600080fd5b50813567ffffffffffffffff81111561213857600080fd5b60208301915083602082850101111561091357600080fd5b6000806020838503121561216357600080fd5b823567ffffffffffffffff81111561217a57600080fd5b6121868582860161210e565b90969095509350505050565b600080604083850312156121a557600080fd5b6121ae8361207d565b915060208301356bffffffffffffffffffffffff811681146121cf57600080fd5b809150509250929050565b60005b838110156121f55781810151838201526020016121dd565b50506000910152565b600081518084526122168160208601602086016121da565b601f01601f19169290920160200192915050565b60208152600061076260208301846121fe565b60006020828403121561224f57600080fd5b5035919050565b60008060006060848603121561226b57600080fd5b6122748461207d565b95602085013595506040909401359392505050565b60008060006040848603121561229e57600080fd5b83359250602084013567ffffffffffffffff8111156122bc57600080fd5b6122c88682870161210e565b9497909650939450505050565b600080604083850312156122e857600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612336576123366122f7565b604052919050565b600067ffffffffffffffff821115612358576123586122f7565b5060051b60200190565b600082601f83011261237357600080fd5b813560206123886123838361233e565b61230d565b8083825260208201915060208460051b8701019350868411156123aa57600080fd5b602086015b848110156123c657803583529183019183016123af565b509695505050505050565b600082601f8301126123e257600080fd5b813567ffffffffffffffff8111156123fc576123fc6122f7565b61240f6020601f19601f8401160161230d565b81815284602083860101111561242457600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a0868803121561245957600080fd5b6124628661207d565b94506124706020870161207d565b9350604086013567ffffffffffffffff8082111561248d57600080fd5b61249989838a01612362565b945060608801359150808211156124af57600080fd5b6124bb89838a01612362565b935060808801359150808211156124d157600080fd5b506124de888289016123d1565b9150509295509295909350565b600080604083850312156124fe57600080fd5b8235915061250e6020840161207d565b90509250929050565b60008083601f84011261252957600080fd5b50813567ffffffffffffffff81111561254157600080fd5b6020830191508360208260051b850101111561091357600080fd5b6000806000806000806060878903121561257557600080fd5b863567ffffffffffffffff8082111561258d57600080fd5b6125998a838b01612517565b909850965060208901359150808211156125b257600080fd5b6125be8a838b01612517565b909650945060408901359150808211156125d757600080fd5b506125e489828a01612517565b979a9699509497509295939492505050565b6000806000806040858703121561260c57600080fd5b843567ffffffffffffffff8082111561262457600080fd5b61263088838901612517565b9096509450602087013591508082111561264957600080fd5b5061265687828801612517565b95989497509550505050565b6000806040838503121561267557600080fd5b823567ffffffffffffffff8082111561268d57600080fd5b818501915085601f8301126126a157600080fd5b813560206126b16123838361233e565b82815260059290921b840181019181810190898411156126d057600080fd5b948201945b838610156126f5576126e68661207d565b825294820194908201906126d5565b9650508601359250508082111561270b57600080fd5b5061271885828601612362565b9150509250929050565b60008151808452602080850194506020840160005b8381101561275357815187529582019590820190600101612737565b509495945050505050565b6020815260006107626020830184612722565b6000806040838503121561278457600080fd5b61278d8361207d565b9150602083013580151581146121cf57600080fd5b6000806000806000606086880312156127ba57600080fd5b6127c38661207d565b9450602086013567ffffffffffffffff808211156127e057600080fd5b6127ec89838a01612517565b9096509450604088013591508082111561280557600080fd5b5061281288828901612517565b969995985093965092949392505050565b6000806040838503121561283657600080fd5b61283f8361207d565b915061250e6020840161207d565b600080600080600060a0868803121561286557600080fd5b61286e8661207d565b945061287c6020870161207d565b93506040860135925060608601359150608086013567ffffffffffffffff8111156128a657600080fd5b6124de888289016123d1565b6000602082840312156128c457600080fd5b6107628261207d565b600080604083850312156128e057600080fd5b823567ffffffffffffffff808211156128f857600080fd5b61290486838701612362565b9350602085013591508082111561270b57600080fd5b600181811c9082168061292e57607f821691505b60208210810361294e57634e487b7160e01b600052602260045260246000fd5b50919050565b60008084546129628161291a565b6001828116801561297a576001811461298f576129be565b60ff19841687528215158302870194506129be565b8860005260208060002060005b858110156129b55781548a82015290840190820161299c565b50505082870194505b5050505083516129d28183602088016121da565b01949350505050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761061b5761061b6129db565b600082612a2557634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612a5757600080fd5b83018035915067ffffffffffffffff821115612a7257600080fd5b6020019150600581901b360382131561091357600080fd5b6000808335601e19843603018112612aa157600080fd5b83018035915067ffffffffffffffff821115612abc57600080fd5b60200191503681900382131561091357600080fd5b601f821115610836576000816000526020600020601f850160051c81016020861015612afa5750805b601f850160051c820191505b818110156109b657828155600101612b06565b67ffffffffffffffff831115612b3157612b316122f7565b612b4583612b3f835461291a565b83612ad1565b6000601f841160018114612b795760008515612b615750838201355b600019600387901b1c1916600186901b178355610bb9565b600083815260209020601f19861690835b82811015612baa5786850135825560209485019460019092019101612b8a565b5086821015612bc75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6001600160a01b0384168152606060208201526000612bfb6060830185612722565b8281036040840152612c0d8185612722565b9695505050505050565b815167ffffffffffffffff811115612c3157612c316122f7565b612c4581612c3f845461291a565b84612ad1565b602080601f831160018114612c7a5760008415612c625750858301515b600019600386901b1c1916600185901b1785556109b6565b600085815260208120601f198616915b82811015612ca957888601518255948401946001909101908401612c8a565b5085821015612cc75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8082018082111561061b5761061b6129db565b604081526000612cfd6040830185612722565b8281036020840152612d0f8185612722565b95945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152612d5060a08301846121fe565b979650505050505050565b600060208284031215612d6d57600080fd5b8151610762816120c3565b60006001600160a01b03808816835280871660208401525060a06040830152612da460a0830186612722565b8281036060840152612db68186612722565b90508281036080840152612dca81856121fe565b9897505050505050505056fea26469706673582212207127bc1815db545e68ee879e519166edc8f047fd962837a5d4cf7dad31f6e3e564736f6c63430008160033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000050ad8fdbc19ea06fd9383f1262ce691dc53fa99f00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000003f697066733a2f2f516d4e62504872394a59424453764642764138775a37774454667537467535674a4770536b4e645a746f4c4c35682f7b69647d2e6a736f6e000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d636e394873444e76677964647158724c3938665a76756e55326b354236767a35704669444b727248544372310000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102405760003560e01c8063715018a611610145578063d5391393116100bd578063e985e9c51161008c578063f2fde38b11610071578063f2fde38b146105be578063f5e2a141146105d1578063ff45ee31146105e457600080fd5b8063e985e9c51461056f578063f242432a146105ab57600080fd5b8063d53913931461051a578063d547741f14610541578063d81d0a1514610554578063e8a3d4851461056757600080fd5b8063938e3d7b11610114578063a217fddf116100f9578063a217fddf146104ec578063a22cb465146104f4578063c34902631461050757600080fd5b8063938e3d7b1461049d57806395d89b41146104b057600080fd5b8063715018a6146104385780638da5cb5b146104405780638ef79e911461045157806391d148541461046457600080fd5b8063162094c4116101d85780632f2ff15d116101a7578063478b47fa1161018c578063478b47fa146103f25780634bb99351146104055780634e1273f41461041857600080fd5b80632f2ff15d146103cc57806336568abe146103df57600080fd5b8063162094c414610350578063248a9ca3146103635780632a55205a146103875780632eb2c2d6146103b957600080fd5b806306fdde031161021457806306fdde03146102b65780630e89341c146102ff578063156e29f61461031257806315b2f58a1461032557600080fd5b8062fdd58e1461024557806301ffc9a71461026b57806302fe53051461028e57806304634d8d146102a3575b600080fd5b610258610253366004612099565b6105f7565b6040519081526020015b60405180910390f35b61027e6102793660046120f1565b610621565b6040519015158152602001610262565b6102a161029c366004612150565b61062c565b005b6102a16102b1366004612192565b610677565b6102f26040518060400160405280601481526020017f53414e574541522062792053414e20534f554e4400000000000000000000000081525081565b604051610262919061222a565b6102f261030d36600461223d565b610689565b6102a1610320366004612256565b610769565b600954610338906001600160a01b031681565b6040516001600160a01b039091168152602001610262565b6102a161035e366004612289565b6107ee565b61025861037136600461223d565b6000908152600160208190526040909120015490565b61039a6103953660046122d5565b61083b565b604080516001600160a01b039093168352602083019190915201610262565b6102a16103c7366004612441565b61091a565b6102a16103da3660046124eb565b6109be565b6102a16103ed3660046124eb565b6109e4565b6102a161040036600461255c565b610a30565b6102a16104133660046125f6565b610aeb565b61042b610426366004612662565b610bc0565b604051610262919061275e565b6102a1610ca6565b6000546001600160a01b0316610338565b6102a161045f366004612150565b610cba565b61027e6104723660046124eb565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6102a16104ab366004612150565b610d01565b6102f26040518060400160405280600781526020017f53414e574541520000000000000000000000000000000000000000000000000081525081565b610258600081565b6102a1610502366004612771565b610d16565b6102a16105153660046122d5565b610d21565b6102587f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102a161054f3660046124eb565b610ecd565b6102a16105623660046127a2565b610ef3565b6102f2610fff565b61027e61057d366004612823565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b6102a16105b936600461284d565b61108d565b6102a16105cc3660046128b2565b611124565b6102a16105df3660046128b2565b61117b565b6102a16105f23660046128cd565b6111bd565b60008181526002602090815260408083206001600160a01b03861684529091529020545b92915050565b600061061b8261123c565b610634611292565b61067382828080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506112d892505050565b5050565b61067f611292565b61067382826112e4565b6000818152600660205260408120805460609291906106a79061291a565b80601f01602080910402602001604051908101604052809291908181526020018280546106d39061291a565b80156107205780601f106106f557610100808354040283529160200191610720565b820191906000526020600020905b81548152906001019060200180831161070357829003601f168201915b50505050509050600081511161073e5761073983611337565b610762565b600581604051602001610752929190612954565b6040516020818303038152906040525b9392505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610793816113cb565b826000036107cd576040517f3f6cc76800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107e8848484604051806020016040528060008152506113d5565b50505050565b6107f6611292565b6108368383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061143292505050565b505050565b60008281526008602090815260408083208151808301909252546001600160a01b038116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff169282019290925282916108dc5750604080518082019091526007546001600160a01b03811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b602081015160009061271090610900906bffffffffffffffffffffffff16876129f1565b61090a9190612a08565b91519350909150505b9250929050565b336001600160a01b038616811480159061095a57506001600160a01b0380871660009081526003602090815260408083209385168352929052205460ff16155b156109a9576040517fe237d9220000000000000000000000000000000000000000000000000000000081526001600160a01b038083166004830152871660248201526044015b60405180910390fd5b6109b6868686868661148f565b505050505050565b600082815260016020819052604090912001546109da816113cb565b6107e883836114ef565b6001600160a01b0381163314610a26576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108368282611582565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610a5a816113cb565b8560005b81811015610ae057610ad8898983818110610a7b57610a7b612a2a565b9050602002016020810190610a9091906128b2565b888884818110610aa257610aa2612a2a565b9050602002810190610ab49190612a40565b888886818110610ac657610ac6612a2a565b90506020028101906105629190612a40565b600101610a5e565b505050505050505050565b610af3611292565b828114610b2c576040517fa24a13a600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b83811015610bb957610bb1858583818110610b4c57610b4c612a2a565b90506020020135848484818110610b6557610b65612a2a565b9050602002810190610b779190612a8a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061143292505050565b600101610b2f565b5050505050565b60608151835114610c0a57815183516040517f5b059991000000000000000000000000000000000000000000000000000000008152600481019290925260248201526044016109a0565b6000835167ffffffffffffffff811115610c2657610c266122f7565b604051908082528060200260200182016040528015610c4f578160200160208202803683370190505b50905060005b8451811015610c9e57602080820286010151610c79906020808402870101516105f7565b828281518110610c8b57610c8b612a2a565b6020908102919091010152600101610c55565b509392505050565b610cae611292565b610cb86000611609565b565b610cc2611292565b61067382828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061167192505050565b610d09611292565b600a610836828483612b19565b61067333838361167d565b6009546001600160a01b0316610d63576040517fc84651bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003610d9d576040517f499548bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610da833838361172d565b80600103610e2a576009546040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481018490526001600160a01b03909116906340c10f19906044015b600060405180830381600087803b158015610e1657600080fd5b505af11580156109b6573d6000803e3d6000fd5b604080516001808252602082018590528183019081526060820184905260808201928390526009547fd81d0a150000000000000000000000000000000000000000000000000000000090935290916001600160a01b031663d81d0a15610e9533858560848201612bd9565b600060405180830381600087803b158015610eaf57600080fd5b505af1158015610ec3573d6000803e3d6000fd5b5050505050505050565b60008281526001602081905260409091200154610ee9816113cb565b6107e88383611582565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610f1d816113cb565b60005b84811015610f8257858582818110610f3a57610f3a612a2a565b90506020020135600003610f7a576040517f3f6cc76800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600101610f20565b506109b68686868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808a02828101820190935289825290935089925088918291850190849080828437600092018290525060408051602081019091529081529250611795915050565b600a805461100c9061291a565b80601f01602080910402602001604051908101604052809291908181526020018280546110389061291a565b80156110855780601f1061105a57610100808354040283529160200191611085565b820191906000526020600020905b81548152906001019060200180831161106857829003601f168201915b505050505081565b336001600160a01b03861681148015906110cd57506001600160a01b0380871660009081526003602090815260408083209385168352929052205460ff16155b15611117576040517fe237d9220000000000000000000000000000000000000000000000000000000081526001600160a01b038083166004830152871660248201526044016109a0565b6109b686868686866117cd565b61112c611292565b6001600160a01b03811661116f576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016109a0565b61117881611609565b50565b611183611292565b600980547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6009546001600160a01b03166111ff576040517fc84651bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61120a33838361185b565b6009546001600160a01b031663d81d0a153384846040518463ffffffff1660e01b8152600401610dfc93929190612bd9565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a00000000000000000000000000000000000000000000000000000000148061061b575061061b826118a1565b6000546001600160a01b03163314610cb8576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016109a0565b60046106738282612c17565b6112ee8282611943565b604080516001600160a01b038416815261ffff831660208201527f2c5ea6e4103e78cb101e796fb2dace540362fc542cbff5145eaa24af7dd8fe41910160405180910390a15050565b6060600480546113469061291a565b80601f01602080910402602001604051908101604052809291908181526020018280546113729061291a565b80156113bf5780601f10611394576101008083540402835291602001916113bf565b820191906000526020600020905b8154815290600101906020018083116113a257829003601f168201915b50505050509050919050565b6111788133611a38565b6001600160a01b0384166113ff57604051632bfa23e760e11b8152600060048201526024016109a0565b604080516001808252602082018690528183019081526060820185905260808201909252906109b6600087848487611aa6565b600082815260066020526040902061144a8282612c17565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61147684610689565b604051611483919061222a565b60405180910390a25050565b6001600160a01b0384166114b957604051632bfa23e760e11b8152600060048201526024016109a0565b6001600160a01b0385166114e257604051626a0d4560e21b8152600060048201526024016109a0565b610bb98585858585611aa6565b60008281526001602090815260408083206001600160a01b038516845290915281205460ff1661157a5760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a450600161061b565b50600061061b565b60008281526001602090815260408083206001600160a01b038516845290915281205460ff161561157a5760008381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161061b565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60056106738282612c17565b6001600160a01b0382166116c0576040517fced3e100000000000000000000000000000000000000000000000000000000008152600060048201526024016109a0565b6001600160a01b03838116600081815260036020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03831661175657604051626a0d4560e21b8152600060048201526024016109a0565b604080516001808252602082018590528183019081526060820184905260a08201909252600060808201818152919291610bb991879185908590611aa6565b6001600160a01b0384166117bf57604051632bfa23e760e11b8152600060048201526024016109a0565b6107e8600085858585611aa6565b6001600160a01b0384166117f757604051632bfa23e760e11b8152600060048201526024016109a0565b6001600160a01b03851661182057604051626a0d4560e21b8152600060048201526024016109a0565b604080516001808252602082018690528183019081526060820185905260808201909252906118528787848487611aa6565b50505050505050565b6001600160a01b03831661188457604051626a0d4560e21b8152600060048201526024016109a0565b610836836000848460405180602001604052806000815250611aa6565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fd9b67a2600000000000000000000000000000000000000000000000000000000148061193457507fffffffff0000000000000000000000000000000000000000000000000000000082167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061061b575061061b82611af9565b6127106bffffffffffffffffffffffff82168110156119a5576040517f6f483d090000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff83166004820152602481018290526044016109a0565b6001600160a01b0383166119e8576040517fb6d9900a000000000000000000000000000000000000000000000000000000008152600060048201526024016109a0565b50604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff90911660209092018290527401000000000000000000000000000000000000000090910217600755565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16610673576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602481018390526044016109a0565b611ab285858585611b90565b6001600160a01b03841615610bb95782513390600103611aeb5760208481015190840151611ae4838989858589611ddc565b50506109b6565b6109b6818787878787611f4a565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061061b57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461061b565b8051825114611bd857815181516040517f5b059991000000000000000000000000000000000000000000000000000000008152600481019290925260248201526044016109a0565b3360005b8351811015611cfd576020818102858101820151908501909101516001600160a01b03881615611cac5760008281526002602090815260408083206001600160a01b038c16845290915290205481811015611c83576040517f03dee4c50000000000000000000000000000000000000000000000000000000081526001600160a01b038a1660048201526024810182905260448101839052606481018490526084016109a0565b60008381526002602090815260408083206001600160a01b038d16845290915290209082900390555b6001600160a01b03871615611cf35760008281526002602090815260408083206001600160a01b038b16845290915281208054839290611ced908490612cd7565b90915550505b5050600101611bdc565b508251600103611d7e5760208301516000906020840151909150856001600160a01b0316876001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628585604051611d6f929190918252602082015260400190565b60405180910390a45050610bb9565b836001600160a01b0316856001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051611dcd929190612cea565b60405180910390a45050505050565b6001600160a01b0384163b156109b6576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190611e399089908990889088908890600401612d18565b6020604051808303816000875af1925050508015611e74575060408051601f3d908101601f19168201909252611e7191810190612d5b565b60015b611edd573d808015611ea2576040519150601f19603f3d011682016040523d82523d6000602084013e611ea7565b606091505b508051600003611ed557604051632bfa23e760e11b81526001600160a01b03861660048201526024016109a0565b805181602001fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e61000000000000000000000000000000000000000000000000000000001461185257604051632bfa23e760e11b81526001600160a01b03861660048201526024016109a0565b6001600160a01b0384163b156109b6576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c8190611fa79089908990889088908890600401612d78565b6020604051808303816000875af1925050508015611fe2575060408051601f3d908101601f19168201909252611fdf91810190612d5b565b60015b612010573d808015611ea2576040519150601f19603f3d011682016040523d82523d6000602084013e611ea7565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c81000000000000000000000000000000000000000000000000000000001461185257604051632bfa23e760e11b81526001600160a01b03861660048201526024016109a0565b80356001600160a01b038116811461209457600080fd5b919050565b600080604083850312156120ac57600080fd5b6120b58361207d565b946020939093013593505050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461117857600080fd5b60006020828403121561210357600080fd5b8135610762816120c3565b60008083601f84011261212057600080fd5b50813567ffffffffffffffff81111561213857600080fd5b60208301915083602082850101111561091357600080fd5b6000806020838503121561216357600080fd5b823567ffffffffffffffff81111561217a57600080fd5b6121868582860161210e565b90969095509350505050565b600080604083850312156121a557600080fd5b6121ae8361207d565b915060208301356bffffffffffffffffffffffff811681146121cf57600080fd5b809150509250929050565b60005b838110156121f55781810151838201526020016121dd565b50506000910152565b600081518084526122168160208601602086016121da565b601f01601f19169290920160200192915050565b60208152600061076260208301846121fe565b60006020828403121561224f57600080fd5b5035919050565b60008060006060848603121561226b57600080fd5b6122748461207d565b95602085013595506040909401359392505050565b60008060006040848603121561229e57600080fd5b83359250602084013567ffffffffffffffff8111156122bc57600080fd5b6122c88682870161210e565b9497909650939450505050565b600080604083850312156122e857600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612336576123366122f7565b604052919050565b600067ffffffffffffffff821115612358576123586122f7565b5060051b60200190565b600082601f83011261237357600080fd5b813560206123886123838361233e565b61230d565b8083825260208201915060208460051b8701019350868411156123aa57600080fd5b602086015b848110156123c657803583529183019183016123af565b509695505050505050565b600082601f8301126123e257600080fd5b813567ffffffffffffffff8111156123fc576123fc6122f7565b61240f6020601f19601f8401160161230d565b81815284602083860101111561242457600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a0868803121561245957600080fd5b6124628661207d565b94506124706020870161207d565b9350604086013567ffffffffffffffff8082111561248d57600080fd5b61249989838a01612362565b945060608801359150808211156124af57600080fd5b6124bb89838a01612362565b935060808801359150808211156124d157600080fd5b506124de888289016123d1565b9150509295509295909350565b600080604083850312156124fe57600080fd5b8235915061250e6020840161207d565b90509250929050565b60008083601f84011261252957600080fd5b50813567ffffffffffffffff81111561254157600080fd5b6020830191508360208260051b850101111561091357600080fd5b6000806000806000806060878903121561257557600080fd5b863567ffffffffffffffff8082111561258d57600080fd5b6125998a838b01612517565b909850965060208901359150808211156125b257600080fd5b6125be8a838b01612517565b909650945060408901359150808211156125d757600080fd5b506125e489828a01612517565b979a9699509497509295939492505050565b6000806000806040858703121561260c57600080fd5b843567ffffffffffffffff8082111561262457600080fd5b61263088838901612517565b9096509450602087013591508082111561264957600080fd5b5061265687828801612517565b95989497509550505050565b6000806040838503121561267557600080fd5b823567ffffffffffffffff8082111561268d57600080fd5b818501915085601f8301126126a157600080fd5b813560206126b16123838361233e565b82815260059290921b840181019181810190898411156126d057600080fd5b948201945b838610156126f5576126e68661207d565b825294820194908201906126d5565b9650508601359250508082111561270b57600080fd5b5061271885828601612362565b9150509250929050565b60008151808452602080850194506020840160005b8381101561275357815187529582019590820190600101612737565b509495945050505050565b6020815260006107626020830184612722565b6000806040838503121561278457600080fd5b61278d8361207d565b9150602083013580151581146121cf57600080fd5b6000806000806000606086880312156127ba57600080fd5b6127c38661207d565b9450602086013567ffffffffffffffff808211156127e057600080fd5b6127ec89838a01612517565b9096509450604088013591508082111561280557600080fd5b5061281288828901612517565b969995985093965092949392505050565b6000806040838503121561283657600080fd5b61283f8361207d565b915061250e6020840161207d565b600080600080600060a0868803121561286557600080fd5b61286e8661207d565b945061287c6020870161207d565b93506040860135925060608601359150608086013567ffffffffffffffff8111156128a657600080fd5b6124de888289016123d1565b6000602082840312156128c457600080fd5b6107628261207d565b600080604083850312156128e057600080fd5b823567ffffffffffffffff808211156128f857600080fd5b61290486838701612362565b9350602085013591508082111561270b57600080fd5b600181811c9082168061292e57607f821691505b60208210810361294e57634e487b7160e01b600052602260045260246000fd5b50919050565b60008084546129628161291a565b6001828116801561297a576001811461298f576129be565b60ff19841687528215158302870194506129be565b8860005260208060002060005b858110156129b55781548a82015290840190820161299c565b50505082870194505b5050505083516129d28183602088016121da565b01949350505050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761061b5761061b6129db565b600082612a2557634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612a5757600080fd5b83018035915067ffffffffffffffff821115612a7257600080fd5b6020019150600581901b360382131561091357600080fd5b6000808335601e19843603018112612aa157600080fd5b83018035915067ffffffffffffffff821115612abc57600080fd5b60200191503681900382131561091357600080fd5b601f821115610836576000816000526020600020601f850160051c81016020861015612afa5750805b601f850160051c820191505b818110156109b657828155600101612b06565b67ffffffffffffffff831115612b3157612b316122f7565b612b4583612b3f835461291a565b83612ad1565b6000601f841160018114612b795760008515612b615750838201355b600019600387901b1c1916600186901b178355610bb9565b600083815260209020601f19861690835b82811015612baa5786850135825560209485019460019092019101612b8a565b5086821015612bc75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6001600160a01b0384168152606060208201526000612bfb6060830185612722565b8281036040840152612c0d8185612722565b9695505050505050565b815167ffffffffffffffff811115612c3157612c316122f7565b612c4581612c3f845461291a565b84612ad1565b602080601f831160018114612c7a5760008415612c625750858301515b600019600386901b1c1916600185901b1785556109b6565b600085815260208120601f198616915b82811015612ca957888601518255948401946001909101908401612c8a565b5085821015612cc75787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8082018082111561061b5761061b6129db565b604081526000612cfd6040830185612722565b8281036020840152612d0f8185612722565b95945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152612d5060a08301846121fe565b979650505050505050565b600060208284031215612d6d57600080fd5b8151610762816120c3565b60006001600160a01b03808816835280871660208401525060a06040830152612da460a0830186612722565b8281036060840152612db68186612722565b90508281036080840152612dca81856121fe565b9897505050505050505056fea26469706673582212207127bc1815db545e68ee879e519166edc8f047fd962837a5d4cf7dad31f6e3e564736f6c63430008160033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000050ad8fdbc19ea06fd9383f1262ce691dc53fa99f00000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000003f697066733a2f2f516d4e62504872394a59424453764642764138775a37774454667537467535674a4770536b4e645a746f4c4c35682f7b69647d2e6a736f6e000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d636e394873444e76677964647158724c3938665a76756e55326b354236767a35704669444b727248544372310000000000000000000000
-----Decoded View---------------
Arg [0] : _uri (string): ipfs://QmNbPHr9JYBDSvFBvA8wZ7wDTfu7Fu5gJGpSkNdZtoLL5h/{id}.json
Arg [1] : _contractUri (string): ipfs://Qmcn9HsDNvgyddqXrL98fZvunU2k5B6vz5pFiDKrrHTCr1
Arg [2] : _royaltyReceiver (address): 0x50AD8FDBC19ea06fD9383F1262Ce691DC53FA99f
Arg [3] : _royaltyBps (uint96): 250
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 00000000000000000000000050ad8fdbc19ea06fd9383f1262ce691dc53fa99f
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000fa
Arg [4] : 000000000000000000000000000000000000000000000000000000000000003f
Arg [5] : 697066733a2f2f516d4e62504872394a59424453764642764138775a37774454
Arg [6] : 667537467535674a4770536b4e645a746f4c4c35682f7b69647d2e6a736f6e00
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000035
Arg [8] : 697066733a2f2f516d636e394873444e76677964647158724c3938665a76756e
Arg [9] : 55326b354236767a35704669444b727248544372310000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.