Overview
TokenID
4
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
LootBox
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {ERC1155P} from "ERC1155P/ERC1155P.sol"; import {ERC1155PSupply} from "ERC1155P/extensions/ERC1155PSupply.sol"; import {ERC2981} from "solady/src/tokens/ERC2981.sol"; import {OwnableRoles} from "solady/src/auth/OwnableRoles.sol"; contract LootBox is ERC1155PSupply, OwnableRoles, ERC2981 { string public baseURI; constructor() ERC1155P("Beanbag Loot Box", "BBLB") { _initializeOwner(tx.origin); // Set royalty receiver to the contract creator, // at 5% (default denominator is 10000). _setDefaultRoyalty(tx.origin, 500); } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function setBaseURI(string calldata baseURI_) external onlyOwner { baseURI = baseURI_; } /* * Minting * Minting can only be done by a designated minter */ function mint(address to, uint256 id, uint256 amount) external onlyRoles(_ROLE_0) { _mint(to, id, amount, ""); } function batchMint(address to, uint256[] calldata ids, uint256[] calldata amounts) external onlyRoles(_ROLE_0) { _mintBatch(to, ids, amounts, ""); } /* * Burning * Loot boxes can only be burned by designated burner contract(s) */ function burn(address from, uint256 id, uint256 amount) external onlyRoles(_ROLE_1) { if (from != msg.sender) { if (!isApprovedForAll(from, msg.sender)) { _revert(TransferCallerNotOwnerNorApproved.selector); } } _burn(from, id, amount); } function batchBurn(address from, uint256[] calldata ids, uint256[] calldata amounts) external onlyRoles(_ROLE_1) { if (from != msg.sender) { if (!isApprovedForAll(from, msg.sender)) { _revert(TransferCallerNotOwnerNorApproved.selector); } } _burnBatch(from, ids, amounts); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155PSupply, ERC2981) returns (bool) { return ERC1155PSupply.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // ERC1155P Contracts v1.1 // Creator: 0xjustadev/0xth0mas pragma solidity ^0.8.20; import "./IERC1155P.sol"; /** * @dev Interface of ERC1155 token receiver. */ interface ERC1155P__IERC1155Receiver { function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); } /** * @dev Interface for IERC1155MetadataURI. */ interface ERC1155P__IERC1155MetadataURI { /** * @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); } /** * @title ERC1155P * * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 including the Metadata extension. * Optimized for lower gas for users collecting multiple tokens. * * Assumptions: * - An owner cannot have more than 2**16 - 1 of a single token * - The maximum token ID cannot exceed 2**100 - 1 */ abstract contract ERC1155P is IERC1155P, ERC1155P__IERC1155MetadataURI { /** * @dev MAX_ACCOUNT_TOKEN_BALANCE is 2^16-1 because token balances are * are being packed into 16 bits within each bucket. */ uint256 private constant MAX_ACCOUNT_TOKEN_BALANCE = 0xFFFF; uint256 private constant BALANCE_STORAGE_OFFSET = 0xE000000000000000000000000000000000000000000000000000000000000000; uint256 private constant APPROVAL_STORAGE_OFFSET = 0xD000000000000000000000000000000000000000000000000000000000000000; /** * @dev MAX_TOKEN_ID is derived from custom storage pointer location for * account/token balance data. Wallet address is shifted 92 bits left * and leaves 92 bits for bucket #'s. Each bucket holds 8 token balances * 2^92*8-1 = MAX_TOKEN_ID */ uint256 private constant MAX_TOKEN_ID = 0x07FFFFFFFFFFFFFFFFFFFFFFF; // The `TransferSingle` event signature is given by: // `keccak256(bytes("TransferSingle(address,address,address,uint256,uint256)"))`. bytes32 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE = 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62; // The `TransferBatch` event signature is given by: // `keccak256(bytes("TransferBatch(address,address,address,uint256[],uint256[])"))`. bytes32 private constant _TRANSFER_BATCH_EVENT_SIGNATURE = 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb; // The `ApprovalForAll` event signature is given by: // `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. bytes32 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; string public name; //collection name string public symbol; //collection symbol // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev constructor initialization of name and symbol parameters * @param _name the name to display for the collection * @param _symbol the symbol for the token collection */ constructor(string memory _name, string memory _symbol) { name = _name; symbol = _symbol; } /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0xd9b67a26 || // ERC165 interface ID for ERC1155. interfaceId == 0x0e89341c; // ERC165 interface ID for ERC1155MetadataURI. } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function uri(uint256 id) public view virtual override returns (string memory) { string memory tokenURI = _tokenURIs[id]; string memory baseURI = _baseURI(); return bytes(tokenURI).length > 0 ? tokenURI : bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(id))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev Sets `tokenURI` as the tokenURI of `tokenId`. */ function _setURI(uint256 tokenId, string calldata tokenURI) internal virtual { _tokenURIs[tokenId] = tokenURI; emit URI(uri(tokenId), tokenId); } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { if(account == address(0)) { _revert(BalanceQueryForZeroAddress.selector); } return getBalance(account, id); } /** * @dev Gets the amount of tokens minted by an account for a given token id */ function _numberMinted(address account, uint256 id) internal view returns (uint256) { if(account == address(0)) { _revert(BalanceQueryForZeroAddress.selector); } return getMinted(account, id); } /** * @dev Gets the balance of an account's token id from packed token data * */ function getBalance(address account, uint256 id) private view returns (uint256 _balance) { /// @solidity memory-safe-assembly assembly { mstore(0x00, or(BALANCE_STORAGE_OFFSET, or(shr(4, shl(96, account)), shr(3, id)))) _balance := shr(shl(5, and(id, 0x07)), and(sload(keccak256(0x00, 0x20)), shl(shl(5, and(id, 0x07)), 0x0000FFFF))) } } /** * @dev Sets the balance of an account's token id in packed token data * */ function setBalance(address account, uint256 id, uint256 amount) private { /// @solidity memory-safe-assembly assembly { mstore(0x00, or(BALANCE_STORAGE_OFFSET, or(shr(4, shl(96, account)), shr(3, id)))) mstore(0x00, keccak256(0x00, 0x20)) sstore(mload(0x00), or(and(not(shl(shl(5, and(id, 0x07)), 0x0000FFFF)), sload(mload(0x00))), shl(shl(5, and(id, 0x07)), amount))) } } /** * @dev Gets the number minted of an account's token id from packed token data * */ function getMinted(address account, uint256 id) private view returns (uint256 _minted) { /// @solidity memory-safe-assembly assembly { mstore(0x00, or(BALANCE_STORAGE_OFFSET, or(shr(4, shl(96, account)), shr(3, id)))) _minted := shr(16, shr(shl(5, and(id, 0x07)), and(sload(keccak256(0x00, 0x20)), shl(shl(5, and(id, 0x07)), 0xFFFF0000)))) } } /** * @dev Sets the number minted of an account's token id in packed token data * */ function setMinted(address account, uint256 id, uint256 amount) private { /// @solidity memory-safe-assembly assembly { mstore(0x00, or(BALANCE_STORAGE_OFFSET, or(shr(4, shl(96, account)), shr(3, id)))) mstore(0x00, keccak256(0x00, 0x20)) sstore(mload(0x00), or(and(not(shl(shl(5, and(id, 0x07)), 0xFFFF0000)), sload(mload(0x00))), shl(shl(5, and(id, 0x07)), shl(16, amount)))) } } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) public view virtual override returns (uint256[] memory) { if(accounts.length != ids.length) { _revert(ArrayLengthMismatch.selector); } uint256[] memory batchBalances = new uint256[](accounts.length); for(uint256 i = 0; i < accounts.length;) { batchBalances[i] = balanceOf(accounts[i], ids[i]); unchecked { ++i; } } return batchBalances; } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool _approved) { /// @solidity memory-safe-assembly assembly { mstore(0x00, shr(96, shl(96, account))) mstore(0x20, or(APPROVAL_STORAGE_OFFSET, shr(96, shl(96, operator)))) mstore(0x00, keccak256(0x00, 0x40)) _approved := sload(mload(0x00)) } return _approved; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes memory data ) public virtual override { _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` 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 `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 amount, bytes memory data ) internal virtual { if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); } if(to == address(0)) { _revert(TransferToZeroAddress.selector); } if(from != _msgSenderERC1155P()) if (!isApprovedForAll(from, _msgSenderERC1155P())) _revert(TransferCallerNotOwnerNorApproved.selector); address operator = _msgSenderERC1155P(); _beforeTokenTransfer(operator, from, to, id, amount, data); uint256 fromBalance = getBalance(from, id); if(amount > fromBalance) { _revert(TransferExceedsBalance.selector); } if(from != to) { uint256 toBalance = getBalance(to, id); unchecked { fromBalance -= amount; toBalance += amount; } if(toBalance > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); } setBalance(from, id, fromBalance); setBalance(to, id, toBalance); } /// @solidity memory-safe-assembly assembly { // Emit the `TransferSingle` event. let memOffset := mload(0x40) mstore(memOffset, id) mstore(add(memOffset, 0x20), amount) log4( memOffset, // Start of data . 0x40, // Length of data. _TRANSFER_SINGLE_EVENT_SIGNATURE, // Signature. operator, // `operator`. from, // `from`. to // `to`. ) } _afterTokenTransfer(operator, from, to, id, amount, data); if(to.code.length != 0) if(!_checkContractOnERC1155Received(from, to, id, amount, data)) { _revert(TransferToNonERC1155ReceiverImplementer.selector); } } /** * @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. */ function _safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes memory data ) internal virtual { if(to == address(0)) { _revert(TransferToZeroAddress.selector); } if(ids.length != amounts.length) { _revert(ArrayLengthMismatch.selector); } if(from != _msgSenderERC1155P()) if (!isApprovedForAll(from, _msgSenderERC1155P())) _revert(TransferCallerNotOwnerNorApproved.selector); address operator = _msgSenderERC1155P(); _beforeBatchTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length;) { uint256 id = ids[i]; uint256 amount = amounts[i]; if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); } uint256 fromBalance = getBalance(from, id); if(amount > fromBalance) { _revert(TransferExceedsBalance.selector); } if(from != to) { uint256 toBalance = getBalance(to, id); unchecked { fromBalance -= amount; toBalance += amount; } if(toBalance > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); } setBalance(from, id, fromBalance); setBalance(to, id, toBalance); } unchecked { ++i; } } /// @solidity memory-safe-assembly assembly { let memOffset := mload(0x40) mstore(memOffset, 0x40) mstore(add(memOffset,0x20), add(0x60, mul(0x20,ids.length))) mstore(add(memOffset,0x40), ids.length) calldatacopy(add(memOffset,0x60), ids.offset, mul(0x20,ids.length)) mstore(add(add(memOffset,0x60),mul(0x20,ids.length)), amounts.length) calldatacopy(add(add(memOffset,0x80),mul(0x20,ids.length)), amounts.offset, mul(0x20,amounts.length)) log4( memOffset, add(0x80,mul(0x40,amounts.length)), _TRANSFER_BATCH_EVENT_SIGNATURE, // Signature. operator, // `operator`. from, // `from`. to // `to`. ) } _afterBatchTokenTransfer(operator, from, to, ids, amounts, data); if(to.code.length != 0) if(!_checkContractOnERC1155BatchReceived(from, to, ids, amounts, data)) { _revert(TransferToNonERC1155ReceiverImplementer.selector); } } /** * @dev Creates `amount` tokens of token 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 amount, bytes memory data) internal virtual { if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); } if(to == address(0)) { _revert(MintToZeroAddress.selector); } if(amount == 0) { _revert(MintZeroQuantity.selector); } address operator = _msgSenderERC1155P(); _beforeTokenTransfer(operator, address(0), to, id, amount, data); uint256 toBalanceBefore = getBalance(to, id); uint256 toBalanceAfter; unchecked { toBalanceAfter = toBalanceBefore + amount; } if(toBalanceAfter > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); } if(toBalanceAfter < toBalanceBefore) { _revert(ExceedsMaximumBalance.selector); } // catches overflow setBalance(to, id, toBalanceAfter); uint256 toMintedBefore = getMinted(to, id); uint256 toMintedAfter; unchecked { toMintedAfter = toMintedBefore + amount; } if(toMintedAfter > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); } if(toMintedAfter < toMintedBefore) { _revert(ExceedsMaximumBalance.selector); } // catches overflow setMinted(to, id, toMintedAfter); /// @solidity memory-safe-assembly assembly { // Emit the `TransferSingle` event. let memOffset := mload(0x40) mstore(memOffset, id) mstore(add(memOffset, 0x20), amount) log4( memOffset, // Start of data . 0x40, // Length of data. _TRANSFER_SINGLE_EVENT_SIGNATURE, // Signature. operator, // `operator`. 0, // `from`. to // `to`. ) } _afterTokenTransfer(operator, address(0), to, id, amount, data); if(to.code.length != 0) if(!_checkContractOnERC1155Received(address(0), to, id, amount, data)) { _revert(TransferToNonERC1155ReceiverImplementer.selector); } } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] calldata ids, uint256[] calldata amounts, bytes memory data ) internal virtual { if(to == address(0)) { _revert(MintToZeroAddress.selector); } if(ids.length != amounts.length) { _revert(ArrayLengthMismatch.selector); } address operator = _msgSenderERC1155P(); _beforeBatchTokenTransfer(operator, address(0), to, ids, amounts, data); uint256 id; uint256 amount; for (uint256 i = 0; i < ids.length;) { id = ids[i]; amount = amounts[i]; if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); } if(amount == 0) { _revert(MintZeroQuantity.selector); } uint256 toBalanceBefore = getBalance(to, id); uint256 toBalanceAfter; unchecked { toBalanceAfter = toBalanceBefore + amount; } if(toBalanceAfter > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); } if(toBalanceAfter < toBalanceBefore) { _revert(ExceedsMaximumBalance.selector); } // catches overflow setBalance(to, id, toBalanceAfter); uint256 toMintedBefore = getMinted(to, id); uint256 toMintedAfter; unchecked { toMintedAfter = toMintedBefore + amount; } if(toMintedAfter > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); } if(toMintedAfter < toMintedBefore) { _revert(ExceedsMaximumBalance.selector); } // catches overflow setMinted(to, id, toMintedAfter); unchecked { ++i; } } /// @solidity memory-safe-assembly assembly { let memOffset := mload(0x40) mstore(memOffset, 0x40) mstore(add(memOffset,0x20), add(0x60, mul(0x20,ids.length))) mstore(add(memOffset,0x40), ids.length) calldatacopy(add(memOffset,0x60), ids.offset, mul(0x20,ids.length)) mstore(add(add(memOffset,0x60),mul(0x20,ids.length)), amounts.length) calldatacopy(add(add(memOffset,0x80),mul(0x20,ids.length)), amounts.offset, mul(0x20,amounts.length)) log4( memOffset, add(0x80,mul(0x40,amounts.length)), _TRANSFER_BATCH_EVENT_SIGNATURE, // Signature. operator, // `operator`. 0, // `from`. to // `to`. ) } _afterBatchTokenTransfer(operator, address(0), to, ids, amounts, data); if(to.code.length != 0) if(!_checkContractOnERC1155BatchReceived(address(0), to, ids, amounts, data)) { _revert(TransferToNonERC1155ReceiverImplementer.selector); } } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn(address from, uint256 id, uint256 amount) internal virtual { if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); } if(from == address(0)) { _revert(BurnFromZeroAddress.selector); } address operator = _msgSenderERC1155P(); _beforeTokenTransfer(operator, from, address(0), id, amount, ""); uint256 fromBalance = getBalance(from, id); if(amount > fromBalance) { _revert(BurnExceedsBalance.selector); } unchecked { fromBalance -= amount; } setBalance(from, id, fromBalance); /// @solidity memory-safe-assembly assembly { // Emit the `TransferSingle` event. let memOffset := mload(0x40) mstore(memOffset, id) mstore(add(memOffset, 0x20), amount) log4( memOffset, // Start of data. 0x40, // Length of data. _TRANSFER_SINGLE_EVENT_SIGNATURE, // Signature. operator, // `operator`. from, // `from`. 0 // `to`. ) } _afterTokenTransfer(operator, from, address(0), id, amount, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch(address from, uint256[] calldata ids, uint256[] calldata amounts) internal virtual { if(from == address(0)) { _revert(BurnFromZeroAddress.selector); } if(ids.length != amounts.length) { _revert(ArrayLengthMismatch.selector); } address operator = _msgSenderERC1155P(); _beforeBatchTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length;) { uint256 id = ids[i]; uint256 amount = amounts[i]; if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); } uint256 fromBalance = getBalance(from, id); if(amount > fromBalance) { _revert(BurnExceedsBalance.selector); } unchecked { fromBalance -= amount; } setBalance(from, id, fromBalance); unchecked { ++i; } } /// @solidity memory-safe-assembly assembly { let memOffset := mload(0x40) mstore(memOffset, 0x40) mstore(add(memOffset,0x20), add(0x60, mul(0x20,ids.length))) mstore(add(memOffset,0x40), ids.length) calldatacopy(add(memOffset,0x60), ids.offset, mul(0x20,ids.length)) mstore(add(add(memOffset,0x60),mul(0x20,ids.length)), amounts.length) calldatacopy(add(add(memOffset,0x80),mul(0x20,ids.length)), amounts.offset, mul(0x20,amounts.length)) log4( memOffset, add(0x80,mul(0x40,amounts.length)), _TRANSFER_BATCH_EVENT_SIGNATURE, // Signature. operator, // `operator`. from, // `from`. 0 // `to`. ) } _afterBatchTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { /// @solidity memory-safe-assembly assembly { mstore(0x00, caller()) mstore(0x20, or(APPROVAL_STORAGE_OFFSET, shr(96, shl(96, operator)))) mstore(0x00, keccak256(0x00, 0x40)) mstore(0x20, approved) sstore(mload(0x00), mload(0x20)) log3( 0x20, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)) ) } } /** * @dev Hook that is called before any single token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual {} /** * @dev Hook that is called before any batch token transfer. This includes minting * and burning. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeBatchTokenTransfer( address operator, address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any single token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any batch token transfer. This includes minting * and burning. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterBatchTokenTransfer( address operator, address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes memory data ) internal virtual {} /** * @dev Private function to invoke {IERC1155Receiver-onERC155Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `id` - Token ID to be transferred. * `amount` - Balance of token to be transferred * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC1155Received( address from, address to, uint256 id, uint256 amount, bytes memory _data ) private returns (bool) { try ERC1155P__IERC1155Receiver(to).onERC1155Received(_msgSenderERC1155P(), from, id, amount, _data) returns ( bytes4 retval ) { return retval == ERC1155P__IERC1155Receiver(to).onERC1155Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { _revert(TransferToNonERC1155ReceiverImplementer.selector); } /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } /** * @dev Private function to invoke {IERC1155Receiver-onERC155Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `id` - Token ID to be transferred. * `amount` - Balance of token to be transferred * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC1155BatchReceived( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes memory _data ) private returns (bool) { try ERC1155P__IERC1155Receiver(to).onERC1155BatchReceived(_msgSenderERC1155P(), from, ids, amounts, _data) returns ( bytes4 retval ) { return retval == ERC1155P__IERC1155Receiver(to).onERC1155BatchReceived.selector; } catch (bytes memory reason) { if (reason.length == 0) { _revert(TransferToNonERC1155ReceiverImplementer.selector); } /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC1155P() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { /// @solidity memory-safe-assembly assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /** * @dev For more efficient reverts. */ function _revert(bytes4 errorSelector) internal pure { /// @solidity memory-safe-assembly assembly { mstore(0x00, errorSelector) revert(0x00, 0x04) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "../ERC1155P.sol"; /** * @dev Extension of ERC1155 that adds tracking of total supply per id. * * Useful for scenarios where Fungible and Non-fungible tokens have to be * clearly identified. Note: While a totalSupply of 1 might mean the * corresponding is an NFT, there is no guarantees that no other token with the * same id are not going to be minted. */ abstract contract ERC1155PSupply is ERC1155P { /** * @dev Custom storage pointer for total token supply. Total supply is * split into buckets of 4 tokens per bucket allowing for 64 bits * per token. * 32 bits are used to store total supply for a max value of 0xFFFFFFFF * (~4.3B) of a single token. * 32 bits are used to store the mint count for a token * * The standard ERC1155P implementation allows a maximum token id * of 0x07FFFFFFFFFFFFFFFFFFFFFFF which requires a max bucket id of * 0x1FFFFFFFFFFFFFFFFFFFFFFF. Storage slots for buckets start at * 0xF000000000000000000000000000000000000000000000000000000000000000 * and continue through * 0xF0000000000000000000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFF * * Storage pointers for ERC1155P account balances start at * 0xE000000000000000000000000000000000000000000000000000000000000000 * and continue through * 0xEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF * * All custom pointers get hashed to avoid potential conflicts with * standard mappings or incorrect returns on view functions. */ uint256 private constant TOTAL_SUPPLY_STORAGE_OFFSET = 0xF000000000000000000000000000000000000000000000000000000000000000; uint256 private constant MAX_TOTAL_SUPPLY = 0xFFFFFFFF; /** * Total supply exceeds maximum. */ error ExceedsMaximumTotalSupply(); /** * @dev Total amount of tokens with a given id. */ function totalSupply( uint256 id ) public view virtual returns (uint256 _totalSupply) { /// @solidity memory-safe-assembly assembly { mstore(0x00, or(TOTAL_SUPPLY_STORAGE_OFFSET, shr(2, id))) _totalSupply := shr(shl(6, and(id, 0x03)), and(sload(keccak256(0x00, 0x20)), shl(shl(6, and(id, 0x03)), 0x00000000FFFFFFFF))) } } /** * @dev Sets total supply in custom storage slot location */ function setTotalSupply(uint256 id, uint256 amount) private { /// @solidity memory-safe-assembly assembly { mstore(0x00, or(TOTAL_SUPPLY_STORAGE_OFFSET, shr(2, id))) mstore(0x00, keccak256(0x00, 0x20)) sstore(mload(0x00), or(and(not(shl(shl(6, and(id, 0x03)), 0x00000000FFFFFFFF)), sload(mload(0x00))), shl(shl(6, and(id, 0x03)), amount))) } } /** * @dev Total amount of tokens minted with a given id. */ function totalMinted( uint256 id ) public view virtual returns (uint256 _totalMinted) { /// @solidity memory-safe-assembly assembly { mstore(0x00, or(TOTAL_SUPPLY_STORAGE_OFFSET, shr(2, id))) _totalMinted := shr(32, shr(shl(6, and(id, 0x03)), and(sload(keccak256(0x00, 0x20)), shl(shl(6, and(id, 0x03)), 0xFFFFFFFF00000000)))) } } /** * @dev Sets total minted in custom storage slot location */ function setTotalMinted(uint256 id, uint256 amount) private { /// @solidity memory-safe-assembly assembly { mstore(0x00, or(TOTAL_SUPPLY_STORAGE_OFFSET, shr(2, id))) mstore(0x00, keccak256(0x00, 0x20)) sstore(mload(0x00), or(and(not(shl(shl(6, and(id, 0x03)), 0xFFFFFFFF00000000)), sload(mload(0x00))), shl(shl(6, and(id, 0x03)), shl(32, amount)))) } } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return this.totalSupply(id) > 0; } /** * @dev See {ERC1155-_beforeTokenTransfer}. */ function _beforeTokenTransfer( address, address from, address to, uint256 id, uint256 amount, bytes memory ) internal virtual override { if (from == address(0)) { uint256 supply = this.totalSupply(id); uint256 minted = this.totalMinted(id); unchecked { supply += amount; minted += amount; } if (supply > MAX_TOTAL_SUPPLY || minted > MAX_TOTAL_SUPPLY) { ERC1155P._revert(ExceedsMaximumTotalSupply.selector); } setTotalSupply(id, supply); setTotalMinted(id, minted); } if (to == address(0)) { uint256 supply = this.totalSupply(id); unchecked { supply -= amount; } setTotalSupply(id, supply); } } /** * @dev See {ERC1155-_beforeTokenTransfer}. */ function _beforeBatchTokenTransfer( address, address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes memory ) internal virtual override { if (from == address(0)) { for (uint256 i = 0; i < ids.length; ) { uint256 id = ids[i]; uint256 supply = this.totalSupply(id); uint256 minted = this.totalMinted(id); unchecked { supply += amounts[i]; minted += amounts[i]; ++i; } if (supply > MAX_TOTAL_SUPPLY || minted > MAX_TOTAL_SUPPLY) { ERC1155P._revert(ExceedsMaximumTotalSupply.selector); } setTotalSupply(id, supply); setTotalMinted(id, minted); } } if (to == address(0)) { for (uint256 i = 0; i < ids.length; ) { uint256 id = ids[i]; uint256 supply = this.totalSupply(id); unchecked { supply -= amounts[i]; ++i; } setTotalSupply(id, supply); } } } function supportsInterface( bytes4 interfaceId ) public view virtual override returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC2981 NFT Royalty Standard implementation. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol) abstract contract ERC2981 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The royalty fee numerator exceeds the fee denominator. error RoyaltyOverflow(); /// @dev The royalty receiver cannot be the zero address. error RoyaltyReceiverIsZeroAddress(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The default royalty info is given by: /// ``` /// let packed := sload(_ERC2981_MASTER_SLOT_SEED) /// let receiver := shr(96, packed) /// let royaltyFraction := xor(packed, shl(96, receiver)) /// ``` /// /// The per token royalty info is given by. /// ``` /// mstore(0x00, tokenId) /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED) /// let packed := sload(keccak256(0x00, 0x40)) /// let receiver := shr(96, packed) /// let royaltyFraction := xor(packed, shl(96, receiver)) /// ``` uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC2981 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Checks that `_feeDenominator` is non-zero. constructor() { require(_feeDenominator() != 0, "Fee denominator cannot be zero."); } /// @dev Returns the denominator for the royalty amount. /// Defaults to 10000, which represents fees in basis points. /// Override this function to return a custom amount if needed. function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a. result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a)) } } /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`. function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address receiver, uint256 royaltyAmount) { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) let packed := sload(keccak256(0x00, 0x40)) receiver := shr(96, packed) if iszero(receiver) { packed := sload(mload(0x20)) receiver := shr(96, packed) } let x := salePrice let y := xor(packed, shl(96, receiver)) // `feeNumerator`. // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`. // Out-of-gas revert. Should not be triggered in practice, but included for safety. returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y)))) royaltyAmount := div(mul(x, y), feeDenominator) } } /// @dev Sets the default royalty `receiver` and `feeNumerator`. /// /// Requirements: /// - `receiver` must not be the zero address. /// - `feeNumerator` must not be greater than the fee denominator. function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { feeNumerator := shr(160, shl(160, feeNumerator)) if gt(feeNumerator, feeDenominator) { mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. revert(0x1c, 0x04) } let packed := shl(96, receiver) if iszero(packed) { mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. revert(0x1c, 0x04) } sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator)) } } /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero. function _deleteDefaultRoyalty() internal virtual { /// @solidity memory-safe-assembly assembly { sstore(_ERC2981_MASTER_SLOT_SEED, 0) } } /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`. /// /// Requirements: /// - `receiver` must not be the zero address. /// - `feeNumerator` must not be greater than the fee denominator. function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { feeNumerator := shr(160, shl(160, feeNumerator)) if gt(feeNumerator, feeDenominator) { mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. revert(0x1c, 0x04) } let packed := shl(96, receiver) if iszero(packed) { mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. revert(0x1c, 0x04) } mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) sstore(keccak256(0x00, 0x40), or(packed, feeNumerator)) } } /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero. function _resetTokenRoyalty(uint256 tokenId) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) sstore(keccak256(0x00, 0x40), 0) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {Ownable} from "./Ownable.sol"; /// @notice Simple single owner and multiroles authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// @dev While the ownable portion follows [EIP-173](https://eips.ethereum.org/EIPS/eip-173) /// for compatibility, the nomenclature for the 2-step ownership handover and roles /// may be unique to this codebase. abstract contract OwnableRoles is Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The `user`'s roles is updated to `roles`. /// Each bit of `roles` represents whether the role is set. event RolesUpdated(address indexed user, uint256 indexed roles); /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`. uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE = 0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The role slot of `user` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED)) /// let roleSlot := keccak256(0x00, 0x20) /// ``` /// This automatically ignores the upper bits of the `user` in case /// they are not clean, as well as keep the `keccak256` under 32-bytes. /// /// Note: This is equal to `_OWNER_SLOT_NOT` in for gas efficiency. uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Overwrite the roles directly without authorization guard. function _setRoles(address user, uint256 roles) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) // Store the new value. sstore(keccak256(0x0c, 0x20), roles) // Emit the {RolesUpdated} event. log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles) } } /// @dev Updates the roles directly without authorization guard. /// If `on` is true, each set bit of `roles` will be turned on, /// otherwise, each set bit of `roles` will be turned off. function _updateRoles(address user, uint256 roles, bool on) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) let roleSlot := keccak256(0x0c, 0x20) // Load the current value. let current := sload(roleSlot) // Compute the updated roles if `on` is true. let updated := or(current, roles) // Compute the updated roles if `on` is false. // Use `and` to compute the intersection of `current` and `roles`, // `xor` it with `current` to flip the bits in the intersection. if iszero(on) { updated := xor(current, and(current, roles)) } // Then, store the new value. sstore(roleSlot, updated) // Emit the {RolesUpdated} event. log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated) } } /// @dev Grants the roles directly without authorization guard. /// Each bit of `roles` represents the role to turn on. function _grantRoles(address user, uint256 roles) internal virtual { _updateRoles(user, roles, true); } /// @dev Removes the roles directly without authorization guard. /// Each bit of `roles` represents the role to turn off. function _removeRoles(address user, uint256 roles) internal virtual { _updateRoles(user, roles, false); } /// @dev Throws if the sender does not have any of the `roles`. function _checkRoles(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Throws if the sender is not the owner, /// and does not have any of the `roles`. /// Checks for ownership first, then lazily checks for roles. function _checkOwnerOrRoles(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner. // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } } /// @dev Throws if the sender does not have any of the `roles`, /// and is not the owner. /// Checks for roles first, then lazily checks for ownership. function _checkRolesOrOwner(uint256 roles) internal view virtual { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, caller()) // Load the stored value, and if the `and` intersection // of the value and `roles` is zero, revert. if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { // If the caller is not the stored owner. // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } } /// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`. /// This is meant for frontends like Etherscan, and is therefore not fully optimized. /// Not recommended to be called on-chain. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) { /// @solidity memory-safe-assembly assembly { for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } { // We don't need to mask the values of `ordinals`, as Solidity // cleans dirty upper bits when storing variables into memory. roles := or(shl(mload(add(ordinals, i)), 1), roles) } } } /// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap. /// This is meant for frontends like Etherscan, and is therefore not fully optimized. /// Not recommended to be called on-chain. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) { /// @solidity memory-safe-assembly assembly { // Grab the pointer to the free memory. ordinals := mload(0x40) let ptr := add(ordinals, 0x20) let o := 0 // The absence of lookup tables, De Bruijn, etc., here is intentional for // smaller bytecode, as this function is not meant to be called on-chain. for { let t := roles } 1 {} { mstore(ptr, o) // `shr` 5 is equivalent to multiplying by 0x20. // Push back into the ordinals array if the bit is set. ptr := add(ptr, shl(5, and(t, 1))) o := add(o, 1) t := shr(o, roles) if iszero(t) { break } } // Store the length of `ordinals`. mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20)))) // Allocate the memory. mstore(0x40, ptr) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to grant `user` `roles`. /// If the `user` already has a role, then it will be an no-op for the role. function grantRoles(address user, uint256 roles) public payable virtual onlyOwner { _grantRoles(user, roles); } /// @dev Allows the owner to remove `user` `roles`. /// If the `user` does not have a role, then it will be an no-op for the role. function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner { _removeRoles(user, roles); } /// @dev Allow the caller to remove their own roles. /// If the caller does not have a role, then it will be an no-op for the role. function renounceRoles(uint256 roles) public payable virtual { _removeRoles(msg.sender, roles); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the roles of `user`. function rolesOf(address user) public view virtual returns (uint256 roles) { /// @solidity memory-safe-assembly assembly { // Compute the role slot. mstore(0x0c, _ROLE_SLOT_SEED) mstore(0x00, user) // Load the stored value. roles := sload(keccak256(0x0c, 0x20)) } } /// @dev Returns whether `user` has any of `roles`. function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) { return rolesOf(user) & roles != 0; } /// @dev Returns whether `user` has all of `roles`. function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) { return rolesOf(user) & roles == roles; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by an account with `roles`. modifier onlyRoles(uint256 roles) virtual { _checkRoles(roles); _; } /// @dev Marks a function as only callable by the owner or by an account /// with `roles`. Checks for ownership first, then lazily checks for roles. modifier onlyOwnerOrRoles(uint256 roles) virtual { _checkOwnerOrRoles(roles); _; } /// @dev Marks a function as only callable by an account with `roles` /// or the owner. Checks for roles first, then lazily checks for ownership. modifier onlyRolesOrOwner(uint256 roles) virtual { _checkRolesOrOwner(roles); _; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ROLE CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // IYKYK uint256 internal constant _ROLE_0 = 1 << 0; uint256 internal constant _ROLE_1 = 1 << 1; uint256 internal constant _ROLE_2 = 1 << 2; uint256 internal constant _ROLE_3 = 1 << 3; uint256 internal constant _ROLE_4 = 1 << 4; uint256 internal constant _ROLE_5 = 1 << 5; uint256 internal constant _ROLE_6 = 1 << 6; uint256 internal constant _ROLE_7 = 1 << 7; uint256 internal constant _ROLE_8 = 1 << 8; uint256 internal constant _ROLE_9 = 1 << 9; uint256 internal constant _ROLE_10 = 1 << 10; uint256 internal constant _ROLE_11 = 1 << 11; uint256 internal constant _ROLE_12 = 1 << 12; uint256 internal constant _ROLE_13 = 1 << 13; uint256 internal constant _ROLE_14 = 1 << 14; uint256 internal constant _ROLE_15 = 1 << 15; uint256 internal constant _ROLE_16 = 1 << 16; uint256 internal constant _ROLE_17 = 1 << 17; uint256 internal constant _ROLE_18 = 1 << 18; uint256 internal constant _ROLE_19 = 1 << 19; uint256 internal constant _ROLE_20 = 1 << 20; uint256 internal constant _ROLE_21 = 1 << 21; uint256 internal constant _ROLE_22 = 1 << 22; uint256 internal constant _ROLE_23 = 1 << 23; uint256 internal constant _ROLE_24 = 1 << 24; uint256 internal constant _ROLE_25 = 1 << 25; uint256 internal constant _ROLE_26 = 1 << 26; uint256 internal constant _ROLE_27 = 1 << 27; uint256 internal constant _ROLE_28 = 1 << 28; uint256 internal constant _ROLE_29 = 1 << 29; uint256 internal constant _ROLE_30 = 1 << 30; uint256 internal constant _ROLE_31 = 1 << 31; uint256 internal constant _ROLE_32 = 1 << 32; uint256 internal constant _ROLE_33 = 1 << 33; uint256 internal constant _ROLE_34 = 1 << 34; uint256 internal constant _ROLE_35 = 1 << 35; uint256 internal constant _ROLE_36 = 1 << 36; uint256 internal constant _ROLE_37 = 1 << 37; uint256 internal constant _ROLE_38 = 1 << 38; uint256 internal constant _ROLE_39 = 1 << 39; uint256 internal constant _ROLE_40 = 1 << 40; uint256 internal constant _ROLE_41 = 1 << 41; uint256 internal constant _ROLE_42 = 1 << 42; uint256 internal constant _ROLE_43 = 1 << 43; uint256 internal constant _ROLE_44 = 1 << 44; uint256 internal constant _ROLE_45 = 1 << 45; uint256 internal constant _ROLE_46 = 1 << 46; uint256 internal constant _ROLE_47 = 1 << 47; uint256 internal constant _ROLE_48 = 1 << 48; uint256 internal constant _ROLE_49 = 1 << 49; uint256 internal constant _ROLE_50 = 1 << 50; uint256 internal constant _ROLE_51 = 1 << 51; uint256 internal constant _ROLE_52 = 1 << 52; uint256 internal constant _ROLE_53 = 1 << 53; uint256 internal constant _ROLE_54 = 1 << 54; uint256 internal constant _ROLE_55 = 1 << 55; uint256 internal constant _ROLE_56 = 1 << 56; uint256 internal constant _ROLE_57 = 1 << 57; uint256 internal constant _ROLE_58 = 1 << 58; uint256 internal constant _ROLE_59 = 1 << 59; uint256 internal constant _ROLE_60 = 1 << 60; uint256 internal constant _ROLE_61 = 1 << 61; uint256 internal constant _ROLE_62 = 1 << 62; uint256 internal constant _ROLE_63 = 1 << 63; uint256 internal constant _ROLE_64 = 1 << 64; uint256 internal constant _ROLE_65 = 1 << 65; uint256 internal constant _ROLE_66 = 1 << 66; uint256 internal constant _ROLE_67 = 1 << 67; uint256 internal constant _ROLE_68 = 1 << 68; uint256 internal constant _ROLE_69 = 1 << 69; uint256 internal constant _ROLE_70 = 1 << 70; uint256 internal constant _ROLE_71 = 1 << 71; uint256 internal constant _ROLE_72 = 1 << 72; uint256 internal constant _ROLE_73 = 1 << 73; uint256 internal constant _ROLE_74 = 1 << 74; uint256 internal constant _ROLE_75 = 1 << 75; uint256 internal constant _ROLE_76 = 1 << 76; uint256 internal constant _ROLE_77 = 1 << 77; uint256 internal constant _ROLE_78 = 1 << 78; uint256 internal constant _ROLE_79 = 1 << 79; uint256 internal constant _ROLE_80 = 1 << 80; uint256 internal constant _ROLE_81 = 1 << 81; uint256 internal constant _ROLE_82 = 1 << 82; uint256 internal constant _ROLE_83 = 1 << 83; uint256 internal constant _ROLE_84 = 1 << 84; uint256 internal constant _ROLE_85 = 1 << 85; uint256 internal constant _ROLE_86 = 1 << 86; uint256 internal constant _ROLE_87 = 1 << 87; uint256 internal constant _ROLE_88 = 1 << 88; uint256 internal constant _ROLE_89 = 1 << 89; uint256 internal constant _ROLE_90 = 1 << 90; uint256 internal constant _ROLE_91 = 1 << 91; uint256 internal constant _ROLE_92 = 1 << 92; uint256 internal constant _ROLE_93 = 1 << 93; uint256 internal constant _ROLE_94 = 1 << 94; uint256 internal constant _ROLE_95 = 1 << 95; uint256 internal constant _ROLE_96 = 1 << 96; uint256 internal constant _ROLE_97 = 1 << 97; uint256 internal constant _ROLE_98 = 1 << 98; uint256 internal constant _ROLE_99 = 1 << 99; uint256 internal constant _ROLE_100 = 1 << 100; uint256 internal constant _ROLE_101 = 1 << 101; uint256 internal constant _ROLE_102 = 1 << 102; uint256 internal constant _ROLE_103 = 1 << 103; uint256 internal constant _ROLE_104 = 1 << 104; uint256 internal constant _ROLE_105 = 1 << 105; uint256 internal constant _ROLE_106 = 1 << 106; uint256 internal constant _ROLE_107 = 1 << 107; uint256 internal constant _ROLE_108 = 1 << 108; uint256 internal constant _ROLE_109 = 1 << 109; uint256 internal constant _ROLE_110 = 1 << 110; uint256 internal constant _ROLE_111 = 1 << 111; uint256 internal constant _ROLE_112 = 1 << 112; uint256 internal constant _ROLE_113 = 1 << 113; uint256 internal constant _ROLE_114 = 1 << 114; uint256 internal constant _ROLE_115 = 1 << 115; uint256 internal constant _ROLE_116 = 1 << 116; uint256 internal constant _ROLE_117 = 1 << 117; uint256 internal constant _ROLE_118 = 1 << 118; uint256 internal constant _ROLE_119 = 1 << 119; uint256 internal constant _ROLE_120 = 1 << 120; uint256 internal constant _ROLE_121 = 1 << 121; uint256 internal constant _ROLE_122 = 1 << 122; uint256 internal constant _ROLE_123 = 1 << 123; uint256 internal constant _ROLE_124 = 1 << 124; uint256 internal constant _ROLE_125 = 1 << 125; uint256 internal constant _ROLE_126 = 1 << 126; uint256 internal constant _ROLE_127 = 1 << 127; uint256 internal constant _ROLE_128 = 1 << 128; uint256 internal constant _ROLE_129 = 1 << 129; uint256 internal constant _ROLE_130 = 1 << 130; uint256 internal constant _ROLE_131 = 1 << 131; uint256 internal constant _ROLE_132 = 1 << 132; uint256 internal constant _ROLE_133 = 1 << 133; uint256 internal constant _ROLE_134 = 1 << 134; uint256 internal constant _ROLE_135 = 1 << 135; uint256 internal constant _ROLE_136 = 1 << 136; uint256 internal constant _ROLE_137 = 1 << 137; uint256 internal constant _ROLE_138 = 1 << 138; uint256 internal constant _ROLE_139 = 1 << 139; uint256 internal constant _ROLE_140 = 1 << 140; uint256 internal constant _ROLE_141 = 1 << 141; uint256 internal constant _ROLE_142 = 1 << 142; uint256 internal constant _ROLE_143 = 1 << 143; uint256 internal constant _ROLE_144 = 1 << 144; uint256 internal constant _ROLE_145 = 1 << 145; uint256 internal constant _ROLE_146 = 1 << 146; uint256 internal constant _ROLE_147 = 1 << 147; uint256 internal constant _ROLE_148 = 1 << 148; uint256 internal constant _ROLE_149 = 1 << 149; uint256 internal constant _ROLE_150 = 1 << 150; uint256 internal constant _ROLE_151 = 1 << 151; uint256 internal constant _ROLE_152 = 1 << 152; uint256 internal constant _ROLE_153 = 1 << 153; uint256 internal constant _ROLE_154 = 1 << 154; uint256 internal constant _ROLE_155 = 1 << 155; uint256 internal constant _ROLE_156 = 1 << 156; uint256 internal constant _ROLE_157 = 1 << 157; uint256 internal constant _ROLE_158 = 1 << 158; uint256 internal constant _ROLE_159 = 1 << 159; uint256 internal constant _ROLE_160 = 1 << 160; uint256 internal constant _ROLE_161 = 1 << 161; uint256 internal constant _ROLE_162 = 1 << 162; uint256 internal constant _ROLE_163 = 1 << 163; uint256 internal constant _ROLE_164 = 1 << 164; uint256 internal constant _ROLE_165 = 1 << 165; uint256 internal constant _ROLE_166 = 1 << 166; uint256 internal constant _ROLE_167 = 1 << 167; uint256 internal constant _ROLE_168 = 1 << 168; uint256 internal constant _ROLE_169 = 1 << 169; uint256 internal constant _ROLE_170 = 1 << 170; uint256 internal constant _ROLE_171 = 1 << 171; uint256 internal constant _ROLE_172 = 1 << 172; uint256 internal constant _ROLE_173 = 1 << 173; uint256 internal constant _ROLE_174 = 1 << 174; uint256 internal constant _ROLE_175 = 1 << 175; uint256 internal constant _ROLE_176 = 1 << 176; uint256 internal constant _ROLE_177 = 1 << 177; uint256 internal constant _ROLE_178 = 1 << 178; uint256 internal constant _ROLE_179 = 1 << 179; uint256 internal constant _ROLE_180 = 1 << 180; uint256 internal constant _ROLE_181 = 1 << 181; uint256 internal constant _ROLE_182 = 1 << 182; uint256 internal constant _ROLE_183 = 1 << 183; uint256 internal constant _ROLE_184 = 1 << 184; uint256 internal constant _ROLE_185 = 1 << 185; uint256 internal constant _ROLE_186 = 1 << 186; uint256 internal constant _ROLE_187 = 1 << 187; uint256 internal constant _ROLE_188 = 1 << 188; uint256 internal constant _ROLE_189 = 1 << 189; uint256 internal constant _ROLE_190 = 1 << 190; uint256 internal constant _ROLE_191 = 1 << 191; uint256 internal constant _ROLE_192 = 1 << 192; uint256 internal constant _ROLE_193 = 1 << 193; uint256 internal constant _ROLE_194 = 1 << 194; uint256 internal constant _ROLE_195 = 1 << 195; uint256 internal constant _ROLE_196 = 1 << 196; uint256 internal constant _ROLE_197 = 1 << 197; uint256 internal constant _ROLE_198 = 1 << 198; uint256 internal constant _ROLE_199 = 1 << 199; uint256 internal constant _ROLE_200 = 1 << 200; uint256 internal constant _ROLE_201 = 1 << 201; uint256 internal constant _ROLE_202 = 1 << 202; uint256 internal constant _ROLE_203 = 1 << 203; uint256 internal constant _ROLE_204 = 1 << 204; uint256 internal constant _ROLE_205 = 1 << 205; uint256 internal constant _ROLE_206 = 1 << 206; uint256 internal constant _ROLE_207 = 1 << 207; uint256 internal constant _ROLE_208 = 1 << 208; uint256 internal constant _ROLE_209 = 1 << 209; uint256 internal constant _ROLE_210 = 1 << 210; uint256 internal constant _ROLE_211 = 1 << 211; uint256 internal constant _ROLE_212 = 1 << 212; uint256 internal constant _ROLE_213 = 1 << 213; uint256 internal constant _ROLE_214 = 1 << 214; uint256 internal constant _ROLE_215 = 1 << 215; uint256 internal constant _ROLE_216 = 1 << 216; uint256 internal constant _ROLE_217 = 1 << 217; uint256 internal constant _ROLE_218 = 1 << 218; uint256 internal constant _ROLE_219 = 1 << 219; uint256 internal constant _ROLE_220 = 1 << 220; uint256 internal constant _ROLE_221 = 1 << 221; uint256 internal constant _ROLE_222 = 1 << 222; uint256 internal constant _ROLE_223 = 1 << 223; uint256 internal constant _ROLE_224 = 1 << 224; uint256 internal constant _ROLE_225 = 1 << 225; uint256 internal constant _ROLE_226 = 1 << 226; uint256 internal constant _ROLE_227 = 1 << 227; uint256 internal constant _ROLE_228 = 1 << 228; uint256 internal constant _ROLE_229 = 1 << 229; uint256 internal constant _ROLE_230 = 1 << 230; uint256 internal constant _ROLE_231 = 1 << 231; uint256 internal constant _ROLE_232 = 1 << 232; uint256 internal constant _ROLE_233 = 1 << 233; uint256 internal constant _ROLE_234 = 1 << 234; uint256 internal constant _ROLE_235 = 1 << 235; uint256 internal constant _ROLE_236 = 1 << 236; uint256 internal constant _ROLE_237 = 1 << 237; uint256 internal constant _ROLE_238 = 1 << 238; uint256 internal constant _ROLE_239 = 1 << 239; uint256 internal constant _ROLE_240 = 1 << 240; uint256 internal constant _ROLE_241 = 1 << 241; uint256 internal constant _ROLE_242 = 1 << 242; uint256 internal constant _ROLE_243 = 1 << 243; uint256 internal constant _ROLE_244 = 1 << 244; uint256 internal constant _ROLE_245 = 1 << 245; uint256 internal constant _ROLE_246 = 1 << 246; uint256 internal constant _ROLE_247 = 1 << 247; uint256 internal constant _ROLE_248 = 1 << 248; uint256 internal constant _ROLE_249 = 1 << 249; uint256 internal constant _ROLE_250 = 1 << 250; uint256 internal constant _ROLE_251 = 1 << 251; uint256 internal constant _ROLE_252 = 1 << 252; uint256 internal constant _ROLE_253 = 1 << 253; uint256 internal constant _ROLE_254 = 1 << 254; uint256 internal constant _ROLE_255 = 1 << 255; }
// SPDX-License-Identifier: MIT // ERC721P Contracts v1.1 pragma solidity ^0.8.20; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155P { /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Arrays cannot be different lengths. */ error ArrayLengthMismatch(); /** * Cannot burn from the zero address. */ error BurnFromZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The quantity of tokens being burned is greater than account balance. */ error BurnExceedsBalance(); /** * The quantity of tokens being transferred is greater than account balance. */ error TransferExceedsBalance(); /** * The resulting token balance exceeds the maximum storable by ERC1155P */ error ExceedsMaximumBalance(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * Cannot safely transfer to a contract that does not implement the * ERC1155Receiver interface. */ error TransferToNonERC1155ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * Exceeds max token ID */ error ExceedsMaximumTokenId(); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); /** * @dev Emitted when `value` tokens of token 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 amount 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 `amount` tokens of token type `id` from `from` to `to`. * * 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 `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 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` 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 amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(not(_OWNER_SLOT_NOT), newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { /// @solidity memory-safe-assembly assembly { let ownerSlot := not(_OWNER_SLOT_NOT) // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(not(_OWNER_SLOT_NOT)) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
{ "remappings": [ "ERC1155P/=lib/ERC1155P/contracts/", "closedsea/=lib/closedsea/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "erc721a-upgradeable/=lib/closedsea/lib/erc721a-upgradeable/contracts/", "erc721a/=lib/closedsea/lib/erc721a/contracts/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/closedsea/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/", "operator-filter-registry/=lib/closedsea/lib/operator-filter-registry/", "solady/=lib/solady/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BurnExceedsBalance","type":"error"},{"inputs":[],"name":"BurnFromZeroAddress","type":"error"},{"inputs":[],"name":"ExceedsMaximumBalance","type":"error"},{"inputs":[],"name":"ExceedsMaximumTokenId","type":"error"},{"inputs":[],"name":"ExceedsMaximumTotalSupply","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"RoyaltyOverflow","type":"error"},{"inputs":[],"name":"RoyaltyReceiverIsZeroAddress","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferExceedsBalance","type":"error"},{"inputs":[],"name":"TransferToNonERC1155ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"roles","type":"uint256"}],"name":"RolesUpdated","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":[{"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":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"batchBurn","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":"batchMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"grantRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAllRoles","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAnyRole","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":"_approved","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":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"renounceRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"revokeRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"rolesOf","outputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","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":"amounts","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":"amount","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":"baseURI_","type":"string"}],"name":"setBaseURI","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":"uint256","name":"id","type":"uint256"}],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"_totalMinted","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"_totalSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040518060400160405280601081526020016f084cac2dcc4c2ce4098dedee84084def60831b815250604051806040016040528060048152602001632121262160e11b815250816000908162000069919062000230565b50600162000078828262000230565b506200008691505061271090565b6001600160601b0316600003620000e35760405162461bcd60e51b815260206004820152601f60248201527f4665652064656e6f6d696e61746f722063616e6e6f74206265207a65726f2e00604482015260640160405180910390fd5b620000ee3262000102565b620000fc326101f46200013e565b620002fc565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b6001600160601b031661271080821115620001615763350a88b36000526004601cfd5b8260601b80620001795763b4457eaa6000526004601cfd5b90911768aa4ec00224afccfdb7555050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620001b657607f821691505b602082108103620001d757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200022b57600081815260208120601f850160051c81016020861015620002065750805b601f850160051c820191505b81811015620002275782815560010162000212565b5050505b505050565b81516001600160401b038111156200024c576200024c6200018b565b62000264816200025d8454620001a1565b84620001dd565b602080601f8311600181146200029c5760008415620002835750858301515b600019600386901b1c1916600185901b17855562000227565b600085815260208120601f198616915b82811015620002cd57888601518255948401946001909101908401620002ac565b5085821015620002ec5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b612812806200030c6000396000f3fe6080604052600436106101ed5760003560e01c8063514e62fc1161010d578063a22cb465116100a0578063f242432a1161006f578063f242432a146105e1578063f2fde38b14610601578063f5298aca14610614578063f6eb127a14610634578063fee81cf41461065457600080fd5b8063a22cb46514610541578063bd85b03914610561578063e985e9c5146105ae578063f04e283e146105ce57600080fd5b8063715018a6116100dc578063715018a6146104a45780638da5cb5b146104ac57806395d89b41146104d85780639d7f4ebf146104ed57600080fd5b8063514e62fc1461043057806354d1f13d1461046757806355f804b31461046f5780636c0360eb1461048f57600080fd5b80631cd64df4116101855780632eb2c2d6116101545780632eb2c2d6146103b05780634a4ee7b1146103d05780634e1273f4146103e35780634f558e791461041057600080fd5b80631cd64df4146102ff57806325692962146103365780632a55205a1461033e5780632de948071461037d57600080fd5b80630e89341c116101c15780630e89341c14610299578063156e29f6146102b9578063183a4f6e146102d95780631c10893f146102ec57600080fd5b8062fdd58e146101f257806301ffc9a71461022557806306fdde03146102555780630ca8348014610277575b600080fd5b3480156101fe57600080fd5b5061021261020d366004611fe2565b610687565b6040519081526020015b60405180910390f35b34801561023157600080fd5b50610245610240366004612022565b6106b8565b604051901515815260200161021c565b34801561026157600080fd5b5061026a6106e7565b60405161021c919061208f565b34801561028357600080fd5b506102976102923660046120ee565b610775565b005b3480156102a557600080fd5b5061026a6102b436600461216f565b6107a5565b3480156102c557600080fd5b506102976102d4366004612188565b6108af565b6102976102e736600461216f565b6108db565b6102976102fa366004611fe2565b6108e8565b34801561030b57600080fd5b5061024561031a366004611fe2565b638b78c6d8600c90815260009290925260209091205481161490565b6102976108fe565b34801561034a57600080fd5b5061035e6103593660046121bb565b61094e565b604080516001600160a01b03909316835260208301919091520161021c565b34801561038957600080fd5b506102126103983660046121dd565b638b78c6d8600c908152600091909152602090205490565b3480156103bc57600080fd5b506102976103cb36600461229b565b6109a3565b6102976103de366004611fe2565b6109bb565b3480156103ef57600080fd5b506104036103fe366004612350565b6109cd565b60405161021c91906123bc565b34801561041c57600080fd5b5061024561042b36600461216f565b610aaf565b34801561043c57600080fd5b5061024561044b366004611fe2565b638b78c6d8600c90815260009290925260209091205416151590565b610297610b1b565b34801561047b57600080fd5b5061029761048a366004612400565b610b57565b34801561049b57600080fd5b5061026a610b71565b610297610b7e565b3480156104b857600080fd5b50638b78c6d819546040516001600160a01b03909116815260200161021c565b3480156104e457600080fd5b5061026a610b92565b3480156104f957600080fd5b5061021261050836600461216f565b60008160021c600f60fc1b1760005267ffffffff000000006003831660061b1b602060002054166003831660061b1c60201c9050919050565b34801561054d57600080fd5b5061029761055c366004612472565b610b9f565b34801561056d57600080fd5b5061021261057c36600461216f565b60008160021c600f60fc1b1760005263ffffffff6003831660061b1b602060002054166003831660061b1c9050919050565b3480156105ba57600080fd5b506102456105c93660046124ae565b610bf7565b6102976105dc3660046121dd565b610c1e565b3480156105ed57600080fd5b506102976105fc3660046124e1565b610c5b565b61029761060f3660046121dd565b610c6f565b34801561062057600080fd5b5061029761062f366004612188565b610c96565b34801561064057600080fd5b5061029761064f3660046120ee565b610cda565b34801561066057600080fd5b5061021261066f3660046121dd565b63389a75e1600c908152600091909152602090205490565b60006001600160a01b0383166106a7576106a76323d3ad8160e21b610d20565b6106b18383610d2a565b9392505050565b60006106c382610d63565b806106e15750632a55205a60e083901c9081146301ffc9a791909114175b92915050565b600080546106f490612553565b80601f016020809104026020016040519081016040528092919081815260200182805461072090612553565b801561076d5780601f106107425761010080835404028352916020019161076d565b820191906000526020600020905b81548152906001019060200180831161075057829003601f168201915b505050505081565b600161078081610d6e565b61079d868686868660405180602001604052806000815250610d94565b505050505050565b6000818152600260205260408120805460609291906107c390612553565b80601f01602080910402602001604051908101604052809291908181526020018280546107ef90612553565b801561083c5780601f106108115761010080835404028352916020019161083c565b820191906000526020600020905b81548152906001019060200180831161081f57829003601f168201915b50505050509050600061084d610fac565b905060008251116108a557805160000361087657604051806020016040528060008152506108a7565b806108808561103e565b60405160200161089192919061258d565b6040516020818303038152906040526108a7565b815b949350505050565b60016108ba81610d6e565b6108d584848460405180602001604052806000815250611082565b50505050565b6108e533826111d6565b50565b6108f06111e2565b6108fa82826111fd565b5050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b600082815268aa4ec00224afccfdb76020526040812054606081901c91906127109083610982576020515490508060601c93505b606084901b1884600019829004811182023d3d3e9396930204935090915050565b6109b287878787878787611209565b50505050505050565b6109c36111e2565b6108fa82826111d6565b60608382146109e6576109e663512509d360e11b610d20565b60008467ffffffffffffffff811115610a0157610a016121f8565b604051908082528060200260200182016040528015610a2a578160200160208202803683370190505b50905060005b85811015610aa557610a80878783818110610a4d57610a4d6125bc565b9050602002016020810190610a6291906121dd565b868684818110610a7457610a746125bc565b90506020020135610687565b828281518110610a9257610a926125bc565b6020908102919091010152600101610a30565b5095945050505050565b60405163bd85b03960e01b8152600481018290526000908190309063bd85b03990602401602060405180830381865afa158015610af0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1491906125d2565b1192915050565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b610b5f6111e2565b6003610b6c828483612631565b505050565b600380546106f490612553565b610b866111e2565b610b90600061141e565b565b600180546106f490612553565b336000528160601b60601c600d60fc1b17602052604060002060005280602052602051600051558160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31602080a35050565b6001600160a01b0391821660009081529116600d60fc1b1760205260408120908190525490565b610c266111e2565b63389a75e1600c52806000526020600c208054421115610c4e57636f5e88186000526004601cfd5b600090556108e58161141e565b610c68858585858561145c565b5050505050565b610c776111e2565b8060601b610c8d57637448fbae6000526004601cfd5b6108e58161141e565b6002610ca181610d6e565b6001600160a01b0384163314610ccf57610cbb8433610bf7565b610ccf57610ccf632ce44b5f60e11b610d20565b6108d58484846115c2565b6002610ce581610d6e565b6001600160a01b0386163314610d1357610cff8633610bf7565b610d1357610d13632ce44b5f60e11b610d20565b61079d86868686866116a0565b8060005260046000fd5b60008160031c8360601b60041c17600760fd1b1760005261ffff6007831660051b1b602060002054166007831660051b1c905092915050565b60006106e182611821565b638b78c6d8600c5233600052806020600c2054166108e5576382b429006000526004601cfd5b6001600160a01b038616610db157610db1622e076360e81b610d20565b838214610dc857610dc863512509d360e11b610d20565b33610dda81600089898989898961186f565b60008060005b87811015610f0057888882818110610dfa57610dfa6125bc565b905060200201359250868682818110610e1557610e156125bc565b90506020020135915060016001605f1b03831115610e3d57610e3d63467777f160e11b610d20565b81600003610e5557610e5563b562e8dd60e01b610d20565b6000610e618b85610d2a565b905082810161ffff811115610e8057610e80630b6cdf5d60e41b610d20565b81811015610e9857610e98630b6cdf5d60e41b610d20565b610ea38c8683611ae3565b6000610eaf8d87611b24565b905084810161ffff811115610ece57610ece630b6cdf5d60e41b610d20565b81811015610ee657610ee6630b6cdf5d60e41b610d20565b610ef18e8883611b62565b84600101945050505050610de0565b5060405160408152876020026060016020820152876040820152876020028960608301378588602002606083010152856020028789602002608084010137896000857f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8960400260800185a4506001600160a01b0389163b15610fa157610f8d60008a8a8a8a8a8a611ba8565b610fa157610fa1639c05499b60e01b610d20565b505050505050505050565b606060038054610fbb90612553565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe790612553565b80156110345780601f1061100957610100808354040283529160200191611034565b820191906000526020600020905b81548152906001019060200180831161101757829003601f168201915b5050505050905090565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806110585750819003601f19909101908152919050565b60016001605f1b038311156110a1576110a163467777f160e11b610d20565b6001600160a01b0384166110be576110be622e076360e81b610d20565b816000036110d6576110d663b562e8dd60e01b610d20565b336110e681600087878787611c94565b60006110f28686610d2a565b905083810161ffff81111561111157611111630b6cdf5d60e41b610d20565b8181101561112957611129630b6cdf5d60e41b610d20565b611134878783611ae3565b60006111408888611b24565b905085810161ffff81111561115f5761115f630b6cdf5d60e41b610d20565b8181101561117757611177630b6cdf5d60e41b610d20565b611182898983611b62565b604051888152876020820152896000877fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0389163b15610fa157610f8d60008a8a8a8a611e34565b6108fa82826000611ef2565b638b78c6d819543314610b90576382b429006000526004601cfd5b6108fa82826001611ef2565b6001600160a01b03861661122757611227633a954ecd60e21b610d20565b83821461123e5761123e63512509d360e11b610d20565b6001600160a01b038716331461126c576112588733610bf7565b61126c5761126c632ce44b5f60e11b610d20565b3361127d818989898989898961186f565b60005b8581101561137557600087878381811061129c5761129c6125bc565b90506020020135905060008686848181106112b9576112b96125bc565b90506020020135905060016001605f1b038211156112e1576112e163467777f160e11b610d20565b60006112ed8c84610d2a565b9050808211156113075761130763169b037b60e01b610d20565b8a6001600160a01b03168c6001600160a01b03161461136757600061132c8c85610d2a565b91839003918301905061ffff81111561134f5761134f630b6cdf5d60e41b610d20565b61135a8d8584611ae3565b6113658c8583611ae3565b505b836001019350505050611280565b50604051604081528560200260600160208201528560408201528560200287606083013783866020026060830101528360200285876020026080840101378789837f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8760400260800185a4506001600160a01b0387163b156114145761140088888888888888611ba8565b61141457611414639c05499b60e01b610d20565b5050505050505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b60016001605f1b0383111561147b5761147b63467777f160e11b610d20565b6001600160a01b03841661149957611499633a954ecd60e21b610d20565b6001600160a01b03851633146114c7576114b38533610bf7565b6114c7576114c7632ce44b5f60e11b610d20565b336114d6818787878787611c94565b60006114e28786610d2a565b9050808411156114fc576114fc63169b037b60e01b610d20565b856001600160a01b0316876001600160a01b03161461155c5760006115218787610d2a565b91859003918501905061ffff81111561154457611544630b6cdf5d60e41b610d20565b61154f888784611ae3565b61155a878783611ae3565b505b6040518581528460208201528688847fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0386163b156109b2576115ae8787878787611e34565b6109b2576109b2639c05499b60e01b610d20565b60016001605f1b038211156115e1576115e163467777f160e11b610d20565b6001600160a01b0383166115ff576115ff63b817eee760e01b610d20565b600033905061162281856000868660405180602001604052806000815250611c94565b600061162e8585610d2a565b9050808311156116485761164863588569f760e01b610d20565b829003611656858583611ae3565b604051848152836020820152600086847fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a450604080516020810190915260009052610c68565b6001600160a01b0385166116be576116be63b817eee760e01b610d20565b8281146116d5576116d563512509d360e11b610d20565b60003390506116fa81876000888888886040518060200160405280600081525061186f565b60005b848110156117a0576000868683818110611719576117196125bc565b9050602002013590506000858584818110611736576117366125bc565b90506020020135905060016001605f1b0382111561175e5761175e63467777f160e11b610d20565b600061176a8a84610d2a565b9050808211156117845761178463588569f760e01b610d20565b8190036117928a8483611ae3565b8360010193505050506116fd565b5060405160408152846020026060016020820152846040820152846020028660608301378285602002606083010152826020028486602002608084010137600087837f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8660400260800185a45060408051602081019091526000905261079d565b60006301ffc9a760e01b6001600160e01b0319831614806118525750636cdb3d1360e11b6001600160e01b03198316145b806106e15750506001600160e01b0319166303a24d0760e21b1490565b6001600160a01b038716611a065760005b84811015611a0457600086868381811061189c5761189c6125bc565b9050602002013590506000306001600160a01b031663bd85b039836040518263ffffffff1660e01b81526004016118d591815260200190565b602060405180830381865afa1580156118f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191691906125d2565b604051639d7f4ebf60e01b8152600481018490529091506000903090639d7f4ebf90602401602060405180830381865afa158015611958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197c91906125d2565b9050868685818110611990576119906125bc565b90506020020135820191508686858181106119ad576119ad6125bc565b905060200201358101905083600101935063ffffffff8211806119d3575063ffffffff81115b156119e8576119e8634da7efd760e11b610d20565b6119f28383611f4b565b6119fc8382611f85565b505050611880565b505b6001600160a01b0386166114145760005b84811015610fa1576000868683818110611a3357611a336125bc565b9050602002013590506000306001600160a01b031663bd85b039836040518263ffffffff1660e01b8152600401611a6c91815260200190565b602060405180830381865afa158015611a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aad91906125d2565b9050858584818110611ac157611ac16125bc565b9050602002013581039050826001019250611adc8282611f4b565b5050611a17565b8160031c8360601b60041c17600760fd1b176000526020600020600052806007831660051b1b6000515461ffff6007851660051b1b19161760005155505050565b60008160031c8360601b60041c17600760fd1b1760005263ffff00006007831660051b1b602060002054166007831660051b1c60101c905092915050565b8160031c8360601b60041c17600760fd1b1760005260206000206000528060101b6007831660051b1b6000515463ffff00006007851660051b1b19161760005155505050565b60405163bc197c8160e01b81526000906001600160a01b0388169063bc197c8190611be39033908c908b908b908b908b908b90600401612723565b6020604051808303816000875af1925050508015611c1e575060408051601f3d908101601f19168201909252611c1b91810190612785565b60015b611c73573d808015611c4c576040519150601f19603f3d011682016040523d82523d6000602084013e611c51565b606091505b508051600003611c6b57611c6b639c05499b60e01b610d20565b805181602001fd5b6001600160e01b03191663bc197c8160e01b1490505b979650505050505050565b6001600160a01b038516611db45760405163bd85b03960e01b815260048101849052600090309063bd85b03990602401602060405180830381865afa158015611ce1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0591906125d2565b604051639d7f4ebf60e01b8152600481018690529091506000903090639d7f4ebf90602401602060405180830381865afa158015611d47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6b91906125d2565b918401918401905063ffffffff821180611d88575063ffffffff81115b15611d9d57611d9d634da7efd760e11b610d20565b611da78583611f4b565b611db18582611f85565b50505b6001600160a01b03841661079d5760405163bd85b03960e01b815260048101849052600090309063bd85b03990602401602060405180830381865afa158015611e01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2591906125d2565b83900390506109b28482611f4b565b60405163f23a6e6160e01b81526000906001600160a01b0386169063f23a6e6190611e6b9033908a908990899089906004016127a2565b6020604051808303816000875af1925050508015611ea6575060408051601f3d908101601f19168201909252611ea391810190612785565b60015b611ed4573d808015611c4c576040519150601f19603f3d011682016040523d82523d6000602084013e611c51565b6001600160e01b03191663f23a6e6160e01b14905095945050505050565b638b78c6d8600c52826000526020600c20805483811783611f14575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3505050505050565b8160021c600f60fc1b176000526020600020600052806003831660061b1b6000515463ffffffff6003851660061b1b191617600051555050565b8160021c600f60fc1b1760005260206000206000528060201b6003831660061b1b6000515467ffffffff000000006003851660061b1b191617600051555050565b80356001600160a01b0381168114611fdd57600080fd5b919050565b60008060408385031215611ff557600080fd5b611ffe83611fc6565b946020939093013593505050565b6001600160e01b0319811681146108e557600080fd5b60006020828403121561203457600080fd5b81356106b18161200c565b60005b8381101561205a578181015183820152602001612042565b50506000910152565b6000815180845261207b81602086016020860161203f565b601f01601f19169290920160200192915050565b6020815260006106b16020830184612063565b60008083601f8401126120b457600080fd5b50813567ffffffffffffffff8111156120cc57600080fd5b6020830191508360208260051b85010111156120e757600080fd5b9250929050565b60008060008060006060868803121561210657600080fd5b61210f86611fc6565b9450602086013567ffffffffffffffff8082111561212c57600080fd5b61213889838a016120a2565b9096509450604088013591508082111561215157600080fd5b5061215e888289016120a2565b969995985093965092949392505050565b60006020828403121561218157600080fd5b5035919050565b60008060006060848603121561219d57600080fd5b6121a684611fc6565b95602085013595506040909401359392505050565b600080604083850312156121ce57600080fd5b50508035926020909101359150565b6000602082840312156121ef57600080fd5b6106b182611fc6565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261221f57600080fd5b813567ffffffffffffffff8082111561223a5761223a6121f8565b604051601f8301601f19908116603f01168101908282118183101715612262576122626121f8565b8160405283815286602085880101111561227b57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600080600060a0888a0312156122b657600080fd5b6122bf88611fc6565b96506122cd60208901611fc6565b9550604088013567ffffffffffffffff808211156122ea57600080fd5b6122f68b838c016120a2565b909750955060608a013591508082111561230f57600080fd5b61231b8b838c016120a2565b909550935060808a013591508082111561233457600080fd5b506123418a828b0161220e565b91505092959891949750929550565b6000806000806040858703121561236657600080fd5b843567ffffffffffffffff8082111561237e57600080fd5b61238a888389016120a2565b909650945060208701359150808211156123a357600080fd5b506123b0878288016120a2565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156123f4578351835292840192918401916001016123d8565b50909695505050505050565b6000806020838503121561241357600080fd5b823567ffffffffffffffff8082111561242b57600080fd5b818501915085601f83011261243f57600080fd5b81358181111561244e57600080fd5b86602082850101111561246057600080fd5b60209290920196919550909350505050565b6000806040838503121561248557600080fd5b61248e83611fc6565b9150602083013580151581146124a357600080fd5b809150509250929050565b600080604083850312156124c157600080fd5b6124ca83611fc6565b91506124d860208401611fc6565b90509250929050565b600080600080600060a086880312156124f957600080fd5b61250286611fc6565b945061251060208701611fc6565b93506040860135925060608601359150608086013567ffffffffffffffff81111561253a57600080fd5b6125468882890161220e565b9150509295509295909350565b600181811c9082168061256757607f821691505b60208210810361258757634e487b7160e01b600052602260045260246000fd5b50919050565b6000835161259f81846020880161203f565b8351908301906125b381836020880161203f565b01949350505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156125e457600080fd5b5051919050565b601f821115610b6c57600081815260208120601f850160051c810160208610156126125750805b601f850160051c820191505b8181101561079d5782815560010161261e565b67ffffffffffffffff831115612649576126496121f8565b61265d836126578354612553565b836125eb565b6000601f84116001811461269157600085156126795750838201355b600019600387901b1c1916600186901b178355610c68565b600083815260209020601f19861690835b828110156126c257868501358255602094850194600190920191016126a2565b50868210156126df5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835260006001600160fb1b0383111561270a57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0388811682528716602082015260a06040820181905260009061275090830187896126f1565b82810360608401526127638186886126f1565b905082810360808401526127778185612063565b9a9950505050505050505050565b60006020828403121561279757600080fd5b81516106b18161200c565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611c899083018461206356fea264697066735822122086ece95694caa9305ddcfddd037d914880b8511f543d3f78afc957fd1775428b64736f6c63430008140033
Deployed Bytecode
0x6080604052600436106101ed5760003560e01c8063514e62fc1161010d578063a22cb465116100a0578063f242432a1161006f578063f242432a146105e1578063f2fde38b14610601578063f5298aca14610614578063f6eb127a14610634578063fee81cf41461065457600080fd5b8063a22cb46514610541578063bd85b03914610561578063e985e9c5146105ae578063f04e283e146105ce57600080fd5b8063715018a6116100dc578063715018a6146104a45780638da5cb5b146104ac57806395d89b41146104d85780639d7f4ebf146104ed57600080fd5b8063514e62fc1461043057806354d1f13d1461046757806355f804b31461046f5780636c0360eb1461048f57600080fd5b80631cd64df4116101855780632eb2c2d6116101545780632eb2c2d6146103b05780634a4ee7b1146103d05780634e1273f4146103e35780634f558e791461041057600080fd5b80631cd64df4146102ff57806325692962146103365780632a55205a1461033e5780632de948071461037d57600080fd5b80630e89341c116101c15780630e89341c14610299578063156e29f6146102b9578063183a4f6e146102d95780631c10893f146102ec57600080fd5b8062fdd58e146101f257806301ffc9a71461022557806306fdde03146102555780630ca8348014610277575b600080fd5b3480156101fe57600080fd5b5061021261020d366004611fe2565b610687565b6040519081526020015b60405180910390f35b34801561023157600080fd5b50610245610240366004612022565b6106b8565b604051901515815260200161021c565b34801561026157600080fd5b5061026a6106e7565b60405161021c919061208f565b34801561028357600080fd5b506102976102923660046120ee565b610775565b005b3480156102a557600080fd5b5061026a6102b436600461216f565b6107a5565b3480156102c557600080fd5b506102976102d4366004612188565b6108af565b6102976102e736600461216f565b6108db565b6102976102fa366004611fe2565b6108e8565b34801561030b57600080fd5b5061024561031a366004611fe2565b638b78c6d8600c90815260009290925260209091205481161490565b6102976108fe565b34801561034a57600080fd5b5061035e6103593660046121bb565b61094e565b604080516001600160a01b03909316835260208301919091520161021c565b34801561038957600080fd5b506102126103983660046121dd565b638b78c6d8600c908152600091909152602090205490565b3480156103bc57600080fd5b506102976103cb36600461229b565b6109a3565b6102976103de366004611fe2565b6109bb565b3480156103ef57600080fd5b506104036103fe366004612350565b6109cd565b60405161021c91906123bc565b34801561041c57600080fd5b5061024561042b36600461216f565b610aaf565b34801561043c57600080fd5b5061024561044b366004611fe2565b638b78c6d8600c90815260009290925260209091205416151590565b610297610b1b565b34801561047b57600080fd5b5061029761048a366004612400565b610b57565b34801561049b57600080fd5b5061026a610b71565b610297610b7e565b3480156104b857600080fd5b50638b78c6d819546040516001600160a01b03909116815260200161021c565b3480156104e457600080fd5b5061026a610b92565b3480156104f957600080fd5b5061021261050836600461216f565b60008160021c600f60fc1b1760005267ffffffff000000006003831660061b1b602060002054166003831660061b1c60201c9050919050565b34801561054d57600080fd5b5061029761055c366004612472565b610b9f565b34801561056d57600080fd5b5061021261057c36600461216f565b60008160021c600f60fc1b1760005263ffffffff6003831660061b1b602060002054166003831660061b1c9050919050565b3480156105ba57600080fd5b506102456105c93660046124ae565b610bf7565b6102976105dc3660046121dd565b610c1e565b3480156105ed57600080fd5b506102976105fc3660046124e1565b610c5b565b61029761060f3660046121dd565b610c6f565b34801561062057600080fd5b5061029761062f366004612188565b610c96565b34801561064057600080fd5b5061029761064f3660046120ee565b610cda565b34801561066057600080fd5b5061021261066f3660046121dd565b63389a75e1600c908152600091909152602090205490565b60006001600160a01b0383166106a7576106a76323d3ad8160e21b610d20565b6106b18383610d2a565b9392505050565b60006106c382610d63565b806106e15750632a55205a60e083901c9081146301ffc9a791909114175b92915050565b600080546106f490612553565b80601f016020809104026020016040519081016040528092919081815260200182805461072090612553565b801561076d5780601f106107425761010080835404028352916020019161076d565b820191906000526020600020905b81548152906001019060200180831161075057829003601f168201915b505050505081565b600161078081610d6e565b61079d868686868660405180602001604052806000815250610d94565b505050505050565b6000818152600260205260408120805460609291906107c390612553565b80601f01602080910402602001604051908101604052809291908181526020018280546107ef90612553565b801561083c5780601f106108115761010080835404028352916020019161083c565b820191906000526020600020905b81548152906001019060200180831161081f57829003601f168201915b50505050509050600061084d610fac565b905060008251116108a557805160000361087657604051806020016040528060008152506108a7565b806108808561103e565b60405160200161089192919061258d565b6040516020818303038152906040526108a7565b815b949350505050565b60016108ba81610d6e565b6108d584848460405180602001604052806000815250611082565b50505050565b6108e533826111d6565b50565b6108f06111e2565b6108fa82826111fd565b5050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b600082815268aa4ec00224afccfdb76020526040812054606081901c91906127109083610982576020515490508060601c93505b606084901b1884600019829004811182023d3d3e9396930204935090915050565b6109b287878787878787611209565b50505050505050565b6109c36111e2565b6108fa82826111d6565b60608382146109e6576109e663512509d360e11b610d20565b60008467ffffffffffffffff811115610a0157610a016121f8565b604051908082528060200260200182016040528015610a2a578160200160208202803683370190505b50905060005b85811015610aa557610a80878783818110610a4d57610a4d6125bc565b9050602002016020810190610a6291906121dd565b868684818110610a7457610a746125bc565b90506020020135610687565b828281518110610a9257610a926125bc565b6020908102919091010152600101610a30565b5095945050505050565b60405163bd85b03960e01b8152600481018290526000908190309063bd85b03990602401602060405180830381865afa158015610af0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1491906125d2565b1192915050565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b610b5f6111e2565b6003610b6c828483612631565b505050565b600380546106f490612553565b610b866111e2565b610b90600061141e565b565b600180546106f490612553565b336000528160601b60601c600d60fc1b17602052604060002060005280602052602051600051558160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31602080a35050565b6001600160a01b0391821660009081529116600d60fc1b1760205260408120908190525490565b610c266111e2565b63389a75e1600c52806000526020600c208054421115610c4e57636f5e88186000526004601cfd5b600090556108e58161141e565b610c68858585858561145c565b5050505050565b610c776111e2565b8060601b610c8d57637448fbae6000526004601cfd5b6108e58161141e565b6002610ca181610d6e565b6001600160a01b0384163314610ccf57610cbb8433610bf7565b610ccf57610ccf632ce44b5f60e11b610d20565b6108d58484846115c2565b6002610ce581610d6e565b6001600160a01b0386163314610d1357610cff8633610bf7565b610d1357610d13632ce44b5f60e11b610d20565b61079d86868686866116a0565b8060005260046000fd5b60008160031c8360601b60041c17600760fd1b1760005261ffff6007831660051b1b602060002054166007831660051b1c905092915050565b60006106e182611821565b638b78c6d8600c5233600052806020600c2054166108e5576382b429006000526004601cfd5b6001600160a01b038616610db157610db1622e076360e81b610d20565b838214610dc857610dc863512509d360e11b610d20565b33610dda81600089898989898961186f565b60008060005b87811015610f0057888882818110610dfa57610dfa6125bc565b905060200201359250868682818110610e1557610e156125bc565b90506020020135915060016001605f1b03831115610e3d57610e3d63467777f160e11b610d20565b81600003610e5557610e5563b562e8dd60e01b610d20565b6000610e618b85610d2a565b905082810161ffff811115610e8057610e80630b6cdf5d60e41b610d20565b81811015610e9857610e98630b6cdf5d60e41b610d20565b610ea38c8683611ae3565b6000610eaf8d87611b24565b905084810161ffff811115610ece57610ece630b6cdf5d60e41b610d20565b81811015610ee657610ee6630b6cdf5d60e41b610d20565b610ef18e8883611b62565b84600101945050505050610de0565b5060405160408152876020026060016020820152876040820152876020028960608301378588602002606083010152856020028789602002608084010137896000857f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8960400260800185a4506001600160a01b0389163b15610fa157610f8d60008a8a8a8a8a8a611ba8565b610fa157610fa1639c05499b60e01b610d20565b505050505050505050565b606060038054610fbb90612553565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe790612553565b80156110345780601f1061100957610100808354040283529160200191611034565b820191906000526020600020905b81548152906001019060200180831161101757829003601f168201915b5050505050905090565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806110585750819003601f19909101908152919050565b60016001605f1b038311156110a1576110a163467777f160e11b610d20565b6001600160a01b0384166110be576110be622e076360e81b610d20565b816000036110d6576110d663b562e8dd60e01b610d20565b336110e681600087878787611c94565b60006110f28686610d2a565b905083810161ffff81111561111157611111630b6cdf5d60e41b610d20565b8181101561112957611129630b6cdf5d60e41b610d20565b611134878783611ae3565b60006111408888611b24565b905085810161ffff81111561115f5761115f630b6cdf5d60e41b610d20565b8181101561117757611177630b6cdf5d60e41b610d20565b611182898983611b62565b604051888152876020820152896000877fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0389163b15610fa157610f8d60008a8a8a8a611e34565b6108fa82826000611ef2565b638b78c6d819543314610b90576382b429006000526004601cfd5b6108fa82826001611ef2565b6001600160a01b03861661122757611227633a954ecd60e21b610d20565b83821461123e5761123e63512509d360e11b610d20565b6001600160a01b038716331461126c576112588733610bf7565b61126c5761126c632ce44b5f60e11b610d20565b3361127d818989898989898961186f565b60005b8581101561137557600087878381811061129c5761129c6125bc565b90506020020135905060008686848181106112b9576112b96125bc565b90506020020135905060016001605f1b038211156112e1576112e163467777f160e11b610d20565b60006112ed8c84610d2a565b9050808211156113075761130763169b037b60e01b610d20565b8a6001600160a01b03168c6001600160a01b03161461136757600061132c8c85610d2a565b91839003918301905061ffff81111561134f5761134f630b6cdf5d60e41b610d20565b61135a8d8584611ae3565b6113658c8583611ae3565b505b836001019350505050611280565b50604051604081528560200260600160208201528560408201528560200287606083013783866020026060830101528360200285876020026080840101378789837f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8760400260800185a4506001600160a01b0387163b156114145761140088888888888888611ba8565b61141457611414639c05499b60e01b610d20565b5050505050505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b60016001605f1b0383111561147b5761147b63467777f160e11b610d20565b6001600160a01b03841661149957611499633a954ecd60e21b610d20565b6001600160a01b03851633146114c7576114b38533610bf7565b6114c7576114c7632ce44b5f60e11b610d20565b336114d6818787878787611c94565b60006114e28786610d2a565b9050808411156114fc576114fc63169b037b60e01b610d20565b856001600160a01b0316876001600160a01b03161461155c5760006115218787610d2a565b91859003918501905061ffff81111561154457611544630b6cdf5d60e41b610d20565b61154f888784611ae3565b61155a878783611ae3565b505b6040518581528460208201528688847fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0386163b156109b2576115ae8787878787611e34565b6109b2576109b2639c05499b60e01b610d20565b60016001605f1b038211156115e1576115e163467777f160e11b610d20565b6001600160a01b0383166115ff576115ff63b817eee760e01b610d20565b600033905061162281856000868660405180602001604052806000815250611c94565b600061162e8585610d2a565b9050808311156116485761164863588569f760e01b610d20565b829003611656858583611ae3565b604051848152836020820152600086847fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a450604080516020810190915260009052610c68565b6001600160a01b0385166116be576116be63b817eee760e01b610d20565b8281146116d5576116d563512509d360e11b610d20565b60003390506116fa81876000888888886040518060200160405280600081525061186f565b60005b848110156117a0576000868683818110611719576117196125bc565b9050602002013590506000858584818110611736576117366125bc565b90506020020135905060016001605f1b0382111561175e5761175e63467777f160e11b610d20565b600061176a8a84610d2a565b9050808211156117845761178463588569f760e01b610d20565b8190036117928a8483611ae3565b8360010193505050506116fd565b5060405160408152846020026060016020820152846040820152846020028660608301378285602002606083010152826020028486602002608084010137600087837f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8660400260800185a45060408051602081019091526000905261079d565b60006301ffc9a760e01b6001600160e01b0319831614806118525750636cdb3d1360e11b6001600160e01b03198316145b806106e15750506001600160e01b0319166303a24d0760e21b1490565b6001600160a01b038716611a065760005b84811015611a0457600086868381811061189c5761189c6125bc565b9050602002013590506000306001600160a01b031663bd85b039836040518263ffffffff1660e01b81526004016118d591815260200190565b602060405180830381865afa1580156118f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191691906125d2565b604051639d7f4ebf60e01b8152600481018490529091506000903090639d7f4ebf90602401602060405180830381865afa158015611958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197c91906125d2565b9050868685818110611990576119906125bc565b90506020020135820191508686858181106119ad576119ad6125bc565b905060200201358101905083600101935063ffffffff8211806119d3575063ffffffff81115b156119e8576119e8634da7efd760e11b610d20565b6119f28383611f4b565b6119fc8382611f85565b505050611880565b505b6001600160a01b0386166114145760005b84811015610fa1576000868683818110611a3357611a336125bc565b9050602002013590506000306001600160a01b031663bd85b039836040518263ffffffff1660e01b8152600401611a6c91815260200190565b602060405180830381865afa158015611a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aad91906125d2565b9050858584818110611ac157611ac16125bc565b9050602002013581039050826001019250611adc8282611f4b565b5050611a17565b8160031c8360601b60041c17600760fd1b176000526020600020600052806007831660051b1b6000515461ffff6007851660051b1b19161760005155505050565b60008160031c8360601b60041c17600760fd1b1760005263ffff00006007831660051b1b602060002054166007831660051b1c60101c905092915050565b8160031c8360601b60041c17600760fd1b1760005260206000206000528060101b6007831660051b1b6000515463ffff00006007851660051b1b19161760005155505050565b60405163bc197c8160e01b81526000906001600160a01b0388169063bc197c8190611be39033908c908b908b908b908b908b90600401612723565b6020604051808303816000875af1925050508015611c1e575060408051601f3d908101601f19168201909252611c1b91810190612785565b60015b611c73573d808015611c4c576040519150601f19603f3d011682016040523d82523d6000602084013e611c51565b606091505b508051600003611c6b57611c6b639c05499b60e01b610d20565b805181602001fd5b6001600160e01b03191663bc197c8160e01b1490505b979650505050505050565b6001600160a01b038516611db45760405163bd85b03960e01b815260048101849052600090309063bd85b03990602401602060405180830381865afa158015611ce1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0591906125d2565b604051639d7f4ebf60e01b8152600481018690529091506000903090639d7f4ebf90602401602060405180830381865afa158015611d47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6b91906125d2565b918401918401905063ffffffff821180611d88575063ffffffff81115b15611d9d57611d9d634da7efd760e11b610d20565b611da78583611f4b565b611db18582611f85565b50505b6001600160a01b03841661079d5760405163bd85b03960e01b815260048101849052600090309063bd85b03990602401602060405180830381865afa158015611e01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2591906125d2565b83900390506109b28482611f4b565b60405163f23a6e6160e01b81526000906001600160a01b0386169063f23a6e6190611e6b9033908a908990899089906004016127a2565b6020604051808303816000875af1925050508015611ea6575060408051601f3d908101601f19168201909252611ea391810190612785565b60015b611ed4573d808015611c4c576040519150601f19603f3d011682016040523d82523d6000602084013e611c51565b6001600160e01b03191663f23a6e6160e01b14905095945050505050565b638b78c6d8600c52826000526020600c20805483811783611f14575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26600080a3505050505050565b8160021c600f60fc1b176000526020600020600052806003831660061b1b6000515463ffffffff6003851660061b1b191617600051555050565b8160021c600f60fc1b1760005260206000206000528060201b6003831660061b1b6000515467ffffffff000000006003851660061b1b191617600051555050565b80356001600160a01b0381168114611fdd57600080fd5b919050565b60008060408385031215611ff557600080fd5b611ffe83611fc6565b946020939093013593505050565b6001600160e01b0319811681146108e557600080fd5b60006020828403121561203457600080fd5b81356106b18161200c565b60005b8381101561205a578181015183820152602001612042565b50506000910152565b6000815180845261207b81602086016020860161203f565b601f01601f19169290920160200192915050565b6020815260006106b16020830184612063565b60008083601f8401126120b457600080fd5b50813567ffffffffffffffff8111156120cc57600080fd5b6020830191508360208260051b85010111156120e757600080fd5b9250929050565b60008060008060006060868803121561210657600080fd5b61210f86611fc6565b9450602086013567ffffffffffffffff8082111561212c57600080fd5b61213889838a016120a2565b9096509450604088013591508082111561215157600080fd5b5061215e888289016120a2565b969995985093965092949392505050565b60006020828403121561218157600080fd5b5035919050565b60008060006060848603121561219d57600080fd5b6121a684611fc6565b95602085013595506040909401359392505050565b600080604083850312156121ce57600080fd5b50508035926020909101359150565b6000602082840312156121ef57600080fd5b6106b182611fc6565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261221f57600080fd5b813567ffffffffffffffff8082111561223a5761223a6121f8565b604051601f8301601f19908116603f01168101908282118183101715612262576122626121f8565b8160405283815286602085880101111561227b57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600080600060a0888a0312156122b657600080fd5b6122bf88611fc6565b96506122cd60208901611fc6565b9550604088013567ffffffffffffffff808211156122ea57600080fd5b6122f68b838c016120a2565b909750955060608a013591508082111561230f57600080fd5b61231b8b838c016120a2565b909550935060808a013591508082111561233457600080fd5b506123418a828b0161220e565b91505092959891949750929550565b6000806000806040858703121561236657600080fd5b843567ffffffffffffffff8082111561237e57600080fd5b61238a888389016120a2565b909650945060208701359150808211156123a357600080fd5b506123b0878288016120a2565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156123f4578351835292840192918401916001016123d8565b50909695505050505050565b6000806020838503121561241357600080fd5b823567ffffffffffffffff8082111561242b57600080fd5b818501915085601f83011261243f57600080fd5b81358181111561244e57600080fd5b86602082850101111561246057600080fd5b60209290920196919550909350505050565b6000806040838503121561248557600080fd5b61248e83611fc6565b9150602083013580151581146124a357600080fd5b809150509250929050565b600080604083850312156124c157600080fd5b6124ca83611fc6565b91506124d860208401611fc6565b90509250929050565b600080600080600060a086880312156124f957600080fd5b61250286611fc6565b945061251060208701611fc6565b93506040860135925060608601359150608086013567ffffffffffffffff81111561253a57600080fd5b6125468882890161220e565b9150509295509295909350565b600181811c9082168061256757607f821691505b60208210810361258757634e487b7160e01b600052602260045260246000fd5b50919050565b6000835161259f81846020880161203f565b8351908301906125b381836020880161203f565b01949350505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156125e457600080fd5b5051919050565b601f821115610b6c57600081815260208120601f850160051c810160208610156126125750805b601f850160051c820191505b8181101561079d5782815560010161261e565b67ffffffffffffffff831115612649576126496121f8565b61265d836126578354612553565b836125eb565b6000601f84116001811461269157600085156126795750838201355b600019600387901b1c1916600186901b178355610c68565b600083815260209020601f19861690835b828110156126c257868501358255602094850194600190920191016126a2565b50868210156126df5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835260006001600160fb1b0383111561270a57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0388811682528716602082015260a06040820181905260009061275090830187896126f1565b82810360608401526127638186886126f1565b905082810360808401526127778185612063565b9a9950505050505050505050565b60006020828403121561279757600080fd5b81516106b18161200c565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611c899083018461206356fea264697066735822122086ece95694caa9305ddcfddd037d914880b8511f543d3f78afc957fd1775428b64736f6c63430008140033
Loading...
Loading
Loading...
Loading
[ 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.